|
@@ -61,7 +61,8 @@
|
|
|
</view>
|
|
|
<view class="other">
|
|
|
<view class="other_1">优惠劵</view>
|
|
|
- <view class="other_2" @click="toCoupon" v-if="couponList.length">请选择优惠劵</view>
|
|
|
+ <view class="other_2" @click="toCoupon" v-if="couponList.length">
|
|
|
+ {{coupon_name||'请选择优惠劵'}}</view>
|
|
|
<view class="other_2" v-else>暂无优惠劵使用</view>
|
|
|
</view>
|
|
|
<view class="other">
|
|
@@ -141,6 +142,8 @@
|
|
|
addressList: [],
|
|
|
// 优惠劵
|
|
|
couponList: [],
|
|
|
+ coupon: [],
|
|
|
+ coupon_name: '',
|
|
|
type: '',
|
|
|
};
|
|
|
},
|
|
@@ -152,7 +155,10 @@
|
|
|
methods: {
|
|
|
// 使用优惠劵
|
|
|
toDiscount(e) {
|
|
|
- console.log(e);
|
|
|
+ const that = this;
|
|
|
+ that.$set(that, 'coupon_name', e.coupon.name)
|
|
|
+ that.coupon.push(e._id)
|
|
|
+ that.$refs.popup.close();
|
|
|
},
|
|
|
// 选择收货地址
|
|
|
toChoose() {
|
|
@@ -171,6 +177,7 @@
|
|
|
toCoupon() {
|
|
|
const that = this;
|
|
|
that.$set(that, 'type', '1')
|
|
|
+ that.$set(that, 'coupon', [])
|
|
|
that.$refs.popup.open();
|
|
|
},
|
|
|
// 是否选中
|
|
@@ -221,7 +228,8 @@
|
|
|
let data = {
|
|
|
address: that.address,
|
|
|
goods: that.orderList,
|
|
|
- total_detail: that.total_detail
|
|
|
+ total_detail: that.total_detail,
|
|
|
+ coupon: that.coupon
|
|
|
}
|
|
|
const arr = await that.$api(`/order`, 'POST', data)
|
|
|
console.log(arr)
|