浏览代码

VIN扫码

chenrui 2 年之前
父节点
当前提交
062848236b
共有 2 个文件被更改,包括 51 次插入11 次删除
  1. 2 1
      pages/vinAnalyse/shelfAnalyse.vue
  2. 49 10
      pages/vinAnalyse/shelfList.vue

+ 2 - 1
pages/vinAnalyse/shelfAnalyse.vue

@@ -163,7 +163,8 @@
 			}
 		},
 		onLoad(option) {
-			this.detail = JSON.parse(option.data)
+			this.selfId = option.selfId
+			this.getSelfDetail();
 			this.theme = getApp().globalData.theme
 			uni.setNavigationBarTitle({
 				title: this.detail.shelfName

+ 49 - 10
pages/vinAnalyse/shelfList.vue

@@ -46,7 +46,8 @@
 </template>
 
 <script>
-	import { selectShelfStockCheck, stockCheckDeleteBySn } from '@/api/stockCheck'
+	// import { selectShelfStockCheck, stockCheckDeleteBySn } from '@/api/stockCheck'
+	import { getShelfList } from '@/api/shelf'
 	import { clzConfirm } from '@/libs/tools'
 	export default {
 		data() {
@@ -57,9 +58,11 @@
 				noDataText: '暂无货架',
 				status: 'loading',
 				tempData: null,
+				pageNo:1,
+				pageSize:20
 			}
 		},
-		onShow() {
+		onLoad() {
 			this.getShelfList()
 		},
 		methods: {
@@ -76,31 +79,67 @@
 			// 获取数字货架列表
 			getShelfList(){
 				const _this = this
+				// if(this.shelfName == ''){
+				// 	this.pageNo = 1
+				// 	this.total = 0
+				// }
+				let params = {
+				    pageNo: _this.pageNo,
+				    pageSize: _this.pageSize,
+					shelfName: _this.shelfName
+				}
 				_this.status = 'loading'
-				selectShelfStockCheck().then(res => {
-					uni.hideLoading()
-					if(res.status==200){
-						let list = res.data.filter(item => item.shelfName.indexOf(this.shelfName)>=0)
+				getShelfList(params).then(res => {
+					if(res.status == 200){
+						let list = res.data.list
 						if (list && list.length){
-							_this.status = 'nomore'
-							_this.shelfList = list
+							// 分页 拼接数据
+							if(_this.pageNo>1){
+								_this.shelfList = _this.shelfList.concat(res.data.list || [])
+							}else{
+								_this.shelfList = res.data.list
+							}
+							_this.total = res.data.count
+							console.log(res.data.count)
+							if (_this.shelfList.length == res.data.count) {
+								_this.status = 'nomore'
+							} else {
+								_this.status = 'loadmore'
+							}
 						} else {
-							_this.shelfList = []
+							_this.shelfList = list || []
+							_this.total = 0
 							_this.status = 'nomore'
 							_this.noDataText = '没有查询到相关货架'
 						}
+						_this.noDataText = '暂无货架'
+						_this.setChecked()
 					}else{
 						_this.status = 'loadmore'
 						_this.shelfList = []
+						_this.total = 0
 						_this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
 					}
 				})
+				
 			},
 			viewDetail(item){
 				uni.navigateTo({
-					url:"/pages/vinAnalyse/shelfAnalyse?data="+encodeURIComponent(JSON.stringify(item))
+					url:"/pages/vinAnalyse/shelfAnalyse?selfId="+item.id
 				})
 			},
+		},
+		// 上拉加载更多
+		onreachBottom () {
+			if(this.shelfList.length < this.total ){
+				if(this.isGobleSearch&&this.shelfName==''){
+					return
+				}
+				this.pageNo++
+				this.getShelfList()
+			}else{
+				this.status = "nomore"
+			}
 		}
 	}
 </script>