wangfukang 1 month ago
parent
commit
a0cbb32ed0
  1. 46
      package1/group/groupBuySingle.vue

46
package1/group/groupBuySingle.vue

@ -630,7 +630,7 @@
const sysInfo = uni.getSystemInfoSync(); const sysInfo = uni.getSystemInfoSync();
const bottomBarPx = Math.round(80 * sysInfo.windowWidth / 375); const bottomBarPx = Math.round(80 * sysInfo.windowWidth / 375);
const h = sysInfo.windowHeight - this.navBarHeight - bottomBarPx; const h = sysInfo.windowHeight - this.navBarHeight - bottomBarPx;
return 'display:flex;position:fixed;left:0;top:' + this.navBarHeight + 'px;width:100%;height:' + h + 'px;z-index:50;background:#F5F8F5;padding:0 2.5%;box-sizing:border-box;'; return 'display:flex;position:fixed;left:0;top:' + this.navBarHeight + 'px;width:95%;margin:0 auto;right:0;height:' + h + 'px;z-index:50;background:#F5F8F5;box-sizing:border-box;';
} else { } else {
return 'display:flex;height:72%;margin-top:20rpx;'; return 'display:flex;height:72%;margin-top:20rpx;';
} }
@ -731,10 +731,18 @@
this.lastScrollTop = e.scrollTop; this.lastScrollTop = e.scrollTop;
// container // container
const stickyThreshold = this.containerOriginalTop - this.navBarHeight; const stickyThreshold = this.containerOriginalTop - this.navBarHeight;
if (e.scrollTop >= stickyThreshold && stickyThreshold > 0) { if (stickyThreshold <= 0) return;
if (e.scrollTop >= stickyThreshold) {
if (!this.isContainerSticky) { if (!this.isContainerSticky) {
this.isContainerSticky = true; this.isContainerSticky = true;
} }
//
if (e.scrollTop > stickyThreshold + 5) {
uni.pageScrollTo({
scrollTop: stickyThreshold,
duration: 0
});
}
} else { } else {
if (this.isContainerSticky) { if (this.isContainerSticky) {
this.isContainerSticky = false; this.isContainerSticky = false;
@ -887,32 +895,46 @@
} }
const selectedCategory = this.menuList[index]; const selectedCategory = this.menuList[index];
// ""id // ""idtuijian
if (!selectedCategory.id && selectedCategory.id !== 0) { if (!selectedCategory.id && selectedCategory.id !== 0) {
this.goodsListScrollTop = 0; this.goodsListScrollTop = 0;
this.$nextTick(() => { this.$nextTick(() => {
this.goodsListScrollTop = 0; this.goodsListScrollTop = 0;
}); });
} else { setTimeout(() => { this.isSwitching = false; }, 300);
this.$forceUpdate();
// scroll-into-view return;
}
//
const doScrollToCategory = () => {
const targetId = 'category-' + selectedCategory.id; const targetId = 'category-' + selectedCategory.id;
// id
this.scrollIntoViewId = ''; this.scrollIntoViewId = '';
this.$nextTick(() => { this.$nextTick(() => {
this.isAutoScrolling = true; this.isAutoScrolling = true;
this.scrollIntoViewId = targetId; this.scrollIntoViewId = targetId;
//
setTimeout(() => { setTimeout(() => {
this.isAutoScrolling = false; this.isAutoScrolling = false;
this.isSwitching = false; this.isSwitching = false;
}, 500); }, 500);
}); });
return; };
//
if (!this.isContainerSticky) {
const stickyThreshold = this.containerOriginalTop - this.navBarHeight;
uni.pageScrollTo({
scrollTop: stickyThreshold,
duration: 200,
complete: () => {
setTimeout(() => {
doScrollToCategory();
}, 250);
}
});
} else {
doScrollToCategory();
} }
setTimeout(() => {
this.isSwitching = false;
}, 300);
this.$forceUpdate(); this.$forceUpdate();
}, },
openOrderWait(item){ openOrderWait(item){

Loading…
Cancel
Save