1
wwl
2025-01-06 2eef2588025c46411b2e6d6b94b1a66d165dad4b
1
1个文件已修改
118 ■■■■ 已修改文件
src/views/system/comp/index.vue 118 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/comp/index.vue
@@ -121,8 +121,8 @@
          <el-col :span="7" :xs="24">
            <div style="padding: 0 20px">
              <el-form ref="form" :model="form" :rules="rules" label-width="80px" :inline="true">
                <el-form-item label="部门名称" prop="dwDeptName">
                  <el-input v-model="form.dwDeptName" placeholder="请输入部门名称" />
                <el-form-item label="套餐名称" prop="dwDeptName">
                  <el-input v-model="form.dwDeptName" placeholder="请输入套餐名称" />
                </el-form-item>
                <el-form-item label="签约金额" prop="signingPrice">
                  <el-input v-model="form.signingPrice" placeholder="请输入签约金额" />
@@ -131,7 +131,7 @@
              <el-row :gutter="10" class="mb8">
                <el-col :span="1.5">
                  <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddDept"
                    v-hasPermi="['system:comp:add']">保存部门</el-button>
                    v-hasPermi="['system:comp:add']">保存套餐</el-button>
                </el-col>
                <el-col :span="1.5">
                  <el-button type="primary" icon="el-icon-edit" size="mini" :disabled="singleg" @click="handledeleDept"
@@ -141,7 +141,7 @@
              <el-table ref="tb" v-loading="loading" :data="deptList" @selection-change="handleSelection" border
                style="width: 320px" height="350">
                <el-table-column type="selection" width="40px" align="center" />
                <el-table-column label="部门名称" align="center" prop="dwDeptName" />
                <el-table-column label="套餐名称" align="center" prop="dwDeptName" />
              </el-table>
            </div>
          </el-col>
@@ -963,7 +963,7 @@
      if (this.form.drugManufacturerId) {
        this.beCurrentDept();
      }
      this.title = "部门分组维护" + "( " + this.form.cnName + ")";
      this.title = "套餐分组维护" + "( " + this.form.cnName + ")";
      getInfo().then((response) => {
        this.getInfodis = response.user.discount;
        if (this.getInfodis == null || this.getInfodis == 10) {
@@ -1093,73 +1093,65 @@
      }
    },
    resetright() {
  this.queryParams.price = 0;
  this.queryParams.xianprice = 0; // 初始化现价
  this.youhui = 0; // 初始化优惠
      this.queryParams.price = 0;
      this.queryParams.xianprice = 0; // 初始化现价
      this.youhui = 0; // 初始化优惠
  const newItemsToAdd = [];
      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); // 更新单个项目的价格
    }
  });
      this.dataList.forEach((item) => {
        this.$refs.tre.toggleRowSelection(item, false);
        // 使用 $set 确保响应性
        this.$set(item, 'limits', 10);
        this.$set(item, 'ysPrice', item.proPrice);
  // 添加新项目到 OnenewpacName
  this.OnenewpacName.push(...newItemsToAdd);
        // 检查是否已经存在相同的项目
        const existingItem = this.OnenewpacName.find(existing => existing.proId === item.proId);
        if (!existingItem) {
          newItemsToAdd.push(item);
          this.updateProPrice(item); // 更新单个项目的价格
        }
      });
  // 删除重复项目,这里我们只需处理新添加的项目和原有项目之间的重复
  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--;
      // 添加新项目到 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--;
          }
        }
      }
    }
  }
  // 计算总价和现价
  this.OnenewpacName.forEach((item) => {
    this.queryParams.price += item.proPrice;
    this.queryParams.xianprice += item.ysPrice || 0; // 确保ysPrice存在
  });
      this.OnenewpacName.forEach((item) => {
        this.queryParams.price += item.proPrice;
        this.queryParams.xianprice += item.ysPrice || 0; // 确保ysPrice存在
      })
    },
    handledbelete(row) {
      this.queryParams.price = 0;
      this.queryParams.xianprice = 0; // 初始化现价
      this.youhui = 0; // 初始化优惠
  // 计算优惠
  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 = this.OnenewpacName.filter(item => item.proId !== row.proId);
  // 然后更新总价和现价
  this.OnenewpacName.forEach((item) => {
    this.queryParams.price += item.proPrice;
    this.queryParams.xianprice += item.ysPrice || 0; // 确保ysPrice存在
  });
      // 然后更新总价和现价
      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;
  }
},
      // 计算优惠
      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;