qinxianzhangyao
2024-03-25 c2943d4c365e6a4719fbd5fedf89f8c2232cf88e
src/views/hosp/order/index.vue
@@ -412,7 +412,7 @@
    <el-dialog
      :title="title"
      :visible.sync="Projectopen"
      width="1200px"
      width="1500px"
      style="height: 860px"
      append-to-body
    >
@@ -428,12 +428,14 @@
          <div class="tab3">
            <div class="outside1">
              <el-tree
                class="filter-tree"
                v-loading="loading"
                :data="Treedata"
                :props="defaultProps"
                show-checkbox
                node-key="proId"
                :props="defaultProps"
                @check-change="handleCurrentChecked"
                :default-checked-keys="checkedkey"
                :filter-node-method="filterNode"
                ref="tree"
              >
@@ -441,125 +443,149 @@
            </div>
          </div>
        </el-col>
        <div>
          <el-col :span="18">
            <div class="grid-content bg-purple">
              <template>
                <el-form :model="form">
                  <el-form-item label="体检类型" prop="tjType">
                    <el-radio-group v-model="form.tjType">
                      <el-radio :label="1">团队</el-radio>
                      <el-radio :label="2">个人</el-radio>
                    </el-radio-group>
                  </el-form-item>
                </el-form>
              </template>
              <div class="outside">
                <el-form :inline="true" class="outside1">
                  <el-form-item label="原价">
                    <el-input
                      placeholder="原价"
                      :value="TotalPrice1"
                      disabled
                      style="width: 90px"
                    ></el-input>
                  </el-form-item>
                  <el-form-item label="折扣设定">
                    <el-input
                      style="width: 90px"
                      type="number"
                      v-model="discount"
                      :value="discount"
                    ></el-input>
                  </el-form-item>
                  <el-form-item label="应付金额">
                    <el-input
                      placeholder="应付金额"
                      :value="TotalPrice1 * (discount / 10)"
                      style="width: 90px"
                    ></el-input>
                  </el-form-item>
                  <el-form-item label="付款类型" prop="payType">
                    <el-select
                      style="width: 120px"
                      v-model="payType"
                      placeholder="请选择付款类型"
                    >
                      <el-option
                        v-for="dict in dict.type.dict_pay_type"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item>
                    <el-button
                      type="primary"
                      @click="submitPrice"
                      :disabled="confirm"
                      style="margin-top: 34px"
                      >收费</el-button
                    >
                  </el-form-item>
                </el-form>
              </div>
              <div style="text-align: center; margin-bottom: 10px">
                已选项目列表
              </div>
              <div
                style="
                  padding: 0px 6px;
                  border: 1px solid #e6ebf5;
                  max-height: 420px;
                  overflow: auto;
                "
        <el-col :span="4">
          <div
            style="text-align: center; margin-bottom: 10px; margin-top: 10px"
          >
            项目列表
          </div>
          <div class="tab3">
            <div class="outside1">
              <el-tree
                class="filter-tree"
                v-loading="loading"
                :data="TreedataList"
                node-key="proId"
                :props="defaultProps"
                :filter-node-method="filterNode"
                show-checkbox
                @check-change="handleCurrentChecked1"
                :default-checked-keys="checkedListkey"
              >
                <el-collapse v-model="activeName" accordion>
                  <div v-for="(item, index) in DataList" :key="index">
                    <el-collapse-item>
                      <template slot="title">
                        {{ item.proName + "(" + "原价" + item.proPrice + ")" }}
                      </template>
                      <el-table
                        :data="item.tjProjectList"
                        border
                        style="width: 100%"
                        height="250"
                      >
                        <el-table-column
                          prop="proName"
                          label="项目"
                          width="180"
                        >
                        </el-table-column>
                        <el-table-column prop="proPrice" label="原价">
                        </el-table-column>
                      </el-table>
                    </el-collapse-item>
                  </div>
                </el-collapse>
                <el-collapse v-model="activeName" accordion v-if="list1">
                  <div>
                    <el-collapse-item title="请选择项目">
                      <el-table :data="DataList" border style="width: 100%">
                        <el-table-column
                          prop="proName"
                          label="项目"
                          width="180"
                        >
                        </el-table-column>
                        <el-table-column prop="ordPrice" label="原价">
                        </el-table-column>
                      </el-table>
                    </el-collapse-item>
                  </div>
                </el-collapse>
              </div>
              </el-tree>
            </div>
          </el-col>
        </div>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple">
            <div style="text-align: center; margin-bottom: 10px">
              已选项目列表
            </div>
            <div
              style="
                padding: 0px 6px;
                border: 1px solid #e6ebf5;
                max-height: 420px;
                overflow: auto;
              "
            >
              <el-table
                :data="DataList"
                border
                style="width: 100%"
                height="250"
              >
                <el-table-column prop="propinName" label="父项">
                </el-table-column>
                <el-table-column prop="proName" label="项目" width="180">
                </el-table-column>
                <el-table-column prop="proPrice" label="原价">
                </el-table-column>
                <el-table-column
                  label="操作"
                  align="center"
                  fixed="right"
                  class-name="small-padding fixed-width"
                  width="80px"
                >
                  <template slot-scope="scope">
                    <el-button
                      size="mini"
                      type="text"
                      icon="el-icon-delete"
                      @click="handleDelete(scope.row)"
                      >删除</el-button
                    >
                  </template>
                </el-table-column>
              </el-table>
              <el-collapse v-model="activeName" accordion v-if="list1">
                <div>
                  <el-collapse-item title="请选择项目">
                    <el-table :data="DataList" border style="width: 100%">
                      <el-table-column prop="proName" label="项目" width="180">
                      </el-table-column>
                      <el-table-column prop="ordPrice" label="原价">
                      </el-table-column>
                    </el-table>
                  </el-collapse-item>
                </div>
              </el-collapse>
            </div>
            <template>
              <el-form :model="form">
                <el-form-item label="体检类型" prop="tjType">
                  <el-radio-group v-model="form.tjType">
                    <el-radio :label="1">团队</el-radio>
                    <el-radio :label="2">个人</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-form>
            </template>
            <div class="outside">
              <el-form :inline="true" class="outside1">
                <el-form-item label="原价">
                  <el-input
                    placeholder="原价"
                    :value="TotalPrice1"
                    disabled
                    style="width: 90px"
                  ></el-input>
                </el-form-item>
                <el-form-item label="折扣设定">
                  <el-input
                    style="width: 90px"
                    type="number"
                    v-model="discount"
                    :value="discount"
                  ></el-input>
                </el-form-item>
                <el-form-item label="应付金额">
                  <el-input
                    placeholder="应付金额"
                    :value="TotalPrice1 * (discount / 10)"
                    style="width: 90px"
                  ></el-input>
                </el-form-item>
                <el-form-item label="付款类型" prop="payType">
                  <el-select
                    style="width: 120px"
                    v-model="payType"
                    placeholder="请选择付款类型"
                  >
                    <el-option
                      v-for="dict in dict.type.dict_pay_type"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item>
                  <el-button
                    type="primary"
                    @click="submitPrice"
                    :disabled="confirm"
                    style="margin-top: 34px"
                    >收费</el-button
                  >
                </el-form-item>
              </el-form>
            </div>
          </div>
        </el-col>
      </el-row>
    </el-dialog>
