From d52b996f9ef0e78f7ae99b6b45985a04fcbf3f7e Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期六, 04 一月 2025 09:25:16 +0800 Subject: [PATCH] # --- pages/out/checkOut.vue | 130 +++++++++++++++++++++++++++++++++++-------- 1 files changed, 106 insertions(+), 24 deletions(-) diff --git a/pages/out/checkOut.vue b/pages/out/checkOut.vue index bc53f97..1f893b7 100644 --- a/pages/out/checkOut.vue +++ b/pages/out/checkOut.vue @@ -2,9 +2,10 @@ <view> <view class="code"> <view class="item"> - <view class="code-decs">绠卞彿:</view> - <input type="text" placeholder=" 鎵爜 / 杈撳叆" v-model="barcode" :focus="barcodeFocus" - @input="barcodeInput()"> + <view class="code-decs">鏉$爜:</view> + <textarea style="background-color: #f0f0f0;max-height: 100rpx;padding: 4px;margin: 4px;" + type="textarea" placeholder=" 鎵爜 / 杈撳叆" maxlength="1000" v-model="barcode" :focus="barcodeFocus" + @input="analysis()" /> </view> </view> <view class="mat-list-title"> @@ -14,29 +15,33 @@ <view class="list" v-for="(item,i) in dataList" :key="i"> <view class="list-left"> <view class="list-left-item"> + <view class="desc">瑙勬牸锛�</view> + <view class="left-item">{{item.matnr}}</view> + </view> + <view class="list-left-item"> <view class="desc">绠卞彿锛�</view> <view class="left-item"> <uni-tag :text="item.batch" type="primary"></uni-tag> </view> </view> <view class="list-left-item"> - <view class="desc">鍝佸悕锛�</view> - <view class="left-item">{{item.maktx}}</view> + <view class="desc">鍑�閲嶏細</view> + <view class="left-item">{{item.weight}}</view> </view> <view class="list-left-item"> - <view class="desc">瑙勬牸锛�</view> - <view class="left-item">{{item.specs}}</view> + <view class="desc">闀垮害锛�</view> + <view class="left-item">{{item.price}}</view> </view> <view class="list-left-item"> - <view class="desc">鎵瑰彿锛�</view> + <view class="desc">鍗峰彿锛�</view> <view class="left-item"> - <uni-tag :text="item.batch" type="warning"></uni-tag> + <uni-tag :text="item.model" type="warning"></uni-tag> </view> </view> <view class="list-left-item"> <view class="desc">鐘舵�侊細</view> <view class="left-item"> - <uni-tag :text="item.deadTime" type="error"></uni-tag> + <uni-tag :text="item.deadTime" :type="deadTimeType"></uni-tag> </view> </view> </view> @@ -135,7 +140,8 @@ matFocus: false, matData: '', removeNum: 0, - targetBatch: '' + targetBatch: '', + deadTimeType: 'error' } }, onLoad() { @@ -150,24 +156,91 @@ this.msgType1 = type this.$refs.message.open() }, - // barcode input 浜嬩欢 - barcodeInput() { + analysis() { let _this = this - let barcode = this.barcode.split(" ") - console.log(barcode); - this.targetBatch = barcode[1].slice(3) - console.log(this.targetBatch); - console.log(this.barcode); + var matObj= { + rollNo: '', // 鍗峰彿 + boxNo: '', // 绠卞彿 + specs: '', // 瑙勬牸 + length: '', // 闀垮害 + netWeight: '', // 鍑�閲� + grossWeight: '', // 姣涢噸 + splices: '', // 鎺ュご 涓� + } + // 鍒涘缓涓�涓� Map 瀵硅薄 + const resultMap = new Map(); + + // 浣跨敤鎹㈣绗︿綔涓哄垎闅旂鍒嗗壊瀛楃涓� + const lines = this.barcode.split('\n'); + console.log(lines); + lines.forEach(line => { + // 浣跨敤涓枃鍐掑彿浣滀负鍒嗛殧绗� + const match = line.split('锛�'); + if (match.length === 2) { + const key = match[0].trim(); // 涓枃閮ㄥ垎浣滀负閿� + const value = match[1].trim(); // 鍚庨潰鐨勫瓧绗︿覆浣滀负鍊� + resultMap.set(key, value); // 灏嗛敭鍊煎瀛樺叆 Map + } + }); + + // 杈撳嚭缁撴灉 + console.log(resultMap); + + + + // 濡傛灉闇�瑕佸皢 Map 杞崲涓烘櫘閫氬璞� + const resultObject = Object.fromEntries(resultMap); + console.log(resultObject.鍑�閲�); + console.log(lines); + matObj.rollNo = resultObject.鍗峰彿 + matObj.boxNo = resultObject.绠卞彿 + matObj.specs = resultObject.瑙勬牸 + matObj.length = resultObject.闀垮害 + matObj.netWeight = resultObject.鍑�閲� + matObj.grossWeight = resultObject.姣涢噸 + matObj.splices = resultObject.鎺ュご + + console.log(matObj); + this.barcodeInput(matObj) + // this.checkMatObj(matObj) + this.barcodeFocus = false; + this.matFocus = false; + setTimeout(() => { + this.matnr = ''; + this.matFocus = true; + }, 100); + }, + checkMatObj(mat) { + var len = this.dataList.length + var add = true + for (let k of this.dataList) { + if (mat.boxNo == k.boxNo) { + add = false + } + } + if (add) { + this.dataList.unshift(mat) + } + }, + // barcode input 浜嬩欢 + barcodeInput(code) { + let _this = this + let newBarcode = code uni.request({ url: _this.baseUrl + '/mobile/wrkDetl/search/batch/auth', header: {'token': uni.getStorageSync('token')}, - data: _this.barcode, + data: newBarcode, method:'POST', success(res) { res = res.data - console.log(res); if (res.code === 200) { + if (res.data.source === 1) { + _this.deadTimeType = "primary" + } else { + _this.deadTimeType = "error" + } _this.dataList.push(res.data) + console.log(_this.dataList); } else if (res.code == 403) { _this.messageText = res.msg _this.messageToggle('error') @@ -367,12 +440,21 @@ }, comb() { let that = this; + console.log(that.dataList[0]); + var matObj= { + rollNo: that.dataList[0].model, // 鍗峰彿 + boxNo: that.dataList[0].batch, // 绠卞彿 + specs: that.dataList[0].matnr, // 瑙勬牸 + length: that.dataList[0].price, // 闀垮害 + netWeight: that.dataList[0].weight, // 鍑�閲� + grossWeight: that.dataList[0].volume, // 姣涢噸 + splices: that.dataList[0].specs, // 鎺ュご 涓� + } uni.request({ url: that.baseUrl + '/mobile/order/search/batch/auth', - data: that.targetBatch, + data: matObj, method: 'POST', header: {'token': uni.getStorageSync('token')}, - method:'POST', success(result) { let res = result.data if (res.code === 200) { @@ -441,7 +523,7 @@ .item { display: flex; align-items: center; - height: 100rpx; + height: 130rpx; margin-left: 20rpx; border-bottom: 1px solid #DCDFE6; } @@ -473,7 +555,7 @@ width: 100%; background-color: white; position: fixed; - margin-top: 100rpx; + margin-top: 130rpx; z-index: 9; /* border-top: 1px solid #DCDFE6; */ text-align: center; -- Gitblit v1.9.1