LXT-NJ\Admin 1 year ago
parent
commit
006057f651
3 changed files with 66 additions and 128 deletions
  1. 6 1
      pages/gouwuche/index.vue
  2. 26 123
      pages/pingjia/index.vue
  3. 34 4
      pages/sort/index.vue

+ 6 - 1
pages/gouwuche/index.vue

@@ -42,6 +42,11 @@
 
 		},
 		created() {
+			if (!uni.getStorageSync("token")) {
+				uni.navigateTo({
+					url: "/pages/login/index",
+				})
+			}
 			this.sys = uni.getSystemInfoSync();
 			this.getList()
 		},
@@ -79,7 +84,7 @@
 								model: 'success',
 								label: res.data.msg
 							})
-							this.getList()
+							this.shanchu()
 						} else {
 							that.$refs.toast.show({
 								model: 'error',

+ 26 - 123
pages/pingjia/index.vue

@@ -140,7 +140,6 @@
 					}
 				})
 			},
-
 			openImagePage() {
 				let that = this;
 				if (that.fileList.length > 5) {
@@ -277,129 +276,33 @@
 </script>
 
 <style lang="scss">
-	/deep/ .tm-menubars .body {
-		background-color: #1b1b1b !important;
-	}
-
-	/deep/ .zhuti {
-		padding: 10px 10px;
-	}
-
+	/deep/ .tm-menubars .body {background-color: #1b1b1b !important;}
+	/deep/ .zhuti {padding: 10px 10px;}
 	/deep/ .kuang,
-	/deep/ .jia .tm-button-btn {
-		margin: 0 !important;
-		padding: 0px !important;
-	}
-
-	.uploadImg {
-		display: flex;
-		justify-content: flex-start;
-		align-items: flex-start;
-		flex-wrap: wrap;
-	}
-
-	.uploadImg-image {
-		width: 70px;
-		height: 70px;
-		margin: 0px 10px 10px 0px;
-		position: relative;
-	}
-
-	.shanchu {
-		position: absolute;
-		right: -15px;
-		top: -5px;
-	}
-
-	/deep/ .jia .tm-button-btn .px-12 {
-		padding: 0 !important;
-	}
-
-	/deep/ .white {
-		background: none !important;
-	}
-
+	/deep/ .jia .tm-button-btn {margin: 0 !important;padding: 0px !important;}
+	.uploadImg {display: flex;justify-content: flex-start;align-items: flex-start;flex-wrap: wrap;}
+	.uploadImg-image {width: 70px;height: 70px;margin: 0px 10px 10px 0px;position: relative;}
+	.shanchu {position: absolute;right: -15px;top: -5px;}
+	/deep/ .jia .tm-button-btn .px-12 {padding: 0 !important;}
+	/deep/ .white {background: none !important;}
 	/deep/ .jia .white,
-	/deep/ .jian .white {
-		color: #ffffff !important;
-	}
-
-	.sao {
-		width: 90%;
-		margin: 20px auto 0px;
-	}
-
-	/deep/ .shuliang .text-size-n {
-		color: white !important;
-	}
-
-	/deep/ .shangpin .tm-cartCellListFood {
-		margin: 5px 0px 20px !important;
-		padding-bottom: 15px !important;
-		border-bottom: 1px solid #1B1B1B;
-	}
-
-	/deep/ .kuang .border-t-1.bk {
-		border-top: 1px solid #1b1b1b !important;
-	}
-
+	/deep/ .jian .white {color: #ffffff !important;}
+	.sao {width: 90%;margin: 20px auto 0px;}
+	/deep/ .shuliang .text-size-n {color: white !important;}
+	/deep/ .shangpin .tm-cartCellListFood {margin: 5px 0px 20px !important;padding-bottom: 15px !important;border-bottom: 1px solid #1B1B1B;}
+	/deep/ .kuang .border-t-1.bk {border-top: 1px solid #1b1b1b !important;}
 	/deep/ .shangpin .title,
-	/deep/ .shangpin .text-red {
-		color: white !important;
-	}
-
-	/deep/ .shangpin .round-3 {
-		width: 90px !important;
-		height: 90px !important;
-	}
-
-	/deep/ .shangpin .tm-cartCellListFood-img {
-		width: 90px !important;
-		height: 90px !important;
-	}
-
-	/deep/ .shuliang .text-size-n {
-		color: white !important;
-	}
-
-	.tiyan text {
-		vertical-align: middle;
-	}
-
-	.tiyan {
-		margin-top: 20px;
-	}
-
-	/deep/ .tiyan .text-primary.bk {
-		color: #FFCC00 !important;
-	}
-
-	/deep/ .tiyan .opacity-6 {
-		opacity: 1 !important;
-	}
-
-	/deep/ .shuru .grey-darken-4 {
-		background: #0D0D0D !important;
-	}
-
-	.shuru {
-		padding: 0px !important;
-		margin-top: 20px !important;
-	}
-
-	.jia {
-		width: 100%;
-		height: 100%;
-		display: flex;
-		flex-direction: column;
-		justify-content: center;
-		align-items: center;
-	}
-
-	.jia-btn {
-		width: 70px;
-		height: 70px;
-		border: 1px solid #eeeeee;
-		border-radius: 4px;
-	}
+	/deep/ .shangpin .text-red {color: white !important;}
+	/deep/ .shangpin .round-3 {width: 90px !important;height: 90px !important;}
+	/deep/ .shangpin .tm-cartCellListFood-img {width: 90px !important;height: 90px !important;}
+	/deep/ .shuliang .text-size-n {color: white !important;}
+	.tiyan text {vertical-align: middle;}
+	.tiyan {margin-top: 20px;}
+	/deep/ .tiyan .text-primary.bk {color: #FFCC00 !important;}
+	/deep/ .tiyan .opacity-6 {opacity: 1 !important;}
+	/deep/ .shuru .grey-darken-4 {background: #0D0D0D !important;}
+	.shuru {padding: 0px !important;margin-top: 20px !important;}
+	.jia {width: 100%;height: 100%;display: flex;flex-direction: column;
+	justify-content: center;align-items: center;}
+	.jia-btn {width: 70px;height: 70px;border: 1px solid #eeeeee;border-radius: 4px;}
 </style>

+ 34 - 4
pages/sort/index.vue

@@ -22,7 +22,7 @@
 						</view>
 					</view>
 					<view style="clear: both;"></view>
-					<view style="clear: both;" class="more ma-40 pt-40" @click="gengmore()"  >
+					<view style="clear: both;" class="more ma-40 pt-40" @click="gengmore()" v-if="listdata.length<total" >
 						<image src="/static/img/30.png" mode="widthFix"></image>
 						<text class="text-size-s">下拉加载更多~</text>
 					</view>
@@ -44,6 +44,7 @@ export default {
 			soId:'',
 			page:1,
 			pagesize:8,
+			total:0
 		};
 	},
 	onLoad(op) {
@@ -51,13 +52,39 @@ export default {
 		this.soId=op.id
 	},
 	created() {
+		if (!uni.getStorageSync("token")) {
+			uni.navigateTo({
+				url: "/pages/login/index",
+			})
+		}
 		this.sys = uni.getSystemInfoSync();
 		// this.randouh()
 		this.getSort()
 	},
 	methods: {
 		gengmore(){
-			// this.randouh()
+			this.page++;
+			let that=this;
+			myRequest({
+				url:'/api/ShopGoods/childrenClassificationList',
+				method:'post',
+				data:{id:that.soId,page:that.page,pagesize:that.pagesize}
+			}).then(res=>{
+				if(res.data.code==200){
+					if(res.data.data.length<res.data.data.total){
+						console.log(res.data.data,'liebiao');
+						// that.total=res.data.data.total;
+						that.listdata=that.listdata.concat(res.data.data.data);
+					}else{
+						that.page--;
+					}
+				}else{
+					that.$refs.toast.show({
+						model: 'error',
+						label: res.data.msg
+					})
+				}
+			})
 		},
 		jiarufuFun(data){
 			uni.navigateTo({
@@ -67,6 +94,8 @@ export default {
 			// this.gouwuche.push(data)
 		},
 		getSort(){
+			this.page=1;
+			this.pagesize=8;
 			let that=this;
 			myRequest({
 				url:'/api/ShopGoods/childrenClassificationList',
@@ -75,8 +104,9 @@ export default {
 			}).then(res=>{
 				if(res.data.code==200){
 					if(res.data.data.length!=0){
-							console.log(res.data.data,'liebiao');
-					that.listdata=res.data.data.data;
+						console.log(res.data.data,'liebiao');
+						that.total=res.data.data.total;
+						that.listdata=res.data.data.data;
 					}else{
 						that.listdata=[]
 					}