From 5596cc695d444d9ef13661148d6e227f8ed3171e Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123 <819527061@qq.com>
Date: 星期四, 28 七月 2022 20:25:37 +0800
Subject: [PATCH] '冲突解决'

---
 pages/new-application-form-data/new-application-form-data.vue |  103 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 62 insertions(+), 41 deletions(-)

diff --git a/pages/new-application-form-data/new-application-form-data.vue b/pages/new-application-form-data/new-application-form-data.vue
index 3d75a8e..dc1bf80 100644
--- a/pages/new-application-form-data/new-application-form-data.vue
+++ b/pages/new-application-form-data/new-application-form-data.vue
@@ -363,7 +363,7 @@
 							<u-form-item label="鎶戝皹璐�" labelWidth="18%" borderBottom ref="item1"><u--input v-model="addContractFormdata.cost2" border="none"></u--input></u-form-item> -->
 						</u--form>
 
-						<view class="addContractConfirm"><u-button text="娣诲姞" type="primary" @click="addContractSanConfirm"></u-button></view>
+						<view class="addContractConfirm"><u-button :text="editApplicationIndex != null ? '娣诲姞淇敼':'娣诲姞'" type="primary" @click="addContractSanConfirm"></u-button></view>
 					</view>
 
 					<!-- 閫夋嫨鐓ゅ巶 -->
@@ -540,12 +540,12 @@
 			<view class="balanceNo" v-if="accountDetails.balanceTotal < 0"><text style="color:red;">瀹㈡埛璐︽埛褰撳墠澶勪簬娆犳鐘舵��</text></view>
 
 			<view class="messageCustomerBalance" v-if="accountDetails.balanceTotal >= 0">
-				<text style="color: #FFA500;;">瀹㈡埛璐︽埛鐜版眹浣欓:{{ accountDetails.balanceTotal }},鎵垮厬浣欓锛歿{ accountDetails.balance2 == null ? 0 : customerChengdui }}</text>
+				<text style="color: #FFA500;;">瀹㈡埛璐︽埛鐜版眹浣欓:{{ accountDetails.balanceTotal == null ? 0 :accountDetails.balanceTotal.toFixed(2) }},鎵垮厬浣欓锛歿{ accountDetails.balance2 == null ? 0 : customerChengdui }}</text>
 			</view>
 			<u-swipe-action>
 				<u-swipe-action-item @click="deleteContractCardClick" :options="options1" v-for="(item, index) in newFormData.contractOrders" :key="index">
 					<view class="cardList">
-						<view class="" class="cardListIcon"><u-icon name="edit-pen" color="#2979ff" size="35"></u-icon></view>
+						<view class="cardListIcon" @click="editApplicationClick(index)"><u-icon name="edit-pen" color="#2979ff" size="35"></u-icon></view>
 						<view class="cardList-container">
 							<view class="cardList_item">
 								鏀惰揣浜猴細
@@ -785,25 +785,25 @@
 			loading: false,
 			// 浠锋牸璇锋眰鍙傛暟
 			getNewPriceData: {
-				compId: 133,
-				compName: '閭㈠彴鐭�',
-				customerAddressName: '閭㈠彴鍥芥嘲鍙戠數鏈夐檺璐d换鍏徃',
-				customerAddressId: 236,
-				coalId: 45,
-				coalName: '',
-				trainType: 1,
-				fromStation: '灏忓悍搴�',
-				toStation: '灏忓悍搴�',
-				quant: '',
-				price: '',
-				amount: '',
-				priceMode: null,
-				filedName: '閭㈠彴鐭夸富鐓ゅ満',
-				filedId: 4,
-				type: '',
-				cost1: '',
-				cost2: '',
-				edit: true
+				// compId: 133,
+				// compName: '閭㈠彴鐭�',
+				// customerAddressName: '閭㈠彴鍥芥嘲鍙戠數鏈夐檺璐d换鍏徃',
+				// customerAddressId: 236,
+				// coalId: 45,
+				// coalName: '',
+				// trainType: 1,
+				// fromStation: '灏忓悍搴�',
+				// toStation: '灏忓悍搴�',
+				// quant: '',
+				// price: '',
+				// amount: '',
+				// priceMode: null,
+				// filedName: '閭㈠彴鐭夸富鐓ゅ満',
+				// filedId: 4,
+				// type: '',
+				// cost1: '',
+				// cost2: '',
+				// edit: true
 			},
 			dust: null, // 鎶戝皹璐�
 			trainfreight: {}, //璺繍杩愯垂
