总计 跳转

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

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

View File

@@ -212,7 +212,6 @@
// 监听价格算法 // 监听价格算法
watchEffect(async () => { watchEffect(async () => {
if (listinfo.combinedArray.length > 0) { if (listinfo.combinedArray.length > 0) {
console.log(11)
// 打包费packFeess 计算购物车商品费用totalPrices 餐位费Seatcharge // 打包费packFeess 计算购物车商品费用totalPrices 餐位费Seatcharge
// try { // try {
let sum = (is_type.value != 0 ? listinfo.packFeess : 0) + listinfo.totalPrices + (is_type let sum = (is_type.value != 0 ? listinfo.packFeess : 0) + listinfo.totalPrices + (is_type

View File

@@ -55,11 +55,13 @@
</view> </view>
<view class="footer"> <view class="footer">
<view class="footer_item"> <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 class="footer_item_bom">前方等待桌数</view>
</view> </view>
<view class="footer_item"> <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 class="footer_item_bom">预计等待时长</view>
</view> </view>
</view> </view>
@@ -99,7 +101,8 @@
</view> </view>
<view> <view>
<view class="title">手机号码</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> </view>
<view class="footer"> <view class="footer">
@@ -114,7 +117,10 @@
<script setup> <script setup>
import { import {
reactive, reactive,
ref ref,
onMounted,
getCurrentInstance,
nextTick
} from 'vue'; } from 'vue';
const queueUpList = ref([]) const queueUpList = ref([])
@@ -130,48 +136,19 @@
shopId: "", shopId: "",
queueId: "", 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: { const getQueryString = (url, name) => {
/**
* 解码
* @param {Object} url
* @param {Object} name
*/
getQueryString(url, name) {
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i') var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg) var r = url.substr(1).match(reg)
if (r != null) { if (r != null) {
return r[2] return r[2]
} }
return null; return null;
}, }
/** // 获取排号状态
* 获取排号状态 const getQueueUpState = async () => {
*/
async getQueueUpState() {
let params = { let params = {
openId: uni.cache.get('miniAppOpenId'), openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId, shopId: this.shopId,
@@ -186,12 +163,10 @@
dataform.queueInfo = res.data.queueInfo; dataform.queueInfo = res.data.queueInfo;
dataform.queueId = dataform.queueInfo.id; dataform.queueId = dataform.queueInfo.id;
} }
}, }
/** // 获取排号数据
* 获取排号数据 const getQueueUpList = async () => {
*/
async getQueueUpList() {
let res = await this.api.getQueueUpList({ let res = await this.api.getQueueUpList({
openId: uni.cache.get('miniAppOpenId'), openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId, shopId: this.shopId,
@@ -199,12 +174,10 @@
if (res.code == 0 && res.data.length > 0) { if (res.code == 0 && res.data.length > 0) {
queueUpList.value = res.data; queueUpList.value = res.data;
} }
}, }
/** // 获取桌型数据
* 获取桌型数据 const getQueueUpTablList = async () => {
*/
async getQueueUpTablList() {
let res = await this.api.getQueueUpTablList({ let res = await this.api.getQueueUpTablList({
shopId: this.shopId, shopId: this.shopId,
}) })
@@ -212,13 +185,10 @@
tableList.value = res.data; tableList.value = res.data;
dataform.callTableId = res.data[0].id; dataform.callTableId = res.data[0].id;
} }
}, }
/**
* 订阅通知
*/
async subscribe() {
// 订阅通知
const subscribe = async () => {
let res = await this.api.setSubMsg({ let res = await this.api.setSubMsg({
openId: uni.cache.get('miniAppOpenId'), openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId, shopId: this.shopId,
@@ -239,13 +209,10 @@
}, },
}) })
} }
}
}, // 取号
const getTakeNumber = async () => {
/**
* 取号
*/
async getTakeNumber() {
if (dataform.phone == "" || dataform.phone == null) { if (dataform.phone == "" || dataform.phone == null) {
uni.showToast({ uni.showToast({
title: '请填写手机号', title: '请填写手机号',
@@ -275,13 +242,10 @@
}) })
} }
}, }
// 取消排队
/** const cancelTakeNumber = async () => {
* 取消排队
*/
async cancelTakeNumber() {
let res = await this.api.cancelTakeNumber({ let res = await this.api.cancelTakeNumber({
queueId: dataform.queueInfo.id, queueId: dataform.queueInfo.id,
shopId: this.shopId, shopId: this.shopId,
@@ -290,29 +254,50 @@
this.getQueueUpTablList(); this.getQueueUpTablList();
this.getQueueUpState(); this.getQueueUpState();
} }
}
}, // 取消排队
const close = async () => {
/**
* 切换桌型
*/
tableCut(item) {
dataform.callTableId = item.id;
},
/**
* 弹窗关闭监听
*/
close() {
this.phone = ""; this.phone = "";
if (tableList.value.length > 0) { if (tableList.value.length > 0) {
dataform.callTableId = tableList.value[0].id; dataform.callTableId = tableList.value[0].id;
} }
dataform.show = false; 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> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

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