去除部分调试打印,优化环境变量控制,修复再来一单只有一个商品时自动弹出图片预览问题,
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
<view class="paneltow">距离您{{ juli }}km</view>
|
||||
<!-- <up-icon name="arrow-right" color="#999999" size="14"></up-icon> -->
|
||||
</view>
|
||||
<view class="new-user-discount u-font-28" v-if="newUserDiscount">
|
||||
<view class="new-user-discount u-font-28" v-if="newUserDiscount&&newUserDiscount.amount">
|
||||
<text class="">新客立减¥</text>
|
||||
<text class="u-font-32">{{ newUserDiscount.amount }}</text>
|
||||
<!-- <text class="u-m-l-60">新客可随机减免金额</text> -->
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
|
||||
<view class="relative">
|
||||
<image @click.stop="getImgs(item)" class="panelfiveitemimage" :src="item.coverImg"
|
||||
<image @click.stop="getProductImgs(item)" class="panelfiveitemimage" :src="item.coverImg"
|
||||
mode="aspectFill"></image>
|
||||
<view class="limitDiscount" v-if="showLimitDiscount(item)">
|
||||
限时折扣{{ limitDiscountCountdown }}</view>
|
||||
@@ -197,8 +197,8 @@
|
||||
<view class="goods" @click="clickspecifications(item1, index, index1)"
|
||||
v-for="(item1, index1) in item.productList" :key="item1.id">
|
||||
<view class="relative">
|
||||
<image class="goodsImg" @click.stop="getImgs(item1)" v-if="item1.coverImg != null"
|
||||
:lazy-load="true" @load="imageLoaded(item1, index, index1)"
|
||||
<image class="goodsImg" @click.stop="getProductImgs(item1)" v-if="item1.coverImg != null"
|
||||
:lazy-load="true"
|
||||
:src="`${item1.coverImg}${!item1.imgLoad ? '?x-oss-process=image/resize,m_lfit,w_150,h_150' : ''}`"
|
||||
mode="aspectFill"></image>
|
||||
<image class="goodsImg"
|
||||
@@ -537,7 +537,7 @@
|
||||
<ModalList></ModalList>
|
||||
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
|
||||
<goodsModal></goodsModal>
|
||||
<xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="showPrveImg = $event">
|
||||
<xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="updateShowPrveImg">
|
||||
</xbSwiperPreview>
|
||||
<!-- 显示选择人数popup -->
|
||||
<u-popup mode="bottom" :safe-area-inset-bottom="false" :show="showTableInfoPeopleNumPopup">
|
||||
@@ -810,10 +810,7 @@
|
||||
productInfo: []
|
||||
});
|
||||
|
||||
// * 图片加载
|
||||
const imageLoaded = (item, index, index1) => {
|
||||
// shopProductList.productInfo[index].products[index1]['imgLoad'] = true;
|
||||
};
|
||||
|
||||
|
||||
// 计算左侧位置
|
||||
const leftIndex = ref(0);
|
||||
@@ -1272,6 +1269,10 @@
|
||||
//预览图
|
||||
const showPrveImg = ref(false);
|
||||
const prveImgsList = ref([]);
|
||||
|
||||
function updateShowPrveImg(e){
|
||||
showPrveImg.value=e
|
||||
}
|
||||
|
||||
function prveImgs(images) {
|
||||
prveImgsList.value = images;
|
||||
@@ -1283,14 +1284,15 @@
|
||||
});
|
||||
}
|
||||
|
||||
async function getImgs(item) {
|
||||
async function getProductImgs(item) {
|
||||
console.log('getProductImgs',item)
|
||||
let res = await APIminiAppinfo(item.id);
|
||||
prveImgs(res.images);
|
||||
}
|
||||
|
||||
//获取多规格数据
|
||||
const clickspecifications = async (item, index, indexs, type) => {
|
||||
console.log(item);
|
||||
console.log('clickspecifications',item);
|
||||
// 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
|
||||
// if (
|
||||
// item.isSoldStock == 1 ||
|
||||
@@ -1584,9 +1586,10 @@
|
||||
|
||||
function cartInit(arr) {
|
||||
const result = []
|
||||
console.log('cartInit arr',arr);
|
||||
console.log('cartInitArr',arr);
|
||||
console.log('allGoodsArr',allGoodsArr);
|
||||
cartStore.carts = arr.map(v => {
|
||||
const goods = matchedProducts.value.find(g => g.id == v.product_id)
|
||||
const goods = allGoodsArr.find(g => g.id == v.product_id)
|
||||
const goodsSkuList = goods?goods.skuList : []
|
||||
const findSku = goodsSkuList.find(sku => sku.id == v.sku_id)
|
||||
const memberPrice = findSku ? findSku.memberPrice : 0
|
||||
@@ -1614,8 +1617,6 @@
|
||||
|
||||
for (let cart of arr) {
|
||||
const findItem = cartStore.carts.find(v => v.id == cart.id)
|
||||
console.log('findItem', findItem)
|
||||
console.log('matchedProducts', matchedProducts.value)
|
||||
if (findItem && findItem.is_time_discount != cart.is_time_discount) {
|
||||
result.push({
|
||||
id: cart.id,
|
||||
@@ -1656,7 +1657,6 @@
|
||||
// 初始化
|
||||
if (Message.operate_type == 'init') {
|
||||
// cartStore.limitTimeDiscount = Message.time_dis_info;
|
||||
console.log('onMessage:限时折扣', cartStore.limitTimeDiscount)
|
||||
cartInit(Message.data)
|
||||
|
||||
uni.hideLoading();
|
||||
@@ -1950,7 +1950,6 @@
|
||||
shopUserInfo: shopUserInfo.value,
|
||||
idKey: 'id'
|
||||
});
|
||||
console.log('限时折扣', price)
|
||||
return total + parseFloat(price) * parseFloat(item.cartNumber);
|
||||
}
|
||||
// 是否启用会员价 0否1是
|
||||
@@ -1973,8 +1972,8 @@
|
||||
const allDiscountMoney = computed(() => {
|
||||
let discountMoney = 0;
|
||||
// 新客立减
|
||||
if (newUserDiscount.value && newUserDiscount.value.discountAmount) {
|
||||
discountMoney += newUserDiscount.value.discountAmount;
|
||||
if (newUserDiscount.value && newUserDiscount.value.amount) {
|
||||
discountMoney += newUserDiscount.value.amount;
|
||||
}
|
||||
// 满减活动
|
||||
if (fullAmountActivty.value && fullAmountActivty.value.discountAmount) {
|
||||
@@ -2085,10 +2084,11 @@
|
||||
}
|
||||
return currentTime >= startTime && currentTime <= endTime;
|
||||
});
|
||||
|
||||
let allGoodsArr=[]
|
||||
// 列表请求
|
||||
const productqueryProduct = async () => {
|
||||
cartStore.goodsIsloading = false;
|
||||
allGoodsArr=[]
|
||||
try {
|
||||
shopProductList.hots = await productminiApphotsquery();
|
||||
shopProductList.productInfo = await APIgroupquery();
|
||||
@@ -2101,7 +2101,6 @@
|
||||
uni.pro.switchTab('index/index');
|
||||
}, 1000);
|
||||
}
|
||||
let allGoodsArr=[]
|
||||
if (shopProductList.productInfo.length > 0 || shopProductList.hots.length > 0) {
|
||||
//TODO handle the exception
|
||||
//第一步:将所有商品的 cartNumber 初始化为 0
|
||||
@@ -2382,7 +2381,7 @@
|
||||
tableCode: uni.cache.get('tableCode')
|
||||
});
|
||||
oldOrder.value = res;
|
||||
if (res && res.id && shopInfo.registerType == 'after') {
|
||||
if (res && res.id && shopInfo.registerType == 'after'&&!e.noJump) {
|
||||
toHistory();
|
||||
return;
|
||||
}
|
||||
@@ -2442,10 +2441,18 @@
|
||||
idKey: 'id'
|
||||
});
|
||||
}
|
||||
|
||||
function watchEmit(){
|
||||
uni.$off('updateProductIndex')
|
||||
uni.$on('updateProductIndex', function(data) {
|
||||
getNewUserDiscount()
|
||||
})
|
||||
}
|
||||
|
||||
onShow(async () => {
|
||||
isAutoClose = true;
|
||||
// 监听页面显示和隐藏
|
||||
watchEmit()
|
||||
useSocket.setOnMessage(onMessage);
|
||||
useSocket.onShowconnect();
|
||||
let res = await APIhistoryOrder({
|
||||
@@ -2489,6 +2496,12 @@
|
||||
});
|
||||
if (res && typeof res == 'object') {
|
||||
newUserDiscount.value = res;
|
||||
cartStore.consumeDiscount=res
|
||||
cartStore.newUserDiscount=res.amount
|
||||
}else{
|
||||
newUserDiscount.value = null;
|
||||
cartStore.consumeDiscount={}
|
||||
cartStore.newUserDiscount=0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user