修改订单详情订单列表价格展示,增加会员价

This commit is contained in:
2024-11-06 17:37:56 +08:00
parent 80a096cd97
commit f2f5bac39e
8 changed files with 593 additions and 62 deletions

View File

@@ -26,7 +26,9 @@
<view class="tui" v-if="isTui(item)">
{{item.status=='refunding'?'退款中':'已退'}}
</view>
<view :class="{'line-th':item.status=='return'||item.status=='refund'||item.status=='refunding'}">{{item.name||item.productName}}
<view
:class="{'line-th':item.status=='return'||item.status=='refund'||item.status=='refunding'}">
{{item.name||item.productName}}
</view>
</view>
<view class="u-flex u-m-t-8">
@@ -54,8 +56,20 @@
<view class="line-th color-666 ">{{returnTotalMoney(item)}}
</view>
</template>
<template v-else-if="isGift(item)">
<view>0.00</view>
<view class="line-th color-666 ">{{returnTotalMoney(item)}}
</view>
</template>
<template v-else>
<view>{{returnTotalMoney(item)}}</view>
<template v-if="user.isVip&&returnVipMoney(item)>0&&returnVipMoney(item)!=returnTotalMoney(item)">
<view>{{returnVipMoney(item)}}</view>
<view class=" color-666 line-th">
{{returnTotalMoney(item)}}</view>
</template>
<template v-else>
<view>{{returnTotalMoney(item)}}</view>
</template>
</template>
<view class="u-m-t-22 color-999 u-font-24">X{{item.number||item.num}}</view>
</view>
@@ -70,10 +84,10 @@
</view>
</template>
<template v-if="canTuiKuan(orderInfo,item)">
<view class="u-flex u-row-right gap-20 u-m-t-20">
<my-button :width="128" :height="48" plain shape="circle"
@tap="tuikuan(item,index)"><text class="no-wrap">退款</text> </my-button>
</view>
<view class="u-flex u-row-right gap-20 u-m-t-20">
<my-button :width="128" :height="48" plain shape="circle" @tap="tuikuan(item,index)"><text
class="no-wrap">退款</text> </my-button>
</view>
</template>
</view>
@@ -99,9 +113,15 @@
</template>
</view>
<view>
<text>小计</text>
<text class="font-bold u-font-32">{{allPrice}}</text>
<view class="u-flex">
<view class="color-red u-m-r-24" v-if="youhuiAllPrice>0">
已优惠{{youhuiAllPrice}}
</view>
<view>
<text>小计</text>
<text class="font-bold u-font-32">{{allPrice}}</text>
</view>
</view>
</view>
@@ -148,9 +168,44 @@
import {
hasPermission
} from '@/commons/utils/hasPermission.js'
import {isTui,canTuiKuan,canTuicai,numSum} from '@/commons/utils/goodsUtil.js'
import {
isTui,isGift,
canTuiKuan,
canTuicai,
numSum
} from '@/commons/utils/goodsUtil.js'
const props = defineProps({
orderInfo: {
type: Object,
default: () => {}
},
data: {
type: Array,
default: () => []
},
seatFee: {
type: Object,
default: () => {}
},
user: {
type: Object,
default: () => {
return {
id: '',
isVip: false
}
}
}
})
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function returnVipMoney(item) {
if (!item.memberPrice || !props.user.isVip) {
return 0
}
return (item.memberPrice * item.num).toFixed(2)
}
function returnTotalMoney(item) {
return (item.price * item.num).toFixed(2)
}
@@ -177,20 +232,7 @@
function printOrder() {
emits('printOrder')
}
const props = defineProps({
orderInfo: {
type: Object,
default: () => {}
},
data: {
type: Array,
default: () => []
},
seatFee: {
type: Object,
default: () => {}
}
})
const seatFeePrice = computed(() => {
if (!props.seatFee.priceAmount) {
@@ -199,21 +241,44 @@
const n = props.seatFee.priceAmount * (props.seatFee.status == 'return' ? 0 : 1)
return n.toFixed(2)
})
const allPrice = computed(() => {
const goodsOriginAllPrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return").reduce((a,
const curTotal = cur.info.reduce((a,
b) => {
// return a + b.priceAmount*1||(b.num*b.price+b.packAmount*1)
// return a + (b.num*b.price+b.packAmount*1)
return a + (b.num * b.price)
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const freePrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift == true || isTui(v)).reduce((a,
b) => {
return a + (b.num * b.price)
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const vipDiscountPrice = computed(() => {
if (!props.user.isVip) {
return 0
}
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return"&&v.memberPrice&&(v.memberPrice!=v.price)).reduce((a,
b) => {
return a + (b.num * (b.price-b.memberPrice))
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const youhuiAllPrice=computed(()=>{
console.log(freePrice.value);
return (freePrice.value*1+vipDiscountPrice.value*1).toFixed(2)
})
const packFee = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.gift != true && v.status !== "return").reduce((a,
@@ -225,7 +290,9 @@
return goodsPrice.toFixed(2)
})
const allPrice = computed(() => {
return (goodsOriginAllPrice.value-freePrice.value-vipDiscountPrice.value).toFixed(2)
})
const goodsNumber = computed(() => {
let result = 0