瀏覽代碼

对接成本模板

谢杰标 2 年之前
父節點
當前提交
3112517cf2

+ 1 - 1
.env.development

@@ -5,7 +5,7 @@ VUE_APP_TITLE =中正平台
 ENV = 'development'
 
 # 中正云教育管理后台/开发环境
-VUE_APP_BASE_API = 'http://192.168.1.222:7077/'
+VUE_APP_BASE_API = 'http://192.168.1.24:7077/'
 # VUE_APP_BASE_API = 'http://192.168.1.24:5030/'
 VUE_APP_IMG_API = 'https://file-dev.xyyxt.net'
 

+ 50 - 0
src/api/financed/index.js

@@ -0,0 +1,50 @@
+import request from "@/utils/request";
+// 成本模板列表
+export function costList(query) {
+  return request({
+    url: "/financial/tp/list",
+    method: "post",
+    method: "get",
+    params: query,
+  });
+}
+// 查询生成表数据
+export function eduList(query) {
+  return request({
+    url: "/course/educationType/allList",
+    method: "get",
+    params: query,
+  });
+}
+// 新增模板
+export function addCost(data) {
+  return request({
+    url: "/financial/tp",
+    method: "post",
+    data,
+  });
+}
+// 修改状态
+export function editDefaultStatus(data) {
+  return request({
+    url: "/financial/tp/editDefaultStatus",
+    method: "post",
+    data,
+  });
+}
+// 修改模板
+export function editCost(data) {
+  return request({
+    url: "/financial/tp/edit",
+    method: "post",
+    data,
+  });
+}
+// 查询模板
+export function costDetal(query) {
+    return request({
+      url: "/financial/tp/list",
+      method: "get",
+      params: query,
+    });
+  }

+ 4 - 0
src/components/tableList.vue

@@ -82,6 +82,7 @@
       style="width: 100%"
       @select-all="selectAll"
       @select="select"
+      @sort-change="sortChange"
       :row-key="rowKey"
       :load="load"
       :cell-style="timeStyle"
@@ -1293,6 +1294,9 @@ export default {
         return a.sort > b.sort ? -1 : 1;
       }
     },
+    sortChange(column) {
+      this.$emit("sortChange", column);
+    },
     openSpec(id) {
       this.$emit("openClassNum", id);
     },

+ 13 - 2
src/views/financed/arap/index.vue

@@ -56,6 +56,9 @@
       @search="search"
     />
     <dislog-tip :dialogVisible.sync="dialogVisible"></dislog-tip>
+    <dislogOrderDetails
+      :dialogVisible.sync="orderDialogVisible"
+    ></dislogOrderDetails>
   </div>
 </template>
 
@@ -64,9 +67,16 @@ import searchBoxNew from "@/components/searchBoxNew";
 import tableList from "@/components/tableList";
 import pagination from "@/components/pagination";
 import dislogTip from "./dislogTip.vue";
+import dislogOrderDetails from "../components/dislogOrderDetails.vue";
 export default {
   name: "cost",
-  components: { searchBoxNew, tableList, pagination, dislogTip },
+  components: {
+    searchBoxNew,
+    tableList,
+    pagination,
+    dislogTip,
+    dislogOrderDetails,
+  },
   data() {
     return {
       loading: false, //当前表单加载是否加载动画
@@ -248,6 +258,7 @@ export default {
       tableData: [], //表单数据
       total: 0, //一共多少条
       dialogVisible: false,
+      orderDialogVisible: true,
       radio1: 1,
     };
   },
@@ -269,7 +280,7 @@ export default {
       this.init();
     },
     handelClick() {
-      this.dialogVisible = false;
+      this.dialogVisible = true;
     },
     search(v) {
       this.loading = true;

+ 160 - 0
src/views/financed/components/dislogOrderDetails.vue

@@ -0,0 +1,160 @@
+<template>
+  <div class="orderDetail">
+    <BaseDialog
+      width="1200px"
+      :isShow.sync="isShow"
+      title="订单详情"
+      @close="close"
+      :isShowFooter="false"
+    >
+      <div class="head">
+        订单号:<span>1561653316541656313</span> 退款状态:<span>——</span>
+        审核状态:<span>已通过</span>
+      </div>
+      <div class="mian">
+        <el-descriptions class="margin-top" :column="3" border>
+          <el-descriptions-item
+            :label="desc.label"
+            v-for="(desc, index) in descList"
+            :key="index"
+          >
+            <div v-if="desc.type">
+              <el-link
+                :underline="false"
+                v-if="desc.type === 'dowm'"
+                href="https://element.eleme.io"
+                target="_blank"
+                >资料下载</el-link
+              >
+              <el-image
+                v-if="desc.type === 'image'"
+                style="width: 40px; height: 20px"
+                :src="$methodsTools.splitImgHost(detailInfo[desc.key])"
+                :preview-src-list="[
+                  $methodsTools.splitImgHost(detailInfo[desc.key]),
+                ]"
+              >
+              </el-image>
+            </div>
+            <div v-else>
+              {{ detailInfo[desc.key] }}
+              <span
+                v-if="desc.key === '888'"
+                :style="{ color: true ? '#409eff' : '#f56c6c' }"
+                >【{{ true ? "盈" : "亏" }}】</span
+              >
+              <span
+                v-if="desc.key === '999'"
+                :style="{ color: false ? '#409eff' : '#f56c6c' }"
+                >({{ true ? "已结清" : "未结清" }})</span
+              >
+            </div>
+          </el-descriptions-item>
+        </el-descriptions>
+      </div>
+      <student-details></student-details>
+    </BaseDialog>
+  </div>
+</template>
+
+<script>
+import studentDetails from "./studentDetails.vue";
+export default {
+  name: "dislogOrderDetails",
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+    id: {
+      type: String,
+      default: "",
+    },
+  },
+  data() {
+    return {
+      form: {},
+      descList: [
+        { label: "机构名称", key: "123" },
+        { label: "业务员", key: "123" },
+        { label: "业务号", key: "123" },
+        { label: "业务分类", key: "123" },
+        { label: "订单来源", key: "123" },
+        { label: "申请时间", key: "123" },
+        { label: "盈亏(元)", key: "888" },
+        { label: "成本(元)", key: "123" },
+        { label: "合同金额(元)", key: "123" },
+        { label: "已收账款(元)", key: "123" },
+        { label: "申请退款", key: "123" },
+        { label: "已退账款(元)", key: "123" },
+        { label: "未收账款(元)", key: "999" },
+        { label: "实际账款(元)", key: "123" },
+        { label: "下单企业", key: "123" },
+        { label: "转账开户名", key: "123" },
+        { label: "转账凭证", key: "avatar", type: "image" },
+        { label: "发票状态", key: "123" },
+        { label: "备注", key: "123" },
+        { label: "附件", type: "dowm" },
+      ],
+      detailInfo: {
+        avatar: "oss/images/avatar/20211103/1635931027923_941464701",
+      },
+    };
+  },
+
+  mounted() {},
+
+  methods: {
+    init() {
+      this.resetForm();
+      if (this.id) {
+      }
+    },
+    close() {
+      this.$refs["form"].resetFields();
+    },
+    submit() {},
+    resetForm() {
+      this.form = {
+        email: undefined,
+        email1: undefined,
+        email2: undefined,
+        email3: undefined,
+      };
+    },
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          this.isShow = false;
+          this.$emit("search");
+        } else {
+          return false;
+        }
+      });
+    },
+  },
+  computed: {
+    isShow: {
+      get() {
+        return this.dialogVisible;
+      },
+      set(val) {
+        this.$emit("update:dialogVisible", false);
+      },
+    },
+  },
+  components: { studentDetails },
+};
+</script>
+
+<style lang="scss" scoped>
+.orderDetail {
+  .head {
+    margin-bottom: 20px;
+    span {
+      padding-right: 20px;
+      color: #409eff;
+    }
+  }
+}
+</style>

+ 187 - 0
src/views/financed/components/studentDetails.vue

