总计 跳转

This commit is contained in:
wwz 2025-03-27 15:50:41 +08:00
parent 9094818ea1
commit 75e5fb65be
4 changed files with 186 additions and 191 deletions

View File

@ -174,11 +174,16 @@
</view>
</view>
</block>
<view class="total-wrap">
<view class="total-wrap" v-if="listinfo.status == 'unpaid'">
<view>总计</view>
<view class="price"> {{listinfo.totalCost}} </view>
</view>
<view class="total-wrap" v-else>
<view>实付</view>
<view class="price"> {{listinfo.payAmount}} </view>
</view>
</view>
</view>

View File

@ -212,7 +212,6 @@
//
watchEffect(async () => {
if (listinfo.combinedArray.length > 0) {
console.log(11)
// packFeess totalPrices Seatcharge
// try {
let sum = (is_type.value != 0 ? listinfo.packFeess : 0) + listinfo.totalPrices + (is_type

View File

@ -55,11 +55,13 @@
</view>
<view class="footer">
<view class="footer_item">
<view class="footer_item_top"><text>{{dataform.queueInfo.waitingCount}}</text><text></text></view>
<view class="footer_item_top"><text>{{dataform.queueInfo.waitingCount}}</text><text></text>
</view>
<view class="footer_item_bom">前方等待桌数</view>
</view>
<view class="footer_item">
<view class="footer_item_top"><text>{{dataform.queueInfo.waitTime||''}}</text><text>分钟</text></view>
<view class="footer_item_top"><text>{{dataform.queueInfo.waitTime||''}}</text><text>分钟</text>
</view>
<view class="footer_item_bom">预计等待时长</view>
</view>
</view>
@ -99,7 +101,8 @@
</view>
<view>
<view class="title">手机号码</view>
<u--input type="number" placeholder="填写号码" border="surround" v-model="dataform.phone"></u--input>
<u--input type="number" placeholder="填写号码" border="surround"
v-model="dataform.phone"></u--input>
</view>
</view>
<view class="footer">
@ -114,7 +117,10 @@
<script setup>
import {
reactive,
ref
ref,
onMounted,
getCurrentInstance,
nextTick
} from 'vue';
const queueUpList = ref([])
@ -130,189 +136,168 @@
shopId: "",
queueId: "",
})
export default {
onLoad(options) {
// #ifdef MP-WEIXIN
if (options.q) {
this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId')
this.queueId = this.getQueryString(decodeURIComponent(options.q), 'queueId')
}
// #endif
// #ifdef MP-ALIPAY
if (getApp().globalData.shopId) {
this.shopId = getApp().globalData.shopId
}
if (getApp().globalData.queueId) {
this.queueId = getApp().globalData.queueId
}
// #endif
},
onShow() {
this.getQueueUpState();
this.getQueueUpTablList();
},
methods: {
/**
* 解码
* @param {Object} url
* @param {Object} name
*/
getQueryString(url, name) {
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
/**
* 获取排号状态
*/
async getQueueUpState() {
let params = {
openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId,
}
if (this.queueId) {
params.queueId = this.queueId;
}
let res = await this.api.getQueueUpState(params)
if (res.code == 0) {
dataform.shopInfo = res.data.shopInfo;
dataform.queueInfo = res.data.queueInfo;
dataform.queueId = dataform.queueInfo.id;
}
},
/**
* 获取排号数据
*/
async getQueueUpList() {
let res = await this.api.getQueueUpList({
openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId,
})
if (res.code == 0 && res.data.length > 0) {
queueUpList.value = res.data;
}
},
/**
* 获取桌型数据
*/
async getQueueUpTablList() {
let res = await this.api.getQueueUpTablList({
shopId: this.shopId,
})
if (res.code == 0 && res.data.length > 0) {
tableList.value = res.data;
dataform.callTableId = res.data[0].id;
}
},
/**
* 订阅通知
*/
async subscribe() {
let res = await this.api.setSubMsg({
openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId,
queueId: this.queueId,
})
if (res.code == 0) {
uni.showToast({
title: '订阅成功',
icon: 'none'
});
uni.requestSubscribeMessage({
tmplIds: ["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw",
"yxOjWK-KjMEZ_BaHWqDJJpHiUPXN6JWqr7u9y65RIWM",
"3BgFazRpVlvreh5z9u4cNP_VeclXKSQfh-r3x2_bYx4"
],
complete() {
},
})
}
},
/**
* 取号
*/
async getTakeNumber() {
if (dataform.phone == "" || dataform.phone == null) {
uni.showToast({
title: '请填写手机号',
icon: 'none'
});
return;
}
let res = await this.api.getTakeNumber({
openId: uni.cache.get('miniAppOpenId'),
shopId: dataform.shopId,
phone: dataform.phone,
callTableId: dataform.callTableId,
})
if (res.code == 0) {
dataform.phone = "";
dataform.queueId = res.data.id;
this.getQueueUpState();
dataform.show = false;
uni.requestSubscribeMessage({
tmplIds: ["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw",
"yxOjWK-KjMEZ_BaHWqDJJpHiUPXN6JWqr7u9y65RIWM",
"3BgFazRpVlvreh5z9u4cNP_VeclXKSQfh-r3x2_bYx4"
],
complete() {
},
})
}
},
/**
* 取消排队
*/
async cancelTakeNumber() {
let res = await this.api.cancelTakeNumber({
queueId: dataform.queueInfo.id,
shopId: this.shopId,
})
if (res.code == 0) {
this.getQueueUpTablList();
this.getQueueUpState();
}
},
/**
* 切换桌型
*/
tableCut(item) {
dataform.callTableId = item.id;
},
/**
* 弹窗关闭监听
*/
close() {
this.phone = "";
if (tableList.value.length > 0) {
dataform.callTableId = tableList.value[0].id;
}
dataform.show = false;
},
//
const getQueryString = (url, name) => {
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
};
return null;
}
//
const getQueueUpState = async () => {
let params = {
openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId,
}
if (this.queueId) {
params.queueId = this.queueId;
}
let res = await this.api.getQueueUpState(params)
if (res.code == 0) {
dataform.shopInfo = res.data.shopInfo;
dataform.queueInfo = res.data.queueInfo;
dataform.queueId = dataform.queueInfo.id;
}
}
//
const getQueueUpList = async () => {
let res = await this.api.getQueueUpList({
openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId,
})
if (res.code == 0 && res.data.length > 0) {
queueUpList.value = res.data;
}
}
//
const getQueueUpTablList = async () => {
let res = await this.api.getQueueUpTablList({
shopId: this.shopId,
})
if (res.code == 0 && res.data.length > 0) {
tableList.value = res.data;
dataform.callTableId = res.data[0].id;
}
}
//
const subscribe = async () => {
let res = await this.api.setSubMsg({
openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId,
queueId: this.queueId,
})
if (res.code == 0) {
uni.showToast({
title: '订阅成功',
icon: 'none'
});
uni.requestSubscribeMessage({
tmplIds: ["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw",
"yxOjWK-KjMEZ_BaHWqDJJpHiUPXN6JWqr7u9y65RIWM",
"3BgFazRpVlvreh5z9u4cNP_VeclXKSQfh-r3x2_bYx4"
],
complete() {
},
})
}
}
//
const getTakeNumber = async () => {
if (dataform.phone == "" || dataform.phone == null) {
uni.showToast({
title: '请填写手机号',
icon: 'none'
});
return;
}
let res = await this.api.getTakeNumber({
openId: uni.cache.get('miniAppOpenId'),
shopId: dataform.shopId,
phone: dataform.phone,
callTableId: dataform.callTableId,
})
if (res.code == 0) {
dataform.phone = "";
dataform.queueId = res.data.id;
this.getQueueUpState();
dataform.show = false;
uni.requestSubscribeMessage({
tmplIds: ["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw",
"yxOjWK-KjMEZ_BaHWqDJJpHiUPXN6JWqr7u9y65RIWM",
"3BgFazRpVlvreh5z9u4cNP_VeclXKSQfh-r3x2_bYx4"
],
complete() {
},
})
}
}
//
const cancelTakeNumber = async () => {
let res = await this.api.cancelTakeNumber({
queueId: dataform.queueInfo.id,
shopId: this.shopId,
})
if (res.code == 0) {
this.getQueueUpTablList();
this.getQueueUpState();
}
}
//
const close = async () => {
this.phone = "";
if (tableList.value.length > 0) {
dataform.callTableId = tableList.value[0].id;
}
dataform.show = false;
}
//
const tableCut = async (item) => {
dataform.callTableId = item.id;
}
onMounted(async () => {
await proxy.$onLaunched;
//
const pages = getCurrentPages();
//
const currentPage = pages[pages.length - 1];
//
const options = currentPage.options;
// #ifdef MP-WEIXIN
if (options.q) {
this.shopId = getQueryString(decodeURIComponent(options.q), 'shopId')
this.queueId = getQueryString(decodeURIComponent(options.q), 'queueId')
}
// #endif
// #ifdef MP-ALIPAY
if (getApp().globalData.shopId) {
this.shopId = getApp().globalData.shopId
}
if (getApp().globalData.queueId) {
this.queueId = getApp().globalData.queueId
}
// #endif
await nextTick()
this.getQueueUpState();
this.getQueueUpTablList();
})
</script>
<style scoped lang="scss">

View File

@ -119,7 +119,9 @@ export const productStore = defineStore('product', {
}
// 是否免除桌位费 0否1是
if (uni.cache.get('shopInfo').isTableFee == 0) {
uni.pro.navigateTo('product/choosetable')
uni.reLaunch({
url: '/pages/product/choosetable'
});
} else {
uni.reLaunch({
url: '/pages/product/index'
@ -147,7 +149,9 @@ export const productStore = defineStore('product', {
}
// 是否免除桌位费 0否1是
if (uni.cache.get('shopInfo').isTableFee == 0) {
uni.pro.navigateTo('product/choosetable')
uni.navigateTo({
url: '/pages/product/choosetable'
});
} else {
uni.reLaunch({
url: '/pages/product/index'
@ -184,7 +188,9 @@ export const productStore = defineStore('product', {
}
if (uni.cache.get('shopInfo').isTableFee == 0) {
uni.pro.navigateTo('product/choosetable')
uni.navigateTo({
url: '/pages/product/choosetable'
});
} else {
uni.reLaunch({
url: '/pages/product/index'