From 248ef3ba3de9994dc83d2b36690542893f9fb6e6 Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期四, 28 十一月 2024 16:26:06 +0800
Subject: [PATCH] #

---
 pages/phyz/order/orderList.vue |  244 +++++++++++++++++++++++++++++++-----------------
 1 files changed, 155 insertions(+), 89 deletions(-)

diff --git a/pages/phyz/order/orderList.vue b/pages/phyz/order/orderList.vue
index a6012ee..fba7117 100644
--- a/pages/phyz/order/orderList.vue
+++ b/pages/phyz/order/orderList.vue
@@ -15,16 +15,32 @@
 				<view>缂栧彿锛歿{item.matnr}}</view>
 				<view>鍚嶇О锛歿{item.maktx}}</view>
 				<view>瑙勬牸锛歿{item.specs}}</view>
-				<view>鏁伴噺锛歿{item.anfme}}</view>
+				<view>鎵瑰彿锛歿{item.batch}}</view>
+				<view class="list-anfme">鏁伴噺锛歿{item.anfme}}</view>
+				<view class="list-qty-1" v-if="item.anfme > item.qty">浣滀笟鏁伴噺锛歿{item.qty}}</view>
+				<view class="list-qty-2" v-if="item.anfme <= item.qty">浣滀笟鏁伴噺锛歿{item.qty}}</view>
 				<view class="card-id">{{i + 1}}</view>
 			</view>
 			<view class="list-right" @click="checkboxChange(item)">
 				<label >
-					<checkbox :value="item.orderNo" :checked="item.checked" color="#FFCC33" style="transform:scale(0.7)" /><text></text>
+					<checkbox :value="item.orderNo" :checked="item.checked" color="" :disabled="item.anfme <= item.qty" style="transform:scale(0.7)" /><text></text>
 				</label>
 			</view>
 		</view>
 		<view style="height: 100rpx;"></view>
+		
+		<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
+		<view class="buttom" v-if="orderType == 'in'">
+			<button size="mini" @click="reset('warn')">閲嶇疆</button>
+			<button size="mini" type="primary" @click="combConfirm('warn')">鍘荤粍鎵�</button>
+		</view>
+		
+		<!-- 搴曢儴鎿嶄綔鎸夐挳 -->
+		<view class="buttom" v-if="orderType == 'out'">
+			<button size="mini" @click="reset('warn')">閲嶇疆</button>
+			<button size="mini" type="primary" @click="combConfirm2('warn')">鍘诲嚭搴�</button>
+		</view>
+		
 	</view>
 </template>
 
@@ -32,103 +48,88 @@
 	export default {
 		data() {
 			return {
+				baseUrl: '',
+				token: '',
+				orderId: '',
 				matFocus: true,
 				matnr: '',
 				checck: true,
-				dataList: [
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931255',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z',
-						checked: true
-					},
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931241',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z'
-					},
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931225',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z'
-					},
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931241',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z'
-					},
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931241',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z'
-					},
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931241',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z'
-					},
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931241',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z'
-					},
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931241',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z'
-					},
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931241',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z'
-					},
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931241',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z'
-					},
-					{
-						orderNo: 'cg0931241',
-						matnr: 'cg0931241',
-						maktx: '浣犲ソ',
-						anfme: 10,
-						specs: '10-z'
-					},
-				],
+				dataList: [],
 				oldDataList: [],
 				newDataList: [],
 				allCheck: false,
-				allCheckBtnTitle: '鍏ㄩ��'
+				allCheckBtnTitle: '鍏ㄩ��',
+				orderType: 'out'
 			}
 		},