@@ -0,0 +1,187 @@
+<template>
+  <div class="studentDetails">
+    <el-tabs v-model="tabType" @tab-click="handleClick">
+      <el-tab-pane label="学员详情" name="1">
+        <div style="margin-bottom: 10px">
+          <!-- 搜索框 -->
+          <el-input
+            style="width: 230px; margin-right: 10px"
+            size="small"
+            v-model="form.templateName"
+            placeholder="姓名/身份证号"
+          ></el-input>
+          <el-button size="small" type="primary" @click="search(form.goodsId)"
+            >查询</el-button
+          >
+          <el-button size="small">重置</el-button>
+        </div>
+        <table-list
+          :tableSets="tableSet1"
+          :tableData="tableData1"
+          :navText="dialogNavText"
+        >
+        </table-list>
+        <pagination
+          :total="total"
+          :pageSize.sync="formData.pageSize"
+          :currentPage.sync="formData.pageNum"
+          @search="search"
+        />
+      </el-tab-pane>
+      <el-tab-pane label="操作历史" name="2">
+        <table-list
+          :tableSets="tableSet2"
+          :tableData="tableData2"
+          :navText="dialogNavText"
+        >
+        </table-list>
+        <pagination
+          :total="total"
+          :pageSize.sync="formData.pageSize"
+          :currentPage.sync="formData.pageNum"
+          @search="search"
+        />
+      </el-tab-pane>
+    </el-tabs>
+  </div>
+</template>
+
+<script>
+import tableList from "@/components/tableList";
+import pagination from "@/components/pagination";
+export default {
+  name: "SaasMasterPlatformStudentDetails",
+
+  data() {
+    return {
+      form: {},
+      tableSet1: [
+        {
+          label: "姓名",
+          prop: "educationName",
+          hidden: true,
+        },
+        {
+          label: "身份证号",
+          prop: "businessName",
+          hidden: true,
+        },
+        {
+          label: "手机号",
+          prop: "name",
+          hidden: true,
+        },
+        {
+          label: "课程",
+          prop: "specNumber",
+          hidden: true,
+        },
+        {
+          label: "专业",
+          prop: "specNumber",
+          hidden: true,
+        },
+        {
+          label: "业务",
+          prop: "specNumber",
+          hidden: true,
+        },
+        {
+          label: "原价(元)",
+          prop: "specNumber",
+          hidden: true,
+        },
+        {
+          label: "单价(元)",
+          prop: "specNumber",
+          hidden: true,
+        },
+        {
+          label: "学习状态",
+          prop: "specNumber",
+          hidden: true,
+        },
+      ],
+      tableData1: [],
+      tableSet2: [
+        {
+          label: "时间",
+          prop: "educationName",
+          hidden: true,
+        },
+        {
+          label: "操作者",
+          prop: "businessName",
+          hidden: true,
+        },
+        {
+          label: "动作",
+          prop: "name",
+          hidden: true,
+        },
+        {
+          label: "字段",
+          prop: "specNumber",
+          hidden: true,
+        },
+        {
+          label: "操作前",
+          prop: "specNumber",
+          hidden: true,
+        },
+        {
+          label: "操作后",
+          prop: "specNumber",
+          hidden: true,
+        },
+      ],
+      tableData2: [],
+      dialogNavText: {
+        index: 0,
+        num: true,
+        border: true,
+        choice: false,
+        choiceRadio: false,
+        radioKey: "specTemplateId",
+        radioFixed: false,
+        addHide: !false,
+        tableHide: true,
+        dontNum: false,
+        headShow: false,
+        backFatherBtn: {
+          status: false,
+          title: "未定义",
+        },
+      },
+      formData: {
+        pageSize: 10,
+        pageNum: 1,
+      },
+      total: 0,
+      tabType: "1",
+    };
+  },
+
+  mounted() {},
+
+  methods: {
+    search() {},
+    handleClick(tab) {
+      console.log(tab);
+    },
+  },
+  components: {
+    tableList,
+    pagination,
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.studentDetails {
+  margin-top: 10px;
+  #tableList {
+    padding: 0;
+  }
+}
+</style>

+ 250 - 69
src/views/financed/cost/dislogSet.vue

@@ -1,97 +1,177 @@
 <template>
   <div>
     <BaseDialog
-      width="1200px"
+      width="1400px"
       :isShow.sync="isShow"
       :title="['新增', '修改', '复制'][type]"
       @close="close"
       @submit="submitForm"
     >
+      <div class="bop-tip">
+        <div><i class="el-icon-warning-outline"></i>说明</div>
+        <div>
+          ●
+          如果提成方式是按阶梯价计算,则需设置阶梯价格区间(最高价无穷大,则填写
+          “ * ” )。如果无需按阶梯价计算提成,留空即可。
+        </div>
+      </div>
       <el-form
         inline
         hide-required-asterisk
         :model="form"
         :rules="rules"
         ref="form"
-        label-width="100px"
       >
         <div>
-          <el-form-item prop="name" label="模板名称:">
+          <el-form-item prop="tpName" label="模板名称:" label-width="100px">
             <el-input
               placeholder="请输入模板名称"
-              v-model="form.name"
+              v-model="form.tpName"
             ></el-input>
           </el-form-item>
+          <el-form-item prop="tenantId" label="">
+            <el-select v-model="form.tenantId" placeholder="请选择关联机构">
+              <el-option
+                v-for="item in companyList"
+                :key="item.tenantId"
+                :label="item.tenantName"
+                :value="item.tenantId"
+              ></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.list" :key="index">
+        <div v-for="(item, index) in form.itemList" :key="index">
           <el-form-item
-            :prop="'list.' + index + '.email'"
+            :prop="'itemList.' + index + '.itemName'"
             :label="index == 0 ? '成本设置:' : ' '"
-            :rules="rules['email']"
+            :rules="rules['itemName']"
+            label-width="100px"
           >
             <el-input
               placeholder="请输入成本项名称"
-              v-model="item.email"
+              v-model="item.itemName"
             ></el-input>
           </el-form-item>
           <el-form-item
-            style="margin-left: 10px"
             label=""
-            label-width="4px"
-            :prop="'list.' + index + '.email1'"
-            :rules="rules['email1']"
+            :prop="'itemList.' + index + '.itemCategory'"
+            :rules="rules['itemCategory']"
           >
-            <el-select v-model="item.email1" placeholder="请选择是否分成">
-              <el-option label="分成成本" value="1"></el-option>
-              <el-option label="非分成成本" value="2"></el-option>
+            <el-select v-model="item.itemCategory" placeholder="请选择成本类型">
+              <el-option label="业务类型" value="1"></el-option>
+              <el-option label="非分成" value="2"></el-option>
             </el-select>
           </el-form-item>
+          <template v-if="item.itemCategory == 1">
+            <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
+              label=""
+              :prop="'itemList.' + index + '.businessId'"
+              :rules="rules['businessId']"
+            >
+              <el-select 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>
+          </template>
           <el-form-item
-            style="margin-left: 10px"
             label=""
-            label-width="4px"
-            :prop="'list.' + index + '.email2'"
-            :rules="rules['email2']"
+            :prop="'itemList.' + index + '.itemType'"
+            :rules="rules['itemType']"
           >
-            <el-select v-model="item.email2" placeholder="请选择成本类型">
+            <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.email2 == 1"
+            label=""
+            :prop="'itemList.' + index + '.email2'"
+            :rules="rules['email2']"
+            class="range"
+          >
+            <el-col :span="11">
+              <el-input placeholder="最低价" v-model="item.minValue"></el-input>
+            </el-col>
+            <el-col class="line" :span="2" style="magrin: 10px">-</el-col>
+            <el-col :span="11">
+              <el-input placeholder="最高价" v-model="item.maxValue"></el-input>
+            </el-col>
+          </el-form-item>
+          <el-form-item
+            class="ddd"
+            v-if="item.itemType == 1"
             label-width="0"
-            :prop="'list.' + index + '.email3'"
+            :prop="'itemList.' + index + '.typeValue'"
             label=" "
-            :rules="rules['email3']"
+            :rules="rules['typeValue']"
           >
-            <el-input placeholder="请输入固定成本" v-model="item.email3">
-              <template slot="append">元</template>
+            <el-input placeholder="百分比成本" v-model="item.typeValue">
+              <template slot="append">%</template>
             </el-input>
           </el-form-item>
           <el-form-item
-            v-if="item.email2 == 2"
+            v-if="item.itemType == 2"
+            class="ddd"
             label-width="0"
-            :prop="'list.' + index + '.email4'"
+            :prop="'itemList.' + index + '.typeValue'"
             label=" "
-            :rules="rules['email4']"
+            :rules="rules['typeValue']"
           >
-            <el-input placeholder="请输入百分比成本" v-model="form.email4">
-              <template slot="append">%</template>
+            <el-input placeholder="固定成本" v-model="item.typeValue">
+              <template slot="append"></template>
             </el-input>
           </el-form-item>
-          <i
-            @click="add(index)"
-            style="font-size: 24px; margin: 5px; cursor: pointer"
-            class="el-icon-circle-plus-outline"
-          ></i>
-          <i
-            v-if="index != 0"
-            @click="del(index)"
-            style="font-size: 24px; margin: 5px; cursor: pointer"
-            class="el-icon-remove-outline"
-          ></i>
+          <el-form-item label-width="0" label=" ">
+            <div class="btns">
+              <!-- <el-button type="text">复制</el-button> -->
+              <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>
@@ -99,6 +179,7 @@
 </template>
 
 <script>
+import { eduList, addCost, costDetal } from "@/api/financed/index";
 export default {
   name: "DislogSet",
   props: {
@@ -111,8 +192,8 @@ export default {
       type: [String, Number],
       default: 0,
     },
-    id: {
-      type: String,
+    tpId: {
+      type: [String, Number],
       default: "",
     },
   },
@@ -120,73 +201,133 @@ export default {
     return {
       form: {},
       rules: {
-        name: [
-          { required: true, message: "请输入活动名称", trigger: "blur" },
-          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
+        tpName: [
+          { required: true, message: "请输入模板名称", trigger: "blur" },
+        ],
+        tenantId: [
+          { required: true, message: "请选择关联机构", trigger: "change" },
         ],
-        email: [
+        itemName: [
           { required: true, message: "请输入成本项名称", trigger: "blur" },
-          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
         ],
-        email1: [
-          { required: true, message: "请选择是否分成", trigger: "change" },
+        businessId: [
+          { required: true, message: "请选择业务层次", trigger: "blur" },
+        ],
+        educationTypeId: [
+          { required: true, message: "请选择教育类型", trigger: "change" },
+        ],
+        itemCategory: [
+          { required: true, message: "请选择业务类型", trigger: "change" },
         ],
-        email2: [
+        itemType: [
           { required: true, message: "请选择成本类型", trigger: "change" },
         ],
         email3: [
           { required: true, message: "请输入固定成本", trigger: "blur" },
         ],
-        email4: [
+        typeValue: [
           { required: true, message: "请输入百分比成本", trigger: "blur" },
         ],
       },
+      eduTypeOptions: [],
+      newCourTypeOptions: [],
+      companyList: [],
+      eduList: [],
+      courType: 0,
     };
   },
 
-  mounted() {},
+  mounted() {
+    console.log(8798465465);
+  },
 
   methods: {
     init() {
       this.resetForm();
-      if (this.id) {
+      if (this.tpId) {
+        this.getCostDetal();
+        console.log(this.tpId, 666);
       }
+      this.getCompanyList();
+      this.getEduList();
+    },
+    getCostDetal() {
+      costDetal({ tpId: this.tpId }).then((res) => {
+        console.log(res.rows, 89);
+      });
+    },
+    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 || [];
+    },
+    getCompanyList() {
+      if (this.companyList.length) return;
+      this.$api.systemtenantlist(this.formData).then((res) => {
+        this.companyList = res.rows;
+      });
     },
-    add(index) {
-      this.form.list.splice(index + 1, 0, {
+    changeEdu(data) {
+      data.businessId = undefined;
+      data.projectId = undefined;
+    },
+    changeBus(data, projectId) {
+      data.projectId = projectId;
+    },
+    add(index, data) {
+      data = data || {
         email: undefined,
-        email1: undefined,
+        businessId: undefined,
         email2: undefined,
         email3: undefined,
         email4: undefined,
-      });
+      };
+      this.form.itemList.splice(index + 1, 0, data);
     },
     del(index) {
-      this.form.list.splice(index, 1);
+      this.form.itemList.splice(index, 1);
     },
     close() {
       this.$refs["form"].resetFields();
     },
+    changeEduType() {},
     submit() {},
     resetForm() {
       this.form = {
-        list: [
+        itemList: [
           {
-            email: undefined,
-            email1: undefined,
-            email2: undefined,
-            email3: undefined,
-            email4: undefined,
+            projectId: undefined,
+            itemName: 456,
+            itemCategory: "1",
+            businessId: undefined,
+            educationTypeId: 21,
+            itemType: "1",
+            typeValue: undefined,
+            minValue: undefined,
+            maxValue: undefined,
           },
         ],
-        name: undefined,
+        tpName: 123,
+        defaultStatus: 0,
+        tenantId: "1",
       };
     },
     submitForm() {
+      console.log(1232132);
       this.$refs["form"].validate((valid) => {
         if (valid) {
-          this.isShow = false;
-          this.$emit("search");
+          console.log(13213);
+          addCost(this.form).then((res) => {
+            console.log(res, 666);
+            this.isShow = false;
+            this.$emit("search");
+          });
         } else {
           return false;
         }
@@ -209,4 +350,44 @@ export default {
 };
 </script>
 
-<style lang="scss" scoped></style>
+<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>

+ 41 - 54
src/views/financed/cost/index.vue

@@ -13,34 +13,30 @@
       :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="pcost" slot-scope="props">
-        <div>税收:40%</div>
-        <div>税收:40%</div>
-      </template>
-      <template slot="fcost" slot-scope="props">
-        <div>税收:40</div>
-        <div>税收:40</div>
-      </template>
       <template slot="status" slot-scope="props">
         <el-checkbox
-          @change="changeStatus"
-          :checked="!!props.scope.row.status"
-        ></el-checkbox>
+          :true-label="1"
+          :false-label="0"
+          @change="(val) => changeStatus(props.scope.row.tpId, 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)"
+        <el-button type="text" @click="handelClick(2, props.scope.row.tpId)"
           >复制</el-button
         >
-        <el-button type="text" @click="handelClick(1, props.scope.row)"
+        <el-button type="text" @click="handelClick(1, props.scope.row.tpId)"
           >修改</el-button
         >
-        <el-button type="text" @click="handelDel(props.scope.row.id)"
+        <el-button type="text" @click="handelDel(props.scope.row.tpId)"
           >删除</el-button
         >
       </template>
@@ -53,7 +49,7 @@
     />
     <dislog-set
       :dialogVisible.sync="dialogVisible"
-      :id="id"
+      :tpId="tpId"
       :type="type"
       @search="search"
     ></dislog-set>
@@ -65,6 +61,7 @@ import dislogSet from "./dislogSet.vue";
 import searchBoxNew from "@/components/searchBoxNew";
 import tableList from "@/components/tableList";
 import pagination from "@/components/pagination";
+import { costList, editDefaultStatus, editCost } from "@/api/financed/index";
 export default {
   name: "cost",
   components: { searchBoxNew, tableList, pagination, dislogSet },
@@ -89,34 +86,23 @@ export default {
       //搜索
       formList: [
         {
-          prop: "name",
+          prop: "tpName",
           placeholder: "请输入模板名称",
         },
       ],
-      formData: {
-        pageSize: 10,
-        pageNum: 1,
-      },
+      formData: {},
       // 表单
       tableSet: [
         {
           label: "模板名称",
-          prop: "name",
+          prop: "tpName",
           hidden: true,
         },
         {
-          label: "百分比成本",
-          prop: "posterTempName",
+          label: "关联机构",
+          prop: "tenantName",
           hidden: true,
-          scope: "solt",
-          soltName: "pcost",
-        },
-        {
-          label: "固定成本成本",
-          prop: "posterTempName1",
-          hidden: true,
-          scope: "solt",
-          soltName: "fcost",
+          sort: "custom",
         },
         {
           label: "默认状态",
@@ -134,18 +120,19 @@ export default {
     };
   },
   created() {
-    this.search();
+    this.search(2);
   },
   methods: {
-    handelClick(type, id) {
+    handelClick(type, tpId) {
       this.dialogVisible = true;
       this.type = type;
-      if (type !== 0) {
-        this.id = id;
-      }
+      this.tpId = tpId;
     },
-    changeStatus(val) {
-      console.log(val);
+    changeStatus(tpId, defaultStatus) {
+      editDefaultStatus({ tpId, defaultStatus }).then((res) => {
+        this.$message.success("状态修改成功");
+        this.search();
+      });
     },
     batchDel() {
       let len = this.$refs.tableList.allCheckData.length;
@@ -154,18 +141,16 @@ export default {
       }
       const ids = this.$refs.tableList.allCheckData.map((item) => item.id);
     },
-    handelDel(id) {
+    handelDel(tpId) {
       this.$confirm("此操作将删除该模板, 是否继续?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
         .then(() => {
-          this.$api.editUser(id).then((res) => {
-            if (res.code === 200) {
-              this.$message.success("删除成功");
-              this.search();
-            }
+          editCost({ tpId, status: -1 }).then((res) => {
+            this.$message.success("删除成功");
+            this.search();
           });
         })
         .catch(() => {
@@ -181,17 +166,10 @@ export default {
         this.formData = {
           pageSize: 10,
           pageNum: 1,
+          tenantSort: undefined,
         };
       }
-      var data = JSON.parse(JSON.stringify(this.formData));
-      // if (this.formData.classStartTime) {
-      //   data.classStartTime = parseInt(data.classStartTime / 1000);
-      // }
-      // if (this.formData.classEndTime) {
-      //   data.classEndTime = parseInt(data.classEndTime / 1000);
-      // }
-      this.$api
-        .distributiontemplist(data)
+      costList(this.formData)
         .then((res) => {
           this.tableData = res.rows;
           this.total = res.total;
@@ -201,6 +179,15 @@ export default {
           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);
     },