添加绑定码牌
This commit is contained in:
parent
44fc24c52f
commit
c232d9ce76
|
|
@ -1,5 +1,6 @@
|
||||||
// 桌台管理
|
// 桌台管理
|
||||||
import http from './http.js'
|
import http from './http.js'
|
||||||
|
const request=http.request
|
||||||
import $API from '@/http/classApi.js'
|
import $API from '@/http/classApi.js'
|
||||||
import appConfig from '@/config/appConfig.js'
|
import appConfig from '@/config/appConfig.js'
|
||||||
import {
|
import {
|
||||||
|
|
@ -11,4 +12,15 @@ import infoBox from '@/commons/utils/infoBox.js'
|
||||||
export const $tableArea=new $API('/api/tbShopArea',http.req)
|
export const $tableArea=new $API('/api/tbShopArea',http.req)
|
||||||
/* 台桌 */
|
/* 台桌 */
|
||||||
export const $table=new $API('/api/tbShopTable',http.req)
|
export const $table=new $API('/api/tbShopTable',http.req)
|
||||||
|
/* 绑定 */
|
||||||
|
// export const $bind=new $API('/api/tbShopTable/bind',http.req)
|
||||||
|
export function $bind(data) {
|
||||||
|
return request({
|
||||||
|
url: "/api/tbShopTable/bind",
|
||||||
|
method: "post",
|
||||||
|
data: {
|
||||||
|
shopId: uni.getStorageSync('shopId'),
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -39,6 +39,11 @@
|
||||||
<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 =='unbind' ">
|
||||||
|
<my-button color="#333" :width="200" :height="56" type="default" @click="bind">
|
||||||
|
绑定码牌
|
||||||
|
</my-button>
|
||||||
|
</template>
|
||||||
<template v-if="data.status=='idle'||(data.status=='using'&&!data.orderId) ">
|
<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">
|
||||||
选择
|
选择
|
||||||
|
|
@ -80,7 +85,7 @@
|
||||||
} from '@/http/yskApi/table.js'
|
} from '@/http/yskApi/table.js'
|
||||||
import infoBox from '@/commons/utils/infoBox.js'
|
import infoBox from '@/commons/utils/infoBox.js'
|
||||||
const status = $status
|
const status = $status
|
||||||
const emits = defineEmits(['more', 'update'])
|
const emits = defineEmits(['more', 'update', 'bind'])
|
||||||
|
|
||||||
function returnStutasText(key) {
|
function returnStutasText(key) {
|
||||||
key = returnIsUseing(key)
|
key = returnIsUseing(key)
|
||||||
|
|
@ -146,6 +151,10 @@
|
||||||
}
|
}
|
||||||
emits('more')
|
emits('more')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bind() {
|
||||||
|
emits('bind',props.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async function diancan() {
|
async function diancan() {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
|
|
||||||
<view class="u-m-t-30 u-flex u-flex-wrap u-row-between">
|
<view class="u-m-t-30 u-flex u-flex-wrap u-row-between">
|
||||||
<view class="u-m-b-30" v-for="(item,index) in tables.list" :key="index">
|
<view class="u-m-b-30" v-for="(item,index) in tables.list" :key="index">
|
||||||
<table-item @update="getTable" :areaMap="areaMap" @more="moreShow(item)" :data="item"></table-item>
|
<table-item @bind="unBind" @update="getTable" :areaMap="areaMap" @more="moreShow(item)" :data="item"></table-item>
|
||||||
</view>
|
</view>
|
||||||
<my-img-empty v-if="tables.hasAjax&&!tables.list.length" tips="未找到相关桌台"></my-img-empty>
|
<my-img-empty v-if="tables.hasAjax&&!tables.list.length" tips="未找到相关桌台"></my-img-empty>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -80,7 +80,8 @@
|
||||||
} from '@/commons/table-status.js'
|
} from '@/commons/table-status.js'
|
||||||
import {
|
import {
|
||||||
$table,
|
$table,
|
||||||
$tableArea
|
$tableArea,
|
||||||
|
$bind
|
||||||
} from '@/http/yskApi/table.js'
|
} from '@/http/yskApi/table.js'
|
||||||
import {
|
import {
|
||||||
objToArrary
|
objToArrary
|
||||||
|
|
@ -111,7 +112,7 @@
|
||||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||||
const refMoreSheet = ref(null)
|
const refMoreSheet = ref(null)
|
||||||
const actionSheet = reactive({
|
const actionSheet = reactive({
|
||||||
list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单'],
|
list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单','绑定码牌'],
|
||||||
title: '',
|
title: '',
|
||||||
selTable: ''
|
selTable: ''
|
||||||
})
|
})
|
||||||
|
|
@ -175,10 +176,51 @@
|
||||||
//打印订单
|
//打印订单
|
||||||
const res = await $fun.printOrder(actionSheet.selTable.tableId)
|
const res = await $fun.printOrder(actionSheet.selTable.tableId)
|
||||||
return
|
return
|
||||||
|
}
|
||||||
|
if (index == 6) {
|
||||||
|
//打印订单
|
||||||
|
scanCode(item)
|
||||||
|
// const res = await $fun.printOrder(actionSheet.selTable.tableId)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
infoBox.showToast('待开放,请敬请期待!')
|
infoBox.showToast('待开放,请敬请期待!')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unBind (item) {
|
||||||
|
scanCode(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
function scanCode(item) {
|
||||||
|
if ( item.status != 'unbind') {
|
||||||
|
infoBox.showToast('当前桌台已绑定')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.scanCode({
|
||||||
|
onlyFromCamera: true,
|
||||||
|
success: function(res) {
|
||||||
|
console.log('条码类型:' + res.scanType);
|
||||||
|
console.log('条码内容:' + res.result);
|
||||||
|
let params = getQueryString(res.result);
|
||||||
|
$bind({
|
||||||
|
"code": params.code,
|
||||||
|
"id": item.id,
|
||||||
|
}).then(res => {
|
||||||
|
getTable()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getQueryString(url) { //解码
|
||||||
|
let params = {};
|
||||||
|
// 正则表达式来匹配URL中的查询字符串
|
||||||
|
let reg = /(?:\?|#|&){1}([^=]*)=([^&]*)/g;
|
||||||
|
url.replace(reg, (match, key, value) => {
|
||||||
|
params[key] = value;
|
||||||
|
});
|
||||||
|
return params;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
const refTable = ref(null)
|
const refTable = ref(null)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1120,7 +1120,7 @@
|
||||||
"iconPath": "static/tabImg/index.png",
|
"iconPath": "static/tabImg/index.png",
|
||||||
"selectedIconPath": "static/tabImg/index-select.png",
|
"selectedIconPath": "static/tabImg/index-select.png",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
}
|
},
|
||||||
{
|
{
|
||||||
"pagePath": "pages/user/user",
|
"pagePath": "pages/user/user",
|
||||||
"iconPath": "static/tabImg/user.png",
|
"iconPath": "static/tabImg/user.png",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue