提交 10adfd58 编写于 作者: guangjun.yang's avatar guangjun.yang

请选择优惠券

上级 221032ee
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
<img @click="cancle" src="../../images/cme/close.png" /> <img @click="cancle" src="../../images/cme/close.png" />
</article> </article>
<article v-if="selectCouponList.length" class="list-wrapper"> <article v-if="selectCouponList.length" class="list-wrapper">
<p v-if="currentCoupon.couponId"> <p v-if="currentCouponInfo.couponId">
已选择1张优惠券,共抵扣 已选择1张优惠券,共抵扣
<span class="sc thin">¥{{yuan(currentCoupon.discountAmount)}}</span> <span class="sc thin">¥{{yuan(currentCouponInfo.discountAmount)}}</span>
</p> </p>
<p v-else-if="goodsInfo4Coupon.count"> <p v-else-if="goodsInfo4Coupon.count">
请选择优惠券 请选择优惠券
...@@ -81,21 +81,33 @@ export default { ...@@ -81,21 +81,33 @@ export default {
}, },
// //
watch: { // watch: {
isShowCoupon: { // showSelectCoupon: {
handler(newVal) { // handler(newVal) {
// 如果打开了选择弹框,则重新选中已经选中的项目 // console.log('showSelectCoupon');
if (newVal) { // // 如果打开了选择弹框,则重新选中已经选中的项目
this.currentCouponInfo = this.currentCoupon; // if (newVal) {
} // this.currentCouponInfo = this.currentCoupon;
} // }
}, // }
}, // },
// },
computed: { computed: {
...mapGetters(['currentCoupon', 'goodsInfo4Coupon', 'selectCouponList']), ...mapGetters(['currentCoupon', 'goodsInfo4Coupon', 'selectCouponList']),
isShow: { isShow: {
get() { get() {
console.log('showSelectCoupon', this.showSelectCoupon);
if(this.showSelectCoupon) {
if(this.currentCoupon && this.currentCoupon.couponId) {
let index = this.selectCouponList.findIndex( item => {
return item.couponId = this.currentCoupon.couponId
});
this.currentCoupon.isChecked = true;
this.selectCouponList.splice(index, 1, this.currentCoupon);
}
this.currentCouponInfo = this.currentCoupon;
}
return this.showSelectCoupon; return this.showSelectCoupon;
}, },
set() {} set() {}
...@@ -124,7 +136,8 @@ export default { ...@@ -124,7 +136,8 @@ export default {
cItem.isChecked = false; cItem.isChecked = false;
}); });
item.isChecked = true; item.isChecked = true;
this.currentCouponInfo = JSON.parse(JSON.stringify(item)); // this.currentCouponInfo = JSON.parse(JSON.stringify(item));
this.currentCouponInfo = item;
} else { } else {
this.currentCouponInfo = {}; this.currentCouponInfo = {};
item.isChecked = false; item.isChecked = false;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册