|
|
@ -1,6 +1,15 @@ |
|
|
|
<template> |
|
|
|
<view class="bg" id="bg" v-if="info"> |
|
|
|
<view class="swipe-box"> |
|
|
|
<view class="scroll-all-box" id="menus"> |
|
|
|
<view :class="'scroll-menus fixed-menus'"> |
|
|
|
<view :class="'scroll-menu-item' + (type == 1 ? ' active' : '')" @click="changeMenu(1)">基本信息</view> |
|
|
|
<view :class="'scroll-menu-item' + (type == 2 ? ' active' : '')" @click="changeMenu(2)">产品详情</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
<view style="height: 88rpx"></view> |
|
|
|
|
|
|
|
<view class="swipe-box info-box-query" id="box1"> |
|
|
|
<swiper class="swiper" :autoplay="true" :interval="3000" :duration="1000" |
|
|
|
@change="swiperChange" circular> |
|
|
|
<swiper-item v-for="(item, index) in info.listimg" :key="item.id"> |
|
|
@ -15,7 +24,7 @@ |
|
|
|
</view> --> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="w-full relative"> |
|
|
|
<view class="w-full relative " > |
|
|
|
<view class="price-box "> |
|
|
|
<view class="flex flex-between" style="font-weight: 500;font-size: 24rpx;color: #666666;"> |
|
|
|
<view > |
|
|
@ -34,7 +43,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="price-box" style="margin-top: 20rpx;"> |
|
|
|
<view class="price-box info-box-query" id="box2" style="margin-top: 20rpx;"> |
|
|
|
<view class="pro-title">产品详情</view> |
|
|
|
<view class="notice" > |
|
|
|
<view class="rich-text" v-html="formateRichText(info.content)"></view> |
|
|
@ -131,6 +140,10 @@ |
|
|
|
components: {cartDataVue}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
down: false, |
|
|
|
type: 1, |
|
|
|
fixed: false, |
|
|
|
|
|
|
|
swiperCurrent: 0, |
|
|
|
|
|
|
|
id: null, |
|
|
@ -146,6 +159,23 @@ |
|
|
|
|
|
|
|
}; |
|
|
|
}, |
|
|
|
onPageScroll(e){ |
|
|
|
let query = uni.createSelectorQuery() |
|
|
|
|
|
|
|
if (this.down) { |
|
|
|
return |
|
|
|
}else{ |
|
|
|
this.down = true |
|
|
|
query.selectAll(".info-box-query").boundingClientRect(res=>{ |
|
|
|
let i = res.findLastIndex(v=>v.top-100<=0) |
|
|
|
console.log(res, i) |
|
|
|
if (i>=0) { |
|
|
|
this.type = i+1 |
|
|
|
} |
|
|
|
}).exec() |
|
|
|
this.down = false |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
this.id = option.id; |
|
|
|
this.getInfo(); |
|
|
@ -255,6 +285,30 @@ |
|
|
|
swiperChange (e) { |
|
|
|
this.swiperCurrent = e.detail.current |
|
|
|
}, |
|
|
|
changeMenu(e) { |
|
|
|
this.down = true |
|
|
|
let index = e; |
|
|
|
let that = this |
|
|
|
const query = uni.createSelectorQuery(); //创建节点查询器 |
|
|
|
query.select('#box'+index).boundingClientRect(); //选择toViewid获取位置信息 |
|
|
|
query.selectViewport().scrollOffset(); //获取页面查询位置的 |
|
|
|
query.exec(function (res) { |
|
|
|
console.log(res) |
|
|
|
let scrollTop = res[0].top + res[1].scrollTop; |
|
|
|
uni.pageScrollTo({ |
|
|
|
scrollTop: scrollTop-50, |
|
|
|
duration: 200, |
|
|
|
fail: (e)=>{ |
|
|
|
console.log(e) |
|
|
|
}, |
|
|
|
complete: ()=>{ |
|
|
|
that.type = index |
|
|
|
setTimeout(()=>{that.down = false},1000) |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
onReachBottom() { |
|
|
|
|
|
|
@ -722,7 +776,7 @@ |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
position: fixed; |
|
|
|
bottom: 140rpx; |
|
|
|
bottom: 200rpx; |
|
|
|
right: 20rpx; |
|
|
|
z-index: 10; |
|
|
|
image{ |
|
|
@ -730,5 +784,51 @@ |
|
|
|
height: 42rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.scroll-all-box { |
|
|
|
background-color: #fff; |
|
|
|
.scroll-menus { |
|
|
|
padding: 0 40rpx; |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
align-items: center; |
|
|
|
font-size: 29rpx; |
|
|
|
color: #333; |
|
|
|
height: 84rpx; |
|
|
|
padding-bottom: 12rpx; |
|
|
|
|
|
|
|
.scroll-menu-item { |
|
|
|
position: relative; |
|
|
|
line-height: 84rpx; |
|
|
|
flex: 1; |
|
|
|
flex-shrink: 0; |
|
|
|
text-align: center; |
|
|
|
font-weight: bold; |
|
|
|
font-size: 31rpx; |
|
|
|
color: #010101; |
|
|
|
} |
|
|
|
|
|
|
|
.scroll-menu-item.active::after { |
|
|
|
content: '1'; |
|
|
|
font-size: 0; |
|
|
|
display: block; |
|
|
|
position: absolute; |
|
|
|
width: 73rpx; |
|
|
|
height: 6rpx; |
|
|
|
border-radius: 3rpx; |
|
|
|
background: #6A8A27; |
|
|
|
left: 50%; |
|
|
|
margin-left: -37rpx; |
|
|
|
bottom: 0rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.fixed-menus { |
|
|
|
position: fixed; |
|
|
|
top: 0; |
|
|
|
left: 0; |
|
|
|
right: 0; |
|
|
|
background: white; |
|
|
|
z-index: 1; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |