Sfoglia il codice sorgente

供应商模板设置

谢杰标 2 anni fa
parent
commit
9686404561

+ 70 - 2
src/api/financed/index.js

@@ -3,7 +3,6 @@ import request from "@/utils/request";
 export function costList(query) {
   return request({
     url: "/financial/tp/list",
-    method: "post",
     method: "get",
     params: query,
   });
@@ -189,7 +188,7 @@ export function countOrderNum(query) {
     url: "/system/top/order/countOrderNum",
     method: "get",
     params: query,
-    isProce:true
+    isProce: true,
   });
 }
 
@@ -209,3 +208,72 @@ export function badBillDetail(query) {
     params: query,
   });
 }
+
+// 供应商模板列表
+export function supplierList(query) {
+  return request({
+    url: "/top/cost/inst/tp/list",
+    method: "get",
+    params: query,
+  });
+}
+
+// 供应商列表
+export function institutionList(query) {
+  return request({
+    url: "/top/institution/list",
+    method: "get",
+    params: query,
+  });
+}
+
+// 供应商模板批量删除
+export function supplierBatchCost(data) {
+  return request({
+    url: "/top/cost/inst/tp/deleteBatch",
+    method: "post",
+    data,
+  });
+}
+
+// 成本分类
+export function categoryList(query) {
+  return request({
+    url: "/top/inst/category/list",
+    method: "get",
+    params: query,
+  });
+}
+// 供应商状态
+export function instDefaultStatus(data) {
+  return request({
+    url: "/top/cost/inst/tp/editDefaultStatus",
+    method: "post",
+    data,
+  });
+}
+
+// 新增供应商模板
+export function addInstCost(data) {
+  return request({
+    url: "/top/cost/inst/tp",
+    method: "post",
+    data,
+  });
+}
+
+// 修改供应商模板
+export function editInstCost(data) {
+  return request({
+    url: "/top/cost/inst/tp/edit",
+    method: "post",
+    data,
+  });
+}
+// 查询供应商模板
+export function costInstDetail(id) {
+  return request({
+    url: "/top/cost/inst/tp/" + id,
+    method: "get",
+  });
+}

+ 0 - 0
src/views/financed/cost/dislogSet.vue → src/views/financed/costSet/dislogOrganSet.vue


+ 471 - 0
src/views/financed/costSet/dislogSupplierSet.vue