@@ -825,7 +825,8 @@
 				{
 					text: '鍒犻櫎'
 				}
-			]
+			],
+      editApplicationIndex:null
 		};
 	},
 	onShow() {
@@ -1304,6 +1305,8 @@
 		// 娣诲姞鍚堝悓寮瑰嚭妗�
 		addContractClose() {
 			this.addContractShow = false;
+			this.addContractFormdata = {};
+			this.editApplicationIndex = null;
 		},
 		addContractOpen() {
 			console.log('娣诲姞璁㈠崟鎵撳紑');
@@ -1317,6 +1320,7 @@
 		},
 		// 閫夋嫨鐨勭叅鍘�
 		coalFiledSelectClick(e) {
+		  console.log('閫夋嫨鐨勭叅鍘�',e);
 			this.addContractFormdata.compName = e.compName;
 			this.addContractFormdata.filedName = e.name;
 			this.addContractFormdata.compId = e.compId;
@@ -1325,7 +1329,14 @@
 
 			this.selectCoalFiledData = e;
 
-			this.coalFiledSelectShow = false;
+			// 鑾峰彇浠锋牸鍙傛暟
+      this.getNewPriceData.compId = e.compId;
+      this.getNewPriceData.compName = e.compName;
+      this.getNewPriceData.filedId = e.id;
+      this.getNewPriceData.filedName = e.name;
+
+
+      this.coalFiledSelectShow = false;
 		},
 		// 鏀惰揣浜�
 		addContractConsigneeClose() {
@@ -1405,7 +1416,7 @@
 						// 	this.currentCoal.type = 1;
 						// }
 						this.addContractFormdata.modifyId = data.modifyId;
-						this.addContractFormdata.id = data.id;
+						// this.addContractFormdata.id = data.id;
 					} else {
 						uni.$u.toast('鐓ょ浠锋牸鏈缃�');
 					}
@@ -1477,11 +1488,14 @@
 		},
 		addContractSanConfirm() {
 			if (this.addContractFormdata.compId && this.addContractFormdata.customerId && this.addContractFormdata.filedId) {
-				this.newFormData.contractOrders.push(this.addContractFormdata);
-				console.log('娣诲姞瀛愯鍗�',this.addContractFormdata);
-				this.$nextTick(() => {
-					this.addContractShow = false;
-				});
+			  if(this.editApplicationIndex != null){
+          this.newFormData.contractOrders[this.editApplicationIndex] = this.addContractFormdata;
+        } else {
+          this.newFormData.contractOrders.push(this.addContractFormdata);
+          console.log('娣诲姞瀛愯鍗�',this.addContractFormdata);
+        }
+        this.addContractShow = false;// 鍏抽棴寮瑰嚭妗�
+        console.log('this.newFormData.contractOrders褰撳墠鍏抽棴鍚�',this.newFormData.contractOrders)
 			} else {
 				uni.$u.toast('璇疯鑼冭緭鍏ユ墍鏈変俊鎭�');
 			}
@@ -1607,6 +1621,11 @@
 			console.log('鍒犻櫎璁㈠崟鍗$墖', e);
 			this.newFormData.contractOrders.splice(e, 1);
 		},
+    editApplicationClick(index){
+		  this.editApplicationIndex = index;
+      this.addContractFormdata = this.newFormData.contractOrders[index];
+      this.addContractShow = true;
+    },
 		xswaybill() {
 			console.log('鏂板缓鍙戣繍鐢宠', this.newFormData);
 			uni.showLoading({
@@ -1616,17 +1635,19 @@
 				uni.hideLoading();
 				console.log('鏂板缓鍙戣繍鐢宠', res);
 				if (res.code == 0) {
-					uni.showToast({
-						title: '娣诲姞鎴愬姛锛�',
-						icon: 'success',
-						duration: 2000
-					});
-					this.$nextTick(() => {
-						uni.navigateBack({
-							// url: '/pages/my-application/my-application'
-							delta: 2
-						});
-					});
+					// uni.showToast({
+					// 	title: '娣诲姞鎴愬姛锛�',
+					// 	icon: 'success',
+					// 	duration: 1000
+					// });
+          this.$u.toast('娣诲姞鎴愬姛锛屽嵆灏嗚繑鍥炵敵璇烽〉锛侊紒锛�')
+					setTimeout(() => {
+            uni.navigateBack({
+              // url: '/pages/my-application/my-application'
+              delta: 2
+            });
+          },2000)
+
 				}
 			});
 		},

--
Gitblit v1.9.1