zs пре 2 година
родитељ
комит
9f5d11e0de
3 измењених фајлова са 14 додато и 6 уклоњено
  1. 2 3
      components/discount/index.vue
  2. 11 3
      pagesHome/order/order.vue
  3. 1 0
      pagesMy/order/index.vue

+ 2 - 3
components/discount/index.vue

@@ -35,9 +35,7 @@
 			// 选择优惠劵
 			toDiscount(e) {
 				const that = this;
-				that.$emit('toDiscount', {
-					e
-				})
+				that.$emit('toDiscount', e)
 			},
 		}
 	}
@@ -93,6 +91,7 @@
 						overflow: hidden;
 						text-overflow: ellipsis;
 						display: -webkit-box;
+						line-height: 6vw;
 						-webkit-line-clamp: 1;
 						-webkit-box-orient: vertical;
 						font-size: var(--font14Size);

+ 11 - 3
pagesHome/order/order.vue

@@ -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)

+ 1 - 0
pagesMy/order/index.vue

@@ -375,6 +375,7 @@
 					padding: 2vw;
 
 					.status {
+						color: var(--ff0Color);
 						text-align: right;
 						margin: 0 0 1vw 0;
 					}