qx
qx
5 天以前 d332a772c0cabc58d47f0afc4ae92fc55115ce3d
src/views/hosp/order/index.vue
@@ -596,7 +596,7 @@
              </el-table-column>
              <el-table-column prop="proPrice" label="原价" width="56px">
              </el-table-column>
              <el-table-column label="折扣">
              <el-table-column label="折扣" width="150px">
                <template slot-scope="scope">
                  <!-- @input="validateDiscount(scope.row)" -->
                  <el-input-number v-model.number="scope.row.discount" @change="handleManualChange(scope.row)"
@@ -1483,21 +1483,6 @@
    },
    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)
      row.nowPrice = result.toNumber();
      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;
    },
    debounceNumberChange(currentValue, oldValue) {
      clearTimeout(this.debounceTimer);
      this.debounceTimer = setTimeout(() => {
@@ -1523,7 +1508,7 @@
            // 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))
            this.TotalPrice = new Big(this.TotalPrice1 * (this.discount / 10)).toFixed(2)
          });
        })
        .catch(() => {
@@ -1541,6 +1526,7 @@
    numberChangeXianPrice(currentValue, oldValue) {
      // 如果现价没有变化,直接返回
      if (this.TotalPrice === this.lastXianPrice || !this.TotalPrice) {
        console.log(2222333)
        return;
      }
      this.$confirm("确定修改所有子项的折扣吗?", "提示", {
@@ -1554,8 +1540,8 @@
          //   this.discount = this.getInfodis;
          // }
          let totalYsprice = new Big(0);
          console.log(this.tableData3, 11111)
          this.tableData3.forEach((item) => {
          console.log(this.DataList3, 11111)
          this.DataList3.forEach((item) => {
            item.discount = this.discount;
            const ordPrice = new Big(item.proPrice);
            const discount = new Big(item.discount);
@@ -1636,7 +1622,10 @@
    // },
    updateProPrice(row) {
      console.log(row, 55555)
      if (row.proPrice == 0) {
        row.discount = 10
        return
      } else {
      const ordPrice = new Big(row.proPrice);
      const discount = new Big(row.discount);
      const result = ordPrice.times(discount.div(10)); // ordPrice * (discount / 10)
@@ -1646,6 +1635,7 @@
      }, new Big(0));
      this.discount =
        (Math.floor((this.TotalPrice / this.TotalPrice1) * 100) / 100) * 10;
      }
    },
    handleRevoke() {
@@ -2289,8 +2279,10 @@
      this.DataList = [];
      this.DataList3 = [];
      this.Datalists = [];
      this.filterText = "",
        this.filterage = "",
      this.TotalPrice = 0;
      this.discount = 10;
      this.filterText = "";
      this.filterage = "";
        this.TotalPrice1 = 0;
      this.orderId = this.ids;
      this.cusId = this.cusIds;
@@ -2402,7 +2394,7 @@
          this.TotalPrice1 = 0;
          this.DataList3.forEach((item) => {
            this.TotalPrice1 += item.proPrice * item.sl;
             this.TotalPrice = new Big(this.TotalPrice1 * (this.discount / 10))
            this.TotalPrice = this.TotalPrice1 * (this.discount / 10)
          this.lastXianPrice = this.TotalPrice;
          });
        });
@@ -2477,9 +2469,6 @@
        this.spliceData();
        this.TotalPrice1 = 0;
        this.DataList.forEach((item1) => {
          console.log(item1.proPrice, 3322);
          console.log(this.TotalPrice1, 1122);
          this.TotalPrice1 = item1.proPrice + this.TotalPrice1;
        });
        if (this.marryalls != 0) {
@@ -2497,8 +2486,18 @@
          });
        }
      });
      this.DataList3.forEach((item, index) => {
        if (item.proId == row.proId) {
          let proParentId = item.proParentId
          // 获取当前选中的节点key
          const currentCheckedKeys = this.$refs.tree.getCheckedKeys();
          // 创建一个新数组,移除想要取消选中的节点key(这里假设是1)
          const newCheckedKeys = currentCheckedKeys.filter(key => key !== proParentId);
          // 使用setCheckedKeys方法更新选中状态
          this.$refs.tree.setCheckedKeys(newCheckedKeys);
          this.DataList3.splice(index, 1);
          this.marryalls = 0;
          this.DataList3.forEach((item1) => {
@@ -2506,21 +2505,36 @@
          });
        }
      });
      if (this.DataList3.length == 0) {
        this.discount = 10
        this.checkedkey = []
        this.$refs.tree.setCheckedKeys([])
        this.TotalPrice1 = this.marryalls;
        this.TotalPrice = new Big(this.TotalPrice1 * (this.discount / 10))
      } else if (this.DataList3.length == 1) {
        this.discount = this.DataList3[0].discount
        this.TotalPrice = new Big(this.TotalPrice1 * (this.discount / 10)).toFixed(2)
      }
      this.DataList.forEach((item, index) => {
        if (item.proId == row.proId) {
          this.DataList.splice(index, 1);
          this.TotalPrice1 = 0;
          this.TotalPrice = 0;
          this.DataList.forEach((item1) => {
            this.TotalPrice1 = item1.proPrice + this.TotalPrice1;
            this.TotalPrice = new Big(this.TotalPrice1 * (this.discount / 10))
          });
          if (this.marryalls != 0) {
            this.TotalPrice1 += this.marryalls;
            this.TotalPrice = new Big(this.TotalPrice1 * (this.discount / 10))
          }
        }
      });
      this.TotalPrice1 = 0;
      this.TotalPrice = 0;
      this.DataList3.forEach((item) => {
        this.TotalPrice1 += item.proPrice;
        this.TotalPrice = new Big(this.TotalPrice1 * (this.discount / 10))
      });
    },
    /** 删除按钮操作 */
@@ -2877,7 +2891,7 @@
}
.box1 {
  width: 50%;
  width: 35%;
  display: flex;
  flex-direction: column;
}