代客下单增加餐位费展示

This commit is contained in:
2024-09-12 16:48:33 +08:00
parent c95c630a75
commit 3df43ddbaa
3 changed files with 192 additions and 82 deletions

View File

@@ -224,7 +224,10 @@
</div>
</div>
<div class="order-list-all u-p-l-20" style="flex: 1; overflow-y: scroll">
<div
class="order-list-all u-p-l-20"
style="flex: 1; overflow-y: scroll"
>
<div class="list">
<!-- 当前购物车列表 -->
<template v-if="order.list.length">
@@ -277,7 +280,23 @@
></cart-item>
</div>
</template>
<!-- 餐位费 -->
<template v-if="order.seatFee&&order.seatFee.totalAmount>0">
<div class="carts_list_title">
餐位费
</div>
<cart-item
@itemClick="changeOrderOldSel"
:canChangeNumber="false"
key="seatFee"
:index="0"
:item="order.seatFee"
isSeatFee
:selIndex="order.old.selIndex"
:placeNum="-1"
:selPlaceNum="order.selPlaceNum"
></cart-item>
</template>
<div class="order_remark" v-if="note.content">
订单备注 {{ note.content }}
</div>
@@ -286,65 +305,66 @@
<div class="w-full bottom">
<div class="border-top">
<div class="flex row-right youhui" v-if="giftLen">
<span> 已优惠{{ allGiftMoney | to2 }} </span>
<i class="el-icon-arrow-right"></i>
</div>
<span> 已优惠{{ allGiftMoney | to2 }} </span>
<i class="el-icon-arrow-right"></i>
</div>
<div class="flex row-between">
<el-checkbox
<div class="flex row-between">
<el-button type="text" @click="printOrder"
>打印制作单</el-button
>
<!-- <el-checkbox
v-model="order.allPack"
:disabled="!this.order.list.length"
>打包</el-checkbox
>
<div class="flex">
<span class="color-666" style="margin-right: 5px"
>{{ allNumber }}</span
>
<span class="color-000 ft-18">{{ allPrice }} </span>
> -->
<div class="flex">
<span class="color-666" style="margin-right: 5px"
>{{ allNumber }}</span
>
<span class="color-000 ft-18">{{ allPrice }} </span>
</div>
</div>
</div>
<div class="flex mt-14">
<template v-if="isCreateOrder">
<button
class="my-btn flex-1 default"
@click="createOrderClose"
>
<span>加菜/返回</span>
</button>
<div style="width: 15px"></div>
<button class="my-btn flex-1 primary" @click="payOrder">
<span>立即支付</span>
</button>
</template>
<template v-else>
<template v-if="postPay">
<div class="flex mt-14">
<template v-if="isCreateOrder">
<button
class="my-btn flex-1 default"
@click="createOrderClose"
>
<span>加菜/返回</span>
</button>
<div style="width: 15px"></div>
<button class="my-btn flex-1 primary" @click="payOrder">
<span>立即支付</span>
</button>
</template>
<template v-else>
<template v-if="postPay">
<div class="flex-1">
<el-button
type="primary"
size="medium"
:disabled="!order.list.length"
@click="toCreateOrderDebounce(false)"
>
仅下单
</el-button>
</div>
<div style="width: 15px"></div>
</template>
<div class="flex-1">
<el-button
type="primary"
size="medium"
:disabled="!order.list.length"
@click="toCreateOrderDebounce(false)"
:disabled="!order.list.length && !order.old.list.length"
@click="toCreateOrderDebounce(true)"
>
仅下单
去结账
</el-button>
</div>
<div style="width: 15px"></div>
</template>
<div class="flex-1">
<el-button
size="medium"
:disabled="!order.list.length && !order.old.list.length"
@click="toCreateOrderDebounce(true)"
>
去结账
</el-button>
</div>
</template>
</div>
</div>
</div>
</div>
</div>
@@ -405,14 +425,16 @@
<div
class="btn"
:class="{ disabled: !order.list.length||order.old.list.length }"
:class="{ disabled: !order.list.length || order.old.list.length }"
@click="saveOrder"
>
存单
</div>
<div
class="btn relative"
:class="{ disabled: !prveOrder.list.length ||order.old.list.length }"
:class="{
disabled: !prveOrder.list.length || order.old.list.length,
}"
@click="cacheOrderShow"
>
取单
@@ -443,7 +465,12 @@
<div class="btn" @click="refNoteShow">整单备注</div>
<div
class="btn"
:class="{ disabled:order.placeNum<=0||order.old.selIndex<0 }"
:class="{
disabled:
order.placeNum <= 0 ||
order.old.selIndex < 0 ||
order.selGoods.status == 'return',
}"
@click="orderBtnsClick('returnCart')"
>
退菜
@@ -1060,7 +1087,8 @@ import {
$payOrder,
$choseTable,
$choseCount,
$returnCart
$returnCart,
$printOrder,
} from "@/api/table";
import { tbShopCategoryGet } from "@/api/shop";
import {
@@ -1150,12 +1178,13 @@ export default {
total: 0,
},
order: {
seatFee:{totalAmount:0},//餐位费
orderId: "",
payType: "",
masterId: "",
allPack: false,
//当前选中的购物车商品(包含历史订单)
selGoods:'',
selGoods: "",
selPlaceNum: -1, //第几次下单 0当前 1以及以上历史订单
btns: [
@@ -1248,7 +1277,7 @@ export default {
},
allGiftMoney() {
const price = this.order.list
.filter((v) => v.isGift === "true")
.filter((v) => v.isGift === "true" || v.status == "return")
.reduce((a, b) => {
return a + b.number * b.salePrice;
}, 0);
@@ -1287,17 +1316,19 @@ export default {
},
allPrice() {
const oldPrice = this.order.old.list.reduce((a, b) => {
const bTotal = b.info.filter((v) => v.isGift !== "true").reduce((prve, cur) => {
const bTotal = b.info
.filter((v) => v.isGift !== "true"&& v.status !== "return")
.reduce((prve, cur) => {
return prve + cur.number * cur.salePrice;
}, 0);
return a + bTotal;
}, 0);
return a + bTotal;
}, 0);
const price = this.order.list
.filter((v) => v.isGift !== "true")
.reduce((a, b) => {
return a + b.number * b.salePrice;
}, 0);
return (oldPrice + price).toFixed(2);
return (oldPrice + price+this.order.seatFee.totalAmount*1).toFixed(2);
},
allNumber() {
const oldNumber = this.order.old.list.reduce((a, b) => {
@@ -1498,13 +1529,32 @@ export default {
// this.refToggle("refDiscount", true);
},
methods: {
//打印制作单
printOrder() {
this.$confirm("是否打印当前台桌菜品", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
$printOrder({
tableId: this.table.tableId,
}).then(() => {
this.$message({
type: "success",
message: "已发送打印请求",
});
});
})
.catch(() => {});
},
//退单
refReturnCartConfirm() {
$returnCart({
async refReturnCartConfirm() {
const res = await $returnCart({
cartId: this.order.selGoods.id,
tableId: this.table.tableId
tableId: this.table.tableId,
});
console.log(this.order.selGoods);
},
// 台桌列表
async getTable() {
@@ -1733,7 +1783,7 @@ export default {
console.log(isNowPay);
console.log(this.postPay && isNowPay);
this.createOrder.status = "success";
this.getCart()
this.getCart();
if (this.postPay && !isNowPay) {
this.$notify({
title: "下单成功",
@@ -2135,7 +2185,7 @@ export default {
changeOrderSel(index) {
this.order.selPlaceNum = 0;
this.order.selIndex = index;
this.order.selGoods=this.order.list[index];
this.order.selGoods = this.order.list[index];
this.order.old.selIndex = -1;
},
//改变已下单菜品选中
@@ -2146,7 +2196,7 @@ export default {
this.order.old.selIndex = index;
this.order.selPlaceNum = placeNum;
const list = this.order.old.list.find((v) => v.placeNum == placeNum);
this.order.selGoods=list.info[index];
this.order.selGoods = list.info[index];
this.order.cacheNumber = list.info[index].number || 1;
},
chooseSkuConfirm() {
@@ -2354,7 +2404,7 @@ export default {
this.order.selIndex = -1;
this.order.selPlaceNum = -1;
this.order.old.list = [];
this.order.selGoods='';
this.order.selGoods = "";
this.prveOrder.list = [];
this.prveOrder.selIndex = -1;
this.order.old.selIndex = -1;
@@ -2374,18 +2424,19 @@ export default {
},
//获取购物车数据
async getCart() {
this.order.list=[]
this.order.old.list=[]
this.order.list = [];
this.order.old.list = [];
const res = await getCart({
...this.order.query,
masterId: this.masterId,
tableId: this.table.tableId,
});
for(let i in res.records){
if(res.records[i].placeNum==0){
this.order.seatFee=res.seatFee;
for (let i in res.records) {
if (res.records[i].placeNum == 0) {
this.order.list = res.records[i].info;
}else{
this.order.old.list.push(res.records[i]);
} else {
this.order.old.list.push(res.records[i]);
}
}
// if (this.key|| res.records.length) {
@@ -2647,6 +2698,9 @@ export default {
if (this.key == "isPayOrder") {
this.toCreateOrder(true);
}
// if(this.key!=='isPayOrder'){
// this.getCart();
// }
this.getCart();
this.getGoods();
this.getCategory();
@@ -2728,7 +2782,7 @@ input[type="number"]::-webkit-outer-spin-button {
border: none;
}
::v-deep .el-button--text {
color: #000;
// color: #000;
}
::v-deep .number-box .el-input__inner {
border: none;
@@ -3335,17 +3389,17 @@ input[type="number"]::-webkit-outer-spin-button {
border-bottom: 1px solid #ebebeb;
margin-bottom: 10px;
}
.order-list-all{
.order-list-all {
}
.order {
border-radius: 6px;
display: flex;
.bottom {
box-sizing: border-box;
padding:0 14px 14px 14px;
padding: 0 14px 14px 14px;
background-color: #fff;
z-index: 10;
.border-top{
.border-top {
padding-top: 14px;
border-top: 1px solid #ebebeb;
}