fix: 修复历史订单切换就餐模式,修改代客下单就餐类型根据店铺信息做限制,修改店铺配置至少勾选一种就餐模式

This commit is contained in:
YeMingfei666 2025-03-18 16:59:06 +08:00
parent c722cd4c79
commit 4e835eb43d
4 changed files with 42 additions and 18 deletions

View File

@ -393,7 +393,9 @@ export const useCartsStore = defineStore("carts", () => {
} }
// 更改全部商品打包状态 // 更改全部商品打包状态
function changePack(is_pack: number | string) { function changePack(is_pack: number | string) {
sendMessage('batch', { is_pack }); if (!isEmpty.value) {
sendMessage('batch', { is_pack });
}
} }
function clear() { function clear() {
@ -496,7 +498,8 @@ export const useCartsStore = defineStore("carts", () => {
discount_sale_note: v.discountSaleNote, discount_sale_note: v.discountSaleNote,
product_name: v.productName, product_name: v.productName,
sku_name: v.skuName, sku_name: v.skuName,
sku_id: v.skuId sku_id: v.skuId,
product_type: v.productType
} }
}) })
} }

View File

@ -79,7 +79,7 @@
<el-radio value="after">餐饮版先下单后支付</el-radio> <el-radio value="after">餐饮版先下单后支付</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="就餐模式「多选」"> <el-form-item label="就餐模式「多选」" prop="eatModel">
<el-checkbox-group v-model="form.eatModel"> <el-checkbox-group v-model="form.eatModel">
<el-checkbox value="dine-in">堂食自取</el-checkbox> <el-checkbox value="dine-in">堂食自取</el-checkbox>
<el-checkbox value="take-out">允许打包</el-checkbox> <el-checkbox value="take-out">允许打包</el-checkbox>
@ -303,17 +303,24 @@ export default {
consumeColony: "all", consumeColony: "all",
}, },
rules: { rules: {
eatModel: [
{
required: true,
message: "请至少选择一种就餐模式",
trigger: "blur",
},
],
shopName: [ shopName: [
{ {
required: true, required: true,
message: " ", message: "请输入门店名称",
trigger: "blur", trigger: "blur",
}, },
], ],
phone: [ phone: [
{ {
required: true, required: true,
message: " ", message: "请输入联系电话",
trigger: "blur", trigger: "blur",
}, },
], ],
@ -426,7 +433,7 @@ export default {
try { try {
const shopId = localStorage.getItem("shopId"); const shopId = localStorage.getItem("shopId");
const res = await ShopApi.get(); const res = await ShopApi.get();
this.form = { ...res, eatModel: res.eatModel.split(",") }; this.form = { ...res, eatModel: res.eatModel ? res.eatModel.split(",") : [] };
if (res.businessTime) { if (res.businessTime) {
const businessTime = res.businessTime.split("-"); const businessTime = res.businessTime.split("-");
this.startTime = businessTime[0]; this.startTime = businessTime[0];
@ -447,13 +454,13 @@ export default {
// //
submitHandle() { submitHandle() {
this.$refs.form.validate(async (valid) => { this.$refs.form.validate(async (valid) => {
console.log(valid);
if (valid) { if (valid) {
this.formLoading = true; this.formLoading = true;
try { try {
if (this.startTime && this.endTime) { if (this.startTime && this.endTime) {
this.form.businessTime = `${this.startTime}-${this.endTime}`; this.form.businessTime = `${this.startTime}-${this.endTime}`;
} }
console.log(this.startTime, this.endTime);
const res = await ShopApi.edit({ const res = await ShopApi.edit({
...this.form, ...this.form,
eatModel: this.form.eatModel.join(","), eatModel: this.form.eatModel.join(","),

View File

@ -1,14 +1,19 @@
<template> <template>
<div class="flex order-item u-m-b-14 relative" :class="[isActive]" @click="itemClick"> <div class="flex order-item u-m-b-14 relative" :class="[isActive]" @click="itemClick">
<div class="absolute status-box"> <div class="absolute status-box">
<span class="pack" v-if="item.pack_number * 1 > 0"> <template v-if="isOld">
<span class="pack" v-if="dinerType == 1">
<span class="number">{{ item.pack_number * 1 }}</span>
</span> <span class="number">{{ item.product_type == "weight" ? 1 : item.num * 1 }}</span>
<span class="pack" v-if="isOld && dinerType == 1"> </span>
</template>
<span class="number">{{ item.product_type == "weight" ? 1 : item.num * 1 }}</span> <template v-else>
</span> <span class="pack" v-if="item.pack_number * 1 > 0">
<span class="number">{{ item.pack_number * 1 }}</span>
</span>
</template>
<span class="da" v-if="item.is_print || item.is_print === null"></span> <span class="da" v-if="item.is_print || item.is_print === null"></span>
<span class="isWaitCall" v-if="item.is_wait_call"></span> <span class="isWaitCall" v-if="item.is_wait_call"></span>
<span class="tui" v-if="item.returnNum"> <span class="tui" v-if="item.returnNum">

View File

@ -84,6 +84,7 @@
<el-button <el-button
:class="{ active: index == diners.sel }" :class="{ active: index == diners.sel }"
v-for="(item, index) in diners.list" v-for="(item, index) in diners.list"
:disabled="dinerDisabled(item, index)"
@click="changeDinersSel(index)" @click="changeDinersSel(index)"
:key="index" :key="index"
> >
@ -308,7 +309,7 @@ async function refReturnCartConfirm(e) {
}); });
ElMessage({ ElMessage({
type: res ? "success" : "error", type: res ? "success" : "error",
text: res ? "退菜成功" : "操作失败", message: res ? "退菜成功" : "操作失败",
}); });
if (res) { if (res) {
// //
@ -578,7 +579,7 @@ const diners = reactive({
{ label: "堂食", value: 1 }, { label: "堂食", value: 1 },
{ label: "自取", value: 2 }, { label: "自取", value: 2 },
], ],
sel: 0, sel: shopUser.userInfo.eatModel.includes("dine-in") ? 0 : 1,
}); });
function changeDinersSel(index) { function changeDinersSel(index) {
@ -593,6 +594,14 @@ watch(
} }
); );
function dinerDisabled(item, index) {
if (index == 0) {
return !shopUser.userInfo.eatModel.includes("dine-in");
}
if (index == 1) {
return !shopUser.userInfo.eatModel.includes("take-out");
}
}
// //
const category = reactive({ const category = reactive({
list: [], list: [],
@ -717,7 +726,7 @@ watch(
function init() { function init() {
getTableList(); getTableList();
getCategoryList(); getCategoryList();
carts.init({ table_code: table.tableCode }); carts.init({ table_code: table.tableCode }, oldOrder.value);
} }
onBeforeRouteLeave(() => { onBeforeRouteLeave(() => {