Browse Source

商城二级页面

LXT-NJ\Admin 2 years ago
parent
commit
0bbebdbaab
1 changed files with 19 additions and 17 deletions
  1. 19 17
      pages/gengduo/index.vue

+ 19 - 17
pages/gengduo/index.vue

@@ -5,7 +5,9 @@
 		<div class="cont" :style="{ height: (sys.windowHeight-80) + 'px' }">
 			<tm-sheet black>
 				<tm-sliderNav :style="{ height: (sys.windowHeight-80) + 'px' }" class="zuo fl" @change="change"
-					:list="list" text color="red"></tm-sliderNav>
+					:list="list" text color="red">
+					
+					</tm-sliderNav>
 				<view class="fr you" :style="{ height: (sys.windowHeight-80) + 'px' }">
 					<view class="huadong">
 						<view class="py-10 text-size-g dianz mingri text-align-center mt-40">
@@ -95,6 +97,7 @@
 		created() {
 			this.sys = uni.getSystemInfoSync();
 			this.getTop();
+			this.change(0)
 		},
 		methods: {
 			// 获取一级分类
@@ -109,6 +112,7 @@
 					if (res.data.code == 200) {
 						res.data.data.forEach(item => {
 							that.list.push({
+								id: item.id,
 								img: item.image,
 								title: item.category_name
 							})
@@ -121,33 +125,31 @@
 					}
 				})
 			},
-			// 二级分类
-			getMiddle() {
+			// 切换更换二级分类
+			change(e) {
+				let that=this;
 				myRequest({
-					url: "/api/ShopGoods/getMallClassification",
-					method: 'get',
-					data: that.reqData
-				}).then(res => {
+					url:'/api/ShopGoods/getMallChildrenClassification',
+					method:'post',
+					data:{id:that.list[e].id}
+				}).then(res=>{
 					console.log(res.data);
-					if (res.data.code == 200) {
+					if(res.data.code==200){
 						res.data.data.forEach(item => {
-							that.list3.push({
-								icon: item.image,
-								text: item.category_name
+							that.quanbuList.push({
+								// src: item.image,
+								// img: item.image,
+								// text: item.category_name
 							})
 						})
-					} else {
+					}else{
 						that.$refs.toast.show({
 							model: 'error',
 							label: res.data.msg
 						})
 					}
 				})
-			},
-
-
-			change(e) {
-				uni.$tm.toast(`您选中了:${e}`)
+				// uni.$tm.toast(`您选中了:${e}`)
 			}
 		},
 	}