中品云站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

155 lines
3.3 KiB

<template>
<view class="page-content" style="background:#eff3f4;overflow: hidden;">
<cu-custom class="bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="content">促销编辑</block>
<block slot="backText">返回</block>
</cu-custom>
<view class="main-money margin margin-bottom-0 radius bg-white cuxiao">
<view class="cu-card case no-card ">
<view class="cuxiao-switch">
<text>促销优惠开关</text>
<switch class="red" v-model="site.activitySwitch" :checked="site.activitySwitch" @change="switchChange" style="transform: scale(0.8);"/>
</view>
<view class="cuxiao-text">
<text>促销优惠内容:</text>
<textarea maxlength="20" class="textarea" v-model="site.activityContent" placeholder="请输入优惠信息(≤20字)"></textarea>
</view>
</view>
<button class="bg-main-oil cuxiao-bottom" @tap="update">
确认编辑
</button>
</view>
</view>
</template>
<script>
import cloudSiteApi from '@/api/cloud-site.js'
import OilMenuItem from '@/components/oil-menu-item.vue'
import oliSiteApi from '@/api/oli-site.js'
export default {
components: {
OilMenuItem
},
data() {
return {
mainURL: this.global.mainURL,
title: 'Hello',
site: {},
oilSiteId:'',
oilList: []
}
},
onLoad() {
this.oilSiteId = uni.getStorageSync('oilSitePriceId')
this.getSiteInfo()
uni.showShareMenu()
},
methods: {
getSiteInfo(){
console.log(this.oilSiteId,'qqqqqqqqqq')
oliSiteApi.getPrice(this.oilSiteId).then(res => {
if (res.code === 20000) {
this.site = res.data
}
})
},
switchChange(e){
if(e.detail.value){
this.site.activitySwitch = 1
}else{
this.site.activitySwitch = 0
}
console.log(e.detail.value,'dayineeeeeeeeeeeeeeeeeeee')
},
update(){
if(this.site.activitySwitch && !this.site.activityContent){
uni.showToast({
title:'请输入促销优惠内容'
})
return
}
if(!this.site.activitySwitch && !this.site.activityContent){
this.site.activityContent = '暂无'
}
oliSiteApi.update(this.site).then(res => {
if (res.code === 20000) {
uni.navigateBack()
}else{
return
}
uni.showToast({
title:res.msg
})
})
}
}
};
</script>
<style scopeds>
.cu-card.case.no-card .image {
margin: 0;
}
.bg-view {
height: 300rpx;
min-width: 100%;
position: absolute;
}
.position-re {}
image {
vertical-align: bottom;
background-color: rgba(113, 11, 233, 0.5)
}
.image {
border-radius: initial;
vertical-align: bottom;
background-color: rgba(11, 11, 251, 0.7)
}
.move-top {
margin-top: -2px;
}
.position-call {
position: absolute;
right: 30upx;
bottom: 30upx;
}
.cuxiao{
height: 100%;
position: absolute;
width: 90%;
left: 50%;
margin-left: -45%;
padding: 75rpx 40rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.cuxiao-switch{
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 60rpx;
}
.cuxiao-switch text,.cuxiao-text text{
font-size: 32rpx;
}
.cuxiao-text textarea{
border: 1px solid #e4e4e4;
width: 100%;
border-radius: 5px;
margin-top: 30rpx;
padding: 15px;
}
.cuxiao-bottom{
margin-bottom: 150px;
width: 100%;
}
</style>