From 287ebd61bb900d52fa968fc7eaf525728cc848fb Mon Sep 17 00:00:00 2001
From: qx <1084500556@qq.com>
Date: 星期四, 24 七月 2025 10:49:01 +0800
Subject: [PATCH] qx

---
 src/views/system/tijian/index.vue     |   10 +
 src/views/hosp/order/index.vue        |  179 ++++++++++++++++++++++++-
 public/yuanqu.ini                     |    1 
 src/views/sampling/sampling/index.vue |   17 ++
 src/views/hosp/order/index1.vue       |  164 ----------------------
 5 files changed, 200 insertions(+), 171 deletions(-)

diff --git a/public/yuanqu.ini b/public/yuanqu.ini
index 63f25b6..851fa96 100644
--- a/public/yuanqu.ini
+++ b/public/yuanqu.ini
@@ -1,6 +1,7 @@
 [development]
 8094=pbkwyy
 81=jdczgzyy
+82=bjxjyy
 8095=jdczgzyy
 8096=sqyy
 8097=wbzxyy
diff --git a/src/views/hosp/order/index.vue b/src/views/hosp/order/index.vue
index add60fd..4f31111 100644
--- a/src/views/hosp/order/index.vue
+++ b/src/views/hosp/order/index.vue
@@ -474,7 +474,7 @@
               </el-table-column>
               <el-table-column prop="proPrice" label="鍘熶环" width="56px">
               </el-table-column>
-              
+
 
               <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" width="50px">
                 <template slot-scope="scope">
@@ -596,6 +596,19 @@
               </el-table-column>
               <el-table-column prop="proPrice" label="鍘熶环" width="56px">
               </el-table-column>
+              <el-table-column label="鎶樻墸">
+                <template slot-scope="scope">
+                  <!-- @input="validateDiscount(scope.row)" -->
+                  <el-input-number v-model.number="scope.row.discount" @change="handleManualChange(scope.row)"
+                    placeholder="杈撳叆鎶樻墸" size="small" type="number" :precision="1" :step="0.1" :max="10" :min="0">
+                  </el-input-number>
+                </template>
+              </el-table-column>
+              <el-table-column prop="nowPrice" label="鐜颁环">
+                <template slot-scope="scope">
+                  {{ scope.row.nowPrice ? scope.row.nowPrice.toFixed(2) : scope.row.nowPrice }}
+                </template>
+              </el-table-column>
 
               <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" width="50px">
                 <template slot-scope="scope">
@@ -623,13 +636,23 @@
           </el-form-item>
 
           <!-- 鎶樻墸璁惧畾 -->
-          <el-form-item label="鎶樻墸" style="display: flex">
+          <!-- <el-form-item label="鎶樻墸" style="display: flex">
             <el-input style="width: 90px" type="number" v-model="discount" :value="discount"></el-input>
+          </el-form-item> -->
+
+          <el-form-item label="鎶樻墸">
+            <!-- {{ discount }} -->
+            <el-input-number ref="inputNumber" style="width: 150px" v-model="discount" :precision="1" :step="0.1"
+              :max="10" :min="0" @change="debounceNumberChange"></el-input-number>
           </el-form-item>
 
           <!-- 搴斾粯閲戦 -->
-          <el-form-item label="搴斾粯" style="display: flex">
+          <!-- <el-form-item label="搴斾粯" style="display: flex">
             <el-input placeholder="搴斾粯閲戦" :value="TotalPrice1 * (discount / 10)" style="width: 90px"></el-input>
+          </el-form-item> -->
+          <el-form-item label="搴斾粯">
+            <el-input placeholder="搴斾粯閲戦" v-model="TotalPrice" style="width: 206px" @input="changeXianjia"
+              @blur="numberChangeXianPrice(discount, discount)" />
           </el-form-item>
 
           <!-- 浠樻绫诲瀷 -->
@@ -942,6 +965,7 @@
   getForceChexiao,
 } from "@/api/hosp/order";
 import moment from "moment";
+import Big from "big.js";
 import { getZhList, getlistByZhId } from "@/api/system/package";
 import { getwater } from "@/api/hosp/customer";
 import { getInfo } from "@/api/login";
@@ -1034,6 +1058,7 @@
       },
       TreedataList: [],
       discount: 10,
+      lastXianPrice:0,
       DataList: [],
       shijianlist: [],
       // 濂楅鎻愪氦鎸夐挳
@@ -1042,6 +1067,7 @@
       activeName: "1",
       proIds: [],
       TotalPrice1: 0,
+      TotalPrice: 0,
       TotalPrice6: 0,
       TotalPrice7: 0,
       numberList: [],
@@ -1457,7 +1483,8 @@
     },
 
 
-     updateProPrice(row) {
+    updateProPrice(row) {
+      console.log(row)
       const ordPrice = new Big(row.ordPrice);
       const discount = new Big(row.discount);
       const result = ordPrice.times(discount.div(10)); // ordPrice * (discount / 10)
@@ -1471,12 +1498,146 @@
     },
 
 
-     handleManualChange(row) {
+    debounceNumberChange(currentValue, oldValue) {
+      clearTimeout(this.debounceTimer);
+      this.debounceTimer = setTimeout(() => {
+        this.numberChange(currentValue, oldValue);
+      }, 300);
+    },
+
+    // 鎶樻墸
+    numberChange(currentValue, oldValue) {
+      this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          this.discount = currentValue;
+          this.DataList3.forEach((item) => {
+            item.discount = this.discount;
+            const ordPrice = new Big(item.proPrice.toString());
+            const discount = new Big(item.discount.toString());
+            const result = ordPrice.times(discount.div(10));
+            item.nowPrice = result.toNumber();
+            // this.TotalPrice = this.DataList3.reduce((sum, item) => {
+            //   return sum.plus(new Big(item.nowPrice || "0"));
+            // }, new Big(0));
+            this.TotalPrice = new Big(this.TotalPrice1 * (this.discount / 10))
+          });
+        })
+        .catch(() => {
+          this.discount = oldValue;
+        });
+    },
+
+    changeXianjia() {
+      // 鍘熷鎶樻墸鐜囪绠�
+      if (this.TotalPrice1 !== 0) {
+        this.discount =
+          (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10;
+      }
+    },
+    numberChangeXianPrice(currentValue, oldValue) {
+      // 濡傛灉鐜颁环娌℃湁鍙樺寲锛岀洿鎺ヨ繑鍥�
+      if (this.TotalPrice === this.lastXianPrice || !this.TotalPrice) {
+        return;
+      }
+      this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          this.discount = currentValue;
+          // if (this.discount < this.getInfodis) {
+          //   this.discount = this.getInfodis;
+          // }
+          let totalYsprice = new Big(0);
+          console.log(this.tableData3, 11111)
+          this.tableData3.forEach((item) => {
+            item.discount = this.discount;
+            const ordPrice = new Big(item.proPrice);
+            const discount = new Big(item.discount);
+            const result = ordPrice.times(discount.div(10));
+            item.nowPrice = result.toNumber();
+            totalYsprice = totalYsprice.plus(new Big(item.nowPrice));
+          });
+          if (!totalYsprice.eq(this.TotalPrice)) {
+            const diff = new Big(this.TotalPrice).minus(totalYsprice);
+            if (this.tableData1.length > 0) {
+              const lastItem = this.tableData3[this.tableData3.length - 1];
+              const newYsPrice = new Big(lastItem.nowPrice)
+                .plus(diff)
+                .toNumber();
+              // console.log(
+              //   "hhh",
+              //   this.tableData1[this.tableData1.length - 1].nowPrice,
+              //   newYsPrice
+              // );
+              this.$set(
+                this.tableData3[this.tableData3.length - 1],
+                "nowPrice",
+                newYsPrice
+              );
+            }
+          }
+          this.lastXianPrice = this.TotalPrice;
+        })
+        .catch(() => {
+          this.discount = oldValue;
+        });
+    },
+    handleManualChange(row) {
       this.updateProPrice(row);
     },
 
