fix: 借贷账户管理,功能优化。

This commit is contained in:
tianyongbao
2026-01-30 13:50:59 +08:00
parent a9e605b785
commit 6a8672fd64
3 changed files with 89 additions and 5 deletions

View File

@@ -11,6 +11,11 @@
<view class="form-view">
<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" label-width="auto"
:labelStyle="{ color: '#333333', fontSize: '30rpx' }">
<u-form-item label="银行" prop="bankName" @click="handleShowBank">
<u--input v-model="form.bankName" disabled disabledColor="#ffffff" placeholder="请选择银行"
inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-down"></u-icon>
</u-form-item>
<u-form-item label="借贷名称" prop="name" required >
<u--input v-model="form.name" placeholder="请填写借贷名称"
inputAlign="right" border="none"></u--input>
@@ -33,6 +38,14 @@
<u--input v-model="form.balance" type="number" placeholder="请填写余额"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="开通日期" prop="activationDate" @click="selectDate(1)">
<u--input v-model="form.activationDate" disabled disabledColor="#ffffff" placeholder="请选择开通日期" inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
<u-form-item label="注销日期" prop="effectiveDate" @click="selectDate(2)">
<u--input v-model="form.effectiveDate" disabled disabledColor="#ffffff" placeholder="请选择注销日期" inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
<!-- <u-form-item label="可用额度" prop="availableLimit" >
<u--input v-model="form.availableLimit" placeholder="请填写可用额度"
inputAlign="right" border="none"></u--input>
@@ -52,6 +65,8 @@
@confirm="handleConfirm"></u-picker>
<u-picker itemHeight="88" :show="showStatus" :columns="statusList" keyName="dictLabel" @cancel="handleStatusCancel"
@confirm="handleStatusConfirm"></u-picker>
<u-picker itemHeight="88" :show="showBank" :columns="bankList" keyName="bankName" @cancel="handleBankCancel"
@confirm="handleBankConfirm"></u-picker>
<u-datetime-picker
:show="datePickShow"
mode="date"
@@ -67,6 +82,7 @@
<script setup>
import { getBankcardLend, addBankcardLend, updateBankcardLend } from '@/api/invest/bankcardlend'
import { getDicts } from '@/api/system/dict/data.js'
import { listBankBaseInfo } from '@/api/invest/bankBaseInfo'
const { proxy } = getCurrentInstance()
import dayjs from 'dayjs'
import {onLoad,onReady} from "@dcloudio/uni-app";
@@ -79,6 +95,8 @@ const lendTypeList = ref([])
const dateType = ref(1)
const showStatus = ref(false)
const statusList = ref([])
const showBank = ref(false)
const bankList = ref([])
const data = reactive({
form: {
id: null,
@@ -103,7 +121,9 @@ const data = reactive({
remark: null,
debitType: null,
status: '1',
statusName: '正常使用'
statusName: '正常使用',
bankId: null,
bankName: null
},
// dateType:'1',
rules: {
@@ -127,7 +147,6 @@ onLoad((option) => {
})
onReady(() => {
form.value.activationDate = dayjs(new Date().getTime()).format("YYYY-MM-DD")
form.value.effectiveDate = dayjs(new Date().getTime()).format("YYYY-MM-DD")
})
function getDict() {
// 类型
@@ -138,6 +157,10 @@ onLoad((option) => {
getDicts('account_status').then(res => {
statusList.value =[res.data]
})
// 获取银行列表
listBankBaseInfo({ pageSize: 1000, pageNum: 1 }).then(res => {
bankList.value = [res.rows]
})
if(form.value.id!=null){
getBankcardLend(form.value.id).then(res => {
form.value = res.data
@@ -148,6 +171,13 @@ onLoad((option) => {
// 类型
getDicts('account_status').then(result => {
form.value.statusName=dictStr(form.value.status, result.data)
})
// 银行名称
listBankBaseInfo({ pageSize: 1000, pageNum: 1 }).then(res => {
const bank = res.rows.find(item => item.id === form.value.bankId)
if (bank) {
form.value.bankName = bank.bankName
}
})
})
}
@@ -196,6 +226,29 @@ onLoad((option) => {
function handleStatusCancel() {
showStatus.value = false
}
function handleShowBank() {
if (bankList.value[0].length === 0) {
proxy.$refs['uToast'].show({
message: '银行列表为空 ', type: 'warning'
})
} else {
showBank.value = true
}
}
function handleBankConfirm(e) {
form.value.bankName = e.value[0].bankName
form.value.bankId = e.value[0].id
// 新增时自动赋值账户名称
if (!form.value.id) {
form.value.name = e.value[0].bankName
}
showBank.value = false
}
function handleBankCancel() {
showBank.value = false
}
function selectDate(type) {
dateType.value=type
datePickShow.value = true

View File

@@ -28,6 +28,10 @@
<text>账户信息</text>
</view>
<view class="info-list">
<view class="list-item">
<text class="item-label">银行</text>
<text class="item-value">{{ detailInfo.bankName || '--' }}</text>
</view>
<view class="list-item">
<text class="item-label">类型</text>
<text class="item-value">{{ detailInfo.lendTypeText }}</text>
@@ -36,6 +40,14 @@
<text class="item-label">账户状态</text>
<text class="item-value" :class="getStatusClass(detailInfo.status, detailInfo.statusText)">{{ detailInfo.statusText }}</text>
</view>
<view class="list-item" v-if="detailInfo.activationDate">
<text class="item-label">开通日期</text>
<text class="item-value">{{ detailInfo.activationDate }}</text>
</view>
<view class="list-item" v-if="detailInfo.effectiveDate">
<text class="item-label">注销日期</text>
<text class="item-value">{{ detailInfo.effectiveDate }}</text>
</view>
</view>
</view>
@@ -58,6 +70,7 @@
<script setup>
import { getBankcardLend} from '@/api/invest/bankcardlend'
import { getDicts } from '@/api/system/dict/data.js'
import { listBankBaseInfo } from '@/api/invest/bankBaseInfo'
import {onLoad} from "@dcloudio/uni-app";
import {reactive ,toRefs,ref,computed }from "vue";
const id = ref('')
@@ -95,6 +108,13 @@ onLoad((option) => {
// 类型
getDicts('account_status').then(result => {
detailInfo.value.statusText=dictStr(detailInfo.value.status, result.data)
})
// 银行名称
listBankBaseInfo({ pageSize: 1000, pageNum: 1 }).then(res => {
const bank = res.rows.find(item => item.id === detailInfo.value.bankId)
if (bank) {
detailInfo.value.bankName = bank.bankName
}
})
})
}

View File

@@ -45,6 +45,7 @@
<view class="card-body">
<view class="info-row">
<view class="info-item" v-if="dictStr(item.lendType, lendTypeList) || true">
<text class="info-label">账户类型</text>
<text class="info-value">{{ dictStr(item.lendType, lendTypeList) || '--' }}</text>
@@ -53,9 +54,19 @@
<text class="info-label">账户状态</text>
<text class="info-value" :class="getStatusClass(item.status, dictStr(item.status, statusList))">{{ dictStr(item.status, statusList) || '--' }}</text>
</view>
<view class="info-item" v-if="item.bankName">
<text class="info-label">银行</text>
<text class="info-value">{{ item.bankName }}</text>
</view>
<view class="info-row">
<view class="info-item info-item-full" v-if="item.remark">
<view class="info-item" v-if="item.activationDate">
<text class="info-label">开通日期</text>
<text class="info-value">{{ item.activationDate }}</text>
</view>
<view class="info-item" v-if="item.effectiveDate ">
<text class="info-label">注销日期</text>
<text class="info-value">{{ item.effectiveDate }}</text>
</view>
<view class="info-item" v-if="item.remark">
<text class="info-label">备注</text>
<text class="info-value">{{ item.remark }}</text>
</view>