修改订单详情优惠逻辑

This commit is contained in:
2024-11-20 14:52:01 +08:00
parent fe441fc471
commit 0ff2e8f770

View File

@@ -58,7 +58,12 @@
<view class="u-text-right u-m-t-28"> <view class="u-text-right u-m-t-28">
<template v-if="isTui(item)"> <template v-if="isTui(item)">
<view>0.00</view> <view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}} <template
v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
<view class="line-th color-666 ">{{returnVipMoney(item)}}</view>
</template>
<view class="line-th color-666 " v-else>{{returnTotalMoney(item)}}
</view> </view>
</template> </template>
<template v-else-if="isGift(item)||item.userCouponId"> <template v-else-if="isGift(item)||item.userCouponId">
@@ -67,7 +72,8 @@
</view> </view>
</template> </template>
<template v-else> <template v-else>
<template v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)"> <template
v-if="user.isVip&&item.isMember&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
<view>{{returnVipMoney(item)}}</view> <view>{{returnVipMoney(item)}}</view>
<view class=" color-666 line-th"> <view class=" color-666 line-th">
{{returnTotalMoney(item)}}</view> {{returnTotalMoney(item)}}</view>
@@ -134,7 +140,7 @@
</view> </view>
</view> </view>
<template v-if="orderInfo.status=='refund'"> <template v-if="orderInfo.refundAmount">
<view class="u-flex u-row-between u-m-t-32"> <view class="u-flex u-row-between u-m-t-32">
<view>退款金额</view> <view>退款金额</view>
<view class="color-999"> <view class="color-999">
@@ -190,7 +196,8 @@
<text>{{orderInfo.fullCouponDiscountAmount}}</text> <text>{{orderInfo.fullCouponDiscountAmount}}</text>
</view> </view>
</view> </view>
<view class="u-flex u-row-between u-m-t-18" v-if="orderInfo.productCouponDiscountAmount||productCoupPrice"> <view class="u-flex u-row-between u-m-t-18"
v-if="orderInfo.productCouponDiscountAmount||productCoupPrice">
<view>商品券抵扣</view> <view>商品券抵扣</view>
<view class="color-red"> <view class="color-red">
<text></text> <text></text>
@@ -213,14 +220,16 @@
<script setup> <script setup>
import { import {
computed, reactive computed,
reactive
} from 'vue'; } from 'vue';
import color from '@/commons/color.js' import color from '@/commons/color.js'
import { import {
hasPermission hasPermission
} from '@/commons/utils/hasPermission.js' } from '@/commons/utils/hasPermission.js'
import { import {
isTui,isGift, isTui,isTuiCai,
isGift,
canTuiKuan, canTuiKuan,
canTuicai, canTuicai,
numSum numSum
@@ -228,9 +237,11 @@
const pop = reactive({ const pop = reactive({
youhui: false youhui: false
}) })
function youhuiDetailShow() { function youhuiDetailShow() {
pop.youhui = true pop.youhui = true
} }
function youhuiDetailHide() { function youhuiDetailHide() {
pop.youhui = false pop.youhui = false
} }
@@ -314,9 +325,10 @@
const freePrice = computed(() => { const freePrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => { const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift == true || isTui(v)).reduce((a, const curTotal = cur.info.filter(v => v.gift == true || isGift(v)).reduce((a,
b) => { b) => {
return a + (b.num * b.price) const price=(b.isMember && b.memberPrice)?b.memberPrice:b.price
return a + (b.num * price)
}, 0) }, 0)
return prve + curTotal return prve + curTotal
}, 0) }, 0)
@@ -327,7 +339,9 @@
return 0 return 0
} }
const goodsPrice = props.data.reduce((prve, cur) => { const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" &&!v.userCouponId&&(v.isMember&&v.memberPrice)&&(v.memberPrice!=v.price)).reduce((a, const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return" && !v
.userCouponId && (v.isMember && v.memberPrice) && (v.memberPrice != v.price)).reduce((
a,
b) => { b) => {
return a + (b.num * (b.price - b.memberPrice)) return a + (b.num * (b.price - b.memberPrice))
}, 0) }, 0)
@@ -355,7 +369,11 @@
}) })
const youhuiAllPrice = computed(() => { const youhuiAllPrice = computed(() => {
return (freePrice.value*1+vipDiscountPrice.value*1+props.orderInfo.fullCouponDiscountAmount+props.orderInfo.pointsDiscountAmount+productCoupPrice.value*1+(props.orderInfo.discountAmount||0)).toFixed(2) console.log(freePrice.value * 1 , vipDiscountPrice.value * 1 , props.orderInfo.fullCouponDiscountAmount ,props
.orderInfo.pointsDiscountAmount , productCoupPrice.value * 1 , props.orderInfo.discountAmount);
return (freePrice.value * 1 + vipDiscountPrice.value * 1 + props.orderInfo.fullCouponDiscountAmount + props
.orderInfo.pointsDiscountAmount + productCoupPrice.value * 1 + (props.orderInfo.discountAmount ||
0)).toFixed(2)
}) })
const packFee = computed(() => { const packFee = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => { const goodsPrice = props.data.reduce((prve, cur) => {