From efd70ae003aa5c8e0fe3f46735327eb3eb55ca9a Mon Sep 17 00:00:00 2001
From: linxi <957440651@qq.com>
Date: Sat, 22 Nov 2025 15:15:13 +0800
Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E5=9B=A2=E8=B4=AD=E7=A4=BC?=
=?UTF-8?q?=E5=93=81=E6=94=AF=E6=8C=81=E4=BC=98=E6=83=A0=E5=88=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/gift.js | 12 +++++++++
pkg_user/views/gift/gift.vue | 47 +++++++++++++++++++++++++-----------
2 files changed, 45 insertions(+), 14 deletions(-)
diff --git a/api/gift.js b/api/gift.js
index 1963088..3f33c62 100644
--- a/api/gift.js
+++ b/api/gift.js
@@ -112,3 +112,15 @@ export function fetchSojoumGroupBuyGiftCarousel(params) {
login: true
})
}
+
+/**
+ * 计算旅居团购礼品订单价格
+ * @param {*} params
+ * @returns
+ */
+
+export function computedSojoumGroupBuyGiftOrderPrice(params) {
+ return request.post("/travel/giftCardOrder/computed/" + params.key, params, {
+ login: true
+ })
+}
diff --git a/pkg_user/views/gift/gift.vue b/pkg_user/views/gift/gift.vue
index c306cd4..ffc34d5 100644
--- a/pkg_user/views/gift/gift.vue
+++ b/pkg_user/views/gift/gift.vue
@@ -81,7 +81,7 @@
{{ isGroupBuy ? goodsInfo.price : computedResult.totalPrice }}
-
+
平台折扣:
-
@@ -89,7 +89,7 @@
{{ computedResult.discountPrice }}
-
+
优惠券:
@@ -111,7 +111,7 @@
合计:
¥
- {{ isGroupBuy ? goodsInfo.price : computedResult.payPrice }}
+ {{ computedResult.payPrice }}
@@ -146,7 +146,7 @@
ref='payPwdPop'
showMoney
v-if="isShowPayPwdPop"
- :money="isGroupBuy ? goodsInfo.price : payPrice"
+ :money="payPrice"
:show="isShowPayPwdPop"
@close="isShowPayPwdPop = false"
@finish="pwdPopFinish"
@@ -186,7 +186,8 @@ import {
getGiftCardResend,
createGroupBuyGift,
createSojoumGroupBuyGift,
- fetchSojoumGroupBuyGiftCarousel
+ fetchSojoumGroupBuyGiftCarousel,
+ computedSojoumGroupBuyGiftOrderPrice
} from '@/api/gift'
import { weappPay } from "@/libs/wechat";
import {mapGetters} from "vuex";
@@ -249,7 +250,11 @@ export default {
async couponId(value) {
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === +value)
this.couponTitle = this.couponList['usable']?.[this.couponIndex]?.couponTitle
- await this.computedPrice(this.goodsInfo.cartNum, 1)
+ if(this.isGroupBuy) {
+ await this.computedTravelGroupPrice(true)
+ } else {
+ await this.computedPrice(this.goodsInfo.cartNum, 1)
+ }
}
},
onLoad(opts) {
@@ -284,14 +289,23 @@ export default {
imageUrl: this.shareImage
}
},
- // onReady() {
- // this.$nextTick(() => {
- // this.$refs.textarea.setFormatter(val => {
- // return val.length > 30 ? val.substring(0, 30) : val
- // })
- // })
- // },
methods: {
+ // 团购价计算
+ computedTravelGroupPrice(useDefaultCouponId) {
+ const params = {
+ key: this.orderKey,
+ couponId: this.couponId
+ }
+ computedSojoumGroupBuyGiftOrderPrice(params).then(res => {
+ this.computedResult = res.data.result
+ this.couponList = res.data.result.couponList
+ this.payPrice = res.data.result.payPrice
+ this.$forceUpdate()
+ if(useDefaultCouponId) {
+ this.couponId = res.data.result.defaultCouponId || 0
+ }
+ })
+ },
handleShowCover() {
this.showCoverPicker = true
},
@@ -310,7 +324,11 @@ export default {
if(!item.id) {
this.couponId = 0
this.couponTitle = ''
- this.computedPrice(this.goodsInfo.cartNum, 1)
+ if(this.isGroupBuy) {
+ this.computedTravelGroupPrice(false)
+ } else {
+ this.computedPrice(this.goodsInfo.cartNum, 1)
+ }
return
}
this.couponId = item.id
@@ -576,6 +594,7 @@ export default {
}
}
this.giftNotice = res.data.giftCardGiftNotice
+ this.computedTravelGroupPrice(true)
}
})
}