feat: 接入下载桌台码接口,代客下单代码调整
This commit is contained in:
@@ -3,11 +3,10 @@ import { Account_BaseUrl } from "@/api/config";
|
||||
const baseURL = Account_BaseUrl + "/admin/shopTable";
|
||||
const API = {
|
||||
// 批量生成桌码
|
||||
fasetAdd(num: number) {
|
||||
downloadTableCode(num: number) {
|
||||
return request({
|
||||
url: `${baseURL}/code`,
|
||||
url: `${baseURL}/code?num=` + num,
|
||||
method: "post",
|
||||
data: { num },
|
||||
});
|
||||
},
|
||||
getList(data: getListRequest) {
|
||||
@@ -17,6 +16,14 @@ const API = {
|
||||
params: data
|
||||
});
|
||||
},
|
||||
// 获取台桌详情
|
||||
get(id: string | number) {
|
||||
return request({
|
||||
url: `${baseURL}/detail`,
|
||||
method: "get",
|
||||
params: { id }
|
||||
});
|
||||
},
|
||||
edit(data: editRequest) {
|
||||
return request({
|
||||
url: `${baseURL}`,
|
||||
|
||||
@@ -2,11 +2,11 @@ import request from "@/utils/request";
|
||||
import { Order_BaseUrl } from "@/api/config";
|
||||
const baseURL = Order_BaseUrl + "/admin/order";
|
||||
const OrderApi = {
|
||||
getList(params: getListRequest) {
|
||||
getList(data: getListRequest) {
|
||||
return request<any, getListResponse>({
|
||||
url: `${baseURL}`,
|
||||
method: "get",
|
||||
params: params,
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
},
|
||||
add(data: addRequest) {
|
||||
@@ -16,11 +16,76 @@ const OrderApi = {
|
||||
data
|
||||
});
|
||||
},
|
||||
// 历史订单(多次下单使用)
|
||||
getHistoryList(params: getHistoryListRequest) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/historyOrder`,
|
||||
method: "get",
|
||||
params: params,
|
||||
});
|
||||
},
|
||||
// 订单全额退款 只传订单id
|
||||
refundOrder(data: refundOrderRequest) {
|
||||
return request<any>({
|
||||
url: `${baseURL}/refundOrder`,
|
||||
method: "post",
|
||||
params: data,
|
||||
});
|
||||
},
|
||||
|
||||
edit() { },
|
||||
delete() { },
|
||||
};
|
||||
|
||||
export default OrderApi;
|
||||
|
||||
export interface refundOrderRequest {
|
||||
/**
|
||||
* 现金退款,是否
|
||||
*/
|
||||
cash?: boolean;
|
||||
/**
|
||||
* 自定义退款金额,退款金额 默认为 退单数量*单价 的和
|
||||
* 整单退款 为订单orderAmount
|
||||
* 如果自定义退款金额 则金额不进行校验 直接退款
|
||||
*/
|
||||
modify?: boolean;
|
||||
orderId: number;
|
||||
/**
|
||||
* 退单总金额
|
||||
*/
|
||||
refundAmount: number;
|
||||
/**
|
||||
* 退单明细
|
||||
* id: orderDetailId
|
||||
* num: 退单数量
|
||||
* returnAmount: 退单金额
|
||||
*/
|
||||
refundDetails?: RefundDetail[];
|
||||
refundReason?: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情 实体类。
|
||||
*/
|
||||
export interface RefundDetail {
|
||||
id?: number;
|
||||
/**
|
||||
* 退单数量
|
||||
*/
|
||||
num?: number;
|
||||
/**
|
||||
* 退单金额
|
||||
*/
|
||||
returnAmount?: number;
|
||||
[property: string]: any;
|
||||
}
|
||||
export interface getHistoryListRequest {
|
||||
orderId?: number;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
// 订单状态
|
||||
export type statusType =
|
||||
| "unpaid"
|
||||
|
||||
@@ -27,12 +27,24 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
const isEmpty = computed(() => {
|
||||
return list.value.length === 0 && giftList.value.length === 0
|
||||
})
|
||||
//当前购物车选中数据
|
||||
const selCart = computed(() => {
|
||||
if (isSelGift.value) {
|
||||
return giftList.value[selListIndex.value] || defaultCart
|
||||
}
|
||||
return list.value[selListIndex.value] || defaultCart
|
||||
})
|
||||
//当前购物车选中对应商品数据
|
||||
const selGoods = computed(() => {
|
||||
return goodsMap[selCart.value.product_id]
|
||||
})
|
||||
//当前选中购物车数据是否是可选套餐商品
|
||||
const isCanSelectGroup = computed(() => {
|
||||
if (!selGoods.value) {
|
||||
return false
|
||||
}
|
||||
return selGoods.value.type == 'package' && selGoods.value.groupType == 1
|
||||
})
|
||||
//赠菜总价
|
||||
const giftMoney = computed(() => {
|
||||
return giftList.value.reduce((acc: number, cur: any) => {
|
||||
@@ -96,18 +108,30 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
}
|
||||
}
|
||||
|
||||
const basic_msg = {
|
||||
number: 1,
|
||||
is_pack: 0,
|
||||
is_gift: 0,
|
||||
is_temporary: 0,
|
||||
discount_sale_amount: 0,
|
||||
discount_sale_note: "",
|
||||
is_print: 0,
|
||||
is_wait_call: 0,
|
||||
product_name: "",
|
||||
remark: "",
|
||||
sku_id: '',
|
||||
}
|
||||
//当前购物车直接添加
|
||||
function cartsPush(data: any) {
|
||||
sendMessage('add', {
|
||||
...basic_msg,
|
||||
...data
|
||||
});
|
||||
}
|
||||
|
||||
function add(data: any) {
|
||||
const msg = {
|
||||
number: 1,
|
||||
is_pack: 0,
|
||||
is_gift: 0,
|
||||
is_temporary: 0,
|
||||
discount_sale_amount: 0,
|
||||
discount_sale_note: "",
|
||||
is_print: 0,
|
||||
is_wait_call: 0,
|
||||
product_name: "",
|
||||
remark: "",
|
||||
...basic_msg,
|
||||
...data
|
||||
}
|
||||
const hasCart = list.value.find((cartItem) => {
|
||||
@@ -116,10 +140,21 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
if (hasCart) {
|
||||
update({ ...hasCart, ...msg, number: hasCart.number * 1 + msg.number * 1 })
|
||||
} else {
|
||||
console.log(msg);
|
||||
sendMessage('add', msg);
|
||||
}
|
||||
}
|
||||
|
||||
// 换桌
|
||||
function changeTable(newVal: string | number) {
|
||||
if (table_code.value) {
|
||||
sendMessage('rottable', {
|
||||
new_table_code: newVal,
|
||||
id: list.value[0].id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function del(data: any) {
|
||||
sendMessage('del', data);
|
||||
}
|
||||
@@ -183,27 +218,40 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
return ElMessage.error(msg.message || '操作失败')
|
||||
}
|
||||
if (msg && msg.data) {
|
||||
const tableCode = Array.isArray(msg.data) ? msg.data[0].table_code : msg.data.table_code
|
||||
table_code.value = table_code.value ? table_code.value : tableCode
|
||||
console.log(table_code.value)
|
||||
if (Array.isArray(msg.data) && msg.data.length) {
|
||||
table_code.value = msg.data[0].table_code
|
||||
}
|
||||
if (msg.data.table_code) {
|
||||
table_code.value = table_code.value ? table_code.value : msg.data.table_code
|
||||
}
|
||||
}
|
||||
// 初始化
|
||||
if (msg.operate_type === "manage_init") {
|
||||
// 设置单价
|
||||
list.value = msg.data.filter((v: { is_gift: any; }) => !v.is_gift).map((v: Record<string, any>) => {
|
||||
list.value = msg.data.filter((v: Record<string, any>) => {
|
||||
const skuData = getProductDetails({ product_id: v.product_id, sku_id: v.sku_id })
|
||||
return {
|
||||
...skuData,
|
||||
...v,
|
||||
if (skuData) {
|
||||
(Object.keys(skuData) as (keyof typeof skuData)[]).forEach((key) => {
|
||||
v[key] = skuData[key];
|
||||
});
|
||||
} else {
|
||||
del({ id: v.id })
|
||||
return false
|
||||
}
|
||||
});
|
||||
giftList.value = msg.data.filter((v: { is_gift: any; }) => v.is_gift).map((v: Record<string, any>) => {
|
||||
return !v.is_gift
|
||||
})
|
||||
giftList.value = msg.data.filter((v: Record<string, any>) => {
|
||||
const skuData = getProductDetails({ product_id: v.product_id, sku_id: v.sku_id })
|
||||
return {
|
||||
...skuData,
|
||||
...v,
|
||||
if (skuData) {
|
||||
(Object.keys(skuData) as (keyof typeof skuData)[]).forEach((key) => {
|
||||
v[key] = skuData[key];
|
||||
});
|
||||
} else {
|
||||
del({ id: v.id })
|
||||
return false
|
||||
}
|
||||
});
|
||||
return v.is_gift
|
||||
})
|
||||
console.log(giftList.value)
|
||||
}
|
||||
//广播
|
||||
@@ -211,6 +259,9 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
msg.operate_type = 'manage_' + msg.operate_type
|
||||
}
|
||||
if (msg.operate_type === "manage_add") {
|
||||
if (list.value.find(v => v.id == msg.data.id)) {
|
||||
return ElMessage.warning(msg.message || '该商品已存在')
|
||||
}
|
||||
const skuData = getProductDetails({ product_id: msg.data.product_id, sku_id: msg.data.sku_id })
|
||||
list.value.push({ ...skuData, ...msg.data })
|
||||
return ElMessage.success(msg.message || '添加成功')
|
||||
@@ -283,6 +334,9 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
WebSocketManager.sendMessage(msg);
|
||||
}
|
||||
return {
|
||||
isCanSelectGroup,
|
||||
selGoods,
|
||||
cartsPush,
|
||||
table_code,
|
||||
updateTag,
|
||||
list,
|
||||
@@ -293,7 +347,8 @@ export const useCartsStore = defineStore("carts", () => {
|
||||
changeNumber, isEmpty,
|
||||
selCart, totalNumber,
|
||||
changeSelCart, payMoney,
|
||||
clear, yiyouhui, giftList
|
||||
clear, yiyouhui, giftList,
|
||||
changeTable
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -56,3 +56,63 @@ export function formatGrowthRate(growthRate: number) {
|
||||
.replace(/\.?0+$/, "");
|
||||
return formattedRate + "%";
|
||||
}
|
||||
/**
|
||||
* Parse the time to string
|
||||
* @param {(Object|string|number)} time
|
||||
* @param {string} cFormat
|
||||
* @returns {string}
|
||||
*/
|
||||
export function parseTime(time: string | number | Date | null, cFormat: string | undefined) {
|
||||
if (arguments.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const format = cFormat || "{y}-{m}-{d} {h}:{i}:{s}";
|
||||
let date;
|
||||
if (typeof time === "undefined" || time === null || time === "null") {
|
||||
return "";
|
||||
} else if (typeof time === "object") {
|
||||
date = time;
|
||||
} else {
|
||||
if (typeof time === "string" && /^[0-9]+$/.test(time)) {
|
||||
time = parseInt(time);
|
||||
}
|
||||
if (typeof time === "number" && time.toString().length === 10) {
|
||||
time = time * 1000;
|
||||
}
|
||||
date = new Date(time);
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
};
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key: keyof typeof formatObj): string => {
|
||||
let value = formatObj[key];
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === "a") {
|
||||
return ["日", "一", "二", "三", "四", "五", "六"][value];
|
||||
}
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = Number("0" + value.toString());
|
||||
}
|
||||
return value.toString() || "0";
|
||||
});
|
||||
return time_str;
|
||||
}
|
||||
|
||||
// 下载文件
|
||||
export function downloadFile(obj: BlobPart, name: string, suffix: string) {
|
||||
const url = window.URL.createObjectURL(new Blob([obj]));
|
||||
const link = document.createElement("a");
|
||||
link.style.display = "none";
|
||||
link.href = url;
|
||||
const fileName = parseTime(new Date(), undefined) + "-" + name + "." + suffix;
|
||||
link.setAttribute("download", fileName);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
@@ -20,7 +20,7 @@ export interface ApifoxModel {
|
||||
type: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
export type msgType = 'add' | 'reduce' | 'remove' | 'edit' | 'init' | 'cleanup' | 'del'
|
||||
export type msgType = 'add' | 'reduce' | 'remove' | 'edit' | 'init' | 'cleanup' | 'del' | 'rottable'
|
||||
class WebSocketManager {
|
||||
private client: WebSocket | null = null;
|
||||
private connected: boolean = false;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<el-button type="primary" @click="resetting">重置</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="安全手机号">
|
||||
{{ form.phone | phoneFilter }}
|
||||
{{ phoneFilter(form.phone) }}
|
||||
</el-form-item>
|
||||
<el-form-item label="验证码">
|
||||
<el-input
|
||||
@@ -118,8 +118,6 @@ export default {
|
||||
type: "success",
|
||||
});
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
phoneFilter(d) {
|
||||
let str = d + "";
|
||||
return str.substr(0, 3) + "***" + str.substr(-4);
|
||||
|
||||
@@ -48,6 +48,8 @@ const contentConfig = {
|
||||
label: "优惠类型",
|
||||
align: "center",
|
||||
prop: "discountType",
|
||||
templet: "custom",
|
||||
slotName: "options",
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
|
||||
@@ -34,10 +34,14 @@
|
||||
<span class="totalPrice">¥{{ carts.payMoney }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<el-button type="primary" @click="createOrder">微信/支付宝</el-button>
|
||||
<el-button type="primary" @click="createOrder">现金</el-button>
|
||||
<el-button type="primary" @click="createOrder">更多支付</el-button>
|
||||
<div class="btn-group" v-if="isXianFuKuan">
|
||||
<el-button type="primary" size="large" @click="createOrder">微信/支付宝</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">现金</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">更多支付</el-button>
|
||||
</div>
|
||||
<div class="btn-group" v-else>
|
||||
<el-button type="primary" size="large" @click="createOrder">仅下单</el-button>
|
||||
<el-button type="primary" size="large" @click="createOrder">去结账</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,6 +51,8 @@
|
||||
import cartsItem from "./item.vue";
|
||||
import { useCartsStore } from "@/store/modules/carts";
|
||||
|
||||
let isXianFuKuan = ref(true);
|
||||
|
||||
const props = defineProps({
|
||||
goodsList: {
|
||||
type: Array,
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<template>
|
||||
<div class="controls">
|
||||
<div class="input-number">
|
||||
<div class="reduce" @click="carts.changeNumber(-1, carts.selCart)">
|
||||
<div class="input-number" :class="{ disabled: canEdit }">
|
||||
<div class="reduce" @click="changeCartNumber(-1)">
|
||||
<el-icon><Minus /></el-icon>
|
||||
</div>
|
||||
<span class="text">{{ carts.selCart.number || 1 }}</span>
|
||||
<div class="add" @click="carts.changeNumber(1, carts.selCart)">
|
||||
<div class="add" @click="changeCartNumber(1)">
|
||||
<el-icon><Plus /></el-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-button
|
||||
v-for="(item, index) in controls"
|
||||
:key="index"
|
||||
v-bund="item"
|
||||
:disabled="btnDisabled(item)"
|
||||
@click="controlsClick(item)"
|
||||
>
|
||||
@@ -30,7 +30,7 @@ const controls = ref([
|
||||
{ label: "规格", key: "", disabled: false, per: "sku" },
|
||||
{ label: "赠送", key: "is_gift", disabled: false, per: "cart" },
|
||||
{ label: "打包", key: "is_pack", disabled: false, per: "cart" },
|
||||
{ label: "删除", key: "del", disabled: false, per: "cart" },
|
||||
{ label: "删除", key: "del", disabled: false, per: "del" },
|
||||
{ label: "存单", key: "", disabled: false, per: "save" },
|
||||
{ label: "取单", key: "", disabled: false },
|
||||
{ label: "单品备注", key: "one-note", disabled: false, per: "one-note" },
|
||||
@@ -78,9 +78,15 @@ const perList = computed(() => {
|
||||
if (!carts.selCart.id) {
|
||||
return ["all-wating", "all-note"];
|
||||
}
|
||||
if (carts.selCart.id) {
|
||||
return ["cart", "save", "one-note", "all-note", "all-wating"];
|
||||
if (carts.isCanSelectGroup) {
|
||||
return ["all-wating", "all-note", "del"];
|
||||
}
|
||||
if (carts.selCart.id) {
|
||||
return ["cart", "del", "save", "one-note", "all-note", "all-wating"];
|
||||
}
|
||||
});
|
||||
const canEdit = computed(() => {
|
||||
return !perList.value.includes("cart");
|
||||
});
|
||||
|
||||
function btnDisabled(item) {
|
||||
@@ -101,6 +107,11 @@ function returnLabel(item) {
|
||||
}
|
||||
return item.label;
|
||||
}
|
||||
function changeCartNumber(step) {
|
||||
if (perList.value.includes("cart")) {
|
||||
carts.changeNumber(step, carts.selCart);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -143,4 +154,7 @@ $gap: 10px;
|
||||
.add {
|
||||
}
|
||||
}
|
||||
.disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
274
src/views/tool/Instead/components/diner-number.vue
Normal file
274
src/views/tool/Instead/components/diner-number.vue
Normal file
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<div class="select_desk">
|
||||
<el-dialog width="410px" title="就餐人数" v-model="show">
|
||||
<div class="select_desk_dialog u-p-b-20">
|
||||
<key-board
|
||||
isCanEmpty
|
||||
v-model="number"
|
||||
@clear="clear"
|
||||
:max="max"
|
||||
:maxTips="'最多' + max + '位'"
|
||||
>
|
||||
<template #clear>
|
||||
<div>清空</div>
|
||||
</template>
|
||||
<template #input>
|
||||
<div class="u-p-l-20 u-p-r-20 u-flex w-full">
|
||||
<el-input
|
||||
placeholder="请输入就餐人数"
|
||||
v-model="number"
|
||||
@input="inputNumber"
|
||||
@change="inputChange"
|
||||
type="number"
|
||||
>
|
||||
<template #append>位</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</template>
|
||||
</key-board>
|
||||
<div class="confirm_btns">
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">确定</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import keyBoard from "./keyboard.vue";
|
||||
import { ElMessage } from "element-plus";
|
||||
export default {
|
||||
components: { keyBoard },
|
||||
props: {
|
||||
max: {
|
||||
type: Number,
|
||||
default: 99,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
number: "",
|
||||
show: false,
|
||||
hasOpen: false,
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
number(newval) {
|
||||
if (newval > this.max) {
|
||||
this.number = this.max;
|
||||
ElMessage.error("最多只能选择" + this.max + "位就餐人数");
|
||||
}
|
||||
// 使用正则表达式匹配正整数
|
||||
const regex = /^[1-9]\d*$/;
|
||||
// 如果输入的值不是正整数,则将其设置为上一个有效值
|
||||
if (!regex.test(newval)) {
|
||||
this.number = newval.substring(0, newval.length - 1);
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
inputNumber(e) {},
|
||||
inputChange(e) {},
|
||||
clear(e) {
|
||||
console.log(e);
|
||||
this.number = "";
|
||||
},
|
||||
confirm() {
|
||||
if (this.number > this.max) {
|
||||
ElMessage.error("最多只能选择" + this.max + "位就餐人数");
|
||||
}
|
||||
if (!this.number) {
|
||||
ElMessage.error("请选择就餐人数");
|
||||
}
|
||||
console.log(this.number);
|
||||
this.$emit("confirm", this.number);
|
||||
this.close();
|
||||
},
|
||||
open(number) {
|
||||
this.number = number || "";
|
||||
this.show = true;
|
||||
},
|
||||
close() {
|
||||
this.show = false;
|
||||
this.number = "";
|
||||
},
|
||||
},
|
||||
mounted() {},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
:deep(.el-button) {
|
||||
padding: 12px 20px;
|
||||
}
|
||||
|
||||
:deep(.el-input__inner::-webkit-inner-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
:deep(.el-input__inner::-webkit-outer-spin-button) {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
:deep(.el-button--success) {
|
||||
border-color: #22bf64;
|
||||
background-color: #22bf64;
|
||||
}
|
||||
.select_desk .btn {
|
||||
height: 34px;
|
||||
}
|
||||
.tags {
|
||||
font-size: 16px;
|
||||
&.using {
|
||||
color: rgb(234, 64, 37);
|
||||
}
|
||||
&.wait {
|
||||
color: rgb(252, 236, 79);
|
||||
}
|
||||
&.idle {
|
||||
color: rgb(137, 234, 71);
|
||||
}
|
||||
&.closed {
|
||||
color: rgb(221, 221, 221);
|
||||
filter: grayscale(1);
|
||||
}
|
||||
}
|
||||
::v-deep .inputs .el-input__inner {
|
||||
border-color: transparent !important;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
letter-spacing: 1.25px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.select_desk .select_desk_dialog {
|
||||
display: flex;
|
||||
|
||||
flex-direction: column;
|
||||
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav {
|
||||
width: 286px;
|
||||
height: 38px;
|
||||
background: #dcf0e8;
|
||||
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav .li,
|
||||
.select_desk .select_desk_dialog .nav {
|
||||
border-radius: 4px;
|
||||
|
||||
display: flex;
|
||||
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav .li {
|
||||
width: 140px;
|
||||
height: 34px;
|
||||
color: #0fc161;
|
||||
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .nav .lion {
|
||||
background: #0fc161;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .inputs {
|
||||
width: 370px;
|
||||
line-height: 54px;
|
||||
margin-top: 24px;
|
||||
height: 54px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
color: rgba(0, 0, 0, 0.8);
|
||||
letter-spacing: 1.25px;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .inputs .close {
|
||||
color: #aaa;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
line-height: 30px;
|
||||
top: 50%;
|
||||
margin-top: -15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard {
|
||||
display: flex;
|
||||
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
border-right: 1px solid #dcdfe6;
|
||||
border-bottom: 1px solid #dcdfe6;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .li {
|
||||
height: 60px;
|
||||
width: 33.333%;
|
||||
|
||||
display: flex;
|
||||
|
||||
justify-content: center;
|
||||
|
||||
align-items: center;
|
||||
font-size: 24px;
|
||||
color: #212121;
|
||||
cursor: pointer;
|
||||
|
||||
user-select: none;
|
||||
border-left: 1px solid #dcdfe6;
|
||||
border-top: 1px solid #dcdfe6;
|
||||
|
||||
transition: all 0.1s;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .li:hover {
|
||||
background: #dcdfe6;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .li .icon {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .confirm {
|
||||
height: 140px;
|
||||
background: #ff9f2e;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.select_desk .select_desk_dialog .keyboard .confirm:hover {
|
||||
background: #f88502;
|
||||
}
|
||||
|
||||
.confirm_btns {
|
||||
display: flex;
|
||||
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.confirm_btns .el-button {
|
||||
width: 175px;
|
||||
}
|
||||
</style>
|
||||
@@ -61,6 +61,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ElMessage } from "element-plus";
|
||||
const props = defineProps({
|
||||
isCanEmpty: {
|
||||
type: Boolean,
|
||||
@@ -108,6 +109,7 @@ function clearFunction() {
|
||||
if (props.isFloat) {
|
||||
return keyboradAdd(".");
|
||||
}
|
||||
number.value = "";
|
||||
}
|
||||
function keyboradAdd(n) {
|
||||
if (n == "." && `${number.value}`.includes(".")) {
|
||||
@@ -120,7 +122,7 @@ function keyboradAdd(n) {
|
||||
}
|
||||
const newval = number.value + n;
|
||||
if (newval * 1 > props.max * 1) {
|
||||
return ElMessage.error(this.maxTips);
|
||||
return ElMessage.error(props.maxTips);
|
||||
}
|
||||
console.log(number.value);
|
||||
number.value = newval;
|
||||
|
||||
@@ -73,9 +73,15 @@ function handleSelectionChange(val, index) {
|
||||
};
|
||||
}
|
||||
|
||||
const emits = defineEmits(["dialogpackageconfirm"]);
|
||||
const emits = defineEmits(["confirm"]);
|
||||
function confirm() {
|
||||
emits("dialogpackageconfirm", listdata.value, multipleSelection.value);
|
||||
const pro_group_info = listdata.value.groupSnap.map((v, index) => {
|
||||
return {
|
||||
...v,
|
||||
goods: [...multipleSelection.value[index]],
|
||||
};
|
||||
});
|
||||
emits("confirm", listdata.value, pro_group_info);
|
||||
show.value = false;
|
||||
}
|
||||
function open(item) {
|
||||
@@ -87,11 +93,6 @@ function open(item) {
|
||||
});
|
||||
} catch (error) {}
|
||||
multipleSelection.value = [];
|
||||
// 不用选套餐
|
||||
if (item.groupType == 0) {
|
||||
emits("dialogpackageconfirm", listdata.value, [item.groupSnap[0].goods]);
|
||||
return false;
|
||||
}
|
||||
disabledshow.value = true;
|
||||
show.value = true;
|
||||
}
|
||||
|
||||
@@ -88,10 +88,11 @@
|
||||
|
||||
<div class="u-flex u-font-14 clear u-m-t-10 perpoles">
|
||||
<div
|
||||
@click="showDinerNumber"
|
||||
class="u-flex u-p-r-14 u-m-r-14"
|
||||
style="border-right: 1px solid #ebebeb; line-height: 1"
|
||||
>
|
||||
<span>就餐人数:-位</span>
|
||||
<span>就餐人数:{{ perpole || "-" }} 位</span>
|
||||
<el-icon><ArrowRight /></el-icon>
|
||||
</div>
|
||||
<a @click="clearCarts" style="color: #1890ff">清空</a>
|
||||
@@ -181,11 +182,14 @@
|
||||
<chooseUser ref="refChooseUser" @chooseUser="chooseUserConfirm"></chooseUser>
|
||||
<!-- 打折 -->
|
||||
<discount ref="refDiscount" @confirm="discountConfirm"></discount>
|
||||
<!-- 就餐人数 -->
|
||||
<dinerNumber ref="refDinerNumber" @confirm="dinerNumberConfirm"></dinerNumber>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import Controls from "./components/control.vue";
|
||||
import discount from "./components/discount.vue";
|
||||
import dinerNumber from "./components/diner-number.vue";
|
||||
import note from "./components/note.vue";
|
||||
import Order from "./components/order.vue";
|
||||
import pack from "./components/pack.vue";
|
||||
@@ -202,6 +206,16 @@ import productApi from "@/api/product/index";
|
||||
import tableApi from "@/api/account/table";
|
||||
import $status from "@/views/tool/table/status.js";
|
||||
import orderApi from "@/api/order/order";
|
||||
//就餐人数
|
||||
let perpole = ref("");
|
||||
const refDinerNumber = ref();
|
||||
function dinerNumberConfirm(e) {
|
||||
perpole.value = e;
|
||||
}
|
||||
function showDinerNumber() {
|
||||
refDinerNumber.value.open(perpole.value);
|
||||
}
|
||||
|
||||
//打折
|
||||
const refDiscount = ref();
|
||||
function discountConfirm(e) {}
|
||||
@@ -224,17 +238,37 @@ function showChooseUser() {
|
||||
|
||||
//订单
|
||||
const showOrder = ref(false);
|
||||
function createOrder() {
|
||||
async function createOrder() {
|
||||
console.log(refCart.value.carts.table_code);
|
||||
orderApi.add({
|
||||
const res = await orderApi.add({
|
||||
orderId: "",
|
||||
shopId: "",
|
||||
userId: "",
|
||||
seatNum: 0,
|
||||
packFee: 0,
|
||||
originAmount: 29,
|
||||
tableCode: refCart.value.carts.table_code,
|
||||
dineMode: "dine-in",
|
||||
dineMode: diners.sel == 0 ? "dine-in" : "take-out",
|
||||
remark: "",
|
||||
placeNum: "",
|
||||
waitCall: false,
|
||||
vipPrice: false,
|
||||
});
|
||||
if (res) {
|
||||
showOrder.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
//套餐商品
|
||||
//可选套餐商品
|
||||
const refAddTaocan = ref();
|
||||
function taocanConfirm() {}
|
||||
function taocanConfirm(goods, pro_group_info) {
|
||||
refCart.value.carts.cartsPush({
|
||||
goods_type: "package",
|
||||
product_id: goods.id,
|
||||
sku_id: goods.skuList[0].id,
|
||||
pro_group_info: JSON.stringify(pro_group_info),
|
||||
});
|
||||
}
|
||||
function taocanShow(item) {
|
||||
refAddTaocan.value.open(item);
|
||||
}
|
||||
@@ -264,6 +298,10 @@ function getTableList() {
|
||||
tableList.value = res.records;
|
||||
});
|
||||
}
|
||||
function getTableDetail(table_code) {
|
||||
tableApi.get(table_code);
|
||||
}
|
||||
function tablesearchInput() {}
|
||||
//返回台桌状态颜色
|
||||
function returnTableColor(key) {
|
||||
const item = $status[key];
|
||||
@@ -276,7 +314,9 @@ function returnTableLabel(key) {
|
||||
}
|
||||
function tableClick(item) {
|
||||
console.log(item);
|
||||
getTableDetail(item.tableCode);
|
||||
table.value = item;
|
||||
refCart.value.carts.changeTable(item.tableCode);
|
||||
refTable.value.hide();
|
||||
}
|
||||
|
||||
@@ -422,11 +462,18 @@ function goodsClick(item) {
|
||||
if (item.type === "package") {
|
||||
//固定套餐
|
||||
if (item.groupType == 0) {
|
||||
addCarts({
|
||||
const sendmsg = {
|
||||
goods_type: "package",
|
||||
sku_id: item.groupSnap[0].goods[0].skuId,
|
||||
product_id: item.id,
|
||||
number: item.groupSnap[0].goods[0].number,
|
||||
});
|
||||
};
|
||||
addCarts(sendmsg);
|
||||
// refCart.value.carts.cartsPush({
|
||||
// sku_id: item.groupSnap[0].goods[0].skuId,
|
||||
// product_id: item.id,
|
||||
// number: item.groupSnap[0].goods[0].number,
|
||||
// });
|
||||
return;
|
||||
}
|
||||
//可选套餐
|
||||
|
||||
69
src/views/tool/table/components/downloadTableCode.vue
Normal file
69
src/views/tool/table/components/downloadTableCode.vue
Normal file
@@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<el-dialog title="下载桌码" width="400px" v-model="dialogVisible" @open="reset">
|
||||
<el-form ref="form" :model="form" label-position="left">
|
||||
<el-form-item label="下载数量">
|
||||
<el-input-number v-model="form.number" :min="1" :max="500"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="onSubmitHandle">下 载</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { downloadFile } from "@/utils/index";
|
||||
import TableApi from "@/api/account/table";
|
||||
import { ElMessage } from "element-plus";
|
||||
export default {
|
||||
props: {
|
||||
total: {
|
||||
type: [Number, String],
|
||||
default: 1,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
loading: false,
|
||||
form: {
|
||||
number: 1,
|
||||
},
|
||||
resetForm: "",
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.resetForm = { ...this.form };
|
||||
},
|
||||
methods: {
|
||||
async onSubmitHandle() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const file = await TableApi.downloadTableCode(this.form.number);
|
||||
this.loading = false;
|
||||
this.dialogVisible = false;
|
||||
ElMessage.success("下载成功");
|
||||
downloadFile(file, "桌码", "zip");
|
||||
} catch (error) {
|
||||
this.loading = false;
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
show(obj) {
|
||||
this.dialogVisible = true;
|
||||
// if (obj && obj.id) {
|
||||
// this.form = JSON.parse(JSON.stringify(obj))
|
||||
// }
|
||||
},
|
||||
close() {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
reset() {
|
||||
this.form = { ...this.resetForm };
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -27,7 +27,9 @@
|
||||
<div class="">
|
||||
<el-button icon="plus" @click="addEaraShow()">添加区域</el-button>
|
||||
<el-button type="primary" icon="plus" @click="addTableShow()">添加台桌</el-button>
|
||||
<el-button type="primary" icon="download" @click="downloadTableCpde">下载桌台码</el-button>
|
||||
<el-button type="primary" icon="download" @click="showDownloadTableCode">
|
||||
下载桌台码
|
||||
</el-button>
|
||||
<el-button type="primary" icon="download" @click="downloadShopCpde">下载店铺码</el-button>
|
||||
</div>
|
||||
|
||||
@@ -218,6 +220,8 @@
|
||||
<!-- 弹窗 -->
|
||||
<addEara ref="refAddEara" @success="areainit" />
|
||||
<addTable ref="refAddTable" @success="tableinit" />
|
||||
<!-- 下载桌台码 -->
|
||||
<downloadTableCode ref="refDownloadTableCode" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -228,6 +232,13 @@ import shopAreaApi from "@/api/account/shopArea";
|
||||
import tableApi from "@/api/account/table";
|
||||
import addEara from "./components/addEara.vue";
|
||||
import addTable from "./components/addTable.vue";
|
||||
import downloadTableCode from "./components/downloadTableCode.vue";
|
||||
|
||||
//桌台二维码
|
||||
const refDownloadTableCode = ref();
|
||||
function showDownloadTableCode() {
|
||||
refDownloadTableCode.value.show();
|
||||
}
|
||||
|
||||
let loading = ref(false);
|
||||
//工具方法
|
||||
|
||||
Reference in New Issue
Block a user