From 2d256c80b73cb675a210f750d01360cb689bc870 Mon Sep 17 00:00:00 2001
From: whycq0520 <91384184@qq.com>
Date: 星期五, 25 三月 2022 17:04:54 +0800
Subject: [PATCH] #

---
 pages/basics/publish.vue |  150 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 120 insertions(+), 30 deletions(-)

diff --git a/pages/basics/publish.vue b/pages/basics/publish.vue
index fa5e409..182f96f 100644
--- a/pages/basics/publish.vue
+++ b/pages/basics/publish.vue
@@ -3,45 +3,56 @@
 		<view>
 			<uni-table border stripe type="selection" emptyText="娌℃湁鏇村鏁版嵁">
 				<uni-tr>
-					<uni-th>鏁伴噺</uni-th>
-					<uni-th>鎵瑰彿</uni-th>
-					<uni-th>鍟嗗搧缂栧彿</uni-th>
-					<uni-th>鍟嗗搧鍚嶇О</uni-th>
-					<uni-th>瑙勬牸</uni-th>
-					<uni-th>鍗曚环</uni-th>
-					<uni-th>鎿嶄綔</uni-th>
+					<uni-th align="center">鏁伴噺</uni-th>
+					<uni-th align="center">鎵瑰彿</uni-th>
+					<uni-th align="center">鍟嗗搧缂栧彿</uni-th>
+					<uni-th align="center">鍟嗗搧鍚嶇О</uni-th>
+					<uni-th align="center">瑙勬牸</uni-th>
+					<uni-th align="center">鍗曚环</uni-th>
+					<uni-th align="center">鎿嶄綔</uni-th>
+				</uni-tr>
+				<uni-tr v-for="(item,index) in stockInData" :key="index">
+					<uni-td width="50">
+						<view class="flex justify-center">
+							<button class="cu-btn bg-orange sm" style="width: 60rpx;" @click="changeCount(index,item)">{{item.count}}</button>
+						</view>
+					</uni-td>
+					<uni-td align="center" width="50">{{item.batch}}</uni-td>
+					<uni-td align="center" width="100">{{item.matnr}}</uni-td>
+					<uni-td align="center" width="100">{{item.maktx}}</uni-td>
+					<uni-td align="center" width="50">{{item.specs}}</uni-td>
+					<uni-td align="center" width="50">{{item.price}}</uni-td>
+					<uni-td align="center" width="50">绌�</uni-td>
 				</uni-tr>
 			</uni-table>
 		</view>
 		<view class="cu-bar foot input justify-center" style="height: 150rpx;">
 			<view style="width: 80%;">
 				<button class="cu-btn bg-yellow lg shadow-blur" style="width: 250rpx;color: #fff;" @click="getMat()">鏂� 澧�</button>
-				<button class="cu-btn bg-orange lg shadow-blur" style="float: right;width: 250rpx;color: #fff;">纭鍏ュ簱</button>
+				<button class="cu-btn bg-orange lg shadow-blur" style="float: right;width: 250rpx;color: #fff;" @click="confirm()">纭鍏ュ簱</button>
 			</view>	
 		</view>
 		<!-- ******************************************************************************************* -->
 		<view>