@@ -567,12 +593,12 @@
    <el-dialog
      :title="title"
      :visible.sync="Projectopen1"
      width="1200px"
      width="1500px"
      style="height: 860px"
      append-to-body
    >
      <el-row type="flex" class="row-bg" justify="space-around">
        <el-col :span="8">
        <el-col :span="6">
          <div
            style="text-align: center; margin-bottom: 10px; margin-top: 10px"
          >
@@ -586,10 +612,11 @@
                class="filter-tree"
                v-loading="loading"
                :data="Treedata"
                :props="defaultProps"
                show-checkbox
                node-key="proId"
                :props="defaultProps"
                @check-change="handleCurrentChecked"
                @check="handleCurrentChecked"
                :default-checked-keys="checkedkey"
                :filter-node-method="filterNode"
                ref="tree"
              >
@@ -597,9 +624,86 @@
            </div>
          </div>
        </el-col>
        <el-col :span="15">
        <el-col :span="4">
          <div
            style="text-align: center; margin-bottom: 10px; margin-top: 10px"
          >
            项目列表
          </div>
          <div class="tab3">
            <div class="outside1">
              <el-tree
                class="filter-tree"
                v-loading="loading"
                :data="TreedataList"
                node-key="proId"
                :props="defaultProps"
                :filter-node-method="filterNode"
                show-checkbox
                @check-change="handleCurrentChecked1"
                :default-checked-keys="checkedListkey"
              >
              </el-tree>
            </div>
          </div>
        </el-col>
        <el-col :span="12">
          <div class="grid-content bg-purple">
            <div style="text-align: center; margin-bottom: 10px">
              已选项目列表
            </div>
            <div
              style="
                padding: 0px 6px;
                border: 1px solid #e6ebf5;
                max-height: 420px;
                overflow: auto;
              "
            >
              <el-table
                :data="DataList"
                border
                style="width: 100%"
                height="250"
              >
                <el-table-column prop="propinName" label="检查项目">
                </el-table-column>
                <el-table-column prop="proName" label="明细项目" width="180">
                </el-table-column>
                <el-table-column prop="proPrice" label="原价">
                </el-table-column>
                <el-table-column
                  label="操作"
                  align="center"
                  fixed="right"
                  class-name="small-padding fixed-width"
                  width="80px"
                >
                  <template slot-scope="scope">
                    <el-button
                      size="mini"
                      type="text"
                      icon="el-icon-delete"
                      @click="handleDelete(scope.row)"
                      title="删除"
                    ></el-button>
                  </template>
                </el-table-column>
              </el-table>
              <el-collapse v-model="activeName" accordion v-if="list1">
                <div>
                  <el-collapse-item title="请选择项目">
                    <el-table :data="DataList" border style="width: 100%">
                      <el-table-column prop="proName" label="项目" width="180">
                      </el-table-column>
                      <el-table-column prop="ordPrice" label="原价">
                      </el-table-column>
                    </el-table>
                  </el-collapse-item>
                </div>
              </el-collapse>
            </div>
            <template>
              <el-form :model="form">
                <el-form-item label="体检类型" prop="tjType">
