订单管理更新

This commit is contained in:
2024-10-10 16:23:17 +08:00
parent 0632e395ce
commit 9c0a4e704f
4 changed files with 159 additions and 74 deletions

View File

@@ -2,18 +2,30 @@
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<view class="u-flex u-row-between">
<view class="font-bold">附加费</view>
<template v-if="orderInfo.status=='unpaid'">
<template v-if="orderInfo.status=='unpaid'&&data.status!='return'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuicai">退菜</my-button>
</template>
<template v-if="orderInfo.status=='closed'">
<my-button plain shape="circle" :width="160" :height="56" @click="tuikuan">退款</my-button>
</template>
</view>
<view class="u-flex u-row-between u-m-t-20">
<view>{{data.name||'餐位费'}}</view>
<view>x{{data.number}}</view>
<view>{{data.number}}</view>
</view>
<template v-if="data.status!='return'">
<view class="u-flex u-row-between u-m-t-20">
<view>{{data.name||'餐位费'}}</view>
<view>x{{data.number}}</view>
<view>{{data.totalAmount}}</view>
</view>
</template>
<template v-else>
<view class="u-flex u-row-between u-m-t-20 color-999">
<view class="u-flex">
<view class="line-th ">{{data.name||'餐位费'}}</view>
<view class="tag yitui u-m-l-10">已退</view>
</view>
<view class="line-th">x{{data.number}}</view>
<view class="line-th">{{data.totalAmount}}</view>
</view>
</template>
</view>
</template>
@@ -49,4 +61,13 @@
</script>
<style lang="scss" scoped>
.tag {
padding: 0 6rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.yitui {
background-color: rgb(188, 188, 188);
color: #fff;
}
}
</style>

View File