-     updateProPrice(row) {
-      const ordPrice = new Big(row.ordPrice);
+    //  validateDiscount(row) {
+    //   if (
+    //     this.TotalPrice !== undefined &&
+    //     !isNaN(this.TotalPrice) &&
+    //     this.TotalPrice !== this.lastXianPrice
+    //   ) {
+    //     this.updateProPrice1(row);
+    //     this.lastXianPrice = this.TotalPrice;
+    //   }
+    // },
+    // updateProPrice1(row) {
+    //     console.log( row,2222)
+    //   const ordPrice = new Big(row.proPrice);
+    //   const discount = new Big(row.discount);
+    //   const result = ordPrice.times(discount.div(10));
+    //   row.nowPrice = result.toNumber();
+    //   const totalYsPrice = this.tableData1.reduce((sum, item) => {
+    //     return sum.plus(new Big(item.nowPrice || "0"));
+    //   }, new Big(0));
+    //   const totalYsPriceNum = totalYsPrice.toNumber();
+    //   if (this.TotalPrice !== undefined && !isNaN(this.TotalPrice)) {
+    //     const xianPrice = new Big(this.TotalPrice);
+    //     const diff = xianPrice.minus(totalYsPriceNum);
+    //     if (!diff.eq(0) && this.tableData1.length > 0) {
+    //       const lastItem = this.tableData1[this.tableData1.length - 1];
+    //       const newYsPrice = new Big(lastItem.nowPrice).plus(diff).toNumber();
+    //       this.$set(
+    //         this.tableData1[this.tableData1.length - 1],
+    //         "nowPrice",
+    //         newYsPrice
+    //       );
+    //     }
+    //   }
+
+    // Update youhui calculation
+    //   if (this.TotalPrice1 !== 0 && this.TotalPrice !== 0) {
+    //     this.discount =
+    //       (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10;
+    //   } else {
+    //     this.discount = 0;
+    //   }
+    // },
+
+    updateProPrice(row) {
+      console.log(row, 55555)
+      const ordPrice = new Big(row.proPrice);
       const discount = new Big(row.discount);
       const result = ordPrice.times(discount.div(10)); // ordPrice * (discount / 10)
       row.nowPrice = result.toNumber();
@@ -2241,6 +2402,8 @@
           this.TotalPrice1 = 0;
           this.DataList3.forEach((item) => {
             this.TotalPrice1 += item.proPrice * item.sl;
+             this.TotalPrice = new Big(this.TotalPrice1 * (this.discount / 10))
+          this.lastXianPrice = this.TotalPrice;
           });
         });
       } else if (checked === false) {
@@ -2269,6 +2432,8 @@
           this.TotalPrice1 = 0;
           this.DataList3.forEach((item) => {
             this.TotalPrice1 += item.proPrice * item.sl;
+             this.TotalPrice = new Big(this.TotalPrice1 * (this.discount / 10))
+          this.lastXianPrice = this.TotalPrice;
           });
         });
       }
diff --git a/src/views/hosp/order/1.vue b/src/views/hosp/order/index1.vue
similarity index 93%
rename from src/views/hosp/order/1.vue
rename to src/views/hosp/order/index1.vue
index 95e2533..add60fd 100644
--- a/src/views/hosp/order/1.vue
+++ b/src/views/hosp/order/index1.vue
@@ -596,19 +596,6 @@
               </el-table-column>
               <el-table-column prop="proPrice" label="鍘熶环" width="56px">
               </el-table-column>
-              <el-table-column label="鎶樻墸">
-                <template slot-scope="scope">
-                  <el-input-number v-model.number="scope.row.discount" @input="validateDiscount(scope.row)"
-                    @change="handleManualChange(scope.row)" placeholder="杈撳叆鎶樻墸" size="small" type="number" :precision="1"
-                    :step="0.1" :max="10" :min="0">
-                  </el-input-number>
-                </template>
-              </el-table-column>
-              <el-table-column prop="nowPrice" label="鐜颁环">
-                    <template slot-scope="scope">
-                      {{ scope.row.nowPrice? scope.row.nowPrice.toFixed(2):scope.row.nowPrice }}
-                    </template>
-                  </el-table-column>
 
               <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" width="50px">
                 <template slot-scope="scope">
@@ -636,24 +623,14 @@
           </el-form-item>
 
           <!-- 鎶樻墸璁惧畾 -->
-          <!-- <el-form-item label="鎶樻墸" style="display: flex">
+          <el-form-item label="鎶樻墸" style="display: flex">
             <el-input style="width: 90px" type="number" v-model="discount" :value="discount"></el-input>
-          </el-form-item> -->
-
-           <el-form-item label="鎶樻墸">
-                  <!-- {{ discount }} -->
-                  <el-input-number ref="inputNumber" style="width: 150px" v-model="discount" :precision="1" :step="0.1"
-                    :max="10" :min="0"  @change="debounceNumberChange"></el-input-number>
-                </el-form-item>
+          </el-form-item>
 
           <!-- 搴斾粯閲戦 -->
-          <!-- <el-form-item label="搴斾粯" style="display: flex">
+          <el-form-item label="搴斾粯" style="display: flex">
             <el-input placeholder="搴斾粯閲戦" :value="TotalPrice1 * (discount / 10)" style="width: 90px"></el-input>
-          </el-form-item> -->
-           <el-form-item label="搴斾粯">
-                  <el-input placeholder="搴斾粯閲戦" v-model="TotalPrice" style="width: 206px" @input="changeXianjia"
-                    @blur="numberChangeXianPrice(discount, discount)" />
-                </el-form-item>
+          </el-form-item>
 
           <!-- 浠樻绫诲瀷 -->
           <el-form-item label="浠樻绫诲瀷" prop="payType" style="display: flex">
@@ -965,7 +942,6 @@
   getForceChexiao,
 } from "@/api/hosp/order";
 import moment from "moment";
-import Big from "big.js";
 import { getZhList, getlistByZhId } from "@/api/system/package";
 import { getwater } from "@/api/hosp/customer";
 import { getInfo } from "@/api/login";
@@ -1066,7 +1042,6 @@
       activeName: "1",
       proIds: [],
       TotalPrice1: 0,
-      TotalPrice: 0,
       TotalPrice6: 0,
       TotalPrice7: 0,
       numberList: [],
@@ -1494,143 +1469,14 @@
       this.discount =
         (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10;
     },
-  debounceNumberChange(currentValue, oldValue) {
-      clearTimeout(this.debounceTimer);
-      this.debounceTimer = setTimeout(() => {
-        this.numberChange(currentValue, oldValue);
-      }, 300);
-    },
 
-      // 鎶樻墸
-    numberChange(currentValue, oldValue) {
-      this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        type: "warning",
-      })
-        .then(() => {
-          this.discount = currentValue;
-          this.DataList3.forEach((item) => {
-            item.discount = this.discount;
-            const ordPrice = new Big(item.ordPrice.toString());
-            const discount = new Big(item.discount.toString());
-            const result = ordPrice.times(discount.div(10));
-            item.nowPrice = result.toNumber();
-            // this.TotalPrice = this.DataList3.reduce((sum, item) => {
-            //   return sum.plus(new Big(item.nowPrice || "0"));
-            // }, new Big(0));
-            this.TotalPrice =  new Big(TotalPrice1 * (discount / 10))
-          });
-        })
-        .catch(() => {
-          this.discount = oldValue;
-        });
-    },
 
-     changeXianjia() {
-      // 鍘熷鎶樻墸鐜囪绠�
-      if (this.TotalPrice1 !== 0) {
-        this.discount =
-          (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10;
-      }
-    },
- numberChangeXianPrice(currentValue, oldValue) {
-      // 濡傛灉鐜颁环娌℃湁鍙樺寲锛岀洿鎺ヨ繑鍥�
-      if (this.TotalPrice === this.lastXianPrice || !this.TotalPrice) {
-        return;
-      }
-      this.$confirm("纭畾淇敼鎵�鏈夊瓙椤圭殑鎶樻墸鍚楋紵", "鎻愮ず", {
-        confirmButtonText: "纭畾",
-        cancelButtonText: "鍙栨秷",
-        type: "warning",
-      })
-        .then(() => {
-          this.discount = currentValue;
-          if (this.discount < this.getInfodis) {
-            this.discount = this.getInfodis;
-          }
-          let totalYsprice = new Big(0);
-          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));
-            item.nowPrice = result.toNumber();
-            totalYsprice = totalYsprice.plus(new Big(item.nowPrice));
-          });
-          if (!totalYsprice.eq(this.TotalPrice)) {
-            const diff = new Big(this.TotalPrice).minus(totalYsprice);
-            if (this.tableData1.length > 0) {
-              const lastItem = this.tableData1[this.tableData1.length - 1];
-              const newYsPrice = new Big(lastItem.nowPrice)
-                .plus(diff)
-                .toNumber();
-              // console.log(
-              //   "hhh",
-              //   this.tableData1[this.tableData1.length - 1].nowPrice,
-              //   newYsPrice
-              // );
-              this.$set(
-                this.tableData1[this.tableData1.length - 1],
-                "nowPrice",
-                newYsPrice
-              );
-            }
-          }
-          this.lastXianPrice = this.TotalPrice;
-        })
-        .catch(() => {
-          this.discount = oldValue;
-        });
-    },
      handleManualChange(row) {
       this.updateProPrice(row);
     },
 
