fix: 贷款账单,功能优化。

This commit is contained in:
tianyongbao
2025-10-19 15:06:34 +08:00
parent 6e4437d0cd
commit 8858eb265a
4 changed files with 113 additions and 25 deletions

View File

@@ -23,6 +23,11 @@
<u-form-item label="借款日期" prop="installmentDate" required @click="selectDate()">
<u--input v-model="form.installmentDate" 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="debitCardName" required @click="handleDebitCard">
<u--input v-model="form.debitCardName" 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="period" required >
<u--input v-model="form.period" type="number" placeholder="请填写借款期数"
@@ -86,6 +91,8 @@
></u-datetime-picker>
<u-picker itemHeight="88" :show="showOnlineLend" :columns="bankCardLendList" keyName="nameCode" @cancel="handleOnlineLendCancel"
@confirm="handleOnlineLendConfirm"></u-picker>
<u-picker itemHeight="88" :show="showDebitCard" :columns="debitCardList" keyName="nameCode" @cancel="handleDebitCardCancel"
@confirm="handleDebitCardConfirm"></u-picker>
</view>
</template>
@@ -108,6 +115,8 @@ const showTeam = ref(false)
const showOnlineLend = ref(false)
const title = ref("贷款账单")
const bankCardLendList = ref([])
const showDebitCard = ref(false)
const debitCardList = ref([])
const settleStateList = ref([])
const data = reactive({
form: {
@@ -125,7 +134,7 @@ const data = reactive({
interestRate: null,
dueDate: null,
closeDate: null,
state: null,
state: '0',
createBy: null,
createTime: null,
updateBy: null,
@@ -140,6 +149,13 @@ const data = reactive({
lendType: '1',
pageSize: 1000
},
queryDebitCardParams: {
pageNum: 1,
type: '1',
status: '1',
// lendType: '1',
pageSize: 1000
},
rules: {
onlineLendName: [{ type: 'string', required: true, message: '贷款机构不能为空', trigger: ['change', 'blur'] }],
billDate: [{ type: 'string', required: true, message: '借款日期不能为空', trigger: ['change', 'blur'] }],
@@ -151,7 +167,7 @@ const data = reactive({
balance: [{ type: 'number', required: true, message: '余额不能为空', trigger: ['change', 'blur'] }],
}
})
const { form, queryBankCardLendParams, rules} = toRefs(data)
const { form, queryBankCardLendParams, queryDebitCardParams, rules} = toRefs(data)
onLoad((option) => {
form.value.id = option.id
@@ -172,11 +188,15 @@ onLoad((option) => {
})
listAccounts(queryBankCardLendParams.value).then((response) => {
bankCardLendList.value = [response.rows]
})
listAccounts(queryDebitCardParams.value).then((response) => {
debitCardList.value = [response.rows]
})
if(form.value.id!=null){
getInstallmentHistory(form.value.id).then(res => {
form.value = res.data
form.value.onlineLendName = res.data.bankName
form.value.debitCardName = res.data.receivingAccountNameCode
// 类型
getDicts('settle_state').then(result => {
form.value.settleStateName=dictStr(form.value.state, result.data)
@@ -230,6 +250,24 @@ onLoad((option) => {
showOnlineLend.value = false
}
function handleDebitCard() {
if (debitCardList.value[0].length === 0) {
proxy.$refs['uToast'].show({
message: '收款账户为空 ', type: 'warning'
})
} else {
showDebitCard.value = true
}
}
function handleDebitCardConfirm(e) {
form.value.debitCardName = e.value[0].nameCode
form.value.receivingAccountId= e.value[0].id
showDebitCard.value = false
}
function handleDebitCardCancel() {
showDebitCard.value = false
}
function selectDate() {
datePickShow.value = true
proxy.$refs['createTimeRef'].innerValue = new Date().getTime()

View File

@@ -13,12 +13,16 @@
<u-list @scrolltolower="loadmore" :spaceHeight="116" lowerThreshold="100">
<u-list-item v-for="(item, index) in listData" :key="index">
<view class="list-item">
<view class="item-row">
<text class="row-label">还款账户</text>
<text class="row-value">{{ item.repaymentAccountName }}</text>
</view>
<view class="item-row">
<text class="row-label">还款日期</text>
<text class="row-value">{{ item.repaymentDate }}</text>
</view>
<view class="item-row">
<text class="row-label">入账状态</text>
<text class="row-label">还款状态</text>
<text class="row-value">{{ dictStr(item.postingState, postingStateList) }}</text>
</view>
<view class="item-row">
@@ -38,8 +42,9 @@
<text class="row-value">{{ item.interest }}</text>
</view>
<view class="operate" >
<view class="btn filling" @click="handleEdit(item)">修改</view>
<view class="btn filling" @click="handleDelete(item)">删除</view>
<view class="btn filling" @click="handleEdit(item)" v-if="item.postingState !== '1'">修改</view>
<view class="btn filling" @click="handleView(item)" v-else>查看</view>
<view class="btn filling" @click="handleDelete(item)" v-if="item.postingState !== '1'">删除</view>
</view>
</view>
@@ -123,7 +128,7 @@ function getList() {
}
function getDict() {
// 交易类型
getDicts('posting_state').then(res => {
getDicts('repayment_state').then(res => {
postingStateList.value = res.data
})
@@ -170,6 +175,10 @@ function handleUpdateInterest() {
uni.navigateTo({ url: `/pages/work/bill/onlineLendHistory/detailsAddEdit?id=${item.id}&installmentHistoryId=${queryParams.value.installmentHistoryId}&name=${queryParams.value.name}` })
isShow.value = true
}
function handleView(item) {
uni.navigateTo({ url: `/pages/work/bill/onlineLendHistory/detailsAddEdit?id=${item.id}&installmentHistoryId=${queryParams.value.installmentHistoryId}&name=${queryParams.value.name}&viewOnly=1` })
isShow.value = true
}
// function handleAdd() {
// uni.navigateTo({ url: `/pages/work/bill/onlineLendHistory/addEdit` })
// isShow.value = true

View File

@@ -11,38 +11,43 @@
<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="repaymentDate" required @click="selectDate()">
<u-form-item label="还款账户" prop="debitCardName" required @click="!viewOnly && handleDebitCard()">
<u--input v-model="form.debitCardName" disabled disabledColor="#ffffff" placeholder="请选择还款账户"
inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-down" v-if="!viewOnly"></u-icon>
</u-form-item>
<u-form-item label="还款日期" prop="repaymentDate" required @click="!viewOnly && selectDate()">
<u--input v-model="form.repaymentDate" disabled disabledColor="#ffffff" placeholder="请选择还款日期" inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
<u-icon slot="right" name="arrow-right" v-if="!viewOnly"></u-icon>
</u-form-item>
<u-form-item label="还款期数" prop="periods" required >
<u--input v-model="form.periods" placeholder="请填写还款期数"
<u--input v-model="form.periods" :disabled="viewOnly" :disabledColor="viewOnly ? '#ffffff' : ''" placeholder="请填写还款期数"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="还款金额" prop="currentAmount" >
<u--input v-model="form.currentAmount" placeholder="请填写还款金额"
<u--input v-model="form.currentAmount" :disabled="viewOnly" :disabledColor="viewOnly ? '#ffffff' : ''" placeholder="请填写还款金额"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="应还本金" prop="principal" required >
<u--input v-model="form.principal" placeholder="请填写应还本金"
<u--input v-model="form.principal" :disabled="viewOnly" :disabledColor="viewOnly ? '#ffffff' : ''" placeholder="请填写应还本金"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="利息" prop="interest" required >
<u--input v-model="form.interest" placeholder="请填写利息"
<u--input v-model="form.interest" :disabled="viewOnly" :disabledColor="viewOnly ? '#ffffff' : ''" placeholder="请填写利息"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="入账状态" prop="postingStateName" required @click="handleShowTeam">
<u-form-item label="还款状态" prop="postingStateName" required @click="!viewOnly && handleShowTeam()">
<u--input v-model="form.postingStateName" disabled disabledColor="#ffffff" placeholder="请选择入账状态"
inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-down"></u-icon>
<u-icon slot="right" name="arrow-down" v-if="!viewOnly"></u-icon>
</u-form-item>
<u-form-item label="备注" prop="remark" labelPosition="top">
<u--textarea v-model="form.remark" placeholder="请填写备注" border="none" autoHeight inputAlign="right" count
<u--textarea v-model="form.remark" :disabled="viewOnly" :disabledColor="viewOnly ? '#ffffff' : ''" placeholder="请填写备注" border="none" autoHeight inputAlign="right" count
maxlength="20000" style="padding:18rpx 0;"></u--textarea>
</u-form-item>
</u--form>
<view class="form-btn">
<view class="form-btn" v-if="!viewOnly">
<u-button type="primary" text="提交" @click="submit"></u-button>
</view>
</view>
@@ -59,6 +64,8 @@
@confirm="datePickConfirm"
itemHeight="88"
></u-datetime-picker>
<u-picker itemHeight="88" :show="showDebitCard" :columns="debitCardList" keyName="nameCode" @cancel="handleDebitCardCancel"
@confirm="handleDebitCardConfirm"></u-picker>
</view>
</template>
@@ -69,6 +76,7 @@ import {
updateInstallmentDetail
} from '@/api/invest/installmentDetail'
import { getDicts } from '@/api/system/dict/data.js'
import { listAccounts } from '@/api/invest/accounts'
const { proxy } = getCurrentInstance()
import dayjs from 'dayjs'
import {onLoad,onReady} from "@dcloudio/uni-app";
@@ -77,25 +85,36 @@ import {reactive ,toRefs,ref,computed ,getCurrentInstance }from "vue";
const datePickShow = ref(false)
const showTeam = ref(false)
const title = ref("贷款账单还款明细")
const showDebitCard = ref(false)
const debitCardList = ref([])
const postingStateList = ref([])
const viewOnly = ref(false)
const data = reactive({
form: {},
queryDebitCardParams: {
pageNum: 1,
type: '1',
status: '1',
// lendType: '1',
pageSize: 1000
},
rules: {
repaymentDate: [{ type: 'string', required: true, message: '还款日期不能为空', trigger: ['change', 'blur'] }],
periods: [{ type: 'number', required: true, message: '还款期数不能为空', trigger: ['change', 'blur'] }],
interest: [{ type: 'number', required: true, message: '利息不能为空', trigger: ['change', 'blur'] }],
principal: [{ type: 'number', required: true, message: '应还本金不能为空', trigger: ['change', 'blur'] }],
postingStateName: [{ type: 'string', required: true, message: '入账状态不能为空', trigger: ['change', 'blur'] }],
postingStateName: [{ type: 'string', required: true, message: '还款状态不能为空', trigger: ['change', 'blur'] }],
}
})
const { form, rules} = toRefs(data)
const { form, rules, queryDebitCardParams} = toRefs(data)
onLoad((option) => {
form.value.id = option.id
form.value.installmentHistoryId = option.installmentHistoryId
form.value.name = option.name
viewOnly.value = option.viewOnly === '1'
if(form.value.id!=null){
title.value="贷款账单还款明细-修改"
title.value = viewOnly.value ? "贷款账单还款明细-查看" : "贷款账单还款明细-修改"
}else{
title.value="贷款账单还款明细-新增"
}
@@ -106,14 +125,18 @@ onLoad((option) => {
})
function getDict() {
// 类型
getDicts('posting_state').then(res => {
getDicts('repayment_state').then(res => {
postingStateList.value =[res.data]
})
listAccounts(queryDebitCardParams.value).then((response) => {
debitCardList.value = [response.rows]
})
if(form.value.id!=null){
getInstallmentDetail(form.value.id).then(res => {
form.value = res.data
form.value.debitCardName = res.data.repaymentAccountName
// 类型
getDicts('posting_state').then(result => {
getDicts('repayment_state').then(result => {
form.value.postingStateName=dictStr(form.value.postingState, result.data)
})
@@ -147,6 +170,24 @@ onLoad((option) => {
function handleCancel() {
showTeam.value = false
}
function handleDebitCard() {
if (debitCardList.value[0].length === 0) {
proxy.$refs['uToast'].show({
message: '收款账户为空 ', type: 'warning'
})
} else {
showDebitCard.value = true
}
}
function handleDebitCardConfirm(e) {
form.value.debitCardName = e.value[0].nameCode
form.value.repaymentAccountId= e.value[0].id
showDebitCard.value = false
}
function handleDebitCardCancel() {
showDebitCard.value = false
}
function selectDate() {
datePickShow.value = true
proxy.$refs['createTimeRef'].innerValue = new Date().getTime()

View File

@@ -45,10 +45,10 @@
<text class="row-label">借款日期</text>
<text class="row-value">{{ item.installmentDate }}</text>
</view>
<!-- <view class="item-row">
<text class="row-label">借款期数</text>
<text class="row-value">{{ item.period }}</text>
</view> -->
<view class="item-row">
<text class="row-label">收款账户</text>
<text class="row-value">{{ item.receivingAccountNameCode }}</text>
</view>
<view class="item-row">
<text class="row-label">已还期数</text>
<text class="row-value">{{ item.repaidPeriod }}</text>