From 4c4abb59d6ee838c61b851fcc7be93c0522c39c4 Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期五, 04 七月 2025 16:36:13 +0800
Subject: [PATCH] Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb_region

---
 src/views/system/package/index.vue |  100 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 92 insertions(+), 8 deletions(-)

diff --git a/src/views/system/package/index.vue b/src/views/system/package/index.vue
index 020d483..197f8ae 100644
--- a/src/views/system/package/index.vue
+++ b/src/views/system/package/index.vue
@@ -118,8 +118,12 @@
         <el-form-item label="鎶樻墸">
           <el-input-number style="width: 150px" v-model="youhui" :precision="2" :step="0.1" :max="10" :min="0.1" @change="debounceNumberChange" :debounce="3000"></el-input-number>
         </el-form-item>
-        <el-form-item label="鐜颁环" prop="xianprice">
+        <!-- <el-form-item label="鐜颁环" prop="xianprice">
           <el-input v-model="form.xianprice" placeholder="鐜颁环" clearable style="width: 140px" @input="changeXianjia" @blur="numberChangeXianPrice(youhui, youhui)" type="number" :debounce="3000" min="0"/>
+        </el-form-item> -->
+        <el-form-item label="鐜颁环" prop="xianprice">
+          <el-input v-model="form.xianprice" placeholder="鐜颁环" clearable style="width: 140px" @input="changeXianjia"
+            type="number" :debounce="3000" min="0"/>
         </el-form-item>
         <el-form-item label="鍏抽敭瀛�" prop="keywords">
           <el-select multiple v-model="form.keywords" placeholder="璇烽�夋嫨鍏抽敭瀛�" style="width: 160px" @change="sel" filterable clearable>
@@ -147,7 +151,7 @@
       <el-row style="display: flex; width: 1300px">
         <el-col>
           <div style="text-align: center; margin-bottom: 10px; margin-top: 10px">椤圭洰鍒楄〃</div>
-          <el-input placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" v-model="filterText" @input="debounceFilter" clearable />
+          <el-input placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" v-model="queryParams1.nr" @input="handleFilterInput" clearable />
           <div class="tab3" style="height: 365px">
             <el-tree
               class="filter-tree"
@@ -315,11 +319,12 @@
     this.getCategory();
   },
   methods: {
-    debounceFilter() {
-      clearTimeout(this.debounceTimer);
-      this.debounceTimer = setTimeout(() => {
-        this.filterTree();
-      }, 600);
+    handleFilterInput() {
+      this.queryParams1.page = 1;
+      this.getDataList();
+      this.$nextTick(() => {
+        this.$refs.tree.setCheckedKeys(this.checkedNodes);
+      });
     },
     filterTree() {
       if (!this.filterText) {
@@ -777,7 +782,7 @@
       this.DataList = this.DataList.filter((item) => item.proParentId !== row.proParentId);
       this.TotalPrice1 = this.DataList.reduce((sum, item) => sum + item.priceOrd, 0);
     },
-    submitForm() {
+    /* submitForm() {
       this.form.limits = this.youhui;
       this.form.price = this.pics;
       this.form.priceNow = this.form.xianprice;
@@ -813,6 +818,85 @@
         this.open = false;
         this.getList();
       });
+    }, */
+    submitForm() {
+      // 妫�鏌ョ幇浠锋槸鍚﹀彂鐢熷彉鍖�
+      if (this.form.xianprice !== this.lastXianPrice) {
+        this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning",
+        }).then(() => {
+          // 鏇存柊鎵�鏈夊瓙椤圭殑鎶樻墸
+          this.youhui = (Math.floor((this.form.xianprice / this.pics) * 100) / 100) * 10;
+          let totalYsprice = new Big(0);
+          this.DataList.forEach((item) => {
+            item.limits = this.youhui;
+            const ordPrice = new Big(item.priceOrd);
+            const discount = new Big(item.limits);
+            const result = ordPrice.times(discount.div(10));
+            item.priceNow = result.toNumber();
+            totalYsprice = totalYsprice.plus(new Big(item.priceNow));
+          });
+          
+          if (!totalYsprice.eq(this.form.xianprice)) {
+            const diff = new Big(this.form.xianprice).minus(totalYsprice);
+            if (this.DataList.length > 0) {
+              const lastItem = this.DataList[this.DataList.length - 1];
+              const newYsPrice = new Big(lastItem.priceNow).plus(diff).toNumber();
+              this.$set(this.DataList[this.DataList.length - 1], "priceNow", newYsPrice);
+            }
+          }
+          
+          // 淇濆瓨鏁版嵁
+          return this.saveData();
+        }).catch(() => {
+          // 鐢ㄦ埛鍙栨秷鎿嶄綔锛屾仮澶嶅師鏉ョ殑鐜颁环
+          this.form.xianprice = this.lastXianPrice;
+        });
+      } else {
+        // 鐜颁环娌℃湁鍙樺寲锛岀洿鎺ヤ繚瀛�
+        this.saveData();
+      }
+    },
+     // 鏂板涓�涓柟娉曞鐞嗕繚瀛橀�昏緫
+     saveData() {
+      this.form.limits = this.youhui;
+      this.form.price = this.pics;
+      this.form.priceNow = this.form.xianprice;
+      if (this.keys) {
+        this.form.keywords = this.keys;
+      }
+      let packageProjects = [];
+      this.DataList.forEach((item) => {
+        packageProjects.push({
+          proName: item.proName,
+          proId: item.proId,
+          priceNow: item.priceNow,
+          limits: item.limits,
+          priceOrd: item.priceOrd,
+        });
+      });
+      let data = {
+        pacName: this.form.pacName,
+        limits: this.form.limits,
+        pacStatus: this.form.pacStatus,
+        packageProjects: packageProjects, 
+        newPrice: this.form.xianprice,
+        price: this.pics,
+        pacId: this.form.pacId || null,
+        isOnSale: this.form.isOnSale,
+        sort: this.form.sort,
+        retailPrice: this.form.retailPrice,
+        tjCategory: this.form.tjCategory,
+        pacRemark: this.form.pacRemark,
+        detail: this.form.detail,
+      };
+      
+      return saveOreditTjPacNew(data).then((res) => {
+        this.open = false;
+        this.getList();
+      });
     },
     handleDelete(row) {
       const pacIds = row.pacId || this.ids;

--
Gitblit v1.8.0