增加相关商品推荐功能
This commit is contained in:
@@ -160,7 +160,10 @@
|
||||
<!-- <view class="btnClick"
|
||||
@tap.stop="$u.throttle(() => singleclick(item, '-'), 500)"></view> -->
|
||||
</view>
|
||||
<text class="num">{{ ifcartNumber(item) }}</text>
|
||||
<!-- <text class="num">{{ ifcartNumber(item) }}</text> -->
|
||||
|
||||
<text class="dot num"
|
||||
v-if="returnGoodsImCartNum(item1)">{{ returnGoodsImCartNum(item1) < 99 ? returnGoodsImCartNum(item1) : '99+' }}</text>
|
||||
<view class="btn">
|
||||
<up-icon name="plus-circle-fill" color="#E9AB7A" size="25"></up-icon>
|
||||
<!-- <view class="btnClick"
|
||||
@@ -571,7 +574,17 @@
|
||||
<Loading :isLoading="!useSocket.isConnected" />
|
||||
<ModalList></ModalList>
|
||||
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
|
||||
<goodsModal v-model="showGoodsModal" :goods="specifications.item" @prveImgs="prveImgs" @websocketsendMessage="websocketsendMessage"></goodsModal>
|
||||
|
||||
<view
|
||||
v-for="(item,index) in goodsModalList" :key="index"
|
||||
>
|
||||
<goodsModal :key="index" v-model="item.show" :goods="item.goods" @prveImgs="prveImgs" @close="goodsModalClose(index)"
|
||||
@websocketsendMessage="websocketsendMessage"
|
||||
@modalAdd="modalAdd"
|
||||
:GoodsIDInCartNumMap="GoodsIDInCartNumMap"
|
||||
></goodsModal>
|
||||
</view>
|
||||
|
||||
<xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="updateShowPrveImg">
|
||||
</xbSwiperPreview>
|
||||
<!-- 显示选择人数popup -->
|
||||
@@ -849,7 +862,7 @@
|
||||
// 购物车对应的商品数
|
||||
const GoodsIDInCartNumMap = computed(() => {
|
||||
const map = {}
|
||||
for (let cart in cartStore.carts) {
|
||||
for (let cart of cartStore.carts) {
|
||||
if (map[cart.product_id]) {
|
||||
map[cart.product_id] += cart.number * 1
|
||||
} else {
|
||||
@@ -864,7 +877,10 @@
|
||||
* 返回购物车对应的商品数量
|
||||
*/
|
||||
function returnGoodsImCartNum(goods) {
|
||||
if (GoodsIDInCartNumMap.value.hasOwnProperty([goods.id])) {
|
||||
if(!goods){
|
||||
return 0
|
||||
}
|
||||
if (GoodsIDInCartNumMap.value.hasOwnProperty(goods.id)) {
|
||||
GoodsIDInCartNumMap.value[goods.id]
|
||||
}
|
||||
return 0
|
||||
@@ -1356,6 +1372,15 @@
|
||||
let res = await APIminiAppinfo(item.id);
|
||||
prveImgs(res.images);
|
||||
}
|
||||
|
||||
const goodsModalList=ref([])
|
||||
|
||||
function goodsModalClose(index){
|
||||
goodsModalList.value.splice(index,1)
|
||||
}
|
||||
function modalAdd(item){
|
||||
clickspecifications(item)
|
||||
}
|
||||
|
||||
//获取多规格数据
|
||||
const clickspecifications = async (item, index, indexs, type) => {
|
||||
@@ -1372,7 +1397,10 @@
|
||||
// }
|
||||
|
||||
if (item.isSoldStock == 1 || (item.isSaleTime == 0 && !item.isSaleTimeshow)) {
|
||||
return false;
|
||||
return uni.showToast({
|
||||
title:'商品已下架或不在可售时间内',
|
||||
icon:'none'
|
||||
});
|
||||
}
|
||||
|
||||
shopCartNumber.value = 0;
|
||||
@@ -1418,7 +1446,11 @@
|
||||
// 给默认数量
|
||||
specifications.item.amountcartNumber = 0;
|
||||
// showShopsku.value = true;
|
||||
showGoodsModal.value=true
|
||||
goodsModalList.value.push({
|
||||
show:true,
|
||||
goods:specifications.item
|
||||
})
|
||||
// showGoodsModal.value=true
|
||||
};
|
||||
// 判断商品是否在可售时间内
|
||||
const isProductAvailable = async (sellDaysStr, startTimeStr, endTimeStr) => {
|
||||
|
||||
Reference in New Issue
Block a user