From 72f6f5abb7d6a90c9edfb69db63907ef3e17ef03 Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期三, 22 十一月 2023 11:31:27 +0800
Subject: [PATCH] 销售明细单添加确认订单前确认是否选择项目

---
 src/views/other/payment/collectionPlan/AddCollectionPlan.vue |   53 ++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/src/views/other/payment/collectionPlan/AddCollectionPlan.vue b/src/views/other/payment/collectionPlan/AddCollectionPlan.vue
index bf6b7cd..c3cd4b1 100644
--- a/src/views/other/payment/collectionPlan/AddCollectionPlan.vue
+++ b/src/views/other/payment/collectionPlan/AddCollectionPlan.vue
@@ -25,14 +25,14 @@
         </div>
         <div class="collection-view">
           <div class="label">閲戦</div>
-          <div>{{ editConfig.infomation.amount }}</div>
+          <div>{{ editConfig.infomation.amountTotal }}</div>
         </div>
         <div class="collection-view">
           <div class="label">鏈鍒掗噾棰�</div>
-          <div>{{ editConfig.infomation.amount }}</div>
+          <div>{{ editConfig.infomation.amountTotal }}</div>
         </div>
         <div class="collection-view">
-          <div class="label">鏀舵璁″垝璐熻矗浜�</div>
+          <div class="label"><span style="color: #f56c6c">*</span>鏀舵璁″垝璐熻矗浜�</div>
           <el-select
             v-model="editConfig.infomation.principalId"
             placeholder="璇烽�夋嫨"
@@ -106,7 +106,13 @@
                   "
                 ></el-input>
                 <div v-else-if="item.date">
-                  <el-date-picker v-model="scope.row[item.prop]" type="date" size="mini" style="width: 130px">
+                  <el-date-picker
+                    v-model="scope.row[item.prop]"
+                    type="date"
+                    value-format="yyyy-MM-dd"
+                    size="mini"
+                    style="width: 130px"
+                  >
                   </el-date-picker>
                 </div>
                 <div v-else @click="delClick(scope.row)"><i class="el-icon-delete"></i></div>
@@ -142,7 +148,7 @@
         </div>
         <div class="btn-view">
           <el-button type="primary" size="small" @click="saveClick">淇濆瓨</el-button>
-          <el-button size="small" @click="editConfig.visible = false">鍙栨秷</el-button>
+          <el-button size="small" @click="droppedClick">鍙栨秷</el-button>
         </div>
       </div>
     </el-dialog>
@@ -182,7 +188,6 @@
         mergeNumber: 7
       },
       tableData: [],
-      productId: 1,
       addProductArr: [],
       memberOptions: [],
       allTerms: 3,
@@ -205,10 +210,14 @@
   methods: {
     // 璁剧疆鍒濆鍊�
     setData() {
+      this.amount =
+        typeof this.editCommonConfig.infomation.amountTotal == "string"
+          ? parseInt(this.editCommonConfig.infomation.amountTotal)
+          : this.editCommonConfig.infomation.amountTotal
       this.editConfig.infomation = {
         collectionType: this.collectionType,
         moneyType: "浜烘皯甯�",
-        amount: this.amount.toFixed(2)
+        amountTotal: this.editCommonConfig.infomation.amountTotal
       }
     },
     getCommonData() {
@@ -226,9 +235,12 @@
     // 淇濆瓨
     saveClick() {
       this.sumTotalAmount()
+      console.log(this.amount)
       if (this.editConfig.title === "鏂板缓") {
         if (this.principalId === 0) {
           this.$message.error("璇烽�夋嫨鏀舵璁″垝璐熻矗浜�")
+        } else if (this.amount === 0) {
+          this.$message.error("鏀舵閲戦涓嶈兘涓�0")
         } else if (this.amount !== this.planAmount) {
           this.$message.error("鏀舵璁″垝鍜屾湭璁″垝閲戦涓嶄竴鑷达紝璇烽噸绠�")
         } else {
@@ -243,6 +255,10 @@
           })
         }
       }
+    },
+    droppedClick() {
+      this.editConfig.visible = false
+      this.$parent.getData()
     },
     // 璁$畻璁″垝鎬婚
     sumTotalAmount() {
@@ -261,6 +277,7 @@
     },
     handleClose() {
       this.editConfig.visible = false
+      this.$parent.getData()
     },
     setTableForm() {
       this.setTableInfomation(this.firstDate)
@@ -283,7 +300,7 @@
           amount: this.amount,
           amountReceivable: this.amount * 0.3,
           amountReceived: 0,
-          amountTotal: 0,
+          amountTotal: this.amount,
           collectionDate: this.setDate(date, 0),
           collectionType: this.editConfig.infomation.collectionType,
           fileId: 0,
@@ -301,7 +318,7 @@
           amount: this.amount,
           amountReceivable: this.amount * 0.5,
           amountReceived: 0,
-          amountTotal: 0,
+          amountTotal: this.amount,
           collectionDate: this.setDate(date, 1),
           collectionType: this.editConfig.infomation.collectionType,
           fileId: 0,
@@ -319,7 +336,7 @@
           amount: this.amount,
           amountReceivable: this.amount * 0.2,
           amountReceived: 0,
-          amountTotal: 0,
+          amountTotal: this.amount,
           collectionDate: this.setDate(date, 2),
           collectionType: this.editConfig.infomation.collectionType,
           fileId: 0,
@@ -346,7 +363,7 @@
             amount: this.amount,
             amountReceivable: this.amount,
             amountReceived: 0,
-            amountTotal: 0,
+            amountTotal: this.amount,
             collectionDate: this.setDate(this.firstDate, 0),
             collectionType: this.editConfig.infomation.collectionType,
             fileId: 0,
@@ -367,7 +384,7 @@
             amount: this.amount,
             amountReceivable: this.amount * 0.5,
             amountReceived: 0,
-            amountTotal: 0,
+            amountTotal: this.amount,
             collectionDate: this.setDate(this.firstDate, 0),
             collectionType: this.editConfig.infomation.collectionType,
             fileId: 0,
@@ -385,7 +402,7 @@
             amount: this.amount,
             amountReceivable: this.amount * 0.5,
             amountReceived: 0,
-            amountTotal: 0,
+            amountTotal: this.amount,
             collectionDate: this.setDate(this.firstDate, 1),
             collectionType: this.editConfig.infomation.collectionType,
             fileId: 0,
@@ -428,9 +445,15 @@
     setDate(str, monthNumber) {
       console.log(str.split("-"))
       let dateArr = str.split("-")
-      let year = parseInt(dateArr[0])
-      let month = parseInt(dateArr[1]) + monthNumber
+      // 鏈堜唤鍜�
+      let monthCount = parseInt(dateArr[1]) + monthNumber
+      // 骞�
+      let year = monthCount > 12 ? parseInt(dateArr[0]) + 1 : parseInt(dateArr[0])
+      // 鏈�
+      let month = monthCount > 12 ? monthCount - 12 : monthCount
+      // 鏃�
       let day = parseInt(dateArr[2])
+
       return year + "-" + month + "-" + day
     },
     principalClick(val) {

--
Gitblit v1.8.0