+		onLoad() {
+			let that = this
+			this.baseUrl = uni.getStorageSync('baseUrl');
+			this.token = uni.getStorageSync('token');
+			// const eventChannel = this.$scope.eventChannel; // 鍏煎APP-NVUE
+			const eventChannel = this.getOpenerEventChannel();
+			
+			// 鐩戝惉acceptDataFromOpenerPage浜嬩欢锛岃幏鍙栦笂涓�椤甸潰閫氳繃eventChannel浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
+			eventChannel.on('item', function(data) {
+				console.log(data);
+				that.orderId = data.item.orderId 
+				console.log(data.item.id);
+				uni.setNavigationBarTitle({
+					title: data.item.orderNo,
+					
+				})
+				that.getOrderDetl(data.item.id)
+				that.orderType = 'in'
+			})
+			eventChannel.on('item1', function(data) {
+				console.log(data);
+				that.orderId = data.item.orderId 
+				console.log(data.item.id);
+				uni.setNavigationBarTitle({
+					title: data.item.orderNo,
+					
+				})
+				that.getOrderDetl(data.item.id)
+				that.orderType = 'out'
+			})
+		},
 		onShow() {
-			this.oldDataList = [...this.dataList]
+			if (this.dataList.length > 0) {
+				this.oldDataList = [...this.dataList]
+			}
+			// this.getOrderDetl(this.orderId)
 		},
 		methods: {
+			// 璁㈠崟鏄庣粏
+			getOrderDetl(id) {
+				let _this = this
+				uni.request({
+					url: `${_this.baseUrl}/orderDetl/list/auth`,
+					header: {'token': uni.getStorageSync('token')},
+					data: {
+						curr: 1,
+						limit: 1000,
+						order_id: id
+					},
+					method: 'GET',
+					success(res) {
+						res = res.data
+						console.log(res);
+						if (res.code === 200) {
+							res.data.records
+							_this.dataList = res.data.records
+							
+							_this.oldDataList = [..._this.dataList]
+						} 
+					}
+				})
+			},
 			matInput() {
 				let count = 0
 				let sign = 0
-				this.dataList = [...this.oldDataList]
+				if (this.oldDataList.length > 0) {
+					this.dataList = [...this.oldDataList]
+				}
 				this.newDataList = []
 				for (let k in this.dataList) {
 					if (!this.dataList[k].matnr.includes(this.matnr)) {
@@ -160,7 +161,12 @@
 				if (e.checked) {
 					this.$set(e,'checked',false)
 				} else {
-					this.$set(e,'checked',true)
+					if (e.anfme == e.qty) {
+						this.$set(e,'checked',false)
+					} else {
+						this.$set(e,'checked',true)
+					}
+					
 				}
 			},
 			allChecked() {
@@ -173,7 +179,11 @@
 				}
 				for (let item of this.dataList) {
 					if (this.allCheck) {
-						this.$set(item,'checked',true)
+						if (item.anfme == item.qty) {
+							this.$set(item,'checked',false)
+						} else {
+							this.$set(item,'checked',true)
+						}
 					} else {
 						this.$set(item,'checked',false)
 					}
@@ -182,12 +192,68 @@
 			clear() {
 				this.matnr = ''
 				this.dataList = [...this.oldDataList]
-			}
+			},
+			combConfirm(type) {
+				let _this = this
+				let combList = []
+				for (let k of _this.dataList) {
+					k['csocode'] = k.threeCode
+					if (k.checked) {
+						combList.push(k)
+					}
+				}
+				if (combList.length == 0) {
+					uni.showToast({ title: '璇烽�夋嫨缁勬墭鍟嗗搧', icon: "error", position: 'top'})
+					return
+				}
+				uni.navigateTo({
+					url: "../AGV/AGVPakin3",
+					success: function(res) {
+						// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�   鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑
+						res.eventChannel.emit('mats', {
+							mats: combList
+						})
+					},
+				});
+			},
+			combConfirm2(type) {
+				let _this = this
+				let combList = []
+				for (let k of _this.dataList) {
+					if (k.checked) {
+						combList.push(k)
+					}
+				}
+				if (combList.length == 0) {
+					uni.showToast({ title: '璇烽�夋嫨鍑哄簱鍟嗗搧', icon: "error", position: 'top'})
+					return
+				}
+				uni.navigateTo({
+					url: "./preview",
+					success: function(res) {
+						// 閫氳繃eventChannel鍚戣鎵撳紑椤甸潰浼犻�佹暟鎹�   鍚戝彟澶栦竴涓〉闈紶閫掑�肩殑
+						res.eventChannel.emit('mats', {
+							mats: combList
+						})
+					},
+				});
+			},
 		}
 	}
 </script>
 
 <style>
 	@import url('../../../static/css/common/order.css');
-	
+	.list-anfme {
+		color: #0082ff;
+		font-weight: bold;
+	}
+	.list-qty-1 {
+		color: #33ba43;
+		font-weight: bold;
+	}
+	.list-qty-2 {
+		color: #e2231a;
+		font-weight: bold;
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.1