From 4fc751c2bcf4e4d328f915a77df7fb5b86657d61 Mon Sep 17 00:00:00 2001 From: whycq <123456> Date: 星期二, 16 八月 2022 16:26:15 +0800 Subject: [PATCH] # --- pages/basics/pakin.vue | 190 ++++++++++++++++++++--------------------------- 1 files changed, 80 insertions(+), 110 deletions(-) diff --git a/pages/basics/pakin.vue b/pages/basics/pakin.vue index 92d886e..e382528 100644 --- a/pages/basics/pakin.vue +++ b/pages/basics/pakin.vue @@ -8,8 +8,8 @@ </view> <view class="square-content"> <view class="content-input"> - <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" placeholder-style="margin-top:10px" maxlength="10" - :focus="barcodeFocus" @confirm="barcodeInput()"> + <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="10" + :focus="barcodeFocus" placeholder-style="line-height: 85rpx;"> <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons> </view> </view> @@ -22,14 +22,14 @@ <view class="title-text"><text>妫�绱㈠晢鍝�</text></view> </view> <view class="square-content"> - <view class="content-input"> + <view class="content-input-btn"> <input v-model="matnr" type="text" placeholder="鎵爜 / 杈撳叆" @input="findMat()" - :focus="focus" placeholder-style="margin-top:9px"> + :focus="focus" placeholder-style="line-height: 85rpx;"> <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons> </view> - <!-- <view class="content-btn"> + <view class="content-btn"> <button class="cu-btn bg-blue pda-btn" @click="selectMat()">+鎻愬彇</button> - </view> --> + </view> </view> </view> @@ -52,15 +52,15 @@ <!-- <view> <checkbox :value="item.id+''" :checked="item.checked" style="display: block;" /> </view> --> - <view class="matnr"><text style="width: 400rpx;">缂栫爜锛歿{item.matNo}}</text></view> - <view><text style="width: 400rpx;">鍝佸悕锛歿{item.matName}}</text></view> - <view><text style="width: 400rpx;">瑙勬牸锛歿{item.str2}}</text></view> + <view class="matnr"><text style="width: 400rpx;">缂栫爜锛歿{item.matnr}}</text></view> + <view><text style="width: 400rpx;">鍝佸悕锛歿{item.maktx}}</text></view> + <view><text style="width: 400rpx;">鎵瑰彿锛歿{item.batch}}</text></view> <view> - <text style="width: 400rpx;">鏁伴噺锛歿{item.count}}</text> + <text style="width: 400rpx;">鏁伴噺锛歿{item.anfme}}</text> </view> </view> <view class="data-list-right"> - <label><uni-icons type="compose" size="20" color="#a5a5a5" @click="revise(index)"></uni-icons></label> + <label><uni-icons type="compose" size="20" color="#a5a5a5" @click="revise(item,index)"></uni-icons></label> <label><uni-icons type="trash" size="25" color="#a5a5a5" @click="remove(item,index)"></uni-icons></label> </view> </view> @@ -87,19 +87,18 @@ <!-- 寮圭獥 --> <!-- 淇敼鏁伴噺 --> - - <uni-popup ref="revise" background-color="#fff"> + <uni-popup ref="revise" background-color="#fff" @change="change"> <view class="revise-box"> <view class="revise-box-top"> <view class="color-block-blue"></view> <text class="title">缁勬墭鏁伴噺</text> </view> <view class="text-box"> - <text>纭缁勬墭鏁伴噺</text> + <text>鍙粍鏁伴噺锛歿{enableQty}}</text> </view> <view class="changeBox"> <view class="num-box"> - <uni-number-box v-model="counts" :min="0" :max="99999" color="#747474" /> + <uni-number-box v-model="count" :min="minCount" :max="maxCount" color="#747474" @change="changeValue"/> </view> </view> <view class="revise-box-buttom"> @@ -117,6 +116,7 @@ export default { data() { return { + commonUrl:null, barcode: '', barcodeFocus:true, focus:false, @@ -128,7 +128,6 @@ result: '', enableQty:'', count:'', - counts:'', minCount:0, maxCount:'', rowNum:'', @@ -148,23 +147,26 @@ this.baseIP = UIP; const UPORT = uni.getStorageSync('UPORT'); this.basePORT = UPORT + const PROJ = uni.getStorageSync('UPROJ'); + this.baseUrl = PROJ + this.getUrl() }, methods: { + // 鑾峰彇url + getUrl() { + this.commonUrl = this.baseHttp + this.baseIP + ':' +this.basePORT + "/" +this.baseUrl + }, // barcode input 浜嬩欢 barcodeInput() { - // 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏� - setTimeout(()=>{ - var len = this.barcode.length - if (len != 8) { - uni.showToast({title: '鎵樼洏鐮佹湁璇閲嶈瘯', icon: "none", position: 'top'}); - this.barcodeFocuss() - return; - } - if (len == 8) { - this.focuss() - } - },100) - + var len = this.barcode.length + if (len != 8) { + uni.showToast({title: '鎵樼洏鐮佹湁璇閲嶈瘯', icon: "none", position: 'top'}); + this.barcodeFocuss() + return; + } + if (len == 8) { + this.focuss() + } }, // 鎵樼洏鐮佹湁璇噸缃� barcodeFocuss() { @@ -210,8 +212,13 @@ this.focus = true; }); }, - remove(item,index) { - this.matList.splice(index,1) + remove() { + // this.matList.splice(index,1) + for (var i = 0; i < this.matList.length; i++) { + if (this.matList[i].checked == true) { + this.matList.splice(i,1) + } + } this.checkList(); uni.vibrateShort(); }, @@ -228,7 +235,7 @@ } uni.showLoading(); uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/comb/auth', + url: that.commonUrl + '/mobile/comb/auth', data: JSON.stringify({ barcode: that.barcode, combMats: that.matList @@ -274,7 +281,7 @@ }, success: function(res) { // 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹� 鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑 - res.eventChannel.emit('acceptDataFromOpenerPage', {baseIP:that.baseIP, basePORT:that.basePORT }) + res.eventChannel.emit('acceptDataFromOpenerPage', {commonUrl:that.commonUrl }) }, }); @@ -283,9 +290,9 @@ findMat() { let that = this uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/matCode/auth', + url: that.commonUrl + '/mat/auth', data: { - id:that.matnr + matnr:that.matnr }, header: { 'token':uni.getStorageSync('token') @@ -302,6 +309,7 @@ // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� matList: function(data) { that.matList.push(data.data) + console.log(that.matList) }, }, success: function(res) { @@ -325,38 +333,47 @@ this.$refs.goodsSearch.open(type) }, checkbox: function (e) { - // var items = this.matList, - // 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(); + var items = this.matList, + 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(); }, - revise(index) { + revise(item,index) { + var maxCount = this.matList[index].maxCount + if (maxCount == undefined ) { + this.matList[index]["maxCount"] = item.enableQty + } + this.enableQty = item.enableQty + this.count = this.minCount + this.maxCount = item.maxCount this.rowNum = index - this.$refs.revise.open() + this.eject() + }, + eject(type) { + this.type = type + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴�� + this.$refs.revise.open(type) + }, + changeValue() { }, - changeCount(e) { - - }, - // 纭缁勬墭鏁伴噺 confirm() { - this.matList[this.rowNum].count = this.counts - this.$forceUpdate() // 寮哄埗鍒锋柊 + this.matList[this.rowNum].anfme = this.count this.$refs.revise.close() }, // 鍒楄〃鍙嶉�� @@ -517,13 +534,12 @@ height: 180rpx; margin: 15rpx; border-radius: 20rpx; - font-size: 12px; } .data-list:first-child { margin-top: 20rpx; } .data-list:last-child { - margin-bottom: 170rpx; + margin-bottom: 120rpx; } /* .data-list-left { display: inline-block; @@ -560,50 +576,4 @@ width: 80rpx; height: 180rpx; } - .revise-box { - width: 500rpx; - height: 500rpx; - } - .revise-box-top { - width: 100%; - height: 100rpx; - background-color: #fff; - padding: 10rpx; - } - .changeBox { - width: 100%; - height: 100rpx; - line-height: 120rpx; - text-align: center; - background-color: #FFF; - margin-top: 20rpx; - border-bottom: 1px solid #e3e3e3; - } - .text-box { - width: 100%; - height: 100rpx; - line-height: 120rpx; - text-align: center; - /* padding-left: 120rpx; */ - background-color: #FFF; - margin-top: 20rpx; - border-bottom: 1px solid #e3e3e3; - } - .changeBox .num-box { - display: inline-block; - /* float: left; */ - } - .changeBox button { - float: left; - } - .revise-box-buttom { - position: absolute; - width: 100%; - height: 100rpx; - line-height: 100rpx; - background-color: #FFFFFF; - bottom: 0; - text-align: center; - } - </style> \ No newline at end of file -- Gitblit v1.9.1