Merge branch 'dev' of https://e.coding.net/g-cphe0354/xiaochengxusaomadiancan/cashier_weapp into wwz_x
This commit is contained in:
commit
f6ac523cd0
|
|
@ -18,6 +18,7 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
|
|||
// #ifdef APP || MP-WEIXIN
|
||||
const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
|
||||
|
||||
// const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
// const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
|
||||
// #endif
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
<view class="left"
|
||||
:style="{ top: `${menuInfo.top + menuInfo.height + paddingBtmSize + tabHeadHeight}px` }">
|
||||
<view class="item" v-for="(item, index) in shopList.productInfo" :key="item.id"
|
||||
:class="{ active: titleTopNumIndex == index }" @click="titleClickHandle(item.id)">
|
||||
:class="{ active: titleTopNumIndex == index }" @click="titleClickHandle(item.id,index)">
|
||||
<text>{{ item.name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -267,6 +267,8 @@
|
|||
showShopInfo: false,
|
||||
showShopsku: false,
|
||||
titleTopNumIndex: 0,
|
||||
titleTopNumIndexFalg: true,
|
||||
timer: null,
|
||||
titleTopNums: [],
|
||||
showCart: false,
|
||||
tableCode: '', //code,
|
||||
|
|
@ -300,6 +302,7 @@
|
|||
backgroundColor: '#000000'
|
||||
});
|
||||
}
|
||||
|
||||
this.countScrollTitle(e.scrollTop);
|
||||
},
|
||||
onLoad(e) {
|
||||
|
|
@ -424,7 +427,7 @@
|
|||
break;
|
||||
case 'addcart':
|
||||
this.cartLists = msg
|
||||
console.log(msg, 1111)
|
||||
// console.log(msg, 1111)
|
||||
this.productqueryProduct() //list 数据
|
||||
try {
|
||||
if (msg.data.length != 0) {
|
||||
|
|
@ -452,7 +455,7 @@
|
|||
}
|
||||
break;
|
||||
}
|
||||
console.log(this.cartLists.data, 1111111)
|
||||
// console.log(this.cartLists.data, 1111111)
|
||||
this.cartListsdatashow = this.cartLists.data.length == 0 ? false : true
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
@ -664,7 +667,9 @@
|
|||
});
|
||||
},
|
||||
// 点击菜单商品滚动到指定为止
|
||||
titleClickHandle(id) {
|
||||
titleClickHandle(id,index) {
|
||||
this.titleTopNumIndexFalg = false;
|
||||
this.titleTopNumIndex = index;
|
||||
uni.createSelectorQuery()
|
||||
.select('#wrapper')
|
||||
.boundingClientRect((data) => {
|
||||
|
|
@ -687,7 +692,8 @@
|
|||
},
|
||||
// 计算滚动到那个标题
|
||||
countScrollTitle: _.throttle(function(top) {
|
||||
if (this.titleTopNums.length > 1) {
|
||||
|
||||
if (this.titleTopNums.length > 1 && this.titleTopNumIndexFalg) {
|
||||
for (let i = 0; i <= this.titleTopNums.length - 1; i++) {
|
||||
if (top >= this.titleTopNums[i] && top < this.titleTopNums[i + 1]) {
|
||||
this.titleTopNumIndex = i;
|
||||
|
|
@ -697,6 +703,13 @@
|
|||
this.titleTopNumIndex = this.titleTopNums.length - 1;
|
||||
}
|
||||
}
|
||||
//这里必须要每次滚动前 清除一次
|
||||
clearTimeout(this.timer)
|
||||
// 如果停留则表示滚动结束 一旦空了1s就判定为滚动结束
|
||||
this.timer = setTimeout(() => {
|
||||
this.titleTopNumIndexFalg = true;
|
||||
// console.log('结束滚动')
|
||||
}, 1000)
|
||||
}, 100),
|
||||
// 统计每个标题到顶部的距离
|
||||
countTitleTopNum() {
|
||||
|
|
@ -705,9 +718,9 @@
|
|||
uni.createSelectorQuery()
|
||||
.select(`#title${i.id}`)
|
||||
.boundingClientRect((res) => {
|
||||
topNums.push(res.top + this.menuInfo.top + this.menuInfo.height + this
|
||||
.paddingBtmSize -
|
||||
this.tabHeadHeight - this.tabHeadHeight / 2);
|
||||
topNums.push(res.top - this.menuInfo.top - this.menuInfo.height - this
|
||||
.paddingBtmSize*8 -
|
||||
this.tabHeadHeight + 40);
|
||||
})
|
||||
.exec();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue