CRM: 完善回款合同回款计划编辑合同回显

This commit is contained in:
puhui999 2024-03-02 23:38:13 +08:00
parent a31c995508
commit 3660cd26ae
4 changed files with 30 additions and 24 deletions

View File

@ -3,18 +3,20 @@ import request from '@/config/axios'
export interface ReceivableVO { export interface ReceivableVO {
id: number id: number
no: string no: string
planId: number planId?: number
customerId: number customerId?: number
customerName?: string customerName?: string
contractId: number contractId?: number
contract?: { contract?: {
id?: number
name?: string
no: string no: string
totalPrice: number totalPrice: number
} }
auditStatus: number auditStatus: number
processInstanceId: number processInstanceId: number
returnTime: Date returnTime: Date
returnType: string returnType: number
price: number price: number
ownerUserId: number ownerUserId: number
ownerUserName?: string ownerUserName?: string

View File

@ -11,7 +11,7 @@ export interface ReceivablePlanVO {
remindTime: Date remindTime: Date
customerId: number customerId: number
customerName?: string customerName?: string
contractId: number contractId?: number
contractNo?: string contractNo?: string
ownerUserId: number ownerUserId: number
ownerUserName?: string ownerUserName?: string

View File

@ -10,7 +10,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="回款编号" prop="no"> <el-form-item label="回款编号" prop="no">
<el-input disabled v-model="formData.no" placeholder="保存时自动生成" /> <el-input v-model="formData.no" disabled placeholder="保存时自动生成" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -38,8 +38,8 @@
:disabled="formType !== 'create'" :disabled="formType !== 'create'"
class="w-1/1" class="w-1/1"
filterable filterable
@change="handleCustomerChange"
placeholder="请选择客户" placeholder="请选择客户"
@change="handleCustomerChange"
> >
<el-option <el-option
v-for="item in customerList" v-for="item in customerList"
@ -57,15 +57,15 @@
:disabled="formType !== 'create' || !formData.customerId" :disabled="formType !== 'create' || !formData.customerId"
class="w-1/1" class="w-1/1"
filterable filterable
@change="handleContractChange"
placeholder="请选择合同" placeholder="请选择合同"
@change="handleContractChange"
> >
<el-option <el-option
v-for="data in contractList" v-for="data in contractList"
:key="data.id" :key="data.id"
:disabled="data.auditStatus !== 20"
:label="data.name" :label="data.name"
:value="data.id!" :value="data.id!"
:disabled="data.auditStatus !== 20"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -78,15 +78,15 @@
v-model="formData.planId" v-model="formData.planId"
:disabled="formType !== 'create' || !formData.contractId" :disabled="formType !== 'create' || !formData.contractId"
class="!w-1/1" class="!w-1/1"
@change="handleReceivablePlanChange"
placeholder="请选择回款期数" placeholder="请选择回款期数"
@change="handleReceivablePlanChange"
> >
<el-option <el-option
v-for="data in receivablePlanList" v-for="data in receivablePlanList"
:key="data.id" :key="data.id"
:disabled="data.receivableId"
:label="'第 ' + data.period + ' 期'" :label="'第 ' + data.period + ' 期'"
:value="data.id!" :value="data.id!"
:disabled="data.receivableId"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -109,11 +109,11 @@
<el-form-item label="回款金额" prop="price"> <el-form-item label="回款金额" prop="price">
<el-input-number <el-input-number
v-model="formData.price" v-model="formData.price"
:min="0.01"
:precision="2"
class="!w-100%" class="!w-100%"
controls-position="right" controls-position="right"
placeholder="请输入回款金额" placeholder="请输入回款金额"
:min="0.01"
:precision="2"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -145,12 +145,12 @@
<script lang="ts" setup> <script lang="ts" setup>
import * as ReceivablePlanApi from '@/api/crm/receivable/plan' import * as ReceivablePlanApi from '@/api/crm/receivable/plan'
import * as ReceivableApi from '@/api/crm/receivable' import * as ReceivableApi from '@/api/crm/receivable'
import { ReceivableVO } from '@/api/crm/receivable'
import * as UserApi from '@/api/system/user' import * as UserApi from '@/api/system/user'
import * as CustomerApi from '@/api/crm/customer' import * as CustomerApi from '@/api/crm/customer'
import * as ContractApi from '@/api/crm/contract' import * as ContractApi from '@/api/crm/contract'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import form from '@/components/Form/src/Form.vue'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
@ -185,9 +185,10 @@ const open = async (
if (id) { if (id) {
formLoading.value = true formLoading.value = true
try { try {
formData.value = await ReceivableApi.getReceivable(id) const data = (await ReceivableApi.getReceivable(id)) as ReceivableVO
await handleCustomerChange(formData.value.customerId) formData.value = data
formData.value.contractId = formData.value.contract.id await handleCustomerChange(data.customerId!)
formData.value.contractId = data?.contract?.id
} finally { } finally {
formLoading.value = false formLoading.value = false
} }
@ -266,7 +267,7 @@ const handleContractChange = async (contractId: number) => {
// //
receivablePlanList.value = [] receivablePlanList.value = []
receivablePlanList.value = await ReceivablePlanApi.getReceivablePlanSimpleList( receivablePlanList.value = await ReceivablePlanApi.getReceivablePlanSimpleList(
formData.value.customerId, formData.value.customerId!,
contractId contractId
) )
// //

View File

@ -10,7 +10,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="还款期数" prop="period"> <el-form-item label="还款期数" prop="period">
<el-input disabled v-model="formData.period" placeholder="保存时自动生成" /> <el-input v-model="formData.period" disabled placeholder="保存时自动生成" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -38,8 +38,8 @@
:disabled="formType !== 'create'" :disabled="formType !== 'create'"
class="w-1/1" class="w-1/1"
filterable filterable
@change="handleCustomerChange"
placeholder="请选择客户" placeholder="请选择客户"
@change="handleCustomerChange"
> >
<el-option <el-option
v-for="item in customerList" v-for="item in customerList"
@ -74,11 +74,11 @@
<el-form-item label="计划回款金额" prop="price"> <el-form-item label="计划回款金额" prop="price">
<el-input-number <el-input-number
v-model="formData.price" v-model="formData.price"
:min="0.01"
:precision="2"
class="!w-100%" class="!w-100%"
controls-position="right" controls-position="right"
placeholder="请输入计划回款金额" placeholder="请输入计划回款金额"
:min="0.01"
:precision="2"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -136,7 +136,7 @@ import * as CustomerApi from '@/api/crm/customer'
import * as ContractApi from '@/api/crm/contract' import * as ContractApi from '@/api/crm/contract'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { aw } from '../../../../../dist-prod/assets/index-9eac537b' import { cloneDeep } from 'lodash-es'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
@ -167,7 +167,10 @@ const open = async (type: string, id?: number, customerId?: number, contractId?:
if (id) { if (id) {
formLoading.value = true formLoading.value = true
try { try {
formData.value = await ReceivablePlanApi.getReceivablePlan(id) const data = await ReceivablePlanApi.getReceivablePlan(id)
formData.value = cloneDeep(data)
await handleCustomerChange(data.customerId!)
formData.value.contractId = data?.contractId
} finally { } finally {
formLoading.value = false formLoading.value = false
} }