代客下单部分逻辑处理优化,订单管理退款退菜结账跳转功能问题处理

This commit is contained in:
2024-11-01 11:16:12 +08:00
parent 924f296ad1
commit 8c99f49700
7 changed files with 162 additions and 52 deletions

View File

@@ -96,6 +96,8 @@ export default {
<style lang="scss" scoped>
::v-deep .number-box .el-input__inner {
border: none;
padding: 0 2px;
text-align: center;
}
.icon-add {
color: #1890ff;

View File

@@ -1,19 +1,32 @@
<template>
<el-dialog title="退菜" width="410px" :visible.sync="show" @close="reset" :modal="modal">
<div class="flex u-row-between u-p-b-20 border-bottom">
<span>退菜数量</span>
<div class="u-flex">
<number-box v-model="number" :min="1" :max="max"></number-box>
<el-dialog
title="退菜"
width="410px"
:visible.sync="show"
@close="reset"
:modal="modal"
>
<div class="u-p-b-16 border-bottom">
<div class="flex u-row-between">
<span>退菜数量</span>
<div class="u-flex" v-if="!isSeatFee">
<number-box v-model="number" :min="1" :max="max"></number-box>
</div>
<div class="u-flex" v-else>
{{ number }}
</div>
</div>
<div class="u-font-12 color-999 u-m-t-8" v-if="isSeatFee">
<div><span class="color-red">*</span><span>客座费只能全退</span> </div>
</div>
</div>
<div class="u-m-t-10 u-font-12 color-999">
菜品已点数量 {{max}}
</div>
<div class="u-m-t-10 u-font-12 color-999">菜品已点数量 {{ max }} </div>
<div class="u-m-t-26">
<div><span>退菜原因</span> <span class="color-red">*</span></div>
</div>
<div class="u-flex u-flex-wrap tags ">
<div class="u-flex u-flex-wrap tags">
<div
class="tag"
v-for="(tag, index) in tags"
@@ -41,28 +54,23 @@
</el-dialog>
</template>
<script>
import numberBox from './number-box.vue';
import numberBox from "./number-box.vue";
import {returnIsSeatFee} from '../util.js'
export default {
components:{numberBox},
props:{
modal:{
type:Boolean,
default:true
components: { numberBox },
props: {
modal: {
type: Boolean,
default: true,
},
goods:{
type:Object,
default:()=>{
return{}
}
max: {
type: Number,
default: 1,
},
max:{
type:Number,
default:1
}
},
data() {
return {
number:1,
number: 1,
isPrint: false,
tagSel: -1,
show: false,
@@ -72,17 +80,27 @@ export default {
{ label: "等待时间过长", checked: false },
],
note: "",
goods:{
productId: -999
}
};
},
computed:{
isSeatFee(){
return returnIsSeatFee(this.goods)
}
},
methods: {
changeSel(item) {
item.checked = !item.checked;
},
reset() {
this.note = "";
this.number=1;
console.log(this.number)
this.number = 1;
this.tags.map(v=>{
v.checked = false;
})
console.log(this.number);
},
delTag(index) {
this.tags.splice(index, 1);
@@ -93,22 +111,30 @@ export default {
}
this.note = tag + "," + this.note;
},
open(note) {
open(item) {
this.goods = item?item:this.goods;
this.show = true;
this.number=1;
if (item != "-999") {
this.number = 1;
} else {
this.number = item.num;
}
},
close() {
this.show = false;
this.number=1;
this.number = 1;
},
confirm() {
const selTag=this.tags.filter(item=>item.checked).map(item=>item.label).join(",")
const note=selTag+(this.note.length>0?","+this.note:"");
console.log(note)
if(!note){
const selTag = this.tags
.filter((item) => item.checked)
.map((item) => item.label)
.join(",");
const note = selTag + (this.note.length > 0 ? "," + this.note : "");
console.log(note);
if (!note) {
return this.$message.error("请输入退菜原因");
}
this.$emit("confirm", {note:note,num:this.number});
this.$emit("confirm", { note: note, num: this.number });
this.close();
},
},
@@ -120,6 +146,7 @@ export default {
::v-deep .el-dialog__body {
margin-bottom: 14px;
margin-top: 14px;
padding: 0 20px;
}
::v-deep .el-tag {
margin-top: 10px;

View File

@@ -1525,7 +1525,8 @@ export default {
);
},
title() {
return this.table ? "代客下单" + `(${this.table.name})` : "代客下单";
// return this.table ? "代客下单" + `(${this.table.name})` : "代客下单";
return '代客下单'
},
allGiftMoney() {
const nowprice = this.order.list
@@ -1623,11 +1624,9 @@ export default {
const oldackFee = returnPackFee(this.order.old.list);
const packFee = nowPackFee + oldackFee;
const returnStatus = ["return", "refunding", "refund"];
console.log(this.order.seatFee);
const seatFee =
this.order.seatFee.totalAmount *
(returnStatus.includes(this.order.seatFee.status) ? 0 : 1);
console.log(nowPackFee, oldackFee, packFee, seatFee);
return (
(oldPrice + price + +packFee + seatFee) *
this.createOrder.discount
@@ -1708,9 +1707,16 @@ export default {
}
},
table(newval, oldval) {
this.setPostPay();
this.setUseType();
if(oldval.tableId&&newval.tableId){
this.perpole = 1;
this.isCreateOrder = false;
}
if(this.key=='isJieZhang'){
this.isCreateOrder = false;
this.key=''
}
if (newval && newval.tableId) {
this.createOrder.data.amount = 0;
this.createOrder.data.id = "";
@@ -2034,6 +2040,8 @@ export default {
//munchies 先付 restaurant 后付
this.postPay = this.shopInfo.registerType == "munchies" ? false : true;
}
console.log('this.postPay')
console.log(this.postPay)
},
//获取店铺信息
async getShopInfo() {
@@ -2069,6 +2077,7 @@ export default {
},
//台桌变化时重新获取取餐号、购物车数据,如果是正在结账状态,创建订单到待支付页面
async onTableChange() {
const perpole=this.perpole || ''
const tableRes = await $returnTableDetail({
tableId: this.table.tableId,
});
@@ -2085,7 +2094,6 @@ export default {
this.table.status == "idle" &&
!this.shopInfo.isTableFee
) {
this.perpole = 1;
await this.changePerpole();
}
//设置就餐类型
@@ -2102,6 +2110,7 @@ export default {
}
this.getCacheOrder();
console.log(this.isCreateOrder);
this.perpole=perpole||this.perpole
if (!this.shopInfo.isTableFee && this.table.tableId && this.perpole > 0) {
//不免餐位费
await this.changePerpole();
@@ -3130,9 +3139,9 @@ export default {
this.order.seatFee = seatFee
? {
...seatFee,
totalNumber: seatFee.num,
number: seatFee.num,
name: seatFee.productName,
totalNumber: seatFee.num||seatFee.number,
num: seatFee.number,
name: seatFee.name|| seatFee.productName,
totalAmount: seatFee.priceAmount || seatFee.totalAmount,
}
: this.order.seatFee;
@@ -3329,6 +3338,7 @@ export default {
key = params.key,
perpoleNumber = params.num || "";
this.key = key;
this.perpole = perpoleNumber;
const shopId = localStorage.getItem("shopId");
const shopInfo = await tbShopInfo(shopId);
@@ -3361,7 +3371,6 @@ export default {
console.log(params);
if (key == "isJieZhang") {
this.perpole = perpoleNumber;
this.table = params.tableId ? { name: item.name } : "";
if (params.orderId) {
const orderRes = await this.getOrderData(params);
@@ -3395,7 +3404,6 @@ export default {
}
this.perpole = perpoleNumber;
this.table = params.tableId ? item : "";
},
async getOrderData(params) {

View File

@@ -107,4 +107,11 @@ export function formatOrderGoodsList(arr){
info: value,
placeNum: key||1
}))
}
export function returnIsSeatFee(item){
if(!item){
return false
}
return item.productId=="-999"
}