@@ -661,50 +765,6 @@
                </el-form-item>
              </el-form>
            </div>
            <div style="text-align: center; margin-bottom: 10px">
              已选项目列表
            </div>
            <div
              style="
                padding: 0px 6px;
                border: 1px solid #e6ebf5;
                max-height: 420px;
                overflow: auto;
              "
            >
              <el-collapse v-model="activeName" accordion>
                <div v-for="(item, index) in DataList" :key="index">
                  <el-collapse-item>
                    <template slot="title">
                      {{ item.proName + "(" + "原价" + item.proPrice + ")" }}
                    </template>
                    <el-table
                      :data="item.tjProjectList"
                      border
                      style="width: 100%"
                      height="250"
                    >
                      <el-table-column prop="proName" label="项目" width="180">
                      </el-table-column>
                      <el-table-column prop="proPrice" label="原价">
                      </el-table-column>
                    </el-table>
                  </el-collapse-item>
                </div>
              </el-collapse>
              <el-collapse v-model="activeName" accordion v-if="list1">
                <div>
                  <el-collapse-item title="请选择项目">
                    <el-table :data="DataList" border style="width: 100%">
                      <el-table-column prop="proName" label="项目" width="180">
                      </el-table-column>
                      <el-table-column prop="ordPrice" label="原价">
                      </el-table-column>
                    </el-table>
                  </el-collapse-item>
                </div>
              </el-collapse>
            </div>
          </div>
        </el-col>
      </el-row>
