Ver Fonte

Merge branch 'x_d_5.1' of http://120.79.166.78:19005/zhongzheng-edu/saas_masterPlatform into dev

Tang há 2 anos atrás
pai
commit
a68c390d11

+ 3 - 2
package.json

@@ -41,9 +41,9 @@
     "af-table-column": "^1.0.3",
     "axios": "0.21.0",
     "clipboard": "2.0.6",
-    "core-js": "3.8.1",
+    "core-js": "^3.30.2",
     "echarts": "4.9.0",
-    "element-ui": "2.15.6",
+    "element-ui": "^2.15.13",
     "file-saver": "^2.0.5",
     "fuse.js": "6.4.3",
     "gsap": "^3.11.4",
@@ -77,6 +77,7 @@
     "babel-eslint": "10.1.0",
     "chalk": "4.1.0",
     "connect": "3.6.6",
+    "core-js": "^3.30.2",
     "eslint": "7.15.0",
     "eslint-plugin-vue": "7.2.0",
     "less": "^4.1.2",

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

@@ -62,6 +62,7 @@ export function orderList(query) {
     url: "/receive/order/list",
     method: "get",
     params: query,
+    isProce: true,
   });
 }
 
@@ -71,6 +72,7 @@ export function orderExport(query) {
     url: "/receive/order/listExport",
     method: "get",
     params: query,
+    isProce: true,
   });
 }
 // 机构分成列表导出
@@ -107,6 +109,15 @@ export function orderNoteEdit(data) {
 }
 
 // 业务员提成列表
