From a6cf6c70f308f62c8d48caf8aee38cf78a84cf09 Mon Sep 17 00:00:00 2001 From: GaoHao <1210693421@qq.com> Date: Fri, 2 Aug 2024 16:50:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E6=95=B0=E9=87=8F=E8=B0=83?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 8 +- pages/index/indexs.vue | 3 +- ...sList_scroll.vue => order_food - 副本.vue} | 84 +++++++++++++------ 3 files changed, 62 insertions(+), 33 deletions(-) rename pages/order_food/{goodsList_scroll.vue => order_food - 副本.vue} (95%) diff --git a/pages.json b/pages.json index 44c2a66..0da14b7 100644 --- a/pages.json +++ b/pages.json @@ -166,13 +166,7 @@ "navigationBarTextStyle": "white" } }, - { - "path": "pages/order_food/goodsList_scroll", - "style": { - "navigationStyle": "custom", - "navigationBarTextStyle": "white" - } - }, + { "path": "pages/make/list", "style": { diff --git a/pages/index/indexs.vue b/pages/index/indexs.vue index fb1f85f..0dba44e 100644 --- a/pages/index/indexs.vue +++ b/pages/index/indexs.vue @@ -61,8 +61,7 @@ let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code') uni.cache.set('tableCode', tableCode) if (tableCode) { - uni.pro.navigateTo('order_food/goodsList_scroll') - // uni.pro.navigateTo('order_food/order_food') + uni.pro.navigateTo('order_food/order_food') } } diff --git a/pages/order_food/goodsList_scroll.vue b/pages/order_food/order_food - 副本.vue similarity index 95% rename from pages/order_food/goodsList_scroll.vue rename to pages/order_food/order_food - 副本.vue index 2172aa9..d9defce 100644 --- a/pages/order_food/goodsList_scroll.vue +++ b/pages/order_food/order_food - 副本.vue @@ -32,7 +32,7 @@ 本店招牌菜 - + @@ -45,8 +45,8 @@ 招牌 - - {{item.shortTitle}} + + {{item.shortTitle?item.shortTitle:''}} 月售{{item.stockNumber}} @@ -160,7 +160,7 @@ {{cartLists.amount||'0.00'}} - 结算 + 去结算 @@ -285,7 +285,7 @@ @click="shopAdd(specifications,specifications.indexa,specifications.indexb,'-',specifications.tagSnap == null ? '单规格':'')"> - {{specifications.cartNumber}} + {{amountcartNumber}} @@ -295,7 +295,7 @@ {{skuidname.toString()}} - 添加到购物车 + 添加到购物车 @@ -330,6 +330,7 @@ cartLists: {}, //购物车 cartLists_count: 0, shopInfo: {}, //店铺信息 + panelfiveShow: false, shopProductList: { }, //商品信息 @@ -338,6 +339,7 @@ }, // 规格信息 socketTicket: null, amountcartNumber: 0, + skuNumber: 0, salePrice: '', //钱数 cartListsdatashow: false ,//是否显示购物车 showCart: false, @@ -376,6 +378,7 @@ this.scrollHeight = data.windowHeight } }) + this.panelfiveShow = true; }, 100); /* 在非H5平台,nextTick回调后有概率获取到错误的元素高度,则添加200ms的延迟来减少BUG的产生 */ @@ -512,10 +515,20 @@ */ shopAdd (item, index, index1, a, b) { if ( a == "+" ){ - item.cartNumber++; + if ( this.amountcartNumber <= 0) { + this.amountcartNumber = this.amountcartNumber + item.suit; + }else { + this.amountcartNumber++; + } } else { - if ( item.cartNumber > 0 ) { - item.cartNumber-- + + if ( this.amountcartNumber > 0 ) { + console.log(item) + if ( this.amountcartNumber <= item.suit) { + this.amountcartNumber = this.amountcartNumber - item.suit + } else { + this.amountcartNumber = this.amountcartNumber - 1; + } } } }, @@ -524,12 +537,19 @@ * 添加购物车 */ addShopping ( item, index, index1, a, b ) { - if ( item.cartNumber <= 0 ) { + console.log(item) + if ( this.amountcartNumber <= 0 ) { return; } + let num = 0; + if ( item.typeEnum == "normal") { + num = item.cartNumber + this.amountcartNumber; + } else { + num = this.skuNumber + this.amountcartNumber; + } let params = { "skuId": this.skuId, - "num": item.cartNumber, //数量 + "num": num, //数量 "type": a == '+' ? 1 : 0, "productId": item.id, //商品id "shopId": uni.cache.get('shopUser'), @@ -621,10 +641,12 @@ } }) }) - this.cartListsdatashow = this.cartLists.data.length == 0 ? false : true + this.cartListsdatashow = this.cartLists.data.length == 0 ? false : true; + console.log(this.cartLists) if ( this.cartLists.data.length > 0 ){ this.cartLists_count = 0; this.cartLists.data.forEach((v,e)=>{ + console.log(v) this.cartLists_count += v.number; }) } @@ -691,6 +713,7 @@ async hodgepodge(item, a, c, num) { //此接口去获取商品id !!!赋值库存 数量 价格等 try { let res = await this.api.productqueryProductSku({ + code: uni.cache.get('tableCode'), shopId: uni.cache.get('shopUser'), productId: item.id, //商品id spec_tag: this.skuidname.join(",") @@ -717,6 +740,7 @@ this.addCart(params); } else { this.skuId = res.data.id; + this.skuNumber = res.data.number; this.showShopsku = true //打开弹框 } this.$set(this, 'amountcartNumber', 0) @@ -956,6 +980,7 @@ } .panelfive { + width: 100%; .panelfive_list{ display: flex; } @@ -964,6 +989,7 @@ width: 340rpx; margin-right: 30rpx; position: relative; + flex-shrink: 0; .panelfiveitemimage { border-radius: 20rpx 20rpx 0rpx 0rpx; width: 100%; @@ -1006,6 +1032,8 @@ .panelfiveitemfour { margin-top: 12rpx; width: 100%; + height: 36rpx; + line-height: 36rpx; overflow: hidden; //超出的文本隐藏 text-overflow: ellipsis; //溢出用省略号显示 white-space: nowrap; //溢出不换行 @@ -1024,7 +1052,6 @@ } .panelfiveitemsex { - padding-bottom: 48rpx; .panelfiveitemsex_oen { text:nth-child(1) { @@ -1055,17 +1082,19 @@ } } .panelfiveitemNum{ - position: absolute; - bottom: 82rpx; - right: 0; + // position: absolute; + // bottom: 82rpx; + // right: 0; + padding-bottom: 48rpx; + display: flex; + align-items: center; + justify-content: flex-end; .sku-wrap{ width: 138rpx; height: 54rpx; background: #E3AD7F; border-radius: 32rpx; - position: absolute; - bottom: 10rpx; - right: 20rpx; + position: relative; align-items: center; .t{ font-size: 28rpx; @@ -1361,17 +1390,16 @@ .btn { width: 160rpx; height: 64rpx; - background: #FEFAF7; + background: #E7AE7B; border-radius: 36rpx 36rpx 36rpx 36rpx; border: 2rpx solid #E8AD7B; display: flex; align-items: center; - justify-content: flex-end; + justify-content: center; .t{ font-weight: bold; font-size: 28rpx; - color: #E8AD7B; - margin-right: 26rpx; + color: #FFFFFF; } } } @@ -1561,7 +1589,9 @@ font-weight: 400; font-size: 24rpx; color: #333333; - + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; &+.item { margin-top: 1px; @@ -1711,6 +1741,12 @@ color: #999999; margin-bottom: 8rpx; } + .describe,.name{ + width: 270rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } .lookBack{ color: #FF534B;