Browse Source

坏账设置

谢杰标 2 years ago
parent
commit
5df5f88133

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

@@ -109,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",
@@ -125,6 +134,15 @@ export function companyList(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({
@@ -141,6 +159,14 @@ export function updateRemark(data) {
     data,
   });
 }
+// 修改月份备注
+export function updateMonthRemark(data) {
+  return request({
+    url: "/divide/log/updateRemark",
+    method: "post",
+    data,
+  });
+}
 // 订单应收应付统计
 export function countOrderNum(query) {
   return request({
@@ -149,3 +175,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,
+  });
+}

+ 2 - 3
src/utils/common.js

@@ -1,6 +1,5 @@
 export function paramMate(data) {
-  console.log(1234);
-  if (typeof data != "object") {
+  if (typeof data != "object" && data == null) {
     return data;
   }
   data = JSON.parse(JSON.stringify(data));
@@ -13,7 +12,7 @@ export function paramMate(data) {
     });
   } else {
     for (const key in data) {
-      if (Array.isArray(data[key])) {
+      if (typeof data[key] == "object") {
         data[key] = paramMate(data[key]);
       } else {
         if (isTimeStamp(data[key])) {

+ 3 - 6
src/utils/request.js

@@ -25,13 +25,10 @@ service.interceptors.request.use(
     if (getToken() && !isToken) {
       config.headers["AuthorizationToken"] = "Bearer " + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
     }
+    // 转换时间戳
     if (config.isProce) {
-      if (config.params) {
-        config.params = paramMate(config.params);
-      }
-      if (config.data) {
-        config.data = paramMate(config.data);
-      }
+      config.params = paramMate(config.params);
+      config.data = paramMate(config.data);
     }
 
     // config.headers.TenantId = sessionStorage.TenantId || methods.getQueryVariable('TenantId')

+ 67 - 34
src/views/financed/arap/index.vue

@@ -18,6 +18,7 @@
       @init="init"
     />
     <picture-list
+      :key="type + 'a'"
       :fn="getCountOrderNum"
       :list="showTabList[type]"
     ></picture-list>
@@ -33,6 +34,9 @@
       :objectSpanMethod="spanMethod"
     >
       <template slot="customize">
+        <el-button @click="openDialog({}, 5)" type="success">
+          坏账设置
+        </el-button>
         <el-button @click="batchExport" type="primary"> 导出excel </el-button>
       </template>
       <template slot="predictPayTime" slot-scope="props">
@@ -66,13 +70,17 @@
         </div>
       </template>
       <template slot="status" slot-scope="props">
-        <el-checkbox
-          @change="changeStatus"
-          :checked="!!props.scope.row.status"
-        ></el-checkbox>
+        {{
+          props.scope.row.payStatus == 1
+            ? "0"
+            : props.scope.row[props.scope.column.property]
+        }}
       </template>
       <template slot="btn" slot-scope="props">
-        <el-button type="text" @click="openDialog(props.scope.row, type + 3)">
+        <el-button
+          type="text"
+          @click="openDialog(props.scope.row, type == 0 ? 3 : 4)"
+        >
           查看详情
         </el-button>
         <el-button
@@ -122,8 +130,9 @@
       :dialogVisible.sync="orderDialogVisible"
     />
     <arap-remarks
-      :orderSn="activeOrderInfo.orderSn"
+      :orderSn="activeOrderInfo.id"
       :remark="activeOrderInfo.remark"
+      :id="activeOrderInfo.id"
       @search="search"
       :dialogVisible.sync="remarkDialogVisible"
     ></arap-remarks>
@@ -137,6 +146,10 @@
     ></dislog-set>
     <!-- 查看详情 -->
     <dislog-arap-details :type="type" :dialogVisible.sync="arapDialogVisible" />
+    <!-- 坏账设置 -->
+    <dislog-bad-bill
+      :dialogVisible.sync="badBillDialogVisible"
+    ></dislog-bad-bill>
   </div>
 </template>
 
@@ -150,6 +163,7 @@ import dislogOrderDetails from "../components/dislogOrderDetails.vue";
 import arapRemarks from "../components/arapRemarks.vue";
 import pictureList from "@/components/Comon/pictureList.vue";
 import dislogArapDetails from "../components/dislogArapDetails.vue";
+import dislogBadBill from "../components/dislogBadBill.vue";
 import { exportFn } from "@/utils/index.js";
 import {
   orderList,
@@ -160,6 +174,8 @@ import {
   tenantExport,
   sellerExport,
   countOrderNum,
+  commissionList,
+  sellerPercentageList,
 } from "@/api/financed/index";
 export default {
   name: "cost",
@@ -173,6 +189,7 @@ export default {
     arapRemarks,
     dislogSet,
     pictureList,
+    dislogBadBill,
   },
   data() {
     return {
@@ -188,57 +205,57 @@ export default {
         [
           {
             label: "代付分成",
-            prop: "orderPriceTotal",
+            prop: "payMoneyTotal",
             img: "未收款",
           },
           {
             label: "待扣分成",
-            prop: "orderReceivedTotal",
+            prop: "deductMoneyTotal",
             img: "已退款",
           },
           {
             label: "已扣分成",
-            prop: "orderUncollectedTotal",
+            prop: "unDeductMoneyTotal",
             img: "成本金额",
           },
           {
             label: "已付分成",
-            prop: "orderUncollectedTotal",
+            prop: "unPayMoneyTotal",
             img: "已收款",
           },
         ],
         [
           {
             label: "代付分成",
-            prop: "orderPriceTotal",
+            prop: "payMoneyTotal",
             img: "未收款",
           },
           {
             label: "待扣分成",
-            prop: "orderReceivedTotal",
+            prop: "deductMoneyTotal",
             img: "已退款",
           },
           {
             label: "已扣分成",
-            prop: "orderUncollectedTotal",
+            prop: "unDeductMoneyTotal",
             img: "成本金额",
           },
           {
             label: "已付分成",
-            prop: "orderUncollectedTotal",
+            prop: "unPayMoneyTotal",
             img: "已收款",
           },
         ],
         [
           {
             label: "待付佣金",
-            prop: "sellerPay",
+            prop: "payMoneyTotal",
             img: "未收款",
           },
           {
             label: "已付佣金",
-            prop: "tenantPay",
-            mg: "已收款",
+            prop: "unPayMoneyTotal",
+            img: "已收款",
           },
         ],
       ],
@@ -350,6 +367,8 @@ export default {
           label: "待付分成(元)",
           prop: "payMoney",
           hidden: true,
+          scope: "solt",
+          soltName: "status",
         },
         {
           label: "待扣分成(元)",
@@ -397,27 +416,29 @@ export default {
         },
         {
           label: "已付提成(元)",
-          prop: "divideSellerMoney",
+          prop: "payMoneyTotal",
           hidden: true,
         },
         {
           label: "已扣提成(元)",
-          prop: "divideSellerMoney",
+          prop: "deductMoneyTotal",
           hidden: true,
         },
         {
           label: "待审月份",
-          prop: "divideSellerMoney",
+          prop: "month",
           hidden: true,
         },
         {
           label: "待审提成(元)",
-          prop: "divideSellerMoney",
+          prop: "payMoney",
           hidden: true,
+          scope: "solt",
+          soltName: "status",
         },
         {
           label: "待扣提成(元)",
-          prop: "divideSellerMoney",
+          prop: "deductMoney",
           hidden: true,
         },
         {
@@ -441,18 +462,20 @@ export default {
         },
         {
           label: "已付佣金(元)",
-          prop: "divideSellerMoney",
+          prop: "payMoney",
           hidden: true,
         },
         {
           label: "待付月份",
-          prop: "divideSellerMoney",
+          prop: "month",
           hidden: true,
         },
         {
           label: "待付佣金(元)",
-          prop: "divideSellerMoney",
+          prop: "deductMoney",
           hidden: true,
+          scope: "solt",
+          soltName: "status",
         },
         {
           label: "审核状态",
@@ -468,12 +491,13 @@ export default {
         },
       ],
       tableData: [], //表单数据
-      total: 4, //一共多少条
+      total: 0, //一共多少条
       tipDialogVisible: false,
       orderDialogVisible: false,
       arapDialogVisible: false,
       remarkDialogVisible: false,
       examineDialogVisible: false,
+      badBillDialogVisible: false,
       type: 1,
       activeOrderInfo: {},
       roleList: [],
@@ -532,9 +556,8 @@ export default {
     },
     openDialog(data, type) {
       this.activeOrderInfo = data;
-      this.activeOrderInfo.orderSn = 123;
       this[
-        ["tip", "examine", "remark", "order", "arap", "arap", "arap"][type] +
+        ["tip", "examine", "remark", "order", "arap", "badBill"][type] +
           "DialogVisible"
       ] = true;
     },
@@ -564,7 +587,9 @@ export default {
       this.search(2);
     },
     getDataList() {
-      const fn = [orderList, companyList, sellerList][this.type];
+      const fn = [orderList, companyList, sellerPercentageList, commissionList][
+        this.type
+      ];
       fn(this.formData)
         .then((res) => {
           this.tableData = this.changeData(res.rows);
@@ -616,10 +641,9 @@ export default {
       });
     },
     getCountOrderNum() {
-      // return countOrderNum().then((res) => {
-      //   return Promise.resolve(res);
-      // });
-      return Promise.resolve({ data: {} });
+      return countOrderNum({ totalType: this.type + 1 }).then((res) => {
+        return Promise.resolve(res);
+      });
     },
   },
   computed: {
@@ -638,7 +662,7 @@ export default {
       if (this.type != 0) {
         data.push(
           {
-            prop: "month",
+            prop: "monthTime",
             scope: "moreMonth",
           },
           {
@@ -665,6 +689,15 @@ export default {
       }
       if (this.type == 0) {
         data.push(
+          {
+            prop: "badStatus",
+            placeholder: "坏账选择",
+            scope: "select",
+            options: [
+              { label: "是", value: 0 },
+              { label: "否", value: 1 },
+            ],
+          },
           {
             prop1: "startTime",
             prop2: "endTime",

+ 13 - 8
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: {
@@ -28,6 +28,9 @@ export default {
     orderSn: {
       type: String,
     },
+    id: {
+      type: [Number, String],
+    },
     remark: {
       type: String,
       default: "",
@@ -46,13 +49,15 @@ export default {
       this.value = this.remark;
     },
     submitForm() {
-      updateRemark({ orderSn: this.orderSn, remark: this.value }).then(
-        (res) => {
-          this.$message.success("修改备注成功");
-          this.isShow = false;
-          this.$emit("search");
-        }
-      );
+      updateMonthRemark({
+        orderSn: this.orderSn,
+        remark: this.value,
+        id: this.id,
+      }).then((res) => {
+        this.$message.success("修改备注成功");
+        this.isShow = false;
+        this.$emit("search");
+      });
     },
   },
   computed: {

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

@@ -0,0 +1,141 @@
+<template>
+  <div>
+    <BaseDialog
+      width="640px"
+      :isShow.sync="isShow"
+      title="坏账设置"
+      @submit="submitForm"
+      @close="close"
+    >
+      <el-form
+        inline
+        hide-required-asterisk
+        :model="form"
+        :rules="rules"
+        ref="form"
+      >
+        <el-form-item label="账龄:" prop="yearType">
+          <el-select v-model="form.yearType" multiple placeholder="请选择账龄">
+            <el-option
+              v-for="(item, idx) in typeList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+              :disabled="disabled(idx)"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item
+          label="扣押比例:"
+          class="range"
+          label-width="90px"
+          prop="detainRate"
+        >
+          <el-input
+            v-model="form.detainRate"
+            v-int="{ max: 100 }"
+            placeholder="请输入扣押比例"
+          >
+            <template slot="append"> % </template>
+          </el-input>
+        </el-form-item>
+      </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: {},
+      rules: {
+        detainRate: [
+          { required: true, message: "请输入扣押比例", trigger: "change" },
+        ],
+        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 = {
+        detainRate: undefined,
+        yearType: [],
+      };
+    },
+    badBillDetail() {
+      badBillDetail().then((res) => {
+        if (res.data) {
+        }
+      });
+    },
+    submitForm() {
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          setBadBill(this.form).then((res) => {
+            this.$message.success("坏账设置成功");
+            this.isShow = false;
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    close() {
+      this.$nextTick(() => {
+        this.$refs["form"].resetFields();
+      });
+    },
+    disabled(idx) {
+      return this.form.yearType.some((e) => (idx == 0 ? e != 1 : e == 1));
+    },
+  },
+  computed: {
+    isShow: {
+      get() {
+        if (this.dialogVisible) {
+          this.init();
+        }
+        return this.dialogVisible;
+      },
+      set(val) {
+        this.$emit("update:dialogVisible", false);
+      },
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+/deep/ .range {
+  .el-form-item__content {
+    width: 200px;
+  }
+}
+</style>