增加网络波动加载中,增加会员信息扫码充值
This commit is contained in:
@@ -12,10 +12,13 @@
|
||||
<view class="item" @click="tabCut(index)" v-for="(item,index) in 9" :key="index">
|
||||
<view class="num_item" :class="{'active':numIndex==index }">{{index+1}}</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<up--input class="num_item" v-model="otherNum" :class="{'active':numIndex==-1 }"
|
||||
@input="isOtherNum" @focus="tabCut(-1)" @blur="blur()" border="none" type="nubmer"
|
||||
maxlength="3" placeholder='请输入..'></up--input>
|
||||
<view class="item" @click="tabCut(-1)">
|
||||
<view class="num_item" :style="numIndex==-1?'background-color: #E8AD7B;':'' ">
|
||||
<up--input v-model="otherNum" @input="isOtherNum" @blur="blur()"
|
||||
border="none" type="nubmer" maxlength="3" placeholder='请输入..'></up--input>
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<!-- <view class="num_item" v-else :class="{'active':numIndex==-1 }">其</view> -->
|
||||
</view>
|
||||
@@ -66,6 +69,7 @@
|
||||
|
||||
// 切换桌型
|
||||
const tabCut = (index) => {
|
||||
console.log(index)
|
||||
numIndex.value = index;
|
||||
if (index != -1) {
|
||||
dinersNum.value = index + 1;
|
||||
@@ -112,7 +116,6 @@
|
||||
const options = currentPage.options;
|
||||
// #ifdef MP-WEIXIN
|
||||
if (options.q) {
|
||||
console.log(options.q)
|
||||
const store = productStore();
|
||||
await store.scanCodeactions(options.q)
|
||||
}
|
||||
@@ -219,7 +222,7 @@
|
||||
font-size: 28rpx !important;
|
||||
color: #333333 !important;
|
||||
text-align: center !important;
|
||||
background-color: #FEF4EB !important;
|
||||
background-color: #FEF4EB;
|
||||
}
|
||||
|
||||
.active {
|
||||
|
||||
@@ -305,13 +305,13 @@
|
||||
shop_id: uni.cache.get('shopId'),
|
||||
operate_type: 'cleanup',
|
||||
})
|
||||
uni.pro.redirectTo('order/detail', {
|
||||
orderId: res.id,
|
||||
shopId: uni.cache.get('shopId')
|
||||
})
|
||||
// uni.redirectTo({
|
||||
// url: '/pages/index/index?orderId=' + res.id + '&shopId=' + uni.cache.get('shopId')
|
||||
// uni.pro.redirectTo('order/detail', {
|
||||
// orderId: res.id,
|
||||
// shopId: uni.cache.get('shopId')
|
||||
// })
|
||||
uni.reLaunch({
|
||||
url: '/pages/order/detail?orderId=' + res.id + '&shopId=' + uni.cache.get('shopId')
|
||||
})
|
||||
// uni.pro.navigateTo('order/detail', {
|
||||
// orderId: res.id,
|
||||
// shopId: uni.cache.get('shopId')
|
||||
|
||||
@@ -37,8 +37,15 @@
|
||||
<view class="price">
|
||||
<text class="i">¥</text>
|
||||
<!-- 会员价与价格 -->
|
||||
<text
|
||||
class="price">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice || item.salePrice):item.salePrice}}</text>
|
||||
<text class="price" v-if="item.type == 'sku'">
|
||||
<text v-for="i in item.skuList" :key="i.id">
|
||||
<!-- -->
|
||||
{{item.cartListinfo.sku_id == i.id?(shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(i.memberPrice || i.salePrice):i.salePrice):''}}
|
||||
</text>
|
||||
</text>
|
||||
<text class="price" v-else>
|
||||
{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1?(item.memberPrice || item.salePrice):item.salePrice}}
|
||||
</text>
|
||||
<!-- <text class="originalprice"
|
||||
v-if="item.originPrice">¥{{item.originPrice}}</text>
|
||||
<text class="unit" v-if="item.unitName">/{{item.unitName}}</text> -->
|
||||
@@ -102,7 +109,6 @@
|
||||
type: Boolean
|
||||
},
|
||||
});
|
||||
|
||||
const shopInfo = uni.cache.get('shopInfo')
|
||||
|
||||
// 定义 ifcartNumber 计算属性方法
|
||||
|
||||
@@ -10,12 +10,14 @@
|
||||
<view class="panelone">
|
||||
{{ shopInfo.shopName }}
|
||||
</view>
|
||||
<view class="paneltow">
|
||||
<view class="paneltow" v-if="distance">
|
||||
距离您{{ distance }}
|
||||
</view>
|
||||
<view class="panelthere flex-between">
|
||||
<view class="paneltheretext">
|
||||
营业时间:{{ (shopInfo.businessStartDay || '--') +' 至 '+ (shopInfo.businessEndDay || '--') +' '+ (shopInfo.businessTime || '')}}
|
||||
营业时间:{{ (shopInfo.businessStartDay || '--') +' 至 '+ (shopInfo.businessEndDay || '--')}}
|
||||
{{endTimeref.startTime}} -
|
||||
{{endTimeref.endTime < '05'?` 凌晨${endTimeref.endTime}`:endTimeref.endTime}}
|
||||
</view>
|
||||
<view class="flex-start" @click="callChildMethod">
|
||||
<view style="margin-right: 14rpx;">查看</view>
|
||||
@@ -103,8 +105,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<text class="num"> {{ ifcartNumber(item) }} </text>
|
||||
<text class="dot num"
|
||||
v-if="item.suitNum>1">{{item.suitNum<99?item.suitNum:'99+'}}</text>
|
||||
<!-- <text class="dot num"
|
||||
v-if="item.suitNum>1">{{item.suitNum<99?item.suitNum:'99+'}}</text> -->
|
||||
<view class="btn">
|
||||
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
||||
<view class="btnClick"
|
||||
@@ -304,7 +306,8 @@
|
||||
:key="goodsid" @click="goodsidClick(setmenuindex, option, goodsid)"
|
||||
:class="{ shop_sku_box_item_selected: isOptionSelected(setmenuindex, option)}"
|
||||
:disabled="isMaxSelected(setmenuindex) &&!isOptionSelected(setmenuindex, option)">
|
||||
{{option.proName}}/{{option.unitName}}
|
||||
{{option.proName}}
|
||||
<text v-if="option.unitName">/{{option.unitName}}</text>
|
||||
<view class="shop_sku_box_item_tip" v-if="specifications.item.isPauseSale == 1">
|
||||
<view>售罄</view>
|
||||
</view>
|
||||
@@ -316,12 +319,21 @@
|
||||
</scroll-view>
|
||||
<view class="shop_bottom">
|
||||
<view class="flex-between">
|
||||
<view class="price">
|
||||
|
||||
<view class="price" v-if="specifications.item.type != 'package' && specifications.item.result">
|
||||
<text class="i">¥</text>
|
||||
<text
|
||||
class="num">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? (specifications.item.result.memberPrice||specifications.item.result.salePrice):specifications.item.result.salePrice}}</text>
|
||||
<text class="i" v-if="specifications.item.unitName">/{{specifications.item.unitName}}</text>
|
||||
</view>
|
||||
<view class="price" v-else>
|
||||
<text class="i">¥</text>
|
||||
<text
|
||||
class="num">{{shopInfo.isVip ==1 && shopInfo.isMemberPrice==1? (specifications.item.memberPrice||specifications.item.salePrice):specifications.item.salePrice}}</text>
|
||||
<text class="i">/{{specifications.item.unitName}}</text>
|
||||
<text class="i" v-if="specifications.item.unitName">/{{specifications.item.unitName}}</text>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="operation-wrap">
|
||||
<view class="btn">
|
||||
<up-icon name="minus-circle-fill" color="#E9AB7A" size="25"
|
||||
@@ -351,6 +363,8 @@
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
|
||||
<Loading :isLoading="isLoading" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -378,6 +392,7 @@
|
||||
import shopindex from './components/shopindex.vue'
|
||||
import shoppingCartes from './components/shoppingCartes.vue'
|
||||
import confirmorder from './components/confirmorder.vue'
|
||||
import Loading from '@/components/Loading.vue';
|
||||
// 获取全局属性
|
||||
const {
|
||||
proxy
|
||||
@@ -441,6 +456,9 @@
|
||||
//店铺详情
|
||||
const showShopInfoRef = ref(null)
|
||||
|
||||
// 初始加载中
|
||||
const isLoading = ref(true);
|
||||
|
||||
//调用shop组件
|
||||
const callChildMethod = () => {
|
||||
if (showShopInfoRef.value) {
|
||||
@@ -639,13 +657,13 @@
|
||||
specInfo: selectedSpecsStr.value,
|
||||
id: specifications.item.id
|
||||
});
|
||||
console.log(result)
|
||||
// console.log(result)
|
||||
if (result != true) {
|
||||
specifications.sku_id = result.id
|
||||
specifications.product_id = result.productId
|
||||
// 添加多规格分组
|
||||
specifications.item.result = result
|
||||
console.log(specifications.item)
|
||||
// console.log(specifications.item)
|
||||
if (result.isPauseSale == 0) {
|
||||
canSubmit.value = true;
|
||||
} else {
|
||||
@@ -811,8 +829,10 @@
|
||||
// 直接返回布尔值
|
||||
return result;
|
||||
} else if (specifications.item.type == 'sku') {
|
||||
// console.log(product,data, 'product,data')
|
||||
// 多规格
|
||||
return product.skuId == data.id && product.id == data.productId
|
||||
return product.cartListinfo.sku_id == data.id && product.cartListinfo.product_id == data
|
||||
.productId
|
||||
} else {
|
||||
// 其他
|
||||
return product.skuId == data.skuId && product.id == data.id
|
||||
@@ -845,6 +865,7 @@
|
||||
}
|
||||
res = await matchingProduct(specifications.item.result)
|
||||
}
|
||||
console.log(res, 'res')
|
||||
if (res) {
|
||||
await calculateValue(res.cartNumber, '+', shopCartNumber.value)
|
||||
}
|
||||
@@ -852,6 +873,7 @@
|
||||
if (specifications.item.type != "package") {
|
||||
selectedGroupSnap.value = []
|
||||
}
|
||||
|
||||
websocketsendMessage({
|
||||
id: res ? res.cartListId : '',
|
||||
type: 'shopping',
|
||||
@@ -1000,7 +1022,7 @@
|
||||
product.cartNumber = cartItem.number
|
||||
product.cartListId = cartItem.id
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
// 遍历购物车数组
|
||||
@@ -1044,6 +1066,9 @@
|
||||
// 初始化
|
||||
if (Message.operate_type == "init") {
|
||||
cartList.value = Message.data
|
||||
setTimeout(()=>{
|
||||
isLoading.value = false;
|
||||
},1000)
|
||||
}
|
||||
|
||||
// 清空购物车
|
||||
@@ -1160,6 +1185,14 @@
|
||||
if (matchedProducts.value.length > 0) {
|
||||
// 购物车总数价格
|
||||
let cart = matchedProducts.value.reduce((total, item) => {
|
||||
if (item.type == 'sku') {
|
||||
item.skuList.forEach((i, t) => {
|
||||
if (item.cartListinfo.sku_id == i.id) {
|
||||
item.memberPrice = i.memberPrice
|
||||
item.salePrice = i.salePrice
|
||||
}
|
||||
})
|
||||
}
|
||||
// 是否启用会员价 0否1是
|
||||
if (shopInfo.isVip == 1 && shopInfo.isMemberPrice == 1) {
|
||||
// memberPrice会员价
|
||||
@@ -1170,7 +1203,6 @@
|
||||
return total + parseFloat(item.salePrice || 0) * parseFloat(item.cartNumber);
|
||||
}
|
||||
}, 0);
|
||||
// 向上取整并保留两位小数
|
||||
return parseFloat(cart.toFixed(2));
|
||||
} else {
|
||||
return 0
|
||||
@@ -1279,6 +1311,11 @@
|
||||
// return isInDayRange && isInTimeRange;
|
||||
// });
|
||||
|
||||
const endTimeref = reactive({
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
})
|
||||
|
||||
// 获取当前时间
|
||||
const getCurrentTime = () => {
|
||||
const now = new Date();
|
||||
@@ -1294,6 +1331,12 @@
|
||||
}
|
||||
const currentTime = getCurrentTime();
|
||||
const [startTime, endTime] = shopInfo.businessTime.split('-');
|
||||
endTimeref.startTime = startTime
|
||||
endTimeref.endTime = endTime
|
||||
// 如果开始时间大于结束时间,说明是跨天的营业时间
|
||||
if (startTime > endTime) {
|
||||
return currentTime >= startTime || currentTime <= endTime;
|
||||
}
|
||||
return currentTime >= startTime && currentTime <= endTime;
|
||||
});
|
||||
|
||||
@@ -1303,7 +1346,15 @@
|
||||
try {
|
||||
shopProductList.hots = await productminiApphotsquery()
|
||||
shopProductList.productInfo = await APIgroupquery()
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
uni.showToast({
|
||||
title: '网络不稳定,请重新扫码进入',
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.pro.switchTab('index/index')
|
||||
}, 1000)
|
||||
}
|
||||
if (shopProductList.productInfo.length > 0 || shopProductList.hots.length > 0) {
|
||||
//TODO handle the exception
|
||||
//第一步:将所有商品的 cartNumber 初始化为 0
|
||||
|
||||
Reference in New Issue
Block a user