|
@@ -27,7 +27,7 @@
|
|
|
<view class="name">{{item.classificationName}}</view>
|
|
|
</view>
|
|
|
<view class="section-main">
|
|
|
- <view class="product-list" v-for="(pros, prosIndex) in item.productList" :key="prosIndex" @click.stop="detailPage(pros.productID)">
|
|
|
+ <view class="product-list" v-for="(pros, prosIndex) in item.productList" :key="prosIndex" @click.stop="detailPage(pros)">
|
|
|
<view class="list-rebate">{{pros.activityDiscount}}<text class="small">折</text></view>
|
|
|
<view class="list-image">
|
|
|
<image :src="pros.mainImage" mode=""></image>
|
|
@@ -96,7 +96,10 @@
|
|
|
},
|
|
|
dataList:[],
|
|
|
scrollTopArray:[],
|
|
|
- scrollTopIndex:0
|
|
|
+ scrollTopIndex:0,
|
|
|
+ hanldeProductID:0,
|
|
|
+ hanldeProductName:'',
|
|
|
+ hanldeProductPrice:'',
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
@@ -120,7 +123,6 @@
|
|
|
let productList = item.productList
|
|
|
let newProductList = []
|
|
|
this.scrollTopArray.push(index);
|
|
|
- console.log(this.scrollTopArray)
|
|
|
// 处理商品价格
|
|
|
productList.forEach(el=>{
|
|
|
let value = el.retailPrice
|
|
@@ -155,14 +157,17 @@
|
|
|
uni.createSelectorQuery().select('.topBanner').boundingClientRect((data)=>{//最外层盒子节点
|
|
|
uni.createSelectorQuery().select(classIndex).boundingClientRect((res)=>{//最外层盒子节点
|
|
|
uni.pageScrollTo({
|
|
|
- duration:200,//过渡时间必须为0,uniapp bug,否则运行到手机会报错
|
|
|
- scrollTop:res.top - data.top - 60,//滚动到实际距离是元素距离顶部的距离减去最外层盒子的滚动距离
|
|
|
+ duration:300,//过渡时间必须为0,uniapp bug,否则运行到手机会报错
|
|
|
+ scrollTop:res.top - data.top - 50,//滚动到实际距离是元素距离顶部的距离减去最外层盒子的滚动距离
|
|
|
})
|
|
|
}).exec()
|
|
|
}).exec()
|
|
|
},
|
|
|
- detailPage(id) {//跳转商品详情页
|
|
|
- this.$api.navigateTo(`/pages/goods/product?id=${id}&path=activity`)
|
|
|
+ detailPage(item) {//跳转商品详情页
|
|
|
+ this.hanldeProductID = item.productID
|
|
|
+ this.hanldeProductName= item.name
|
|
|
+ this.hanldeProductPrice= item.retailPrice
|
|
|
+ this.$api.navigateTo(`/pages/goods/product?id=${item.productID}&path=activity`)
|
|
|
},
|
|
|
navigator(){
|
|
|
authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
|
|
@@ -192,40 +197,21 @@
|
|
|
duration: 600
|
|
|
});
|
|
|
},
|
|
|
- createSelectorQuery(e){
|
|
|
+ createSelectorQuery(event){
|
|
|
let self = this
|
|
|
let indexLength = this.scrollTopArray.length
|
|
|
- let index = this.scrollTopArray[0]
|
|
|
- let index1 = this.scrollTopArray[1]
|
|
|
- let index2 = this.scrollTopArray[2]
|
|
|
- let index3 = this.scrollTopArray[3]
|
|
|
- let index4 = this.scrollTopArray[4]
|
|
|
- let index5 = this.scrollTopArray[5]
|
|
|
+ let index = this.scrollTopArray[2]
|
|
|
let classIndex = '.activity-section-'+index;
|
|
|
- let classIndex1 = '.activity-section-'+index1;
|
|
|
- let classIndex2 = '.activity-section-'+index2;
|
|
|
- let classIndex3 = '.activity-section-'+index3;
|
|
|
- let classIndex4 = '.activity-section-'+index4;
|
|
|
- let classIndex5 = '.activity-section-'+index5;
|
|
|
- // this.scrollTopArray.forEach(el=>{
|
|
|
-
|
|
|
- // })
|
|
|
- // console.log('滚动条=======>',classIndex)
|
|
|
- this.onCreateSelectorQuery(index,classIndex)
|
|
|
- this.onCreateSelectorQuery(index1,classIndex1)
|
|
|
- this.onCreateSelectorQuery(index2,classIndex2)
|
|
|
- this.onCreateSelectorQuery(index3,classIndex3)
|
|
|
- this.onCreateSelectorQuery(index4,classIndex4)
|
|
|
- this.onCreateSelectorQuery(index5,classIndex5)
|
|
|
+ this.onCreateSelectorQuery(event,index,classIndex)
|
|
|
},
|
|
|
- onCreateSelectorQuery(index,classIndex){
|
|
|
+ onCreateSelectorQuery(event,index,classIndex){
|
|
|
let self = this
|
|
|
uni.createSelectorQuery().select(classIndex).boundingClientRect((res)=>{//最外层盒子节点4
|
|
|
- console.log(res)
|
|
|
+ console.log('滚动条的高度==========>',event.scrollTop)
|
|
|
+ console.log('元素节点距离顶部的高度==========>', res.top)
|
|
|
if(res.dataset.index == index){
|
|
|
- if( res.top ){
|
|
|
+ if( event.scrollTop == res.top ){
|
|
|
self.headTab.TabCur = index;
|
|
|
- console.log('选项卡索引',self.headTab.TabCur)
|
|
|
self.headTab.scrollLeft = (index - 1) * 60;
|
|
|
}
|
|
|
}
|
|
@@ -255,8 +241,7 @@
|
|
|
this.showTop = false
|
|
|
}
|
|
|
//锚点切换
|
|
|
- // this.scrollTopIndex++
|
|
|
- this.createSelectorQuery(e)
|
|
|
+ // this.createSelectorQuery(e)
|
|
|
},
|
|
|
onPullDownRefresh() {//下拉刷新
|
|
|
uni.stopPullDownRefresh()
|