Ver código fonte

修改仓库管理

wangchao 3 anos atrás
pai
commit
9e3761721d
1 arquivos alterados com 69 adições e 27 exclusões
  1. 69 27
      pages/erp/index.vue

+ 69 - 27
pages/erp/index.vue

@@ -2,20 +2,20 @@
 	<view class="wrap">
 		<view class='title'>仓库管理</view>
 		<view class="dropdown">
-			<view class="left"  @click='show1=true'>
+			<view class="left" @click='show1=true'>
 				<view>{{warehouseName}}</view>
 				<u-icon name="arrow-right" color=""></u-icon>
-				<u-select v-model="show1" :default-value='[0]' :list="warehouseList" @confirm="confirmWarehouse">
-				</u-select>
+				<u-picker @confirm="warehousechange" range-key='warehouseName' mode="selector" v-model="show1"
+					:range="warehouseList"></u-picker>
 			</view>
-			<view class="right"  @click='show2=true'>
+			<view class="right" @click='show2=true'>
 				<view>{{positionName}}</view>
 				<u-icon name="arrow-right" color=""></u-icon>
 				<u-select v-model="show2" :default-value='[0]' :list="positionList" @confirm="confirmPositon">
 				</u-select>
 			</view>
 		</view>
-		
+
 		<view class="cu-list grid" :class="['col-' + gridCol,gridBorder?'':'no-border']">
 			<view class="cu-item" v-for="(item,index) in gridList" :key="index" @click="gridClick(item, index)"
 				v-if="index<gridCol*2">
@@ -26,6 +26,8 @@
 				<text>{{item.name}}</text>
 			</view>
 		</view>
+		<u-modal v-model="isShowAlert" confirm-color='#22C572' confirm-text='立即开通' title='您尚未开通ERP业务'
+			:content="content"></u-modal>
 	</view>
 </template>
 <script>
@@ -39,22 +41,17 @@
 		},
 		data() {
 			return {
-				show1:false,
-				show2:false,
-				warehouseName: '鲅鱼圈一号库',
+				show1: false,
+				show2: false,
+				isShowAlert: false,
+				content: '易粮易运ERP系统包含合同管理、仓库管理、运输管理、结算管理等多个模块,可为粮企提供粮食贸易的全流程服务,平台诚邀您的加入。',
+				warehouseName: '',
 				positionName: '102仓位',
-					warehouseList: [
-						{
-						"label": '1',
-						"value": '1'
-						}
-					],
-					positionList: [
-						{
-						"label": '102仓位',
-						"value": '1'
-						}
-					],
+				warehouseList: [],
+				positionList: [{
+					"label": '102仓位',
+					"value": '1'
+				}],
 				gridCol: 4,
 				gridBorder: false,
 				gridList: [{
@@ -116,7 +113,7 @@
 		},
 
 		onLoad() {
-
+			this.init()
 		},
 		// #ifndef MP
 		onNavigationBarButtonTap(e) {
@@ -162,7 +159,6 @@
 					})
 				}
 			})
-			console.log("hasLogin", this.hasLogin)
 		},
 		methods: {
 			/**
@@ -203,8 +199,51 @@
 					}
 				}
 			},
-			confirmWarehouse(){},
-			confirmPositon(){}
+			confirmWarehouse() {},
+			confirmPositon() {},
+			init() {
+				console.log(this.userInfo)
+				this.$api.doRequest('get', '/warehouseBaseInfo/selectWarehouseViewinfo', {
+					compId: '',
+				}).then(res => {
+					if (res.data.data) {
+						console.log('res',res.data.data)
+						if (res.data.data.length == 0) {
+							this.isShowAlert = true
+						} else {
+							this.warehouseName = res.data.data[0].warehouseName
+							this.warehouseList = res.data.data;
+							this.makeBinNumber()
+						}
+					}
+				})
+			},
+			makeBinNumber(){debugger
+				let _data = this.warehouseList
+				let _arr = []
+				for(let i = 0;i<_data.length;i++){
+					//判断当前对象是否在数组中
+					let result = _arr.some(item=>{
+					   if(item.warehouseId==_data[i].warehouseId){
+						  _arr.cwList.push(_data[i].binNumber)
+					      return true 
+					  } 
+					})
+					console.log(result) 
+					if(!result){ 
+						 _arr.push(_data[i])
+						 _arr.cwList = [_data[i].binNumber]
+					 }
+					
+				}
+				console.log(_arr)
+			
+			},
+			warehousechange(e) {
+				debugger
+				this.warehouseName = this.warehouseList[e[0]].warehouseName
+				console.log(e)
+			},
 
 		}
 	}
@@ -300,11 +339,14 @@
 		top: 4px;
 		margin-right: 6px;
 	}
-	.dropdown{
+
+	.dropdown {
 		display: flex;
-		margin:20rpx 0;
+		margin: 20rpx 0;
 		justify-content: space-between;
-		.left,.right{
+
+		.left,
+		.right {
 			display: flex;
 		}
 	}