From c0bf4ed2c9c32bfa8787650f95f7a4b44f42b5e3 Mon Sep 17 00:00:00 2001
From: lifizer <913626195@qq.com>
Date: Mon, 22 Apr 2024 16:18:47 +0800
Subject: [PATCH] =?UTF-8?q?Feat(=E8=AE=A2=E5=8D=95):=E4=BD=BF=E7=94=A8?=
=?UTF-8?q?=E7=A7=AF=E5=88=86=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
assets/css/style.less | 2 +-
pages/order/OrderSubmission/index.vue | 83 ++++++++++++++++++++++-----
pages/user/Points/index.vue | 10 +++-
3 files changed, 78 insertions(+), 17 deletions(-)
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 @@
-
-
+ 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 {