From 9c0a4e704f4c7f940e9839e838712b7a4a6e27b2 Mon Sep 17 00:00:00 2001
From: YeMingfei666 <1619116647@qq.com>
Date: Thu, 10 Oct 2024 16:23:17 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=AE=A1=E7=90=86=E6=9B=B4?=
=?UTF-8?q?=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pagesOrder/detail/components/extra.vue | 33 ++++--
pagesOrder/detail/components/list.vue | 143 +++++++++++++++++--------
pagesOrder/detail/detail.vue | 38 +++----
pagesOrder/pay-order/pay-order.vue | 19 +++-
4 files changed, 159 insertions(+), 74 deletions(-)
diff --git a/pagesOrder/detail/components/extra.vue b/pagesOrder/detail/components/extra.vue
index 145294b..ad38e62 100644
--- a/pagesOrder/detail/components/extra.vue
+++ b/pagesOrder/detail/components/extra.vue
@@ -2,18 +2,30 @@
附加费
-
+
退菜
退款
-
- {{data.name||'餐位费'}}
- x{{data.number}}
- ¥{{data.number}}
-
+
+
+ {{data.name||'餐位费'}}
+ x{{data.number}}
+ ¥{{data.totalAmount}}
+
+
+
+
+
+ {{data.name||'餐位费'}}
+ 已退
+
+ x{{data.number}}
+ ¥{{data.totalAmount}}
+
+
@@ -49,4 +61,13 @@
\ No newline at end of file
diff --git a/pagesOrder/detail/components/list.vue b/pagesOrder/detail/components/list.vue
index 8e510ab..fbdea30 100644
--- a/pagesOrder/detail/components/list.vue
+++ b/pagesOrder/detail/components/list.vue
@@ -1,8 +1,8 @@
-
+
共
- {{goodsNumber}}
+ {{goodsNumber}}
份菜品
@@ -16,23 +16,24 @@
-
+
已退
- {{item.name||item.productName}}
+ {{item.name||item.productName}}
+
{{item.productSkuName||''}}
- ¥0.00
- ¥{{item.salePrice||item.price}}
+ ¥0.00
+ ¥{{item.salePrice||item.price}}
- ¥{{item.salePrice||item.price}}
+ ¥{{item.salePrice||item.price}}
X{{item.number||item.num}}
@@ -42,44 +43,70 @@
- 退菜
+ 退菜
- 退款
+ 退款
-
+
备注
{{orderInfo.remark}}
-
-
+
+
未支付
-
+
+
+ 退款成功
+
+
-
+
小计¥
{{allPrice}}
-
+
+
+
+ 退款金额
+
+ {{orderInfo.originAmount}}
+
+
+
+ 退款原因
+
+ 0.00
+
+
+
+
+
+ 退款成功
+
+
+
总计¥
- {{seatFee*1+allPrice*1}}
+ {{allPrice*1+seatFeePrice*1}}
@@ -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
})
-
\ No newline at end of file
diff --git a/pagesOrder/detail/detail.vue b/pagesOrder/detail/detail.vue
index a98e24d..9412ce8 100644
--- a/pagesOrder/detail/detail.vue
+++ b/pagesOrder/detail/detail.vue
@@ -2,11 +2,11 @@
- 桌位号:
- {{orderDetail.info.tableName}}
+ 桌位号:
+ {{orderDetail.info.tableName}}
+ :data="orderDetail.goodsList" :seatFee="orderDetail.seatFee" @tuicai="onTuiCai">
@@ -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,
diff --git a/pagesOrder/pay-order/pay-order.vue b/pagesOrder/pay-order/pay-order.vue
index 4560c98..c356def 100644
--- a/pagesOrder/pay-order/pay-order.vue
+++ b/pagesOrder/pay-order/pay-order.vue
@@ -28,7 +28,7 @@
v-if="discount.price&&discount.currentPrice!=order.amount">
服务员改价
- -¥{{order.amount- discount.currentPrice}}
+ -¥{{to2(order.amount- discount.currentPrice)}}
@@ -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()