-     validateDiscount(row) {
-      if (
-        this.TotalPrice !== undefined &&
-        !isNaN(this.TotalPrice) &&
-        this.TotalPrice !== this.lastXianPrice
-      ) {
-        this.updateProPrice1(row);
-        this.lastXianPrice = this.TotalPrice;
-      }
-    },
-    updateProPrice1(row) {
-      const ordPrice = new Big(row.ordPrice);
-      const discount = new Big(row.discount);
-      const result = ordPrice.times(discount.div(10));
-      row.nowPrice = result.toNumber();
-      const totalYsPrice = this.tableData1.reduce((sum, item) => {
-        return sum.plus(new Big(item.nowPrice || "0"));
-      }, new Big(0));
-      const totalYsPriceNum = totalYsPrice.toNumber();
-      if (this.TotalPrice !== undefined && !isNaN(this.TotalPrice)) {
-        const xianPrice = new Big(this.TotalPrice);
-        const diff = xianPrice.minus(totalYsPriceNum);
-        if (!diff.eq(0) && this.tableData1.length > 0) {
-          const lastItem = this.tableData1[this.tableData1.length - 1];
-          const newYsPrice = new Big(lastItem.nowPrice).plus(diff).toNumber();
-          this.$set(
-            this.tableData1[this.tableData1.length - 1],
-            "nowPrice",
-            newYsPrice
-          );
-        }
-      }
-
-      // Update youhui calculation
-      if (this.TotalPrice1 !== 0 && this.TotalPrice !== 0) {
-        this.discount =
-          (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10;
-      } else {
-        this.discount = 0;
-      }
-    },
-
      updateProPrice(row) {
-      const ordPrice = new Big(row.proPrice);
+      const ordPrice = new Big(row.ordPrice);
       const discount = new Big(row.discount);
       const result = ordPrice.times(discount.div(10)); // ordPrice * (discount / 10)
       row.nowPrice = result.toNumber();
diff --git a/src/views/sampling/sampling/index.vue b/src/views/sampling/sampling/index.vue
index 71781d5..f8885c1 100644
--- a/src/views/sampling/sampling/index.vue
+++ b/src/views/sampling/sampling/index.vue
@@ -300,6 +300,7 @@
         proId: null,
         proName: null,
       },
+      tjNumber: null,
       startTime: "",
       tableKey: "",
       pickerOptions: {
@@ -456,10 +457,19 @@
 
 
     jydPrint() {
-      const tjnumber = this.piliangList[0].tjNumber;
+      if (this.piliangList.length != 0) {
+        const tjnumber = this.piliangList[0].tjNumber;
       const viewNum = "1086792376946569216";
       const params = { viewNum, tjnumber };
       this.$tab.openPage("妫�楠岀瀵兼鍗�", "/report/clinical", params);
+      this.$refs.tb.toggleRowSelection(this.piliangList[0], false);
+      this.piliangList = []
+      } else {
+        this.$message.info('璇烽噸鏂伴�夋嫨瑕佹墦鍗扮殑鏁版嵁');
+        this.$refs.tb.toggleRowSelection(this.piliangList[0], false);
+          this.piliangList = []
+      }
+     
     },
     getTruncatedName(proName) {
       // 鍘绘帀鎵�鏈夌┖鏍�
@@ -632,13 +642,13 @@
     },
     handleCurrentChangess(val) {
       if (val != null) {
-          this.$refs.tb.toggleRowSelection(val, true);
+        this.$refs.tb.toggleRowSelection(val, true);
         this.handleSelectionChange(val);
       }
     },
 
     handleSelectionChange(selection) {
-      this.piliangList = selection;
+
       const selectedCount = selection.length;
       const totalCount = this.samplingList.length;
 
@@ -646,6 +656,7 @@
       if (selectedCount === 1) {
         this.disableSelections = false;
         const selectedPerson = selection[0];
+        this.piliangList = selection;
         const tjNumber = selectedPerson.tjNumber;
         console.log(`閫変腑鐨勪綋妫�鍙�: ${tjNumber}`);
         this.fetchData(tjNumber);
diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue
index ba6cde8..7ecfeea 100644
--- a/src/views/system/tijian/index.vue
+++ b/src/views/system/tijian/index.vue
@@ -1978,7 +1978,7 @@
         if (isChineseChar(resultObj.data.sex)) {
           _this.form.cusSex = resultObj.data.sex == "濂�" ? 1 : 0
         } else {
-          _this.form.cusSex = resultObj.data.sex;
+          _this.form.cusSex = resultObj.data.sex ==  "1" ? 0 : 1;
         }
         _this.form.cusNational = resultObj.data.mz;
         _this.form.cusBrithday = resultObj.data.csrq;
@@ -2126,7 +2126,13 @@
         websocket.onmessage = function (event) {
           var resultObj = JSON.parse(event.data);
           _this.form.cusName = resultObj.data.name;
-          _this.form.cusSex = resultObj.data.sex;
+            const isChineseChar = (char) => /[\u4E00-\u9FA5]/.test(char)
+          // _this.form.cusSex = resultObj.data.sex;
+           if (isChineseChar(resultObj.data.sex)) {
+          _this.form.cusSex = resultObj.data.sex == "濂�" ? 1 : 0
+        } else {
+          _this.form.cusSex = resultObj.data.sex ==  "1" ? 0 : 1;
+        }
           _this.form.cusNational = resultObj.data.mz;
           _this.form.cusBrithday = resultObj.data.csrq;
           if (_this.form.cusBrithday) {

--
Gitblit v1.8.0