购物车计算
This commit is contained in:
@@ -46,19 +46,19 @@ export default (params) => {
|
||||
resolve(res.data);
|
||||
} else {
|
||||
switch (res.code) {
|
||||
case '-4':
|
||||
resolve(res)
|
||||
// uni.showToast({
|
||||
// title: res.message || res.msg || res.error,
|
||||
// icon: "none",
|
||||
// success: () => {
|
||||
// setTimeout(() => {
|
||||
// uni.reLaunch({
|
||||
// url: "/pages/login/index",
|
||||
// })
|
||||
// }, 1000);
|
||||
// }
|
||||
// })
|
||||
case '501':
|
||||
uni.cache.remove('shopId')
|
||||
uni.showToast({
|
||||
title: '',
|
||||
icon: "none",
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: "/pages/index/index",
|
||||
})
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 404:
|
||||
uni.showToast({
|
||||
|
||||
@@ -5,24 +5,38 @@
|
||||
* @return {String} 缓存值
|
||||
*/
|
||||
function get(key) {
|
||||
try {
|
||||
let res = uni.getStorageSync(key)
|
||||
try {
|
||||
let res = uni.getStorageSync(key)
|
||||
if (!res) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (!res) {
|
||||
return ''
|
||||
}
|
||||
|
||||
|
||||
// res = JSON.parse(res)
|
||||
|
||||
if (res.__expiretime && res.__expiretime < uni.utils.timestamp()) {
|
||||
if (res.expiretime && res.expiretime < Date.now()) {
|
||||
remove(key)
|
||||
return ''
|
||||
} else {
|
||||
return res
|
||||
}
|
||||
} catch (e) {
|
||||
return ''
|
||||
}
|
||||
return ''
|
||||
} else {
|
||||
// #ifdef APP-PLUS
|
||||
return res.value
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
res = JSON.parse(res)
|
||||
return res.value
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
return res.value
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
return res.value
|
||||
// #endif
|
||||
|
||||
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,19 +47,19 @@ function get(key) {
|
||||
* @return {String} 缓存值
|
||||
*/
|
||||
function getStorageData(key) {
|
||||
try {
|
||||
let res = uni.getStorageSync(key);
|
||||
try {
|
||||
let res = uni.getStorageSync(key);
|
||||
|
||||
if (!res) {
|
||||
return ''
|
||||
}
|
||||
if (!res) {
|
||||
return ''
|
||||
}
|
||||
|
||||
res = JSON.parse(res)
|
||||
res = JSON.parse(res)
|
||||
|
||||
return res.data
|
||||
} catch (e) {
|
||||
return ''
|
||||
}
|
||||
return res.data
|
||||
} catch (e) {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,14 +71,14 @@ function getStorageData(key) {
|
||||
* @return void
|
||||
*/
|
||||
function set(key, value, expire = uni.conf.default_expire) {
|
||||
let cacheItem = {}
|
||||
cacheItem = value
|
||||
let cacheItem = {}
|
||||
cacheItem.value = value
|
||||
// console.log(cacheItem)
|
||||
if (expire > 0) {
|
||||
cacheItem.__expiretime = uni.utils.timestamp() + expire
|
||||
}
|
||||
// uni.setStorageSync(key,JSON.stringify(cacheItem))
|
||||
uni.setStorageSync(key,cacheItem)
|
||||
if (expire > 0) {
|
||||
cacheItem.expiretime = Date.now() + expire * 60 * 1000;
|
||||
}
|
||||
// uni.setStorageSync(key,JSON.stringify(cacheItem))
|
||||
uni.setStorageSync(key, cacheItem)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,14 +90,14 @@ function set(key, value, expire = uni.conf.default_expire) {
|
||||
* @return {Promise} Promise对象
|
||||
*/
|
||||
async function remember(key, callback, expire = uni.conf.default_expire) {
|
||||
let ret = this.get(key)
|
||||
if (ret) {
|
||||
return ret
|
||||
} else {
|
||||
ret = await callback()
|
||||
set(key, ret, expire)
|
||||
return ret
|
||||
}
|
||||
let ret = this.get(key)
|
||||
if (ret) {
|
||||
return ret
|
||||
} else {
|
||||
ret = await callback()
|
||||
set(key, ret, expire)
|
||||
return ret
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +107,7 @@ async function remember(key, callback, expire = uni.conf.default_expire) {
|
||||
* @return {void}
|
||||
*/
|
||||
function remove(key) {
|
||||
uni.removeStorageSync(key)
|
||||
uni.removeStorageSync(key)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,22 +117,22 @@ function remove(key) {
|
||||
* @return void
|
||||
*/
|
||||
function removeList(prefix) {
|
||||
let keys = uni.getStorageInfoSync().keys
|
||||
if (keys && keys.length > 0) {
|
||||
keys.forEach(key => {
|
||||
if (key.indexOf(prefix) === 0) {
|
||||
uni.removeStorageSync(key)
|
||||
}
|
||||
})
|
||||
}
|
||||
let keys = uni.getStorageInfoSync().keys
|
||||
if (keys && keys.length > 0) {
|
||||
keys.forEach(key => {
|
||||
if (key.indexOf(prefix) === 0) {
|
||||
uni.removeStorageSync(key)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function _randomRemove() {
|
||||
const info = uni.getStorageInfoSync()
|
||||
if (info.currentSize > 0.7 * info.limitSize
|
||||
|| info.keys.length > uni.conf.autoRemoveCache.count
|
||||
|| info.currentSize > uni.conf.autoRemoveCache.size) {
|
||||
for (let i = 0; i < 100; i++) {
|
||||
if (info.currentSize > 0.7 * info.limitSize ||
|
||||
info.keys.length > uni.conf.autoRemoveCache.count ||
|
||||
info.currentSize > uni.conf.autoRemoveCache.size) {
|
||||
for (let i = 0; i < 100; i++) {
|
||||
if (info.keys.length < 1) {
|
||||
return
|
||||
}
|
||||
@@ -131,24 +145,24 @@ function _randomRemove() {
|
||||
function _removeExpired(key) {
|
||||
let res = uni.getStorageSync(key);
|
||||
if (!res) {
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
res = JSON.parse(res)
|
||||
if (res.__expiretime && res.__expiretime < uni.utils.timestamp()) {
|
||||
if (res.expiretime && res.expiretime < uni.utils.timestamp()) {
|
||||
remove(key)
|
||||
}
|
||||
}
|
||||
|
||||
function _autoRemoveExpired() {
|
||||
const info = uni.getStorageInfoSync()
|
||||
if (info.currentSize > 0.7 * info.limitSize
|
||||
|| info.keys.length > uni.conf.autoRemoveCache.count
|
||||
|| info.currentSize > uni.conf.autoRemoveCache.size) {
|
||||
if (info.currentSize > 0.7 * info.limitSize ||
|
||||
info.keys.length > uni.conf.autoRemoveCache.count ||
|
||||
info.currentSize > uni.conf.autoRemoveCache.size) {
|
||||
if (info.keys && info.keys.length > 0) {
|
||||
info.keys.forEach(key => {
|
||||
_removeExpired(key)
|
||||
})
|
||||
info.keys.forEach(key => {
|
||||
_removeExpired(key)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +172,7 @@ function autoRemove(is_once = true) {
|
||||
if (info.currentSize > 0.9 * info.limitSize) {
|
||||
clearMemory()
|
||||
}
|
||||
|
||||
|
||||
if (is_once) {
|
||||
_autoRemoveExpired()
|
||||
} else {
|
||||
@@ -169,13 +183,13 @@ function autoRemove(is_once = true) {
|
||||
|
||||
|
||||
function clearFetch(url) {
|
||||
const prefixCacheKey = 'memory:fetch:' + url
|
||||
removeList(prefixCacheKey)
|
||||
const prefixCacheKey = 'memory:fetch:' + url
|
||||
removeList(prefixCacheKey)
|
||||
}
|
||||
|
||||
function clearMemory() {
|
||||
const prefixCacheKey = 'memory:'
|
||||
removeList(prefixCacheKey)
|
||||
const prefixCacheKey = 'memory:'
|
||||
removeList(prefixCacheKey)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,22 +198,22 @@ function clearMemory() {
|
||||
* @return void
|
||||
*/
|
||||
function clear() {
|
||||
uni.clearStorageSync()
|
||||
uni.clearStorageSync()
|
||||
}
|
||||
|
||||
function getInfo() {
|
||||
return uni.getStorageInfoSync()
|
||||
return uni.getStorageInfoSync()
|
||||
}
|
||||
|
||||
uni.cache = {
|
||||
get,
|
||||
getStorageData,
|
||||
set,
|
||||
remove,
|
||||
remember,
|
||||
clearFetch,
|
||||
clearMemory,
|
||||
clear,
|
||||
getInfo,
|
||||
get,
|
||||
getStorageData,
|
||||
set,
|
||||
remove,
|
||||
remember,
|
||||
clearFetch,
|
||||
clearMemory,
|
||||
clear,
|
||||
getInfo,
|
||||
autoRemove,
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="contentbox"
|
||||
:style="'background:url('+(shopExtend?shopExtend.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png')+') no-repeat center center / cover' ">
|
||||
:style="'background:url('+(shopExtend.index_bg?shopExtend.index_bg.value:'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png')+') no-repeat center center / cover' ">
|
||||
<view class="contentboxitem flex-between">
|
||||
<view class="contentboxitemleft flex-colum" @click="scanCodehandle(0)">
|
||||
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xdiancan.png" mode="aspectFill">
|
||||
@@ -10,7 +10,8 @@
|
||||
<text class="contentboxitemlefttexttow">在线点不排队</text>
|
||||
</view>
|
||||
<view class="contentboxitemright">
|
||||
<view class="contentboxitemright_item flex-between" @click="memberindex('user/member/memberdetails')">
|
||||
<view class="contentboxitemright_item flex-between"
|
||||
@click="memberindex('user/member/memberdetails')">
|
||||
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xvip.png" mode="aspectFill">
|
||||
</image>
|
||||
<view class="contentboxitemright_itembox flex-colum">
|
||||
@@ -41,11 +42,14 @@
|
||||
import {
|
||||
productStore
|
||||
} from '@/stores/user.js';
|
||||
const shopExtend = uni.cache.get('shopTable').shopExtendMap.index_bg
|
||||
const shopExtend = uni.cache.get('shopTable').shopExtendMap
|
||||
|
||||
const scanCodehandle = async (i) => {
|
||||
const store = productStore();
|
||||
await store.scanCodeactions()
|
||||
}
|
||||
|
||||
|
||||
const memberindex = (url) => {
|
||||
uni.pro.navigateTo(url, {
|
||||
shopId: uni.cache.get('shopId'),
|
||||
@@ -60,6 +64,8 @@
|
||||
}
|
||||
return null;
|
||||
}
|
||||
onMounted(() => {
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<view class="content">
|
||||
<view class="title">
|
||||
<view class="title_text">请选择就餐人数</view>
|
||||
<view class="title_tabNum">桌号{{tableCode}}</view>
|
||||
<view class="title_tabNum">桌号{{shopTable.name}}</view>
|
||||
</view>
|
||||
<view class="num" :class="{'active':numIndex==-1}">
|
||||
<view class="item" @click="tabCut(index)" v-for="(item,index) in 9" :key="index">
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<view class="shop-item" v-for="(item,index) in props.cartList" :key="item.id">
|
||||
<view class="shop-item-content">
|
||||
<view class="cover" v-if="item.productId!=-999">
|
||||
<up-image :src="item.coverImg" width="120" radius="10" height="120"></up-image>
|
||||
<up-image :src="item.coverImg" width="80" radius="10" height="80"></up-image>
|
||||
</view>
|
||||
<view class="info">
|
||||
<view class="name"> {{ item.name }} </view>
|
||||
|
||||
@@ -52,12 +52,12 @@
|
||||
<view class="panelfiveitemsex flex-between">
|
||||
<view class="panelfiveitemsex_oen">
|
||||
<text class="tips"
|
||||
:class="shopInfo.isVip ==0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text>
|
||||
:class="shopInfo.isVip == 0 || shopInfo.isMemberPrice==0?'lineThrough':''">¥</text>
|
||||
<!-- 会员价与价格 -->
|
||||
<text
|
||||
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.salePrice}}</text>
|
||||
<!-- 原价 -->
|
||||
<text class="originalprice" v-if="item.originPrice">¥{{item.originPrice}}</text>
|
||||
<!-- <text class="originalprice" v-if="item.originPrice">¥{{item.originPrice}}</text> -->
|
||||
<!-- 单位 -->
|
||||
<text class="unit" v-if="item.unitName">/{{item.unitName}}</text>
|
||||
</view>
|
||||
@@ -79,7 +79,7 @@
|
||||
<text
|
||||
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?item.memberPrice:item.salePrice}}</text>
|
||||
<!-- 原价 -->
|
||||
<text class="originalprice" v-if="item.originPrice">¥{{item.originPrice}}</text>
|
||||
<!-- <text class="originalprice" v-if="item.originPrice">¥{{item.originPrice}}</text> -->
|
||||
<!-- 单位 -->
|
||||
<text class="unit" v-if="item.unitName">/{{item.unitName}}</text>
|
||||
</view>
|
||||
@@ -164,12 +164,12 @@
|
||||
<text class="money_num"
|
||||
v-if="shopInfo.isVip ==1 && shopInfo.isMemberPrice==1"
|
||||
style="margin-right: 10rpx;">{{ item1.memberPrice }}</text>
|
||||
<view v-if="shopInfo.isVip ==1 && shopInfo.isMemberPrice==1"
|
||||
<!--<view v-if="shopInfo.isVip ==1 && shopInfo.isMemberPrice==1"
|
||||
:class="{lineThrough: shopInfo.isVip ==1 && shopInfo.isMemberPrice==1}">
|
||||
¥
|
||||
</view>
|
||||
<text class="money_num"
|
||||
:class="{lineThrough: shopInfo.isVip ==1 && shopInfo.isMemberPrice==1}">{{ item1.salePrice }}</text>
|
||||
<text class="money_num"
|
||||
:class="{lineThrough: shopInfo.isVip ==1 && shopInfo.isMemberPrice==1}">{{ item1.salePrice }}</text> -->
|
||||
<text v-if="item1.unitName">/{{item1.unitName}}</text>
|
||||
</view>
|
||||
<view class="flex-end">
|
||||
@@ -185,12 +185,12 @@
|
||||
<text class="money_num"
|
||||
v-if="shopInfo.isVip ==1 && shopInfo.isMemberPrice==1"
|
||||
style="margin-right: 10rpx;">{{ item1.memberPrice }}</text>
|
||||
<view v-if="shopInfo.isVip ==1 && shopInfo.isMemberPrice==1"
|
||||
<!--<view v-if="shopInfo.isVip ==1 && shopInfo.isMemberPrice==1"
|
||||
:class="{lineThrough: shopInfo.isVip ==1 && shopInfo.isMemberPrice==1}">
|
||||
¥
|
||||
</view>
|
||||
<text class="money_num"
|
||||
:class="{lineThrough: shopInfo.isVip ==1 && shopInfo.isMemberPrice==1}">{{ item1.salePrice }}</text>
|
||||
<text class="money_num"
|
||||
:class="{lineThrough: shopInfo.isVip ==1 && shopInfo.isMemberPrice==1}">{{ item1.salePrice }}</text> -->
|
||||
<text v-if="item1.unitName">/{{item1.unitName}}</text>
|
||||
</view>
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
@customevent='websocketsendMessage' @close="showCart = !showCart">
|
||||
</shoppingCartes>
|
||||
|
||||
<!-- 购物车 -->
|
||||
<!-- 显示购物车栏 -->
|
||||
<view class="cart-wrap" v-if="cartLists_count>0">
|
||||
<view class="cart-content">
|
||||
<view class="left">
|
||||
@@ -253,9 +253,7 @@
|
||||
</view>
|
||||
|
||||
<text class="i">¥</text>
|
||||
<!-- <text class="num"
|
||||
v-if="shopInfo.isVip == 1 && cartLists.memberAmount > 0">{{cartLists.memberAmount||'0.00'}}</text>
|
||||
<text class="num" v-else>{{cartLists.amount||'0.00'}}</text> -->
|
||||
<text class="num">{{TotalPrices}}</text>
|
||||
</view>
|
||||
<view class="btn" @tap="$u.debounce(orderdetail, 500)">
|
||||
<text class="t">去结算</text>
|
||||
@@ -436,6 +434,9 @@
|
||||
// 计算高度
|
||||
const navScroll = ref(null)
|
||||
|
||||
// 用餐人数
|
||||
const dinersNum = ref(0)
|
||||
|
||||
// 获取商品数据
|
||||
const shopProductList = reactive({
|
||||
hots: [],
|
||||
@@ -762,7 +763,6 @@
|
||||
}
|
||||
// 判断购物车是否有该选中商品
|
||||
let res = await matchingProduct(item)
|
||||
console.log(res)
|
||||
websocketsendMessage({
|
||||
id: res ? item.cartListId : '',
|
||||
type: 'shopping',
|
||||
@@ -873,10 +873,6 @@
|
||||
showCart.value = false
|
||||
}
|
||||
|
||||
if (Message.type == 'bc') {
|
||||
console.log(Message)
|
||||
}
|
||||
|
||||
// 初始化购物车数据
|
||||
if (Message.operate_type == "shopping_init") {
|
||||
cartList.value = Message.data
|
||||
@@ -888,7 +884,8 @@
|
||||
}
|
||||
|
||||
// 添加或者减少购物后返回
|
||||
if (Message.operate_type == 'shopping_add' || Message.operate_type == 'sopping_edit' || Message.type == 'bc') {
|
||||
if (Message.operate_type == 'shopping_add' || Message.operate_type == 'sopping_edit' || Message
|
||||
.type == 'bc') {
|
||||
[Message.data].forEach((objA) => {
|
||||
const index = cartList.value.findIndex((objB) => objB.id == objA.id);
|
||||
if (index !== -1) {
|
||||
@@ -924,14 +921,25 @@
|
||||
for (const group of shopProductList.productInfo) {
|
||||
for (const product of group.productList) {
|
||||
if (product.id == cartItem.product_id) {
|
||||
console.log(cartItem, product)
|
||||
// 找到匹配的商品,添加 cartListId 属性
|
||||
// 多规格
|
||||
if (product.type == 'sku') {
|
||||
product.skuList.forEach((item) => {
|
||||
if (item.id == product.id && item.productId == product.id) {
|
||||
product.salePrice = item.salePrice
|
||||
product.memberPrice = item.memberPrice
|
||||
product.originPrice = item.originPrice
|
||||
}
|
||||
})
|
||||
}
|
||||
// 单规格
|
||||
return {
|
||||
...product,
|
||||
// cartListinfo:cartItem
|
||||
cartListId: cartItem.id,
|
||||
cartNumberToAdd: product.type == 'weight' ? 1 : cartItem.number //增加一个数量算法
|
||||
// cartNumberToAdd: product.type == 'weight' ? 1 : cartItem.number //增加一个数量算法
|
||||
cartNumberToAdd: cartItem.number //增加一个数量算法
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -944,12 +952,36 @@
|
||||
const cartLists_count = computed(() => {
|
||||
return matchedProducts.value.reduce((sum, item) => {
|
||||
// 将 cartNumberToAdd 转换为数字
|
||||
const num = typeof item.cartNumberToAdd === 'string' ? parseFloat(item.cartNumberToAdd) : item
|
||||
const num = typeof item.cartNumberToAdd === 'string' ? parseFloat(item
|
||||
.cartNumberToAdd) : item
|
||||
.cartNumberToAdd;
|
||||
return sum + num;
|
||||
}, 0);
|
||||
});
|
||||
|
||||
|
||||
// 使用 computed 计算购物车总价格
|
||||
const TotalPrices = computed(() => {
|
||||
// 购物车总数价格
|
||||
let cart = matchedProducts.value.reduce((total, item) => {
|
||||
// 是否启用会员价 0否1是
|
||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
return total + parseFloat(item.memberPrice) * parseFloat(item.cartNumber);
|
||||
} else {
|
||||
// salePrice销售价
|
||||
return total + parseFloat(item.salePrice) * parseFloat(item.salePrice);
|
||||
}
|
||||
}, 0);
|
||||
// 是否免除桌位费 0否1是
|
||||
if (uni.cache.get('shopInfo').isTableFee == 0) {
|
||||
console.log( cart + dinersNum.value * parseFloat(uni.cache.get('shopInfo').tableFee))
|
||||
return cart + parseFloat(dinersNum.value) * parseFloat(uni.cache.get('shopInfo').tableFee)
|
||||
} else {
|
||||
return cart;
|
||||
}
|
||||
});
|
||||
|
||||
// 定义 ifcartNumber 计算属性方法 展示数量
|
||||
const ifcartNumber = computed(() => {
|
||||
return (item) => {
|
||||
@@ -978,7 +1010,6 @@
|
||||
|
||||
// 计算处理后的购物车列表 // 用于筛选后的购物车数组
|
||||
const cartListFilter = computed(() => {
|
||||
console.log(cartList.value)
|
||||
// 使用 reduce 方法对 cartList 进行处理
|
||||
const grouped = cartList.value.reduce((acc, item) => {
|
||||
const productId = item.product_id;
|
||||
@@ -1033,7 +1064,6 @@
|
||||
scrollTopSize.value = 0
|
||||
topArr.value = []
|
||||
userStore.actionsAPIuser()
|
||||
userInfo.value = uni.cache.get('userInfo')
|
||||
// 数据可以更新
|
||||
isDataLoaded.value = true;
|
||||
}
|
||||
@@ -1043,6 +1073,13 @@
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
// 获取当前页面栈
|
||||
const pages = getCurrentPages();
|
||||
// 获取当前页面实例
|
||||
const currentPage = pages[pages.length - 1];
|
||||
// 获取页面参数
|
||||
const options = currentPage.options;
|
||||
dinersNum.value = options.dinersNum
|
||||
await productqueryProduct()
|
||||
setTimeout(() => {
|
||||
getElementTop()
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
<!-- <u-picker :show="calendarShow" ref="uPicker" :columns="columns" @confirm="confirm" @change="changeHandler"></u-picker> -->
|
||||
<!-- <picker :show="calendarShow" mode="date"></picker> -->
|
||||
<up-datetime-picker mode="date" @cancel="calendarShow = false" :show="calendarShow"
|
||||
minDate="-2208988800000" v-model="value1" itemHeight="66" visibleItemCount="5"
|
||||
:minDate="-2208988800000" v-model="value1" itemHeight="66" visibleItemCount="5"
|
||||
@confirm="confirmTime"></up-datetime-picker>
|
||||
<u-icon name="arrow-down-fill" color="#000" size="23"></u-icon>
|
||||
<up-icon name="arrow-down-fill" color="#000" size="10"></up-icon>
|
||||
</view>
|
||||
<view class="reg-cell">
|
||||
<view class="lable">手机号</view>
|
||||
@@ -92,6 +92,10 @@
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
},
|
||||
memberOpen: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
});
|
||||
|
||||
const formInfo = reactive({
|
||||
@@ -107,8 +111,6 @@
|
||||
// 用户图片
|
||||
const userHeadImg = ref('')
|
||||
|
||||
//显示隐藏
|
||||
const memberOpen = ref(false)
|
||||
|
||||
//显示隐藏
|
||||
const isProtocol = ref(false)
|
||||
@@ -286,7 +288,7 @@
|
||||
}
|
||||
|
||||
|
||||
const registerMember = async() => {
|
||||
const registerMember = async () => {
|
||||
// if ( userHeadImg.value == "" || userHeadImg.value == null ) {
|
||||
// uni.showToast({
|
||||
// title: '请选择会员头像',
|
||||
|
||||
@@ -94,7 +94,8 @@
|
||||
</view>
|
||||
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
|
||||
</view>
|
||||
<!-- <registermember :show="memberOpen" :shopId="shopId" @getRegisterMember="getRegisterMember"></registermember> -->
|
||||
<registermember :show="infoForn.shopUserInfo.isVip == 1? false : true" :shopUserInfo="infoForn.shopUserInfo">
|
||||
</registermember>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
@@ -105,7 +106,7 @@
|
||||
reactive,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
// import registermember from './components/registermember.vue'
|
||||
import registermember from './components/registermember.vue'
|
||||
|
||||
import {
|
||||
APIuseractivate,
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<registermember :show="memberOpen" :shopUserInfo="shopUserInfo.shopInfo" @getRegisterMember="getRegisterMember">
|
||||
<registermember :show="shopUserInfo.shopInfo.isVip == 1? false : true" :shopUserInfo="shopUserInfo.shopInfo">
|
||||
</registermember>
|
||||
|
||||
</view>
|
||||
@@ -115,7 +115,7 @@
|
||||
})
|
||||
|
||||
const form = reactive({
|
||||
memberOpen: '',
|
||||
memberOpen: false,
|
||||
shopName: "",
|
||||
amount: '',
|
||||
lucky: {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user