From 4aa1546dda1adf637a8d612c6dc0a535532294b4 Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期一, 17 四月 2023 12:28:56 +0800 Subject: [PATCH] # --- pages/basics/checkout.vue | 155 ++++++++++++++++++++++++++++++++++----------------- 1 files changed, 104 insertions(+), 51 deletions(-) diff --git a/pages/basics/checkout.vue b/pages/basics/checkout.vue index 6fa26c5..00f264b 100644 --- a/pages/basics/checkout.vue +++ b/pages/basics/checkout.vue @@ -1,6 +1,6 @@ <template> <view > - <scroll-view scroll-y catch:touchmove="touchmove"> + <scroll-view scroll-y class="scroll-Y"> <view class="square-2"> <view class="square-title"> <view class="title-sign"><view class="sign"></view></view> @@ -9,7 +9,7 @@ <view class="square-content"> <view class="content-input"> <input v-model="barcode" type="text" placeholder="鎵爜 / 杈撳叆" maxlength="8" - @input="findBarcode()" :focus="barcodeFocus" @focus="focuss" > + @input="findBarcode()" :focus="barcodeFocus" > <uni-icons type="closeempty" size="20" color="#dadada" @click="removeBarcode()"></uni-icons> </view> </view> @@ -22,7 +22,7 @@ <view class="square-content"> <view class="content-input-combox" style="width: 94%;"> <input style="width: 90%;" type="text" v-model="matnr" placeholder="鎵爜 / 杈撳叆" @input="findMat()":focus="focus" - @focus="focuss"> + > <!-- @focus="focuss" --> <uni-icons type="closeempty" size="20" color="#dadada" @click="removeMatnr()"></uni-icons> </view> @@ -33,10 +33,11 @@ <view class="square-title"> <view class="title-sign"><view class="sign"></view></view> <view class="title-text"><text>鍟嗗搧鍒楄〃</text></view> + <view v-show="matCount > 0" style="display: inline-block;float: right;height: 100rpx;line-height: 100rpx;margin-right: 50rpx;">璇锋壂鐮侀�夊彇 {{matCount}} 浠跺晢鍝�</view> </view> </view> <view class="square-none" v-show="matList.length === 0"> - <view class="v-show">璇锋壂鐮侀�夊彇 {{matCount}} 浠跺晢鍝�</view> + <view class="v-show">鏆傛棤鏇村鏁版嵁. . . </view> </view> <checkbox-group @change="checkbox"> <view v-for="(item,index) in matList" :key="index" class="data-list bg-false" :class="'bg-'+item.checked" > @@ -72,6 +73,7 @@ export default { data() { return { + commonUrl:null, barcode: '', barcodeFocus:true, focus:false, @@ -83,14 +85,14 @@ matList:[], result: '', siteList:[], - desc:'', staNoList:[], satNo:'', listLen:0, msgType: 'success', messageText: '杩欐槸涓�鏉℃垚鍔熸彁绀�', fontColor:{color:'red'}, - matCount:'0' + matCount:'', + wrkNo:'', } }, onReady() { @@ -99,38 +101,52 @@ // this.getMatListLen() },1000) }, + onLoad() { + // #ifdef APP + setInterval(()=>{ + uni.hideKeyboard() + },20) + // #endif + }, mounted(){ const UIP = uni.getStorageSync('UIP'); 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 + }, + // 鍑哄簱鍒嗕负涓ょ 涓�:鍏ㄦ澘鍑哄簱 鎵弿鎵樼洏鐮佹樉绀哄叏鏉垮晢鍝� 鍙互鐩存帴纭 浜屾槸鍑忔枡鍑哄簱 鎵弿鎵樼洏鐮佹彁绀洪渶瑕佸嚭搴撴暟閲� 鎵弿璐у搧鏉$爜杈惧埌鏈�澶у嚭搴撴暟閲忓嵆鍙� messageToggle(type) { this.msgType = type this.messageText = `杩欐槸涓�鏉�${type}娑堟伅鎻愮ず` this.$refs.message.open() }, - choseStaNo() { - for (var i = 0;i < this.staNoList.length; i++) { - if (this.desc == this.staNoList[i].desc) { - this.staNo = this.staNoList[i].siteId - } - } - }, getMatListLen() { // this.listLen = this.matList.length; }, focuss() { - // uni.hideKeyboard() + let that = this; + that.barcodeFocus = false; + setTimeout(()=>{ + that.barcode = '' + that.barcodeFocus = true; + }, 100); }, resst() { this.matList = [] this.barcode = '' this.matnr = '' - this.desc = '' + this.matCount = '' + this.removeBarcode(); uni.vibrateShort(); + }, removeBarcode() { this.barcode = '' @@ -139,6 +155,16 @@ this.$nextTick(function() { this.barcodeFocus = true; }); + }, + foucss() { + // #ifdef APP + let that = this; + that.focus = false; + setTimeout(()=>{ + that.matnr = ''; + that.focus = true; + }, 100); + // #endif }, removeMatnr() { this.matnr = '' @@ -179,7 +205,7 @@ findBarcode() { let that = this uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth/v2', + url: that.commonUrl + '/mobile/pakout/confirm/barcode/auth', data: { barcode:that.barcode }, @@ -187,10 +213,20 @@ 'token':uni.getStorageSync('token'), }, success(result) { + console.log('findBarcode:' + result.data); let res = result.data; if (res.code === 200) { - if (res.data) { - that.matCount = res.data.length + if (res.data.ioType === 101) { + that.matList = res.data.list.concat(that.matList) + that.listLen = that.matList.length; + that.foucss(); + return; + } + if (res.data.ioType === 103 || res.data.ioType === 104 || res.data.ioType === 107) { + that.matCount = res.data.list.length + that.wrkNo = res.data.list[0].wrkNo + that.foucss(); + return; } } else if (res.code === 403) { uni.showToast({title: res.msg, icon: "none", position: 'top'}) @@ -201,6 +237,7 @@ }, 1000); } else { uni.showToast({title: res.msg, icon: "none",position: 'top'}) + that.focuss() } } @@ -209,10 +246,22 @@ }, findMat() { let that = this + if(that.barcode == '') { + uni.showToast({title: '璇峰厛鎵弿鎵樼洏鐮侊紒', icon: "none",position: 'top'}) + that.focuss() + setTimeout(function() { + that.matnr = '' + }, 100); + return; + } + if (that.matCount == that.matList.length) { + uni.showToast({title: '璇风‘璁ゅ嚭搴撴暟閲忥紒', icon: "none",position: 'top'}) + return; + } uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/query/auth/v2', + url: that.commonUrl + '/mobile/pakout/confirm/pick/auth', data: { - staNo:that.staNo, + wrkNo:that.wrkNo, matnr:that.matnr }, header: { @@ -221,27 +270,22 @@ success(result) { var res = result.data; if(res.code === 200 ) { - if(res.data) { - for(let i = 0;i<that.matList.length;i++) { - for (let j = 0;j < res.data.length; j++) { - if(JSON.stringify(that.matList[i]) === JSON.stringify(res.data[j])) { - res.data.splice(j,1) - } + var add = true + if(res.data) { + for(let i = 0;i < that.matList.length; i++) { + var matnr = that.matList[i].matnr + '-' + that.matList[i].batch + if (matnr === that.matnr) { + that.messageToggle('warn'); + that.messageText = '璇ュ晢鍝佸凡娣诲姞'; + that.foucss(); + add = false } } - if (that.matList.length < that.matCount) { - that.matList = res.data.concat(that.matList) + if (add) { + that.matList.unshift(res.data); that.listLen = that.matList.length; - that.focus = false; - that.$nextTick(function() { - that.focus = true; - }); - that.matnr = '' - } else { - that.messageToggle('warn') - that.messageText = '鍟嗗搧宸插叏閮ㄦ坊鍔�' + that.foucss(); } - } } else if (res.code == 403) { uni.showToast({title: res.msg, icon: "none", position: 'top'}) @@ -252,23 +296,39 @@ }, 1000); } else { uni.showToast({title: res.msg, icon: "none",position: 'top'}) + that.foucss(); } } }); }, comb() { - uni.vibrateShort(); let that = this; - uni.showLoading(); + if (that.barcode === '') { + this.messageToggle('error') + this.messageText = '璇锋壂鎻忔墭鐩樼爜' + return; + } + if (that.barcode.length !== 8) { + this.messageToggle('error') + this.messageText = '鎵樼洏鐮佸繀椤讳负8浣�' + return; + } + if (that.matList.length === 0) { + this.messageToggle('error') + this.messageText = '璇锋坊鍔犲晢鍝佸垪琛�' + return; + } + if (that.matList.length < that.matCount) { var len = that.matCount - that.matList.length that.messageToggle('error') that.messageText = '杩樺墿' + len + '浠舵湭鎵弿' return; } + uni.showLoading(); uni.request({ - url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + '/mobile/pakout/confirm/auth', + url: that.commonUrl + '/mobile/pakout/confirm/auth', data: that.matList, method: 'POST', header: { @@ -278,15 +338,8 @@ uni.showLoading(); var res = result.data if (res.code === 200) { - uni.showToast({ - title: res.msg, - position: 'bottom', - duration: 1000 - }); - that.matList = [] - that.barcode = '' - that.matnr = '' - that.desc = '' + uni.showToast({ title: res.msg,position: 'bottom',duration: 1000}); + that.resst(); } else if (res.code == 403) { uni.showToast({title: res.msg, icon: "none", position: 'top'}) setTimeout(() => { @@ -339,7 +392,7 @@ <style> /* @import "../../colorui/main.css"; @import "../../colorui/icon.css"; */ - + .pak-seach-box { background-color: #FFFFFF; margin: 15rpx 15rpx 0rpx 15rpx; -- Gitblit v1.9.1