更新优化换桌功能
This commit is contained in:
@@ -670,11 +670,13 @@ export const useCartsStore = defineStore("carts", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function rotTable(newVal: string | number, cart_id = []) {
|
function rotTable(newVal: string | number, cart_id = []) {
|
||||||
sendMessage('rottable', {
|
if (cart_id.length) {
|
||||||
new_table_code: newVal,
|
sendMessage('rottable', {
|
||||||
table_code: table_code.value,
|
new_table_code: newVal,
|
||||||
cart_id
|
table_code: table_code.value,
|
||||||
});
|
cart_id
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function del(data: any) {
|
function del(data: any) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useUserStoreHook } from "@/store";
|
|||||||
import { ElMessage, ElMessageBox } from "element-plus";
|
import { ElMessage, ElMessageBox } from "element-plus";
|
||||||
|
|
||||||
const user = useUserStoreHook();
|
const user = useUserStoreHook();
|
||||||
|
let isTips = false
|
||||||
|
|
||||||
export interface ApifoxModel {
|
export interface ApifoxModel {
|
||||||
account: string;
|
account: string;
|
||||||
@@ -143,6 +144,7 @@ class WebSocketManager {
|
|||||||
this.autoConnect = false;
|
this.autoConnect = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 自动重连机制
|
// 自动重连机制
|
||||||
private reconnect() {
|
private reconnect() {
|
||||||
if (!this.autoConnect) {
|
if (!this.autoConnect) {
|
||||||
@@ -156,19 +158,24 @@ class WebSocketManager {
|
|||||||
}, this.reconnectDelay);
|
}, this.reconnectDelay);
|
||||||
} else {
|
} else {
|
||||||
clearTimeout(this.reconnectTimer);
|
clearTimeout(this.reconnectTimer);
|
||||||
console.error("达到最大重连次数,停止重连");
|
// window.location.reload();
|
||||||
ElMessageBox.confirm('达到最大重连次数' + this.maxReconnectAttempts + '次,已停止重连,是否立即重连?', '提示', {
|
// console.error("达到最大重连次数,停止重连");
|
||||||
confirmButtonText: '确定',
|
if (!isTips) {
|
||||||
cancelButtonText: '取消',
|
ElMessageBox.confirm('达到最大重连次数' + this.maxReconnectAttempts + '次,已停止重连,是否立即重连?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
|
||||||
callback: (action: string) => {
|
callback: (action: string) => {
|
||||||
console.log(action);
|
console.log(action);
|
||||||
if (action == 'confirm') {
|
if (action == 'confirm') {
|
||||||
this.setupWebSocket();
|
isTips = false
|
||||||
this.reconnectAttempts = 0;
|
this.setupWebSocket();
|
||||||
|
this.reconnectAttempts = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
isTips = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<extra-fee name="餐位费" :number="perpole" :price="canWeiFee"></extra-fee>
|
<extra-fee name="餐位费" :number="perpole" :price="canWeiFee"></extra-fee>
|
||||||
</template>
|
</template>
|
||||||
<!-- 历史订单 -->
|
<!-- 历史订单 -->
|
||||||
<div class="u-flex u-row-between u-m-b-10" v-if="carts.oldOrder.id">
|
<div class="u-flex u-row-between u-m-b-10" v-if="carts.oldOrder.id && !isEmptyObject(carts.oldOrder.detailMap)">
|
||||||
<span class="u-font-14">历史订单</span>
|
<span class="u-font-14">历史订单</span>
|
||||||
<el-button link size="small" type="danger" @click="clearOldOrder()">清空</el-button>
|
<el-button link size="small" type="danger" @click="clearOldOrder()">清空</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,12 +3,7 @@
|
|||||||
<el-form :rules="rules" ref="refForm" :model="form">
|
<el-form :rules="rules" ref="refForm" :model="form">
|
||||||
<el-form-item label="转桌到" prop="targetTableCode">
|
<el-form-item label="转桌到" prop="targetTableCode">
|
||||||
<el-select v-model="form.targetTableCode" placeholder="请选择转桌到" style="width: 200px">
|
<el-select v-model="form.targetTableCode" placeholder="请选择转桌到" style="width: 200px">
|
||||||
<el-option
|
<el-option v-for="item in tableList" :key="item.id" :label="item.name" :value="item.tableCode"></el-option>
|
||||||
v-for="item in tableList"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.tableCode"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="转入类型">
|
<el-form-item label="转入类型">
|
||||||
@@ -59,6 +54,7 @@ const basicForm = {
|
|||||||
targetOrderId: "",
|
targetOrderId: "",
|
||||||
targetTableCode: "",
|
targetTableCode: "",
|
||||||
detailIds: [],
|
detailIds: [],
|
||||||
|
allMerge: 0 // 是否全部转台
|
||||||
};
|
};
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
...basicForm,
|
...basicForm,
|
||||||
@@ -120,6 +116,17 @@ function confirm() {
|
|||||||
type: "error",
|
type: "error",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rottableType.value == 1) {
|
||||||
|
form.allMerge = 1;
|
||||||
|
} else {
|
||||||
|
console.log('oldCartGoods.value===', oldCartGoods.value);
|
||||||
|
const orderCount = Object.values(oldCartGoods.value).reduce((sum, arr) => {
|
||||||
|
return sum + arr.length
|
||||||
|
}, 0)
|
||||||
|
form.allMerge = orderCount == detailIds.length ? 1 : 0
|
||||||
|
}
|
||||||
|
|
||||||
emits(
|
emits(
|
||||||
"confirm",
|
"confirm",
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div class="box" v-loading="!carts.isLinkFinshed" element-loading-text="购物车连接初始化中,请稍等……">
|
||||||
class="box"
|
|
||||||
v-loading="!carts.isLinkFinshed"
|
|
||||||
element-loading-text="购物车连接初始化中,请稍等……"
|
|
||||||
>
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="top">
|
<div class="top">
|
||||||
<div class="left u-flex u-col-center">
|
<div class="left u-flex u-col-center">
|
||||||
@@ -13,12 +9,8 @@
|
|||||||
<el-button type="primary" v-if="!carts.vipUser.id">选择用户</el-button>
|
<el-button type="primary" v-if="!carts.vipUser.id">选择用户</el-button>
|
||||||
|
|
||||||
<div v-else class="flex cur-pointer">
|
<div v-else class="flex cur-pointer">
|
||||||
<img
|
<img v-if="carts.vipUser.headImg && carts.vipUser.headImg != 'null'" class="headimg"
|
||||||
v-if="carts.vipUser.headImg && carts.vipUser.headImg != 'null'"
|
:src="carts.vipUser.headImg" alt="" />
|
||||||
class="headimg"
|
|
||||||
:src="carts.vipUser.headImg"
|
|
||||||
alt=""
|
|
||||||
/>
|
|
||||||
<div v-else class="headimg flex flex-x-y-center">
|
<div v-else class="headimg flex flex-x-y-center">
|
||||||
<i class="el-icon-user"></i>
|
<i class="el-icon-user"></i>
|
||||||
</div>
|
</div>
|
||||||
@@ -36,19 +28,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-popover placement="right" width="333" trigger="click" ref="refTable">
|
<el-popover placement="right" width="333" trigger="click" ref="refTable">
|
||||||
<el-input
|
<el-input placeholder="请输入内容" prefix-icon="search" v-model="tableSearchText"
|
||||||
placeholder="请输入内容"
|
@input="tablesearchInput"></el-input>
|
||||||
prefix-icon="search"
|
|
||||||
v-model="tableSearchText"
|
|
||||||
@input="tablesearchInput"
|
|
||||||
></el-input>
|
|
||||||
<div style="max-height: 398px; overflow-y: scroll" class="u-m-t-12">
|
<div style="max-height: 398px; overflow-y: scroll" class="u-m-t-12">
|
||||||
<div
|
<div class="u-flex u-row-between u-p-t-8 table-item u-p-b-8 u-p-r-30" v-for="(item, index) in tableList"
|
||||||
class="u-flex u-row-between u-p-t-8 table-item u-p-b-8 u-p-r-30"
|
:key="index" @click="tableClick(item, index)">
|
||||||
v-for="(item, index) in tableList"
|
|
||||||
:key="index"
|
|
||||||
@click="tableClick(item, index)"
|
|
||||||
>
|
|
||||||
<span>{{ item.name }}</span>
|
<span>{{ item.name }}</span>
|
||||||
<span :style="{ color: returnTableColor(item.status) }">
|
<span :style="{ color: returnTableColor(item.status) }">
|
||||||
{{ returnTableLabel(item.status) }}
|
{{ returnTableLabel(item.status) }}
|
||||||
@@ -68,12 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<el-input
|
<el-input placeholder="请输入商品名称" v-model="goods.query.name" clearable @change="getGoods">
|
||||||
placeholder="请输入商品名称"
|
|
||||||
v-model="goods.query.name"
|
|
||||||
clearable
|
|
||||||
@change="getGoods"
|
|
||||||
>
|
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<el-icon class="el-input__icon">
|
<el-icon class="el-input__icon">
|
||||||
<search />
|
<search />
|
||||||
@@ -87,24 +66,16 @@
|
|||||||
<div class="diners">
|
<div class="diners">
|
||||||
<!-- 就餐类型 -->
|
<!-- 就餐类型 -->
|
||||||
<el-button-group v-model="diners.sel" style="width: 100%; display: flex">
|
<el-button-group v-model="diners.sel" style="width: 100%; display: flex">
|
||||||
<el-button
|
<el-button :class="{ active: index == diners.sel }" v-for="(item, index) in diners.list"
|
||||||
:class="{ active: index == diners.sel }"
|
:disabled="dinerDisabled(item, index)" @click="changeDinersSel(index)" :key="index">
|
||||||
v-for="(item, index) in diners.list"
|
|
||||||
:disabled="dinerDisabled(item, index)"
|
|
||||||
@click="changeDinersSel(index)"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-button-group>
|
</el-button-group>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="u-flex u-font-14 clear u-m-t-10 perpoles">
|
<div class="u-flex u-font-14 clear u-m-t-10 perpoles">
|
||||||
<div
|
<div @click="showDinerNumber" class="u-flex u-p-r-14 u-m-r-14"
|
||||||
@click="showDinerNumber"
|
style="border-right: 1px solid #ebebeb; line-height: 1">
|
||||||
class="u-flex u-p-r-14 u-m-r-14"
|
|
||||||
style="border-right: 1px solid #ebebeb; line-height: 1"
|
|
||||||
>
|
|
||||||
<span>就餐人数:{{ perpole || "-" }} 位</span>
|
<span>就餐人数:{{ perpole || "-" }} 位</span>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<ArrowRight />
|
<ArrowRight />
|
||||||
@@ -115,39 +86,19 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<!-- 购物车 -->
|
<!-- 购物车 -->
|
||||||
<cartsList
|
<cartsList @editNote="showNote(true)" @createOrder="createOrder" @hideOrder="hideOrder"
|
||||||
@editNote="showNote(true)"
|
@clearOldOrder="clearOldOrder" :showOrder="showOrder" :goodsList="carts.goods" :dinerType="diners.sel"
|
||||||
@createOrder="createOrder"
|
:perpole="perpole" :remark="remark" :table="carts.tableInfo" ref="refCart"></cartsList>
|
||||||
@hideOrder="hideOrder"
|
|
||||||
@clearOldOrder="clearOldOrder"
|
|
||||||
:showOrder="showOrder"
|
|
||||||
:goodsList="carts.goods"
|
|
||||||
:dinerType="diners.sel"
|
|
||||||
:perpole="perpole"
|
|
||||||
:remark="remark"
|
|
||||||
:table="carts.tableInfo"
|
|
||||||
ref="refCart"
|
|
||||||
></cartsList>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<!-- 购物车控制操作按钮 -->
|
<!-- 购物车控制操作按钮 -->
|
||||||
<Controls
|
<Controls @noteClick="showNote" @packClick="showPack" @changePriceClick="showChangePrice"
|
||||||
@noteClick="showNote"
|
@return="refReturnCartShow" @rottable="rottableShow" @changeCartNumberShow="refChangeNumberShow" />
|
||||||
@packClick="showPack"
|
|
||||||
@changePriceClick="showChangePrice"
|
|
||||||
@return="refReturnCartShow"
|
|
||||||
@rottable="rottableShow"
|
|
||||||
@changeCartNumberShow="refChangeNumberShow"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<template v-if="!showOrder">
|
<template v-if="!showOrder">
|
||||||
<div class="flex categoty u-col-center">
|
<div class="flex categoty u-col-center">
|
||||||
<div
|
<div class="show_more_btn" :class="{ showAll: category.showAll }" @click="toggleShowAll">
|
||||||
class="show_more_btn"
|
|
||||||
:class="{ showAll: category.showAll }"
|
|
||||||
@click="toggleShowAll"
|
|
||||||
>
|
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<div class="flex showmore">
|
<div class="flex showmore">
|
||||||
<el-icon color="#fff">
|
<el-icon color="#fff">
|
||||||
@@ -158,16 +109,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex categorys" :class="{ 'flex-wrap': category.showAll }">
|
<div class="flex categorys" :class="{ 'flex-wrap': category.showAll }">
|
||||||
<div
|
<div v-for="(item, index) in category.list" :key="index" @click="changeCategoryId(item)">
|
||||||
v-for="(item, index) in category.list"
|
<el-tag size="large" :type="goods.query.categoryId === item.id ? 'primary' : 'info'" effect="dark">
|
||||||
:key="index"
|
|
||||||
@click="changeCategoryId(item)"
|
|
||||||
>
|
|
||||||
<el-tag
|
|
||||||
size="large"
|
|
||||||
:type="goods.query.categoryId === item.id ? 'primary' : 'info'"
|
|
||||||
effect="dark"
|
|
||||||
>
|
|
||||||
{{ item.name }}
|
{{ item.name }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
@@ -181,25 +124,13 @@
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
<div class="u-m-t-10">临时菜</div>
|
<div class="u-m-t-10">临时菜</div>
|
||||||
</div>
|
</div>
|
||||||
<GoodsItem
|
<GoodsItem :item="item" @itemClick="goodsClick(item)" v-for="item in carts.goods" :key="item.id">
|
||||||
:item="item"
|
</GoodsItem>
|
||||||
@itemClick="goodsClick(item)"
|
|
||||||
v-for="item in carts.goods"
|
|
||||||
:key="item.id"
|
|
||||||
></GoodsItem>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<!-- 订单信息展示 -->
|
<!-- 订单信息展示 -->
|
||||||
<Order
|
<Order ref="refOrder" :orderInfo="carts.oldOrder" @chooseUser="showChooseUser" @paysuccess="refresh"
|
||||||
ref="refOrder"
|
:table="carts.tableInfo" :perpole="perpole" v-else :user="user"></Order>
|
||||||
:orderInfo="carts.oldOrder"
|
|
||||||
@chooseUser="showChooseUser"
|
|
||||||
@paysuccess="refresh"
|
|
||||||
:table="carts.tableInfo"
|
|
||||||
:perpole="perpole"
|
|
||||||
v-else
|
|
||||||
:user="user"
|
|
||||||
></Order>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -214,11 +145,7 @@
|
|||||||
<!-- 临时菜 -->
|
<!-- 临时菜 -->
|
||||||
<addLingShiCai ref="refAddLingShiCai" @confirm="addLingShiCaiConfirm"></addLingShiCai>
|
<addLingShiCai ref="refAddLingShiCai" @confirm="addLingShiCaiConfirm"></addLingShiCai>
|
||||||
<!-- 改价 -->
|
<!-- 改价 -->
|
||||||
<changePrice
|
<changePrice ref="refChangePrice" :useVipPrice="carts.useVipPrice" @confirm="changePriceConfirm"></changePrice>
|
||||||
ref="refChangePrice"
|
|
||||||
:useVipPrice="carts.useVipPrice"
|
|
||||||
@confirm="changePriceConfirm"
|
|
||||||
></changePrice>
|
|
||||||
<!-- 称重商品 -->
|
<!-- 称重商品 -->
|
||||||
<change-weight ref="refChangeWeight" @confirm="changeWeightConfirm"></change-weight>
|
<change-weight ref="refChangeWeight" @confirm="changeWeightConfirm"></change-weight>
|
||||||
<!-- 可选套餐 -->
|
<!-- 可选套餐 -->
|
||||||
@@ -291,7 +218,9 @@ function rottableShow() {
|
|||||||
}
|
}
|
||||||
async function rottableConfirm(form, cart_id) {
|
async function rottableConfirm(form, cart_id) {
|
||||||
carts.rotTable(form.targetTableCode, cart_id);
|
carts.rotTable(form.targetTableCode, cart_id);
|
||||||
const res = await orderApi.mergeOrder(form);
|
if (form.detailIds.length) {
|
||||||
|
await orderApi.mergeOrder(form);
|
||||||
|
}
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: "成功",
|
title: "成功",
|
||||||
message: "合并成功",
|
message: "合并成功",
|
||||||
@@ -589,7 +518,7 @@ async function getTableDetail(params) {
|
|||||||
const res = await tableApi.get(params);
|
const res = await tableApi.get(params);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
function tablesearchInput() {}
|
function tablesearchInput() { }
|
||||||
//返回桌台状态颜色
|
//返回桌台状态颜色
|
||||||
function returnTableColor(key) {
|
function returnTableColor(key) {
|
||||||
const item = $status[key];
|
const item = $status[key];
|
||||||
|
|||||||
Reference in New Issue
Block a user