修改订单部分逻辑代码,提取公共方法
This commit is contained in:
parent
a958a401b3
commit
b8977bd81a
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@
|
|||
|
||||
<view class="">
|
||||
<view class="u-flex">
|
||||
<view class="tui" v-if="item.status=='return'||item.status=='refund'">
|
||||
已退
|
||||
<view class="tui" v-if="isTui(item)">
|
||||
{{item.status=='refunding'?'退款中':'已退'}}
|
||||
</view>
|
||||
<view :class="{'line-th':item.status=='return'||item.status=='refund'}">{{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">
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="u-text-right u-m-t-28">
|
||||
<template v-if="item.status=='return'||item.gift||item.status=='refund'">
|
||||
<template v-if="isTui(item)">
|
||||
<view>¥0.00</view>
|
||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||
</view>
|
||||
|
|
@ -62,20 +62,18 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-24" v-if="item.status!='return'">
|
||||
<template v-if="canTuicai(orderInfo,item)">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-24">
|
||||
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
|
||||
<my-button :width="128" :height="48" plain shape="circle" @tap="tuicai(item,index)"><text
|
||||
class="no-wrap">退菜</text></my-button>
|
||||
</view>
|
||||
</template>
|
||||
<template v-if="item.status!='refund'&&!item.gift">
|
||||
<template v-if="orderInfo.status=='closed'||orderInfo.status=='refund'">
|
||||
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
|
||||
<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>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
</view>
|
||||
|
|
@ -149,6 +147,7 @@
|
|||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js'
|
||||
import {isTui,canTuiKuan,canTuicai} from '@/commons/utils/goodsUtil.js'
|
||||
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
|
||||
|
||||
function returnTotalMoney(item) {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@
|
|||
<view class="no-wrap u-m-r-32">打包费</view>
|
||||
<view>¥{{data.packFee||0}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between u-m-t-32 u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
|
||||
<view style="height: 32rpx;" v-if="data.packFee>0&&data.seatInfo&&data.seatInfo.priceAmount>0"></view>
|
||||
<view class="u-flex u-row-between u-col-top" v-if="data.seatInfo&&data.seatInfo.priceAmount>0">
|
||||
<view class="no-wrap u-m-r-32">{{data.seatInfo.productName}}</view>
|
||||
<view>¥{{data.seatInfo.priceAmount}}</view>
|
||||
</view>
|
||||
|
|
@ -72,7 +73,7 @@
|
|||
</view>
|
||||
<view class="u-m-t-32">
|
||||
<view class="u-flex u-row-right">
|
||||
<text>小计¥</text>
|
||||
<text>总计¥</text>
|
||||
<text class="font-bold u-font-32">{{data.orderAmount}}</text>
|
||||
</view>
|
||||
<view class="u-flex u-row-right u-m-t-24">
|
||||
|
|
@ -87,6 +88,7 @@
|
|||
import dayjs from 'dayjs';
|
||||
import orderEnum from '@/commons/orderEnum.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {isTui,canTuiKuan,canTuicai} from '@/commons/utils/goodsUtil.js'
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
|
|
|
|||
Loading…
Reference in New Issue