py преди 2 години
родител
ревизия
8e94099f0f
променени са 2 файла, в които са добавени 54 реда и са изтрити 37 реда
  1. 53 36
      pages-takeout/shop-mod/menu.vue
  2. 1 1
      pages-takeout/shop.vue

+ 53 - 36
pages-takeout/shop-mod/menu.vue

@@ -62,7 +62,7 @@
 						<view class="fw-400 fc-9 fs-24">月销{{popData.goodsItem.sales}}</view>
 						<view class="fw-400 fc-9 fs-24">月销{{popData.goodsItem.sales}}</view>
 					</view>
 					</view>
 				</view>
 				</view>
-				<view class="scroll-view-css box-border-box plr-32">
+				<scroll-view scroll-y="true" class="scroll-view-css box-border-box plr-32">
 					<view class="" v-for="(item,i) in popData.spec_attr" :key="i">
 					<view class="" v-for="(item,i) in popData.spec_attr" :key="i">
 						<view class="fs-32 fw-500 fc-0 mb-32">{{item.group_name}}</view>
 						<view class="fs-32 fw-500 fc-0 mb-32">{{item.group_name}}</view>
 						<view class="flex-wrap-wrap">
 						<view class="flex-wrap-wrap">
@@ -73,7 +73,19 @@
 							</view>
 							</view>
 						</view>
 						</view>
 					</view>
 					</view>
-				</view>
+				</scroll-view>
+<!-- 				<view class="scroll-view-css box-border-box plr-32">
+					<view class="" v-for="(item,i) in popData.spec_attr" :key="i">
+						<view class="fs-32 fw-500 fc-0 mb-32">{{item.group_name}}</view>
+						<view class="flex-wrap-wrap">
+							<view class="spec-item text-align-center fs-28"
+								:class="popData.spec_ids.indexOf(info.item_id)>=0?'s-item':'n-item'"
+								v-for="(info,k) in item.spec_items" :key="k" @click="selectSpec(info,i)">
+								{{info.spec_value}}
+							</view>
+						</view>
+					</view>
+				</view> -->
 				<view class="pop-buttom box-border-box plr-32">
 				<view class="pop-buttom box-border-box plr-32">
 					<view class="flex-justify-space mb-28">
 					<view class="flex-justify-space mb-28">
 						<view class="pop-buttom-left">
 						<view class="pop-buttom-left">
@@ -198,17 +210,17 @@
 						this.popData.spec_key = ''
 						this.popData.spec_key = ''
 						this.popData.num = 1
 						this.popData.num = 1
 						this.popData.spec_ids = []
 						this.popData.spec_ids = []
-					}else {
-            this.popData.num =1;
-            if(this.cartData.goods_list.length>0){
-              this.cartData.goods_list.forEach(item=>{
-                if(item.spec_sku_id===this.popData.spec_key){
-                  this.popData.num = item.goods_number
-                }
-              })
-            }
-
-          }
+					} else {
+						this.popData.num = 1;
+						if (this.cartData.goods_list.length > 0) {
+							this.cartData.goods_list.forEach(item => {
+								if (item.spec_sku_id === this.popData.spec_key) {
+									this.popData.num = item.goods_number
+								}
+							})
+						}
+
+					}
 					this.popData.spec_list = res.data.spec_list
 					this.popData.spec_list = res.data.spec_list
 					this.popData.spec_attr = res.data.spec_attr
 					this.popData.spec_attr = res.data.spec_attr
 					this.$refs.popupGG.open();
 					this.$refs.popupGG.open();
@@ -226,10 +238,12 @@
 					let spec_key = spec_ids.join('_')
 					let spec_key = spec_ids.join('_')
 					this.popData.spec_key = spec_key
 					this.popData.spec_key = spec_key
 					if (this.popData.spec_list[spec_key] !== undefined) {
 					if (this.popData.spec_list[spec_key] !== undefined) {
-						this.popData.price = this.popData.spec_list[spec_key].seckill_money > 0 ? this.popData.spec_list[spec_key].seckill_money : this.popData.spec_list[spec_key].price
+						this.popData.price = this.popData.spec_list[spec_key].seckill_money > 0 ? this.popData.spec_list[
+							spec_key].seckill_money : this.popData.spec_list[spec_key].price
 						this.popData.line_price = this.popData.spec_list[spec_key].line_price
 						this.popData.line_price = this.popData.spec_list[spec_key].line_price
 						this.popData.goods_spec_id = this.popData.spec_list[spec_key].goods_spec_id + ''
 						this.popData.goods_spec_id = this.popData.spec_list[spec_key].goods_spec_id + ''
-						let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id*1 === row.goods_spec_id*1)
+						let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id * 1 === row
+							.goods_spec_id * 1)
 						if (cartKey >= 0) {
 						if (cartKey >= 0) {
 							this.popData.num = this.cartData.goods_list[cartKey].goods_number
 							this.popData.num = this.cartData.goods_list[cartKey].goods_number
 						}
 						}
@@ -295,9 +309,9 @@
 							})
 							})
 						})
 						})
 						// console.log(res)
 						// console.log(res)
