From cac302f302084ab310d0e35339f30966a4829a4e Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期五, 23 一月 2026 12:18:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New

---
 src/views/financialManagement/loanManagement/index.vue |  271 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 271 insertions(+), 0 deletions(-)

diff --git a/src/views/financialManagement/loanManagement/index.vue b/src/views/financialManagement/loanManagement/index.vue
new file mode 100644
index 0000000..7580d3b
--- /dev/null
+++ b/src/views/financialManagement/loanManagement/index.vue
@@ -0,0 +1,271 @@
+<template>
+  <div class="app-container">
+    <el-form :model="filters" :inline="true">
+      <el-form-item label="鍊熸浜哄鍚�:">
+        <el-input
+          v-model="filters.borrowerName"
+          placeholder="璇疯緭鍏ュ�熸浜哄鍚�"
+          clearable
+          style="width: 200px;"
+        />
+      </el-form-item>
+      <el-form-item label="鍊熸鏃ユ湡:">
+        <el-date-picker
+          v-model="filters.borrowDate"
+          value-format="YYYY-MM-DD"
+          format="YYYY-MM-DD"
+          type="daterange"
+          range-separator="鑷�"
+          start-placeholder="寮�濮嬫棩鏈�"
+          end-placeholder="缁撴潫鏃ユ湡"
+          clearable
+          @change="changeDaterange"
+        />
+      </el-form-item>
+      <el-form-item label="鍊熸鐘舵��:">
+        <el-select
+          v-model="filters.status"
+          placeholder="璇烽�夋嫨"
+          clearable
+          style="width: 200px;"
+        >
+          <el-option label="寰呰繕娆�" :value="1" />
+          <el-option label="宸茶繕娆�" :value="2" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" @click="getTableData">鎼滅储</el-button>
+        <el-button @click="resetFilters">閲嶇疆</el-button>
+      </el-form-item>
+    </el-form>
+    <div class="table_list">
+      <div class="actions">
+        <div></div>
+        <div>
+          <el-button type="primary" @click="add" icon="Plus"> 鏂板 </el-button>
+          <el-button @click="handleOut" icon="download">瀵煎嚭</el-button>
+          <el-button
+            type="danger"
+            icon="Delete"
+            :disabled="multipleList.length <= 0"
+            @click="deleteRow(multipleList.map((item) => item.id))"
+          >
+            鎵归噺鍒犻櫎
+          </el-button>
+        </div>
+      </div>
+      <PIMTable
+        rowKey="id"
+        isSelection
+        :column="columns"
+        :tableData="dataList"
+        :page="{
+          current: pagination.currentPage,
+          size: pagination.pageSize,
+          total: pagination.total,
+        }"
+        @selection-change="handleSelectionChange"
+        @pagination="changePage"
+      >
+        <template #operation="{ row }">
+          <el-button type="primary" link @click="edit(row)">
+            缂栬緫
+          </el-button>
+          <el-button
+            :disabled="row.status !== 1"
+            type="primary"
+            link
+            @click="repay(row)"
+          >
+            杩樻
+          </el-button>
+        </template>
+      </PIMTable>
+    </div>
+    <Modal ref="modalRef" @success="getTableData"></Modal>
+  </div>
+</template>
+
+<script setup>
+import { usePaginationApi } from "@/hooks/usePaginationApi";
+import { listPage, delAccountLoan } from "@/api/financialManagement/loanManagement";
+import { onMounted, getCurrentInstance, ref, nextTick } from "vue";
+import Modal from "./Modal.vue";
+import { ElMessageBox, ElMessage } from "element-plus";
+import dayjs from "dayjs";
+
+defineOptions({
+  name: "鍊熸绠$悊",
+});
+
+// 琛ㄦ牸澶氶�夋閫変腑椤�
+const multipleList = ref([]);
+const { proxy } = getCurrentInstance();
+const modalRef = ref();
+
+const {
+  filters,
+  columns,
+  dataList,
+  pagination,
+  getTableData,
+  resetFilters,
+  onCurrentChange,
+} = usePaginationApi(
+  listPage,
+  {
+    borrowerName: undefined,
+    borrowDate: undefined,
+    status: undefined,
+  },
+  [
+    {
+      label: "鍊熸浜哄鍚�",
+      prop: "borrowerName",
+    },
+    {
+      label: "鍊熸閲戦锛堝厓锛�",
+      prop: "borrowAmount",
+      formatData: (val) => {
+        return val ? `楼${parseFloat(val).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : '楼0.00';
+      },
+    },
+    {
+      label: "鍊熸鍒╃巼锛�%锛�",
+      prop: "interestRate",
+      formatData: (val) => {
+        return val ? `${parseFloat(val).toFixed(2)}%` : '-';
+      },
+    },
+    {
+      label: "鍊熸鏃ユ湡",
+      prop: "borrowDate",
+    },
+    {
+      label: "瀹為檯杩樻鏃ユ湡",
+      prop: "repayDate",
+    },
+    {
+      label: "鍊熸鐘舵��",
+      prop: "status",
+      dataType: "tag",
+			align: 'center',
+      formatData: (params) => {
+        if (params == 1) {
+          return "寰呰繕娆�";
+        } else if (params == 2) {
+          return "宸茶繕娆�";
+        }
+        return null;
+      },
+      formatType: (params) => {
+        if (params == 1) {
+          return "error";
+        } else if (params == 2) {
+          return "success";
+        }
+        return null;
+      },
+    },
+    {
+      fixed: "right",
+      label: "鎿嶄綔",
+      dataType: "slot",
+      slot: "operation",
+      align: "center",
+      width: "120px",
+    },
+  ],
+  null,
+  {
+    // 灏嗗墠绔�熸鏃ユ湡鑼冨洿杞崲涓哄悗绔渶瑕佺殑 entryDateStart / entryDateEnd锛屽苟涓斾笉浼� borrowDate
+    borrowDate: (val) => {
+      if (val && val.length === 2) {
+        return {
+          entryDateStart: dayjs(val[0]).format("YYYY-MM-DD"),
+          entryDateEnd: dayjs(val[1]).format("YYYY-MM-DD"),
+        };
+      }
+      return {};
+    },
+  }
+);
+
+// 澶氶�夊悗鍋氫粈涔�
+const handleSelectionChange = (selectionList) => {
+  multipleList.value = selectionList;
+};
+
+const add = () => {
+  modalRef.value.openModal();
+};
+
+const edit = (row) => {
+  modalRef.value.loadForm(row);
+};
+
+const repay = (row) => {
+  modalRef.value.repay(row);
+};
+
+const changePage = ({ page, limit }) => {
+  pagination.currentPage = page;
+  pagination.pageSize = limit;
+  onCurrentChange(page);
+};
+
+const deleteRow = (id) => {
+  ElMessageBox.confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?", "鎻愮ず", {
+    confirmButtonText: "纭畾",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  }).then(async () => {
+    const { code } = await delAccountLoan(id);
+    if (code == 200) {
+      ElMessage({
+        type: "success",
+        message: "鍒犻櫎鎴愬姛",
+      });
+      getTableData();
+    }
+  });
+};
+
+const changeDaterange = (value) => {
+  if (value) {
+    filters.borrowDate = value;
+  } else {
+    filters.borrowDate = null;
+  }
+  getTableData();
+};
+
+const handleOut = () => {
+  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  })
+    .then(() => {
+      proxy.download(`/borrowInfo/export`, {}, "鍊熸鍙拌处.xlsx");
+    })
+    .catch(() => {
+      proxy.$modal.msg("宸插彇娑�");
+    });
+};
+
+onMounted(() => {
+  getTableData();
+});
+</script>
+
+<style lang="scss" scoped>
+.table_list {
+  margin-top: unset;
+}
+.actions {
+  display: flex;
+  justify-content: space-between;
+  margin-bottom: 10px;
+}
+</style>

--
Gitblit v1.9.3