From 492a91ada4f0f98d9d800b55f9dddda7b53f7dd8 Mon Sep 17 00:00:00 2001
From: wwl <xchao828@163.com>
Date: 星期六, 04 一月 2025 18:11:59 +0800
Subject: [PATCH] 1

---
 src/components/jianceResult/index.vue |   37 ++++-
 src/views/system/tijian/index.vue     |  144 ++++++++++++++++-------
 src/views/system/comp/index.vue       |  149 +++++++++++++++++-------
 3 files changed, 227 insertions(+), 103 deletions(-)

diff --git a/src/components/jianceResult/index.vue b/src/components/jianceResult/index.vue
index 07bec52..4baeb4a 100644
--- a/src/components/jianceResult/index.vue
+++ b/src/components/jianceResult/index.vue
@@ -1,6 +1,16 @@
 <template>
   <div>
-    <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
+    <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body @close="quxiao">
+      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
+
+        <el-form-item label="鍐呭" prop="xmg">
+          <el-input v-model="queryParams.xmgz" placeholder="璇疯緭鍏ュ唴瀹�" clearable @keyup.enter.native="handleQuery"
+            style="width: 130px;" />
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
+        </el-form-item>
+      </el-form>
       <el-table :data="dataList" ref="elTable" v-loading="loading" border @selection-change="handleSelectionChange">
         <el-table-column type="selection" width="40" align="center" />
         <el-table-column label="鏍囧彿" prop="aid" align="center" />
@@ -9,7 +19,7 @@
         <el-table-column label="绠�鐮�" prop="jm" align="center" />
       </el-table>
       <span slot="footer" class="dialog-footer">
-        <el-button @click="open = false">鍙� 娑�</el-button>
+        <el-button @click="quxiao">鍙� 娑�</el-button>
         <el-button type="primary" @click="handleOk">纭� 瀹�</el-button>
       </span>
     </el-dialog>
@@ -39,20 +49,27 @@
       },
       list: [],
       fList: {},
+      queryParams: { xmgz: '' }
     };
   },
   mounted() {
   },
   methods: {
+    quxiao(){
+      this.open = false
+      this.queryParams = {
+        xmgz: ''
+      }
+    },
     handleOk() {
-      if(this.list.length == 0) {
+      if (this.list.length == 0) {
         this.$modal.msgError("璇烽�夋嫨鑷冲皯涓�椤癸紒");
         return
-      } else{
+      } else {
         this.open = false
-      this.$emit('add', this.list);
+        this.$emit('add', this.list);
       }
-      
+
     },
     handleQuery() {
       this.getList();
@@ -63,14 +80,16 @@
     getList() {
       this.loading = true;
       selectZT({
-        proId: this.proId
+        proId: this.proId,
+        xmgz: this.queryParams.xmgz
       }).then((res) => {
-        if (res.data.length>0) {
+        if (res.data.length > 0) {
           this.open = true
           this.dataList = res.data;
           this.loading = false;
         } else {
-          this.open = false
+          this.dataList = res.data;
+          this.loading = false;
         }
       });
     },
diff --git a/src/views/system/comp/index.vue b/src/views/system/comp/index.vue
index 3163714..07b3d74 100644
--- a/src/views/system/comp/index.vue
+++ b/src/views/system/comp/index.vue
@@ -31,7 +31,7 @@
       </el-col>
       <el-col :span="1.5">
         <el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single" @click="mainDepartment"
-          v-hasPermi="['system:comp:edit']">缁存姢閮ㄩ棬</el-button>
+          v-hasPermi="['system:comp:edit']">缁存姢濂楅</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
@@ -333,8 +333,8 @@
                 <el-input ref="inputName" v-model="queryParams.price" placeholder="鍚堣" clearable style="width: 140px" />
               </el-form-item>
               <el-form-item label="浼樻儬">
-                <el-input-number ref="inputNumber" style="width: 150px" v-model="youhui" :precision="2"
-                  :step="0.1" :max="10" :min="1"></el-input-number>
+                <el-input-number ref="inputNumber" style="width: 150px" v-model="youhui" :precision="2" :step="0.1"
+                  :max="10" :min="1" @change="numberChange"></el-input-number>
               </el-form-item>
               <el-form-item label="鐜颁环">
                 <el-input ref="inputName" v-model="queryParams.xianprice" placeholder="鍚堣" clearable
@@ -372,8 +372,8 @@
           <el-col :span="2" :xs="24">
             <div style="margin: 240% 16%">
               <el-button type="primary" size="medium " icon="el-icon-back"
-                style="writing-mode: vertical-rl; text-align: center;letter-spacing: 10px;"
-                @click="resetright">纭</el-button>
+                style="writing-mode: vertical-rl; text-align: center;letter-spacing: 10px;" @click="resetright">纭�
+                璁�</el-button>
             </div>
           </el-col>
           <el-col :span="11" :xs="24">
@@ -801,7 +801,7 @@
       this.updateProPrice(row); // 鏇存柊浠锋牸鎴栧叾浠栭�昏緫
     },
     updateProPrice(row) {
-  
+
       const proPrice = new Big(row.proPrice);
 
       const limits = new Big(row.limits);
@@ -810,7 +810,7 @@
       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
+      this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
     },
     getList() {
       this.$nextTick(() => {
@@ -971,16 +971,34 @@
         }
       });
     },
-    // 鎶樻墸
-    numberChange(currentValue) {
-      this.forms.limits = currentValue;
-      /* if (this.forms.limits > this.getInfodis) {
-        this.forms.limits = this.getInfodis;
-        this.forms.ysPrice = (
-          this.forms.price *
-          (this.forms.limits / 10)
-        ).toFixed(2);
-      } */
+    numberChange(currentValue, oldValue) {
+      this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          this.youhui = currentValue;
+          if (this.youhui < this.getInfodis) {
+            this.youhui = this.getInfodis;
+            // this.$modal.msgError(`璇ヤ汉鍛樻渶楂樹紭鎯犳潈闄愪负${this.getInfodis}鎶榒);
+          }
+          this.OnenewpacName.forEach((item) => {
+            item.limits = this.youhui
+            const proPrice = new Big(item.proPrice);
+            const limits = new Big(item.limits);
+            const result = proPrice.times(limits.div(10));  // ordPrice * (discount / 10)
+            item.ysPrice = result.toNumber();
+            this.queryParams.xianprice = this.OnenewpacName.reduce((sum, item) => {
+              return sum.plus(new Big(item.ysPrice || '0'));
+            }, new Big(0));
+          })
+          // ----------------------------------------------------------
+
+        })
+        .catch(() => {
+          this.youhui = oldValue;
+        });
 
     },
 
@@ -1074,37 +1092,74 @@
         this.dataList = selection;
       }
     },
