代客下单增加餐位费展示

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"
>
<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="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 class="good-info">
<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
>
@ -23,7 +28,8 @@
</div>
<div class="flex">
<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="order-input-number">
<i class="icon-remove" @click="changeOrderNumber(true)"></i>
@ -44,11 +50,12 @@
</div>
</div>
</div>
<div class="color-333 total-price">
<div v-if="item.isGift === 'true'">0</div>
<div :class="{ 'free-price': item.isGift === 'true' }">
{{ item.salePrice }}
<div v-if="item.isGift === 'true'||item.status=='return' ">0</div>
<div :class="{ 'free-price': item.isGift === 'true'||item.status=='return' }">
<span v-if="isSeatFee"> {{ item.totalAmount }}</span>
<span v-else> {{ item.salePrice }}</span>
</div>
</div>
</div>
@ -58,6 +65,11 @@
<script>
export default {
props: {
//
isSeatFee:{
type: Boolean,
default: false,
},
//
isOld:{
type: Boolean,
@ -139,6 +151,9 @@ export default {
this.$emit("changeOrderNumber", this.index, isReduce);
},
itemClick() {
if(this.isSeatFee){
return
}
this.$emit("itemClick", this.index,this.canChangeNumber,this.placeNum);
},
},
@ -156,6 +171,11 @@ export default {
padding: 0 4px;
text-align: center;
}
.isSeatFee{
background: #3F9EFF;
color: #fff;
font-size: 12px;
}
.icon-remove {
border: 1px solid #d8d8d8;
width: 22px;
@ -200,6 +220,17 @@ export default {
text-align: center;
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 {
background-color: rgba(0, 0, 0, 0.04);
}

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;
}