Browse Source

盘点修改

zhaoyanlong 17 hours ago
parent
commit
88fb66732b
1 changed files with 76 additions and 20 deletions
  1. 76 20
      pages/sample/stocktaking.vue

+ 76 - 20
pages/sample/stocktaking.vue

@@ -27,13 +27,13 @@
 				</view>
 				<view class="uni-input-wrapper" style="margin: 5px auto;">
 					<text class="uni-form-item__title" style="width: 25%;">回库口</text>
-					<select-lay style="width: 75%;" :zindex="2" :value="port_sn" name="port_sn" placeholder="请选择回库口"
+					<select-lay style="width: 75%;" :zindex="zindex1" :value="port_sn" name="port_sn" placeholder="请选择回库口"
 						:options="portList" @selectitem="selectPort">
 					</select-lay>
 				</view>
 				<view class="uni-input-wrapper" style="margin: 5px auto;">
 					<text class="uni-form-item__title" style="width: 25%;">选择层</text>
-					<select-lay style="width: 75%;" :zindex="1" :value="floor" name="floor"
+					<select-lay style="width: 75%;" :zindex="zindex2" :value="floor" name="floor"
 						placeholder="请选择层" :options="floorList" @selectitem="selectFloor">
 					</select-lay>
 				</view>
@@ -51,6 +51,8 @@
 											货物名称:{{item.name}}  型号:{{item.model}} 
 											 </br>
 											库存数量:{{item.num}}  盘点数量:{{item.stocktaking_num}} 
+											</br>
+											修改原因:{{item.remark}}
 										</view>
 										<br>
 									</view>
@@ -83,10 +85,31 @@
 		</uni-popup> -->
 
 		<!-- 输入框示例 -->
-		<uni-popup ref="inputDialog" type="dialog">
+		<!-- <uni-popup ref="inputDialog" type="dialog">
 			<uni-popup-dialog ref="inputClose" mode="input" :title="title" :value="outNum" placeholder="请填写正确数量"
 				@confirm="UpdateNum"></uni-popup-dialog>
-		</uni-popup>
+		</uni-popup> -->
+		
+		<!-- 引入自定义模态框 -->
+		<custom-modal :visible="updateModalVisible">
+			<!-- 模态框的内容-->
+			<view>
+				<text>提示</text>
+				<view class="uni-input-wrapper" style="margin: 5px auto;">
+					<text class="uni-form-item__title" style="width: 30%;">数量</text>
+					<input type="number" class="uni-input" :value="outNum" @input="outNumChange"/>
+				</view>
+				<view class="uni-input-wrapper" style="margin: 5px auto;">
+					<text class="uni-form-item__title" style="width: 30%;">修改原因</text>
+					<input class="uni-input" :value="remark" @input="remarkChange"/>
+				</view>
+				<br><br>
+				<button class="mini-btn" size="mini" @click="closeUpdateModal"
+					style="width: 50%;float: left;">关闭</button>
+				<button class="mini-btn" type="primary" size="mini" @click="UpdateNum"
+					style="width: 50%;">更新</button>
+			</view>
+		</custom-modal>
 	</view>
 </template>
 <script>
@@ -123,11 +146,13 @@
 				viewText: "",
 				tableData: [],
 				BtnDisabled: false,
+				updateModalVisible:false,
 				attributeData: {},
 				title: "",
 				port_sn: "",
 				portList: [],
 				outNum: "",
+				remark:"",
 				floor:"",
 				floorList: [
 						{
@@ -154,7 +179,9 @@
 							label: "6层",
 							value: "6"
 						}
-				]
+				],
+				zindex1: 2,
+				zindex2: 1,
 			}
 		},
 		computed: {
@@ -201,7 +228,6 @@
 				
 				_this = this;
 				_this.firstFocus = true;
-				console.log(options.containerCode);	
 				_this.container_code = options.containerCode;
 			},
 
@@ -355,22 +381,38 @@
 			closeModal() {
 				// 关闭模态框  
 			},
-
+			closeUpdateModal() {
+				_this.zindex1 = 2;
+				_this.zindex2 = 1;
+				// 关闭模态框  
+				_this.sn = "";
+				_this.remark = "";
+				_this.outNum = 0;
+				this.updateModalVisible = false;
+			},
 			OutStore(item) {
+				_this.zindex1 = 0;
+				_this.zindex2 = 0;
 				_this.sn = item["sn"]
 				_this.detail_sn = item["detail_sn"]
 				_this.title = "盘点数量:" + item["stocktaking_num"];
 				_this.outNum = item["stocktaking_num"]
-				this.$refs.inputDialog.open()
+				_this.remark = item["remark"]
+				_this.updateModalVisible = true;
+				// this.$refs.inputDialog.open()
 			},
 			// 更改库存明细
-			UpdateNum(val) {
+			UpdateNum() {
 				setTimeout(() => {
 					uni.hideLoading()
-					if (parseFloat(val) < 0 ) {
+					if (parseFloat(_this.outNum) < 0 ) {
 						_this.alertInfo("请输入正确的数量!");
 						return
 					}
+					if (_this.remark == "" ) {
+						_this.alertInfo("请输入修改原因!");
+						return
+					}
 					uni.request({
 						url: reqRootUrl + '/PDAUpdateDetail',
 						method: 'POST',
@@ -379,27 +421,34 @@
 						},
 						data: JSON.stringify({
 							"detail_sn": _this.detail_sn,
-							"upNum": parseFloat(val),
+							"upNum": parseFloat(_this.outNum),
+							"remark":_this.remark
 						}),
 						success: (ret) => {
-							this.$refs.inputDialog.close();
+							// this.$refs.inputDialog.close();
 							if (ret.statusCode === 200) {
 								if(ret.data.ret =="failed"){
 									_this.alertInfo(ret.data.msg);
 								}else{
 									_this.alertInfo("更改成功!");
-									_this.out_tips = "";
-									_this.detail_sn ="";
+									_this.zindex1 = 2;
+									_this.zindex2 = 1;
+									// 关闭模态框  
 									_this.sn = "";
+									_this.remark = "";
 									_this.outNum = 0;
+									this.updateModalVisible = false;
 									_this.getList();
 								}
 							}else{
 								_this.alertInfo("更改失败!");
-								_this.out_tips = "";
-								_this.detail_sn ="";
+								_this.zindex1 = 2;
+								_this.zindex2 = 1;
+								// 关闭模态框  
 								_this.sn = "";
+								_this.remark = "";
 								_this.outNum = 0;
+								this.updateModalVisible = false;
 								_this.getList();
 							}
 							
@@ -412,12 +461,19 @@
 							// console.log('complete');
 						}
 					})
-					// 关闭窗口后,恢复默认内容
-					this.$refs.inputDialog.close()
+					// // 关闭窗口后,恢复默认内容
+					// this.$refs.inputDialog.close()
 				}, 30)
 			},
 
-	
+			outNumChange: function(e) {
+				this.outNum = e.target.value
+			},
+			
+			remarkChange: function(e) {
+				this.remark = e.target.value
+			},
+			
 			dialogClose() {
 				_this.getList();
 			},
@@ -443,7 +499,7 @@
 						"container_code": _this.container_code,
 					}),
 					success: (ret) => {
-						//console.log(ret);
+						
 						//处理成功逻辑
 						if (ret.statusCode === 200) {
 							//console.log(ret.statusCode);