-            setTimeout(()=>{
-              this.setGoodsNum()
-            },1000)
+						setTimeout(() => {
+							this.setGoodsNum()
+						}, 1000)
 					}
 					}
 				})
 				})
 			},
 			},
@@ -307,12 +321,14 @@
 					this.idMark = 'scroll' + item.type
 					this.idMark = 'scroll' + item.type
 				}
 				}
 			},
 			},
-			menuScroll() {
+			menuScroll(e) {
 				let _this = this;
 				let _this = this;
 				let query = uni.createSelectorQuery().in(this);
 				let query = uni.createSelectorQuery().in(this);
+				console.log(e.detail,'%%%%%%%%%%');
 				query.selectAll(".menu-box-only").boundingClientRect(data => {
 				query.selectAll(".menu-box-only").boundingClientRect(data => {
 					data.forEach((v) => {
 					data.forEach((v) => {
-						if (v.top < 329 && v.top > 0) {
+						console.log(v.top, '^^^^^^^^^^^^^^');
+						if (v.top < 330 && v.top > 0) {
 							_this.idMark = v.id;
 							_this.idMark = v.id;
 							let arr = v.id.split('scroll');
 							let arr = v.id.split('scroll');
 							_this.type = Number(arr[1]);
 							_this.type = Number(arr[1]);
@@ -349,28 +365,29 @@
 				} else {
 				} else {
 					this.$refs.popupGG.close();
 					this.$refs.popupGG.close();
 					this.isAjax = false
 					this.isAjax = false
-          let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id === row.goods_spec_id)
-          console.log(cartKey)
-          let addType=this.popData.num>0?2:1
-          console.log('addType:'+addType)
-          if (addType === 2 && cartKey < 0) {
-            this.setShopIngAdd(this.popData.goods_id, this.popData.goodsItem.category_id, this.popData
-                .goods_spec_id,this.popData.num)
-          } else {
-            this.setShopIngNumber(this.popData.goods_id, this.popData.goodsItem.category_id, type, this.popData
-                .goods_spec_id,this.popData.num)
-          }
+					let cartKey = this.cartData.goods_list.findIndex(row => this.popData.goods_spec_id === row
+						.goods_spec_id)
+					console.log(cartKey)
+					let addType = this.popData.num > 0 ? 2 : 1
+					console.log('addType:' + addType)
+					if (addType === 2 && cartKey < 0) {
+						this.setShopIngAdd(this.popData.goods_id, this.popData.goodsItem.category_id, this.popData
+							.goods_spec_id, this.popData.num)
+					} else {
+						this.setShopIngNumber(this.popData.goods_id, this.popData.goodsItem.category_id, type, this.popData
+							.goods_spec_id, this.popData.num)
+					}
 				}
 				}
 			},
 			},
 			setSub(item, type) {
 			setSub(item, type) {
 				let cartKey = this.cartData.goods_list.findIndex(row => row.goods_id === item.goods_id)
 				let cartKey = this.cartData.goods_list.findIndex(row => row.goods_id === item.goods_id)
 				if (type === 2 && cartKey < 0) {
 				if (type === 2 && cartKey < 0) {
-					this.setShopIngAdd(item.goods_id, item.category_id, '',1)
+					this.setShopIngAdd(item.goods_id, item.category_id, '', 1)
 				} else {
 				} else {
-					this.setShopIngNumber(item.goods_id, item.category_id, type, '',1)
+					this.setShopIngNumber(item.goods_id, item.category_id, type, '', 1)
 				}
 				}
 			},
 			},
-			setShopIngAdd(goodsId, categoryId, goodsSpecId,number) {
+			setShopIngAdd(goodsId, categoryId, goodsSpecId, number) {
 				setShopIngAdd({
 				setShopIngAdd({
 					'type': 1,
 					'type': 1,
 					'goods_id': goodsId,
 					'goods_id': goodsId,
@@ -385,7 +402,7 @@
 					this.isAjax = false
 					this.isAjax = false
 				})
 				})
 			},
 			},
-			setShopIngNumber(goodsId, categoryId, operation, goodsSpecId,number) {
+			setShopIngNumber(goodsId, categoryId, operation, goodsSpecId, number) {
 				setShopIngNumber({
 				setShopIngNumber({
 					'type': 1,
 					'type': 1,
 					'goods_id': goodsId,
 					'goods_id': goodsId,
@@ -612,4 +629,4 @@
 	.goods-name {
 	.goods-name {
 		max-width: 310rpx;
 		max-width: 310rpx;
 	}
 	}
-</style>
+</style>

+ 1 - 1
pages-takeout/shop.vue

@@ -1,5 +1,5 @@
 <template>
 <template>
-	<view class="shop-index iPhone-bottom flex-common-css box-border-box ">
+	<view class="shop-index iPhone-bottom flex-common-css box-border-box" @touchmove.stop.prevent="moveHandle">
 		<image class="bg-img" :src="shopsInfo.shop_logo" mode="aspectFill"></image>
 		<image class="bg-img" :src="shopsInfo.shop_logo" mode="aspectFill"></image>
 		<view class="mb-box"></view>
 		<view class="mb-box"></view>
 		<view class="nav-box">
 		<view class="nav-box">