Fix:3268 【礼品功能】进入送礼页面,商品价格会变成0

This commit is contained in:
modendeveloper
2025-02-23 23:22:33 +08:00
parent cca0f24cbc
commit 61e1e2939f
2 changed files with 33 additions and 3 deletions
+8
View File
@@ -40,3 +40,11 @@ export function getGiftCardReceive(data) {
export function getGiftCardSendNotice(data) { export function getGiftCardSendNotice(data) {
return request.get("/giftCard/giftNotice", data); return request.get("/giftCard/giftNotice", data);
} }
/**
* 计算订单金额
* @param {*} data
*/
export function getGiftCardSendOrderAmount(key, data) {
return request.post("giftCard/computed/" + key, data);
}
+25 -3
View File
@@ -43,9 +43,10 @@
<view class="v12-justify-between"> <view class="v12-justify-between">
<view> <view>
<text class="v12-primary-text v12-font-bold v12-font-22">¥</text> <text class="v12-primary-text v12-font-bold v12-font-22">¥</text>
<text class="v12-primary-text v12-font-bold v12-font-30">{{ goodsInfo.productInfo.otPrice }}</text> <text class="v12-primary-text v12-font-bold v12-font-30">{{ payPrice }}</text>
</view> </view>
<view> <view>
<u-number-box <u-number-box
v-if="!isPayOk" v-if="!isPayOk"
v-model="goodsInfo.cartNum" v-model="goodsInfo.cartNum"
@@ -54,6 +55,7 @@
disabledInput disabledInput
iconStyle="color: #fff" iconStyle="color: #fff"
class="num-step" class="num-step"
@change="numberChange"
> >
<template v-slot:minus> <template v-slot:minus>
<view class="v12-minus-btn v12-font-bold flex jc-center ai-center"> <view class="v12-minus-btn v12-font-bold flex jc-center ai-center">
@@ -69,6 +71,7 @@
</view> </view>
</template> </template>
</u-number-box> </u-number-box>
<view v-else> x{{ goodsInfo['cartNum'] }} </view>
</view> </view>
</view> </view>
</view> </view>
@@ -113,7 +116,7 @@
<passkeyborad <passkeyborad
ref='payPwdPop' ref='payPwdPop'
showMoney showMoney
:money="goodsInfo.productInfo.otPrice" :money="payPrice"
:show="isShowPayPwdPop" :show="isShowPayPwdPop"
@close="isShowPayPwdPop = false" @close="isShowPayPwdPop = false"
@finish="pwdPopFinish" @finish="pwdPopFinish"
@@ -128,7 +131,7 @@
<script> <script>
import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard' import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard'
import { getGiftCardSendOrderConfirm, getGiftCardSendOrder } from '@/api/gift' import { getGiftCardSendOrderConfirm, getGiftCardSendOrder, getGiftCardSendOrderAmount } from '@/api/gift'
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import giftTips from './components/giftTips.vue' import giftTips from './components/giftTips.vue'
import CoverPicker from './components/CoverPicker.vue' import CoverPicker from './components/CoverPicker.vue'
@@ -165,6 +168,7 @@ export default {
payType: '', payType: '',
isPayOk: false, isPayOk: false,
giftKey: '', giftKey: '',
payPrice: 0
} }
}, },
onLoad(opts) { onLoad(opts) {
@@ -181,6 +185,20 @@ export default {
} }
}, },
methods: { methods: {
numberChange(e) {
this.computedPrice(e.value)
},
computedPrice(num) {
const params = {
cartId: this.cartId,
couponId: this.couponId,
cartNum : num,
}
getGiftCardSendOrderAmount(this.orderKey, params).then(res => {
this.payPrice = res.data.result.payPrice
this.$forceUpdate()
})
},
pwdPopFinish(payPwd) { pwdPopFinish(payPwd) {
this.payPassword = payPwd; this.payPassword = payPwd;
this.confirmGift(true); this.confirmGift(true);
@@ -207,6 +225,10 @@ export default {
this.giftNotice = res.data.giftCardGiftNotice this.giftNotice = res.data.giftCardGiftNotice
this.orderKey = res.data.orderKey this.orderKey = res.data.orderKey
this.goodsInfo = res.data.cartInfo[0] this.goodsInfo = res.data.cartInfo[0]
this.templateId = res.data.specialGiftCardTemplate.id
this.selectedCover = res.data.specialGiftCardTemplate.cover
this.giftImage = res.data.specialGiftCardTemplate.image
this.computedPrice(this.goodsInfo.cartNum)
}) })
}, },
/** /**