-    // 鍗曢」閫夊畾鎸夐挳
     resetright() {
-      this.queryParams.price = 0;
-      this.dataList.forEach((item) => {
-        this.$refs.tre.toggleRowSelection(item, false);
-        this.OnenewpacName.push(item);
-      });
+  this.queryParams.price = 0;
+  this.queryParams.xianprice = 0; // 鍒濆鍖栫幇浠�
+  this.youhui = 0; // 鍒濆鍖栦紭鎯�
 
-      for (var i = 0; i < this.OnenewpacName.length - 1; i++) {
-        for (var j = i + 1; j < this.OnenewpacName.length; j++) {
-          if (this.OnenewpacName[i].proId == this.OnenewpacName[j].proId) {
-            this.OnenewpacName.splice(j, 1);
-            j--;
-          }
-        }
+  const newItemsToAdd = [];
+
+  this.dataList.forEach((item) => {
+    this.$refs.tre.toggleRowSelection(item, false);
+    // 浣跨敤 $set 纭繚鍝嶅簲鎬�
+    this.$set(item, 'limits', 10);
+    this.$set(item, 'ysPrice', item.proPrice);
+    
+    // 妫�鏌ユ槸鍚﹀凡缁忓瓨鍦ㄧ浉鍚岀殑椤圭洰
+    const existingItem = this.OnenewpacName.find(existing => existing.proId === item.proId);
+    if (!existingItem) {
+      newItemsToAdd.push(item);
+      this.updateProPrice(item); // 鏇存柊鍗曚釜椤圭洰鐨勪环鏍�
+    }
+  });
+
+  // 娣诲姞鏂伴」鐩埌 OnenewpacName
+  this.OnenewpacName.push(...newItemsToAdd);
+
+  // 鍒犻櫎閲嶅椤圭洰锛岃繖閲屾垜浠彧闇�澶勭悊鏂版坊鍔犵殑椤圭洰鍜屽師鏈夐」鐩箣闂寸殑閲嶅
+  for (let i = this.OnenewpacName.length - newItemsToAdd.length; i < this.OnenewpacName.length - 1; i++) {
+    for (let j = i + 1; j < this.OnenewpacName.length; j++) {
+      if (this.OnenewpacName[i].proId === this.OnenewpacName[j].proId) {
+        this.OnenewpacName.splice(j, 1);
+        j--;
       }
-      return this.OnenewpacName.forEach((item) => {
-        this.queryParams.price += item.proPrice;
-      });
-    },
-    handledbelete(row) {
-      this.queryParams.price = 0;
-      this.OnenewpacName.forEach((item, index) => {
-        if (item.proId == row.proId) {
-          this.OnenewpacName.splice(index, 1);
-        }
-      });
-      return this.OnenewpacName.forEach((item) => {
-        this.queryParams.price += item.proPrice;
-      });
-    },
+    }
+  }
+
+  // 璁$畻鎬讳环鍜岀幇浠�
+  this.OnenewpacName.forEach((item) => {
+    this.queryParams.price += item.proPrice;
+    this.queryParams.xianprice += item.ysPrice || 0; // 纭繚ysPrice瀛樺湪
+  });
+
+  // 璁$畻浼樻儬
+  if (this.queryParams.price > 0) {
+    this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
+  } else {
+    this.youhui = 0;
+  }
+},
+handledbelete(row) {
+  this.queryParams.price = 0;
+  this.queryParams.xianprice = 0; // 鍒濆鍖栫幇浠�
+  this.youhui = 0; // 鍒濆鍖栦紭鎯�
+  
+  // 鍏堟壘鍒板苟鍒犻櫎椤圭洰
+  this.OnenewpacName = this.OnenewpacName.filter(item => item.proId !== row.proId);
+
+  // 鐒跺悗鏇存柊鎬讳环鍜岀幇浠�
+  this.OnenewpacName.forEach((item) => {
+    this.queryParams.price += item.proPrice;
+    this.queryParams.xianprice += item.ysPrice || 0; // 纭繚ysPrice瀛樺湪
+  });
+
+  // 璁$畻浼樻儬
+  if (this.queryParams.price > 0) {
+    this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10;
+  } else {
+    this.youhui = 0;
+  }
+},
 
     submitrighr() {
       this.openOne = false;
@@ -1258,7 +1313,7 @@
           this.OnenewpacName.forEach((item, index) => {
             this.queryParams.price += item.proPrice;
           });
-          this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price)*100)/100)*10
+          this.youhui = (Math.floor((this.queryParams.xianprice / this.queryParams.price) * 100) / 100) * 10
         });
       }
       // console.log(this.groupList[0].id, 9966);
