修改订单部分逻辑代码,提取公共方法
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="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="u-flex u-row-between">
|
||||||
<view class="font-bold">附加费</view>
|
<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>
|
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="orderInfo.status=='closed'&&data.status!='return'">
|
<template v-if=" extraCanTuiKuan(orderInfo,data)">
|
||||||
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
|
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<template v-if="data.status!='return'">
|
<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>{{data.name||'餐位费'}}</view>
|
||||||
<view>x{{data.number||0}}</view>
|
<view>x{{data.number||0}}</view>
|
||||||
<view class="price-min-width">¥{{data.totalAmount}}</view>
|
<view class="price-min-width">¥{{data.totalAmount}}</view>
|
||||||
|
|
@ -49,6 +49,16 @@
|
||||||
import {
|
import {
|
||||||
computed
|
computed
|
||||||
} from 'vue'
|
} 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({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -72,16 +82,16 @@
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return props.orderInfo.detailList.reduce((prve, cur) => {
|
return props.orderInfo.detailList.reduce((prve, cur) => {
|
||||||
return prve + (cur.packAmount>0?cur.num:0)
|
return prve + (cur.packAmount > 0 ? cur.num : 0)
|
||||||
}, 0)
|
}, 0)
|
||||||
})
|
})
|
||||||
const packeFee = computed(() => {
|
const packeFee = computed(() => {
|
||||||
if (!props.orderInfo.detailList) {
|
if (!props.orderInfo.detailList) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return props.orderInfo.detailList.reduce((prve, cur) => {
|
const arr = returnCanComputedGoodsArr(props.orderInfo.detailList)
|
||||||
return prve + cur.packAmount
|
console.log(arr);
|
||||||
}, 0).toFixed(2)
|
return returnPackFee(arr)
|
||||||
})
|
})
|
||||||
|
|
||||||
const statusMap = {
|
const statusMap = {
|
||||||
|
|
@ -113,7 +123,8 @@
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.price-min-width{
|
|
||||||
|
.price-min-width {
|
||||||
min-width: 100rpx;
|
min-width: 100rpx;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@
|
||||||
|
|
||||||
<view class="">
|
<view class="">
|
||||||
<view class="u-flex">
|
<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>
|
||||||
<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>
|
</view>
|
||||||
<view class="u-flex u-m-t-8">
|
<view class="u-flex u-m-t-8">
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-text-right u-m-t-28">
|
<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>¥0.00</view>
|
||||||
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
<view class="line-th color-666 ">¥{{returnTotalMoney(item)}}
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -62,20 +62,18 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<template v-if="orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'">
|
<template v-if="canTuicai(orderInfo,item)">
|
||||||
<view class="u-flex u-row-right gap-20 u-m-t-24" v-if="item.status!='return'">
|
<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 :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
|
<my-button :width="128" :height="48" plain shape="circle" @tap="tuicai(item,index)"><text
|
||||||
class="no-wrap">退菜</text></my-button>
|
class="no-wrap">退菜</text></my-button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="item.status!='refund'&&!item.gift">
|
<template v-if="canTuiKuan(orderInfo,item)">
|
||||||
<template v-if="orderInfo.status=='closed'||orderInfo.status=='refund'">
|
<view class="u-flex u-row-right gap-20 u-m-t-20">
|
||||||
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
|
|
||||||
<my-button :width="128" :height="48" plain shape="circle"
|
<my-button :width="128" :height="48" plain shape="circle"
|
||||||
@tap="tuikuan(item,index)"><text class="no-wrap">退款</text> </my-button>
|
@tap="tuikuan(item,index)"><text class="no-wrap">退款</text> </my-button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -149,6 +147,7 @@
|
||||||
import {
|
import {
|
||||||
hasPermission
|
hasPermission
|
||||||
} from '@/commons/utils/hasPermission.js'
|
} from '@/commons/utils/hasPermission.js'
|
||||||
|
import {isTui,canTuiKuan,canTuicai} from '@/commons/utils/goodsUtil.js'
|
||||||
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
|
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
|
||||||
|
|
||||||
function returnTotalMoney(item) {
|
function returnTotalMoney(item) {
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@
|
||||||
<view class="no-wrap u-m-r-32">打包费</view>
|
<view class="no-wrap u-m-r-32">打包费</view>
|
||||||
<view>¥{{data.packFee||0}}</view>
|
<view>¥{{data.packFee||0}}</view>
|
||||||
</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 class="no-wrap u-m-r-32">{{data.seatInfo.productName}}</view>
|
||||||
<view>¥{{data.seatInfo.priceAmount}}</view>
|
<view>¥{{data.seatInfo.priceAmount}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -72,7 +73,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="u-m-t-32">
|
<view class="u-m-t-32">
|
||||||
<view class="u-flex u-row-right">
|
<view class="u-flex u-row-right">
|
||||||
<text>小计¥</text>
|
<text>总计¥</text>
|
||||||
<text class="font-bold u-font-32">{{data.orderAmount}}</text>
|
<text class="font-bold u-font-32">{{data.orderAmount}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="u-flex u-row-right u-m-t-24">
|
<view class="u-flex u-row-right u-m-t-24">
|
||||||
|
|
@ -87,6 +88,7 @@
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import orderEnum from '@/commons/orderEnum.js'
|
import orderEnum from '@/commons/orderEnum.js'
|
||||||
import go from '@/commons/utils/go.js'
|
import go from '@/commons/utils/go.js'
|
||||||
|
import {isTui,canTuiKuan,canTuicai} from '@/commons/utils/goodsUtil.js'
|
||||||
import {
|
import {
|
||||||
computed,
|
computed,
|
||||||
reactive,
|
reactive,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue