From 8315c3ff55eb53be82ac7ddbbc6cce5f447ffdfa Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期三, 09 四月 2025 13:42:35 +0800
Subject: [PATCH] qx

---
 src/views/system/comp/index.vue |   85 +++++++++++++++++++++---------------------
 1 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/src/views/system/comp/index.vue b/src/views/system/comp/index.vue
index c4f13cb..5d2295e 100644
--- a/src/views/system/comp/index.vue
+++ b/src/views/system/comp/index.vue
@@ -117,7 +117,7 @@
     </div>
 
     <div>
-      <el-dialog :title="title" :visible.sync="opens" width="1350px" append-to-body :close-on-click-modal="false">
+      <el-dialog :title="title" :visible.sync="opens" width="1350px" append-to-body :close-on-click-modal="true">
         <el-row :gutter="20">
           <el-col :span="7" :xs="24">
             <div style="padding: 0 20px">
@@ -199,7 +199,7 @@
                 <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleGroup">淇濆瓨</el-button>
               </el-col>
               <el-col :span="1.5">
-                <el-button type="primary" icon="el-icon-edit" size="mini" @click="xiangmuWh">椤圭洰缁存姢</el-button>
+                <el-button type="primary" icon="el-icon-edit" size="mini" @click="xiangmuWh" >椤圭洰缁存姢</el-button>
               </el-col>
               <el-col :span="1.5">
                 <el-button type="primary" icon="el-icon-edit" size="mini" :disabled="singlegg"
@@ -324,7 +324,7 @@
     </div>
 
     <div>
-      <el-dialog :title="title" :visible.sync="openOne" width="1400px" append-to-body :close-on-click-modal="false">
+      <el-dialog :title="title" :visible.sync="openOne" width="1400px" append-to-body  :close-on-click-modal="false"  >
         <el-row :gutter="24" v-if="!isTableVisible">
 
           <el-col :span="15" :xs="24">
@@ -335,7 +335,7 @@
               </el-form-item>
               <el-form-item label="鎶樻墸">
                 <el-input-number ref="inputNumber" style="width: 150px" v-model="youhui" :precision="1" :step="0.1"
-                  :min="0" :max="20" @change="debounceNumberChange" :debounce="3000"></el-input-number>
+                  :min="0" :max="10" @change="debounceNumberChange" :debounce="3000"></el-input-number>
               </el-form-item>
               <el-form-item label="鐜颁环">
                 <el-input ref="inputName" v-model="queryParams.xianprice" placeholder="鍚堣" clearable
@@ -355,10 +355,10 @@
               <el-table-column label="鍘熶环" align="center" prop="proPrice" width="85"></el-table-column>
               <el-table-column label="鎶樻墸" width="151">
                 <template slot-scope="scope">
-                  <!-- 鍙緭鍏ョ函鏁板瓧鎶樻墸 -->
-                  <el-input-number v-model.number="scope.row.limits" @input="validateDiscount(scope.row)"
+                  <!-- 鍙緭鍏ョ函鏁板瓧鎶樻墸  @input="validateDiscount(scope.row)"-->
+                  <el-input-number v-model="scope.row.limits" 
                     @change="handleManualChange(scope.row)" placeholder="杈撳叆鎶樻墸" size="mini" type="number" :min="0"
-                    :step="0.1" :precision="1" :max="20">
+                    :step="0.1" :precision="1" :max="10">
                   </el-input-number>
                 </template>
               </el-table-column>
@@ -753,8 +753,8 @@
     updateProPrice(row) {
       const proPrice = new Big(row.proPrice);
       const limits = new Big(row.limits);
-      const result = proPrice.times(limits.div(10));  // ordPrice * (discount / 10)
-      row.ysPrice = result.toNumber();
+      const result = proPrice.times(limits.div(10)).toNumber();  // ordPrice * (discount / 10)
+      row.ysPrice = result.toFixed(2);
       this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
         return sum.plus(new Big(item.ysPrice || '0'));
       }, new Big(0)).toNumber();
@@ -763,8 +763,8 @@
     updateProPrice1(row) {
       const proPrice = new Big(row.proPrice);
       const limits = new Big(row.limits);
-      const result = proPrice.times(limits.div(10));
-      row.ysPrice = result.toNumber();
+       const result = proPrice.times(limits.div(10)).toNumber();  // ordPrice * (discount / 10)
+      row.ysPrice = result.toFixed(2);
       const totalYsPrice = this.OnenewpacName.reduce((sum, item) => {
         return sum.plus(new Big(item.ysPrice || '0'));
       }, new Big(0));
@@ -780,10 +780,11 @@
       }
 
       // Update youhui calculation
+ 
       if (this.queryParams.price !== 0 && this.queryParams.xianprice !== 0) {
         this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
       } else {
-        this.youhui = 0;
+        this.youhui = 10;
       }
     },
     debounceNumberChange(currentValue, oldValue) {
@@ -794,12 +795,9 @@
     },
     changeXianjia() {
       // 鍘熷鎶樻墸鐜囪绠�
-
-
       if (this.queryParams.price !== 0) {
         this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
       }
-
     },
 
     getList() {
@@ -831,6 +829,7 @@
     cancell() {
       this.openss = false;
       this.openOne = false;
+      this.youhui = 10
       // this.reset();
     },
     // 琛ㄥ崟閲嶇疆
@@ -974,7 +973,7 @@
             item.ysPrice = result.toNumber();
             this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
               return sum.plus(new Big(item.ysPrice || '0'));
-            }, new Big(0));
+            }, new Big(0)).toNumber();
           })
           // ----------------------------------------------------------
 