@@ -0,0 +1,471 @@
+<template>
+  <div>
+    <BaseDialog
+      width="1200px"
+      :isShow.sync="isShow"
+      :title="title"
+      @close="close"
+      @submit="submitForm"
+    >
+      <div class="bop-tip">
+        <div>
+          <i class="el-icon-warning-outline" style="padding-right: 4px"></i>注意
+        </div>
+        <div>● 1、百分比成本 = 百分比*(课程金额 - 课程税前佣金)。</div>
+      </div>
+      <el-form
+        inline
+        hide-required-asterisk
+        :model="form"
+        :rules="rules"
+        ref="form"
+      >
+        <div>
+          <el-form-item prop="tpName" label="模板名称:" label-width="100px">
+            <el-input
+              placeholder="请输入模板名称"
+              v-model="form.tpName"
+            ></el-input>
+          </el-form-item>
+          <el-form-item prop="instId" label="">
+            <el-select
+              filterable
+              v-model="form.instId"
+              placeholder="请选择关联机构"
+            >
+              <el-option
+                v-for="item in tenantList"
+                :key="item.instId"
+                :label="item.instName"
+                :value="item.instId"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item label="">
+            <el-checkbox
+              :true-label="1"
+              :false-label="0"
+              v-model="form.defaultStatus"
+              >默认</el-checkbox
+            >
+          </el-form-item>
+        </div>
+
+        <div v-for="(item, index) in form.itemList" :key="index">
+          <el-form-item
+            :label="index == 0 ? '成本设置:' : ' '"
+            :prop="'itemList.' + index + '.costCatId'"
+            :rules="rules['costCatId']"
+            label-width="100px"
+          >
+            <el-select v-model="item.costCatId" placeholder="请选择成本分类">
+              <el-option
+                :label="item.categoryName"
+                :value="item.costCatId"
+                v-for="item in categoryList"
+                :key="item.costCatId"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item
+            label=""
+            :prop="'itemList.' + index + '.educationTypeId'"
+            :rules="rules['educationTypeId']"
+          >
+            <el-select
+              @change="changeEdu(item)"
+              v-model="item.educationTypeId"
+              placeholder="请选择教育类型"
+            >
+              <el-option
+                v-for="item in eduList"
+                :key="item.id"
+                :label="
+                  item.schemeName +
+                  (item.schemeName ? '-' : '') +
+                  item.educationName
+                "
+                :value="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item
+            v-if="item.educationTypeId != -1"
+            label=""
+            :prop="'itemList.' + index + '.businessId'"
+            :rules="rules['businessId']"
+          >
+            <el-select
+              filterable
+              v-model="item.businessId"
+              placeholder="请选择业务层次"
+            >
+              <el-option
+                v-for="level in backbusinessList(item.educationTypeId)"
+                :key="level.businessId"
+                :label="level.aliasName"
+                :value="level.businessId"
+                @click.native="changeBus(item, level.projectId)"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item
+            label=""
+            :prop="'itemList.' + index + '.itemType'"
+            :rules="rules['itemType']"
+          >
+            <el-select v-model="item.itemType" placeholder="请选择成本类型">
+              <el-option label="百分比成本" :value="1"></el-option>
+              <el-option label="固定成本" :value="2"></el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item
+            v-if="item.itemType"
+            class="ddd"
+            label-width="0"
+            :prop="'itemList.' + index + '.typeValue'"
+            label=" "
+            :rules="rules['typeValue']"
+          >
+            <el-input
+              v-if="item.itemType == 1"
+              placeholder="输入百分比"
+              v-model="item.typeValue"
+              key="2"
+              v-int="{ max: 100 }"
+            >
+              <template slot="append"> % </template>
+            </el-input>
+            <el-input
+              key="1"
+              v-else
+              placeholder="固定金额"
+              v-model="item.typeValue"
+              v-int
+            >
+              <template slot="append"> 元 </template>
+            </el-input>
+          </el-form-item>
+          <el-form-item label-width="0" label=" ">
+            <div class="btns">
+              <i @click="add(index, item)" class="el-icon-connection"></i>
+              <i @click="add(index)" class="el-icon-circle-plus-outline"></i>
+              <i
+                v-if="index != 0"
+                @click="del(index)"
+                class="el-icon-remove-outline"
+              ></i>
+            </div>
+          </el-form-item>
+        </div>
+      </el-form>
+    </BaseDialog>
+  </div>
+</template>
+
+<script>
+import {
+  eduList,
+  addInstCost,
+  costInstDetail,
+  editInstCost,
+  categoryList,
+} from "@/api/financed/index";
+export default {
+  name: "DislogSet",
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+    // 0 新增  1修改  2复制  3订单成本设置  4批量设置
+    type: {
+      type: [String, Number],
+      default: 0,
+    },
+    tpId: {
+      type: [String, Number],
+      default: "",
+    },
+    tenantList: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+  },
+  data() {
+    var checkBusId = (rule, value, callback) => {
+      const { costCatId } = this.itemList[rule.field.split(".")[1]];
+      if (this.itemList.length > 1) {
+        const levelList = this.itemList.filter(
+          (e) =>
+            costCatId &&
+            value &&
+            e.businessId == value &&
+            e.costCatId == costCatId
+        );
+        if (levelList.length > 1) {
+          callback(new Error("已存在相同的成本分类!"));
+        }
+      }
+      callback();
+    };
+    return {
+      form: {},
+      rules: {
+        tpName: [
+          { required: true, message: "请输入模板名称", trigger: "blur" },
+        ],
+        instId: [
+          { required: true, message: "请选择关联机构", trigger: "change" },
+        ],
+        businessId: [
+          { required: true, message: "请选择业务层次", trigger: "blur" },
+          { validator: checkBusId, trigger: "change" },
+        ],
+        educationTypeId: [
+          { required: true, message: "请选择教育类型", trigger: "change" },
+        ],
+        costCatId: [
+          { required: true, message: "请选择成本分类", trigger: "change" },
+        ],
+        itemType: [
+          { required: true, message: "请选择成本类型", trigger: "change" },
+        ],
+        typeValue: [
+          { required: true, message: "请输入成本值", trigger: "blur" },
+        ],
+      },
+      eduList: [],
+      categoryList: [],
+    };
+  },
+  methods: {
+    init() {
+      this.resetForm();
+      if (this.type === 3) {
+        this.getOrdercostInstDetail();
+      } else if (this.type === 4) {
+      } else {
+        this.tpId && this.getcostInstDetail();
+      }
+      this.getEduList();
+      this.getCategoryList();
+    },
+    getCategoryList() {
+      categoryList().then((res) => {
+        this.categoryList = res.rows;
+      });
+    },
+    getOrdercostInstDetail() {
+      this.$api.systemtopordercost(this.tpId).then((res) => {
+        Object.keys(this.form).map((key) => {
+          this.form[key] = res.data[key];
+        });
+        this.form.itemList.forEach((ele) => {
+          if (ele.maxValue == -1) {
+            ele.maxValue = "*";
+          }
+        });
+      });
+    },
+    getcostInstDetail() {
+      costInstDetail(this.tpId).then((res) => {
+        if (this.type == 2) delete this.form["tpId"];
+        Object.keys(this.form).map((key) => {
+          this.form[key] = res.data[key];
+        });
+        this.form.itemList.forEach((ele) => {
+          if (ele.maxValue == -1) {
+            ele.maxValue = "*";
+          }
+        });
+      });
+    },
+    getEduList() {
+      if (this.eduList.length) return;
+      eduList({}).then((res) => {
+        this.eduList = res.rows;
+      });
+    },
+    backbusinessList(eduId) {
+      if (!eduId || !this.eduList.length) return [];
+      let data = this.eduList.find((e) => e.id == eduId);
+      return data.businessList || [];
+    },
+    changeEdu(data) {
+      let value = data.educationTypeId == -1 ? -1 : undefined;
+      data.businessId = value;
+      data.projectId = value;
+    },
+    changeBus(data, projectId) {
+      data.projectId = projectId;
+    },
+    add(index, data) {
+      data = data ? JSON.parse(JSON.stringify(data)) : this.backItem();
+      this.itemList.splice(index + 1, 0, data);
+    },
+    del(index) {
+      this.itemList.splice(index, 1);
+    },
+    close() {
+      this.$nextTick(() => {
+        this.$refs["form"].resetFields();
+      });
+    },
+    backItem() {
+      return {
+        projectId: undefined,
+        costCatId: undefined,
+        businessId: undefined,
+        educationTypeId: undefined,
+        itemType: undefined,
+        typeValue: undefined,
+        dockStatus: undefined,
+        dockType: undefined,
+        dockValue: undefined,
+      };
+    },
+    resetForm() {
+      this.form = {
+        itemList: [this.backItem()],
+        tpId: undefined,
+        tpName: undefined,
+        defaultStatus: 0,
+        instId: undefined,
+      };
+    },
+    cb() {
+      this.$message.success(this.title + "成功");
+      this.isShow = false;
+      this.$emit("search");
+    },
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          if (this.type === 3 || this.type === 4) {
+            this.$api
+              .systemtoporderupdatecost({
+                costTpVo: form,
+                orderSnList:
+                  this.type === 3 ? [this.tpId] : this.tpId?.split(","),
+              })
+              .then(this.cb);
+          } else if (this.type !== 1) {
+            addInstCost(this.form).then(this.cb);
+          } else {
+            editInstCost(form).then(this.cb);
+          }
+        } else {
+          return false;
+        }
+      });
+    },
+    changeMaxValue(prop) {
+      this.$refs.form.validateField(prop);
+    },
+    // 阶梯校验
+    isHaveIntersect(list) {
+      const isEmpty = list.some((e) => !e.minValue && !e.maxValue);
+      if (isEmpty) {
+        return "非阶梯计价只能存在一个";
+      }
+      let maxList = list.filter((e) => e.maxValue === "*");
+      if (maxList.length > 1) {
+        return "阶梯计价存在范围冲突";
+      }
+      list.sort((a, b) => {
+        if (a.maxValue == "*") {
+          return Number.MAX_VALUE;
+        }
+        if (b.maxValue == "*") {
+          return -Number.MAX_VALUE;
+        }
+        return a.minValue - b.minValue;
+      });
+      for (let i = 0, len = list.length - 1; i < len; i++) {
+        if (list[i].maxValue >= list[i + 1].minValue) {
+          return "阶梯计价存在范围冲突";
+        }
+      }
+      return;
+    },
+    regValue(data) {
+      let { maxValue } = data;
+      let val;
+      if (maxValue.includes("*")) {
+        val = "*";
+      } else {
+        val = maxValue.replace(/[^0-9]/g, "");
+      }
+      data.maxValue = val;
+    },
+  },
+  computed: {
+    isShow: {
+      get() {
+        if (this.dialogVisible) {
+          this.init();
+        }
+        return this.dialogVisible;
+      },
+      set(val) {
+        this.$emit("update:dialogVisible", false);
+      },
+    },
+    title() {
+      return ["新增", "修改", "复制", "订单成本设置", "批量成本设置"][
+        this.type
+      ];
+    },
+    itemList() {
+      return this.form.itemList;
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+/deep/.el-input--medium .el-input__inner {
+  width: 144px;
+}
+/deep/ .range {
+  .el-form-item__content {
+    width: 170px;
+  }
+  .el-input--medium .el-input__inner {
+    width: 76px;
+  }
+}
+/deep/ .ddd {
+  margin-left: -10px;
+  .el-input--medium .el-input__inner {
+    width: 105px;
+  }
+}
+.line {
+  text-align: center;
+}
+.btns {
+  height: 36px;
+  display: flex;
+  align-items: center;
+  i {
+    font-size: 24px;
+    cursor: pointer;
+    margin-left: 5px;
+  }
+}
+.bop-tip {
+  background: #fff6f7;
+  margin: 0 0 20px 10px;
+  padding: 8px 10px;
+  i {
+    font-size: 16px;
+    color: #e6a23c;
+  }
+}
+</style>

+ 1 - 1
src/views/financed/cost/index.vue → src/views/financed/costSet/organ.vue

@@ -57,7 +57,7 @@
 </template>
 
 <script>
-import dislogSet from "./dislogSet.vue";
+import dislogSet from "./dislogOrganSet.vue";
 import searchBoxNew from "@/components/searchBoxNew";
 import tableList from "@/components/tableList";
 import pagination from "@/components/pagination";

+ 234 - 0
src/views/financed/costSet/supplier.vue

@@ -0,0 +1,234 @@
+<template>
+  <div id="ActivityList">
+    <search-box-new
+      ref="searchBox"
+      :formData="formData"
+      :formList="formList"
+      @search="search"
+      @init="init"
+    />
+    <table-list
+      rowKey="tpId"
+      ref="tableList"
+      :tableSets="tableSet"
+      :tableData="tableData"
+      :navText="navText"
+      @sortChange="sortChange"
+      :loading="loading"
+    >
+      <template slot="customize">
+        <el-button type="primary" @click="handelClick(0)"> 新增 </el-button>
+        <el-button @click="batchDel" type="warning"> 批量删除 </el-button>
+      </template>
+      <template slot="status" slot-scope="props">
+        <el-checkbox
+          :true-label="1"
+          :false-label="0"
+          @change="(val) => changeStatus(props.scope.row, val)"
+          v-model="props.scope.row.defaultStatus"
+        >
+        </el-checkbox>
+      </template>
+      <template slot="btn" slot-scope="props">
+        <el-button type="text" @click="handelClick(2, props.scope.row.tpId)"
+          >复制</el-button
+        >
+        <el-button type="text" @click="handelClick(1, props.scope.row.tpId)"
+          >修改</el-button
+        >
+        <el-button type="text" @click="handelDel(props.scope.row.tpId)"
+          >删除</el-button
+        >
+      </template>
+    </table-list>
+    <pagination
+      :total="total"
+      :pageSize.sync="formData.pageSize"
+      :currentPage.sync="formData.pageNum"
+      @search="search"
+    />
+    <dislog-set
+      :dialogVisible.sync="dialogVisible"
+      :tpId="tpId"
+      :type="type"
+      :tenantList="institutionList"
+      @search="search"
+    ></dislog-set>
+  </div>
+</template>
+
+<script>
+import dislogSet from "./dislogSupplierSet.vue";
+import searchBoxNew from "@/components/searchBoxNew";
+import tableList from "@/components/tableList";
+import pagination from "@/components/pagination";
+import {
+  supplierList,
+  institutionList,
+  instDefaultStatus,
+  editInstCost,
+  supplierBatchCost,
+} from "@/api/financed/index";
+export default {
+  name: "Cost",
+  components: { searchBoxNew, tableList, pagination, dislogSet },
+  data() {
+    return {
+      loading: false,
+      navText: {
+        title: "模板管理",
+        index: 0,
+        ch: "条",
+        num: true,
+        choice: true,
+        addHide: true,
+        openCheckMore: true,
+        custom: false,
+      },
+      formList: [
+        {
+          prop: "instId",
+          placeholder: "关联供应商",
+          scope: "select",
+          selectLabel: "instName",
+          selectValue: "instId",
+          options: [],
+        },
+        {
+          prop: "tpName",
+          placeholder: "请输入模板名称",
+        },
+      ],
+      formData: {},
+      tableSet: [
+        {
+          label: "模板名称",
+          prop: "tpName",
+          hidden: true,
+        },
+        {
+          label: "关联供应商",
+          prop: "instName",
+          hidden: true,
+          sort: "custom",
+        },
+        {
+          label: "默认状态",
+          prop: "startTime",
+          hidden: true,
+          scope: "solt",
+          soltName: "status",
+        },
+      ],
+      tableData: [],
+      total: 0,
+      dialogVisible: !true,
+      tpId: "",
+      type: 0,
+      institutionList: [],
+    };
+  },
+  created() {
+    this.search(2);
+    this.getInstitutionList();
+  },
+  methods: {
+    getInstitutionList() {
+      institutionList({
+        pageSize: 999,
+        pageNum: 1,
+      }).then((res) => {
+        this.institutionList = res.rows;
+        this.formList[0].options = this.institutionList;
+      });
+    },
+    handelClick(type, tpId) {
+      this.dialogVisible = true;
+      this.type = type;
+      this.tpId = tpId;
+    },
+    changeStatus({ tpId, instId }, defaultStatus) {
+      instDefaultStatus({ tpId, instId, defaultStatus }).then((res) => {
+        this.$message.success("状态修改成功");
+        this.search();
+      });
+    },
+    batchDel() {
+      const ids = this.$refs.tableList.allCheckData.map((item) => item.tpId);
+      if (!ids.length) {
+        return this.$message.warning("请先勾选模板");
+      }
+      this.handelDel(ids, 1);
+    },
+    handelDel(tpId, type = 0) {
+      this.$confirm(
+        `此操作将删除${type ? "批量" : "该"}模板, 是否继续?`,
+        "提示",
+        {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }
+      )
+        .then(() => {
+          if (type) {
+            supplierBatchCost({ ids: tpId }).then((res) => {
+              this.$message.success("删除成功");
+              this.$refs.tableList.clearMoreActive();
+              this.search();
+            });
+          } else {
+            editInstCost({ tpId, status: -1 }).then((res) => {
+              this.$message.success("删除成功");
+              this.$refs.tableList.clearMoreActive();
+              this.search();
+            });
+          }
+        })
+        .catch(() => {
+          this.$message({
+            type: "info",
+            message: "已取消删除",
+          });
+        });
+    },
+    search(v) {
+      this.loading = true;
+      if (v === 2) {
+        this.formData = {
+          pageSize: 10,
+          pageNum: 1,
+          statusList: "0,1",
+          tenantSort: undefined,
+        };
+        this.$nextTick(() => {
+          this.$refs.tableList.clearMoreActive();
+        });
+      }
+      supplierList(this.formData)
+        .then((res) => {
+          this.tableData = res.rows;
+          this.total = res.total;
+          this.navText.index = res.total;
+        })
+        .finally(() => {
+          this.loading = false;
+        });
+    },
+    sortChange(data) {
+      this.formData.tenantSort = data.order
+        ? data.order == "ascending"
+          ? 1
+          : 0
+        : undefined;
+      this.formData.pageNum = 1;
+      this.search();
+    },
+    init() {
+      this.search(2);
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped></style>

+ 1 - 1
src/views/financed/orderManageList/index.vue

@@ -256,7 +256,7 @@
 
 <script>
 import { exportFn } from "@/utils/index.js";
-import dislogSetCost from "../cost/dislogSet.vue";
+import dislogSetCost from "../costSet/dislogOrganSet.vue";
 import dislogSet from "../components/refund/dislogSet.vue";
 import remarks from "../components/remarks.vue";
 import searchBoxNew from "@/components/searchBoxNew";