更新购物车
This commit is contained in:
@@ -123,6 +123,20 @@
|
||||
nextTick
|
||||
} from 'vue';
|
||||
|
||||
//接口引入
|
||||
import {
|
||||
APIcallTabletakeNumber,
|
||||
APIusercallTable,
|
||||
APIqueuecallTable,
|
||||
APIqueuedetail,
|
||||
APIcallTablesubMsg
|
||||
} from "@/common/api/subscribeto.js";
|
||||
|
||||
// 获取全局属性
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
|
||||
const queueUpList = ref([])
|
||||
|
||||
const tableList = ref([])
|
||||
@@ -131,7 +145,10 @@
|
||||
show: false,
|
||||
phone: "",
|
||||
callTableId: "",
|
||||
shopInfo: null,
|
||||
shopInfo: {
|
||||
logo: '',
|
||||
shopName: ''
|
||||
},
|
||||
queueInfo: null,
|
||||
shopId: "",
|
||||
queueId: "",
|
||||
@@ -150,15 +167,14 @@
|
||||
// 获取排号状态
|
||||
const getQueueUpState = async () => {
|
||||
let params = {
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
shopId: this.shopId,
|
||||
shopId: dataform.shopId,
|
||||
}
|
||||
if (this.queueId) {
|
||||
params.queueId = this.queueId;
|
||||
if (dataform.queueId) {
|
||||
params.queueId = dataform.queueId;
|
||||
}
|
||||
let res = await this.api.getQueueUpState(params)
|
||||
let res = await APIusercallTable(params)
|
||||
|
||||
if (res.code == 0) {
|
||||
if (res) {
|
||||
dataform.shopInfo = res.data.shopInfo;
|
||||
dataform.queueInfo = res.data.queueInfo;
|
||||
dataform.queueId = dataform.queueInfo.id;
|
||||
@@ -167,34 +183,36 @@
|
||||
|
||||
// 获取排号数据
|
||||
const getQueueUpList = async () => {
|
||||
let res = await this.api.getQueueUpList({
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
shopId: this.shopId,
|
||||
let res = await APIqueuecallTable({
|
||||
shopId: dataform.shopId,
|
||||
})
|
||||
if (res.code == 0 && res.data.length > 0) {
|
||||
if (res) {
|
||||
queueUpList.value = res.data;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取桌型数据
|
||||
// 叫号队列详情
|
||||
const getQueueUpTablList = async () => {
|
||||
let res = await this.api.getQueueUpTablList({
|
||||
shopId: this.shopId,
|
||||
let res = await APIqueuedetail({
|
||||
shopId: dataform.shopId,
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
})
|
||||
if (res.code == 0 && res.data.length > 0) {
|
||||
if (res.queueInfo) {
|
||||
tableList.value = res.data;
|
||||
dataform.callTableId = res.data[0].id;
|
||||
|
||||
} else {
|
||||
getQueueUpState()
|
||||
}
|
||||
}
|
||||
|
||||
// 订阅通知
|
||||
const subscribe = async () => {
|
||||
let res = await this.api.setSubMsg({
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
shopId: this.shopId,
|
||||
queueId: this.queueId,
|
||||
let res = await APIcallTablesubMsg({
|
||||
openId: uni.cache.get('userInfo').wechatOpenId,
|
||||
shopId: dataform.shopId,
|
||||
queueId: dataform.queueId,
|
||||
})
|
||||
if (res.code == 0) {
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: '订阅成功',
|
||||
icon: 'none'
|
||||
@@ -229,7 +247,7 @@
|
||||
if (res.code == 0) {
|
||||
dataform.phone = "";
|
||||
dataform.queueId = res.data.id;
|
||||
this.getQueueUpState();
|
||||
getQueueUpState();
|
||||
dataform.show = false;
|
||||
uni.requestSubscribeMessage({
|
||||
tmplIds: ["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw",
|
||||
@@ -248,15 +266,20 @@
|
||||
const cancelTakeNumber = async () => {
|
||||
let res = await this.api.cancelTakeNumber({
|
||||
queueId: dataform.queueInfo.id,
|
||||
shopId: this.shopId,
|
||||
shopId: dataform.shopId,
|
||||
})
|
||||
if (res.code == 0) {
|
||||
this.getQueueUpTablList();
|
||||
this.getQueueUpState();
|
||||
if (res) {
|
||||
getQueueUpTablList();
|
||||
getQueueUpState();
|
||||
}
|
||||
}
|
||||
|
||||
// 取消排队
|
||||
// 切换桌型
|
||||
const tableCut = (item) => {
|
||||
dataform.callTableId = item.id;
|
||||
}
|
||||
|
||||
// 弹窗关闭监听
|
||||
const close = async () => {
|
||||
this.phone = "";
|
||||
if (tableList.value.length > 0) {
|
||||
@@ -265,11 +288,6 @@
|
||||
dataform.show = false;
|
||||
}
|
||||
|
||||
// 取消排队
|
||||
const tableCut = async (item) => {
|
||||
dataform.callTableId = item.id;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await proxy.$onLaunched;
|
||||
// 获取当前页面栈
|
||||
@@ -281,22 +299,21 @@
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
if (options.q) {
|
||||
this.shopId = getQueryString(decodeURIComponent(options.q), 'shopId')
|
||||
this.queueId = getQueryString(decodeURIComponent(options.q), 'queueId')
|
||||
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) {
|
||||
this.shopId = getApp().globalData.shopId
|
||||
dataform.shopId = getApp().globalData.shopId
|
||||
}
|
||||
if (getApp().globalData.queueId) {
|
||||
this.queueId = getApp().globalData.queueId
|
||||
dataform.queueId = getApp().globalData.queueId
|
||||
}
|
||||
// #endif
|
||||
await nextTick()
|
||||
this.getQueueUpState();
|
||||
this.getQueueUpTablList();
|
||||
getQueueUpTablList();
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user