台桌列表修改

当台桌状态为开台中时
如果台桌没有返回下单生成订单id,
将台桌当做空闲处理
This commit is contained in:
YeMingfei666 2024-10-10 11:46:00 +08:00
parent 8329d9cfad
commit 09781b82e1
1 changed files with 30 additions and 12 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="item color-fff border-r-12" :class="[data.status]" @click="toOrderDetail"> <view class="item color-fff border-r-12" :class="[computedClass]" @click="toOrderDetail">
<view class="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}"> <view class="my-bg-main" :style="{'background-color':returnStutasColor(data.status)}">
<view class="u-flex u-row-between"> <view class="u-flex u-row-between">
<view class="u-font-32">{{data.name}}</view> <view class="u-font-32">{{data.name}}</view>
@ -18,10 +18,11 @@
<view class="u-flex u-flex-col u-row-center u-col-center bg-fff bottom"> <view class="u-flex u-flex-col u-row-center u-col-center bg-fff bottom">
<template v-if="data.status!='using'"> <template v-if="data.status!='using'">
<view class=" u-font-32" :style="{color:returnStutasColor(data.status)}"> <view class=" u-font-32" :style="{color:returnStutasColor(data.status)}">
{{returnStutasText(data.status)}}~</view> {{returnStutasText(data.status)}}~
</view>
</template> </template>
<view class=" w-full u-p-l-16 u-p-r-16 u-p-t-16 u-font-24"> <view class=" w-full u-p-l-16 u-p-r-16 u-p-t-16 u-font-24">
<template v-if="data.status=='using'"> <template v-if="data.status=='using'&& data.orderId">
<view class="color-666 u-text-left u-p-b-20 border-bottom"> <view class="color-666 u-text-left u-p-b-20 border-bottom">
<view class=""><text>已点</text><text class="u-m-l-20 color-333">{{data.productNum||0}}</text> <view class=""><text>已点</text><text class="u-m-l-20 color-333">{{data.productNum||0}}</text>
</view> </view>
@ -38,7 +39,7 @@
<template v-else> <template v-else>
<view class="u-flex u-row-center u-m-t-16"> <view class="u-flex u-row-center u-m-t-16">
<template v-if="data.tableId"> <template v-if="data.tableId">
<template v-if="data.status=='idle' "> <template v-if="data.status=='idle'||(data.status=='using'&&!data.orderId) ">
<my-button color="#333" :width="150" :height="56" type="default" @click="diancan"> <my-button color="#333" :width="150" :height="56" type="default" @click="diancan">
选择 选择
</my-button> </my-button>
@ -81,16 +82,27 @@
const emits = defineEmits(['more', 'update']) const emits = defineEmits(['more', 'update'])
function returnStutasText(key) { function returnStutasText(key) {
key = returnIsUseing(key)
const item = status[key] const item = status[key]
return item ? item.label : '' return item ? item.label : ''
} }
const computedClass = computed(() => {
const key = returnIsUseing(props.data.status)
return key
})
function returnIsUseing(key) {
return key = key == 'using' ? (props.data.orderId ? key : 'idle') : key
}
function returnStutasColor(key) { function returnStutasColor(key) {
// if(key=='using'){ // if(key=='using'){
// return 'rgb(250,85,85)' // return 'rgb(250,85,85)'
// }else{ // }else{
// return '' // return ''
// } // }
key = returnIsUseing(key)
const item = status[key] const item = status[key]
return item ? item.type : '' return item ? item.type : ''
} }
@ -139,7 +151,7 @@
} }
function toOrderDetail() { function toOrderDetail() {
if (props.data.status == 'using') { if (props.data.status == 'using' && props.data.orderId) {
const { const {
tableId, tableId,
name, name,
@ -148,6 +160,12 @@
areaId, areaId,
orderId orderId
} = props.data } = props.data
if (!orderId) {
return uni.showToast({
icon: 'none',
title: '台桌未返回订单id'
})
}
go.to('PAGES_ORDER_DETAIL', { go.to('PAGES_ORDER_DETAIL', {
tableId, tableId,
name, name,