@@ -1,8 +1,8 @@
<template>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20" v-if="data.length">
<view class="u-font-32 font-bold">
<view class="u-font-32 color-999">
<text></text>
<text class="color-main font-bold"> {{goodsNumber}}</text>
<text class="color-333 "> {{goodsNumber}}</text>
<text>份菜品</text>
</view>
<view class="u-m-b-20 u-m-t-20" v-for="(order,orderIndex) in data" :key="orderIndex">
@@ -16,23 +16,24 @@
</view>
<view class="u-p-l-30 u-flex-1">
<view class="u-flex u-row-between u-col-top">
<view class="">
<view class="u-flex">
<view class="tui" v-if="item.status=='return'">
已退
</view>
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}</view>
<view :class="{'line-th':item.status=='return'}">{{item.name||item.productName}}
</view>
</view>
<view class="color-999 u-font-24 u-m-t-10">{{item.productSkuName||''}}</view>
</view>
<view class="u-text-right">
<template v-if="item.status=='return'">
<view >0.00</view>
<view class="line-th color-666 u-font-24">{{item.salePrice||item.price}}</view>
<view>0.00</view>
<view class="line-th color-666 u-font-24">{{item.salePrice||item.price}}</view>
</template>
<template v-else>
<view >{{item.salePrice||item.price}}</view>
<view>{{item.salePrice||item.price}}</view>
</template>
<view class="u-m-t-10 u-font-24">X{{item.number||item.num}}</view>
</view>
@@ -42,44 +43,70 @@
<template v-if="orderInfo.status=='unpaid'">
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
<!-- <my-button :height="60" color="#333" plain type="cancel" shape="circle">更多操作</my-button> -->
<my-button :width="168" :height="60" plain shape="circle" @tap="tuicai(item,index)">退菜</my-button>
<my-button :width="168" :height="60" plain shape="circle"
@tap="tuicai(item,index)">退菜</my-button>
</view>
</template>
<template v-if="orderInfo.status=='closed'">
<view class="u-flex u-row-right gap-20 u-m-t-20" v-if="item.status!='return'">
<my-button :width="168" :height="60" plain shape="circle" @tap="tuikuan(item,index)">退款</my-button>
<my-button :width="168" :height="60" plain shape="circle"
@tap="tuikuan(item,index)">退款</my-button>
</view>
</template>
</view>
</view>
<view class="bg-gray u-p-20 u-m-t-20">
<view class="bg-gray u-p-20 u-m-t-20" v-if="orderInfo.remark">
<view>备注</view>
<view class="u-m-t-10">{{orderInfo.remark}}</view>
</view>
</view>
<view class="u-m-t-40">
<view class="u-flex u-row-between border-bottom u-p-b-20">
<view class="u-m-t-32">
<view class="u-flex u-row-between border-top u-p-t-32">
<view>
<template v-if="orderInfo.status=='unpaid'">
<view class="tag no-pay">
未支付
</view>
</template>
<template v-if="orderInfo.status=='refund'">
<view class="tag refund">
退款成功
</view>
</template>
</view>
<view>
<text>小计</text>
<text class="font-bold u-font-32">{{allPrice}}</text>
</view>
</view>
<template v-if="orderInfo.status=='refund'">
<view class="u-flex u-row-between u-m-t-32">
<view>退款金额</view>
<view class="color-999">
<text class="">{{orderInfo.originAmount}}</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-32">
<view>退款原因</view>
<view class="color-999">
<text class="">0.00</text>
</view>
</view>
<view class="u-flex u-row-between u-m-t-32 u-p-b-24 border-bottom">
<view></view>
<view class="">
<text class="">退款成功</text>
</view>
</view>
</template>
<view class="u-flex u-row-between u-m-t-20">
<view></view>
<view>
<text>总计</text>
<text class="font-bold u-font-32">{{seatFee*1+allPrice*1}}</text>
<text class="font-bold u-font-32">{{allPrice*1+seatFeePrice*1}}</text>
</view>
</view>
<view class="u-m-t-30">
@@ -94,18 +121,21 @@
computed
} from 'vue';
import color from '@/commons/color.js'
const emits=defineEmits(['tuicai','tuikuan','printOrder'])
function tuicai(item,index){
emits('tuicai',item,index)
const emits = defineEmits(['tuicai', 'tuikuan', 'printOrder'])
function tuicai(item, index) {
emits('tuicai', item, index)
}
function tuikuan(item,index){
emits('tuikuan',item,index)
function tuikuan(item, index) {
emits('tuikuan', item, index)
}
function printOrder(){
function printOrder() {
emits('printOrder')
}
const props = defineProps({
orderInfo:{
orderInfo: {
type: Object,
default: () => {}
},
@@ -113,55 +143,79 @@
type: Array,
default: () => []
},
seatFee:{
type:[String,Number],
default:0
seatFee: {
type: Object,
default: () => {}
}
})
const allPrice = computed(() => {
return props.data.reduce((prve, cur) => {
const curTotal=cur.info.filter(v=>v.isGift !== "true"&& v.status !== "return").reduce((a,b)=>{
return a+(b.salePrice||b.price) * (b.number||b.num)
},0)
return prve + curTotal
}, 0).toFixed(2)
const seatFeePrice = computed(() => {
if (props.seatFee.totalAmount) {
return 0
}
const n = props.seatFee.totalAmount * (props.seatFee.status == 'return' ? 0 : 1)
return n.toFixed(2)
})
const allPrice = computed(() => {
const goodsPrice = props.data.reduce((prve, cur) => {
const curTotal = cur.info.filter(v => v.isGift !== "true" && v.status !== "return").reduce((a,
b) => {
return a + (b.salePrice || b.price) * (b.number || b.num)
}, 0)
return prve + curTotal
}, 0)
return goodsPrice.toFixed(2)
})
const goodsNumber = computed(() => {
let result = 0
result = props.data.reduce((a, b) => {
const bTotal = b.info.reduce((prve, cur) => {
return prve + (cur.number||cur.num) * 1;
return prve + (cur.number || cur.num) * 1;
}, 0);
return a + bTotal
}, 0)
return result
})
</script>
<style lang="scss" scoped>
.img {
width: 70rpx;
height: 70rpx;
width: 152rpx;
height: 152rpx;
}
.border-top {
border-color: #F6F6F6;
}
.border-bottom {
border-color: rgb(240, 240, 240);
// border-color: rgb(240, 240, 240);
border-color: #F6F6F6;
}
.line-th{
.line-th {
text-decoration: line-through;
}
.tag {
padding: 2rpx 8rpx;
border-radius: 8rpx;
.tag {
padding: 4rpx 8rpx 2rpx 10rpx;
border-radius: 8rpx;
font-size: 24rpx;
&.no-pay {
background-color: rgb(170, 170, 170);
color: #fff;
}
&.refund{
background-color: #FCE7E7;
padding: 8rpx 20rpx 6rpx 22rpx;
color: #EB4F4F;
}
}
.tui{
.tui {
background-color: rgb(239, 239, 239);
border-radius: 4rpx;
margin-right: 6rpx;
@@ -169,5 +223,4 @@
padding: 0 4rpx;
font-size: 20rpx;
}
</style>