gaoluyang
4 天以前 2d157a517d45b34acfdc0a540078d57c105877e5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<template>
  <view class="sales-account">
    <PageHeader title="借款管理" @back="goBack" />
    <view class="search-section">
      <view class="search-bar">
        <view class="search-input">
          <up-input class="search-text" placeholder="请输入客户名称搜索" v-model="searchForm.borrowerName" clearable />
        </view>
        <view class="filter-button" @click="handleQuery">
          <up-icon name="search" size="24" color="#999"></up-icon>
        </view>
      </view>
    </view>
    <view class="ledger-list" v-if="list.length>0">
      <view class="ledger-item" v-for="item in list" :key="item.id">
        <view class="item-header">
          <view class="item-left">
            <view class="document-icon"><up-icon name="file-text" color="#fff" size="16" /></view>
            <text class="item-id">{{ item.borrowerName || '--' }}</text>
          </view>
          <view class="item-tag">
            <u-tag :type="statusType(item.status)">{{ statusText(item.status) }}</u-tag>
          </view>
        </view>
        <up-divider></up-divider>
        <view class="item-details">
          <view class="detail-row"><text class="detail-label">借款金额(元)</text><text class="detail-value highlight">{{ fmtAmount(item.borrowAmount) }}</text></view>
          <view class="detail-row"><text class="detail-label">借款利率(%)</text><text class="detail-value">{{ fmtRate(item.interestRate) }}</text></view>
          <view class="detail-row"><text class="detail-label">借款日期</text><text class="detail-value">{{ item.borrowDate || '--' }}</text></view>
          <view class="detail-row"><text class="detail-label">实际还款日期</text><text class="detail-value">{{ item.repayDate || '--' }}</text></view>
          <view class="detail-row"><text class="detail-label">备注</text><text class="detail-value">{{ item.remark || '--' }}</text></view>
        </view>
      </view>
    </view>
    <view class="no-data" v-else><text>暂无数据</text></view>
  </view>
</template>
 
<script setup>
import { ref, reactive } from "vue";
import { onShow } from "@dcloudio/uni-app";
import { listPage } from "@/api/financialManagement/loanManagement";
 
const list = ref([]);
const searchForm = reactive({ borrowerName: "", current: -1, size: -1 });
 
 
const getList = () => {
  listPage({ ...searchForm, current: -1, size: -1 })  
    .then(res => {
      const records = res?.data?.records ?? res?.records ?? [];
      list.value = records;
    });
};
 
const handleQuery = () => {
  searchForm.current = 1;
  getList();
};
const statusText = (s) => s===1?'待还款': s===2?'已还款':'';
const statusType = (s) => s===1?'error': s===2?'success':'primary';
const fmtAmount = (v) => {
  const n = parseFloat(v || 0);
  return n.toFixed(2);
};
const fmtRate = (v) => {
  if (v===undefined || v===null || v==='') return '-';
  const n = parseFloat(v);
  return n.toFixed(2) + '%';
};
 
const goBack = () => {
  uni.navigateBack();
};
 
onShow(() => {
  getList();
});
</script>
 
<style scoped lang="scss">
@import "@/styles/sales-common.scss";
.actions { margin-top: 8px; }
</style>