Forráskód Böngészése

优化协定方新增项目时单次数量修改的问题

张田田 4 napja
szülő
commit
11dbfffe8c
1 módosított fájl, 18 hozzáadás és 3 törlés
  1. 18 3
      src/views/business/components/AcupointTable.vue

+ 18 - 3
src/views/business/components/AcupointTable.vue

@@ -401,7 +401,7 @@
                   :min="1"
                   :controls="false"
                   style="width: 60px"
-                  @change="updatePrice"
+                  @change="onSingleCountChange"
                   placeholder="请输入"
                 ></el-input-number>
                 <span class="stat-unit">{{ currentPricingUnit }}</span>
@@ -635,6 +635,7 @@ function createPrescriptionData(options = {}) {
     coursePrice: "0.00",
     totalPrice: "0.00",
     currentUnitPrice: unitPrice,
+    _manualSingleCount: false,
   };
 }
 
@@ -699,6 +700,7 @@ export default {
       singlePrice: "0.00",
       coursePrice: "0.00",
       totalPrice: "0.00",
+      _manualSingleCount: false,
       // 处方 tab
       activeIndex: 0,
       prescriptionDataMap: {},
@@ -810,6 +812,7 @@ export default {
         coursePrice: this.coursePrice,
         totalPrice: this.totalPrice,
         currentUnitPrice: this.currentUnitPrice,
+        _manualSingleCount: this._manualSingleCount,
       });
     },
     loadTabData(index) {
@@ -831,6 +834,7 @@ export default {
         this.coursePrice = data.coursePrice;
         this.totalPrice = data.totalPrice;
         this.currentUnitPrice = data.currentUnitPrice || 0;
+        this._manualSingleCount = data._manualSingleCount || false;
       } else {
         const def = createPrescriptionData();
         this.detailTables = def.detailTables;
@@ -848,6 +852,7 @@ export default {
         this.coursePrice = def.coursePrice;
         this.totalPrice = def.totalPrice;
         this.currentUnitPrice = def.currentUnitPrice || 0;
+        this._manualSingleCount = def._manualSingleCount || false;
       }
       this.$nextTick(() => {
         this._isLoadingTab = false;
@@ -1327,8 +1332,15 @@ export default {
       });
     },
 
+    onSingleCountChange(val) {
+      if (val !== undefined && val !== null) {
+        this._manualSingleCount = true;
+      }
+      this.updatePrice();
+    },
+
     updatePrice() {
-      if (this.currentSingleNumber !== "0" && !this._isLoadingTab) {
+      if (this.currentSingleNumber !== "0" && !this._isLoadingTab && !this._manualSingleCount) {
         this.singleCount = this.calcTotalCount();
       }
       const price = this.currentUnitPrice || this.unitPrice || 0;
@@ -1358,7 +1370,8 @@ export default {
         }
       });
       const coefficient = this.currentCountCoefficient;
-      return coefficient > 0 ? total / coefficient : total;
+      const result = coefficient > 0 ? total / coefficient : total;
+      return Math.ceil(result);
     },
     emitStatistics() {
       this.$emit("update:statistics", {
@@ -1582,6 +1595,7 @@ export default {
         }
 
         // 构造 tab 数据
+        const singleNumber = item.basisStitutionsnondrug?.singleNumber || "0";
         this.prescriptionDataMap[index] = {
           detailTables,
           innerIsEditable: item.isUpdate || "1",
@@ -1599,6 +1613,7 @@ export default {
           ).toFixed(2),
           totalPrice: "0.00",
           currentUnitPrice: unitPrice,
+          _manualSingleCount: singleNumber !== "0",
         };
       });