This commit is contained in:
魏啾 2024-07-26 11:16:27 +08:00
commit f6ac523cd0
2 changed files with 22 additions and 8 deletions

View File

@ -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

View File

@ -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();
}