From 153d2d110c7b43c4f8407ff3d851c7a4434b5c21 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期四, 18 十二月 2025 17:25:37 +0800
Subject: [PATCH] #
---
pages/out/checkOut.vue | 100 +++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 87 insertions(+), 13 deletions(-)
diff --git a/pages/out/checkOut.vue b/pages/out/checkOut.vue
index c51f9c1..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">
@@ -155,13 +156,76 @@
this.msgType1 = type
this.$refs.message.open()
},
- // barcode input 浜嬩欢
- barcodeInput() {
+ analysis() {
let _this = this
- let newBarcode = this.barcode
- let barcode = this.barcode.split(" ")
- this.targetBatch = barcode[1].slice(3)
- this.barcode = barcode[1].slice(3)
+ 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')},
@@ -176,6 +240,7 @@
_this.deadTimeType = "error"
}
_this.dataList.push(res.data)
+ console.log(_this.dataList);
} else if (res.code == 403) {
_this.messageText = res.msg
_this.messageToggle('error')
@@ -375,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) {
@@ -449,7 +523,7 @@
.item {
display: flex;
align-items: center;
- height: 100rpx;
+ height: 130rpx;
margin-left: 20rpx;
border-bottom: 1px solid #DCDFE6;
}
@@ -481,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