订单管理更新

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>

View File

@@ -2,11 +2,11 @@
<view class="min-page bg-gray u-font-28 u-p-30">
<user-vue :orderInfo="orderDetail.info" :user="user"></user-vue>
<view class="default-box-padding bg-fff border-r-12 u-m-t-20">
<text class="color-666">桌位号</text>
<text class="font-bold">{{orderDetail.info.tableName}}</text>
<text class="">桌位号</text>
<text class="">{{orderDetail.info.tableName}}</text>
</view>
<goods-list @printOrder="onPrintOrder" @tuikuan="onTuikuan" :orderInfo="orderDetail.info"
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee.totalAmount" @tuicai="onTuiCai"></goods-list>
:data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai"></goods-list>
<template v-if="orderDetail.seatFee.totalNumber&&orderDetail.seatFee.totalAmount">
<extra-vue @tuicai="onSeatFeeTuicai" @tuikuan="onSeatFeeTuiKuan" :orderInfo="orderDetail.info"
:data="orderDetail.seatFee"></extra-vue>
@@ -88,24 +88,23 @@
id,
productId,
productSkuId,
productName,
productSkuName,
name,
cartId,
num,
priceAmount,
price
number,
totalAmount,
salePrice
} = seatFee
go.to('PAGES_ORDER_TUIKUAN', {
id,
cartId,
id:orderDetail.info.id,
cartId:seatFee.id,
productId,
productSkuId,
productName,
num,
productName:name,
num:number,
number: 0,
productSkuName: productSkuName || '',
priceAmount,
price
productSkuName: '',
priceAmount:totalAmount,
price:salePrice
})
}
@@ -120,8 +119,8 @@
cartId: tuicai.selGoods.hasOwnProperty('cartId') ? tuicai.selGoods.cartId : tuicai.selGoods.id,
tableId: orderDetail.info.tableId,
})
tuicai.selGoods.status = 'return'
tuicai.show = false
init()
}
@@ -263,11 +262,12 @@
}
}
orderDetail.seatFee = {
name: '餐位费',
orderDetail.seatFee = res.seatInfo|| {
name: '客座费',
number: res.seatCount,
totalNumber: res.seatCount,
totalAmount: res.seatAmount
totalAmount: res.seatAmount,
status:''
}
orderDetail.goodsList = Object.entries(goodsMap).map(([key, value]) => ({
info: value,

View File

@@ -28,7 +28,7 @@
v-if="discount.price&&discount.currentPrice!=order.amount">
<view>服务员改价</view>
<view class=" u-flex u-col-center">
<text style="color: rgb(255, 95, 46);">-{{order.amount- discount.currentPrice}}</text>
<text style="color: rgb(255, 95, 46);">-{{to2(order.amount- discount.currentPrice)}}</text>
</view>
</view>
</view>
@@ -132,7 +132,12 @@
clearInterval(timer)
timer = null
}
function to2(n){
if(!n){
return ''
}
return n.toFixed(2)
}
const pays = reactive({
list: ['扫码收款', '二维码收款'],
selIndex: 0,
@@ -179,6 +184,7 @@
function editDiscountConfirm(form) {
console.log(form);
Object.assign(discount, form)
getPayUrl()
}
async function getPayType() {
const payTypeList = await Api.$getPayType()
@@ -196,6 +202,7 @@
infoBox.showToast('支付成功')
setTimeout(() => {
// uni.$emit('orderDetail:update')
uni.$emit('update:createOrderIndex')
uni.navigateBack({
delta: 2
})
@@ -270,13 +277,17 @@
async function init() {
const res = await orderApi.tbOrderInfoDetail(order.orderId)
Object.assign(order, res)
getPayUrl()
}
onLoad(async(opt) => {
function getPayUrl(){
orderApi.$getOrderPayUrl({
orderId: opt.orderId
orderId: order.id,
payAmount:discount.currentPrice?discount.currentPrice:order.amount
}).then(res => {
payCodeUrl.value = res
})
}
onLoad(async(opt) => {
console.log(opt);
Object.assign(order, opt)
const payTypeList = await Api.$getPayType()