From 93c3e70e98153d60051acf399ec9520e407d54dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=95=BE?= <1144797966@qq.com> Date: Sat, 3 Aug 2024 16:38:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=89=8D=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E4=BA=8C=E6=AC=A1=E8=BF=9B=E6=9D=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order_food/order_food.vue | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index 222d9f0..255e19f 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -483,6 +483,9 @@ if (this.cartLists && this.cartLists.data && this.cartLists.data.length >= 0) { this.setNumber() } + this.scrollTopSize = 0 + this.scrollHeight = 1000 + this.topArr = [] setTimeout(() => { this.getElementTop(); }, 100); @@ -833,6 +836,7 @@ /* 获取元素顶部信息 */ getElementTop() { + new Promise((resolve, reject) => { let view = uni.createSelectorQuery().selectAll('.main-item'); view.boundingClientRect(async data => { @@ -874,14 +878,14 @@ } } const lastElement = this.topArr[this.topArr.length - 1]; - const currentElement = this.topArr[this.leftIndex]; + const currentElement = this.topArr[index]; const diff = lastElement - currentElement; console.log(diff) - // if (diff > this.scrollHeight) { - this.leftIndex = (index < 0 ? 0 : index); - // } else { - // this.leftIndex = this.leftIndex - // } + if (diff > this.scrollHeight) { + this.leftIndex = (index < 0 ? 0 : index); + } else { + this.leftIndex = this.leftIndex + } } }, /* 左侧导航点击 */ @@ -890,9 +894,7 @@ scrollTop: this.topArr[index] - this.HeighT, duration: 0 }); - setTimeout(() => { - this.leftIndex = index - }, 500) + this.leftIndex = index } } } From aeae9c2e39e900898e67ef4a659fa22276832c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=95=BE?= <1144797966@qq.com> Date: Sat, 3 Aug 2024 16:58:19 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order_food/order_food.vue | 46 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index 255e19f..45bdfa0 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -469,29 +469,6 @@ } }, - - /** - * 获取商品数据 - */ - async productqueryProduct() { - let res = await this.api.productqueryProduct({ - "shopId": uni.cache.get('shopUser'), - "productGroupId": '' - }) - if (res.code == 0) { - this.shopProductList = res.data; - if (this.cartLists && this.cartLists.data && this.cartLists.data.length >= 0) { - this.setNumber() - } - this.scrollTopSize = 0 - this.scrollHeight = 1000 - this.topArr = [] - setTimeout(() => { - this.getElementTop(); - }, 100); - } - }, - /** * 商品数量增加/减少 * @param {Object} item @@ -833,10 +810,30 @@ this.socketTicket.send(data); } }, + /** + * 获取商品数据 + */ + async productqueryProduct() { + let res = await this.api.productqueryProduct({ + "shopId": uni.cache.get('shopUser'), + "productGroupId": '' + }) + if (res.code == 0) { + this.shopProductList = res.data; + if (this.cartLists && this.cartLists.data && this.cartLists.data.length >= 0) { + this.setNumber() + } + this.scrollTopSize = 0 + this.scrollHeight = 1000 + this.topArr = [] + setTimeout(() => { + this.getElementTop(); + }, 500); + } + }, /* 获取元素顶部信息 */ getElementTop() { - new Promise((resolve, reject) => { let view = uni.createSelectorQuery().selectAll('.main-item'); view.boundingClientRect(async data => { @@ -846,6 +843,7 @@ this.scrollTopSize = res.top; //元素距离顶部的距离 }) }).then((res) => { + console.log(res, 111) let topArr = res.map((item) => { return item.top; /* 减去滚动容器距离顶部的距离 加导航栏高度*/ }); From 2a3f125bce1a3005e9e8ab51500b79594700543f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=95=BE?= <1144797966@qq.com> Date: Sat, 3 Aug 2024 17:20:39 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/navseat.vue | 18 +++++++++++++----- pages/order_food/order_food.vue | 16 ++++++++++++++-- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/components/navseat.vue b/components/navseat.vue index 2bcc098..d218c4b 100644 --- a/components/navseat.vue +++ b/components/navseat.vue @@ -58,22 +58,26 @@ type: Boolean, default: false }, - titleshow: {//标题是否显示 + titleshow: { //标题是否显示 type: Boolean, default: false }, - heightshow: {//是否要占位高度 + heightshow: { //是否要占位高度 type: Boolean, default: false }, - iconshow: {//返回键是否显示 + iconshow: { //返回键是否显示 type: Boolean, default: true }, - iconcolor:{//返回键颜色 + iconcolor: { //返回键颜色 type: String, default: '#000' }, + navigateBacknavtitle: { + type: Boolean, + default: false + } }, computed: { HeighT() { //手机类型的尺寸 @@ -95,7 +99,11 @@ }) }, clicknavigateBack() { - uni.navigateBack() + if (this.navigateBacknavtitle) { + this.$emit('navigateBacknav') + } else { + uni.navigateBack() + } } } diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index 9df05f2..240b9d1 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -8,9 +8,11 @@ - + - + {{ shopInfo.storeInfo.shopName }} @@ -393,6 +395,10 @@ this.fixedtrue = true }, onShow() { + uni.pageScrollTo({ + scrollTop: 0, + duration: 0 + }); console.log(!uni.cache.get('token')) if (!uni.cache.get('token')) { uni.login({ @@ -427,6 +433,9 @@ } }, methods: { + navigateBacknav() { + uni.pro.switchTab('index/index') + }, getQueryString(url, name) { //解码 var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i') var r = url.substr(1).match(reg) @@ -837,6 +846,7 @@ new Promise((resolve, reject) => { let view = uni.createSelectorQuery().selectAll('.main-item'); view.boundingClientRect(async data => { + console.log(data, 840) resolve(data); }).exec(); this.$u.getRect('.scroll-panel').then(res => { @@ -955,6 +965,7 @@ font-size: 24rpx; color: #999999; padding: 0 20rpx; + .paneltheretext { font-family: Source Han Sans CN, Source Han Sans CN; font-weight: 400; @@ -983,6 +994,7 @@ .panelfive { width: 100%; padding: 0 20rpx; + .panelfive_list { display: flex; }