Bladeren bron

项目日志 handle

gubai 2 jaren geleden
bovenliggende
commit
ff04f7fb93
1 gewijzigde bestanden met toevoegingen van 86 en 51 verwijderingen
  1. 86 51
      src/views/contracts/new_file.vue

+ 86 - 51
src/views/contracts/new_file.vue

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -100,10 +100,7 @@
             v-model="item.expectDiscountDate"
             type="date"
             placeholder="选择日期"
-            @change="
-              changeE;
-              xpectDiscountDate($event, index);
-            "
+             @change="change(index,4)"
           />
         </el-form-item>
         <!-- 出票日期 -->
@@ -113,6 +110,7 @@
             type="date"
             placeholder="选择日期"
             class="ipwidth"
+             @change="change(index,2)"
           />
         </el-form-item>
         <!-- 承兑日期 -->
@@ -131,6 +129,7 @@
             v-model="item.expireDate"
             type="date"
             placeholder="选择日期"
+             @change="change(index,3)"
           />
         </el-form-item>
       </el-form>
@@ -151,7 +150,7 @@
             class="ipwidth"
             placeholder="请填写金额"
             style="width: 220px"
-            @input="getMoney" @blur="getMoneyIndex(index)"
+            @blur="getMoney(index)"
           />
         </el-form-item>
         <!-- 服务费 -->
@@ -219,7 +218,6 @@
             class="ipwidth"
             placeholder="服务费率"
             style="width: 220px"
-            @input="inputServiceRate($event, index)"
           />
         </el-form-item>
         <!-- 利率 -->
@@ -229,7 +227,6 @@
             class="ipwidth"
             placeholder="利率"
             style="width: 220px"
-            @input="inputInterestRate($event, index)"
           />
         </el-form-item>
       </el-form>
@@ -317,22 +314,22 @@ export default {
         /* 汇票的数据 */
         contractDrafts: [
           {
-            name: "",
-            draftNo: "",
-            acceptorId: "",
-            drawersId: "",
-            money: "",
-            acceptDate: "",
-            loanLimit: "",
-            serviceRate: "",
-            serviceMoney: "",
-            interestRate: "",
-            interest: "",
+            name: "1",
+            draftNo: "1",
+            acceptorId: "1",
+            drawersId: "1",
+            money: "1",
+            acceptDate: "1",
+            loanLimit: "1",
+            serviceRate: "1",
+            serviceMoney: "1",
+            interestRate: "1",
+            interest: "1",
             picUrls: [],
-            expectDiscountDate: "",
-            issueDate: "",
-            expireDate: "",
-            limitTime: "",
+            expectDiscountDate: "1",
+            issueDate: "1",
+            expireDate: "1",
+            limitTime: "1",
           },
         ],
       },
@@ -413,6 +410,9 @@ export default {
         }
       }
     });
+
+    /* 调用获取当前的时间 */
+    this.loadTime()
   },
   methods: {
     /* 确实上传按钮 */
@@ -429,6 +429,29 @@ export default {
         });
       });
     },
+
+
+    /* 默认时间 */
+    loadTime() {
+				let myDate = new Date()
+				let wk = parseInt(Date.now() / 100000).toFixed(0) * 100000
+				let yy = String(myDate.getFullYear())
+				// let mm = myDate.getMonth() + 1
+				let mm = String(myDate.getMonth() + 1 < 10 ? '0' + (myDate.getMonth() + 1) : myDate.getMonth() + 1)
+				let dd = String(myDate.getDate() < 10 ? '0' + myDate.getDate() : myDate.getDate())
+				let nowDate = yy + '-' + mm + '-' + dd
+				this.form.contractDrafts.forEach(item => {
+					item.acceptDate = nowDate
+					item.issueDate = nowDate
+					item.expireDate = nowDate
+					item.expectDiscountDate = nowDate
+					item.expectDiscountDateTime = wk
+					item.acceptDateTime = wk
+					let nTime = item.acceptDateTime - item.expectDiscountDateTime
+					item.limitTime = Math.floor(nTime / 86400000);
+				})
+			},
+
     /* 合同附件上传 */
     handlepics(res) {
       // 解构
@@ -450,7 +473,6 @@ export default {
     },
 
     /* 上传图片到浏览器成功回调 */
-
     handlepicUrls(res) {
       // 解构
       const { file } = res.data;
@@ -511,38 +533,51 @@ export default {
         this.$message.error("至少一个");
       }
     },
-    // 服务费率
-    inputServiceRate(val, index) {
-      console.log(val, index);
-    },
-    // 利率
-    inputInterestRate(val, index) {
-      console.log(val, index);
-    },
-    // 预计贴现日
-    changeExpectDiscountDate(val, index) {
-      console.log(val, index);
-    },
-    // 承兑日期
-    changeIssueDate(val, index) {
-      console.log(val, index);
-    },
+   
+    /* 计算时间段 */
+    change(e,number){
+      // if (number == 1) {
+			// 		let ino = parseInt(e.value / 10000).toFixed(0) * 10000
+			// 		form[this.index].acceptDateTime = ino
+			// 		let nTime = form[this.index].acceptDateTime - form[this.index].expectDiscountDateTime
+			// 		let limitTime = Math.floor(nTime / 86400000)
+			// 		if (limitTime <= -1) {
+			// 			this.$toast('承兑日期应该大于预计贴现日')
+			// 			return
+			// 		}
+			// 		form[this.index].limitTime = limitTime
+			// 		form[this.index].acceptDate = timeFormat(e.value, 'yyyy-mm-dd')
+			// 		this.getloanLimt(this.index)
+			// 		this.getSerMoney(this.index)
+			// 		this.getInterMoney(this.index)
+			// 	} else if (this.opdanum == 2) {
+
+			// 		form[this.index].issueDate = timeFormat(e.value, 'yyyy-mm-dd')
+			// 	} else if (this.opdanum == 3) {
+			// 		form[this.index].expireDate = timeFormat(e.value, 'yyyy-mm-dd')
+			// 	} else if (this.opdanum == 4) {
+			// 		form[this.index].expectDiscountDateTime = e.value
+			// 		let nTime = form[this.index].acceptDateTime - form[this.index].expectDiscountDateTime
+			// 		let limitTime = Math.floor(nTime / 86400000)
+			// 		if (limitTime <= -1) {
+			// 			this.$toast('预计贴现日应该小于承兑日期')
+			// 			return
+			// 		}
+			// 		form[this.index].limitTime = limitTime
+			// 		form[this.index].expectDiscountDate = timeFormat(e.value, 'yyyy-mm-dd')
+			// 		this.getloanLimt(this.index)
+			// 		this.getSerMoney(this.index)
+			// 		this.getInterMoney(this.index)
+			// 	}
 
-    /* 汇票的索引 */
-    getMoneyIndex(index){
-     this.myindex = index
-    },
-    change(index,number){
-      console.log(index);
     },
+
     /* 获取金额 */
-    getMoney(event,index) {
-      this.form.contractDrafts[this.myindex].money = event
-				this.getloanLimt(this.myindex)
-				this.getSerMoney(this.myindex)
-				this.getInterMoney(this.myindex)
+    getMoney(index) {
+				this.getloanLimt(index)
+				this.getSerMoney(index)
+				this.getInterMoney(index)
     },
-
     /* 计算最高贷款额度 */
    getloanLimt(i) {
 				if (this.form.contractDrafts[i].money && this.form.contractDrafts[i].serviceRate && this.form