问题修复

This commit is contained in:
2025-12-01 10:50:08 +08:00
parent 0c5ba4b092
commit d2ba7af340
14 changed files with 346 additions and 201 deletions

View File

@@ -26,7 +26,7 @@
:key="index"
class="item"
@click="itemClick(item)"
:class="[selItem && selItem.id == item.id ? 'selected' : '']"
:class="[selItem && selItem.tableCode == item.tableCode ? 'selected' : '']"
>
<view class="u-flex u-row-between">
<view class="u-flex gap-20">
@@ -91,7 +91,7 @@ const props = defineProps({
const selItem = ref("");
function itemClick(item) {
if (selItem.value && selItem.value.id == item.id) {
if (selItem.value && selItem.value.tableCode == item.tableCode) {
selItem.value = "";
return;
}
@@ -112,7 +112,7 @@ watch(
() => modelValue.value,
(newVal, oldVal) => {
console.log(newVal, oldVal);
selItem.value = list.value.find((item) => item.id == newVal);
selItem.value = list.value.find((item) => item.tableCode == newVal);
console.log(selItem.value);
if (selItem.value) {
goodsName.value = selItem.value.name;
@@ -123,10 +123,10 @@ watch(
watch(
() => list.value.length,
(newVal, oldVal) => {
selItem.value = list.value.find((item) => item.id == modelValue.value);
selItem.value = list.value.find((item) => item.tableCode == modelValue.value);
console.log(selItem.value);
if (selItem.value) {
modelValue.value = selItem.value.id;
modelValue.value = selItem.value.tableCode;
goodsName.value = selItem.value.name;
}
}
@@ -143,12 +143,12 @@ function confirm() {
});
return;
}
modelValue.value = selItem.value.id;
modelValue.value = selItem.value.tableCode;
show.value = false;
}
async function getTablelist() {
const res = await tableApi.getShopTable({ size: 999 });
list.value = res.records || [];
list.value = (res.records || []).filter((item) => item.tableCode);
}
onMounted(() => {
getTablelist();

View File

@@ -43,7 +43,7 @@
import { ref, reactive, toRaw, watch, computed ,inject} from "vue";
const accountStore=inject('accountStore')
const cartStore=inject('cartStore')
const orderBtns = [
const $orderBtns = [
{
name: "单品改价",
value: "changePrice",
@@ -56,6 +56,22 @@ const orderBtns = [
name: "赠菜",
value: "gift",
},
{
name: "打包",
value: "pack",
},
// {
// name: "等叫",
// value: "wait",
// },
// {
// name: "免厨打",
// value: "noPrint",
// },
// {
// name: "单品备注",
// value: "remark",
// },
{
name: "单品上菜",
value: "serve",
@@ -69,9 +85,6 @@ const orderBtns = [
value: "startCooking",
},
];
const selCart = defineModel("selCart", {
default: null,
});
const tableBtns = [
{
name: "换台",
@@ -82,6 +95,21 @@ const tableBtns = [
value: "clearTable",
},
];
const payBeforeBtns = ['单品改价','单品转台','赠菜','打包'];
const orderBtns=computed(()=>{
if(cartStore.shopInfo.registerType=='after'){
return $orderBtns
}
return $orderBtns.filter(v=>payBeforeBtns.find(item=>item==v.name))
})
const selCart = defineModel("selCart", {
default: null,
});
const servingSel = ref("");
const tableSel = ref("");
const emits = defineEmits(["btnClick"]);

View File

@@ -18,9 +18,13 @@
>
<view class="u-flex">
<text>{{ item.productName }}</text>
<view class="u-flex gap-10" style="margin-left: 40rpx">
<view class="u-flex gap-20" style="margin-left: 40rpx">
<text class="status gift" v-if="item.isGift"></text>
<template v-if="item.subStatus">
<text class="status pack" v-if="item.packNumber > 0"
>
<view class="badge">{{ item.packNumber }}</view>
</text>
<template v-if="item.subStatus &&cartStore.shopInfo.registerType=='after'">
<text
class="status"
:class="[
@@ -78,7 +82,7 @@
</view>
<text class="u-flex-1">
{{ cartStore.packFee }}
{{ cartStore.orderCostSummary.packFee }}
</text>
</view>
</view>
@@ -107,12 +111,18 @@ const timer = setInterval(() => {
}, 1000);
//超时时间
const maxTime = 10 * 60 * 1000;
const maxTime = cartStore.shopInfo.serveTime*60*1000;
function returnStatusClass(item) {
if (item.subStatus == "DELIVERED") {
return "success";
}
if (item.subStatus == "READY_TO_SERVE") {
return "warning";
}
if (item.subStatus == "SENT_OUT") {
return "green";
}
}
/**
* 返回商品状态文本
@@ -123,7 +133,7 @@ function returnSubStatusText(item) {
return "待起菜";
}
if (item.subStatus == "READY_TO_SERVE") {
if (item.startOrderTime) {
if (item.startOrderTime&&cartStore.shopInfo.isServeTimeControl) {
const maxWaitTime = dayjs(item.startOrderTime).add(
maxTime,
"millisecond"
@@ -215,6 +225,7 @@ function itemClick(item) {
color: #999;
border-color: #999;
background-color: rgba(153, 153, 153, 0.25);
position: relative;
&.default {
}
&.timeout {
@@ -227,13 +238,44 @@ function itemClick(item) {
border-color: $my-main-color;
background-color: rgba(63, 158, 255, 0.25);
}
&.green {
$color: rgba(52, 199, 89, 1);
border-color: $color;
color: $color;
background-color: rgba(52, 199, 89, 0.25);
}
&.warning {
$color: #ff8d28;
border-color: $color;
color: $color;
background-color: rgba(255, 141, 40, 0.25);
}
&.gift {
$color: rgb(255, 159, 46);
color: $color;
background-color: rgb(255, 240, 223);
border-color: $color;
}
&.pack {
$color: rgb(49, 138, 254);
color: $color;
background-color: rgb(49, 138, 254, 0.25);
border-color: $color;
}
.badge {
position: absolute;
text-align: center;
$height:32rpx;
line-height: $height;
height: $height;
top: calc(-#{$height} / 2);
right: calc(-#{$height} / 2);
width: $height;
border-radius: 50%;
font-size: 20rpx;
color: #fff;
background-color: #ff383c;
}
}
.old-price {
text-decoration: line-through;