diff --git a/assets/css/style.less b/assets/css/style.less index c9a21dc..049e4eb 100644 --- a/assets/css/style.less +++ b/assets/css/style.less @@ -3423,7 +3423,7 @@ page { .order-details .wrapper .item .conter { color: #868686; - width: 5*100rpx; + width: 4.5*100rpx; text-align: right; } diff --git a/pages/order/OrderSubmission/index.vue b/pages/order/OrderSubmission/index.vue index 9c2a6a8..9c18d30 100644 --- a/pages/order/OrderSubmission/index.vue +++ b/pages/order/OrderSubmission/index.vue @@ -171,7 +171,24 @@ -¥{{ force2Decimal(orderPrice.deductionPrice) }} - + + + 积分抵扣: + + + + + + 积分:{{ orderPrice.usedPoints }} + + -¥{{ force2Decimal(orderPrice.deductionPrice) }} + + + 优惠券: @@ -204,23 +221,27 @@ 合计: - ¥{{ - force2Decimal(orderPrice.payPrice) - }} + + ¥{{ force2Decimal(orderPrice.payPrice) }} 立即结算 - - + v-model="showAddress" + ref="mychild" + :checked="addressInfo.id" + @checked="changeAddress" + @redirect="addressRedirect" + /> + @@ -288,7 +309,15 @@ export default { }, couponId: uni.getStorageSync('couponId') || 0, couponIndex: -1, - show: false + show: false, + // 是否使用积分开关 + usePointsCheck: false, + // 要使用的积分数量(传0为不使用积分,目前需求是默认使用最大可使用的积分,所以只要传大于0的数值都会变为自动使用最大可用积分) + usePointsNumber: 0, + // 订单是否可以使用积分 + canUsePoints: false, + // 订单最大可使用积分数量 + maxPoints: 0 }; }, computed: mapGetters(["userInfo", "storeItems"]), @@ -344,13 +373,17 @@ export default { force2Decimal(value) { return this.$force2Decimal(value); }, + usePointsCheckChange(e) { + this.computedPrice() + }, + // 计算订单金额 computedPrice(f) { - console.log(f) let shipping_type = this.shipping_type; postOrderComputed(this.orderGroupInfo.orderKey, { addressId: this.addressInfo.id, useIntegral: this.useIntegral ? 1 : 0, couponId: this.couponId || 0, + usePoints: this.usePointsCheck ? 1 : 0, shipping_type: parseInt(shipping_type) + 1 }).then(res => { const data = res.data; @@ -363,6 +396,11 @@ export default { }); } else { this.orderPrice = data.result; + if (this.usePointsCheck) { + this.usePointsNumber = data.result.usedPoints + } else { + this.usePointsNumber = 0 + } } }); }, @@ -391,6 +429,16 @@ export default { item.checked = false } }) + uni.removeStorageSync('couponId') + } else { + uni.removeStorageSync('couponId') + } + _this.canUsePoints = data.canUsePoints + _this.maxPoints = data.maxPoints + // 如果允许使用积分,则默认开启 + if (data.canUsePoints) { + _this.usePointsCheck = true + _this.usePointsNumber = data.maxPoints } _this.addressInfo = data.addressInfo || {} _this.systemStore = data.systemStore || {} @@ -534,6 +582,7 @@ export default { addressId: this.addressInfo.id, useIntegral: this.useIntegral ? 1 : 0, couponId: this.couponId || 0, + usePoints: this.usePointsNumber || 0, payType: this.active, pinkId: this.pinkId, seckillId: this.orderGroupInfo.seckill_id, @@ -826,4 +875,8 @@ export default { background-color: #FFFFFF; font-size: 24rpx; } +.points-cell { + padding: 20rpx 0 0 0; + color: #999; +} diff --git a/pages/user/Points/index.vue b/pages/user/Points/index.vue index 0202c56..2fd67ba 100644 --- a/pages/user/Points/index.vue +++ b/pages/user/Points/index.vue @@ -68,6 +68,7 @@ + {{ item.title }} @@ -312,9 +313,16 @@ export default { } .lottery { display: flex; + align-items: center; padding: 20rpx; + .img { + display: block; + width: 62rpx; + height: 62rpx; + margin: 0 20rpx 0 0; + } .title { - width: calc(100% - 160rpx); + flex: 1; } } .number {