From 34e81b3d0fe9ae1e9edd4fd8bcdaf7ec69b7f239 Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期五, 27 六月 2025 09:00:45 +0800 Subject: [PATCH] 12 --- pages/stock/stockCheck.vue | 202 +++++++++++++++++++++++++++----------------------- 1 files changed, 110 insertions(+), 92 deletions(-) diff --git a/pages/stock/stockCheck.vue b/pages/stock/stockCheck.vue index cd83df3..dbebda6 100644 --- a/pages/stock/stockCheck.vue +++ b/pages/stock/stockCheck.vue @@ -4,20 +4,11 @@ <view class="item"> <view class="code-decs">鎵樼洏鐮�:</view> <input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="barcode" :focus="barcodeFocus" - @confirm="barcodeInput()"> - </view> - <view class="item"> - <view class="code-decs">鐗╂枡鐮�:</view> - <input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="matnr" :focus="matFocus" @input="findMat()"> - <view class="item-right"> - <button></button> - <text style="text-align: right;color: #409EFF;" @click="selectMat()">鎻愬彇+</text> - <uni-icons type="right" color="#c1c1c1"></uni-icons> - </view> - </view> + @input="search()"> + </view> </view> <view class="mat-list-title"> - 鍟嗗搧鍒楄〃 + 鐗╂枡鍒楄〃 </view> <scroll-view> <view class="list" v-for="(item,i) in dataList" :key="i"> @@ -43,24 +34,30 @@ <view class="list-left-item"> <view class="desc">鎵瑰彿锛�</view> <view class="left-item"> - <uni-tag :text="item.batch" type="warning"></uni-tag> + {{item.batch}} </view> </view> <view class="list-left-item"> - <view class="desc">鏁伴噺锛�</view> - <view class="left-item">{{item.anfme}}</view> + <view class="desc">搴撳瓨锛�</view> + <view class="left-item"> + {{item.anfme}} + </view> + </view> + <view class="list-left-item"> + <view class="desc">鐩樼偣锛�</view> + <view class="left-item">{{item.checkAnfme}}</view> </view> </view> <view class="list-right"> <uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons> - <uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons> + <!-- <uni-icons type="trash" color="#f58a8a" size="24" @click="remove(item,i,'warn')"></uni-icons> --> </view> </view> </scroll-view> <!-- 搴曢儴鎿嶄綔鎸夐挳 --> <view class="buttom"> <button size="mini" @click="reset('warn')">閲嶇疆</button> - <button size="mini" type="primary" @click="combConfirm('warn')">缁勬墭</button> + <button size="mini" type="primary" @click="combConfirm('warn')">纭</button> </view> <!-- 寮圭獥 --> <!-- 淇敼鏁伴噺 --> @@ -77,9 +74,10 @@ </view> </view> <view class="popup-item"> - <view class="popup-item-left">鍚堝悓鍙�:</view> - <view class="popup-item-right"><input type="text" v-model="batch"></view> - </view> + <view class="popup-item-left">鎵瑰彿:</view> + <view class="popup-item-right"><input type="text" v-model="batch" disabled="true" + style="background-color: #f7f7f7;padding: 0;color: #d5d5d5;"></view> + </view> <view class="popup-item"> <view class="popup-item-left">鏁伴噺:</view> <view class="popup-item-right" style="border: none;justify-content: center;"> @@ -111,7 +109,7 @@ <view> <uni-popup ref="combConfirm" type="dialog"> <uni-popup-dialog :type="msgType" cancelText="鍙栨秷" confirmText="纭" :title="title" :content="content" - @confirm="comb" @close="combClose"></uni-popup-dialog> + @confirm="adjust" @close="combClose"></uni-popup-dialog> </uni-popup> </view> <!-- 纭閲嶇疆 --> @@ -159,23 +157,42 @@ this.msgType1 = type this.$refs.message.open() }, - // barcode input 浜嬩欢 - barcodeInput() { - // 涓嶈缃畾鏃跺櫒 浼氬嚭鐜版壂鍏ョ殑瀛楃涓蹭笉鍏� - setTimeout(() => { - var len = this.barcode.length - if (len != 8) { - uni.showToast({ - title: '鎵樼洏鐮佹湁璇閲嶈瘯', - icon: "none", - position: 'top' - }); - this.barcodeFocuss() - return; + // 鏍规嵁鎵樼洏鐮佹悳绱� + search() { + let that = this + if(that.barcode === "" || that.barcode === null || that.barcode === ''){ + return + } + uni.request({ + url: that.baseUrl + '/inventoryCheckOrder/StockCheck/select/barcode', + header: { + 'token':uni.getStorageSync('token') + }, + data: {barcode: that.barcode}, + method:'GET', + success(res) { + console.log(res); + res = res.data + if(res.code === 200){ + for(var i = 0; i < res.data.length;i++){ + that.dataList.push(res.data[i]) + } + } else if (res.code == 403) { + uni.showToast({title: res.msg, icon: "none", position: 'top'}) + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + } else { + that.dataList = [] + uni.showToast({title: res.msg, icon: "none",position: 'top'}) + } } - this.focuss() - }, 200) + + }) }, + // 鎵樼洏鐮佹湁璇噸缃� barcodeFocuss() { let that = this; @@ -308,7 +325,7 @@ // 淇敼鎵瑰彿 revise(item, i) { this.matnr = this.dataList[i].matnr - this.count = this.dataList[i].anfme + this.count = this.dataList[i].checkAnfme this.batch = this.dataList[i].batch this.rowNum = i this.eject() @@ -335,7 +352,7 @@ this.$refs.alertDialog.close() }, reviseConfirm() { - this.dataList[this.rowNum].anfme = this.count + this.dataList[this.rowNum].checkAnfme = this.count this.dataList[this.rowNum].batch = this.batch this.messageText = "淇敼鎴愬姛" this.messageToggle('success') @@ -350,62 +367,11 @@ combConfirm(type) { this.msgType = type this.title = '璀﹀憡' - this.content = '鏄惁鐜板湪缁勬墭!' + this.content = '鏄惁纭鐩樼偣!' this.$refs.combConfirm.open() }, combClose() { this.$refs.combConfirm.close() - }, - comb() { - uni.vibrateShort(); - let that = this; - if (that.barcode === '') { - this.messageText = "璇锋壂鎻忔墭鐩樻潯鐮�" - this.messageToggle('error') - return; - } - if (that.dataList.length === 0) { - this.messageText = "璇锋坊鍔犲晢鍝佸垪琛�" - this.messageToggle('error') - return; - } - for (var i = 0; i < that.dataList.length; i++) { - if (that.dataList[i].anfme == 0 || that.dataList[i].anfme == '') { - this.messageText = that.dataList[i].matnr + '缁勬墭鏁伴噺涓嶈兘涓�0' - this.messageToggle('error') - return; - } - } - uni.request({ - url: that.baseUrl + '/mobile/comb/auth', - data: JSON.stringify({ - barcode: that.barcode, - combMats: that.dataList - }), - method: 'POST', - header: { - 'token': uni.getStorageSync('token') - }, - success(result) { - var res = result.data - if (res.code === 200) { - that.resst(); - that.messageText = "缁勬墭鎴愬姛" - that.messageToggle('success') - } else if (res.code == 403) { - that.messageText = res.msg - that.messageToggle('error') - setTimeout(() => { - uni.reLaunch({ - url: '../login/login' - }); - }, 1000); - } else { - that.messageText = res.msg - that.messageToggle('error') - } - } - }); }, reset(type) { this.msgType = type @@ -416,6 +382,7 @@ // 纭閲嶇疆 resetConfirm() { this.dataList = [] + this.barcode = '' this.messageText = "閲嶇疆瀹屾垚" this.messageToggle('success') }, @@ -429,6 +396,46 @@ this.barcode = '' this.barcodeFocuss() }, + adjust() { + let that = this + + for (var i = 0; i < that.dataList.length; i++) { + if (that.dataList[i].checkAnfme == 0 || that.dataList[i].checkAnfme == '' || that.dataList[i].checkAnfme == null) { + this.messageText = that.dataList[i].matnr + '鐩樼偣鏁伴噺涓嶈兘涓�0' + this.messageToggle('error') + return; + } + } + var combMats = [] + var combParam = {} + combParam['barcode'] = that.barcode + combParam['param'] = that.dataList + uni.request({ + url: that.baseUrl + '/mobile/pda/adjust/auth', + method: 'POST', + data: JSON.stringify(combParam), + header: { + 'token':uni.getStorageSync('token') + }, + success(result) { + var res = result.data + if (res.code === 200) { + that.dataList = [] + that.barcode = '' + uni.showToast({title: res.msg, icon: "none", position: 'top'}) + } else if (res.code == 403) { + uni.showToast({title: res.msg, icon: "none", position: 'top'}) + setTimeout(() => { + uni.reLaunch({ + url: '../login/login' + }); + }, 1000); + } else { + uni.showToast({title: res.msg, icon: "none",position: 'top'}) + } + }, + }); + }, } } </script> @@ -439,7 +446,7 @@ .code { width: 100%; position: fixed; - min-height: 200rpx; + min-height: 100rpx; background-color: #FFF; z-index: 10; } @@ -479,10 +486,21 @@ width: 100%; background-color: white; position: fixed; - margin-top: 200rpx; + margin-top: 100rpx; z-index: 9; /* border-top: 1px solid #DCDFE6; */ text-align: center; box-shadow: 0px 0px 30px 0px rgba(0, 0, 0, 0.5); } + .list { + display: flex; + min-height: 80rpx; + background-color: #FFF; + margin: 20rpx 20rpx; + border-radius: 20rpx; + box-shadow: 0px 0px 30px 0px rgba(0,0,0,0.2); + } + .list:first-child { + margin-top: 250rpx; + } </style> -- Gitblit v1.9.1