@@ -1311,7 +1366,7 @@
       });
 
 
-   
+
 
       let data = {
         groupingName: this.forms.groupingName,
diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue
index 7c1f5d9..ec6cc61 100644
--- a/src/views/system/tijian/index.vue
+++ b/src/views/system/tijian/index.vue
@@ -218,13 +218,7 @@
               <el-input :disabled="isDisabled" v-model="form.cusIntroduce" placeholder="璇疯緭鍏ヤ粙缁嶄汉" />
             </el-form-item>
 
-            <el-form-item label="鍗曚綅鍚嶇О" prop="compName">
-              <el-select :disabled="isDisabled" v-model="form.compName" remote default-first-option allow-create
-                filterable style="width: 200px" placeholder="璇烽�夋嫨鍗曚綅鍚嶇О" clearable @change="idFn1">
-                <el-option v-for="dict in CompanyList" :key="dict.cnName" :label="dict.cnName" :value="dict.cnName" />
-              </el-select>
-              <!-- <i class="el-icon-circle-plus-outline" @click="handleAdd1"></i> -->
-            </el-form-item>
+
 
             <el-form-item label="鏂囧寲绋嬪害" prop="wenHua" label-width="93px">
               <el-input :disabled="isDisabled" v-model="form.wenHua" placeholder="璇疯緭鍏ユ枃鍖栫▼搴�" />
@@ -482,15 +476,47 @@
       <el-col :span="15">
         <div class="grid-content bg-purple">
           <template>
-            <el-form :model="form" :inline="true" label-width="75px" style="margin-left: 20px">
+            <el-form :model="form" :inline="true" label-width="75px" style="margin-left: 20px;width: 900px;">
+              <el-form-item label="濮撳悕" prop="cusName">
+                <span slot="label">
+                  濮撳悕
+                </span>
+                <el-input v-model="form.cusName" placeholder="璇疯緭鍏ュ鍚�" :disabled="isDisabled" />
+              </el-form-item>
+              <el-form-item label="鎬у埆" prop="cusSex">
+                <el-select :disabled="isDisabled" v-model="form.cusSex" placeholder="鎬у埆" style="width: 150px">
+                  <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
+                    :value="parseInt(dict.value)"></el-option>
+                </el-select>
+              </el-form-item>
+              <el-form-item label="璇佷欢鍙风爜" prop="cusIdcard">
+                <span slot="label">
+                  璇佷欢鍙风爜
+                </span>
+                <el-input :disabled="isDisabled" v-model="form.cusIdcard" placeholder="璇疯緭鍏ヨ韩浠借瘉鍙�" @input="inputChange" />
+              </el-form-item>
+              <el-form-item label="鍗曚綅鍚嶇О" prop="firmName">
+                <el-select v-model="form.firmName" remote default-first-option allow-create filterable
+                  style="width: 200px" placeholder="璇烽�夋嫨鍗曚綅鍚嶇О" clearable @change="idFn1" @clear="clear">
+                  <el-option v-for="dict in CompanyList" :key="dict.cnName" :label="dict.cnName" :value="dict.cnName" />
+                </el-select>
+              </el-form-item>
               <el-form-item label="浣撴绫诲瀷">
                 <el-select style="width: 150px" v-model="form.tjType" placeholder="璇烽�夋嫨浣撴绫诲瀷">
                   <el-option v-for="dict in dict.type.dict_team" :key="dict.value" :label="dict.label"
-                    :value="dict.value"></el-option>
+                    :value="dict.value" :disabled="!form.firmId && dict.value === '1'"></el-option>
                 </el-select>
               </el-form-item>
+
+              <el-form-item label="浣撴绫诲埆">
+                <el-select style="width: 200px" v-model="tjCategory" placeholder="璇烽�夋嫨浣撴绫诲埆">
+                  <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.value" :label="dict.label"
+                    :value="dict.value"></el-option>
+                </el-select>
+                <!-- <el-input v-model="form.category" placeholder="璇疯緭鍏ヤ綋妫�绫诲埆" /> -->
+              </el-form-item>
               <el-form-item label="搴旀敹閲戦">
-                <el-input placeholder="搴旀敹閲戦" v-model="TotalPrice1" disabled style="width: 150px"></el-input>
+                <el-input placeholder="搴旀敹閲戦" v-model="TotalPrice1" disabled style="width: 200px"></el-input>
               </el-form-item>
               <el-form-item label="浼樻儬">
                 <!-- {{ discount }} -->
@@ -498,24 +524,11 @@
                   :max="10" :min="0" @change="numberChange" :disabled="isfalse"></el-input-number>
               </el-form-item>
               <el-form-item label="瀹炴敹閲戦">
-                <el-input placeholder="瀹炴敹閲戦" v-model="TotalPrice" style="width: 150px"></el-input>
+                <el-input placeholder="瀹炴敹閲戦" v-model="TotalPrice" style="width: 206px"></el-input>
               </el-form-item>
               <br />
 
-              <el-form-item label="棰嗗彇鏂瑰紡">
 
-                <el-select v-model="getType" style="width: 150px" @change="getmailType">
-                  <el-option v-for="dict in dict.type.report_get_type" :key="dict.value" :label="dict.label"
-                    :value="dict.value"></el-option>
-                </el-select>
-              </el-form-item>
-              <el-form-item label="浣撴绫诲埆">
-                <el-select style="width: 150px" v-model="tjCategory" placeholder="璇烽�夋嫨浣撴绫诲埆">
-                  <el-option v-for="dict in dict.type.dict_tjtype" :key="dict.value" :label="dict.label"
-                    :value="dict.value"></el-option>
-                </el-select>
-                <!-- <el-input v-model="form.category" placeholder="璇疯緭鍏ヤ綋妫�绫诲埆" /> -->
-              </el-form-item>
 
               <el-form-item style="margin-left: 149px">
                 <el-button type="primary" @click="Package" size="mini" style="margin-right: 20px">閫夋嫨濂楅</el-button>
@@ -1026,6 +1039,8 @@
         cusMarryStatus: "5",
         idType: "1",
         ageUnit: "0",
+        firmId: '',
+
       },
       form1: {},
       title: "",
@@ -1078,6 +1093,9 @@
   mounted() { },
 
   methods: {
+    clear() {
+      this.form.firmId = ""
+    },
     /** 鍒犻櫎鎸夐挳鎿嶄綔 */
     handleDelete1(row) {
       console.log(row);
@@ -1177,16 +1195,20 @@
     },
     idFn1(value) {
       if (value) {
-        const originalCompId = this.form.dictCompId;
-        this.form.compName = value;
+        console.log(value)
+        const originalCompId = this.form.firmId;
+        this.form.firmName = value;
         this.CompanyList.forEach((item) => {
-          if (item.cnName == this.form.compName) {
-            this.form.dictCompId = item.drugManufacturerId;
+          if (item.cnName == this.form.firmName) {
+            this.form.firmId = item.drugManufacturerId;
           }
         });
 
-        if (this.form.dictCompId === originalCompId) {
-          this.form.dictCompId = "";
+        if (this.form.firmId === originalCompId) {
+          this.form.firmId = "";
+        }
+        if (this.form.firmId) {
+          this.form.tjType = "1"
         }
       }
     },
@@ -1551,6 +1573,7 @@
         updateBy: null,
         updateTime: null,
         deleted: null,
+        firmid: ''
       };
       this.resetForm("form");
     },
@@ -1583,11 +1606,34 @@
 
     // 鎶樻墸
     numberChange(currentValue, oldValue) {
-      this.discount = currentValue;
-      if (this.discount <= this.getInfodis) {
-        this.discount = this.getInfodis;
-      }
-      // this.TotalPrice = (this.TotalPrice1 * (this.discount / 10)).toFixed(2);
+      this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          this.discount = currentValue;
+          if (this.discount < this.getInfodis) {
+            this.discount = this.getInfodis;
+            // this.$modal.msgError(`璇ヤ汉鍛樻渶楂樹紭鎯犳潈闄愪负${this.getInfodis}鎶榒);
+          }
+          this.tableData1.forEach((item) => {
+            item.discount = this.discount
+            const ordPrice = new Big(item.ordPrice);
+            const discount = new Big(item.discount);
+            const result = ordPrice.times(discount.div(10));  // ordPrice * (discount / 10)
+            item.nowPrice = result.toNumber();
+            this.TotalPrice = this.tableData1.reduce((sum, item) => {
+              return sum.plus(new Big(item.nowPrice || '0'));
+            }, new Big(0));
+          })
+          // ----------------------------------------------------------
+
+        })
+        .catch(() => {
+          this.discount = oldValue;
+        });
+
     },
 
     /** 鐧昏鎻愪氦鎸夐挳 */