-			<!-- 鏅�氬脊绐� -->
-			<uni-popup ref="popup" background-color="#fff" style="position: fixed; border-radius: 5px;" >
-				<view class="popup-content " :class="{ 'popup-height': type === 'left' || type === 'right' }">
-					<view style="height: 900rpx;width: 700rpx;">
-						<view><text>鍏抽棴</text></view>
-						<view>
-							<scroll-view scroll-x="true" @scroll="scroll" scroll-left="120">
-								<uni-table border stripe type="selection" emptyText="娌℃湁鏇村鏁版嵁">
-									<uni-tr>
-										<uni-th>鍟嗗搧缂栧彿</uni-th>
-										<uni-th>鍟嗗搧鍚嶇О</uni-th>
-										<uni-th>瑙勬牸</uni-th>
-										<uni-th>鍗曚环</uni-th>
-										<uni-th>淇敼鏃堕棿</uni-th>
-									</uni-tr>
-								</uni-table>
-							</scroll-view>
-						</view>
+			<!-- 淇敼鏁伴噺寮规 -->
+			<uni-popup ref="inputDialog" type="dialog">
+				<uni-popup-dialog ref="inputClose" mode="input" title="鐗╂枡鏁伴噺" @confirm="dialogInputConfirm">
+						<uni-number-box  :max="999" v-model="value" />
+				</uni-popup-dialog>
+			</uni-popup>
+		</view>
+		<view>
+			<!-- 鎻愮ず淇℃伅寮圭獥 -->
+			<uni-popup ref="message" type="message">
+				<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
+			</uni-popup>
+		</view>
+		<view>
+			<!-- 鏄剧ず琛ㄥ崟寮圭獥 -->
+			<uni-popup ref="showNodeSelect" type="dialog">
+				<uni-popup-dialog ref="inputClose" mode="input" title="閫夋嫨鍏ュ簱璐т綅" >
 						
-					</view>
-				</view>
+				</uni-popup-dialog>
 			</uni-popup>
 		</view>
 	</view>
@@ -52,8 +63,12 @@
 		data() {
 			return {
 				type:'bottom',
+				stockInData: [],
+				value:'',
+				rowNum:'',
+				msgType: '',
+				messageText: '',
 			}
-			
 		},
 		mounted(){
 			const UIP = uni.getStorageSync('UIP');
@@ -68,13 +83,88 @@
 				// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴��
 				this.$refs.popup.open(type)
 			},
+			// 鎻愰啋寮圭獥
+			messageToggle(type) {
+				this.msgType = type
+				this.messageText = '鎻愬彇澶辫触'
+				this.$refs.message.open()
+			},
 			getMat() {
 				let that = this
-				console.log(that.baseHttp,that.baseIP,that.basePORT,that.baseUrl)
 				uni.navigateTo({
 				    url: 'stockIn?baseIP=' + that.baseIP + '&basePORT=' + that.basePORT
 				});
 			},
+			// 鍒濆鍖栦笂鏋舵暟閲�
+			initCount() {
+				this.stockInData.forEach(function(element){
+					element.count = 0
+				})
+			},
+			otherFun(object){ // 鎺ユ敹涓婁釜椤甸潰鐨勪紶鍊�
+				let that = this
+				if(!!object){
+					if ( that.stockInData.length == 0 ) {
+						that.stockInData = object
+					} else {
+						that.addSotokInData(object)
+					}
+					
+					
+				}
+				that.initCount()
+			},
+			addSotokInData(object) {
+				let that = this
+				for (var i = 1; i < object.length; i++) {
+					var toPush = true
+					for (var j = 0; j < that.stockInData.length; j++) {
+						if (object[i].matnr == that.stockInData[j].matnr) {
+							toPush = false
+						}
+					}
+					if (toPush) {
+						that.stockInData.push(object[i])
+					}
+					
+				}
+			},
+			// 淇敼鏁伴噺
+			changeCount(index,item) {
+				this.$refs.inputDialog.open()
+				this.rowNum = index
+				this.value = 0
+			},
+			// 淇敼鏁伴噺寮圭獥
+			dialogInputConfirm() {
+				this.stockInData[this.rowNum].count = this.value
+			},
+			// 纭鍏ュ簱
+			confirm() {
+				let that = this
+				if (that.stockInData.length == 0) {
+					that.messageToggle('error')
+					that.messageText = '璇峰厛娣诲姞鐗╂枡'
+					return;
+				}
+				for (var i = 0; i < that.stockInData.length; i++) {
+					if (that.stockInData[i].count === 0){
+					    that.messageToggle('error')
+					    that.messageText = '鏁伴噺涓嶈兘涓洪浂'
+					    return;
+					}
+				}
+				this.$refs.showNodeSelect.open()
+				uni.request({
+					url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/work/stock/pakin",
+					header: { 'token':uni.getStorageSync('token') },
+					data: {},
+					method:'POST',
+					success(res) {
+						console.log(res)
+					}
+				})
+			}
 		}
 	}
 </script>

--
Gitblit v1.9.1