|
@@ -80,6 +80,14 @@
|
|
|
<view class="cell-tit clamp">总共合计</view>
|
|
|
<view class="cell-tip">¥{{price}}</view>
|
|
|
</view>
|
|
|
+ <label class="yt-list-cell b-b" @click="changeDeductionScore(maxDeductionScore)" for="maxDeductionScoreCheckbox" v-if="maxDeductionScore < userInfo['score']">
|
|
|
+ <view class="cell-tit clamp"><checkbox id="maxDeductionScoreCheckbox" value="maxDeductionScore" ></checkbox>使用积分抵扣</view>
|
|
|
+ <view class="cell-tip red">{{maxDeductionScore}}元</view>
|
|
|
+ </label>
|
|
|
+ <label class="yt-list-cell b-b" for="userInfoScore" v-else>
|
|
|
+ <view class="cell-tit clamp"><checkbox @click="changeDeductionScore(userInfo['score'])" id="userInfoScore" value="userInfo['score']" ></checkbox>使用积分抵扣</view>
|
|
|
+ <view class="cell-tip red">{{userInfo['score']}}元</view>
|
|
|
+ </label>
|
|
|
<view class="yt-list-cell b-b" v-if="couponList && couponList.length">
|
|
|
<view class="cell-tit clamp">优惠金额</view>
|
|
|
<view class="cell-tip red">-¥{{coupon_price}}</view>
|
|
@@ -109,7 +117,7 @@
|
|
|
<view class="price-content">
|
|
|
<text>实付款</text>
|
|
|
<text class="price-tip">¥</text>
|
|
|
- <text class="price">{{total}}</text>
|
|
|
+ <text class="price">{{total - deductionScore}}</text>
|
|
|
</view>
|
|
|
<text class="submit" @click="submit">提交订单</text>
|
|
|
</view>
|
|
@@ -154,6 +162,10 @@
|
|
|
useCouponIndex: -1,
|
|
|
addressData: {},
|
|
|
product: [],
|
|
|
+ userInfo: {
|
|
|
+ score: 0
|
|
|
+ },
|
|
|
+ maxDeductionScore: 0,
|
|
|
price: 0.00, //商品金额
|
|
|
coupon_price: 0.00, //优惠券金额
|
|
|
total: 0.00, //实付金额
|
|
@@ -163,7 +175,8 @@
|
|
|
cart: [], // 购物车id
|
|
|
flash_id: 0, // 秒杀id
|
|
|
progress:{},
|
|
|
- submitLock:false // 提交按钮锁
|
|
|
+ submitLock:false ,// 提交按钮锁
|
|
|
+ deductionScore: 0
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
@@ -231,14 +244,22 @@
|
|
|
|
|
|
let apiUrl = !param.flash_id || param.flash_id == 0 ? '/order/create' : '/flash/createOrder';
|
|
|
let data = await this.$api.request(apiUrl, 'POST', param);
|
|
|
+ let maxDeductionScore = 0;
|
|
|
|
|
|
if (data) {
|
|
|
this.addressData = data.address;
|
|
|
- this.product = data.product;
|
|
|
+ const product = this.product = data.product;
|
|
|
this.couponList = data.coupon;
|
|
|
this.deliveryList = data.delivery;
|
|
|
+ this.userInfo = data.userInfo;
|
|
|
this.calcTotal();
|
|
|
|
|
|
+ for(const i in product){
|
|
|
+ maxDeductionScore += product[i]['maxDeductionScore'];
|
|
|
+ }
|
|
|
+
|
|
|
+ this.maxDeductionScore = maxDeductionScore;
|
|
|
+
|
|
|
if (data.flash) {
|
|
|
this.progress = data.flash;
|
|
|
}
|
|
@@ -288,7 +309,8 @@
|
|
|
spec: [],
|
|
|
number: [],
|
|
|
cart: this.cart,
|
|
|
- flash_id: this.flash_id
|
|
|
+ flash_id: this.flash_id,
|
|
|
+ deductionScore: this.deductionScore
|
|
|
};
|
|
|
|
|
|
this.product.forEach((item, index) => {
|
|
@@ -307,7 +329,7 @@
|
|
|
this.submitLock = false; // 解除锁
|
|
|
this.$api.msg('已提交', 2000);
|
|
|
uni.redirectTo({
|
|
|
- url: `/pages/money/pay?order_id=${result.order_id}&total=${this.total}&out_trade_no=${result.out_trade_no}`
|
|
|
+ url: `/pages/money/pay?order_id=${result.order_id}&total=${this.total-this.deductionScore}&out_trade_no=${result.out_trade_no}`
|
|
|
});
|
|
|
}
|
|
|
this.submitLock = false; // 解除锁
|
|
@@ -393,6 +415,13 @@
|
|
|
// 查看运费模板
|
|
|
deliveryTemplate() {
|
|
|
this.$api.navTo('/pages/order/delivery');
|
|
|
+ },
|
|
|
+ changeDeductionScore(num) {
|
|
|
+ if(this.deductionScore == 0) {
|
|
|
+ this.deductionScore = num;
|
|
|
+ } else {
|
|
|
+ this.deductionScore = 0;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|