代客下单增加餐位费展示

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

View File

@ -375,3 +375,28 @@ export function $fastCreateTable(data) {
} }
}); });
} }
//打印当前台桌订单
export function $printOrder(data) {
return request({
url: '/api/place/printOrder',
method: "post",
data:{
shopId: localStorage.getItem("shopId"),
...data
}
});
}
//打印当前台桌菜品
export function $printDishes(data) {
return request({
url: '/api/place/printDishes',
method: "post",
data:{
shopId: localStorage.getItem("shopId"),
...data
}
});
}

View File

@ -5,13 +5,18 @@
@click="itemClick" @click="itemClick"
> >
<span class="absolute pack" v-if="item.isPack === 'true'"> </span> <span class="absolute pack" v-if="item.isPack === 'true'"> </span>
<span class="absolute tui" v-if="item.status === 'return'"> 退 </span>
<div class="flex"> <div class="flex">
<div class="img"> <div class="img">
<img :src="item.coverImg" class="" alt="" /> <div class="isSeatFee img u-line-1 u-flex u-col-center u-row-center" v-if="isSeatFee">
<span>{{ item.name }}</span>
</div>
<img v-else :src="item.coverImg" class="" alt="" />
</div> </div>
<div class="good-info"> <div class="good-info">
<div class="flex lh-16"> <div class="flex lh-16">
<div class="name">{{ item.name }}</div> <div class="name" :class="{ 'free-price': item.status === 'return' }">{{ item.name }}</div>
<span class="good_info_discount" v-if="item.isGift === 'true'" <span class="good_info_discount" v-if="item.isGift === 'true'"
></span ></span
> >
@ -23,7 +28,8 @@
</div> </div>
<div class="flex"> <div class="flex">
<div class="order-number-box"> <div class="order-number-box">
<div class="" style="">X{{ item.number }}</div> <div class="" v-if="isSeatFee">X{{ item.totalNumber }}</div>
<div class="" v-else>X{{ item.number }}</div>
<div class="absolute" v-if="canChangeNumber"> <div class="absolute" v-if="canChangeNumber">
<div class="order-input-number"> <div class="order-input-number">
<i class="icon-remove" @click="changeOrderNumber(true)"></i> <i class="icon-remove" @click="changeOrderNumber(true)"></i>
@ -44,11 +50,12 @@
</div> </div>
</div> </div>
</div> </div>
<div class="color-333 total-price"> <div class="color-333 total-price">
<div v-if="item.isGift === 'true'">0</div> <div v-if="item.isGift === 'true'||item.status=='return' ">0</div>
<div :class="{ 'free-price': item.isGift === 'true' }"> <div :class="{ 'free-price': item.isGift === 'true'||item.status=='return' }">
{{ item.salePrice }} <span v-if="isSeatFee"> {{ item.totalAmount }}</span>
<span v-else> {{ item.salePrice }}</span>
</div> </div>
</div> </div>
</div> </div>
@ -58,6 +65,11 @@
<script> <script>
export default { export default {
props: { props: {
//
isSeatFee:{
type: Boolean,
default: false,
},
// //
isOld:{ isOld:{
type: Boolean, type: Boolean,
@ -139,6 +151,9 @@ export default {
this.$emit("changeOrderNumber", this.index, isReduce); this.$emit("changeOrderNumber", this.index, isReduce);
}, },
itemClick() { itemClick() {
if(this.isSeatFee){
return
}
this.$emit("itemClick", this.index,this.canChangeNumber,this.placeNum); this.$emit("itemClick", this.index,this.canChangeNumber,this.placeNum);
}, },
}, },
@ -156,6 +171,11 @@ export default {
padding: 0 4px; padding: 0 4px;
text-align: center; text-align: center;
} }
.isSeatFee{
background: #3F9EFF;
color: #fff;
font-size: 12px;
}
.icon-remove { .icon-remove {
border: 1px solid #d8d8d8; border: 1px solid #d8d8d8;
width: 22px; width: 22px;
@ -200,6 +220,17 @@ export default {
text-align: center; text-align: center;
line-height: 17px; line-height: 17px;
} }
.tui{
right: 100%;
width: 18px;
height: 18px;
background: #ac4735;
border-radius: 4px 0 4px 0;
font-size: 12px;
color: #fff;
text-align: center;
line-height: 17px;
}
&.active { &.active {
background-color: rgba(0, 0, 0, 0.04); background-color: rgba(0, 0, 0, 0.04);
} }

View File

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