购物车计算

This commit is contained in:
wwz
2025-03-01 18:30:19 +08:00
parent 04a84aa17f
commit c0af79f666
10 changed files with 216 additions and 152 deletions

View File

@@ -116,6 +116,7 @@ export const productStore = defineStore('product', {
await this.actionsproductqueryShop()
}
}
// 是否免除桌位费 0否1是
if (uni.cache.get('shopInfo').isTableFee == 0) {
uni.pro.navigateTo('product/choosetable')
} else {
@@ -132,6 +133,8 @@ export const productStore = defineStore('product', {
}
});
// #endif
// #ifdef H5
if (uni.cache.get('tableCode')) {
let data = await this.actionsproductqueryShop()
@@ -143,12 +146,14 @@ export const productStore = defineStore('product', {
await this.actionsproductqueryShop()
}
}
if (uni.cache.get('shopTable').status != 'idle') {
// idle-空闲 using-使用中 subscribe预定closed--关台, opening 开台中cleaning 台桌清理中
if (uni.cache.get('shopTable').status == 'cleaning' || uni.cache.get(
'shopTable').status == 'cleaning') {
uni.showToast({
title: '此台桌暂不可用...',
icon: 'none'
})
return false
return false;
}
if (uni.cache.get('shopInfo').isTableFee == 0) {
@@ -164,37 +169,36 @@ export const productStore = defineStore('product', {
})
},
// /通过桌码获取店铺信息
// /通过桌码获取当前店铺信息
actionsproductqueryShop() {
return new Promise(async (resolve, reject) => {
try {
let res = await APIproductqueryShop({
tableCode: uni.cache.get('tableCode'),
})
res.shopInfo.isVip = res.vip ? '1' : '0'
res.shopTable.shopExtendMap = res.shopExtendMap
// 店铺信息
uni.cache.set('shopTable', res.shopTable)
// 台桌信息
uni.cache.set('shopInfo', res.shopInfo)
uni.cache.set('shopId', res.shopTable.shopId)
// 当前用户距离店铺的米数
uni.cache.set('distance', res.distance,5000)
// try {
let res = await APIproductqueryShop({
tableCode: uni.cache.get('tableCode'),
})
res.shopInfo.isVip = res.vip ? '1' : '0'
res.shopTable.shopExtendMap = res.shopExtendMap
// 店铺信息
uni.cache.set('shopTable', res.shopTable)
// 台桌信息
uni.cache.set('shopInfo', res.shopInfo)
uni.cache.set('shopId', res.shopTable.shopId,30)
// 当前用户距离店铺的米数
uni.cache.set('distance', res.distance)
resolve(res)
} catch (e) {
reject(false)
}
resolve(res)
// } catch (e) {
// reject(false)
// }
})
},
// 获取店铺会员信息
// 通过shopId 获取店铺会员信息
actionsproductqueryProduct() {
return new Promise(async (resolve, reject) => {
try {
let res = await APIshopUserInfo()
// uni.cache.set('ShopUser', res)
uni.cache.set('userInfo', res);
resolve(true)
} catch (e) {