Commit 1333ed32 authored by 潘永坪's avatar 潘永坪

优惠券功能改成了可取消

parent ebd721c8
...@@ -13,34 +13,12 @@ ...@@ -13,34 +13,12 @@
<!----------------------------------------------------可用------------------------------------------> <!----------------------------------------------------可用------------------------------------------>
<view v-show="active==0"> <view v-show="active==0">
<view class="middle"> <view class="middle">
<radio-group @change="radioChange" v-if="couponList.usableCouponList&&couponList.usableCouponList.length>1"> <checkbox-group @change="checkboxChange" v-if="couponList.masterSlaveCouponList&&couponList.masterSlaveCouponList.length>0">
<view v-for="(item,index) of couponList.usableCouponList" :key="index" class="listBox"> <view v-for="(item,index) of couponList.masterSlaveCouponList" :key="index" class="listBox">
<label> <label class="listLabel">
<view> <view>
{{item.couponName}} {{item.couponName}}
<radio :value="item.couponId" :checked="item.couponId==chooseCoupon.couponId"/> <checkbox :value="item.couponId" :checked="item.couponId==chooseCoupon.couponId" />
</view>
<view>
{{item.couponRule}}
</view>
<view>
{{item.useStartDate}}-{{item.useEndDate}}
<text>
<text>¥</text>{{parseFloat(item.savedMoney.toFixed(2))}}
</text>
</view>
</label>
</view>
</radio-group>
<checkbox-group @change="checkboxChange" v-if="couponList.usableCouponList&&couponList.usableCouponList.length==1">
<view v-for="(item,index) of couponList.usableCouponList" :key="index" class="listBox">
<label>
<view>
{{item.couponName}}
<checkbox :value="item.couponId" :checked="true" />
</view> </view>
<view> <view>
{{item.couponRule}} {{item.couponRule}}
...@@ -54,11 +32,10 @@ ...@@ -54,11 +32,10 @@
</view> </view>
</label> </label>
</view> </view>
</checkbox-group> </checkbox-group>
</view> </view>
<view class="empty" v-if="!couponList.usableCouponList||couponList.usableCouponList.length==0"> <view class="empty" v-if="!couponList.masterSlaveCouponList||couponList.masterSlaveCouponList.length==0">
空空如也... 空空如也...
</view> </view>
</view> </view>
...@@ -131,30 +108,24 @@ ...@@ -131,30 +108,24 @@
showCoupon(){//----------------------------------------展示弹窗 showCoupon(){//----------------------------------------展示弹窗
this.show=true this.show=true
}, },
radioChange(evt) {//-------------------------单选框值变化
if(evt.detail.value){
this.chooseCoupon=this.couponList.usableCouponList.find((item)=>{
return item.couponId==evt.detail.value
})
this.show=false
this.$emit("couponChoose",this.chooseCoupon)
}
},
//---多选框值变化 //---多选框值变化
checkboxChange(evt){ checkboxChange(evt){
if(evt.detail.value){ if(evt.detail.value.length==2){
this.chooseCoupon=this.couponList.usableCouponList.find((item)=>{ //删除第一个
return item.couponId==evt.detail.value evt.detail.value.splice(0,1)
//获取选中券,传值给父组件
this.chooseCoupon=this.couponList.masterSlaveCouponList.find((item)=>{
return item.couponId==evt.detail.value[0]
})
this.$emit("couponChoose",this.chooseCoupon)
}else if(evt.detail.value.length==1){
this.chooseCoupon=this.couponList.masterSlaveCouponList.find((item)=>{
return item.couponId==evt.detail.value[0]
}) })
this.$emit("couponChoose",this.chooseCoupon) this.$emit("couponChoose",this.chooseCoupon)
}else{ }else if(evt.detail.value.length==0){
this.$emit("couponChoose","") this.$emit("couponChoose","")
} }
},
cancelCoupon(){//------------------------------------取消选中优惠券
this.chooseCoupon=""
this.show=false
this.$emit("couponChoose",this.chooseCoupon)
} }
} }
} }
...@@ -168,7 +139,7 @@ ...@@ -168,7 +139,7 @@
.titleContent view text{width: 40rpx;height: 6rpx;background:$title-color;border-radius:6rpx;display:inline-block;position: relative;top:-10rpx;} .titleContent view text{width: 40rpx;height: 6rpx;background:$title-color;border-radius:6rpx;display:inline-block;position: relative;top:-10rpx;}
.middle{padding:24rpx;background:#f5f5f5;} .middle{padding:24rpx;background:#f5f5f5;}
.listBox{background: #FFFFFF;padding:24rpx;border-radius:10rpx;} .listBox{background: #FFFFFF;padding:24rpx;border-radius:10rpx;}
.middle .listBox:not(:first-child){margin-top:20rpx;} .middle .listBox:not(:first-child){margin-top:20rpx;}
.middle view view:not(:first-child){margin-top:20rpx;} .middle view view:not(:first-child){margin-top:20rpx;}
.middle view view{display: flex;justify-content: space-between;} .middle view view{display: flex;justify-content: space-between;}
.middle view view:first-child{font-weight: bold;} .middle view view:first-child{font-weight: bold;}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment