Browse Source

借款管理

cz 1 year ago
parent
commit
89f16ec833

+ 272 - 2
src/views/finance/fundManage/accountStatement/index.vue

@@ -10,6 +10,10 @@
         highlight-current-row
         :action-list="[
           {
+            text: '添加借款',
+            action: () => addloan(),
+          },
+          {
             text: '导出Excel',
             action: () => deriveExcel(),
           },
@@ -283,6 +287,48 @@
         >
       </template>
     </el-dialog>
+
+    <el-dialog
+      :title="submitType == 'add' ? '添加借款' : '还款'"
+      v-if="openLoanDialog"
+      v-model="openLoanDialog"
+      width="500"
+      destroy-on-close
+    >
+      <byForm
+        :formConfig="loanFormConfig"
+        :formOption="formOption"
+        :rules="loanRules"
+        v-model="formData.loanData"
+        ref="byform"
+      >
+        <template #loanUserName>
+          <div style="width: 100%">
+            <el-autocomplete
+              v-model="formData.loanData.loanUserName"
+              value-key="loanUserName"
+              :fetch-suggestions="querySearch"
+              :disabled="submitType == 'edit'"
+              clearable
+              class="inline-input w-50"
+              placeholder="请输入"
+            />
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="openLoanDialog = false" size="large"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          @click="handleSubmitLoan()"
+          size="large"
+          :loading="submitLoading"
+          >确 定</el-button
+        >
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -299,6 +345,7 @@ const { proxy } = getCurrentInstance();
 const accountCurrency = ref([]);
 const accountList = ref([]);
 const contractList = ref([]);
+const corporationList = ref([]);
 const status = ref([
   {
     label: "收入",
@@ -666,13 +713,23 @@ const getDict = () => {
       contractList.value = res.rows;
     });
 
+  proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      corporationList.value = res.rows.map((item) => {
+        return {
+          ...item,
+          label: item.name,
+          value: item.id,
+        };
+      });
+    }
+  });
+
   Promise.all([getCurrency(), getAccountList()]).then(() => {
     getList();
   });
 };
 
-
-
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
@@ -1158,6 +1215,219 @@ const printObj = ref({
 const clickDownload = () => {
   proxy.getPdf("外销合同PDF文件");
 };
+
+const loanRules = ref({
+  corporationId: [
+    { required: true, message: "请选择归属公司", trigger: "change" },
+  ],
+  loanUserName: [{ required: true, message: "请输入借款人", trigger: "blur" }],
+  loanTime: [{ required: true, message: "请选择借款时间", trigger: "change" }],
+  currency: [{ required: true, message: "请选择币种", trigger: "change" }],
+  amount: [{ required: true, message: "请输入借款金额", trigger: "blur" }],
+  loanAccountId: [
+    { required: true, message: "请选择付款账户", trigger: "change" },
+  ],
+  repaymentAccountId: [
+    { required: true, message: "请选择收款账户", trigger: "change" },
+  ],
+  amountOne: [{ required: true, message: "请输入还款金额", trigger: "blur" }],
+  repaymentTime: [
+    { required: true, message: "请选择还款时间", trigger: "change" },
+  ],
+});
+const loanFormConfig = computed(() => {
+  return [
+    {
+      type: "select",
+      prop: "corporationId",
+      label: "归属公司",
+      data: corporationList.value,
+      clearable: true,
+      disabled: submitType.value != "add",
+      itemWidth: 100,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "slot",
+      prop: "loanUserName",
+      label: "借款人",
+      slotName: "loanUserName",
+      disabled: submitType.value != "add",
+      itemWidth: 100,
+      style: {
+        width: "50%",
+      },
+    },
+    {
+      type: "date",
+      itemType: "datetime",
+      prop: "loanTime",
+      label: "借款时间",
+      disabled: submitType.value != "add",
+      itemWidth: 100,
+      style: {
+        width: "50%",
+      },
+    },
+    {
+      type: "select",
+      prop: "currency",
+      label: "借款金额",
+      data: accountCurrency.value,
+      clearable: true,
+      disabled: submitType.value != "add",
+      itemWidth: 25,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "number",
+      prop: "amount",
+      label: " ",
+      precision: 2,
+      min: 0,
+      controls: false,
+      disabled: submitType.value != "add",
+      itemWidth: 30,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "select",
+      prop: "loanAccountId",
+      label: "付款账户",
+      data: accountList.value,
+      disabled: submitType.value != "add",
+      itemWidth: 100,
+      clearable: true,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "input",
+      itemType: "textarea",
+      prop: "remarks",
+      label: "备注",
+      disabled: submitType.value != "add",
+    },
+    submitType.value != "add"
+      ? {
+          type: "title",
+          title: "还款信息",
+        }
+      : {},
+    {
+      type: "select",
+      prop: "repaymentAccountId",
+      label: "收款账户",
+      data: accountList.value,
+      itemWidth: 100,
+      clearable: true,
+      isShow: submitType.value != "add",
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "select",
+      prop: "currency",
+      label: "还款金额",
+      data: accountCurrency.value,
+      clearable: true,
+      itemWidth: 25,
+      isShow: submitType.value != "add",
+      disabled: true,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "number",
+      prop: "amountOne",
+      label: " ",
+      precision: 2,
+      min: 0,
+      controls: false,
+      itemWidth: 30,
+      isShow: submitType.value != "add",
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "date",
+      itemType: "datetime",
+      prop: "repaymentTime",
+      label: "还款时间",
+      itemWidth: 100,
+      isShow: submitType.value != "add",
+      style: {
+        width: "50%",
+      },
+    },
+    {
+      type: "input",
+      itemType: "textarea",
+      prop: "remarksOne",
+      label: "备注",
+      isShow: submitType.value != "add",
+    },
+  ];
+});
+
+const openLoanDialog = ref(false);
+const byform = ref(null);
+const submitLoading = ref(false);
+const submitType = ref("add");
+const historyData = ref([]);
+const addloan = () => {
+  proxy.get("/loanInfo/getLoanUserList").then((res) => {
+    historyData.value = res.data;
+  });
+  formData.loanData = {};
+  openLoanDialog.value = true;
+};
+
+const querySearch = (queryString, cb) => {
+  const results = queryString
+    ? historyData.value.filter(createFilter(queryString))
+    : historyData.value;
+  cb(results);
+};
+
+const createFilter = (queryString) => {
+  return (restaurant) => {
+    return (
+      restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+    );
+  };
+};
+
+const handleSubmitLoan = () => {
+  byform.value.handleSubmit(() => {
+    submitLoading.value = true;
+    let requestUrl = "/loanInfo/add";
+    proxy.post(requestUrl, formData.loanData).then(
+      () => {
+        ElMessage({
+          message: "操作成功",
+          type: "success",
+        });
+        getList();
+        openLoanDialog.value = false;
+        submitLoading.value = false;
+      },
+      () => {
+        submitLoading.value = false;
+      }
+    );
+  });
+};
 </script>
 
 <style lang="scss" scoped>

+ 274 - 0
src/views/finance/fundManage/flow/index.vue

@@ -10,6 +10,10 @@
         highlight-current-row
         :action-list="[
           {
+            text: '添加借款',
+            action: () => addloan(),
+          },
+          {
             text: '导出Excel',
             action: () => deriveExcel(),
           },
@@ -266,6 +270,48 @@
         >
       </template>
     </el-dialog>
+
+    <el-dialog
+      :title="submitType == 'add' ? '添加借款' : '还款'"
+      v-if="openLoanDialog"
+      v-model="openLoanDialog"
+      width="500"
+      destroy-on-close
+    >
+      <byForm
+        :formConfig="loanFormConfig"
+        :formOption="formOption"
+        :rules="loanRules"
+        v-model="formData.loanData"
+        ref="byform"
+      >
+        <template #loanUserName>
+          <div style="width: 100%">
+            <el-autocomplete
+              v-model="formData.loanData.loanUserName"
+              value-key="loanUserName"
+              :fetch-suggestions="querySearch"
+              :disabled="submitType == 'edit'"
+              clearable
+              class="inline-input w-50"
+              placeholder="请输入"
+            />
+          </div>
+        </template>
+      </byForm>
+      <template #footer>
+        <el-button @click="openLoanDialog = false" size="large"
+          >取 消</el-button
+        >
+        <el-button
+          type="primary"
+          @click="handleSubmitLoan()"
+          size="large"
+          :loading="submitLoading"
+          >确 定</el-button
+        >
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -281,6 +327,7 @@ import ContractPDF from "@/components/PDF/contractPDF.vue";
 const { proxy } = getCurrentInstance();
 const accountCurrency = ref([]);
 const accountList = ref([]);
+const corporationList = ref([]);
 const status = ref([
   {
     label: "收入",
@@ -476,6 +523,19 @@ const getDict = () => {
         });
       }
     });
+
+  proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      corporationList.value = res.rows.map((item) => {
+        return {
+          ...item,
+          label: item.name,
+          value: item.id,
+        };
+      });
+    }
+  });
+
   proxy
     .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
     .then((res) => {
@@ -526,6 +586,7 @@ const formData = reactive({
   data: {
     isTransaction: "1",
   },
+  loanData: {},
 });
 const formData2 = reactive({
   data: {},
@@ -1065,6 +1126,219 @@ const printObj = ref({
 const clickDownload = () => {
   proxy.getPdf("外销合同PDF文件");
 };
+
+const loanRules = ref({
+  corporationId: [
+    { required: true, message: "请选择归属公司", trigger: "change" },
+  ],
+  loanUserName: [{ required: true, message: "请输入借款人", trigger: "blur" }],
+  loanTime: [{ required: true, message: "请选择借款时间", trigger: "change" }],
+  currency: [{ required: true, message: "请选择币种", trigger: "change" }],
+  amount: [{ required: true, message: "请输入借款金额", trigger: "blur" }],
+  loanAccountId: [
+    { required: true, message: "请选择付款账户", trigger: "change" },
+  ],
+  repaymentAccountId: [
+    { required: true, message: "请选择收款账户", trigger: "change" },
+  ],
+  amountOne: [{ required: true, message: "请输入还款金额", trigger: "blur" }],
+  repaymentTime: [
+    { required: true, message: "请选择还款时间", trigger: "change" },
+  ],
+});
+const loanFormConfig = computed(() => {
+  return [
+    {
+      type: "select",
+      prop: "corporationId",
+      label: "归属公司",
+      data: corporationList.value,
+      clearable: true,
+      disabled: submitType.value != "add",
+      itemWidth: 100,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "slot",
+      prop: "loanUserName",
+      label: "借款人",
+      slotName: "loanUserName",
+      disabled: submitType.value != "add",
+      itemWidth: 100,
+      style: {
+        width: "50%",
+      },
+    },
+    {
+      type: "date",
+      itemType: "datetime",
+      prop: "loanTime",
+      label: "借款时间",
+      disabled: submitType.value != "add",
+      itemWidth: 100,
+      style: {
+        width: "50%",
+      },
+    },
+    {
+      type: "select",
+      prop: "currency",
+      label: "借款金额",
+      data: accountCurrency.value,
+      clearable: true,
+      disabled: submitType.value != "add",
+      itemWidth: 25,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "number",
+      prop: "amount",
+      label: " ",
+      precision: 2,
+      min: 0,
+      controls: false,
+      disabled: submitType.value != "add",
+      itemWidth: 30,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "select",
+      prop: "loanAccountId",
+      label: "付款账户",
+      data: accountList.value,
+      disabled: submitType.value != "add",
+      itemWidth: 100,
+      clearable: true,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "input",
+      itemType: "textarea",
+      prop: "remarks",
+      label: "备注",
+      disabled: submitType.value != "add",
+    },
+    submitType.value != "add"
+      ? {
+          type: "title",
+          title: "还款信息",
+        }
+      : {},
+    {
+      type: "select",
+      prop: "repaymentAccountId",
+      label: "收款账户",
+      data: accountList.value,
+      itemWidth: 100,
+      clearable: true,
+      isShow: submitType.value != "add",
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "select",
+      prop: "currency",
+      label: "还款金额",
+      data: accountCurrency.value,
+      clearable: true,
+      itemWidth: 25,
+      isShow: submitType.value != "add",
+      disabled: true,
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "number",
+      prop: "amountOne",
+      label: " ",
+      precision: 2,
+      min: 0,
+      controls: false,
+      itemWidth: 30,
+      isShow: submitType.value != "add",
+      style: {
+        width: "100%",
+      },
+    },
+    {
+      type: "date",
+      itemType: "datetime",
+      prop: "repaymentTime",
+      label: "还款时间",
+      itemWidth: 100,
+      isShow: submitType.value != "add",
+      style: {
+        width: "50%",
+      },
+    },
+    {
+      type: "input",
+      itemType: "textarea",
+      prop: "remarksOne",
+      label: "备注",
+      isShow: submitType.value != "add",
+    },
+  ];
+});
+
+const openLoanDialog = ref(false);
+const byform = ref(null);
+const submitLoading = ref(false);
+const submitType = ref("add");
+const historyData = ref([]);
+const addloan = () => {
+  proxy.get("/loanInfo/getLoanUserList").then((res) => {
+    historyData.value = res.data;
+  });
+  formData.loanData = {};
+  openLoanDialog.value = true;
+};
+
+const querySearch = (queryString, cb) => {
+  const results = queryString
+    ? historyData.value.filter(createFilter(queryString))
+    : historyData.value;
+  cb(results);
+};
+
+const createFilter = (queryString) => {
+  return (restaurant) => {
+    return (
+      restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+    );
+  };
+};
+
+const handleSubmitLoan = () => {
+  byform.value.handleSubmit(() => {
+    submitLoading.value = true;
+    let requestUrl = "/loanInfo/add";
+    proxy.post(requestUrl, formData.loanData).then(
+      () => {
+        ElMessage({
+          message: "操作成功",
+          type: "success",
+        });
+        getList();
+        openLoanDialog.value = false;
+        submitLoading.value = false;
+      },
+      () => {
+        submitLoading.value = false;
+      }
+    );
+  });
+};
 </script>
 
 <style lang="scss" scoped>

+ 147 - 58
src/views/finance/fundManage/loan/index.vue

@@ -18,15 +18,15 @@
     >
       <template #money="{ item }">
         <div style="width: 100%">
-          <span>{{ item.currency }}{{ item.money }}</span>
+          <span>{{ item.currency }} {{ moneyFormat(item.amount, 2) }}</span>
         </div>
       </template>
-      <template #type="{ item }">
+      <template #repaymentStatus="{ item }">
         <div style="width: 100%">
           <span
             style="color: #409eff; cursor: pointer"
             @click="lookRecords(item)"
-            >aa</span
+            >{{ dictValueLabel(item.repaymentStatus, status) }}</span
           >
         </div>
       </template>
@@ -37,13 +37,28 @@
       v-if="openAddDialog"
       v-model="openAddDialog"
       width="500"
+      destroy-on-close
     >
       <byForm
         :formConfig="formConfig"
         :formOption="formOption"
+        :rules="rules"
         v-model="formData.data"
         ref="byform"
       >
+        <template #loanUserName>
+          <div style="width: 100%">
+            <el-autocomplete
+              v-model="formData.data.loanUserName"
+              value-key="loanUserName"
+              clearable
+              :fetch-suggestions="querySearch"
+              :disabled="submitType == 'edit'"
+              class="inline-input w-50"
+              placeholder="请输入"
+            />
+          </div>
+        </template>
       </byForm>
       <template #footer>
         <el-button @click="openAddDialog = false" size="large">取 消</el-button>
@@ -63,6 +78,19 @@
       v-model="openRecordsDialog"
       width="500"
     >
+      <div
+        v-for="(item, index) in recordsData"
+        :key="item.id"
+        style="margin-bottom: 20px"
+      >
+        <div style="margin-top: 5px; color: #bbbbbb">
+          {{ item.repaymentTime }}
+        </div>
+        <div style="margin-top: 5px">
+          还款金额:{{ item.currency }} {{ moneyFormat(item.amount, 2) }}
+        </div>
+        <div style="margin-top: 5px">登记人:{{ item.createUserName }}</div>
+      </div>
       <template #footer>
         <el-button @click="openRecordsDialog = false" size="large"
           >关 闭</el-button
@@ -78,6 +106,7 @@ import useUserStore from "@/store/modules/user";
 import { reactive, ref } from "vue";
 import byForm from "@/components/byForm/index";
 import FundsPDF from "@/components/PDF/fundsPDF.vue";
+import { ElMessage } from "element-plus";
 
 const loading = ref(false);
 const sourceList = ref({
@@ -86,7 +115,7 @@ const sourceList = ref({
     total: 0,
     pageNum: 1,
     pageSize: 10,
-    status: "",
+    repaymentStatus: "",
     keyword: "",
     corporationId: "",
   },
@@ -96,17 +125,30 @@ const userList = ref([]);
 const accountCurrency = ref([]);
 const accountList = ref([]);
 const corporationList = ref([]);
-const status = ref([]);
+const status = ref([
+  {
+    label: "未还款",
+    value: "0",
+  },
+  {
+    label: "部分还款",
+    value: "1",
+  },
+  {
+    label: "已还款",
+    value: "2",
+  },
+]);
 const selectConfig = computed(() => {
   return [
     {
       label: "归属公司",
-      prop: "type",
+      prop: "corporationId",
       data: corporationList.value,
     },
     {
       label: "还款状态",
-      prop: "status",
+      prop: "repaymentStatus",
       data: status.value,
     },
   ];
@@ -123,14 +165,13 @@ const config = computed(() => {
     {
       attrs: {
         label: "借款人",
-        prop: "deptName",
+        prop: "loanUserName",
         width: 120,
       },
     },
     {
       attrs: {
         label: "借款金额",
-
         width: 150,
         slot: "money",
       },
@@ -138,30 +179,28 @@ const config = computed(() => {
     {
       attrs: {
         label: "还款状态",
-        prop: "type",
         width: 100,
-        slot: "type",
+        slot: "repaymentStatus",
       },
     },
     {
       attrs: {
         label: "借款时间",
-        prop: "createTime",
+        prop: "loanTime",
         width: 160,
       },
     },
-
     {
       attrs: {
         label: "备注",
-        prop: "paymentRemarks",
+        prop: "remarks",
       },
     },
 
     {
       attrs: {
         label: "创建人",
-        prop: "accountManagementName",
+        prop: "createUserName",
         width: 120,
       },
     },
@@ -169,7 +208,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "创建时间",
-        prop: "accountPaymentStatus",
+        prop: "createTime",
         width: 160,
       },
     },
@@ -182,17 +221,19 @@ const config = computed(() => {
       },
       renderHTML(row) {
         return [
-          {
-            attrs: {
-              label: "还款",
-              type: "primary",
-              text: true,
-            },
-            el: "button",
-            click() {
-              handleEdit(row);
-            },
-          },
+          row.repaymentStatus != 2
+            ? {
+                attrs: {
+                  label: "还款",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  handleEdit(row);
+                },
+              }
+            : {},
         ];
       },
     },
@@ -201,15 +242,13 @@ const config = computed(() => {
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy
-    .post("/accountRequestFunds/page", sourceList.value.pagination)
-    .then((message) => {
-      sourceList.value.data = message.rows;
-      sourceList.value.pagination.total = message.total;
-      setTimeout(() => {
-        loading.value = false;
-      }, 200);
-    });
+  proxy.post("/loanInfo/page", sourceList.value.pagination).then((message) => {
+    sourceList.value.data = message.rows;
+    sourceList.value.pagination.total = message.total;
+    setTimeout(() => {
+      loading.value = false;
+    }, 200);
+  });
 };
 
 const getDictData = () => {
@@ -224,6 +263,7 @@ const getDictData = () => {
       });
     }
   });
+
   proxy
     .get("/tenantUser/list", {
       pageNum: 1,
@@ -271,7 +311,25 @@ const formOption = reactive({
   itemWidth: 100,
   rules: [],
 });
-
+const rules = ref({
+  corporationId: [
+    { required: true, message: "请选择归属公司", trigger: "change" },
+  ],
+  loanUserName: [{ required: true, message: "请输入借款人", trigger: "blur" }],
+  loanTime: [{ required: true, message: "请选择借款时间", trigger: "change" }],
+  currency: [{ required: true, message: "请选择币种", trigger: "change" }],
+  amount: [{ required: true, message: "请输入借款金额", trigger: "blur" }],
+  loanAccountId: [
+    { required: true, message: "请选择付款账户", trigger: "change" },
+  ],
+  repaymentAccountId: [
+    { required: true, message: "请选择收款账户", trigger: "change" },
+  ],
+  amountOne: [{ required: true, message: "请输入还款金额", trigger: "blur" }],
+  repaymentTime: [
+    { required: true, message: "请选择还款时间", trigger: "change" },
+  ],
+});
 const formConfig = computed(() => {
   return [
     {
@@ -287,11 +345,10 @@ const formConfig = computed(() => {
       },
     },
     {
-      type: "select",
-      prop: "createUser",
+      type: "slot",
+      prop: "loanUserName",
       label: "借款人",
-      data: userList.value,
-      clearable: true,
+      slotName: "loanUserName",
       disabled: submitType.value != "add",
       itemWidth: 100,
       style: {
@@ -301,7 +358,7 @@ const formConfig = computed(() => {
     {
       type: "date",
       itemType: "datetime",
-      prop: "type",
+      prop: "loanTime",
       label: "借款时间",
       disabled: submitType.value != "add",
       itemWidth: 100,
@@ -336,9 +393,9 @@ const formConfig = computed(() => {
     },
     {
       type: "select",
-      prop: "createUser",
-      label: "付款账",
-      data: userList.value,
+      prop: "loanAccountId",
+      label: "付款账",
+      data: accountList.value,
       disabled: submitType.value != "add",
       itemWidth: 100,
       clearable: true,
@@ -349,7 +406,7 @@ const formConfig = computed(() => {
     {
       type: "input",
       itemType: "textarea",
-      prop: "paymentRemarks",
+      prop: "remarks",
       label: "备注",
       disabled: submitType.value != "add",
     },
@@ -361,9 +418,9 @@ const formConfig = computed(() => {
       : {},
     {
       type: "select",
-      prop: "createUser",
-      label: "收款账",
-      data: userList.value,
+      prop: "repaymentAccountId",
+      label: "收款账",
+      data: accountList.value,
       itemWidth: 100,
       clearable: true,
       isShow: submitType.value != "add",
@@ -379,13 +436,14 @@ const formConfig = computed(() => {
       clearable: true,
       itemWidth: 25,
       isShow: submitType.value != "add",
+      disabled: true,
       style: {
         width: "100%",
       },
     },
     {
       type: "number",
-      prop: "amount",
+      prop: "amountOne",
       label: " ",
       precision: 2,
       min: 0,
@@ -399,8 +457,8 @@ const formConfig = computed(() => {
     {
       type: "date",
       itemType: "datetime",
-      prop: "type",
-      label: "款时间",
+      prop: "repaymentTime",
+      label: "款时间",
       itemWidth: 100,
       isShow: submitType.value != "add",
       style: {
@@ -410,7 +468,7 @@ const formConfig = computed(() => {
     {
       type: "input",
       itemType: "textarea",
-      prop: "paymentRemarks",
+      prop: "remarksOne",
       label: "备注",
       isShow: submitType.value != "add",
     },
@@ -423,22 +481,47 @@ const openAddDialog = ref(false);
 const byform = ref(null);
 const submitLoading = ref(false);
 const submitType = ref("add");
-
+const historyData = ref([]);
 const openModal = () => {
+  proxy.get("/loanInfo/getLoanUserList").then((res) => {
+    historyData.value = res.data;
+  });
   submitType.value = "add";
   formData.data = {};
   openAddDialog.value = true;
 };
+
+const querySearch = (queryString, cb) => {
+  const results = queryString
+    ? historyData.value.filter(createFilter(queryString))
+    : historyData.value;
+  cb(results);
+};
+
+const createFilter = (queryString) => {
+  return (restaurant) => {
+    return (
+      restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+    );
+  };
+};
+
 const handleSubmit = () => {
   byform.value.handleSubmit(() => {
     submitLoading.value = true;
-    proxy.post("/accountPayment/add", formData.data).then(
+    let requestUrl = "/loanInfo/add";
+    if (submitType.value != "add") {
+      requestUrl = "/repaymentRecords/add";
+      formData.data.amount = formData.data.amountOne;
+      formData.data.remarks = formData.data.remarksOne;
+    }
+    proxy.post(requestUrl, formData.data).then(
       () => {
         ElMessage({
-          message: "打款成功",
+          message: "操作成功",
           type: "success",
         });
-        dialogVisible.value = false;
+        openAddDialog.value = false;
         submitLoading.value = false;
         getList();
       },
@@ -450,11 +533,17 @@ const handleSubmit = () => {
 };
 const handleEdit = (row) => {
   submitType.value = "edit";
-  formData.data = {};
+  proxy.post("/loanInfo/detail", { id: row.id }).then((res) => {
+    formData.data = { ...res, loanId: row.id };
+  });
   openAddDialog.value = true;
 };
 const openRecordsDialog = ref(false);
+const recordsData = ref([]);
 const lookRecords = (row) => {
+  proxy.post("/repaymentRecords/list", { loanId: row.id }).then((res) => {
+    recordsData.value = res;
+  });
   openRecordsDialog.value = true;
 };
 </script>

+ 16 - 10
src/views/salesMange/salesMange/performance/index.vue

@@ -359,7 +359,7 @@ const selectConfig = computed(() => {
     // },
   ];
 });
-
+const headerData = ref({});
 const statConfig = computed(() => [
   {
     label: "统计",
@@ -371,22 +371,22 @@ const statConfig = computed(() => [
         data: [
           {
             label: "收入合计",
-            num: proxy.moneyFormat(10, 2),
+            num: proxy.moneyFormat(headerData.value.totalIncome, 2),
             color: "#C280FF",
           },
           {
             label: "支出合计",
-            num: proxy.moneyFormat(20, 2),
+            num: proxy.moneyFormat(headerData.value.totalExpenses, 2),
             color: "#C280FF",
           },
           {
             label: "毛利",
-            num: proxy.moneyFormat(20, 2),
+            num: proxy.moneyFormat(headerData.value.grossGrofit, 2),
             color: "#C280FF",
           },
           {
             label: "毛利率",
-            num: proxy.moneyFormat(20, 2),
+            num: headerData.value.grossRofitMargin + " %",
             color: "#C280FF",
           },
         ],
@@ -397,27 +397,27 @@ const statConfig = computed(() => [
         data: [
           {
             label: "售后",
-            num: proxy.moneyFormat(10, 2),
+            num: proxy.moneyFormat(headerData.value.afterSalesAmount, 2),
             color: "#0084ff",
           },
           {
             label: "公共",
-            num: proxy.moneyFormat(20, 2),
+            num: proxy.moneyFormat(headerData.value.publicAmount, 2),
             color: "#0084ff",
           },
           {
             label: "总办",
-            num: proxy.moneyFormat(20, 2),
+            num: proxy.moneyFormat(headerData.value.haveOverallAmount, 2),
             color: "#0084ff",
           },
           {
             label: "部门提成",
-            num: proxy.moneyFormat(20, 2),
+            num: proxy.moneyFormat(headerData.value.departmentalCommission, 2),
             color: "#0084ff",
           },
           {
             label: "个人提成",
-            num: proxy.moneyFormat(20, 2),
+            num: proxy.moneyFormat(headerData.value.personalCommission, 2),
             color: "#0084ff",
           },
         ],
@@ -425,6 +425,12 @@ const statConfig = computed(() => [
     ],
   },
 ]);
+const getHeaderData = () => {
+  proxy.post("/commission/getHeadStatistics").then((res) => {
+    headerData.value = res;
+  });
+};
+getHeaderData();
 const config = computed(() => {
   return [];
 });