From 066b803e929f2bc6ef0356a781f4e2907efdd1a9 Mon Sep 17 00:00:00 2001 From: whycq <whycq> Date: 星期二, 22 二月 2022 16:48:31 +0800 Subject: [PATCH] 12 --- pages/basics/stockCheck.vue | 206 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 195 insertions(+), 11 deletions(-) diff --git a/pages/basics/stockCheck.vue b/pages/basics/stockCheck.vue index f45e227..ace4fcf 100644 --- a/pages/basics/stockCheck.vue +++ b/pages/basics/stockCheck.vue @@ -1,17 +1,75 @@ <template> <view> <view class="cu-form-group margin-top"> - <view class="title">鍑哄簱鍙�</view> - <picker @change="PickerChange" :value="index" :range="picker"> - <view class="picker"> - {{index>-1?picker[index]:'璇烽�夋嫨'}} - </view> - </picker> - <button></button> + <view> + 鍑哄簱鍙� + </view> + <view class="uni-list-cell-db"> + <picker @change="bindPickerChange" :value="index" :range="array" range-key="name"> + <view class="uni-input">{{array[index]}}</view> + </picker> + </view> + <view> + <button v-model="matBtn" class="cu-btn bg-yellow" @click="toggle('right')"><text>+琛ュ厖</text></button> + </view> + </view> + <view class="margin-top"> + <uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁"> + <uni-tr> + <uni-th width="50">鏁伴噺</uni-th> + <uni-th width="100">浜у搧ID</uni-th> + <uni-th width="100">浜у搧鍚嶇О</uni-th> + <uni-th width="100">搴撲綅</uni-th> + </uni-tr> + <uni-tr v-for="(item, index) in locDetlData" :key="index"> + <uni-td>{{item.count}}</uni-td> + <uni-td>{{item.matNo}}</uni-td> + <uni-td>{{item.matName}}</uni-td> + <uni-td>{{item.locNo}}</uni-td> + </uni-tr> + </uni-table> + </view> <view> - <button class="cu-btn bg-yellow pda-btn">纭</button> - <button class="cu-btn bg-grey pda-btn">閲嶇疆</button> + <button class="cu-btn bg-yellow pda-btn">纭� 璁�</button> + <button class="cu-btn bg-grey pda-btn">閲� 缃�</button> + </view> + <view> + <uni-popup ref="popup" background-color="#fff" style="width: 500rpx;"> + <view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }"> + <view class="cu-form-group margin-top"> + <text>琛ュ厖浜у搧</text> + </view> + <view class="cu-form-group margin-top"> + <text class="title">浜у搧ID</text> + <input type="text" v-model="matNo" placeholder="鎵爜 / 杈撳叆" name="input" autocomplete="off" focus @input="find()"> + </view> + <view class="cu-form-group margin-top"> + <text class="title">浜у搧鍚嶇О</text> + <input type="text" name="input" autocomplete="off" v-model="matName"> + </view> + <view class="cu-form-group margin-top"> + <text class="title">瑙勬牸鍨嬪彿</text> + <input type="text" name="input" autocomplete="off" v-model="specs"> + </view> + <view class="cu-form-group margin-top"> + <text class="title">鍗曚綅</text> + <input type="text" name="input" autocomplete="off" v-model="unit"> + </view> + <view class="cu-form-group margin-top"> + <text class="title">鏁伴噺</text> + <uni-number-box @change="countDom" v-model="count" /> + </view> + <button class="cu-btn bg-yellow pda-btn2" @click="confirm">琛ュ厖</button> + + </view> + </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> </template> @@ -20,11 +78,137 @@ export default { data() { return { - picker: ['+琛ュ厖', '姹豹姹�', '鍝煎敡鍝煎敡'], + index: 0, + array: [], + matBtn:'', + souceData:[], // 鍒濆鍖栬〃鏍兼暟鎹褰� + locDetlData:[], + matNo:'', + matName:'', + specs:'', + unit:'', + count:'0', + type: '', + msgType:'', + messageText:'', } }, + onLoad(){ + let that = this + // 鑾峰彇鍑哄簱鍙� + uni.request({ + url: that.baseHttp + that.baseIP + that.baseUrl + "/available/take/check/site", + header: { + 'token':uni.getStorageSync('token') + }, + method: 'POST', + async: false, + success(res){ + if(res.data.code === 200){ + that.array = res.data.data + } + } + }) + }, methods: { - + bindPickerChange: function(e) { + this.index = e.detail.value + }, + // 鎻愬彇 + toggle(type) { + this.type = type + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴�� + this.$refs.popup.open(type) + }, + messageToggle(type) { + this.msgType = type + this.messageText = '鎻愬彇澶辫触' + this.$refs.message.open() + }, + countDom(value) { + + }, + find(){ + let that = this + let thatId = that.matNo + if(that.matNo.length===0){ + return; + } + uni.request({ + url: that.baseHttp + that.baseIP + that.baseUrl + "/matCode/auth", + header: { + 'content-type':'application/x-www-form-urlencoded', + 'token':uni.getStorageSync('token') + }, + data: { + id:thatId + }, + method: 'POST', + success(res){ + let data = res.data.data + + if(res.data.code === 200){ + if(data != null){ + that.matName = data.matName + that.specs = data.specs + that.unit = data.unit + } + } else if (res.data.code ===403 ){ + // 寰呭畾 + } else { + // 寰呭畾 + } + } + }) + }, + confirm(){ + let that = this + let data = { + matNo:that.matNo, + matName:that.matName, + count:that.count + } + that.addTableData(data) + + }, + initTableData(data){ + for(var i=0;i<data.length;i++){ + var toPush =true + for(var j = 0; j<this.locDetlDate.length;j++){ + if (data[i].matNo === this.locDetlData[j].matNo && data[i].locNo === this.locDetlData[j].locNo) { + toPush = false; + } + } + if(toPush){ + this.locDetlDate.push(data[i]) + } + } + }, + addTableData(data){ + let that = this + if(data.matNo.length === 0){ + that.messageToggle('error') + that.messageText = '鎻愬彇澶辫触' + return + } + this.$refs.popup.close() + var toPush = true + for (var j = 0; j < this.locDetlData.length; j++) { + if (data.matNo === this.locDetlData[j].matNo && data.locNo === this.locDetlData[j].locNo) { + toPush = false; + } + } + if (toPush) { + var pushData = { + locNo: this.locDetlData[0] ? this.locDetlData[0].locNo : null, + matNo: data.matNo, + count: data.count, + matName: data.matName + } + locDetlData.push(pushData); + } + + }, } } </script> -- Gitblit v1.9.1