Feat:团购礼品支持优惠券
This commit is contained in:
+12
@@ -112,3 +112,15 @@ export function fetchSojoumGroupBuyGiftCarousel(params) {
|
|||||||
login: true
|
login: true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算旅居团购礼品订单价格
|
||||||
|
* @param {*} params
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function computedSojoumGroupBuyGiftOrderPrice(params) {
|
||||||
|
return request.post("/travel/giftCardOrder/computed/" + params.key, params, {
|
||||||
|
login: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
<text class="v12-dark-text v12-font-30">{{ isGroupBuy ? goodsInfo.price : computedResult.totalPrice }}</text>
|
<text class="v12-dark-text v12-font-30">{{ isGroupBuy ? goodsInfo.price : computedResult.totalPrice }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="v12-justify-between v12-align-center v12-font-28 v12-mt-1" v-if="!isGroupBuy">
|
<view class="v12-justify-between v12-align-center v12-font-28 v12-mt-1">
|
||||||
<view class="v12-font-24 v12-dark-text">平台折扣:</view>
|
<view class="v12-font-24 v12-dark-text">平台折扣:</view>
|
||||||
<view>
|
<view>
|
||||||
-
|
-
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
<text class="v12-dark-text v12-font-30">{{ computedResult.discountPrice }}</text>
|
<text class="v12-dark-text v12-font-30">{{ computedResult.discountPrice }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="v12-justify-between v12-align-center v12-font-28 v12-mt-1" v-if="!isGroupBuy">
|
<view class="v12-justify-between v12-align-center v12-font-28 v12-mt-1">
|
||||||
<view class="v12-font-24 v12-dark-text v12-align-center">
|
<view class="v12-font-24 v12-dark-text v12-align-center">
|
||||||
<view class="">
|
<view class="">
|
||||||
优惠券:
|
优惠券:
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
<view class="v12-font-bold">合计:</view>
|
<view class="v12-font-bold">合计:</view>
|
||||||
<view class="">
|
<view class="">
|
||||||
<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-28">{{ isGroupBuy ? goodsInfo.price : computedResult.payPrice }}</text>
|
<text class="v12-primary-text v12-font-bold v12-font-28">{{ computedResult.payPrice }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
ref='payPwdPop'
|
ref='payPwdPop'
|
||||||
showMoney
|
showMoney
|
||||||
v-if="isShowPayPwdPop"
|
v-if="isShowPayPwdPop"
|
||||||
:money="isGroupBuy ? goodsInfo.price : payPrice"
|
:money="payPrice"
|
||||||
:show="isShowPayPwdPop"
|
:show="isShowPayPwdPop"
|
||||||
@close="isShowPayPwdPop = false"
|
@close="isShowPayPwdPop = false"
|
||||||
@finish="pwdPopFinish"
|
@finish="pwdPopFinish"
|
||||||
@@ -186,7 +186,8 @@ import {
|
|||||||
getGiftCardResend,
|
getGiftCardResend,
|
||||||
createGroupBuyGift,
|
createGroupBuyGift,
|
||||||
createSojoumGroupBuyGift,
|
createSojoumGroupBuyGift,
|
||||||
fetchSojoumGroupBuyGiftCarousel
|
fetchSojoumGroupBuyGiftCarousel,
|
||||||
|
computedSojoumGroupBuyGiftOrderPrice
|
||||||
} from '@/api/gift'
|
} from '@/api/gift'
|
||||||
import { weappPay } from "@/libs/wechat";
|
import { weappPay } from "@/libs/wechat";
|
||||||
import {mapGetters} from "vuex";
|
import {mapGetters} from "vuex";
|
||||||
@@ -249,7 +250,11 @@ export default {
|
|||||||
async couponId(value) {
|
async couponId(value) {
|
||||||
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === +value)
|
this.couponIndex = this.couponList['usable']?.findIndex(item => item.id === +value)
|
||||||
this.couponTitle = this.couponList['usable']?.[this.couponIndex]?.couponTitle
|
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) {
|
onLoad(opts) {
|
||||||
@@ -284,14 +289,23 @@ export default {
|
|||||||
imageUrl: this.shareImage
|
imageUrl: this.shareImage
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// onReady() {
|
|
||||||
// this.$nextTick(() => {
|
|
||||||
// this.$refs.textarea.setFormatter(val => {
|
|
||||||
// return val.length > 30 ? val.substring(0, 30) : val
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// },
|
|
||||||
methods: {
|
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() {
|
handleShowCover() {
|
||||||
this.showCoverPicker = true
|
this.showCoverPicker = true
|
||||||
},
|
},
|
||||||
@@ -310,7 +324,11 @@ export default {
|
|||||||
if(!item.id) {
|
if(!item.id) {
|
||||||
this.couponId = 0
|
this.couponId = 0
|
||||||
this.couponTitle = ''
|
this.couponTitle = ''
|
||||||
this.computedPrice(this.goodsInfo.cartNum, 1)
|
if(this.isGroupBuy) {
|
||||||
|
this.computedTravelGroupPrice(false)
|
||||||
|
} else {
|
||||||
|
this.computedPrice(this.goodsInfo.cartNum, 1)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.couponId = item.id
|
this.couponId = item.id
|
||||||
@@ -576,6 +594,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.giftNotice = res.data.giftCardGiftNotice
|
this.giftNotice = res.data.giftCardGiftNotice
|
||||||
|
this.computedTravelGroupPrice(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user