@@ -2135,7 +2181,7 @@
       this.name = this.queryParam.pacName;
       let param = {
         sex: this.form.cusSex,
-        dwId: this.form.dictCompId
+        dwId: this.form.firmId
       }
       if (this.name) {
         getPackageListName(this.name).then((response) => {
@@ -2249,10 +2295,10 @@
 
       let param = {
         sex: cusSex,
-        dwId: this.form.dictCompId || ''
+        dwId: this.form.firmId || ''
       }
       if (this.form.tjType == 1) {
-        if (!this.form.dictCompId) {
+        if (!this.form.firmId) {
           this.$message({
             type: "warning",
             message: "璇峰厛缁存姢鍗曚綅锛�",
@@ -2712,8 +2758,6 @@
               this.TotalPrice1 = 0;
               if (this.tableData1) {
                 this.tableData1.forEach((item) => {
-                  this.TotalPrice1 += item.ordPrice;
-                  this.TotalPrice += item.nowPrice;
                   if (item.tjCategory != null) {
                     this.tjCategory = item.tjCategory;
                   }
@@ -2722,10 +2766,16 @@
                       this.treeList.push(item9.proId);
                     });
                   }
+                  this.TotalPrice1 += item.ordPrice;
+                  this.TotalPrice += item.nowPrice;
+
                   this.pacName = item.pacName;
                 });
 
-
+                this.TotalPrice = this.tableData1.reduce((sum, item) => {
+                  return sum.plus(new Big(item.nowPrice || '0'));
+                }, new Big(0));
+                this.discount = (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10
                 this.list1 = false;
                 this.list3 = true;
                 this.list2 = false;
@@ -2738,7 +2788,8 @@
 
           }
         });
-      } else {
+      }
+       else {
         getaddtTransition(data).then((response) => {
           if (response.code == 200) {
             let cusId = this.form.cusIdcard;
@@ -2748,8 +2799,6 @@
               this.TotalPrice1 = 0;
               if (this.tableData1) {
                 this.tableData1.forEach((item) => {
-                  this.TotalPrice1 += item.ordPrice;
-                  this.TotalPrice += item.nowPrice;
                   if (item.tjCategory != null) {
                     this.tjCategory = item.tjCategory;
                   }
@@ -2758,9 +2807,12 @@
                       this.treeList.push(item9.proId);
                     });
                   }
+                  this.TotalPrice1 += item.ordPrice;
+                  this.TotalPrice += item.nowPrice;
+
                   this.pacName = item.pacName;
                 });
-
+                this.discount = (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10
 
 
                 this.list1 = false;
@@ -2776,8 +2828,6 @@
           }
         });
       }
-
-
       this.taocan = false;
       this.defaultKeys = [];
       this.DataLists = [];

--
Gitblit v1.8.0