From 22bcd46c2b55d6d1f0c9a25071a268f2daf5125a Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期二, 26 十一月 2024 15:00:08 +0800
Subject: [PATCH] #

---
 pages/home/home.vue      |    8 +
 pages.json               |    9 +
 pages/pakin/delCheck.vue |  341 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 App.vue                  |    2 
 4 files changed, 359 insertions(+), 1 deletions(-)

diff --git a/App.vue b/App.vue
index 8147dc3..f6e3e8c 100644
--- a/App.vue
+++ b/App.vue
@@ -133,7 +133,7 @@
 	.nav-li {
 		padding: 30upx;
 		border-radius: 12upx;
-		width: 36%;
+		width: 90%;
 		margin: 0 2.5% 40upx;
 		/* background-image: url(https://cdn.nlark.com/yuque/0/2019/png/280374/1552996358352-assets/web-upload/cc3b1807-c684-4b83-8f80-80e5b8a6b975.png); */
 		background-size: cover;
diff --git a/pages.json b/pages.json
index 1152794..b4ef775 100644
--- a/pages.json
+++ b/pages.json
@@ -277,6 +277,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/pakin/delCheck",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "鍙戣揣鏍稿",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
diff --git a/pages/home/home.vue b/pages/home/home.vue
index 5496ad7..e7e1b34 100644
--- a/pages/home/home.vue
+++ b/pages/home/home.vue
@@ -38,6 +38,14 @@
 						cuIcon: 'pullup',
 						url: '/pakin/repairPakin'
 					},
+					{
+						// delivery 鎶曢�掍氦璐�
+						title: '鍙戣揣鏍稿',
+						name: 'delCheck',
+						color: 'yellow',
+						cuIcon: 'pullup',
+						url: '/pakin/delCheck'
+					},
 					// {
 					// 	title: '鍏ュ簱',
 					// 	name: 'Pakin',
