问题修复,下单修复
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
</view>
|
||||
<view class="font-12" v-if="item.rewardPoints">
|
||||
<text>送</text>
|
||||
<text>¥</text>
|
||||
<text class="font-14">{{item.rewardPoints}}</text>
|
||||
<text>积分</text>
|
||||
</view>
|
||||
<view class="font-12 color-666" v-if="item.couponInfoList.length">
|
||||
<text>送</text>
|
||||
|
||||
@@ -117,7 +117,8 @@
|
||||
v-if="item.icon" :src="item.icon" mode=""></u-image>
|
||||
</view>
|
||||
<text class="name u-m-l-16 no-wrap"> {{ item.name }} </text>
|
||||
<text class="font-12 u-p-l-6" style="color: #666;margin-right: 16rpx;max-width: 360rpx;" v-if="item.type=='points'">
|
||||
<text class=" u-p-l-6" style="color: #666;max-width: 400rpx;font-size: 10px;"
|
||||
v-if="item.type=='points'">
|
||||
「可用积分{{pointsRes.accountPoints}},最大可抵扣{{maxPointDiscount}}元」
|
||||
|
||||
</text>
|
||||
@@ -126,8 +127,17 @@
|
||||
|
||||
<!-- 优惠卷 -->
|
||||
<view class="favorable_right" v-if="item.type=='coupon'">
|
||||
<text class="favorable_right_text red"
|
||||
v-if="returnCouponDiscount>0">-¥{{returnCouponDiscount}}</text>
|
||||
<template v-if="cartStore.orderCostSummary.couponDeductionAmount>0">
|
||||
<text
|
||||
class="favorable_right_text red">-¥{{cartStore.orderCostSummary.couponDeductionAmount}}</text>
|
||||
</template>
|
||||
<template v-else>
|
||||
<text class="favorable_right_text red" v-if="hasCouponCanUse">有可用优惠券</text>
|
||||
<text class=" favorable_right_text " v-else>暂无可用优惠券</text>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<up-icon name="arrow-right" color="#575B66" size="16"
|
||||
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'||!listinfo.id"></up-icon>
|
||||
|
||||
@@ -142,14 +152,17 @@
|
||||
|
||||
<!-- 积分 -->
|
||||
<view class="favorable_right u-flex u-col-center" v-if="item.type=='points'">
|
||||
<up-icon name="checkmark-circle-fill" size="24rpx" v-if="usePoints"
|
||||
color="#FE7E00"></up-icon>
|
||||
<text v-if="usePoints" class="red">
|
||||
-¥{{cartStore.orderCostSummary.pointDeductionAmount}}
|
||||
</text>
|
||||
<template v-if="usePoints&&cartStore.orderCostSummary.pointDeductionAmount">
|
||||
<up-icon name="checkmark-circle-fill" size="24rpx" color="#FE7E00"></up-icon>
|
||||
<text class="red">
|
||||
-¥{{cartStore.orderCostSummary.pointDeductionAmount}}
|
||||
</text>
|
||||
</template>
|
||||
|
||||
|
||||
<view v-else class="u-flex u-col-center">
|
||||
<view class="round"></view>
|
||||
<text class="color-333 font-12 no-wrap">使用抵扣</text>
|
||||
<text class="color-333 font-12 no-wrap u-m-l-4">使用抵扣</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view class="favorable_right" v-if="item.type=='points'">
|
||||
@@ -218,21 +231,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="orderInfo">
|
||||
<view class="">
|
||||
<view class="t">
|
||||
订单备注:
|
||||
</view>
|
||||
<view class="u-m-t-18 ">
|
||||
<up-textarea border="none" placeholder="请填写口味、偏好等要求" :type="'textarea'" v-model="listinfo.remark"
|
||||
:clearable="true" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<IntegralInput :visible="calcUsablePointsData.showModal" :minValue="calcUsablePointsData.minIntegral"
|
||||
:maxValue="calcUsablePointsData.maxIntegral" :instructions="calcUsablePointsData.instructionText"
|
||||
@@ -260,8 +258,15 @@
|
||||
watch,
|
||||
watchEffect,
|
||||
defineExpose,
|
||||
toRaw,
|
||||
onMounted
|
||||
|
||||
} from 'vue'
|
||||
import {
|
||||
returnHasCouponCanUse
|
||||
} from '@/utils/coupon.js'
|
||||
let hasCouponCanUse = ref(false)
|
||||
|
||||
|
||||
const usePoints = ref(false)
|
||||
|
||||
@@ -300,7 +305,7 @@
|
||||
},
|
||||
])
|
||||
|
||||
const favorablelist = reactive([{
|
||||
const favorablelist = ref([{
|
||||
name: "新客立减",
|
||||
type: "newUser",
|
||||
width: '40rpx',
|
||||
@@ -390,15 +395,15 @@
|
||||
|
||||
// 操作优惠卷
|
||||
const dataprocessing = (data) => {
|
||||
favorablelist[1].value = data
|
||||
favorablelist.value[1].value = data
|
||||
|
||||
}
|
||||
|
||||
const returnCouponDiscount = computed(() => {
|
||||
if (!favorablelist[1].value) {
|
||||
if (!favorablelist.value[1].value) {
|
||||
return 0
|
||||
}
|
||||
return favorablelist[1].value.reduce((prve, cur) => {
|
||||
return favorablelist.value[1].value.reduce((prve, cur) => {
|
||||
return prve + (cur.discountAmount || 0)
|
||||
}, 0)
|
||||
})
|
||||
@@ -407,8 +412,8 @@
|
||||
const bwcclear = () => {
|
||||
IntegralInputclose()
|
||||
// 清空优惠卷
|
||||
favorablelist[1].value = ''
|
||||
favorablelist[1].value = ''
|
||||
favorablelist.value[1].value = ''
|
||||
favorablelist.value[1].value = ''
|
||||
}
|
||||
const dinnerType = computed(() => {
|
||||
return is_type.value ? 'take-out' : 'dine-ine'
|
||||
@@ -418,10 +423,7 @@
|
||||
const canDikouGoodsArr = props.nowCarts
|
||||
const goodsOrderPrice = props.listinfo.totalPrices
|
||||
// const user=uni.cache.get('shopUserInfo')
|
||||
uni.setStorageSync('canDikouGoodsArr', canDikouGoodsArr)
|
||||
uni.setStorageSync('goodsOrderPrice', goodsOrderPrice)
|
||||
uni.setStorageSync('dinnerType', dinnerType.value)
|
||||
|
||||
|
||||
if (props.isBwc) {
|
||||
uni.showToast({
|
||||
@@ -432,36 +434,13 @@
|
||||
}
|
||||
switch (item.type) {
|
||||
case 'coupon':
|
||||
// 清空积分
|
||||
IntegralInputclose()
|
||||
favorablelist[1].value = ''
|
||||
emits('learcoupons', 'coupon')
|
||||
console.log('payAmount', props.listinfo.totalPrices, props.listinfo
|
||||
.Productroll);
|
||||
uni.pro.navigateTo('/pages/order/coupon', {
|
||||
type: "confirm_order_coupon",
|
||||
shopId: uni.cache.get('orderVIP').shopId,
|
||||
shopUserId: props.orderVIP.id,
|
||||
payAmount: (parseFloat(props.listinfo.totalPrices) - parseFloat(props.listinfo
|
||||
.Productroll)).toFixed(2),
|
||||
shoppingCart: JSON.stringify([...props.nowCarts, ...props.listinfo.combinedArray]),
|
||||
})
|
||||
uni.pro.navigateTo('/pages/order/coupon', {})
|
||||
break;
|
||||
|
||||
case 'points':
|
||||
chnageIsUsePoints()
|
||||
return
|
||||
IntegralInputclose()
|
||||
if (calcUsablePointsData.usable == 0) {
|
||||
uni.showToast({
|
||||
title: calcUsablePointsData.unusableReason,
|
||||
icon: 'none'
|
||||
})
|
||||
return false;
|
||||
}
|
||||
console.log('calcUsablePointsData:', calcUsablePointsData)
|
||||
calcUsablePointsData.showModal = true
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,27 +458,35 @@
|
||||
const pointsRes = reactive({
|
||||
accountPoints: 0
|
||||
})
|
||||
getMaxPointsDiscount()
|
||||
const maxPointDiscount=ref(0)
|
||||
async function getMaxPointsDiscount() {
|
||||
//积分可抵扣最大金额
|
||||
const maxMoney = cartStore.orderCostSummary.goodsRealAmount - cartStore.orderCostSummary
|
||||
const maxPointDiscount = ref(0)
|
||||
//积分可抵扣最大金额
|
||||
const maxMoney = computed(() => {
|
||||
return cartStore.orderCostSummary.goodsRealAmount - cartStore.orderCostSummary
|
||||
.couponDeductionAmount
|
||||
})
|
||||
|
||||
async function getMaxPointsDiscount() {
|
||||
let res = await APImemberPointscalcUsablePoints({
|
||||
shopUserId: props.orderVIP.id,
|
||||
orderAmount: maxMoney
|
||||
orderAmount: maxMoney.value
|
||||
})
|
||||
console.log(res);
|
||||
Object.assign(pointsRes, res)
|
||||
const maxUsablePoints = res.maxUsablePoints
|
||||
maxPointDiscount.value=res.maxDeductionAmount
|
||||
maxPointDiscount.value = res.maxDeductionAmount
|
||||
// props.listinfo.pointsDiscountAmount = await APImemberPointscalcDeductionAmount({
|
||||
// points: maxUsablePoints,
|
||||
// shopUserId: props.orderVIP.id,
|
||||
// orderAmount: maxMoney
|
||||
// })
|
||||
cartStore.setUserPoints(maxUsablePoints)
|
||||
if (usePoints.value) {
|
||||
cartStore.setUserPoints(maxUsablePoints)
|
||||
}
|
||||
}
|
||||
watch(() => maxMoney.value, (newval) => {
|
||||
console.log('maxMoney.value', newval);
|
||||
getMaxPointsDiscount()
|
||||
})
|
||||
watch(() => usePoints.value, (newval) => {
|
||||
if (newval) {
|
||||
getMaxPointsDiscount()
|
||||
@@ -571,21 +558,47 @@
|
||||
});
|
||||
|
||||
watch(() => props.listinfo.seatNum, (newval) => {
|
||||
cartStore.setSeatFeeConfig('personCount', newval || 1)
|
||||
cartStore.setSeatFeeConfig('personCount', newval || 0)
|
||||
})
|
||||
|
||||
const newUserDiscount = ref(0)
|
||||
const back_favorablelist = toRaw(favorablelist.value)
|
||||
async function getConsumeDiscount() {
|
||||
const consumeDiscountRes = await consumeDiscount({
|
||||
shopId: uni.cache.get('shopId'),
|
||||
})
|
||||
if (consumeDiscountRes&&consumeDiscountRes.isUse) {
|
||||
if (!consumeDiscountRes.isUse) {
|
||||
favorablelist.value = back_favorablelist.filter(v => v.name != '新客立减')
|
||||
}
|
||||
if (consumeDiscountRes && consumeDiscountRes.isUse) {
|
||||
newUserDiscount.value = consumeDiscountRes.amount
|
||||
cartStore.newUserDiscount = consumeDiscountRes.amount || 0
|
||||
cartStore.consumeDiscount=consumeDiscountRes
|
||||
cartStore.consumeDiscount = consumeDiscountRes
|
||||
}
|
||||
}
|
||||
getConsumeDiscount()
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
getConsumeDiscount()
|
||||
//积分可抵扣最大金额
|
||||
const goodsOrderPrice = cartStore.orderCostSummary.goodsRealAmount - cartStore.orderCostSummary
|
||||
const dinnerType = cartStore.dinnerType
|
||||
const shopInfo = cartStore.shopInfo
|
||||
const shopId = cartStore.shopInfo.shopId
|
||||
const user = uni.cache.get('shopUserInfo')
|
||||
const shopUserId = user.id
|
||||
const allGoods = cartStore.allGoods
|
||||
hasCouponCanUse.value = await returnHasCouponCanUse({
|
||||
goodsOrderPrice,
|
||||
dinnerType,
|
||||
shopId,
|
||||
shopInfo,
|
||||
shopUserId,
|
||||
allGoods,
|
||||
user
|
||||
})
|
||||
console.log('hasCouponCanUse', hasCouponCanUse.value);
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user