ソースを参照

完善库存的分页

wangxiaoying 4 年 前
コミット
f73f51696f
2 ファイル変更21 行追加12 行削除
  1. 15 10
      pages/home/my-stock/my-stock.vue
  2. 6 2
      pages/me/agent-stock/agent-stock.vue

+ 15 - 10
pages/home/my-stock/my-stock.vue

@@ -15,9 +15,9 @@
 					<view class="list-right">库存</view>
 				</view>
 				<template v-if="datalist&&datalist.length">
-					<view class="list-row u-flex" v-for="item in datalist" :key="item.matDescribe">
-						<view class="list-left">{{item.matDescribe}}</view>
-						<view class="list-right">{{item.stock}}</view>
+					<view class="list-row u-flex u-skeleton" v-for="item in datalist" :key="item.matDescribe">
+						<view class="list-left u-skeleton-rect">{{item.matDescribe}}</view>
+						<view class="list-right u-skeleton-rect">{{item.stock}}</view>
 					</view>
 				</template>
 				<u-empty v-else text="暂无数据" mode="list"></u-empty>
@@ -47,7 +47,7 @@
 				}],
 				// 分页信息
 				first: 0,
-				pageSize: 20, //每页条数
+				pageSize: 10, //每页条数
 				currentPage: 1, //当前页码
 				totalPage: 0, //总页码数
 				loadStatus: "loadmore",
@@ -85,15 +85,19 @@
 			},
 
 			handleSearch: function(v) {
+				this.first = 0;
+				this.currentPage = 1;
 				console.log(v)
 				this.handleGetData();
 			},
 			handleFilterBrand: function(v2) {
+				this.first = 0;
+				this.currentPage = 1;
 				this.current = v2;
-				this.currentBrand = this.brandlLst[this.current].brandName;
+				this.currentBrand = this.brandlLst[this.current].brandCode;
 				this.handleGetData();
 				console.log(arguments);
-				console.log(this.brandlLst[this.current].brandName)
+				console.log(this.brandlLst[this.current].brandCode)
 			},
 			handleGetFilterData: function() {
 				var _this = this;
@@ -146,11 +150,11 @@
 					url: '/homepage/storeGetStock',
 					method: 'post',
 					data: {
-						storeId: "990289",
+						storeId: "1000",
 						userId: "1",
 						current: _this.currentPage,
 						pageSize: _this.pageSize,
-						brandCode: _this.currentBrand,
+						brandCode: _this.currentBrand=="all"?"":_this.currentBrand,
 						specKey: _this.keyword
 					}
 				}).then(res => {
@@ -158,8 +162,9 @@
 						console.log(res)
 						// 获取数据列表
 						if (_this.first == 0) {
-							_this.datalist = res.data.data;
-							_this.total = parseInt(res.data.data.count);
+							_this.datalist = [];
+							_this.datalist = _this.datalist.concat(res.data.data);
+							_this.total = parseInt(res.data.count);
 							_this.totalPage = Math.ceil(_this.total / _this.pageSize);
 							console.log(_this.totalPage)
 						} else {

+ 6 - 2
pages/me/agent-stock/agent-stock.vue

@@ -109,6 +109,7 @@
 					this.currenBrand = "";
 					this.currentPattern = "";
 					this.currentSpec = "";
+					this.first = 0;
 					this.currentPage = 1;
 					this.handleGetData();
 				} else if (this.currentTab == 1) {
@@ -119,7 +120,6 @@
 			},
 			// 获取筛选条件
 			handleGetFilterData: function() {
-				
 				var _this = this;
 				request({
 					url: '/app/appAgent/getStoreAgentCondition',
@@ -191,7 +191,8 @@
 						console.log(res)
 						// 获取数据列表
 						if (_this.first == 0) {
-							_this.datalist = res.data.data.stockInfo;
+							_this.datalist = [];
+							_this.datalist = _this.datalist.concat(res.data.data.stockInfo);
 							_this.total = parseInt(res.data.data.count);
 							_this.totalPage = Math.ceil(_this.total / _this.pageSize);
 							console.log(_this.totalPage)
@@ -235,16 +236,19 @@
 			confirmBrand: function(v) {
 				this.currenBrand = v[0].label;
 				this.currentPage = 1;
+				this.first = 0;
 				this.handleGetData();
 			},
 			// 筛选花纹
 			confirmPattern: function(v) {
 				this.currentPattern = v[0].label;
 				this.currentPage = 1;
+				this.first = 0;
 				this.handleGetData();
 			},
 			searchSpec: function() {
 				if (this.currentSpec) {
+					this.first = 0;
 					this.currentPage = 1;
 					this.handleGetData();
 				}