diff --git a/pages/pakin/delCheck.vue b/pages/pakin/delCheck.vue
new file mode 100644
index 0000000..fbe6fc6
--- /dev/null
+++ b/pages/pakin/delCheck.vue
@@ -0,0 +1,341 @@
+<template>
+	<view>
+		<view class="combox">
+			<view style="flex: 1;"><uni-combox :candidates="orderNoList" placeholder="璇烽�夋嫨璁㈠崟" v-model="orderNo" @input="getOrderDet"></uni-combox></view>
+			<view style="width: 80px;display: flex;align-items: center;justify-content: center;"><button size="mini" type="primary" @click="getOrderDetlByOrderNo()">妫�绱�</button></view>
+		</view>
+		<view class="list-header" style="display: flex;text-align: start;align-items: center;padding: 8px;">
+			<text style="width: 6em;">鎵爜纭</text>
+			<view style="width: 10px;"></view>
+			<textarea style="background-color: #f0f0f0;max-height: 100rpx;padding: 4px;margin: 4px;font-weight: normal;"
+				type="textarea" placeholder=" 鎵爜 / 杈撳叆" maxlength="1000" v-model="matnr" :focus="matFocus" 
+				@input="analysis2()" />
+		</view>
+		<view class="list-header">
+			<text>璁㈠崟鏄庣粏</text>
+		</view>
+		<!-- 鍖呰缁勫彿锛歿{item.packageGroupNo}} -->
+		<view class="order-item" v-for="item in orderList">
+			<view style="flex: 1;">鍖呰缁勫彿锛歿{item.packageGroupNo}}</view>
+			<view style="width: 30px;" v-show="item.checked">
+				<uni-icons type="checkbox-filled" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons>
+			</view>
+			<view style="width: 30px;" v-show="!item.checked">
+				<uni-icons type="checkbox-filled" color="#c3c3c3" size="24" @click="revise(item,i)"></uni-icons>
+			</view>
+			
+		</view>
+		<view style="height: 60px;"></view>
+		<view class="orderDetl-none" v-if="orderList.length == 0">鏆傛棤鏄庣粏</view>
+		
+		<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
+		<view class="buttom">
+			<button size="mini" @click="reset('warn')">閲嶇疆</button>
+			<button size="mini" type="primary" @click="combConfirm('warn')">鍙戣揣鏍稿</button>
+		</view>
+		<!-- 纭缁勬墭 -->
+		<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>
+			</uni-popup>
+		</view>
+		<!-- 纭閲嶇疆 -->
+		<view>
+			<uni-popup ref="resetConfirm" type="dialog">
+				<uni-popup-dialog :type="msgType" cancelText="鍙栨秷" confirmText="纭" :title="title" :content="content"
+					@confirm="resetConfirm" @close="resetClose"></uni-popup-dialog>
+			</uni-popup>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				baseUrl: '',
+				token: '',
+				orderNoList: [],
+				orderNo: '',
+				orderList: [],
+				matnr: '',
+				matFocus: true,
+				msgType: 'success',
+				messageText: '',
+				title: '',
+				content: '',
+				
+			}
+		},
+		onShow() {
+			this.baseUrl = uni.getStorageSync('baseUrl');
+			this.token = uni.getStorageSync('token');
+		},
+		methods: {
+			getOrderDet() {
+				let _this = this
+				if (_this.orderNo.length == 0) {
+					_this.orderList = []
+					_this.orderNoList = []
+					return
+				}
+				uni.request({
+					url: `${_this.baseUrl}/mobile/getOrderNoList/${_this.orderNo}`,
+					header: { 'token': uni.getStorageSync('token') },
+					method: 'GET',
+					success(res) {
+						res = res.data
+						if (res.code === 200 ) {
+							_this.orderNoList = res.data
+						} else if (res.code === 403) {
+							uni.showToast({ title: res.msg, icon: "error", position: 'center' })
+							setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
+						} else {
+							uni.showToast({ title: res.msg, icon: "error", position: 'center' })
+						}
+					}
+				})
+			},
+			getOrderDetlByOrderNo() {
+				let _this = this
+				uni.request({
+					url: `${_this.baseUrl}/mobile/getOrderDetlByOrderNo/${_this.orderNo}`,
+					header: { 'token': uni.getStorageSync('token') },
+					method: 'GET',
+					success(res) {
+						res = res.data
+						if (res.code === 200 ) {
+							for	(let k of res.data) {
+								var item = {packageGroupNo: '',checked:false}
+								console.log(k);
+								item.packageGroupNo = k 
+								_this.orderList.push(item)
+							}
+							// console.log(_this.orderList);
+							// _this.orderList = res.data
+						} else if (res.code === 403) {
+							uni.showToast({ title: res.msg, icon: "error", position: 'center' })
+							setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
+						} else {
+							uni.showToast({ title: res.msg, icon: "error", position: 'center' })
+						}
+					}
+				})
+			},
+			choseOne() {
+				let _this = this
+				uni.navigateTo({
+					url: './orderSelect',
+					success(res) {
+						res.eventChannel.emit('matList', {
+							matList: _this.dataList
+						})
+					},
+					events: {
+						pickList: function(data) {
+							}
+					}
+				})
+			},
+			analysis2() {
+				const data = this.matnr
+				const parseData = (data) => {
+				    const lines = data.split('\n');
+				    const t = {
+						boxPos: '宸�',
+				        packageGroupNo: '',
+				        rollType: '',
+						boxType: '',
+				        thickness: '',
+				        wideInWidth: '',
+				        totalGrossWeight: '',
+				        totalNetWeight: '',
+				        rolls: []
+				    };
+					
+					// console.log(lines);
+				    // 瑙f瀽鍩烘湰淇℃伅
+				    lines.forEach(line => {
+				        if (line.startsWith('鍖呰缁勫彿锛�')) t.packageGroupNo = line.split('锛�')[1].trim();
+				        else if (line.startsWith('绠¤姱绫诲瀷锛�')) t.rollType = line.split('锛�')[1].trim();
+						else if (line.startsWith('鏈ㄧ绫诲瀷锛�')) t.boxType = line.split('锛�')[1].trim();
+				        else if (line.startsWith('鍘氬害锛�')) t.thickness = line.split('锛�')[1].trim();
+				        else if (line.startsWith('瀹藉箙锛�')) t.wideInWidth = line.split('锛�')[1].trim();
+				        else if (line.startsWith('鎬绘瘺閲嶏細')) t.totalGrossWeight = line.split('锛�')[1].trim();
+				        else if (line.startsWith('鎬诲噣閲嶏細')) t.totalNetWeight = line.split('锛�')[1].trim();
+				    });
+				
+				    // 瑙f瀽鍗峰彿淇℃伅
+				    let rollData = {};
+					let roll = {
+						rollNo: '',
+						boxNo: '',
+						specs: '',
+						length: '',
+						splices: '',
+						netWeight: '',
+						grossWeight: '',
+						fqTime: '',
+					}
+				    lines.forEach(line => {
+				        const match = line.match(/鍗峰彿(\d+)锛�(.+)/) || line.match(/绠卞彿(\d+)锛�(.+)/) || line.match(/瑙勬牸(\d+)锛�(.+)/) ||
+				                      line.match(/闀垮害(\d+)锛�(.+)/) || line.match(/鍑�閲�(\d+)锛�(.+)/) || line.match(/姣涢噸(\d+)锛�(.+)/) ||
+				                      line.match(/鎺ュご(\d+)锛�(.+)/) || line.match(/鍒嗗垏鏃堕棿(\d+)锛�(.+)/);
+				        
+				        if (match) {
+				            const index = match[1]; // 鑾峰彇搴忓彿
+				            const key = match[0].split('锛�')[0]; // 鑾峰彇鍙傛暟鍚嶇О
+				            const value = match[2].trim(); // 鑾峰彇鍙傛暟鍊�
+							
+							
+				            // 鍒濆鍖栧嵎淇℃伅瀵硅薄
+				            if (!rollData[index]) rollData[index] = {};
+				            rollData[index][key] = value;
+							if (!roll[index]) roll[index] = {};
+							if (key.startsWith('鍗峰彿')) roll[index].rollNo = value;
+							else if (key.startsWith('绠卞彿')) roll[index].boxNo = value;
+							else if (key.startsWith('瑙勬牸')) roll[index].specs = value;
+							else if (key.startsWith('闀垮害')) roll[index].length = value.replace(/[^0-9]/ig, "");
+							else if (key.startsWith('鍑�閲�')) roll[index].netWeight = value.replace(/[^0-9]/ig, "");
+							else if (key.startsWith('姣涢噸')) roll[index].grossWeight = value.replace(/[^0-9]/ig, "");
+							else if (key.startsWith('鎺ュご')) roll[index].splices = value.replace(/[^0-9]/ig, "");
+							else if (key.startsWith('鍒嗗垏鏃堕棿')) roll[index].fqTime = value;
+				
+				            // 濡傛灉鏈夋墍鏈夊弬鏁帮紝鍒欏皢鍏舵帹鍏� rolls 鏁扮粍
+				            if (Object.keys(rollData[index]).length === 8) { // 鎵�鏈夊瓧娈甸兘宸茬粡濉厖
+				                t.rolls.push(rollData[index]);
+				                rollData[index] = {}; // 閲嶇疆浠ュ噯澶囦笅涓�涓嵎
+				            }
+							
+				        }
+				    });
+				    return t;
+				};
+				
+				const result = parseData(data);
+				// console.log(result);
+				this.secAnalysis(result)
+				// if (this.dataList.length > 0) this.checkAdd(result)
+				// else this.dataList.push(result);
+				// this.focuss()
+			
+			},
+			secAnalysis(data) {
+				for (let k of this.orderList) {
+					if (data.packageGroupNo == k.packageGroupNo) {
+						if (k.checked) {
+							uni.showToast({ title: '褰撳墠鏉$爜宸茬‘璁�', icon: "error", position: 'center' })
+						} else {
+							uni.showToast({ title: '纭鎴愬姛', icon: "success", position: 'center' })
+							k.checked = true
+						}
+					}
+				}
+				this.focuss()
+			},
+			focuss() {
+				this.matFocus = false;
+				setTimeout(() => {
+					this.matnr = '';
+					this.matFocus = true;
+				}, 100);
+			},
+			reset(type) {
+				this.msgType = type
+				this.title = '璀﹀憡'
+				this.content = '鏄惁閲嶇疆!'
+				this.$refs.resetConfirm.open()
+			},
+			combConfirm(type) {
+				this.msgType = type
+				this.title = '璀﹀憡'
+				this.content = '鏄惁鐜板湪鏍稿!'
+				this.$refs.combConfirm.open()
+			},
+			combClose() {
+				this.$refs.combConfirm.close()
+			},
+			comb() {
+				let _this = this
+				for (let k of this.orderList) {
+					if (!k.checked) {
+						uni.showToast({ title: `鍖呰鍙�${ k.packageGroupNo},杩樻湭纭` , icon: "error", position: 'center' })
+						return
+					}
+				}
+				uni.request({
+					url: `${_this.baseUrl}/mobile/pdaFhhd`,
+					header: { 'token': uni.getStorageSync('token') },
+					data: {orderNo: _this.orderNo},
+					method: 'POST',
+					success(res) {
+						res = res.data
+						if (res.code === 200 ) {
+							_this.orderList = [],
+							_this.orderNo = ''
+							uni.showToast({ title: res.msg, icon: "success", position: 'center' })
+						} else if (res.code === 403) {
+							uni.showToast({ title: res.msg, icon: "error", position: 'center' })
+							setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
+						} else {
+							uni.showToast({ title: res.msg, icon: "error", position: 'center' })
+						}
+					}
+				})
+			},
+			// 纭閲嶇疆
+			resetConfirm() {
+				this.orderList = [],
+				this.orderNo = ''
+				this.messageText = "閲嶇疆瀹屾垚"
+				this.messageToggle('success')
+			},
+			// 鍙栨秷閲嶇疆
+			resetClose() {
+			
+			},
+		}
+	}
+</script>
+
+<style>
+	.combox {
+		background-color: white;
+		padding: 8px;
+		display: flex;
+	}
+	.list-header {
+		border-top: 1px solid #eee;
+		background-color: white;
+		text-align: center;
+		min-height: 70rpx;
+		line-height: 70rpx;
+		color: #555;
+		font-weight: bold;
+	}
+	.order-item {
+		margin: 8px;
+		padding: 16px;
+		background-color: white;
+		border-radius: 10px;
+		display: flex;
+	}
+	.orderDetl-none {
+		height: 100vh;
+		text-align: center;
+		line-height: 50vh;
+		color: #aaa;
+	}
+	.buttom {
+		width: 100%;
+		position: fixed;
+		bottom: 0;
+		left: 0;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		height: 100rpx;
+		background-color: #FFF;
+	}
+</style>

--
Gitblit v1.9.1