扫码排队
This commit is contained in:
@@ -1,44 +1,6 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<block v-if="!dataform.queueInfo">
|
||||
<image class="top_bg" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_bg.png"
|
||||
mode="aspectFill"></image>
|
||||
<view class="content">
|
||||
<image class="top_img" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_img.png"
|
||||
mode="aspectFill"></image>
|
||||
<view class="head">
|
||||
<image class="avatar" :src="dataform.shopInfo.logo" mode="aspectFill"></image>
|
||||
<view class="head_text">
|
||||
<text class="shopName">{{shopInfo.shopName}}</text>
|
||||
<text class="tip">{{dataform.shopInfo.status == 1 ? '营业中' : '休息中'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="center">
|
||||
<view class="center_head">
|
||||
<text>餐桌类型</text>
|
||||
<text>等待桌数</text>
|
||||
<text>预计等待</text>
|
||||
</view>
|
||||
<view class="center_list" v-for="(item,index) in tableList" :key="index">
|
||||
<view class="w center_list_item">
|
||||
<text>{{item.name||''}}</text>
|
||||
<text>{{item.note||''}}</text>
|
||||
</view>
|
||||
<view class="w center_list_item">
|
||||
<text>{{item.waitingCount}}</text>
|
||||
<text>桌</text>
|
||||
</view>
|
||||
<view class="w time">约{{item.waitTime}}分钟</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="addBtn" @click="dataform.show = true" v-if="dataform.shopInfo.status == 1">
|
||||
立即排队
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<block v-else>
|
||||
<block v-if="dataform.queueInfo">
|
||||
<view class="result"
|
||||
style="background: url('https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_su_bg.png') no-repeat center 26rpx / 96%;">
|
||||
<view class="head">
|
||||
@@ -60,7 +22,7 @@
|
||||
<view class="footer_item_bom">前方等待桌数</view>
|
||||
</view>
|
||||
<view class="footer_item">
|
||||
<view class="footer_item_top"><text>≥{{dataform.queueInfo.waitTime||''}}</text><text>分钟</text>
|
||||
<view class="footer_item_top"><text>≥{{dataform.queueInfo.waitTime || 0}}</text><text>分钟</text>
|
||||
</view>
|
||||
<view class="footer_item_bom">预计等待时长</view>
|
||||
</view>
|
||||
@@ -73,8 +35,43 @@
|
||||
取消排队
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<image class="top_bg" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_bg.png"
|
||||
mode="aspectFill"></image>
|
||||
<view class="content">
|
||||
<image class="top_img" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_img.png"
|
||||
mode="aspectFill"></image>
|
||||
<view class="head">
|
||||
<image class="avatar" :src="dataform.shopInfo.logo" mode="aspectFill"></image>
|
||||
<view class="head_text">
|
||||
<text class="shopName">{{dataform.shopInfo.shopName}}</text>
|
||||
<text class="tip">{{dataform.shopInfo.status == 1 ? '营业中' : '休息中'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="center">
|
||||
<view class="center_head">
|
||||
<text>餐桌类型</text>
|
||||
<text>等待桌数</text>
|
||||
<text>预计等待</text>
|
||||
</view>
|
||||
<view class="center_list" v-for="(item,index) in tableList" :key="index">
|
||||
<view class="w center_list_item">
|
||||
<text>{{item.name||''}}</text>
|
||||
<text>{{item.note||''}}</text>
|
||||
</view>
|
||||
<view class="w center_list_item">
|
||||
<text>{{item.nearNum}}</text>
|
||||
<text>桌</text>
|
||||
</view>
|
||||
<view class="w time">约{{item.waitTime}}分钟</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="addBtn" @click="dataform.show = true" v-if="dataform.shopInfo.status == 1">
|
||||
立即排队
|
||||
</view>
|
||||
</block>
|
||||
|
||||
@@ -120,7 +117,8 @@
|
||||
ref,
|
||||
onMounted,
|
||||
getCurrentInstance,
|
||||
nextTick
|
||||
nextTick,
|
||||
onShow
|
||||
} from 'vue';
|
||||
|
||||
//接口引入
|
||||
@@ -129,7 +127,8 @@
|
||||
APIusercallTable,
|
||||
APIqueuecallTable,
|
||||
APIqueuedetail,
|
||||
APIcallTablesubMsg
|
||||
APIcallTablesubMsg,
|
||||
APIqueuecancel
|
||||
} from "@/common/api/subscribeto.js";
|
||||
|
||||
// 获取全局属性
|
||||
@@ -146,11 +145,10 @@
|
||||
phone: "",
|
||||
callTableId: "",
|
||||
shopInfo: {
|
||||
logo: '',
|
||||
shopName: ''
|
||||
},
|
||||
queueInfo: null,
|
||||
shopId: "",
|
||||
shopId: 29,
|
||||
queueId: "",
|
||||
})
|
||||
|
||||
@@ -164,31 +162,15 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
// 获取排号状态
|
||||
const getQueueUpState = async () => {
|
||||
let params = {
|
||||
shopId: dataform.shopId,
|
||||
}
|
||||
if (dataform.queueId) {
|
||||
params.queueId = dataform.queueId;
|
||||
}
|
||||
let res = await APIusercallTable(params)
|
||||
|
||||
if (res) {
|
||||
dataform.shopInfo = res.data.shopInfo;
|
||||
dataform.queueInfo = res.data.queueInfo;
|
||||
dataform.queueId = dataform.queueInfo.id;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取排号数据
|
||||
const getQueueUpList = async () => {
|
||||
let res = await APIqueuecallTable({
|
||||
// 获取排号列表
|
||||
const userorderList = async () => {
|
||||
let res = await APIusercallTable({
|
||||
shopId: dataform.shopId,
|
||||
queueId: dataform.queueId
|
||||
})
|
||||
if (res) {
|
||||
queueUpList.value = res.data;
|
||||
}
|
||||
tableList.value = res.records
|
||||
}
|
||||
|
||||
// 叫号队列详情
|
||||
@@ -198,11 +180,11 @@
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
})
|
||||
if (res.queueInfo) {
|
||||
tableList.value = res.data;
|
||||
|
||||
dataform.queueInfo = res.queueInfo;
|
||||
} else {
|
||||
getQueueUpState()
|
||||
userorderList()
|
||||
}
|
||||
dataform.shopInfo = res.shopInfo;
|
||||
}
|
||||
|
||||
// 订阅通知
|
||||
@@ -210,7 +192,7 @@
|
||||
let res = await APIcallTablesubMsg({
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
shopId: dataform.shopId,
|
||||
queueId: dataform.queueId,
|
||||
queueId: dataform.queueInfo.id,
|
||||
})
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
@@ -238,17 +220,17 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
let res = await this.api.getTakeNumber({
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
let res = await APIcallTabletakeNumber({
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
shopId: dataform.shopId,
|
||||
phone: dataform.phone,
|
||||
callTableId: dataform.callTableId,
|
||||
})
|
||||
if (res.code == 0) {
|
||||
if (res) {
|
||||
dataform.phone = "";
|
||||
dataform.queueId = res.data.id;
|
||||
getQueueUpState();
|
||||
dataform.queueId = res.id;
|
||||
dataform.show = false;
|
||||
getQueueUpTablList()
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: ["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw",
|
||||
"yxOjWK-KjMEZ_BaHWqDJJpHiUPXN6JWqr7u9y65RIWM",
|
||||
@@ -264,14 +246,11 @@
|
||||
|
||||
// 取消排队
|
||||
const cancelTakeNumber = async () => {
|
||||
let res = await this.api.cancelTakeNumber({
|
||||
let res = await APIqueuecancel({
|
||||
queueId: dataform.queueInfo.id,
|
||||
shopId: dataform.shopId,
|
||||
})
|
||||
if (res) {
|
||||
getQueueUpTablList();
|
||||
getQueueUpState();
|
||||
}
|
||||
getQueueUpTablList();
|
||||
}
|
||||
|
||||
// 切换桌型
|
||||
@@ -281,7 +260,7 @@
|
||||
|
||||
// 弹窗关闭监听
|
||||
const close = async () => {
|
||||
this.phone = "";
|
||||
dataform.phone = "";
|
||||
if (tableList.value.length > 0) {
|
||||
dataform.callTableId = tableList.value[0].id;
|
||||
}
|
||||
@@ -291,28 +270,28 @@
|
||||
onMounted(async () => {
|
||||
await proxy.$onLaunched;
|
||||
// 获取当前页面栈
|
||||
const pages = getCurrentPages();
|
||||
// 获取当前页面实例
|
||||
const currentPage = pages[pages.length - 1];
|
||||
// 获取页面参数
|
||||
const options = currentPage.options;
|
||||
// const pages = getCurrentPages();
|
||||
// // 获取当前页面实例
|
||||
// const currentPage = pages[pages.length - 1];
|
||||
// // 获取页面参数
|
||||
// const options = currentPage.options;
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
if (options.q) {
|
||||
dataform.shopId = getQueryString(decodeURIComponent(options.q), 'shopId')
|
||||
dataform.queueId = getQueryString(decodeURIComponent(options.q), 'queueId')
|
||||
}
|
||||
// #endif
|
||||
console.log(dataform.shopId, 11)
|
||||
// #ifdef MP-ALIPAY
|
||||
if (getApp().globalData.shopId) {
|
||||
dataform.shopId = getApp().globalData.shopId
|
||||
}
|
||||
if (getApp().globalData.queueId) {
|
||||
dataform.queueId = getApp().globalData.queueId
|
||||
}
|
||||
// #endif
|
||||
// // #ifdef MP-WEIXIN
|
||||
// if (options.q) {
|
||||
// dataform.shopId = getQueryString(decodeURIComponent(options.q), 'shopId')
|
||||
// dataform.queueId = getQueryString(decodeURIComponent(options.q), 'queueId')
|
||||
// }
|
||||
// // #endif
|
||||
// // #ifdef MP-ALIPAY
|
||||
// if (getApp().globalData.shopId) {
|
||||
// dataform.shopId = getApp().globalData.shopId
|
||||
// }
|
||||
// if (getApp().globalData.queueId) {
|
||||
// dataform.queueId = getApp().globalData.queueId
|
||||
// }
|
||||
//// #endif
|
||||
await nextTick()
|
||||
uni.cache.set('shopId', 29, 30)
|
||||
getQueueUpTablList();
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user