diff --git a/api/gift.js b/api/gift.js index 2c14841..a2dcbc5 100644 --- a/api/gift.js +++ b/api/gift.js @@ -39,4 +39,12 @@ export function getGiftCardReceive(data) { */ export function getGiftCardSendNotice(data) { return request.get("/giftCard/giftNotice", data); +} + +/** + * 计算订单金额 + * @param {*} data + */ +export function getGiftCardSendOrderAmount(key, data) { + return request.post("giftCard/computed/" + key, data); } \ No newline at end of file diff --git a/pkg_user/views/gift/gift.vue b/pkg_user/views/gift/gift.vue index 06aac5f..c3f28d6 100644 --- a/pkg_user/views/gift/gift.vue +++ b/pkg_user/views/gift/gift.vue @@ -43,9 +43,10 @@ - {{ goodsInfo.productInfo.otPrice }} + {{ payPrice }} + + x{{ goodsInfo['cartNum'] }} @@ -113,7 +116,7 @@ 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 giftTips from './components/giftTips.vue' import CoverPicker from './components/CoverPicker.vue' @@ -165,6 +168,7 @@ export default { payType: '', isPayOk: false, giftKey: '', + payPrice: 0 } }, onLoad(opts) { @@ -181,6 +185,20 @@ export default { } }, 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) { this.payPassword = payPwd; this.confirmGift(true); @@ -207,6 +225,10 @@ export default { this.giftNotice = res.data.giftCardGiftNotice this.orderKey = res.data.orderKey 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) }) }, /**