lalala 6 ani în urmă
părinte
comite
94e75862c0

+ 13 - 4
mobile-code/src/components/app-coupon-sel.vue

@@ -100,9 +100,13 @@ export default {
 		// 优惠金额
 		// 优惠金额
 		totalDiscountPrice() {
 		totalDiscountPrice() {
 			console.log(this.price)
 			console.log(this.price)
+			if (this.price) {
 			// console.log(this.$util.floatFormat((this.price - this.price * this.shopUser.userAsset.discount / 10), 1))
 			// console.log(this.$util.floatFormat((this.price - this.price * this.shopUser.userAsset.discount / 10), 1))
 			// return this.$util.floatFormat((this.price - this.price * this.shopUser.userAsset.discount / 10), 1)
 			// return this.$util.floatFormat((this.price - this.price * this.shopUser.userAsset.discount / 10), 1)
-			return ((this.price * 1000000) - (this.price * this.shopUser.userAsset.discount / 10) * 1000000) / 1000000
+				return ((this.price * 1000000) - (this.price * this.shopUser.userAsset.discount / 10) * 1000000) / 1000000
+			} else {
+				return 0
+			}
 		}
 		}
 	},
 	},
 	mounted() {
 	mounted() {
@@ -115,12 +119,17 @@ export default {
 	},
 	},
 	methods: {
 	methods: {
 		mInit() {
 		mInit() {
-			this._getUserDiscount()
+			// this._getUserDiscount()
 		},
 		},
-		_getUserDiscount() {
-			userDiscount().then(res => {
+		async _getUserDiscount() {
+			let arr = []
+			await userDiscount().then(res => {
 				this.data = res.data
 				this.data = res.data
+				console.log('1111111')
+				arr = this.discountArr
 			})
 			})
+			console.log('222222')
+			return arr
 		},
 		},
 		checkChange(e) {
 		checkChange(e) {
 			this.selIndex = e.detail.value
 			this.selIndex = e.detail.value

+ 8 - 2
mobile-code/src/pages/pay/index.vue

@@ -65,7 +65,7 @@
 				</div>
 				</div>
 			</block>-->
 			</block>-->
 			<!-- 可选优惠 -->
 			<!-- 可选优惠 -->
-			<div class="module-com discount-wrap" v-if="!$util.isEmpty(shopUser) && shopUser.userAsset.member && shopUser.userAsset.getCouponNum">
+			<div class="module-com discount-wrap" v-if="!$util.isEmpty(discountArr)">
 				<div class="module-tit">可选优惠</div>
 				<div class="module-tit">可选优惠</div>
 				<div class="module-det">
 				<div class="module-det">
 					<app-coupon-sel ref="couponSel" :price="amount" :discountArr="['member', 'coupon']" />
 					<app-coupon-sel ref="couponSel" :price="amount" :discountArr="['member', 'coupon']" />
@@ -160,7 +160,9 @@
 					receiveLat: '', // 收花人纬度
 					receiveLat: '', // 收花人纬度
 					receiveLong: '' // 收花人经度
 					receiveLong: '' // 收花人经度
 				},
 				},
-				payCallData: null
+				payCallData: null,
+				// 优惠折扣
+				discountArr: []
 			}
 			}
 		},
 		},
 		computed: {
 		computed: {
@@ -196,6 +198,10 @@
 					uni.setNavigationBarTitle({
 					uni.setNavigationBarTitle({
 						title: `您正在向【${res.shop.merchantName}】付款`
 						title: `您正在向【${res.shop.merchantName}】付款`
 					})
 					})
+
+					this.$refs.couponSel._getUserDiscount().then(res => {
+						this.discountArr = res
+					})
 				})
 				})
 				if (isLogin()) {
 				if (isLogin()) {
 					getShopUser().then(res => {
 					getShopUser().then(res => {