@@ -763,7 +823,12 @@
import moment from "moment";
import { getwater } from "@/api/hosp/customer";
import ViewPdf from "@/components/ViewPdf";
import { projectGetList, getaddtTransition } from "@/api/system/tijian";
import {
  projectGetList,
  getaddtTransition,
  getProParentIdDxList,
  getProSonDxList,
} from "@/api/system/tijian";
export default {
  components: {
    ViewPdf,
@@ -794,10 +859,13 @@
      flag: true,
      bill: null,
      Treedata: [],
      checkedkey: [],
      checkedListkey: [],
      defaultProps: {
        children: "tjProjectList",
        children: [],
        label: "proName",
      },
      TreedataList: [],
      discount: 10,
      DataList: [],
      // 套餐提交按钮
@@ -888,7 +956,7 @@
  },
  created() {
    // this.getNowTime();
    this.getdate();
  },
  mounted() {
@@ -899,14 +967,13 @@
  methods: {
    getdate() {
      getNewDateList().then((res) => {
        if(res.data){
        if (res.data) {
          this.createTimeList = [
            moment(res.data).format("YYYY-MM-DD 00:00:00"),
            moment(res.data).format("YYYY-MM-DD 23:59:00")
            moment(res.data).format("YYYY-MM-DD 23:59:00"),
          ];
          this.getList();
        }
      });
    },
    filterNode(value, data) {
@@ -955,9 +1022,12 @@
      if (this.startTime) {
        this.queryParams.djbeginTime = this.startTime[0];
        this.queryParams.djendTime = this.startTime[1];
      }else{
         this.queryParams.djbeginTime = this.createTimeList[0];
      } else if (this.createTimeList) {
        this.queryParams.djbeginTime = this.createTimeList[0];
        this.queryParams.djendTime = this.createTimeList[1];
      } else if (this.createTimeList == null) {
        this.queryParams.djbeginTime = null;
        this.queryParams.djendTime = null;
      }
      if (this.startTime1) {
        this.queryParams.bgbeginTime = this.startTime1[0];
@@ -1064,7 +1134,6 @@
    },
    // 表单重置
    reset() {
      this.form = {
        orderId: null,
        userId: null,
@@ -1102,9 +1171,9 @@
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.startTime = []
      this.startTime1 = []
      this.createTimeList = []
      this.startTime = [];
      this.startTime1 = [];
      this.createTimeList = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
@@ -1158,6 +1227,7 @@
    // 补录项目
    handleProject(row) {
      this.loading = true;
      this.DataList = [];
      this.orderId = row.orderId;
      this.cusId = row.tjCusIdCard;
      this.userId = row.userId;
@@ -1173,16 +1243,41 @@
        this.form.tjType = 0;
      }
      /** 查询部门下拉树结构 */
      projectGetList().then((response) => {
        this.Treedata = response.data.list;
        this.loading = false;
      });
      this.getDataList();
      this.Projectopen = true;
      this.title = "补录项目";
    },
    getDataList() {
      getProParentIdDxList().then((response) => {
        this.Treedata = response.data.list;
        this.checkedkey.push(this.Treedata[0].proId);
        let proId = this.Treedata[0].proId;
        getProSonDxList(proId).then((res) => {
          this.TreedataList = res.data.list;
          this.TreedataList.forEach((item) => {
            this.checkedListkey.push(item.proId);
            this.DataList.push(item);
            this.DataList.forEach((item) => {
              item.propinName = this.Treedata[0].proName;
            });
          });
          this.TotalPrice1 = 0;
          if (this.DataList.length != 0) {
            this.list1 = false;
            this.DataList.forEach((item) => {
              this.TotalPrice1 = item.proPrice + this.TotalPrice1;
            });
          }
        });
        this.loading = false;
      });
    },
    // 补录项目
    handleProject1(row) {
    handleProject1() {
      this.loading = true;
      this.DataList = [];
      this.orderId = this.ids;
      this.cusId = this.cusIds;
      this.userId = this.userIds;
@@ -1192,59 +1287,119 @@
        cusPhone: this.cusPhone,
        cusSex: this.cusSex,
      };
      if (row.tjType) {
        this.form.tjType = parseInt(row.tjType);
      } else {
        this.form.tjType = 0;
      }
      // if (row.tjType) {
      //   this.form.tjType = parseInt(row.tjType);
      // } else {
      //   this.form.tjType = 0;
      // }
      /** 查询部门下拉树结构 */
      projectGetList().then((response) => {
        this.Treedata = response.data.list;
        this.loading = false;
      });
      this.getDataList();
      this.Projectopen1 = true;
      this.title = "补录项目";
    },
    // 点击获取每个树节点
    handleCurrentChecked(data, checked, checkedNodes) {
      if (!data.tjProjectList) {
        return;
      }
      if (checked === true) {
        this.DataList.push(data);
      } else {
        this.DataList.pop(data);
        this.list1 = true;
      }
      // let DataList = selectedobj.checkedNodes
      // if (DataList.length>0) {
      //   DataList.forEach(item => {
      //     if (nodeobj.proId === item.proId) {
      //       this.DataList = []
      //       this.DataList.push(item)
      //       this.list1 = false;
      //     }
      //   })
      // }else{
      //   this.DataList = []
      //   this.list1 = true;
      // }
      this.TotalPrice1 = 0;
      this.proIds = [];
      if (this.DataList.length != 0) {
        this.list1 = false;
        this.DataList.forEach((item) => {
          this.TotalPrice1 = item.proPrice + this.TotalPrice1;
          item.tjProjectList.forEach((item1) => {
            this.proIds.push(item1.proId);
      console.log(data, checked, checkedNodes);
      console.log(this.DataList,22222);
      if (checked.checkedNodes.length != 0) {
        this.$refs.tree.setCheckedKeys([data.proId]);
        let proId = data.proId;
        getProSonDxList(proId).then((res) => {
          this.TreedataList = res.data.list;
          this.TreedataList.forEach((item) => {
            this.checkedListkey.push(item.proId);
            this.DataList.push(item);
            this.DataList.forEach((item1) => {
              if (item1.proParentId == data.proId) {
                item1.propinName = data.proName;
              }
            });
          });
          this.spliceData(this.DataList);
          this.TotalPrice1 = 0;
          if (this.DataList.length != 0) {
            this.list1 = false;
            this.DataList.forEach((item) => {
              this.TotalPrice1 = item.proPrice + this.TotalPrice1;
            });
          }
        });
      } else if (checked.checkedNodes.length == 0) {
        let proId = data.proId;
        getProSonDxList(proId).then((res) => {
          this.TreedataList = res.data.list;
          this.DataList.forEach((item, index) => {
            this.TreedataList.forEach((item1) => {
              if (item.proId == item1.proId) {
                this.DataList.splice(index, this.TreedataList.length);
                this.TotalPrice1 = 0;
                this.DataList.forEach((item1) => {
                  this.TotalPrice1 = item1.proPrice + this.TotalPrice1;
                });
              }
            });
          });
        });
        this.checkedListkey = [];
        console.log(this.DataList,1111)
      }
    },
    spliceData(row) {
      for (var i = 0; i < row.length; i++) {
        for (var j = i + 1; j < row.length; j++) {
          if (row[i].proId == row[j].proId) {
            //如果第一个等于第二个,splice方法删除第二个
            row.splice(j, 1);
            j--;
          }
        }
      }
      return row;
    },
    // 点击获取每个树节点
    handleCurrentChecked1(data, checked, checkedNodes) {
      if (checked == false) {
        this.DataList.forEach((item, index) => {
          if (item.proId == data.proId) {
            this.DataList.splice(index, 1);
            this.TotalPrice1 = 0;
            this.DataList.forEach((item1) => {
              this.TotalPrice1 = item1.proPrice + this.TotalPrice1;
            });
          }
        });
      } else if (checked == true) {
        this.DataList.push(data);
        this.TotalPrice1 = 0;
        this.DataList.forEach((item1) => {
          this.TotalPrice1 = item1.proPrice + this.TotalPrice1;
        });
      }
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      this.DataList.forEach((item, index) => {
        if (item.proId == row.proId) {
          this.DataList.splice(index, 1);
          this.TotalPrice1 = 0;
          this.DataList.forEach((item1) => {
            this.TotalPrice1 = item1.proPrice + this.TotalPrice1;
          });
        }
      });
    },
    // 收费按钮
    submitPrice() {
      this.proIds = [];
      if (this.DataList.length != 0) {
        this.DataList.forEach((item) => {
          this.proIds.push(item.proId);
        });
      }
      let data = {
        cusId: this.cusId,
        proIds: this.proIds,
@@ -1280,6 +1435,12 @@
    },
    // 收费按钮
    submitPrice1() {
      this.proIds = [];
      if (this.DataList.length != 0) {
        this.DataList.forEach((item) => {
          this.proIds.push(item.proId);
        });
      }
      let data = {
        cusId: this.cusIds,
        proIds: this.proIds,
@@ -1334,16 +1495,7 @@
    //     }
    //   });
    // },
    /** 删除按钮操作 */
    // handleDelete(row) {
    //   const orderIds = row.orderId || this.ids;
    //   this.$modal.confirm('是否确认删除体检记录编号为"' + orderIds + '"的数据项?').then(function() {
    //     return delOrder(orderIds);
    //   }).then(() => {
    //     this.getList();
    //     this.$modal.msgSuccess("删除成功");
    //   }).catch(() => {});
    // },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
@@ -1421,7 +1573,7 @@
}
.outside1 {
  width: 700px;
  width: 500px;
  display: flex;
  margin-top: 8px;
}