|
|
|
@ -91,10 +91,10 @@ |
|
|
|
</swiper> |
|
|
|
</view> |
|
|
|
<!-- 分类栏:移到goods-list外层,position:sticky才能生效 --> |
|
|
|
<view class="container" :class="{'container-sticky': isContainerSticky}" :style="{'margin-top': isContainerSticky ? '0' : '10px', 'top': isContainerSticky ? navBarHeight + 'px' : 'auto'}" style="display: flex;height: 72%;"> |
|
|
|
<scroll-view scroll-y id="menuList" style="border-right: 1px solid #eee;font-weight: 700;font-size: 14px;height: 100%;width: 160rpx;"> |
|
|
|
<view class="container" style="display: flex;height: 72%;"> |
|
|
|
<scroll-view scroll-y id="menuList" style="border-right: 1px solid #eee;font-weight: 700;font-size: 28rpx;height: 100%;width: 160rpx;"> |
|
|
|
<view class="menu1" @tap="checkTab(index)" v-for="(item,index) in menuList" :key="index" |
|
|
|
:style="{'border-radius':item.checked?'10px':'','color':item.checked?'rgba(0, 35, 28, 1)':'#777','background':item.checked?'#fff':'','border-right':item.checked?'5px solid #48D1CC;':''}"> |
|
|
|
:style="{'border-top-right-radius':item.checked?'20rpx':'','border-bottom-right-radius':item.checked?'20rpx':'','color':item.checked?'rgba(0, 35, 28, 1)':'#777','background':item.checked?'#fff':''}"> |
|
|
|
<view style="width: 160rpx;">{{item.categoryName}}</view> |
|
|
|
</view> |
|
|
|
</scroll-view> |
|
|
|
@ -143,7 +143,6 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<uni-load-more :status="loadStatus" @change="onChange" /> |
|
|
|
<view style="height: 80px;width: 100%;"></view> |
|
|
|
</scroll-view> |
|
|
|
|
|
|
|
</view> |
|
|
|
@ -178,7 +177,7 @@ |
|
|
|
<scroll-view scroll-y style="max-height: 400rpx;"> |
|
|
|
<view class="goods-top" style="padding: 20rpx 0;" v-for="(cartItem, index) in cartItems" |
|
|
|
:key="index"> |
|
|
|
<view class="goods-img" style="width: 120rpx;height: 120rpx;"> |
|
|
|
<view class="goods-img" style="width: 168rpx;height: 168rpx;"> |
|
|
|
<img :src="cartItem.item.productPicture" alt="" |
|
|
|
style="border-radius: 20rpx;width:100%;height:100%;"> |
|
|
|
</view> |
|
|
|
@ -188,8 +187,9 @@ |
|
|
|
</view> |
|
|
|
<view class="goods-content-center"> |
|
|
|
<view class="goods-deal1" v-if="cartItem.specs"> |
|
|
|
<text style="color: #999; font-size: 20rpx;">已选规格: |
|
|
|
{{getSpecDisplayString(cartItem.specs)}}</text> |
|
|
|
<text style="color: #999; font-size: 20rpx;"> |
|
|
|
已选规格:{{getSpecDisplayString(cartItem.specs)}} |
|
|
|
</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="goods-content-bottom" style="margin-top: 10rpx;"> |
|
|
|
@ -287,9 +287,22 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="spec11" v-if="moreBuyList.length > 0 && isPintuan" style="display: flex;"> |
|
|
|
搭配小食 |
|
|
|
<view style="flex: 1;text-align: right;"> |
|
|
|
<uni-number-box v-model="vModelValue" :min="0" @change="changeValue" /> |
|
|
|
<view style="flex: 1;"> |
|
|
|
搭配小食 |
|
|
|
</view> |
|
|
|
<view style="padding-top: 10rpx;"> |
|
|
|
<view class="goods-num"> |
|
|
|
<view class="num-plus" style="background: #999;color: #fff;" |
|
|
|
@tap="changeValue('minus')"> |
|
|
|
- |
|
|
|
</view> |
|
|
|
<view class="num"> |
|
|
|
{{vModelValue}} |
|
|
|
</view> |
|
|
|
<view class="num-plus" @tap="changeValue('plus')"> |
|
|
|
+ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
@ -298,11 +311,14 @@ |
|
|
|
v-for="(spec, sIndex) in moreBuyList" :key="sIndex" |
|
|
|
@tap="selectMoreBuy(spec,sIndex)"> |
|
|
|
<view class="team11"> |
|
|
|
¥{{spec.attributeListPrice | sliceMsg}} ✕ {{spec.quantity ? spec.quantity : ''}} |
|
|
|
¥{{spec.attributeListPrice | sliceMsg}} |
|
|
|
</view> |
|
|
|
<view class="team11"> |
|
|
|
{{spec.productName}} |
|
|
|
</view> |
|
|
|
<view class="jiaobiao" v-if="spec.isChecked && spec.quantity>0"> |
|
|
|
{{spec.quantity ? spec.quantity : ''}} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
@ -400,7 +416,7 @@ |
|
|
|
|
|
|
|
<!-- 支付弹出层 --> |
|
|
|
<uni-popup ref="payPopup" background-color="#fff"> |
|
|
|
<view class="pay-popup" style="height: 960px;background: #fff;border-radius: 40rpx 40rpx 0 0;padding-top: 40rpx;"> |
|
|
|
<view class="pay-popup" style="height: 1920rpx;background: #fff;border-radius: 40rpx 40rpx 0 0;padding-top: 40rpx;"> |
|
|
|
<view class="content"> |
|
|
|
<view class="box1"> |
|
|
|
<view style="height: 70rpx;line-height: 70rpx;text-align: center;"> |
|
|
|
@ -478,7 +494,14 @@ |
|
|
|
loadStatus: 'more', |
|
|
|
type: '', |
|
|
|
shopId: '', |
|
|
|
shopItem: {}, |
|
|
|
shopItem: { |
|
|
|
shopIcon:'', |
|
|
|
shopName:'', |
|
|
|
shopScore:'', |
|
|
|
shopTypeTitle:'', |
|
|
|
saleCount:'', |
|
|
|
remark:'', |
|
|
|
}, |
|
|
|
productId: '', |
|
|
|
productItem: [], |
|
|
|
tuanzhangOrder:{}, |
|
|
|
@ -501,8 +524,6 @@ |
|
|
|
lastScrollTop: 0, |
|
|
|
// 防止切换分类之后onPageScroll闪回的标志 |
|
|
|
isSwitching: false, |
|
|
|
// 吸顶与滚动控制 |
|
|
|
isContainerSticky: false, |
|
|
|
containerOriginalTop: 0, |
|
|
|
scrollIntoViewId: '', |
|
|
|
goodsListScrollTop: 0, |
|
|
|
@ -527,9 +548,10 @@ |
|
|
|
onlineWorkerDuration:500, |
|
|
|
menuList: [{ |
|
|
|
categoryName: '猜你喜欢', |
|
|
|
id: '', |
|
|
|
id: '1', |
|
|
|
checked: true |
|
|
|
}] |
|
|
|
}], |
|
|
|
shopRecommend:[] |
|
|
|
} |
|
|
|
}, |
|
|
|
components: { |
|
|
|
@ -597,6 +619,11 @@ |
|
|
|
} catch(e) { |
|
|
|
this.shopItem = JSON.parse(option.item); |
|
|
|
} |
|
|
|
this.shopRecommend = this.shopItem.products |
|
|
|
for(let i=0;i<this.shopRecommend.length;i++){ |
|
|
|
this.shopRecommend[i].categoryId = '1' |
|
|
|
this.shopRecommend[i].isChecked = false |
|
|
|
} |
|
|
|
} else { |
|
|
|
try { |
|
|
|
this.productItem = JSON.parse(decodeURIComponent(option.item)); |
|
|
|
@ -629,9 +656,7 @@ |
|
|
|
this.lastScrollTop = e.scrollTop; |
|
|
|
// 当页面滚动到container应该触顶的位置时,启用吸顶 |
|
|
|
const stickyThreshold = this.containerOriginalTop - this.navBarHeight; |
|
|
|
if (e.scrollTop >= stickyThreshold && !this.isContainerSticky) { |
|
|
|
this.isContainerSticky = true; |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 页面touchmove事件:吸顶后阻止页面整体滑动(让goods-list接管滚动) |
|
|
|
@ -642,18 +667,13 @@ |
|
|
|
onGoodsListScroll(e) { |
|
|
|
if (this.isAutoScrolling) return; |
|
|
|
const scrollTop = e.detail.scrollTop; |
|
|
|
// 向下滑动到顶部时,取消吸顶 |
|
|
|
if (scrollTop <= 0 && this.isContainerSticky) { |
|
|
|
this.isContainerSticky = false; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 根据滚动位置自动选中对应分类 |
|
|
|
this.detectCurrentCategory(); |
|
|
|
}, |
|
|
|
onGoodsListScrollToTop() { |
|
|
|
if (this.isAutoScrolling) return; |
|
|
|
// 滚到顶部了,取消吸顶 |
|
|
|
this.isContainerSticky = false; |
|
|
|
|
|
|
|
}, |
|
|
|
// 检测当前可见的分类 |
|
|
|
detectCurrentCategory() { |
|
|
|
@ -712,6 +732,7 @@ |
|
|
|
that.loadStatus = 'nomore'; |
|
|
|
if (res.code == 200) { |
|
|
|
that.productItem = res.result.records; |
|
|
|
that.productItem = [...that.shopRecommend, ...that.productItem]; |
|
|
|
for(let i = 0;i<that.productItem.length;i++){ |
|
|
|
if(that.productItem[i].isMoreBuy == 1){ |
|
|
|
//搭配的小料商品 |
|
|
|
@ -767,10 +788,7 @@ |
|
|
|
this.goodsListScrollTop = 0; |
|
|
|
}); |
|
|
|
} else { |
|
|
|
// 确保吸顶状态 |
|
|
|
if (!this.isContainerSticky) { |
|
|
|
this.isContainerSticky = true; |
|
|
|
} |
|
|
|
|
|
|
|
// 通过scroll-into-view滚动到对应分类的第一个商品 |
|
|
|
const targetId = 'category-' + selectedCategory.id; |
|
|
|
// 先清空再设置,确保同一个id也能触发滚动 |
|
|
|
@ -814,7 +832,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
console.error("Failed to parse specifications", e); |
|
|
|
console.log(e); |
|
|
|
} |
|
|
|
} |
|
|
|
this.isPintuan = true; |
|
|
|
@ -915,7 +933,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (e) { |
|
|
|
console.error("Failed to parse specifications", e); |
|
|
|
console.log(e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1026,8 +1044,6 @@ |
|
|
|
groupId: this.groupId, |
|
|
|
isFaceToFace: this.groupId ? this.isFaceToFaceGroup : (isFaceToFace || false) |
|
|
|
}; |
|
|
|
// Directly navigate to checkout |
|
|
|
console.log("111",this.currentItem) |
|
|
|
uni.navigateTo({ |
|
|
|
url: '/package1/buyFood/buyFood?item=' + encodeURIComponent(JSON.stringify(goData)) + |
|
|
|
'&shopItem=' + encodeURIComponent(JSON.stringify(this.shopItem)) + '&packageFee=' + |
|
|
|
@ -1234,11 +1250,16 @@ |
|
|
|
} |
|
|
|
return name; |
|
|
|
}, |
|
|
|
changeValue(value) { |
|
|
|
changeValue(type) { |
|
|
|
if(type == 'plus'){ |
|
|
|
this.vModelValue += 1 |
|
|
|
}else{ |
|
|
|
this.vModelValue = this.vModelValue > 0 ?this.vModelValue -= 1:0 |
|
|
|
} |
|
|
|
let moreBuyPrice = 0 |
|
|
|
for(let i = 0;i<this.moreBuyList.length;i++){ |
|
|
|
if(this.moreBuyList[i].id == this.checkMoreBuyIndex){ |
|
|
|
this.moreBuyList[i].quantity = value |
|
|
|
this.moreBuyList[i].quantity = this.vModelValue |
|
|
|
} |
|
|
|
if(this.moreBuyList[i].quantity > 0){ |
|
|
|
moreBuyPrice += Number((Number(this.moreBuyList[i].quantity) * Number(this.sliceMsg2(this.moreBuyList[i].attributeListPrice))).toFixed(2)) |
|
|
|
@ -1247,7 +1268,7 @@ |
|
|
|
this.selectedGroupRule.groupPriceAndMore = Number(this.selectedGroupRule.groupPrice) + moreBuyPrice |
|
|
|
for(let i = 0;i<this.moreBuyData.length;i++){ |
|
|
|
if(this.moreBuyData[i].id == this.checkMoreBuyIndex){ |
|
|
|
this.moreBuyData[i].quantity = value |
|
|
|
this.moreBuyData[i].quantity = this.vModelValue |
|
|
|
} |
|
|
|
} |
|
|
|
this.$forceUpdate() |
|
|
|
@ -1336,6 +1357,7 @@ |
|
|
|
height: 100%; |
|
|
|
font-size: 24rpx; |
|
|
|
position: relative; |
|
|
|
overflow: hidden; |
|
|
|
} |
|
|
|
|
|
|
|
/* 顶部背景图随页面滚动(不固定) */ |
|
|
|
@ -1568,7 +1590,7 @@ |
|
|
|
left: 0; |
|
|
|
width: 100%; |
|
|
|
z-index: 50; |
|
|
|
height: calc(100vh - 80px); |
|
|
|
height: calc(100vh - 160rpx); |
|
|
|
background: #F5F8F5; |
|
|
|
padding: 0 2.5%; |
|
|
|
box-sizing: border-box; |
|
|
|
@ -1719,7 +1741,8 @@ |
|
|
|
|
|
|
|
.car-content { |
|
|
|
position: relative; |
|
|
|
height: 1200rpx; |
|
|
|
height: auto; |
|
|
|
max-height: 1200rpx; |
|
|
|
width: 100%; |
|
|
|
border-top-left-radius: 20rpx; |
|
|
|
border-top-right-radius: 20rpx; |
|
|
|
@ -1837,9 +1860,10 @@ |
|
|
|
border-radius: 20rpx; |
|
|
|
font-size: 26rpx; |
|
|
|
text-align: center; |
|
|
|
line-height: 60rpx; |
|
|
|
line-height: 40rpx; |
|
|
|
float: left; |
|
|
|
margin-right: 40rpx; |
|
|
|
font-weight: 700; |
|
|
|
} |
|
|
|
|
|
|
|
.team-check { |
|
|
|
@ -1849,9 +1873,10 @@ |
|
|
|
border-radius: 20rpx; |
|
|
|
font-size: 26rpx; |
|
|
|
text-align: center; |
|
|
|
line-height: 60rpx; |
|
|
|
line-height: 40rpx; |
|
|
|
float: left; |
|
|
|
margin-right: 40rpx; |
|
|
|
position: relative; |
|
|
|
} |
|
|
|
.zaixian-swiper{ |
|
|
|
flex: 1; |
|
|
|
@ -1867,8 +1892,8 @@ |
|
|
|
} |
|
|
|
|
|
|
|
.team11 { |
|
|
|
height: 26rpx; |
|
|
|
margin-top: 20rpx; |
|
|
|
height: 35rpx; |
|
|
|
margin-top: 18rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.goods-team { |
|
|
|
@ -1882,7 +1907,19 @@ |
|
|
|
padding: 30rpx 0 30rpx 30rpx; |
|
|
|
flex: 1; |
|
|
|
} |
|
|
|
|
|
|
|
.jiaobiao{ |
|
|
|
position: absolute; |
|
|
|
top: -16rpx; |
|
|
|
right: -12rpx; |
|
|
|
width: 40rpx; |
|
|
|
height: 40rpx; |
|
|
|
border-radius: 40rpx; |
|
|
|
background: red; |
|
|
|
color: #fff; |
|
|
|
text-align: center; |
|
|
|
line-height: 40rpx; |
|
|
|
font-size: 20rpx; |
|
|
|
} |
|
|
|
.list-right-img { |
|
|
|
height: 80rpx; |
|
|
|
display: flex; |
|
|
|
|