台桌列表修改

当台桌状态为开台中时
如果台桌没有返回下单生成订单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>
<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="u-flex u-row-between">
<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">
<template v-if="data.status!='using'">
<view class=" u-font-32" :style="{color:returnStutasColor(data.status)}">
{{returnStutasText(data.status)}}~</view>
{{returnStutasText(data.status)}}~
</view>
</template>
<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=""><text>已点</text><text class="u-m-l-20 color-333">{{data.productNum||0}}</text>
</view>
@ -38,7 +39,7 @@
<template v-else>
<view class="u-flex u-row-center u-m-t-16">
<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>
@ -78,19 +79,30 @@
} from '@/http/yskApi/table.js'
import infoBox from '@/commons/utils/infoBox.js'
const status = $status
const emits = defineEmits(['more','update'])
const emits = defineEmits(['more', 'update'])
function returnStutasText(key) {
key = returnIsUseing(key)
const item = status[key]
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) {
// if(key=='using'){
// return 'rgb(250,85,85)'
// }else{
// return ''
// }
key = returnIsUseing(key)
const item = status[key]
return item ? item.type : ''
}
@ -126,10 +138,10 @@
function more() {
emits('more')
}
function diancan() {
const useType=props.status=='using'?props.data.useType:undefined
const useType = props.status == 'using' ? props.data.useType : undefined
go.to('PAGES_CREATE_ORDER', {
tableId: props.data.tableId,
name: props.data.name,
@ -139,7 +151,7 @@
}
function toOrderDetail() {
if (props.data.status == 'using') {
if (props.data.status == 'using' && props.data.orderId) {
const {
tableId,
name,
@ -148,19 +160,25 @@
areaId,
orderId
} = props.data
if (!orderId) {
return uni.showToast({
icon: 'none',
title: '台桌未返回订单id'
})
}
go.to('PAGES_ORDER_DETAIL', {
tableId,
name,
status,
amount,
areaId,
id:orderId
id: orderId
})
}
}
function qingtai() {
const item=props.data
const item = props.data
uni.showModal({
title: '提示',
content: '确定要清台:' + props.data.name + '',
@ -170,7 +188,7 @@
...item,
status: "idle",
qrcode: item.tableId,
}).then(res=>{
}).then(res => {
infoBox.showToast('清台成功')
emits('update')
})