Commit ebd721c8 authored by 潘永坪's avatar 潘永坪

一个券时,可以取消券

parent bc469a3e
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
</view> </view>
<!----------------------------------------------------可用------------------------------------------> <!----------------------------------------------------可用------------------------------------------>
<view v-show="active==0"> <view v-show="active==0">
<view class="middle" v-if="couponList.usableCouponList&&couponList.usableCouponList.length>0"> <view class="middle">
<radio-group @change="radioChange"> <radio-group @change="radioChange" v-if="couponList.usableCouponList&&couponList.usableCouponList.length>1">
<view v-for="(item,index) of couponList.usableCouponList" :key="index" class="listBox"> <view v-for="(item,index) of couponList.usableCouponList" :key="index" class="listBox">
<label> <label>
<view> <view>
...@@ -34,6 +34,28 @@ ...@@ -34,6 +34,28 @@
</label> </label>
</view> </view>
</radio-group> </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>
{{item.couponRule}}
</view>
<view>
{{item.useStartDate}}-{{item.useEndDate}}
<text>
<text>¥</text>{{parseFloat(item.savedMoney.toFixed(2))}}
</text>
</view>
</label>
</view>
</checkbox-group>
</view> </view>
<view class="empty" v-if="!couponList.usableCouponList||couponList.usableCouponList.length==0"> <view class="empty" v-if="!couponList.usableCouponList||couponList.usableCouponList.length==0">
...@@ -118,6 +140,17 @@ ...@@ -118,6 +140,17 @@
this.$emit("couponChoose",this.chooseCoupon) this.$emit("couponChoose",this.chooseCoupon)
} }
}, },
//---多选框值变化
checkboxChange(evt){
if(evt.detail.value){
this.chooseCoupon=this.couponList.usableCouponList.find((item)=>{
return item.couponId==evt.detail.value
})
this.$emit("couponChoose",this.chooseCoupon)
}else{
this.$emit("couponChoose","")
}
},
cancelCoupon(){//------------------------------------取消选中优惠券 cancelCoupon(){//------------------------------------取消选中优惠券
this.chooseCoupon="" this.chooseCoupon=""
this.show=false this.show=false
......
...@@ -291,8 +291,13 @@ ...@@ -291,8 +291,13 @@
}, 1500) }, 1500)
}, },
couponChoose(data) { //---子组件券选择之后触发的事件 couponChoose(data) { //---子组件券选择之后触发的事件
if(data){
this.chooseCouponObj = data this.chooseCouponObj = data
this.savedMoney=this.chooseCouponObj.savedMoney||0 this.savedMoney=this.chooseCouponObj.savedMoney||0
}else{
this.chooseCouponObj = ""
this.savedMoney=0
}
}, },
showCoupon() { //---展示券列表 showCoupon() { //---展示券列表
......
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