+export function sellerPercentageList(query) {
+  return request({
+    url: "/divide/log/sellerList",
+    method: "get",
+    params: query,
+    isProce: true,
+  });
+}
+// 业务员提成订单列表
 export function sellerList(query) {
   return request({
     url: "/system/top/order/divSellerList",
@@ -114,6 +125,24 @@ export function sellerList(query) {
     params: query,
   });
 }
+// 查询机构分成记录列表
+export function companyList(query) {
+  return request({
+    url: "/divide/log/companyList",
+    method: "get",
+    params: query,
+    isProce: true,
+  });
+}
+// 查询佣金结算列表
+export function commissionList(query) {
+  return request({
+    url: "/divide/log/commissionList",
+    method: "get",
+    params: query,
+    isProce: true,
+  });
+}
 // 机构分成列表
 export function tenantList(query) {
   return request({
@@ -130,6 +159,22 @@ export function updateRemark(data) {
     data,
   });
 }
+// 修改月份备注
+export function updateMonthRemark(data) {
+  return request({
+    url: "/divide/log/updateRemark",
+    method: "post",
+    data,
+  });
+}
+// 查询月份订单列表
+export function monthOrderList(query) {
+  return request({
+    url: "/divide/log/monthOrderList",
+    method: "get",
+    params: query,
+  });
+}
 // 订单应收应付统计
 export function countOrderNum(query) {
   return request({
@@ -138,3 +183,20 @@ export function countOrderNum(query) {
     params: query,
   });
 }
+
+// 坏账设置
+export function setBadBill(data) {
+  return request({
+    url: "/divide/log/updateBadBill",
+    method: "post",
+    data,
+  });
+}
+// 坏账详情
+export function badBillDetail(query) {
+  return request({
+    url: "/divide/log/configKey/badBill",
+    method: "get",
+    params: query,
+  });
+}

+ 92 - 0
src/components/Comon/pictureList.vue

@@ -0,0 +1,92 @@
+<template>
+  <div class="dis_flex_order_li">
+    <div class="list" v-for="(item, index) in list" :key="index">
+      <img :src="backFullSrc(item.img)" alt="" />
+      <div class="right">
+        <h4>{{ item.label }}:</h4>
+        <p>{{ item.value || info[item.prop] }}{{ item.ch || "元" }}</p>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "SaasMasterPlatformPictureList",
+  props: {
+    list: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+    fn: {
+      type: Function,
+      default: () => {
+        return Promise.resolve({ data: {} });
+      },
+    },
+  },
+  data() {
+    return {
+      info: {},
+    };
+  },
+
+  mounted() {
+    this.fn().then((res) => {
+      this.info = res.data;
+    });
+  },
+
+  methods: {
+    backFullSrc(name) {
+      return require(`@/assets/images/${name}@2x.png`);
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.dis_flex_order_li {
+  display: flex;
+  align-items: center;
+  flex-wrap: wrap;
+  & > .list {
+    user-select: none;
+    cursor: pointer;
+    transition: all 0.3s;
+    box-shadow: 0px 0px 4px 1px rgba(0, 0, 0, 0.2);
+    &:hover {
+      transform: scale(1.04);
+    }
+    width: 136px;
+    height: 44px;
+    border-radius: 6px;
+    display: flex;
+    align-items: center;
+    flex-shrink: 0;
+    margin-right: 10px;
+    margin-bottom: 10px;
+    & > img {
+      margin-left: 2px;
+      width: 40px;
+      height: 40px;
+    }
+    & > .right {
+      flex: 1;
+      padding-left: 4px;
+      & > h4 {
+        color: #000;
+        margin: 0;
+        font-size: 12px;
+      }
+      & > p {
+        font-size: 12px;
+        color: red;
+        margin: 0;
+      }
+    }
+  }
+}
+</style>

+ 11 - 12
src/components/searchBoxNew.vue

@@ -78,20 +78,10 @@
       </div>
     </div> -->
     <div class="inputListBoxs">
-      <div class="fon_sIcon" v-if="redIcon">
-        <el-tooltip
-          effect="light"
-          class="item"
-          content="该页面中的数据查询,针对的是「有效、有课程内容」的视频商品"
-          placement="bottom-start"
-        >
-          <i class="el-icon-warning-outline iconStyS"></i>
-        </el-tooltip>
-      </div>
       <div
         class="fon_s"
         style="padding-top: 10px; width: 70px; text-align: end"
-        v-else
+        v-if="redIcon !== false"
       >
         筛选:
       </div>
@@ -504,6 +494,15 @@
             >
             </el-date-picker>
           </div>
+          <el-date-picker
+            v-else-if="item.scope === 'moreMonth'"
+            type="months"
+            :size="size"
+            v-model="formData[item.prop]"
+            :placeholder="item.placeholder || '选择月份'"
+            value-format="timestamp"
+          >
+          </el-date-picker>
           <el-input
             :style="item.prop === 'searchKey' ? 'width:260px;' : ''"
             v-else-if="!item.scope"
@@ -967,7 +966,7 @@ export default {
       const indexs = this.educationType.findIndex((item) => {
         return item.id === id;
       });
-      this.tireStatus = this.educationType[indexs].tireStatus || '';
+      this.tireStatus = this.educationType[indexs].tireStatus || "";
       if (!status1) {
         if (this.formData.projectId) {
           this.formData.projectId = "";

+ 7 - 2
src/components/tableList.vue

@@ -129,6 +129,7 @@
       <el-table-column
         v-if="navText.dontNum ? false : true"
         type="index"
+        :index="setIndex"
         label="序号"
         width="70"
         align="center"
@@ -547,6 +548,9 @@
                 : "未知"
             }}
           </span>
+          <span v-else-if="item.scope === 'type'">
+            {{ item.values[scope.row[item.prop]] }}
+          </span>
           <span v-else-if="item.scope === 'typeStatus'">{{
             scope.row[item.prop] === 0
               ? "报名指引"
@@ -964,14 +968,14 @@
           <div v-else-if="item.scope === 'solt'">
             <slot :name="item.soltName" :scope="scope"></slot>
           </div>
-          <div v-else>
+          <span v-else>
             {{ scope.row[item.prop] }}
             {{
               (scope.row[item.prop] || scope.row[item.prop] === 0) && item.ch
                 ? item.ch
                 : ""
             }}
-          </div>
+          </span>
         </template>
       </af-table-column>
       <el-table-column
@@ -1155,6 +1159,7 @@ export default {
     "loading",
     "studentTable",
     "objectSpanMethod",
+    "setIndex",
     "radio",
   ],
   data: function () {

+ 28 - 0
src/utils/common.js

@@ -0,0 +1,28 @@
+export function paramMate(data) {
+  if (typeof data != "object" && data == null) {
+    return data;
+  }
+  data = JSON.parse(JSON.stringify(data));
+  if (Array.isArray(data)) {
+    data = data.map((e) => {
+      if (isTimeStamp(e)) {
+        e = parseInt(e / 1000);
+      }
+      return e;
+    });
+  } else {
+    for (const key in data) {
+      if (typeof data[key] == "object") {
+        data[key] = paramMate(data[key]);
+      } else {
+        if (isTimeStamp(data[key])) {
+          data[key] = parseInt(data[key] / 1000);
+        }
+      }
+    }
+  }
+  return data;
+}
+export function isTimeStamp(time) {
+  return typeof time == "number" && String(time).length == 13;
+}

+ 101 - 88
src/utils/request.js

@@ -1,116 +1,129 @@
-import axios from 'axios'
-import { Notification, MessageBox, Message } from 'element-ui'
-import store from '@/store'
-import { getToken } from '@/utils/auth'
-import errorCode from '@/utils/errorCode'
-import methods from '@/utils/methodsTool';
+import axios from "axios";
+import { Notification, MessageBox, Message } from "element-ui";
+import store from "@/store";
+import { getToken } from "@/utils/auth";
+import errorCode from "@/utils/errorCode";
+import { paramMate } from "@/utils/common";
 
-axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
+axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
 // 创建axios实例
 // export const baseURL = process.env.VUE_APP_BASE_API
 // export const baseURL = 'https://ptapi.gdzzkj.net/'
-export const baseURL = 'http://192.168.1.7:7077/'
-export const BASE_IMG_URL = process.env.VUE_APP_IMG_API
+export const baseURL = "http://192.168.1.24:7077/";
+export const BASE_IMG_URL = process.env.VUE_APP_IMG_API;
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分
   baseURL: baseURL,
   // 超时
-  timeout: 60000
-})
+  timeout: 60000,
+});
 // request拦截器
-service.interceptors.request.use(config => {
-  // 是否需要设置 token
-  const isToken = (config.headers || {}).isToken === false
-  if (getToken() && !isToken) {
-    config.headers['AuthorizationToken'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
-  }
-  // config.headers.TenantId = sessionStorage.TenantId || methods.getQueryVariable('TenantId')
-  // get请求映射params参数
-  if (config.method === 'get' && config.params) {
-    let url = config.url + '?';
-    for (const propName of Object.keys(config.params)) {
-      const value = config.params[propName];
-      var part = encodeURIComponent(propName) + "=";
-      if (value !== null && typeof (value) !== "undefined") {
-        if (typeof value === 'object') {
-          for (const key of Object.keys(value)) {
-            if (value[key] !== null && typeof (value[key]) !== 'undefined') {
-              let params = propName + '[' + key + ']';
-              let subPart = encodeURIComponent(params) + '=';
-              url += subPart + encodeURIComponent(value[key]) + '&';
+service.interceptors.request.use(
+  (config) => {
+    // 是否需要设置 token
+    const isToken = (config.headers || {}).isToken === false;
+    if (getToken() && !isToken) {
+      config.headers["AuthorizationToken"] = "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
+    }
+    // 转换时间戳
+    if (config.isProce) {
+      config.params = paramMate(config.params);
+      config.data = paramMate(config.data);
+    }
+
+    // config.headers.TenantId = sessionStorage.TenantId || methods.getQueryVariable('TenantId')
+    // get请求映射params参数
+    if (config.method === "get" && config.params) {
+      let url = config.url + "?";
+      for (const propName of Object.keys(config.params)) {
+        const value = config.params[propName];
+        var part = encodeURIComponent(propName) + "=";
+        if (value !== null && typeof value !== "undefined") {
+          if (typeof value === "object") {
+            for (const key of Object.keys(value)) {
+              if (value[key] !== null && typeof value[key] !== "undefined") {
+                let params = propName + "[" + key + "]";
+                let subPart = encodeURIComponent(params) + "=";
+                url += subPart + encodeURIComponent(value[key]) + "&";
+              }
             }
+          } else {
+            url += part + encodeURIComponent(value) + "&";
           }
-        } else {
-          url += part + encodeURIComponent(value) + "&";
         }
       }
+      url = url.slice(0, -1);
+      config.params = {};
+      config.url = url;
     }
-    url = url.slice(0, -1);
-    config.params = {};
-    config.url = url;
+    return config;
+  },
+  (error) => {
+    console.log(error);
+    Promise.reject(error);
   }
-  return config
-}, error => {
-  console.log(error)
-  Promise.reject(error)
-})
+);
 
 // 响应拦截器
-service.interceptors.response.use(res => {
-  // 未设置状态码则默认成功状态
-  const code = res.data.code || 200;
-  // 获取错误信息
-  const msg = errorCode[code] || res.data.msg || errorCode['default']
-  if (code === 401) {
-    MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
-      confirmButtonText: '重新登录',
-      cancelButtonText: '取消',
-      type: 'warning'
+service.interceptors.response.use(
+  (res) => {
+    // 未设置状态码则默认成功状态
+    const code = res.data.code || 200;
+    // 获取错误信息
+    const msg = errorCode[code] || res.data.msg || errorCode["default"];
+    if (code === 401) {
+      MessageBox.confirm(
+        "登录状态已过期,您可以继续留在该页面,或者重新登录",
+        "系统提示",
+        {
+          confirmButtonText: "重新登录",
+          cancelButtonText: "取消",
+          type: "warning",
+        }
+      )
+        .then(() => {
+          store.dispatch("LogOut").then(() => {
+            location.href = "/index";
+          });
+        })
+        .catch(() => {});
+      return Promise.reject("无效的会话,或者会话已过期,请重新登录。");
+    } else if (code === 500) {
+      Message({
+        message: msg,
+        type: "error",
+        duration: 5000,
+        showClose: true,
+      });
+      return Promise.reject(new Error(msg));
+    } else if (code === 510 || code === 511) {
+      return res.data;
+    } else if (code !== 200) {
+      Notification.error({
+        title: msg,
+      });
+      return Promise.reject("error");
+    } else {
+      return res.data;
     }
-    ).then(() => {
-      store.dispatch('LogOut').then(() => {
-        location.href = '/index';
-      })
-    }).catch(() => { });
-    return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
-  } else if (code === 500) {
-    Message({
-      message: msg,
-      type: 'error',
-      duration: 5000,
-      showClose: true
-    })
-    return Promise.reject(new Error(msg))
-  } else if (code === 510 || code === 511) {
-    return res.data
-  } else if (code !== 200) {
-    Notification.error({
-      title: msg
-    })
-    return Promise.reject('error')
-  } else {
-    return res.data
-  }
-},
-  error => {
-    console.log('err' + error)
+  },
+  (error) => {
+    console.log("err" + error);
     let { message } = error;
     if (message == "Network Error") {
       message = "后端接口连接异常";
-    }
-    else if (message.includes("timeout")) {
+    } else if (message.includes("timeout")) {
       message = "系统接口请求超时";
-    }
-    else if (message.includes("Request failed with status code")) {
+    } else if (message.includes("Request failed with status code")) {
       message = "系统接口" + message.substr(message.length - 3) + "异常";
     }
     Message({
       message: message,
-      type: 'error',
-      duration: 5 * 1000
-    })
-    return Promise.reject(error)
+      type: "error",
+      duration: 5 * 1000,
+    });
+    return Promise.reject(error);
   }
-)
+);
 
-export default service
+export default service;

+ 334 - 146
src/views/financed/arap/index.vue

@@ -8,6 +8,7 @@
       <el-radio-button :label="0">应收账款</el-radio-button>
       <el-radio-button :label="1">机构分成</el-radio-button>
       <el-radio-button :label="2">业务员提成</el-radio-button>
+      <el-radio-button :label="3">佣金结算</el-radio-button>
     </el-radio-group>
     <search-box-new
       ref="searchBox"
@@ -16,26 +17,27 @@
       @search="search"
       @init="init"
     />
-    <div class="dis_flex_order_li">
-      <div class="list" v-for="(item, index) in showTabList[type]" :key="index">
-        <img :src="item.img" alt="" />
-        <div class="right">
-          <h4>{{ item.label }}:</h4>
-          <p>{{ countInfo[item.prop] }}{{ item.ch || "元" }}</p>
-        </div>
-      </div>
-    </div>
+    <picture-list
+      :key="type + 'a'"
+      :fn="getCountOrderNum"
+      :list="showTabList[type]"
+    ></picture-list>
     <table-list
       :key="type"
       rowKey="id"
       ref="tableList"
-      @openDialog="(row) => openDialog(row, 0)"
       :tableSets="tableSet"
       :tableData="tableData"
       :navText="navText"
       :loading="loading"
+      :setIndex="setIndex"
+      @load="load"
     >
       <template slot="customize">
+        <el-button @click="() => {}" type="warning"> 批量支付 </el-button>
+        <el-button @click="openDialog({}, 4)" type="success">
+          坏账设置
+        </el-button>
         <el-button @click="batchExport" type="primary"> 导出excel </el-button>
       </template>
       <template slot="predictPayTime" slot-scope="props">
@@ -62,24 +64,28 @@
       </template>
       <template slot="divideCheckStatus" slot-scope="props">
         <div>
-          {{ divideCheckStatus(props.scope.row.divideCheckStatus) }}
+          {{ divideCheckStatus(props.scope.row.checkStatus) }}
           <span style="color: #409eff" v-if="props.scope.row.roleName">
             ({{ props.scope.row.roleName }})
           </span>
         </div>
       </template>
       <template slot="status" slot-scope="props">
-        <el-checkbox
-          @change="changeStatus"
-          :checked="!!props.scope.row.status"
-        ></el-checkbox>
+        {{ backStatus(props.scope) }}
       </template>
       <template slot="btn" slot-scope="props">
+        <el-button
+          v-if="props.scope.row.oId"
+          type="text"
+          @click="openDialog(props.scope.row, 3)"
+        >
+          查看详情
+        </el-button>
         <el-button
           v-if="type == 0"
           type="text"
           :disabled="props.scope.row.creditStatus == 1"
-          @click="openDialog(props.scope.row, 1)"
+          @click="openDialog(props.scope.row, 0)"
         >
           催款提醒
         </el-button>
@@ -90,14 +96,14 @@
               props.scope.row.creditStatus == 1 ||
               props.scope.row.divideCheckStatus == 3
             "
-            @click="openDialog(props.scope.row, 2)"
+            @click="openDialog(props.scope.row, 1)"
           >
             点击审核
           </el-button>
           <el-button
             type="text"
             style="color: #e6a23c"
-            @click="openDialog(props.scope.row, 3)"
+            @click="openDialog(props.scope.row, 2)"
           >
             修改备注
           </el-button>
@@ -122,8 +128,7 @@
       :dialogVisible.sync="orderDialogVisible"
     />
     <arap-remarks
-      :orderSn="activeOrderInfo.orderSn"
-      :remark="activeOrderInfo.remark"
+      :info="activeOrderInfo"
       @search="search"
       :dialogVisible.sync="remarkDialogVisible"
     ></arap-remarks>
@@ -135,6 +140,10 @@
       :orderSn="activeOrderInfo.orderSn"
       :checkFrom="type + 1"
     ></dislog-set>
+    <!-- 坏账设置 -->
+    <dislog-bad-bill
+      :dialogVisible.sync="badBillDialogVisible"
+    ></dislog-bad-bill>
   </div>
 </template>
 
@@ -146,15 +155,21 @@ import pagination from "@/components/pagination";
 import dislogTip from "./dislogTip.vue";
 import dislogOrderDetails from "../components/dislogOrderDetails.vue";
 import arapRemarks from "../components/arapRemarks.vue";
+import pictureList from "@/components/Comon/pictureList.vue";
+import dislogBadBill from "../components/dislogBadBill.vue";
 import { exportFn } from "@/utils/index.js";
 import {
   orderList,
   sellerList,
   tenantList,
+  companyList,
   orderExport,
   tenantExport,
   sellerExport,
   countOrderNum,
+  commissionList,
+  sellerPercentageList,
+  monthOrderList,
 } from "@/api/financed/index";
 export default {
   name: "cost",
@@ -166,39 +181,74 @@ export default {
     dislogOrderDetails,
     arapRemarks,
     dislogSet,
+    pictureList,
+    dislogBadBill,
   },
   data() {
     return {
+      value5: [],
       showTabList: [
         [
           {
-            label: "合同金额",
-            prop: "orderPriceTotal",
-            img: require("@/assets/images/合同金额@2x.png"),
+            label: "未收账款",
+            prop: "orderUncollectedTotal",
+            img: "未收款",
           },
+        ],
+        [
           {
-            label: "已收账款",
-            prop: "orderReceivedTotal",
-            img: require("@/assets/images/已收款@2x.png"),
+            label: "代付分成",
+            prop: "payMoneyTotal",
+            img: "未收款",
           },
           {
-            label: "未收账款",
-            prop: "orderUncollectedTotal",
-            img: require("@/assets/images/未收款@2x.png"),
+            label: "待扣分成",
+            prop: "deductMoneyTotal",
+            img: "已退款",
+          },
+          {
+            label: "已扣分成",
+            prop: "unDeductMoneyTotal",
+            img: "成本金额",
+          },
+          {
+            label: "已付分成",
+            prop: "unPayMoneyTotal",
+            img: "已收款",
           },
         ],
         [
           {
-            label: "待付账款",
-            prop: "sellerPay",
-            img: require("@/assets/images/未收款@2x.png"),
+            label: "代付分成",
+            prop: "payMoneyTotal",
+            img: "未收款",
+          },
+          {
+            label: "待扣分成",
+            prop: "deductMoneyTotal",
+            img: "已退款",
+          },
+          {
+            label: "已扣分成",
+            prop: "unDeductMoneyTotal",
+            img: "成本金额",
+          },
+          {
+            label: "已付分成",
+            prop: "unPayMoneyTotal",
+            img: "已收款",
           },
         ],
         [
           {
-            label: "待付账款",
-            prop: "tenantPay",
-            img: require("@/assets/images/未收款@2x.png"),
+            label: "待付佣金",
+            prop: "payMoneyTotal",
+            img: "未收款",
+          },
+          {
+            label: "已付佣金",
+            prop: "unPayMoneyTotal",
+            img: "已收款",
           },
         ],
       ],
@@ -208,10 +258,11 @@ export default {
         index: 0,
         ch: "条",
         num: true,
-        choice: false,
+        choice: true,
         addHide: true,
+        dontNum: false,
         openCheckMore: true,
-        changeWidth: "160px",
+        changeWidth: "240px",
         custom: false,
       },
       formData: {
@@ -230,7 +281,6 @@ export default {
           label: "订单单号",
           prop: "orderSn",
           hidden: true,
-          scope: "openDialog",
         },
         {
           label: "机构名称",
@@ -288,25 +338,61 @@ export default {
       ],
       tableSet1: [
         {
-          label: "下单时间",
-          prop: "startTime",
+          label: "时间",
+          prop: "monthTime",
           hidden: true,
-          scope: "aTimeList",
         },
         {
           label: "订单单号",
           prop: "orderSn",
           hidden: true,
         },
+        {
+          label: "类型",
+          prop: "billType",
+          scope: "type",
+          hidden: true,
+          values: {
+            1: "月份",
+            2: "季度",
+            3: "半年",
+            4: "年度",
+            6: "完单",
+            7: "退款",
+          },
+        },
         {
           label: "机构名称",
           prop: "tenantName",
           hidden: true,
         },
         {
-          label: "待付账款(元)",
-          prop: "divideCompanyMoney",
+          label: "已付分成(元)",
+          prop: "payMoney",
+          hidden: true,
+          scope: "solt",
+          soltName: "status",
+        },
+        {
+          label: "已扣分成(元)",
+          prop: "deductMoney",
+          hidden: true,
+          scope: "solt",
+          soltName: "status",
+        },
+        {
+          label: "待付分成(元)",
+          prop: "payMoney",
+          hidden: true,
+          scope: "solt",
+          soltName: "status",
+        },
+        {
+          label: "待扣分成(元)",
+          prop: "deductMoney",
           hidden: true,
+          scope: "solt",
+          soltName: "status",
         },
         {
           label: "预付时间",
@@ -325,6 +411,12 @@ export default {
           scope: "solt",
           soltName: "divideCheckStatus",
         },
+        {
+          label: "支付时间",
+          prop: "payTime",
+          scope: "aTimeList",
+          hidden: true,
+        },
         {
           label: "备注",
           prop: "remark",
@@ -333,16 +425,29 @@ export default {
       ],
       tableSet2: [
         {
-          label: "下单时间",
-          prop: "buyTime",
+          label: "时间",
+          prop: "monthTime",
           hidden: true,
-          scope: "aTimeList",
         },
         {
           label: "订单单号",
           prop: "orderSn",
           hidden: true,
         },
+        {
+          label: "类型",
+          prop: "billType",
+          scope: "type",
+          hidden: true,
+          values: {
+            1: "月份",
+            2: "季度",
+            3: "半年",
+            4: "年度",
+            6: "完单",
+            7: "退款",
+          },
+        },
         {
           label: "机构名称",
           prop: "tenantName",
@@ -359,19 +464,82 @@ export default {
           hidden: true,
         },
         {
-          label: "待付账款(元)",
-          prop: "divideSellerMoney",
+          label: "已付提成(元)",
+          prop: "payMoney",
           hidden: true,
+          scope: "solt",
+          soltName: "status",
         },
         {
-          label: "预付时间",
-          prop: "predictReceiveTime",
+          label: "已扣提成(元)",
+          prop: "deductMoney",
           hidden: true,
+          scope: "solt",
+          soltName: "status",
         },
         {
-          label: "剩余天数",
-          prop: "predictReceiveDay",
+          label: "待付提成(元)",
+          prop: "payMoney",
+          hidden: true,
+          scope: "solt",
+          soltName: "status",
+        },
+        {
+          label: "待扣提成(元)",
+          prop: "deductMoney",
+          hidden: true,
+          scope: "solt",
+          soltName: "status",
+        },
+        {
+          label: "审核状态",
+          prop: "divideCheckStatus",
+          hidden: true,
+          scope: "solt",
+          soltName: "divideCheckStatus",
+        },
+        {
+          label: "支付时间",
+          prop: "payTime",
+          scope: "aTimeList",
+          scope: "aTimeList",
+          hidden: true,
+        },
+        {
+          label: "备注",
+          prop: "remark",
+          hidden: true,
+        },
+      ],
+      tableSet3: [
+        {
+          label: "时间",
+          prop: "monthTime",
+          hidden: true,
+        },
+        {
+          label: "订单单号",
+          prop: "orderSn",
+          hidden: true,
+        },
+        {
+          label: "机构名称",
+          prop: "tenantName",
+          hidden: true,
+        },
+        {
+          label: "已付佣金(元)",
+          prop: "payMoney",
           hidden: true,
+          scope: "solt",
+          soltName: "status",
+        },
+        {
+          label: "待付佣金(元)",
+          prop: "deductMoney",
+          hidden: true,
+          scope: "solt",
+          soltName: "status",
         },
         {
           label: "审核状态",
@@ -380,6 +548,11 @@ export default {
           scope: "solt",
           soltName: "divideCheckStatus",
         },
+        {
+          label: "支付时间",
+          prop: "payTime",
+          hidden: true,
+        },
         {
           label: "备注",
           prop: "remark",
@@ -392,10 +565,12 @@ export default {
       orderDialogVisible: false,
       remarkDialogVisible: false,
       examineDialogVisible: false,
-      type: 0,
+      badBillDialogVisible: false,
+      type: 1,
       activeOrderInfo: {},
       roleList: [],
       countInfo: {},
+      spanData: {},
     };
   },
   created() {
@@ -429,12 +604,12 @@ export default {
     openDialog(data, type) {
       this.activeOrderInfo = data;
       this[
-        ["order", "tip", "examine", "remark"][type] + "DialogVisible"
+        ["tip", "examine", "remark", "order", "badBill"][type] + "DialogVisible"
       ] = true;
     },
     batchExport() {
       const fn = [orderExport, tenantExport, sellerExport][this.type];
-      fn(this.backData()).then((res) => {
+      fn(this.formData).then((res) => {
         if (res.msg) {
           exportFn(
             res.msg,
@@ -454,13 +629,23 @@ export default {
       let data = row[key].split(",").sort((a, b) => a - b);
       return data;
     },
+    setIndex(index) {
+      return index + 1;
+    },
     changeSearch() {
       this.search(2);
     },
-    getDataList(data) {
-      const fn = [orderList, tenantList, sellerList][this.type];
-      fn(data)
+    getDataList() {
+      const fn = [orderList, companyList, sellerPercentageList, commissionList][
+        this.type
+      ];
+      fn(this.formData)
         .then((res) => {
+          res.rows.forEach((e) => {
+            e.children = [];
+            e.hasChildren = true;
+            e.monthTime = this.parseTime(e.monthTime, "{y}-{m}");
+          });
           this.tableData = res.rows;
           this.total = res.total;
           this.navText.index = res.total;
@@ -469,33 +654,62 @@ export default {
           this.loading = false;
         });
     },
+    load(tree, treeNode, resolve) {
+      monthOrderList({ divideLogId: tree.id })
+        .then((res) => {
+          // id冲突会报错
+          res.data.forEach((e) => {
+            e.oId = e.id;
+            e.id = e.id + 100086;
+            e.billType = e.orderType + 5;
+            e.monthTime = this.parseTime(e.monthTime, "{y}-{m}-{d}");
+          });
+          resolve(res.data);
+        })
+        .catch(() => {
+          resolve([]);
+        });
+    },
+    // 切换已付待付
+    backStatus({ row, column }) {
+      let { label, property } = column;
+      return ["0.00", row[property]][
+        (label.indexOf("已") != -1 ? 0 : 1) ^ row.payStatus
+      ];
+    },
+    changeData(data) {
+      if (this.type == 0) {
+        return data;
+      }
+      let total = 0;
+      let arr = [];
+      data.forEach((ele) => {
+        const monthList = ele.monthList;
+        delete ele.monthList;
+        this.spanData[total] = monthList.length;
+        total += monthList.length;
+        monthList.map((e) => {
+          Object.keys(e).forEach((key) => {
+            e[key] = e[key] || ele[key];
+          });
+        });
+        arr.push(...monthList);
+      });
+      return arr;
+    },
     search(v) {
       this.loading = true;
       if (v === 2) {
         this.formData = {
           pageSize: 10,
           pageNum: 1,
+          month: [],
         };
       }
-      this.getDataList(this.backData());
-    },
-    backData() {
-      let data = this.formData;
-      let { startTime, endTime } = this.formData;
-      if (startTime || endTime) {
-        data = JSON.parse(JSON.stringify(this.formData));
-        if (startTime) {
-          data.startTime = parseInt(startTime / 1000);
-        }
-        if (endTime) {
-          data.endTime = parseInt(endTime / 1000);
-        }
-      }
-      return data;
+      this.getDataList();
     },
     init() {
       this.getRoleList();
-      this.getCountOrderNum();
       this.search(2);
     },
     getRoleList() {
@@ -504,8 +718,8 @@ export default {
       });
     },
     getCountOrderNum() {
-      countOrderNum().then((res) => {
-        this.countInfo = res.data;
+      return countOrderNum({ totalType: this.type + 1 }).then((res) => {
+        return Promise.resolve(res);
       });
     },
   },
@@ -514,55 +728,70 @@ export default {
       return this["tableSet" + this.type];
     },
     formList() {
+      const key = ["订单", "分成", "提成", "分成"][this.type];
       let data = [
         {
-          prop: "creditStatus",
-          placeholder: "账款状态",
-          scope: "select",
-          options: [
-            { label: "已结清", value: 1 },
-            { label: "未结清", value: 0 },
-          ],
-        },
-        {
-          prop1: "startTime",
-          prop2: "endTime",
-          placeholder1: "开始时间",
-          placeholder2: "结束时间",
-          scope: "moreDataPicker",
+          prop: "tenantId",
+          placeholder: "机构选择",
+          scope: "systemtenantlist",
         },
       ];
-      if (this.type != 1) {
-        data.unshift(
+      if (this.type != 0) {
+        data.push(
+          {
+            prop: "monthTime",
+            scope: "moreMonth",
+          },
+          {
+            prop: "checkStatus",
+            placeholder: "审核状态",
+            scope: "select",
+            options: [
+              { label: "待审核", value: 0 },
+              { label: "已通过", value: 1 },
+              { label: "未通过", value: -1 },
+              { label: "待支付", value: 2 },
+              { label: "已支付", value: 3 },
+            ],
+          },
           {
             prop: "roleId",
-            placeholder: "角色选择",
+            placeholder: "审核角色",
             scope: "select",
             options: this.roleList,
             selectValue: "roleId",
             selectLabel: "roleName",
-          },
+          }
+        );
+      }
+      if (this.type == 0) {
+        data.push(
           {
-            prop: "divideStatus",
-            placeholder: "审核状态",
+            prop: "badStatus",
+            placeholder: "坏账选择",
             scope: "select",
             options: [
-              { label: "待审核", value: 0 },
-              { label: "已通过", value: 1 },
-              { label: "未通过", value: 2 },
-              { label: "已撤销", value: 3 },
+              { label: "是", value: 0 },
+              { label: "否", value: 1 },
             ],
           },
           {
-            prop: "tenantId",
-            placeholder: "机构选择",
-            scope: "systemtenantlist",
+            prop1: "startTime",
+            prop2: "endTime",
+            placeholder1: key + "开始时间",
+            placeholder2: key + "结束时间",
+            scope: "moreDataPicker",
+          },
+          {
+            prop: "orderSn",
+            placeholder: "订单单号",
           }
         );
-      } else {
+      }
+      if (this.type == 0 || this.type == 2) {
         data.push({
           prop: "keyNo",
-          placeholder: "机构/业务号",
+          placeholder: "业务号",
         });
       }
       return data;
@@ -579,45 +808,4 @@ export default {
     content: ",";
   }
 }
-.dis_flex_order_li {
-  display: flex;
-  align-items: center;
-  flex-wrap: wrap;
-  & > .list {
-    user-select: none;
-    cursor: pointer;
-    transition: all 0.3s;
-    box-shadow: 0px 0px 4px 1px rgba(0, 0, 0, 0.2);
-    &:hover {
-      transform: scale(1.04);
-    }
-    width: 136px;
-    height: 44px;
-    border-radius: 6px;
-    display: flex;
-    align-items: center;
-    flex-shrink: 0;
-    margin-right: 10px;
-    margin-bottom: 10px;
-    & > img {
-      margin-left: 2px;
-      width: 40px;
-      height: 40px;
-    }
-    & > .right {
-      flex: 1;
-      padding-left: 4px;
-      & > h4 {
-        color: #000;
-        margin: 0;
-        font-size: 12px;
-      }
-      & > p {
-        font-size: 12px;
-        color: red;
-        margin: 0;
-      }
-    }
-  }
-}
 </style>

+ 18 - 15
src/views/financed/components/arapRemarks.vue

@@ -17,7 +17,7 @@
 </template>
 
 <script>
-import { updateRemark } from "@/api/financed/index";
+import { updateRemark, updateMonthRemark } from "@/api/financed/index";
 export default {
   name: "remarks",
   props: {
@@ -25,12 +25,11 @@ export default {
       type: Boolean,
       default: false,
     },
-    orderSn: {
-      type: String,
-    },
-    remark: {
-      type: String,
-      default: "",
+    info: {
+      type: Object,
+      default: () => {
+        return {};
+      },
     },
   },
   data() {
@@ -43,16 +42,20 @@ export default {
 
   methods: {
     init() {
-      this.value = this.remark;
+      this.value = this.info.remark;
     },
     submitForm() {
-      updateRemark({ orderSn: this.orderSn, remark: this.value }).then(
-        (res) => {
-          this.$message.success("修改备注成功");
-          this.isShow = false;
-          this.$emit("search");
-        }
-      );
+      let { orderSn, id } = this.info;
+      let fn = orderSn ? updateRemark : updateMonthRemark;
+      fn({
+        orderSn: orderSn,
+        remark: this.value,
+        id: id,
+      }).then((res) => {
+        this.$message.success("修改备注成功");
+        this.isShow = false;
+        this.$emit("search");
+      });
     },
   },
   computed: {

+ 418 - 0
src/views/financed/components/dislogArapDetails.vue

@@ -0,0 +1,418 @@
+<template>
+  <div class="arapDetail">
+    <BaseDialog
+      width="1200px"
+      :isShow.sync="isShow"
+      title="查看详情"
+      :isShowFooter="false"
+    >
+      <el-radio-group
+        v-model="status"
+        @change="changeGroup"
+        style="margin-bottom: 10px"
+      >
+        <el-radio-button :label="0">完单订单</el-radio-button>
+        <el-radio-button :label="1" v-if="type !== 3">退款订单</el-radio-button>
+        <el-radio-button :label="2">结算记录</el-radio-button>
+      </el-radio-group>
+      <search-box-new
+        ref="searchBox"
+        :formData="formData"
+        :formList="formList"
+        :redIcon="false"
+        @search="search"
+        @init="init"
+      />
+      <pictureList :list="showTabList[status]" />
+      <table-list
+        :key="type + status + ''"
+        :tableSets="tableSet"
+        :tableData="tableData"
+        :navText="dialogNavText"
+      >
+        <template slot="btn" slot-scope="props">
+          <el-button type="text" @click="openDialog(props.scope.row)">
+            查看详情
+          </el-button>
+        </template>
+      </table-list>
+      <pagination
+        :total="total"
+        :pageSize.sync="formData.pageSize"
+        :currentPage.sync="formData.pageNum"
+        @search="search"
+      />
+      <!-- 订单详情 -->
+      <dislog-order-details
+        :orderSn="activeOrderInfo.orderSn"
+        :orderFrom="activeOrderInfo.orderFrom"
+        :dialogVisible.sync="orderDialogVisible"
+      />
+    </BaseDialog>
+  </div>
+</template>
+
+<script>
+import tableList from "@/components/tableList";
+import pagination from "@/components/pagination";
+import searchBoxNew from "@/components/searchBoxNew";
+import pictureList from "@/components/Comon/pictureList.vue";
+import dislogOrderDetails from "../components/dislogOrderDetails.vue";
+import { sellerList, tenantList } from "@/api/financed/index";
+export default {
+  name: "SaasMasterPlatformDislogArapDetails",
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+    type: {
+      type: Number,
+      default: 1,
+    },
+  },
+  data() {
+    return {
+      dialogNavText: {
+        index: 0,
+        num: true,
+        border: true,
+        choice: false,
+        choiceRadio: false,
+        radioKey: "specTemplateId",
+        radioFixed: false,
+        addHide: !false,
+        tableHide: false,
+        dontNum: false,
+        headShow: false,
+        backFatherBtn: {
+          status: false,
+          title: "未定义",
+        },
+      },
+      tableData: [],
+      formData: {
+        pageSize: 10,
+        pageNum: 1,
+      },
+      total: 0,
+      status: 0,
+      showTabList: [
+        [
+          {
+            label: "待付提成",
+            prop: "orderUncollectedTotal",
+            img: "未收款",
+          },
+          {
+            label: "已付提成",
+            prop: "orderUncollectedTotal",
+            img: "已收款",
+          },
+        ],
+        [
+          {
+            label: "待扣提成",
+            prop: "orderReceivedTotal",
+            img: "已退款",
+          },
+          {
+            label: "已扣提成",
+            prop: "orderUncollectedTotal",
+            img: "成本金额",
+          },
+        ],
+        [
+          {
+            label: "结算金额",
+            prop: "orderPriceTotal",
+            img: "已收款",
+          },
+          {
+            label: "完单提成",
+            prop: "orderReceivedTotal",
+            img: "已退款",
+          },
+          {
+            label: "扣除提成",
+            prop: "orderUncollectedTotal",
+            img: "未收款",
+          },
+        ],
+      ],
+      activeOrderInfo: {},
+      orderDialogVisible: false,
+      loading: false,
+    };
+  },
+
+  mounted() {},
+
+  methods: {
+    init() {
+      this.search(2);
+    },
+    search(v) {
+      this.loading = true;
+      if (v === 2) {
+        this.formData = {
+          pageSize: 10,
+          pageNum: 1,
+        };
+      }
+      this.getDataList();
+    },
+    getDataList() {
+      this.fn(this.backData())
+        .then((res) => {
+          this.tableData = res.rows;
+          this.total = res.total;
+          this.navText.index = res.total;
+        })
+        .finally(() => {
+          this.loading = false;
+        });
+    },
+    backData() {
+      let data = this.formData;
+      let { startTime, endTime } = this.formData;
+      if (startTime || endTime) {
+        data = JSON.parse(JSON.stringify(this.formData));
+        if (startTime) {
+          data.startTime = parseInt(startTime / 1000);
+        }
+        if (endTime) {
+          data.endTime = parseInt(endTime / 1000);
+        }
+      }
+      return data;
+    },
+    changeGroup() {},
+    openDialog(data) {
+      this.activeOrderInfo = data;
+      this.orderDialogVisible = true;
+    },
+  },
+  components: {
+    tableList,
+    pagination,
+    searchBoxNew,
+    pictureList,
+    dislogOrderDetails,
+  },
+  computed: {
+    isShow: {
+      get() {
+        if (this.dialogVisible) {
+          this.init();
+        }
+        return this.dialogVisible;
+      },
+      set(val) {
+        this.$emit("update:dialogVisible", false);
+      },
+    },
+    text() {
+      return ["分成", "提成", "佣金"][this.type - 1];
+    },
+    formList() {
+      const key = ["完单", "退款", "结算"][this.status];
+      let data = [
+        {
+          prop1: "startTime",
+          prop2: "endTime",
+          placeholder1: key + "开始时间",
+          placeholder2: key + "结束时间",
+          scope: "moreDataPicker",
+        },
+      ];
+      if (this.status == 0) {
+        data.unshift({
+          prop: "divideStatus",
+          placeholder: "分成状态",
+          scope: "select",
+          options: [
+            { label: "待审核", value: 0 },
+            { label: "已通过", value: 1 },
+            { label: "未通过", value: 2 },
+            { label: "已撤销", value: 3 },
+          ],
+        });
+      }
+      if (this.status != 2) {
+        data.push({
+          prop: "orderSn",
+          placeholder: "订单单号",
+        });
+      }
+      return data;
+    },
+    tableSet() {
+      if (this.status == 0) {
+        let data = [
+          {
+            label: "完单时间",
+            prop: "userName",
+            hidden: true,
+          },
+          {
+            label: "订单单号",
+            prop: "orderSn",
+            hidden: true,
+          },
+          {
+            label: `已付${this.text}(元)`,
+            prop: "goodsName",
+            hidden: true,
+          },
+          {
+            label: `待付${this.text}(元)`,
+            prop: "userPhone",
+            hidden: true,
+          },
+        ];
+        if (this.type != 3) {
+          data.push(
+            {
+              label: "预付时间",
+              prop: "predictPayTime",
+              hidden: true,
+            },
+            {
+              label: "剩余天数",
+              prop: "predictReceiveDay",
+              hidden: true,
+            }
+          );
+        } else {
+          data.push({
+            label: "佣金状态",
+            prop: "majorName",
+            hidden: true,
+          });
+        }
+        return data;
+      } else if (this.status == 1) {
+        return [
+          {
+            label: "退款时间",
+            prop: "userName",
+            hidden: true,
+          },
+          {
+            label: "订单单号",
+            prop: "orderSn",
+            hidden: true,
+          },
+          {
+            label: `扣除${this.text}(元)`,
+            prop: "goodsName",
+            hidden: true,
+          },
+          {
+            label: "扣除状态",
+            prop: "orderSn",
+            hidden: true,
+          },
+        ];
+      } else {
+        let data = [
+          {
+            label: "结算时间",
+            prop: "userName",
+            hidden: true,
+          },
+          {
+            label: "结算金额(元)",
+            prop: "orderSn",
+            hidden: true,
+          },
+          {
+            label: `完成${this.text}(元)`,
+            prop: "goodsName",
+            hidden: true,
+          },
+          {
+            label: `扣除${this.text}(元)`,
+            prop: "userPhone",
+            hidden: true,
+          },
+        ];
+        if (this.type != 3) {
+          data.push();
+        }
+        return data;
+      }
+    },
+    pictureList() {
+      if (this.status == 0) {
+        return [
+          {
+            label: `待付${this.text}`,
+            prop: "orderUncollectedTotal",
+            img: "未收款",
+          },
+          {
+            label: `已付${this.text}`,
+            prop: "orderUncollectedTotal",
+            img: "已收款",
+          },
+        ];
+      } else if (this.status == 1) {
+        return [
+          {
+            label: `待扣${this.text}`,
+            prop: "orderReceivedTotal",
+            img: "已退款",
+          },
+          {
+            label: `已扣${this.text}`,
+            prop: "orderUncollectedTotal",
+            img: "成本金额",
+          },
+        ];
+      } else {
+        let data = [
+          {
+            label: "结算金额",
+            prop: "orderPriceTotal",
+            img: "已收款",
+          },
+        ];
+        if (this.type != 3) {
+          data.push(
+            {
+              label: `完单${this.text}`,
+              prop: "orderReceivedTotal",
+              img: "已退款",
+            },
+            {
+              label: `扣除${this.text}`,
+              prop: "orderUncollectedTotal",
+              img: "未收款",
+            }
+          );
+        }
+        return data;
+      }
+    },
+    fn() {
+      const list = {
+        1: [tenantList],
+        2: [],
+        3: [],
+      };
+      return list[this.type][this.status];
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.arapDetail {
+  margin-top: 10px;
+  #tableList {
+    padding: 0;
+  }
+}
+</style>

+ 194 - 0
src/views/financed/components/dislogBadBill.vue

@@ -0,0 +1,194 @@
+<template>
+  <div>
+    <BaseDialog
+      width="700px"
+      :isShow.sync="isShow"
+      title="坏账设置"
+      @submit="submitForm"
+      @close="close"
+    >
+      <el-form
+        inline
+        hide-required-asterisk
+        :model="form"
+        :rules="rules"
+        ref="form"
+      >
+        <div v-for="(item, index) in form.data" :key="index">
+          <el-form-item
+            label="账龄:"
+            :prop="'data.' + index + '.yearType'"
+            :rules="rules['yearType']"
+          >
+            <el-select v-model="item.yearType" placeholder="请选择账龄">
+              <el-option
+                v-for="(item, idx) in typeList"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+                :disabled="disabled(idx, item.value)"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+          <el-form-item
+            label="扣押比例:"
+            class="range"
+            label-width="90px"
+            :rules="rules['detainRate']"
+            :prop="'data.' + index + '.detainRate'"
+          >
+            <el-input
+              v-model="item.detainRate"
+              v-int="{ max: 100 }"
+              placeholder="请输入扣押比例"
+            >
+              <template slot="append"> % </template>
+            </el-input>
+          </el-form-item>
+          <el-form-item label-width="0" label=" ">
+            <div class="btns">
+              <i
+                @click="add(index)"
+                v-if="!yearType.includes(1) && form.data.length < 4"
+                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 { setBadBill, badBillDetail } from "@/api/financed/index";
+export default {
+  name: "badBill",
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false,
+    },
+  },
+  data() {
+    return {
+      form: { data: [] },
+      rules: {
+        detainRate: [
+          { required: true, message: "请输入扣押比例", trigger: "blur" },
+        ],
+        yearType: [
+          { required: true, message: "请选择账龄", trigger: "change" },
+        ],
+      },
+      typeList: [
+        { label: "1年以上", value: 1 },
+        { label: "1-2年", value: 2 },
+        { label: "2-3年", value: 3 },
+        { label: "3-4年", value: 4 },
+        { label: "5年以上", value: 5 },
+      ],
+    };
+  },
+
+  mounted() {},
+
+  methods: {
+    init() {
+      this.resetForm();
+      this.badBillDetail();
+    },
+    resetForm() {
+      this.form = {
+        data: [
+          {
+            detainRate: undefined,
+            yearType: undefined,
+          },
+        ],
+      };
+    },
+    badBillDetail() {
+      badBillDetail().then((res) => {
+        if (res.data) {
+          this.form.data = JSON.parse(res.data);
+        }
+      });
+    },
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          setBadBill(this.form.data).then((res) => {
+            this.$message.success("坏账设置成功");
+            this.isShow = false;
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    close() {
+      this.$nextTick(() => {
+        this.$refs["form"].resetFields();
+      });
+    },
+    disabled(idx, value) {
+      if (this.form.data.length <= 1) {
+        return false;
+      }
+      return this.yearType.some((e) => (idx == 0 ? e != 1 : e == value));
+    },
+    add(index) {
+      this.form.data.splice(index + 1, 0, {
+        detainRate: undefined,
+        yearType: undefined,
+      });
+    },
+    del(index) {
+      this.form.data.splice(index, 1);
+    },
+  },
+  computed: {
+    isShow: {
+      get() {
+        if (this.dialogVisible) {
+          this.init();
+        }
+        return this.dialogVisible;
+      },
+      set(val) {
+        this.$emit("update:dialogVisible", false);
+      },
+    },
+    yearType() {
+      console.log(this.form.data);
+      return this.form.data.map((e) => e.yearType).filter((e) => e);
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+/deep/ .range {
+  .el-form-item__content {
+    width: 200px;
+  }
+}
+.btns {
+  margin-left: -10px;
+  height: 36px;
+  display: flex;
+  align-items: center;
+  i {
+    font-size: 24px;
+    cursor: pointer;
+    margin-left: 5px;
+  }
+}
+</style>

+ 162 - 86
src/views/financed/cost/dislogSet.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <BaseDialog
-      width="1400px"
+      width="1800px"
       :isShow.sync="isShow"
       :title="title"
       @close="close"
@@ -70,60 +70,55 @@
             :prop="'itemList.' + index + '.itemCategory'"
             :rules="rules['itemCategory']"
           >
-            <el-select
-              @change="changeCategory(item)"
-              v-model="item.itemCategory"
-              placeholder="请选择成本类型"
-            >
+            <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-form-item
+            label=""
+            :prop="'itemList.' + index + '.educationTypeId'"
+            :rules="rules['educationTypeId']"
+          >
+            <el-select
+              @change="changeEdu(item)"
+              v-model="item.educationTypeId"
+              placeholder="请选择教育类型"
             >
-              <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
-                  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-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-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
-                  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-option>
+            </el-select>
+          </el-form-item>
           <el-form-item
             label=""
             :prop="'itemList.' + index + '.itemType'"
@@ -167,7 +162,7 @@
           >
             <el-input
               v-if="item.itemType == 1"
-              placeholder="百分比成本"
+              placeholder="输入百分比"
               v-model="item.typeValue"
               key="2"
               v-int="{ max: 100 }"
@@ -177,13 +172,60 @@
             <el-input
               key="1"
               v-else
-              placeholder="固定成本"
+              placeholder="固定金额"
               v-model="item.typeValue"
               v-int
             >
               <template slot="append"> 元 </template>
             </el-input>
           </el-form-item>
+          <el-form-item label="" v-if="item.itemCategory == 1">
+            <el-checkbox
+              :true-label="1"
+              :false-label="0"
+              v-model="item.dockStatus"
+              >成本扣除</el-checkbox
+            >
+          </el-form-item>
+          <template v-if="item.dockStatus == 1">
+            <el-form-item
+              label=""
+              :prop="'itemList.' + index + '.dockType'"
+              :rules="rules['dockType']"
+            >
+              <el-select v-model="item.dockType" 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.dockType"
+              class="ddd"
+              label-width="0"
+              :prop="'itemList.' + index + '.dockValue'"
+              label=" "
+              :rules="rules['dockValue']"
+            >
+              <el-input
+                v-if="item.dockType == 1"
+                placeholder="输入百分比"
+                v-model="item.dockValue"
+                key="2"
+                v-int="{ max: 100 }"
+              >
+                <template slot="append"> % </template>
+              </el-input>
+              <el-input
+                key="1"
+                v-else
+                placeholder="固定金额"
+                v-model="item.dockValue"
+                v-int
+              >
+                <template slot="append"> 元 </template>
+              </el-input>
+            </el-form-item>
+          </template>
           <el-form-item label-width="0" label=" ">
             <div class="btns">
               <i @click="add(index, item)" class="el-icon-connection"></i>
@@ -245,6 +287,33 @@ export default {
       }
       callback();
     };
+    var checkEduId = (rule, value, callback) => {
+      const len = this.itemList.length;
+      if (len > 1) {
+        const len1 = this.itemList.filter(
+          (e) => e.educationTypeId == -1
+        ).length;
+        if (len1 > 0 && len1 != len) {
+          callback(new Error("需统一不限!"));
+        }
+      }
+      callback();
+    };
+    var checkBusId = (rule, value, callback) => {
+      const { educationTypeId } = this.itemList[rule.field.split(".")[1]];
+      if (this.itemList.length > 1) {
+        const flag = this.itemList.some(
+          (e) => e.educationTypeId == educationTypeId && e.businessId == -1
+        );
+        if (flag) {
+          const flag1 = this.itemList.some(
+            (e) => e.educationTypeId == educationTypeId && e.businessId != -1
+          );
+          flag1 && callback(new Error("需统一不限!"));
+        }
+      }
+      callback();
+    };
     return {
       form: {},
       rules: {
@@ -259,9 +328,11 @@ export default {
         ],
         businessId: [
           { required: true, message: "请选择业务层次", trigger: "blur" },
+          { validator: checkBusId, trigger: "change" },
         ],
         educationTypeId: [
           { required: true, message: "请选择教育类型", trigger: "change" },
+          { validator: checkEduId, trigger: "change" },
         ],
         itemCategory: [
           { required: true, message: "请选择业务类型", trigger: "change" },
@@ -270,7 +341,13 @@ export default {
           { required: true, message: "请选择成本类型", trigger: "change" },
         ],
         typeValue: [
-          { required: true, message: "请输入百分比成本", trigger: "blur" },
+          { required: true, message: "请输入成本值", trigger: "blur" },
+        ],
+        dockType: [
+          { required: true, message: "请选择扣除类型", trigger: "change" },
+        ],
+        dockValue: [
+          { required: true, message: "请输入扣除值", trigger: "blur" },
         ],
         minValue: [{ validator: checkMinValue, trigger: "blur" }],
       },
@@ -279,7 +356,7 @@ export default {
     };
   },
   methods: {
-    init() { 
+    init() {
       this.resetForm();
       if (this.type === 3) {
         this.getOrderCostDetail();
@@ -318,13 +395,21 @@ export default {
     getEduList() {
       if (this.eduList.length) return;
       eduList({}).then((res) => {
-        this.eduList = res.rows;
+        this.eduList = [
+          { schemeName: "", educationName: "不限", id: -1 },
+          ...res.rows,
+        ];
       });
     },
     backbusinessList(eduId) {
       if (!eduId || !this.eduList.length) return [];
       let data = this.eduList.find((e) => e.id == eduId);
-      return data.businessList || [];
+      return data.businessList
+        ? [
+            { aliasName: "不限", businessId: -1, projectId: -1 },
+            ...data.businessList,
+          ]
+        : [];
     },
     getTenantList() {
       if (this.tenantList.length) return;
@@ -333,53 +418,44 @@ export default {
       });
     },
     changeEdu(data) {
-      data.businessId = undefined;
-      data.projectId = undefined;
+      let value = data.educationTypeId == -1 ? -1 : undefined;
+      data.businessId = value;
+      data.projectId = value;
     },
     changeBus(data, projectId) {
       data.projectId = projectId;
     },
-    changeCategory(data) {
-      data.educationTypeId = undefined;
-      this.changeEdu(data);
-    },
     add(index, data) {
-      data = data
-        ? JSON.parse(JSON.stringify(data))
-        : {
-            projectId: undefined,
-            itemName: undefined,
-            itemCategory: undefined,
-            businessId: undefined,
-            educationTypeId: undefined,
-            itemType: undefined,
-            typeValue: undefined,
-            minValue: undefined,
-            maxValue: undefined,
-          };
+      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.$refs["form"].resetFields();
+      this.$nextTick(() => {
+        this.$refs["form"].resetFields();
+      });
+    },
+    backItem() {
+      return {
+        projectId: undefined,
+        itemName: undefined,
+        itemCategory: undefined,
+        businessId: undefined,
+        educationTypeId: undefined,
+        itemType: undefined,
+        typeValue: undefined,
+        minValue: undefined,
+        maxValue: undefined,
+        dockStatus: undefined,
+        dockType: undefined,
+        dockValue: undefined,
+      };
     },
     resetForm() {
       this.form = {
-        itemList: [
-          {
-            projectId: undefined,
-            itemName: undefined,
-            itemCategory: undefined,
-            businessId: undefined,
-            educationTypeId: undefined,
-            itemType: undefined,
-            typeValue: undefined,
-            minValue: undefined,
-            maxValue: undefined,
-          },
-        ],
+        itemList: [this.backItem()],
         tpId: undefined,
         tpName: undefined,
         defaultStatus: 0,