@@ -1044,8 +1043,6 @@
       this.loading = true;
       if (this.forms.sex) {
         deptTreeSelect(this.forms.sex).then((response) => {
-          console.log('111', response.rows);
-
           this.newpacName = response.rows;
           this.loading = false;
           response.rows.forEach((item, index) => {
@@ -1058,7 +1055,6 @@
         });
       } else {
         deptTreeSelect().then((response) => {
-          console.log('222', response.rows);
           this.newpacName = response.rows;
           this.loading = false;
           response.rows.forEach((item, index) => {
@@ -1082,7 +1078,6 @@
     handleSearch() {
       if (this.queryParams.pacName) {
         getPackageList(this.queryParams.pacName).then((response) => {
-          console.log('333', response.data);
           this.newpacName = response.data;
           response.data.forEach((item, index) => {
             item.newID =
@@ -1093,7 +1088,6 @@
         });
       } else {
         deptTreeSelect().then((response) => {
-          console.log('44', response.rows);
           this.newpacName = response.rows;
           response.rows.forEach((item, index) => {
             item.newID =
@@ -1171,11 +1165,12 @@
         // 閲嶆柊璁$畻鎬讳环鍜岀幇浠�
         this.OnenewpacName.forEach((item) => {
           this.queryParams.price += item.proPrice; // 绱姞鍘熶环
-          this.queryParams.xianprice += item.ysPrice || 0; // 绱姞鐜颁环锛屽鏋測sPrice涓簎ndefined鍒欑疮鍔�0
+          //this.queryParams.xianprice += item.ysPrice || 0;  绱姞鐜颁环锛屽鏋測sPrice涓簎ndefined鍒欑疮鍔�0
         });
-
-        // 璁$畻浼樻儬锛岃繖閲屽亣璁句紭鎯犳槸鐜颁环涓庡師浠风殑宸鐧惧垎姣�
-        this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
+        this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
+        return sum.plus(new Big(item.ysPrice || '0'));
+      }, new Big(0)).toNumber();
+      this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
       }
     },
     handledbelete(row) {
@@ -1189,14 +1184,16 @@
       // 鐒跺悗鏇存柊鎬讳环鍜岀幇浠�
       this.OnenewpacName.forEach((item) => {
         this.queryParams.price += item.proPrice;
-        this.queryParams.xianprice += item.ysPrice || 0; // 纭繚ysPrice瀛樺湪
+        this.queryParams.xianprice =this.OnenewpacName.reduce((sum, item) => {
+        return sum.plus(new Big(item.ysPrice || "0"));
+      }, new Big(0)).toNumber();
       });
 
       // 璁$畻浼樻儬
       if (this.queryParams.price > 0) {
         this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
       } else {
-        this.youhui = 0;
+        this.youhui = 10;
       }
     },
 
@@ -1313,6 +1310,7 @@
           this.forms.groupingName = item.groupingName;
           this.forms.gtAge = item.gtAge;
           this.forms.limits = item.limits;
+          this.youhui =item.limits
           this.forms.ltAge = item.ltAge;
           this.forms.pacName = item.pacName;
           this.forms.payType = item.payType;
@@ -1329,6 +1327,11 @@
       this.groupIds = selection.map((item) => item.id);
       this.singlegg = !selection.length;
     },
+    handleBeforeClose(done) {
+      this.$confirm('纭鍏抽棴锛�')
+        .then(() => done())
+        .catch(() => { /* 鍙栨秷鍏抽棴 */ });
+    },
     xiangmuWh() {
       if (!this.forms.groupingName ||
         !this.forms.sex ||
@@ -1337,7 +1340,6 @@
         return; // Stop execution if any required field is empty
       }
       this.openOne = true;
-
       this.title = "鍒嗙粍椤圭洰缁存姢";
       this.OnenewpacName = [];
       this.queryParams.price = 0;
@@ -1346,13 +1348,19 @@
         let id = this.groupList[0].id || '';
         getDetails(id).then((res) => {
           this.OnenewpacName = res.data.groupingProList;
-          this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
-            return sum.plus(new Big(item.ysPrice || '0'));
-          }, new Big(0));
-          this.OnenewpacName.forEach((item, index) => {
-            this.queryParams.price += item.proPrice;
-          });
-          this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
+          // this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
+          //   return sum.plus(new Big(item.ysPrice || '0'));
+          // }, new Big(0)).toNumber();
+         
+          // this.OnenewpacName.forEach((item, index) => {
+          //   this.queryParams.price += item.proPrice;
+          // });
+          // 
+         
+          // this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
+          this.queryParams.xianprice = res.data.ysPrice
+          this.queryParams.price= res.data.price
+          this.youhui= res.data.limits
         });
       }
       // console.log(this.groupList[0].id, 9966);
@@ -1368,7 +1376,6 @@
         deptTreeSelect(this.forms.sex).then((response) => {
           // 濂楅鍚嶇О
           this.newpacName = response.rows;
-          console.log('5', response.rows);
           this.loading = false;
           response.rows.forEach((item, index) => {
             item.newID =
@@ -1382,7 +1389,6 @@
 
         deptTreeSelect().then((response) => {
           this.newpacName = response.rows;
-          console.log('6', response.rows);
           this.loading = false;
           response.rows.forEach((item, index) => {
             item.newID =
@@ -1394,7 +1400,6 @@
       }
       getProjectList().then((response) => {
         this.Treedata = response.data;
-        // console.log(this.Treedata,999888);
       });
     },
 
@@ -1408,9 +1413,6 @@
           proPrice: item.proPrice,
         });
       });
-
-
-
 
       let data = {
         groupingName: this.forms.groupingName,
@@ -1443,7 +1445,6 @@
     },
     // 淇敼鍒嗙粍
     GroupUpdate() {
-      console.log(this.$refs.elTable)
       this.$refs.tbs.clearSelection();
       this.forms = {
         groupingName: "",

--
Gitblit v1.8.0