修改订单部分逻辑代码,提取公共方法
This commit is contained in:
@@ -2,16 +2,16 @@
|
||||
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="packeFee>0||data.totalAmount>0">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="font-bold">附加费</view>
|
||||
<template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
|
||||
<template v-if="extraCanTuicai(orderInfo,data)">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
|
||||
</template>
|
||||
<template v-if="orderInfo.status=='closed'&&data.status!='return'">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
|
||||
<template v-if=" extraCanTuiKuan(orderInfo,data)">
|
||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
|
||||
</template>
|
||||
</view>
|
||||
<view>
|
||||
<template v-if="data.status!='return'">
|
||||
<view class="u-flex u-row-between u-m-t-24">
|
||||
<view class="u-flex u-row-between u-m-t-24" v-if="data.totalAmount*1>0">
|
||||
<view>{{data.name||'餐位费'}}</view>
|
||||
<view>x{{data.number||0}}</view>
|
||||
<view class="price-min-width">¥{{data.totalAmount}}</view>
|
||||
@@ -49,6 +49,16 @@
|
||||
import {
|
||||
computed
|
||||
} from 'vue'
|
||||
import {
|
||||
returnCanComputedGoodsArr,canComputedPackFee,
|
||||
returnPackFee
|
||||
} from '@/commons/utils/goodsUtil.js'
|
||||
function extraCanTuicai(orderInfo,data){
|
||||
return orderInfo.status=='unpaid'&&data.status!='return'&&data.totalAmount*1>0
|
||||
}
|
||||
function extraCanTuiKuan(orderInfo,data){
|
||||
return orderInfo.status=='closed'&&data.status!='return'&&data.totalAmount*1>0
|
||||
}
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
@@ -72,16 +82,16 @@
|
||||
return 0
|
||||
}
|
||||
return props.orderInfo.detailList.reduce((prve, cur) => {
|
||||
return prve + (cur.packAmount>0?cur.num:0)
|
||||
return prve + (cur.packAmount > 0 ? cur.num : 0)
|
||||
}, 0)
|
||||
})
|
||||
const packeFee = computed(() => {
|
||||
if (!props.orderInfo.detailList) {
|
||||
return 0
|
||||
}
|
||||
return props.orderInfo.detailList.reduce((prve, cur) => {
|
||||
return prve + cur.packAmount
|
||||
}, 0).toFixed(2)
|
||||
const arr = returnCanComputedGoodsArr(props.orderInfo.detailList)
|
||||
console.log(arr);
|
||||
return returnPackFee(arr)
|
||||
})
|
||||
|
||||
const statusMap = {
|
||||
@@ -113,7 +123,8 @@
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.price-min-width{
|
||||
|
||||
.price-min-width {
|
||||
min-width: 100rpx;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user