From 0c4086cfdbc5bbff567bd05ebcc6e34e36cb2bf9 Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123 <819527061@qq.com>
Date: 星期五, 29 七月 2022 11:24:36 +0800
Subject: [PATCH] '首页添加日计划模块'

---
 pages/new-application-form-data/new-application-form-data.vue |  138 ++++++++++++++++++++++++---------------------
 1 files changed, 73 insertions(+), 65 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..b53c266 100644
--- a/pages/new-application-form-data/new-application-form-data.vue
+++ b/pages/new-application-form-data/new-application-form-data.vue
@@ -70,9 +70,8 @@
 						<view class="searchResultList">
 							<u-cell-group :right-icon="false">
 								<u-cell v-for="(item, index) in customerData" :title="item.customerFullName" :arrow="false">
-									<text slot="value" class="u-slot-value">
+									<view slot="value" class="u-slot-value">
 										<button
-											class="mini-btn"
 											type="default"
 											size="mini"
 											style="background: #007aff;
@@ -87,7 +86,7 @@
 										>
 											閫夋嫨
 										</button>
-									</text>
+									</view>
 								</u-cell>
 							</u-cell-group>
 						</view>
@@ -363,7 +362,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>
 
 					<!-- 閫夋嫨鐓ゅ巶 -->
@@ -392,7 +391,7 @@
 													<view :style="tdStyle">{{ item.compName }}</view>
 												</uni-td>
 												<uni-td align="left">
-													<view :style="tdStyle">{{ item.remark }}</view>
+													<view :style="tdStyle">{{ item.remark == null ? '' : item.remark }}</view>
 												</uni-td>
 											</uni-tr>
 										</uni-table>
@@ -444,7 +443,7 @@
 									<view class="searchResultList">
 										<u-cell-group :right-icon="false">
 											<u-cell v-for="(item, index) in customerData" :title="item.customerFullName" :arrow="false">
-												<text slot="value" class="u-slot-value">
+												<view slot="value" class="u-slot-value">
 													<button
 														class="mini-btn"
 														type="default"
@@ -461,7 +460,7 @@
 													>
 														閫夋嫨
 													</button>
-												</text>
+												</view>
 											</u-cell>
 										</u-cell-group>
 									</view>
@@ -540,12 +539,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 +784,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 +824,8 @@
 				{
 					text: '鍒犻櫎'
 				}
-			]
+			],
+      editApplicationIndex:null
 		};
 	},
 	onShow() {
@@ -1227,24 +1227,12 @@
 
 			// 浠锋牸鍙傛暟璧嬪��
 			this.getNewPriceData.type = e.type;
-			// 閫夊畾鍚堝悓璇︽儏
-			uni
-				.request({
-					url: `/yunxiao/contractitem/getByContractId/${e.id}`,
-					method: 'GET',
-					header: {
-						'TENANT-ID': 5,
-						Authorization: 'Bearer ' + uni.getStorageSync('access_token'),
-						VERSION: 'zzl'
-					}
-				})
-				.then(res => {
-					this.contractDetails = res[1].data.data;
-					console.log('鍚堝悓璇︽儏', res, this.contractDetails);
-				})
-				.catch(err => {
-					console.log(err);
-				});
+				// 閫夊畾鍚堝悓璇︽儏
+			this.$reqGet('getByContractId',{},e.id).then(res=>{
+					this.contractDetails = res.data
+			}).catch(err=>{
+				console.log(err);
+			})
 		},
 		// 娣诲姞鍚堝悓鎸夐挳
 		addContractClick() {
@@ -1304,6 +1292,8 @@
 		// 娣诲姞鍚堝悓寮瑰嚭妗�
 		addContractClose() {
 			this.addContractShow = false;
+			this.addContractFormdata = {};
+			this.editApplicationIndex = null;
 		},
 		addContractOpen() {
 			console.log('娣诲姞璁㈠崟鎵撳紑');
@@ -1317,6 +1307,7 @@
 		},
 		// 閫夋嫨鐨勭叅鍘�
 		coalFiledSelectClick(e) {
+		  console.log('閫夋嫨鐨勭叅鍘�',e);
 			this.addContractFormdata.compName = e.compName;
 			this.addContractFormdata.filedName = e.name;
 			this.addContractFormdata.compId = e.compId;
@@ -1325,7 +1316,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 +1403,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 +1475,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 +1608,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 +1622,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