From f1befa80c8e88d3c2cd7d2f268c4b8678d2108e8 Mon Sep 17 00:00:00 2001 From: whycq <123456> Date: 星期一, 16 五月 2022 22:11:44 +0800 Subject: [PATCH] # --- pages/basics/outPakin.vue | 146 +++++++++++++++++++++++------------------------- 1 files changed, 71 insertions(+), 75 deletions(-) diff --git a/pages/basics/outPakin.vue b/pages/basics/outPakin.vue index 883b3b8..795c19b 100644 --- a/pages/basics/outPakin.vue +++ b/pages/basics/outPakin.vue @@ -21,7 +21,7 @@ </view> <view class="square-content"> <view class="content-input"> - <input v-model="matnr" type="text" placeholder="鎵爜 / 杈撳叆" @input="findMat()" + <input v-model="matnrId" type="text" placeholder="鎵爜 / 杈撳叆" @input="findMat()" :focus="focus" @focus="focuss" > <!-- @focus="focuss" --> <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons> @@ -37,14 +37,14 @@ <view class="square-none" v-show="matList.length === 0"> <view class="v-show">鏆傛棤鏇村鏁版嵁...</view> </view> - <checkbox-group @change="checkbox"> + <checkbox-group > <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" > <view class="data-list-left"> - <text>No:{{listLen-index}}</text> + <view class="matnr">No:{{listLen-index}}</view> <view class="matnr">{{item.matnr}}-{{item.batch}}</view> </view> <view class="data-list-right"> - <uni-icons type="trash" size="25" color="#a5a5a5" @click="remove(item,index)"></uni-icons> + <uni-icons type="trash" size="20" color="#a5a5a5" @click="remove(item,index)"></uni-icons> </view> </view> </checkbox-group> @@ -56,6 +56,12 @@ <view> <button class="cu-btn lg pakin-btn bg-blue" @click="comb()">缁勬墭</button> </view> + </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> @@ -71,12 +77,16 @@ type: 'center', searchBox: 'hide', pick:'hide', - matnr:'', + matnrId:'', + // matList:[{matnr:'1101842-10000',batch:'22047515999'}], matList:[], result: '', - listLen:0 + listLen:0, + msgType: 'success', + messageText: '杩欐槸涓�鏉℃垚鍔熸彁绀�', } }, + mounted(){ const UIP = uni.getStorageSync('UIP'); this.baseIP = UIP; @@ -84,16 +94,21 @@ this.basePORT = UPORT }, methods: { - getListLength() { - this.listLen = this.matList.length + messageToggle(type) { + this.msgType = type + this.messageText = `杩欐槸涓�鏉�${type}娑堟伅鎻愮ず` + this.$refs.message.open() }, focuss() { - uni.hideKeyboard() + // setInterval(function(){ + // uni.hideKeyboard() + // },20) + // uni.hideKeyboard() }, resst() { this.matList = [] this.barcode = '' - this.matnr = '' + this.matnrId = '' uni.vibrateShort(); }, removeBarcode() { @@ -105,16 +120,19 @@ }); }, removeMatnr() { - this.matnr = '' - uni.vibrateShort(); + this.focus = false; this.$nextTick(function() { this.focus = true; }); + this.matnrId = '' + uni.vibrateShort(); }, remove(item,index) { this.matList.splice(index,1) this.listLen = this.matList.length + this.messageToggle('success') + this.messageText = '鍒犻櫎鎴愬姛' uni.vibrateShort(); }, comb() { @@ -148,6 +166,9 @@ position: 'bottom', duration: 1000 }); + that.barcode = ''; + that.matList = ''; + that.matList = []; } else if (res.code == 403) { uni.showToast({title: res.msg, icon: "none", position: 'top'}) setTimeout(() => { @@ -161,34 +182,17 @@ } }); }, - selectMat() { - let that = this - uni.vibrateShort(); - uni.showLoading(); - uni.navigateTo({ - url: "matSelect", - events: { - // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� - acceptDataFromOpenedPage: function(data) { - that.matnr = data.data - that.findMat(that.matnr) - }, - }, - success: function(res) { - // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� - res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT }) - } - }); - that.matnr = '' - }, + findMat() { let that = this - let str = that.matnr.split('-') - that.matnr = str[0]+'-'+str[1] + let str = that.matnrId.split('-') + let matnr = str[0]+'-'+str[1] + // that.matnr = str[0]+'-'+str[1] + uni.showLoading(); uni.request({ url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mat/auth', data: { - matnr:that.matnr + matnr:matnr }, header: { 'token':uni.getStorageSync('token') @@ -197,7 +201,6 @@ uni.vibrateShort(); let res = result.data if (res.code === 200 && res.data) { - that.matnr = '' let add = true; if(res.data) { let mat = res.data; @@ -205,31 +208,43 @@ mat['anfme'] = 1 for(let i = 0;i < that.matList.length;i++) { if(that.matList[i].batch == str[2]) { + that.messageToggle('warn'); + that.messageText = '閲嶅鎵弿'; + that.focus = false; + that.$nextTick(function() { + that.focus = true; + }); add = false; break; } } } if(add) { + that.messageToggle('success'); + that.messageText = '妫�绱㈡垚鍔�'; + that.focus = false; + that.$nextTick(function() { + that.focus = true; + }); + // uni.hideKeyboard(); that.matList.unshift(res.data) } - that.focus = false; - that.$nextTick(function() { - that.focus = true; - }); - uni.hideKeyboard(); - that.listLen = that.matList.length + that.matnrId = '' + that.listLen = that.matList.length; + uni.hideLoading(); } else if (res.code == 403) { - that.messageToggle('warn') + that.messageToggle('error') that.messageText = res.msg setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000); + uni.hideLoading(); } else { - that.messageToggle('warn') + that.messageToggle('error') that.messageText = res.msg + uni.hideLoading(); // uni.showToast({title: res.msg, icon: "none",position: 'top'}) } } @@ -240,35 +255,12 @@ change(e) { console.log('褰撳墠妯″紡锛�' + e.type + ',鐘舵�侊細' + e.show); }, - toggle(type) { - this.type = type - // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴�� - this.$refs.goodsSearch.open(type) - }, - checkbox: function (e) { - var items = this.data, - values = e.detail.value; - for (var i = 0, lenI = items.length; i < lenI; ++i) { - const item = items[i] - item.id = item.id + '' - if(values.indexOf(item.id) >= 0){ - this.$set(item,'checked',true) - }else{ - this.$set(item,'checked',false) - } - } - if (values.length == items.length) { - this.check = true - this.checkText = "鍙栨秷鍏ㄩ��" - } else { - this.check = false - this.checkText = "鍏ㄩ��" - } - uni.vibrateShort(); - }, + } } </script> + + <style> /* @import "../../colorui/main.css"; @@ -388,7 +380,7 @@ } .data-list { border-bottom: 1px solid #d8d8d8; - height: 90rpx; + height: 130rpx; margin: 15rpx; border-radius: 20rpx; } @@ -410,17 +402,21 @@ display: inline-block; float: left; margin-left: 6%; - height: 90rpx; + height: 130rpx; + /* line-height: 100rpx; */ color: #676767; } .matnr { - padding-top: 10rpx; + font-size: 14px; + font-weight: 700; + /* padding-top: 15rpx; */ + padding-top: 15rpx; } .data-list-right { display: inline-block; float: right; - height: 90rpx; - line-height: 90rpx; + height: 130rpx; + line-height: 130rpx; margin-right: 10%; } </style> \ No newline at end of file -- Gitblit v1.9.1