点餐页面热销修改
This commit is contained in:
@@ -129,7 +129,7 @@
|
|||||||
:class="shopInfo.isVip == 0 || shopInfo.isMemberPrice == 0 ? 'lineThrough' : ''">¥</text>
|
:class="shopInfo.isVip == 0 || shopInfo.isMemberPrice == 0 ? 'lineThrough' : ''">¥</text>
|
||||||
<!-- 会员价与价格 -->
|
<!-- 会员价与价格 -->
|
||||||
<view class="price">
|
<view class="price">
|
||||||
<GoodsPrice :limitDiscount="limitTimeDiscountRes" :cart="item"
|
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="item"
|
||||||
:shopUserInfo="shopUserInfo" :key="item.id" :shopInfo="shopInfo">
|
:shopUserInfo="shopUserInfo" :key="item.id" :shopInfo="shopInfo">
|
||||||
</GoodsPrice>
|
</GoodsPrice>
|
||||||
</view>
|
</view>
|
||||||
@@ -195,7 +195,7 @@
|
|||||||
<view>{{ item.name }}</view>
|
<view>{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="goods" @click="clickspecifications(item1, index, index1)"
|
<view class="goods" @click="clickspecifications(item1, index, index1)"
|
||||||
v-for="(item1, index1) in item.productList" :key="index1">
|
v-for="(item1, index1) in item.productList" :key="item1.id">
|
||||||
<view class="relative">
|
<view class="relative">
|
||||||
<image class="goodsImg" @click.stop="getImgs(item1)" v-if="item1.coverImg != null"
|
<image class="goodsImg" @click.stop="getImgs(item1)" v-if="item1.coverImg != null"
|
||||||
:lazy-load="true" @load="imageLoaded(item1, index, index1)"
|
:lazy-load="true" @load="imageLoaded(item1, index, index1)"
|
||||||
@@ -238,7 +238,8 @@
|
|||||||
<view class="goods_right" style="overflow: hidden">
|
<view class="goods_right" style="overflow: hidden">
|
||||||
<view class="name">{{ item1.name }}</view>
|
<view class="name">{{ item1.name }}</view>
|
||||||
<!-- <view class="lookBack" v-if="index=='0'">本店销量第{{index1+1}}名</view>-->
|
<!-- <view class="lookBack" v-if="index=='0'">本店销量第{{index1+1}}名</view>-->
|
||||||
<view class="lookBack" v-if="specifications.item.isHot == 1">热销</view>
|
<!-- <view class="lookBack" v-if="specifications.item.isHot == 1">热销</view> -->
|
||||||
|
<view class="lookBack" v-if="returnIsHot(item1,item,index)">热销</view>
|
||||||
<view class="describe">{{ item1.shortTitle ? item1.shortTitle : '' }}</view>
|
<view class="describe">{{ item1.shortTitle ? item1.shortTitle : '' }}</view>
|
||||||
|
|
||||||
<view class="describe" v-if="item1.suitNum > 1 && item1.type != 'sku'"
|
<view class="describe" v-if="item1.suitNum > 1 && item1.type != 'sku'"
|
||||||
@@ -267,7 +268,7 @@
|
|||||||
<view class="money">
|
<view class="money">
|
||||||
<view>¥</view>
|
<view>¥</view>
|
||||||
<view class="money_num">
|
<view class="money_num">
|
||||||
<GoodsPrice :limitDiscount="limitTimeDiscountRes" :cart="item1"
|
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="item1"
|
||||||
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
||||||
</view>
|
</view>
|
||||||
<text class="money_num" v-if="item1.unitName">/{{ item1.unitName }}</text>
|
<text class="money_num" v-if="item1.unitName">/{{ item1.unitName }}</text>
|
||||||
@@ -326,7 +327,7 @@
|
|||||||
<shopindex ref="showShopInfoRef"></shopindex>
|
<shopindex ref="showShopInfoRef"></shopindex>
|
||||||
<!-- 购物车 -->
|
<!-- 购物车 -->
|
||||||
<shoppingCartes :cartLists_count="cartLists_count" :cartList="matchedProducts" :showCart="showCart"
|
<shoppingCartes :cartLists_count="cartLists_count" :cartList="matchedProducts" :showCart="showCart"
|
||||||
:limitDiscount="limitTimeDiscountRes" @customevent="websocketsendMessage" @close="showCart = !showCart"
|
:limitDiscount="cartStore.limitTimeDiscount" @customevent="websocketsendMessage" @close="showCart = !showCart"
|
||||||
:orderinfo="orderinfo" @clickcancelOrder="clickcancelOrder" v-if="cartLists_count > 0"
|
:orderinfo="orderinfo" @clickcancelOrder="clickcancelOrder" v-if="cartLists_count > 0"
|
||||||
:nextFullAmountActivty="nextFullAmountActivty"></shoppingCartes>
|
:nextFullAmountActivty="nextFullAmountActivty"></shoppingCartes>
|
||||||
|
|
||||||
@@ -437,13 +438,15 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
<!-- 占位 -->
|
||||||
|
<view style="height: 42rpx;"></view>
|
||||||
<view class="shop_bottom">
|
<view class="shop_bottom">
|
||||||
<view class="flex-between">
|
<view class="flex-between">
|
||||||
<view class="price price-sku"
|
<view class="price price-sku"
|
||||||
v-if="specifications.item.type != 'package' && specifications.item.result">
|
v-if="specifications.item.type != 'package' && specifications.item.result">
|
||||||
<text class="i">¥</text>
|
<text class="i">¥</text>
|
||||||
<view class="num">
|
<view class="num">
|
||||||
<GoodsPrice :limitDiscount="limitTimeDiscountRes" :cart="specifications.item.result"
|
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="specifications.item.result"
|
||||||
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -462,7 +465,7 @@
|
|||||||
<view class="price price-package" v-else>
|
<view class="price price-package" v-else>
|
||||||
<text class="i">¥</text>
|
<text class="i">¥</text>
|
||||||
<view class="num">
|
<view class="num">
|
||||||
<GoodsPrice :limitDiscount="limitTimeDiscountRes" :cart="specifications.item"
|
<GoodsPrice :limitDiscount="cartStore.limitTimeDiscount" :cart="specifications.item"
|
||||||
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
:shopUserInfo="shopUserInfo" :shopInfo="shopInfo"></GoodsPrice>
|
||||||
</view>
|
</view>
|
||||||
<text class="num" v-if="false">
|
<text class="num" v-if="false">
|
||||||
@@ -1098,7 +1101,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//返回是否是热销商品
|
||||||
|
function returnIsHot(item,category,index){
|
||||||
|
return item.isHot&& category.name=='热销' &&index==0 && shopProductList.hots.find(v=>v.id==item.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1502,9 +1509,9 @@
|
|||||||
const websocketsendMessage = (data) => {
|
const websocketsendMessage = (data) => {
|
||||||
console.log('websocketsendMessage', data);
|
console.log('websocketsendMessage', data);
|
||||||
delete data.memberPrice;
|
delete data.memberPrice;
|
||||||
useSocket.sendMessage(data);
|
uni.$u.debounce(() => {
|
||||||
// uni.$u.debounce(() => {
|
useSocket.sendMessage(data);
|
||||||
// }, 500);
|
}, 200);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 用于记录已经处理过的消息的 msg_id
|
// 用于记录已经处理过的消息的 msg_id
|
||||||
@@ -1601,6 +1608,7 @@
|
|||||||
// 初始化
|
// 初始化
|
||||||
if (Message.operate_type == 'init') {
|
if (Message.operate_type == 'init') {
|
||||||
cartStore.limitTimeDiscount = Message.time_dis_info;
|
cartStore.limitTimeDiscount = Message.time_dis_info;
|
||||||
|
console.log('onMessage:限时折扣',cartStore.limitTimeDiscount)
|
||||||
cartInit(Message.data)
|
cartInit(Message.data)
|
||||||
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
@@ -1621,6 +1629,7 @@
|
|||||||
cancelText: '舍弃',
|
cancelText: '舍弃',
|
||||||
confirmText: '合并',
|
confirmText: '合并',
|
||||||
success(res) {
|
success(res) {
|
||||||
|
showTableInfoPeopleNumPopup.value=false;
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
startUseTable({
|
startUseTable({
|
||||||
is_hb: 2
|
is_hb: 2
|
||||||
@@ -1732,6 +1741,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Message.operate_type == 'time_discount_save') {
|
if (Message.operate_type == 'time_discount_save') {
|
||||||
cartStore.limitTimeDiscount = Message.data;
|
cartStore.limitTimeDiscount = Message.data;
|
||||||
}
|
}
|
||||||
@@ -1881,13 +1891,13 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
console.log('limitTimeDiscountRes',item)
|
console.log('limitTimeDiscountRes',item)
|
||||||
if (limitTimeDiscountRes.value && limitTimeDiscountRes.value.id && item.cartListinfo.is_time_discount ==
|
if (cartStore.limitTimeDiscount && cartStore.limitTimeDiscount.id && item.cartListinfo.is_time_discount ==
|
||||||
1) {
|
1) {
|
||||||
//限时折扣
|
//限时折扣
|
||||||
const price = limitUtils.returnPrice({
|
const price = limitUtils.returnPrice({
|
||||||
goods: item,
|
goods: item,
|
||||||
shopInfo,
|
shopInfo,
|
||||||
limitTimeDiscountRes: limitTimeDiscountRes.value,
|
limitTimeDiscountRes: cartStore.limitTimeDiscount,
|
||||||
shopUserInfo: shopUserInfo.value,
|
shopUserInfo: shopUserInfo.value,
|
||||||
idKey: 'id'
|
idKey: 'id'
|
||||||
});
|
});
|
||||||
@@ -2324,14 +2334,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const limitDiscountCountdown = computed(() => {
|
const limitDiscountCountdown = computed(() => {
|
||||||
if (!limitTimeDiscountRes.value && !limitTimeDiscountRes.value.id) {
|
if (!cartStore.limitTimeDiscount && !cartStore.limitTimeDiscount.id) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (limitTimeDiscountRes.value.useTimeType != 'custom') {
|
if (cartStore.limitTimeDiscount.useTimeType != 'custom') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
//根据当前时间和限时折扣的结束时间计算倒计时,结束时间是hh:mm,将hh:mm转换为时间多少秒,然后再减去当前时间,就得到了倒计时
|
//根据当前时间和限时折扣的结束时间计算倒计时,结束时间是hh:mm,将hh:mm转换为时间多少秒,然后再减去当前时间,就得到了倒计时
|
||||||
const endTime = getEndTimeInSeconds(limitTimeDiscountRes.value.useEndTime);
|
const endTime = getEndTimeInSeconds(cartStore.limitTimeDiscount.useEndTime);
|
||||||
const countdown = endTime - nowTime.value;
|
const countdown = endTime - nowTime.value;
|
||||||
if (countdown <= 0) {
|
if (countdown <= 0) {
|
||||||
return '';
|
return '';
|
||||||
@@ -2482,8 +2492,8 @@
|
|||||||
shopId: uni.cache.get('shopId')
|
shopId: uni.cache.get('shopId')
|
||||||
});
|
});
|
||||||
if (limitRes && typeof limitRes == 'object') {
|
if (limitRes && typeof limitRes == 'object') {
|
||||||
limitTimeDiscountRes.value = limitRes;
|
|
||||||
cartStore.limitTimeDiscount = limitRes;
|
cartStore.limitTimeDiscount = limitRes;
|
||||||
|
console.log('onMounted:限时折扣',cartStore.limitTimeDiscount );
|
||||||
websocketsendMessage({
|
websocketsendMessage({
|
||||||
type: 'shopping',
|
type: 'shopping',
|
||||||
operate_type: 'time_discount_save',
|
operate_type: 'time_discount_save',
|
||||||
@@ -2494,6 +2504,7 @@
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
cartStore.limitTimeDiscount = null;
|
cartStore.limitTimeDiscount = null;
|
||||||
|
console.log('onMounted:限时折扣',cartStore.limitTimeDiscount );
|
||||||
websocketsendMessage({
|
websocketsendMessage({
|
||||||
type: 'shopping',
|
type: 'shopping',
|
||||||
operate_type: 'time_discount_save',
|
operate_type: 'time_discount_save',
|
||||||
|
|||||||
Reference in New Issue
Block a user