lilei 3 gadi atpakaļ
vecāks
revīzija
000ea4b48c
2 mainītis faili ar 165 papildinājumiem un 6 dzēšanām
  1. 13 0
      api/shelf.js
  2. 152 6
      pages/latePlay/chooseBulk.vue

+ 13 - 0
api/shelf.js

@@ -0,0 +1,13 @@
+import axios from '@/libs/axios.js'
+
+// 货架分页列表
+export const getShelfList = (params) => {
+	let url = `shelf/queryPage/${params.pageNo}/${params.pageSize}`
+	delete params.pageNo
+	delete params.pageSize
+	return axios.request({
+		url: url,
+		data: params,
+		method: 'post'
+	})
+}

+ 152 - 6
pages/latePlay/chooseBulk.vue

@@ -1,22 +1,168 @@
 <template>
 <template>
-	<view>
-		
+	<view class="moreShelfPart flex flex_column">
+		<view class="moreShelfPart-search">
+			<u-search
+			placeholder="请输入货柜名称搜索" 
+			v-model="queryWord" 
+			:show-action="isGobleSearch" 
+			@focus="isGobleSearch=true" 
+			@custom="searchPart" 
+			@search="searchPart" 
+			@clear="searchPart"
+			:action-style="{'color': '#fff', 'font-size': '24upx', 'background-color': '#57a3f3', 'border-radius': '6upx', 'padding': '12upx 0'}">
+			</u-search>
+		</view>
+		<view class="moreShelfPart-body">
+			<scroll-view
+			class="nav-right" 
+			scroll-y 
+			@scrolltolower="onreachBottom">
+				<view class="nav-right-item" v-for="(item, index) in shelfList" :key="item.id">
+					<view class="item-info uni-col-10">
+						<view class="item-name">
+							<text>{{item.shelfName}}</text>
+						</view>
+						<view class="item-detail">
+							<text class="item-detail-text">西安市未央区常青二路与贞观路交叉口向东100米</text>
+						</view>
+					</view>
+				</view>
+				<view v-if="shelfList&&shelfList.length==0">
+					<u-empty v-if="status!='loading'" :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="240" :text="noDataText" mode="list" :margin-top="50"></u-empty>
+				</view>
+				<view style="padding: 20upx;" v-if="total>pageSize || status=='loading'">
+					<u-loadmore :status="status" />
+				</view>
+			</scroll-view>
+		</view>
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
+	import { getShelfList } from '@/api/shelf'
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
-				
+				queryWord: '',
+				isGobleSearch: false,
+				shelfList: [],
+				pageNo:1,
+				pageSize: 10,
+				total: 0, // 列表总数
+				noDataText: '暂无货架',
+				status: 'loading',
+				vinstatus: 'loading'
 			}
 			}
 		},
 		},
+		onLoad(opts) {
+			this.getShelfList()
+		},
 		methods: {
 		methods: {
-			
+			clearSearch(){
+				this.queryWord = ''
+				this.pageNo = 1
+				this.shelfList = []
+			},
+			// 搜索配件
+			searchPart(){
+				if(this.queryWord != ''){
+					this.clearSearch()
+					this.getShelfList()
+				}
+			},
+			// 获取数字货架列表
+			getShelfList(){
+				const _this = this
+				let params = {
+				    pageNo: this.pageNo,
+				    pageSize: this.pageSize,
+					queryWord: this.queryWord
+				}
+				_this.status = 'loading'
+				getShelfList(params).then(res => {
+					uni.hideLoading()
+					if(res.status == 200){
+						let list = res.data.list
+						if (list && list.length){
+							// 分页 拼接数据
+							if (_this.pageNo != 1) {
+								_this.shelfList = _this.shelfList ? _this.shelfList.concat(list) : list
+							} else {
+								_this.shelfList = list
+							}
+							this.total = res.data.count
+							if (_this.shelfList.length == res.data.count) {
+								_this.status = 'nomore'
+							} else {
+								_this.status = 'loadmore'
+							}
+						} else {
+							_this.shelfList = list || []
+							this.total = 0
+							_this.status = 'nomore'
+						}
+						_this.noDataText = '暂无配件'
+					}else{
+						_this.status = 'loadmore'
+						_this.shelfList = []
+						_this.total = 0
+						_this.noDataText = res.message ? res.message : '网络似乎出错了,请稍后再试'
+					}
+				})
+			},
+			// 加载更多
+			onreachBottom () {
+				if(this.shelfList.length < this.total ){
+					if(this.isGobleSearch&&this.queryWord==''){
+						return
+					}
+					this.pageNo++
+					this.getShelfList()
+				}else{
+					this.status = "nomore"
+				}
+			},
 		}
 		}
 	}
 	}
 </script>
 </script>
 
 
-<style>
-
+<style lang="less">
+	.moreShelfPart{
+		width: 100%;
+		height: 100vh;
+		.moreShelfPart-search{
+			padding: 20rpx;
+			background-color: #FFFFFF;
+		}
+		.moreShelfPart-body{
+			flex-grow: 1;
+			background-color: #fff;
+		}
+		.nav-right{
+			padding: 0 30upx;
+			height: calc(100vh - 180rpx);
+			box-sizing: border-box;
+			 
+			.nav-right-item{
+				padding:20upx 10upx;
+				border-bottom: 2rpx solid #f5f5f5;
+				display: flex;
+				.item-info{
+					.item-name{
+						font-size: 36upx;
+						display: flex;
+						align-items: center;
+					}
+					.item-detail{
+						margin-top: 10rpx;
+						.item-detail-text{
+							font-size: 30upx;
+							color: #9DA8B5;
+							word-break: break-all;
+						}
+					}
+				}
+			}
+		}
+	}
 </style>
 </style>