From 0fcb19cbdc87802107d7c80ec0fd13ac01ce09c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=8F=E5=95=BE?= <1144797966@qq.com> Date: Tue, 6 Aug 2024 14:17:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=B3=E8=BE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/order_food/order_food.vue | 63 +++++++++++++++++---------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/pages/order_food/order_food.vue b/pages/order_food/order_food.vue index d41c4cf..d130243 100644 --- a/pages/order_food/order_food.vue +++ b/pages/order_food/order_food.vue @@ -109,9 +109,10 @@ - - TOP{{index1+1}} @@ -276,9 +277,8 @@ {{item.name}} - {{item1.info}} @@ -310,7 +310,8 @@ - {{skuBtnText}} + {{skuBtnText}} + @@ -344,8 +345,7 @@ cartLists_count: 0, shopInfo: {}, //店铺信息 shopProductList: {}, //商品信息 - specifications: { - }, // 规格信息 + specifications: {}, // 规格信息 socketTicket: null, amountcartNumber: 0, isSpec: true, @@ -356,7 +356,7 @@ cartListsdatashow: false, //是否显示购物车 showCart: false, lastbottom: '', //元素最低端的距离 - scrollxleft: false, + scrollxleft: true, orderdetailFlag: true, } }, @@ -366,6 +366,11 @@ } else { this.opacity = true } + // if (e.scrollTop > this.topArr[0]) { + // this.scrollxleft = true + // } else { + // this.scrollxleft = false + // } this.mainScroll(e) }, computed: { @@ -400,7 +405,7 @@ }, onUnload() { - if ( this.socketTicket ) { + if (this.socketTicket) { this.socketTicket.Close() uni.$off('message') } @@ -678,9 +683,9 @@ this.isSpec = true; let res = await this.api.productquerySpec({ productId: item1.id, //商品id - querySpecList:[], + querySpecList: [], }) - if( res.code == 0 ){ + if (res.code == 0) { this.specifications.tagSnap = res.data.map((item) => { console.log(item) let data = { @@ -699,7 +704,7 @@ }) } this.skuBtnText = `您还没选择${this.specifications.tagSnap[0].name}哦` - + // this.specifications.tagSnap.forEach((val, index, arr) => { //初始化skuidname的数据 选择第一个 // console.log(val) // this.skuidname.push(val.children[0].info) @@ -722,48 +727,48 @@ */ async morloe(e, index, index1, item) { let _this = this; - if ( !e.isGrounding ) { + if (!e.isGrounding) { return; } - + let querySpecList = []; this.skuBtnText = "添加到购物车"; this.isSpec = true; - if ( this.specifications.tagSnap[index].start != index1) { + if (this.specifications.tagSnap[index].start != index1) { this.$set(this.specifications.tagSnap[index], 'start', index1) } else { this.$set(this.specifications.tagSnap[index], 'start', -1) } _this.skuidname.splice(index, 1, e.info); //替换skuidname的数据 - _this.specifications.tagSnap.forEach((v,i)=>{ - if ( v.start >= 0 && v.start <= v.children.length) { + _this.specifications.tagSnap.forEach((v, i) => { + if (v.start >= 0 && v.start <= v.children.length) { querySpecList.push({ name: v.name, value: v.children[v.start].info }) } - + }) for (let i = 0; i < this.specifications.tagSnap.length; i++) { - if ( this.specifications.tagSnap[i].start < 0) { + if (this.specifications.tagSnap[i].start < 0) { this.isSpec = false; this.skuBtnText = `您还没选择${this.specifications.tagSnap[i].name}哦` break; // 终止循环 } } - + let res = await _this.api.productquerySpec({ productId: item.id, //商品id querySpecList: querySpecList, }) - if( res.code == 0 ){ - res.data.forEach((v,e)=>{ + if (res.code == 0) { + res.data.forEach((v, e) => { _this.$set(this.specifications.tagSnap[e], 'children', v.value) // _this.specifications.tagSnap[e].children = v.value }) } console.log(_this.specifications.tagSnap) - + this.$forceUpdate(); _this.hodgepodge(item, 2) }, @@ -812,7 +817,7 @@ * 结算直接生成订单 */ orderdetail() { - if ( !this.orderdetailFlag ) { + if (!this.orderdetailFlag) { return; } this.orderdetailFlag = false; @@ -965,11 +970,7 @@ let top = e.scrollTop; let index = 0; // 判断左边是否可以滑动 - if (top + 2 > this.topArr[0]) { - this.scrollxleft = true - } else { - this.scrollxleft = false - } + for (let i = (this.topArr.length - 1); i >= 0; i--) { /* 在部分安卓设备上,因手机逻辑分辨率与rpx单位计算不是整数,滚动距离与有误差,增加2px来完善该问题 */ if ((top + 2) >= this.topArr[i] - this.HeighT) {