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

一个券时,可以取消券

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