代码优化
This commit is contained in:
@@ -71,10 +71,9 @@
|
||||
import { computed, ref } from 'vue';
|
||||
import myButton from '@/components/my-components/my-button'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import { $status } from '@/commons/table-status.js'
|
||||
import { $table } from '@/http/yskApi/table.js'
|
||||
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import { shopTableClear } from '@/http/api/table.js'
|
||||
|
||||
const emits = defineEmits(['more', 'update', 'bind'])
|
||||
const props = defineProps({
|
||||
data: {
|
||||
@@ -88,26 +87,18 @@
|
||||
default: () => {}
|
||||
}
|
||||
})
|
||||
const status = $status
|
||||
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
|
||||
return props.data.status
|
||||
})
|
||||
|
||||
function returnIsUseing(key) {
|
||||
// return key = key == 'using' ? (props.data.orderId ? key : 'idle') : key
|
||||
return key
|
||||
function returnStutasText(key) {
|
||||
const item = uni.$dict.tableStatus[key]
|
||||
return item ? item.label : ''
|
||||
}
|
||||
|
||||
|
||||
function returnStutasColor(key) {
|
||||
key = returnIsUseing(key)
|
||||
const item = status[key]
|
||||
const item = uni.$dict.tableStatus[key]
|
||||
return item ? item.type : ''
|
||||
}
|
||||
|
||||
@@ -151,16 +142,14 @@
|
||||
* 清台
|
||||
*/
|
||||
function qingtai() {
|
||||
const item = props.data
|
||||
let item = props.data
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要清台:' + props.data.name + '?',
|
||||
content: '确定要清台:' + item.name + '?',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
$table.update({
|
||||
...item,
|
||||
status: "idle",
|
||||
qrcode: item.id,
|
||||
shopTableClear({
|
||||
id: item.id,
|
||||
}).then(res => {
|
||||
uni.$utils.showToast('清台成功')
|
||||
emits('update')
|
||||
|
||||
Reference in New Issue
Block a user