代客下单增加就餐类型切换
This commit is contained in:
parent
4fd8d61756
commit
5f1688173f
|
|
@ -1,6 +1,11 @@
|
||||||
// 桌台管理
|
// 桌台管理
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
//就餐形式,默认堂食后付费
|
||||||
|
const useType='dine-in-after'
|
||||||
|
function getUseType(){
|
||||||
|
const type=localStorage.getItem("useType")
|
||||||
|
return type?type:useType
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 台桌列表
|
* 台桌列表
|
||||||
* @returns
|
* @returns
|
||||||
|
|
@ -133,6 +138,7 @@ export function getCart(params) {
|
||||||
method: "get",
|
method: "get",
|
||||||
params:{
|
params:{
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
useType: getUseType(),
|
||||||
...params
|
...params
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -162,6 +168,7 @@ export function addCart(data) {
|
||||||
method: "post",
|
method: "post",
|
||||||
data:{
|
data:{
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
useType: getUseType(),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -177,6 +184,7 @@ export function $clearCart(data) {
|
||||||
method: "delete",
|
method: "delete",
|
||||||
data:{
|
data:{
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
useType: getUseType(),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -192,6 +200,7 @@ export function $removeCart(data) {
|
||||||
method: "delete",
|
method: "delete",
|
||||||
data:{
|
data:{
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
useType: getUseType(),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -234,6 +243,7 @@ export function $getMasterId(data) {
|
||||||
method: "get",
|
method: "get",
|
||||||
params:{
|
params:{
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
useType: getUseType(),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -262,6 +272,7 @@ export function $createOrder(data) {
|
||||||
method: "post",
|
method: "post",
|
||||||
data:{
|
data:{
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
useType: getUseType(),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -278,6 +289,7 @@ export function $cacheOrder(data) {
|
||||||
method: "post",
|
method: "post",
|
||||||
data:{
|
data:{
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
useType: getUseType(),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -293,6 +305,7 @@ export function $getCacheOrder(data) {
|
||||||
method: "get",
|
method: "get",
|
||||||
params:{
|
params:{
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
useType: getUseType(),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -362,6 +375,7 @@ export function $choseCount(data) {
|
||||||
method: "put",
|
method: "put",
|
||||||
data:{
|
data:{
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
|
useType: getUseType(),
|
||||||
...data
|
...data
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@
|
||||||
<div class="el-dialog__title" style="margin-right: 10px">
|
<div class="el-dialog__title" style="margin-right: 10px">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</div>
|
</div>
|
||||||
<el-dropdown @command="changePostPay">
|
<!-- 先付后付start -->
|
||||||
|
<!-- <el-dropdown @command="changePostPay">
|
||||||
<el-button plain type="primary" size="mini">
|
<el-button plain type="primary" size="mini">
|
||||||
{{ postPay ? "后付费" : "先付费" }}
|
{{ postPay ? "后付费" : "先付费" }}
|
||||||
<i class="el-icon-caret-bottom"></i>
|
<i class="el-icon-caret-bottom"></i>
|
||||||
|
|
@ -21,7 +22,11 @@
|
||||||
<el-dropdown-item :command="false">先付费</el-dropdown-item>
|
<el-dropdown-item :command="false">先付费</el-dropdown-item>
|
||||||
<el-dropdown-item :command="true">后付费</el-dropdown-item>
|
<el-dropdown-item :command="true">后付费</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown> -->
|
||||||
|
<el-button plain type="primary" size="mini">
|
||||||
|
{{ postPay ? "后付费" : "先付费" }}
|
||||||
|
</el-button>
|
||||||
|
<!-- 先付后付end -->
|
||||||
<span
|
<span
|
||||||
@click="toggleFullScreen"
|
@click="toggleFullScreen"
|
||||||
class="flex flex-xy-center cur-pointer full-screen"
|
class="flex flex-xy-center cur-pointer full-screen"
|
||||||
|
|
@ -173,6 +178,18 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="u-m-l-20 u-p-b-10 meal_box">
|
||||||
|
<el-button-group>
|
||||||
|
<el-button
|
||||||
|
:class="{ active: item.value == useTypes.sel }"
|
||||||
|
:disabled="order.old.list.length > 0"
|
||||||
|
v-for="(item, index) in useTypes.list"
|
||||||
|
@click="changeUseType(item.value)"
|
||||||
|
:key="index"
|
||||||
|
>{{ item.name }}</el-button
|
||||||
|
>
|
||||||
|
</el-button-group>
|
||||||
|
</div>
|
||||||
<div class="flex row-between table-list u-m-l-20">
|
<div class="flex row-between table-list u-m-l-20">
|
||||||
<!-- <div class="tableId" @click="chooseTableOpen"> -->
|
<!-- <div class="tableId" @click="chooseTableOpen"> -->
|
||||||
<el-popover
|
<el-popover
|
||||||
|
|
@ -203,15 +220,27 @@
|
||||||
|
|
||||||
<div class="u-flex">
|
<div class="u-flex">
|
||||||
<div class="u-p-r-14 border-r u-m-r-14">
|
<div class="u-p-r-14 border-r u-m-r-14">
|
||||||
|
<template v-if="!shopInfo.isTableFee">
|
||||||
<div
|
<div
|
||||||
class="u-flex cur-pointer"
|
class="u-flex cur-pointer"
|
||||||
@click="refToggle('refChooseDinersNumber', true, perpole)"
|
@click="
|
||||||
|
refToggle('refChooseDinersNumber', true, perpole)
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<span>就餐人数:{{ perpole }}位</span>
|
<span>就餐人数:{{ perpole }}位</span>
|
||||||
<span
|
<span
|
||||||
class="el-icon-arrow-right diningPeople_cell_arrow"
|
class="el-icon-arrow-right diningPeople_cell_arrow"
|
||||||
></span>
|
></span>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<div class="u-flex">
|
||||||
|
<span>就餐人数:-位</span>
|
||||||
|
<span
|
||||||
|
class="el-icon-arrow-right diningPeople_cell_arrow"
|
||||||
|
></span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<el-button
|
<el-button
|
||||||
@click="clearCart"
|
@click="clearCart"
|
||||||
|
|
@ -1071,6 +1100,8 @@ import chooseDinersNumber from "./table-diancan-components/choose-diners-number.
|
||||||
import returnCart from "./table-diancan-components/return-cart.vue";
|
import returnCart from "./table-diancan-components/return-cart.vue";
|
||||||
import moneyKeyboard from "./money-keyboard.vue";
|
import moneyKeyboard from "./money-keyboard.vue";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
import { tbShopInfo } from "@/api/user";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getGoodsLists,
|
getGoodsLists,
|
||||||
addCart,
|
addCart,
|
||||||
|
|
@ -1090,7 +1121,7 @@ import {
|
||||||
$choseCount,
|
$choseCount,
|
||||||
$returnCart,
|
$returnCart,
|
||||||
$printOrder,
|
$printOrder,
|
||||||
tbShopTableGet
|
tbShopTableGet,
|
||||||
} from "@/api/table";
|
} from "@/api/table";
|
||||||
import { tbShopCategoryGet } from "@/api/shop";
|
import { tbShopCategoryGet } from "@/api/shop";
|
||||||
import {
|
import {
|
||||||
|
|
@ -1115,6 +1146,22 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
//店铺信息
|
||||||
|
shopInfo: {},
|
||||||
|
//就餐饭方式
|
||||||
|
useTypes: {
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
name: "堂食",
|
||||||
|
value: "dine-in",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "自取",
|
||||||
|
value: "takeout",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
sel: "dine-in",
|
||||||
|
},
|
||||||
//台桌列表
|
//台桌列表
|
||||||
tableList: [],
|
tableList: [],
|
||||||
tableShow: false,
|
tableShow: false,
|
||||||
|
|
@ -1374,6 +1421,10 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
"useTypes.sel": function (newval, oldval) {
|
||||||
|
this.setPostPay();
|
||||||
|
this.setUseType();
|
||||||
|
},
|
||||||
perpole(newval, oldval) {
|
perpole(newval, oldval) {
|
||||||
if (!oldval && newval && this.table.tableId) {
|
if (!oldval && newval && this.table.tableId) {
|
||||||
// $choseCount({
|
// $choseCount({
|
||||||
|
|
@ -1387,7 +1438,7 @@ export default {
|
||||||
},
|
},
|
||||||
table(oldval, newval) {
|
table(oldval, newval) {
|
||||||
if (oldval && newval) {
|
if (oldval && newval) {
|
||||||
this.onTableChange()
|
this.onTableChange();
|
||||||
}
|
}
|
||||||
// if (oldval && newval) {
|
// if (oldval && newval) {
|
||||||
// console.log(oldval, newval);
|
// console.log(oldval, newval);
|
||||||
|
|
@ -1408,7 +1459,7 @@ export default {
|
||||||
},
|
},
|
||||||
"vipUser.id": async function (val) {
|
"vipUser.id": async function (val) {
|
||||||
if (!this.table.tableId) {
|
if (!this.table.tableId) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
let masterId = this.order.masterId;
|
let masterId = this.order.masterId;
|
||||||
if (!masterId) {
|
if (!masterId) {
|
||||||
|
|
@ -1533,17 +1584,60 @@ export default {
|
||||||
// this.getCategory();
|
// this.getCategory();
|
||||||
// this.refToggle('refScanCode',true)
|
// this.refToggle('refScanCode',true)
|
||||||
// this.refToggle("refDiscount", true);
|
// this.refToggle("refDiscount", true);
|
||||||
|
this.getShopInfo();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//设置用餐类型
|
||||||
|
setUseType() {
|
||||||
|
// 自取
|
||||||
|
if (this.useTypes.sel == "takeout") {
|
||||||
|
localStorage.setItem("useType", "takeout");
|
||||||
|
} else {
|
||||||
|
//堂食
|
||||||
|
localStorage.setItem(
|
||||||
|
"useType",
|
||||||
|
`dine-in-${this.postPay ? "after" : "before"}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//设置先付后付
|
||||||
|
setPostPay() {
|
||||||
|
// 自取
|
||||||
|
// postPay true 后付 false 先付
|
||||||
|
|
||||||
|
if (this.useTypes.sel == "takeout") {
|
||||||
|
this.postPay = false;
|
||||||
|
} else {
|
||||||
|
//munchies 先付 restaurant 后付
|
||||||
|
this.postPay = this.shopInfo.registerType == "munchies" ? false : true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//获取店铺信息
|
||||||
|
async getShopInfo() {
|
||||||
|
try {
|
||||||
|
const shopId = localStorage.getItem("shopId");
|
||||||
|
const res = await tbShopInfo(shopId);
|
||||||
|
this.shopInfo = res;
|
||||||
|
this.setPostPay();
|
||||||
|
this.setUseType();
|
||||||
|
} catch (error) {}
|
||||||
|
},
|
||||||
|
//更改就餐方式
|
||||||
|
changeUseType(type) {
|
||||||
|
if(this.order.old.list.length > 0){
|
||||||
|
return this.$message('下单后不支持更改就餐方式');
|
||||||
|
}
|
||||||
|
this.useTypes.sel = type;
|
||||||
|
},
|
||||||
//更改就餐人数
|
//更改就餐人数
|
||||||
changePerpole() {
|
changePerpole() {
|
||||||
$choseCount({
|
$choseCount({
|
||||||
masterId: this.masterId,
|
masterId: this.masterId,
|
||||||
tableId: this.table.tableId,
|
tableId: this.table.tableId,
|
||||||
num: this.perpole,
|
num: this.perpole,
|
||||||
}).then(res=>{
|
}).then((res) => {
|
||||||
this.order.seatFee=res
|
this.order.seatFee = res;
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
//台桌变化时重新获取取餐号、购物车数据,如果是正在结账状态,创建订单到待支付页面
|
//台桌变化时重新获取取餐号、购物车数据,如果是正在结账状态,创建订单到待支付页面
|
||||||
async onTableChange() {
|
async onTableChange() {
|
||||||
|
|
@ -1557,9 +1651,9 @@ export default {
|
||||||
// 获取台桌详情
|
// 获取台桌详情
|
||||||
async getTableDetail() {
|
async getTableDetail() {
|
||||||
const res = await tbShopTableGet({
|
const res = await tbShopTableGet({
|
||||||
qrcode:this.table.tableId
|
qrcode: this.table.tableId,
|
||||||
})
|
});
|
||||||
console.log(res)
|
console.log(res);
|
||||||
},
|
},
|
||||||
//打印制作单
|
//打印制作单
|
||||||
printOrder() {
|
printOrder() {
|
||||||
|
|
@ -1596,7 +1690,7 @@ export default {
|
||||||
const { content, total } = await tbShopTableGet({
|
const { content, total } = await tbShopTableGet({
|
||||||
shopId: localStorage.getItem("shopId"),
|
shopId: localStorage.getItem("shopId"),
|
||||||
});
|
});
|
||||||
this.tableList = content.filter(v=>v.status!='closed');
|
this.tableList = content.filter((v) => v.status != "closed");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
@ -1607,8 +1701,7 @@ export default {
|
||||||
},
|
},
|
||||||
chooseDinersNumberConfirm(e) {
|
chooseDinersNumberConfirm(e) {
|
||||||
this.perpole = e;
|
this.perpole = e;
|
||||||
this.changePerpole()
|
this.changePerpole();
|
||||||
|
|
||||||
},
|
},
|
||||||
//扫码支付弹窗确认
|
//扫码支付弹窗确认
|
||||||
scanPayConfirm(code) {
|
scanPayConfirm(code) {
|
||||||
|
|
@ -2443,7 +2536,7 @@ export default {
|
||||||
this.order.selPlaceNum = -1;
|
this.order.selPlaceNum = -1;
|
||||||
this.order.old.list = [];
|
this.order.old.list = [];
|
||||||
this.order.selGoods = "";
|
this.order.selGoods = "";
|
||||||
this.order.seatFee={totalAmount:0}//餐位费
|
this.order.seatFee = { totalAmount: 0 }; //餐位费
|
||||||
this.prveOrder.list = [];
|
this.prveOrder.list = [];
|
||||||
this.prveOrder.selIndex = -1;
|
this.prveOrder.selIndex = -1;
|
||||||
this.order.old.selIndex = -1;
|
this.order.old.selIndex = -1;
|
||||||
|
|
@ -2461,10 +2554,11 @@ export default {
|
||||||
this.key = "";
|
this.key = "";
|
||||||
this.order.orderId = "";
|
this.order.orderId = "";
|
||||||
this.perpole = "";
|
this.perpole = "";
|
||||||
|
this.useTypes.sel='dine-in'
|
||||||
},
|
},
|
||||||
//获取购物车数据
|
//获取购物车数据
|
||||||
async getCart() {
|
async getCart() {
|
||||||
console.log(this.table)
|
console.log(this.table);
|
||||||
const res = await getCart({
|
const res = await getCart({
|
||||||
...this.order.query,
|
...this.order.query,
|
||||||
masterId: this.masterId,
|
masterId: this.masterId,
|
||||||
|
|
@ -2739,11 +2833,16 @@ export default {
|
||||||
// this.getCart();
|
// this.getCart();
|
||||||
// }
|
// }
|
||||||
// this.changePerpole()
|
// this.changePerpole()
|
||||||
|
|
||||||
|
if (!this.shopInfo.isTableFee) {
|
||||||
|
//不免餐位费
|
||||||
await $choseCount({
|
await $choseCount({
|
||||||
masterId: this.masterId,
|
masterId: this.masterId,
|
||||||
tableId: this.table.tableId,
|
tableId: this.table.tableId,
|
||||||
num: this.perpole,
|
num: this.perpole,
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.getCart();
|
this.getCart();
|
||||||
this.getGoods();
|
this.getGoods();
|
||||||
this.getCategory();
|
this.getCategory();
|
||||||
|
|
@ -2827,6 +2926,19 @@ input[type="number"]::-webkit-outer-spin-button {
|
||||||
::v-deep .el-button--text {
|
::v-deep .el-button--text {
|
||||||
// color: #000;
|
// color: #000;
|
||||||
}
|
}
|
||||||
|
::v-deep .meal_box .el-button-group {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
::v-deep .meal_box .el-button-group .el-button {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
::v-deep .meal_box .el-button-group .active {
|
||||||
|
border: 1px solid #409eff !important;
|
||||||
|
color: #409eff !important;
|
||||||
|
background: rgba(24, 144, 255, 0.1) !important;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
::v-deep .number-box .el-input__inner {
|
::v-deep .number-box .el-input__inner {
|
||||||
border: none;
|
border: none;
|
||||||
padding: 0 4px;
|
padding: 0 4px;
|
||||||
|
|
|
||||||
|
|
@ -223,6 +223,7 @@ import downloadTableCode from "./components/downloadTableCode";
|
||||||
import tableDiancan from "./components/table-diancan.vue";
|
import tableDiancan from "./components/table-diancan.vue";
|
||||||
import $status from "./status.js";
|
import $status from "./status.js";
|
||||||
import chooseDinersNumber from "./components/table-diancan-components/choose-diners-number.vue";
|
import chooseDinersNumber from "./components/table-diancan-components/choose-diners-number.vue";
|
||||||
|
import { tbShopInfo } from "@/api/user";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
tbShopTableGet,
|
tbShopTableGet,
|
||||||
|
|
@ -251,10 +252,13 @@ export default {
|
||||||
status: $status,
|
status: $status,
|
||||||
selTable: "", //当前选中的桌台
|
selTable: "", //当前选中的桌台
|
||||||
areaMap: {},
|
areaMap: {},
|
||||||
|
shopInfo:{},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.tbShopAreaGet();
|
this.tbShopAreaGet();
|
||||||
|
this.getShopInfo()
|
||||||
|
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
formatTime(time) {
|
formatTime(time) {
|
||||||
|
|
@ -262,6 +266,15 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//获取店铺信息
|
||||||
|
async getShopInfo() {
|
||||||
|
try {
|
||||||
|
const shopId = localStorage.getItem("shopId");
|
||||||
|
const res = await tbShopInfo(shopId);
|
||||||
|
this.shopInfo=res
|
||||||
|
console.log(res)
|
||||||
|
} catch (error) {}
|
||||||
|
},
|
||||||
// 清台
|
// 清台
|
||||||
cleanTableHandle(item) {
|
cleanTableHandle(item) {
|
||||||
this.$confirm("确定要清台:"+item.name, "提示", {
|
this.$confirm("确定要清台:"+item.name, "提示", {
|
||||||
|
|
@ -308,6 +321,11 @@ export default {
|
||||||
//key isAddGoods 加菜
|
//key isAddGoods 加菜
|
||||||
//key isPayOrder结账
|
//key isPayOrder结账
|
||||||
this.selTable = item;
|
this.selTable = item;
|
||||||
|
if(this.shopInfo.isTableFee){
|
||||||
|
//免餐位费
|
||||||
|
this.$refs.diancan.open(item, key, '');
|
||||||
|
return
|
||||||
|
}
|
||||||
const num = item.useNum || 0;
|
const num = item.useNum || 0;
|
||||||
if (item.useNum <= 0) {
|
if (item.useNum <= 0) {
|
||||||
return this.$refs.refChooseDinersNumber.open();
|
return this.$refs.refChooseDinersNumber.open();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue