合同变更
parent
912dd110fb
commit
f22127a4ad
|
|
@ -78,6 +78,11 @@ export const getContract = async (id: number) => {
|
|||
return await request.get({ url: `/crm/contract/get?id=` + id })
|
||||
}
|
||||
|
||||
// 查询 CRM 合同详情
|
||||
export const getChangeContract = async (id: number) => {
|
||||
return await request.get({ url: `/crm/contract/getChangeContract?contractChangeId=` + id })
|
||||
}
|
||||
|
||||
// 查询 CRM 合同下拉列表
|
||||
export const getContractSimpleList = async (customerId: number) => {
|
||||
return await request.get({
|
||||
|
|
@ -115,6 +120,11 @@ export const transferContract = async (data: TransferReqVO) => {
|
|||
return await request.put({ url: '/crm/contract/transfer', data })
|
||||
}
|
||||
|
||||
// 合同变更
|
||||
export const changeContract = async (data: TransferReqVO) => {
|
||||
return await request.put({ url: '/crm/contract/changeContract', data })
|
||||
}
|
||||
|
||||
// 获得待审核合同数量
|
||||
export const getAuditContractCount = async () => {
|
||||
return await request.get({ url: '/crm/contract/audit-count' })
|
||||
|
|
|
|||
|
|
@ -636,7 +636,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
|||
component: () => import('@/views/crm/contract/ContractForm.vue')
|
||||
},
|
||||
{
|
||||
path: 'contract/change',
|
||||
path: 'contract/ContractChange',
|
||||
name: 'CrmContractChange',
|
||||
meta: {
|
||||
title: '合同变更',
|
||||
|
|
@ -646,6 +646,18 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
|||
},
|
||||
component: () => import('@/views/crm/contract/ContractChange.vue')
|
||||
},
|
||||
{
|
||||
path: 'contract/detail/ContractChangeDetail',
|
||||
name: 'CrmContractChangeDetail',
|
||||
meta: {
|
||||
title: '合同变更详情',
|
||||
noCache: true,
|
||||
canTo: true,
|
||||
hidden: true,
|
||||
activeMenu: '/crm/contract'
|
||||
},
|
||||
component: () => import('@/views/crm/contract/detail/ContractChangeDetail.vue')
|
||||
},
|
||||
{
|
||||
path: 'contract/detail/index',
|
||||
name: 'CrmContractDetail',
|
||||
|
|
|
|||
|
|
@ -113,13 +113,13 @@ const getCount = () => {
|
|||
(count) => (customerPutPoolRemindCount.value = count)
|
||||
)
|
||||
CustomerApi.getFollowCustomerCount().then((count) => (customerFollowCount.value = count))
|
||||
ClueApi.getFollowClueCount().then((count) => (clueFollowCount.value = count))
|
||||
// ClueApi.getFollowClueCount().then((count) => (clueFollowCount.value = count))
|
||||
ContractApi.getAuditContractCount().then((count) => (contractAuditCount.value = count))
|
||||
ContractApi.getRemindContractCount().then((count) => (contractRemindCount.value = count))
|
||||
ReceivableApi.getAuditReceivableCount().then((count) => (receivableAuditCount.value = count))
|
||||
ReceivablePlanApi.getReceivablePlanRemindCount().then(
|
||||
(count) => (receivablePlanRemindCount.value = count)
|
||||
)
|
||||
// ContractApi.getRemindContractCount().then((count) => (contractRemindCount.value = count))
|
||||
// ReceivableApi.getAuditReceivableCount().then((count) => (receivableAuditCount.value = count))
|
||||
// ReceivablePlanApi.getReceivablePlanRemindCount().then(
|
||||
// (count) => (receivablePlanRemindCount.value = count)
|
||||
// )
|
||||
}
|
||||
|
||||
/** 激活时 */
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ const formData = ref({
|
|||
creditMethod: undefined,
|
||||
creditCalcCycle: undefined,
|
||||
creditLimit: undefined,
|
||||
techSupport: undefined,
|
||||
techSupport: 1,
|
||||
products: []
|
||||
});
|
||||
const formRules = reactive({
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合同状态" prop="quotationId">
|
||||
<el-select v-model="formData.auditStatus" clearable placeholder="请选择合同状态">
|
||||
<el-select v-model="formData.auditStatus" disabled clearable placeholder="请选择合同状态">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value"
|
||||
|
|
@ -62,6 +62,7 @@
|
|||
<el-form-item label="协议截止日期" prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="formData.endTime"
|
||||
disabled
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="请选择协议截止日期"
|
||||
|
|
@ -69,46 +70,45 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="变更项目" prop="endTime">
|
||||
<el-radio-group v-model="formData.radio">
|
||||
<el-radio :value="1">额度</el-radio>
|
||||
<el-radio :value="2">授权人</el-radio>
|
||||
<el-radio :value="3">延期</el-radio>
|
||||
<el-radio :value="4">终止</el-radio>
|
||||
<el-radio :value="5">甲方关联单位</el-radio>
|
||||
<el-radio :value="6">重签</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
变更项目
|
||||
|
||||
<!-- 子表的表单 -->
|
||||
<ContentWrap>
|
||||
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px">
|
||||
<el-tab-pane label="额度" name="limit">
|
||||
<ContractChangeLimit
|
||||
v-if="formData.radio == 1"
|
||||
ref="limitFormRef"
|
||||
:formData="formData"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="授权人" name="product">
|
||||
<ContentWrap style="border: none">
|
||||
甲方现授权人信息
|
||||
</ContentWrap>
|
||||
<ContractAuthPersonInfo
|
||||
ref="personDataRef"
|
||||
:products="formData.contractAAuthorizedPersons"
|
||||
/>
|
||||
<ContentWrap style="border: none">
|
||||
甲方授权人
|
||||
</ContentWrap>
|
||||
<ContractAAuthorizedCompanyForm ref="contractAAuthorizedCompanyFormRef" :contract-id="formData.id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="延期" name="ContracExtension">
|
||||
<ContracExtension ref="contractExtensionFormRef" :formData="formData" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="终止" name="ContractStop">
|
||||
<ContractStop ref="contractStopFormRef" :formData="formData" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="甲方关联单位" name="contractAAuthorizedCompany">
|
||||
<ContractAAuthorizedCompanyForm ref="contractAAuthorizedCompanyFormRef1" :contract-id="formData.id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="重签" name="ContractForm">
|
||||
<ContractForm ref="contractFormRef" :type="1" :formData="formData" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div v-if="formData.radio == 2">
|
||||
<ContentWrap style="border: none">
|
||||
甲方现授权人信息
|
||||
</ContentWrap>
|
||||
<ContractAuthPersonInfo
|
||||
ref="personDataRef"
|
||||
:products="formData.contractAAuthorizedPersons"
|
||||
/>
|
||||
<ContentWrap style="border: none">
|
||||
甲方授权人
|
||||
</ContentWrap>
|
||||
<ContractAAuthorizedCompanyForm ref="contractAAuthorizedCompanyFormRef" :contract-id="formData.id" />
|
||||
</div>
|
||||
<ContracExtension ref="contractExtensionFormRef" v-if="formData.radio == 3" :formData="formData" />
|
||||
<ContractStop ref="contractStopFormRef" :formData="formData" v-if="formData.radio == 4" />
|
||||
<ContractAAuthorizedCompanyForm ref="contractAAuthorizedCompanyFormRef1" v-if="formData.radio == 5" :contract-id="formData.id" />
|
||||
<ContractForm ref="contractFormRef" :type="1" :formData="formData" v-if="formData.radio == 6" />
|
||||
</ContentWrap>
|
||||
</el-form>
|
||||
<div style="text-align: right">
|
||||
|
|
@ -124,7 +124,7 @@ import * as ContractApi from '@/api/crm/contract'
|
|||
import * as ContactApi from '@/api/crm/contact'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import { QuotationApi,QuotationVO } from '@/api/crm/quotation'
|
||||
import { erpPriceMultiply, erpPriceInputFormatter } from '@/utils'
|
||||
import { erpPriceMultiply, erpPriceInputFormatter, jsonParse } from '@/utils'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import ContractChangeLimit from '@/views/crm/contract/components/ContractChangeLimit.vue'
|
||||
import ContractAuthPersonInfo from '@/views/crm/contract/components/ContractAuthPersonInfo.vue'
|
||||
|
|
@ -179,6 +179,7 @@ const formData = ref({
|
|||
partnerCompanyId: undefined,
|
||||
deptId: undefined,
|
||||
quotationTimes: undefined,
|
||||
radio: 1,
|
||||
products: []
|
||||
})
|
||||
const formRules = reactive({
|
||||
|
|
@ -221,7 +222,8 @@ const open = async (type: string) => {
|
|||
if (type) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ContractApi.getContract(type)
|
||||
let data = await ContractApi.getContract(type)
|
||||
formData.value = Object.assign(formData.value, data)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
|
|
@ -244,11 +246,18 @@ const submitForm = async () => {
|
|||
// const Authalid1 = await contractAAuthorizedCompanyFormRef1.value.validate()
|
||||
// if (!Authalid1) return
|
||||
|
||||
// const limitValid = await limitFormRef.value.validate()
|
||||
// if (!limitValid) return
|
||||
if(limitFormRef.value) {
|
||||
const limitValid = await limitFormRef.value.validate()
|
||||
if (!limitValid) return
|
||||
}
|
||||
|
||||
if(contractExtensionFormRef.value) {
|
||||
const extensionValid = await contractExtensionFormRef.value.validate()
|
||||
if (!extensionValid) return
|
||||
|
||||
}
|
||||
|
||||
|
||||
// const stopValid = await contractStopFormRef.value.validate()
|
||||
// if (!stopValid) return
|
||||
|
||||
|
|
@ -262,20 +271,18 @@ const submitForm = async () => {
|
|||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = unref(formData.value) as unknown as ContractApi.ContractVO
|
||||
const data = unref(JSON.parse(JSON.stringify(formData.value))) as unknown as ContractApi.ContractVO
|
||||
// 拼接子表的数据
|
||||
data.contractAAuthorizedCompanys = limitFormRef.value.getData()
|
||||
data.contractAAuthorizedCompanys = contractExtensionFormRef.value.getData()
|
||||
data.contractAAuthorizedCompanys = contractStopFormRef.value.getData()
|
||||
data.contractAAuthorizedCompanys = contractFormRef.value.getData()
|
||||
data.contractAAuthorizedCompanys = contractAAuthorizedCompanyFormRef.value.getData()
|
||||
if (!formType.value ) {
|
||||
await ContractApi.createContract(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await ContractApi.updateContract(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
data.contractId = data.id
|
||||
delete data.id
|
||||
await ContractApi.changeContract(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
|
|
@ -327,6 +334,7 @@ const resetForm = () => {
|
|||
partnerCompanyId: undefined,
|
||||
deptId: undefined,
|
||||
quotationTimes: undefined,
|
||||
radio: 1,
|
||||
products: []
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
|
|
|
|||
|
|
@ -452,9 +452,7 @@ const open = async (type: string) => {
|
|||
if (type) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
console.log('%csrc/views/crm/contract/ContractForm.vue:456 type', 'color: #007acc;', type);
|
||||
formData.value = await ContractApi.getContract(type)
|
||||
console.log('%csrc/views/crm/contract/ContractForm.vue:458 formData.value', 'color: #007acc;', formData.value);
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
<el-date-picker
|
||||
v-model="formData.lastPayDate"
|
||||
type="date"
|
||||
:disabled="!!type"
|
||||
value-format="x"
|
||||
placeholder="请选择终止日期"
|
||||
style="width: 100%"
|
||||
|
|
@ -20,7 +21,7 @@
|
|||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="终止原因" prop="">
|
||||
<el-radio-group v-model="formData.defendantRecord" :disabled="true">
|
||||
<el-radio-group v-model="formData.defendantRecord" :disabled="!!type">
|
||||
<el-radio :label="1">合同到期</el-radio>
|
||||
<el-radio :label="2">甲方违反协议</el-radio>
|
||||
<el-radio :label="3">乙方不可抗力</el-radio>
|
||||
|
|
@ -32,7 +33,7 @@
|
|||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="终止说明" prop="signEmail">
|
||||
<el-input v-model="formData.terminationReason" type="textarea" :row="5" placeholder="必须确保账款已全部回收" />
|
||||
<el-input v-model="formData.terminationReason" :disabled="!!type" type="textarea" :row="5" placeholder="必须确保账款已全部回收" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -50,6 +51,7 @@ import * as CustomerApi from '@/api/crm/customer'
|
|||
import * as UserApi from '@/api/system/user'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
|
||||
/** CRM 方案报价 表单 */
|
||||
defineOptions({ name: 'QuotationForm' })
|
||||
|
|
@ -63,7 +65,9 @@ const businessList = ref([])
|
|||
const deptTree = ref() // 部门树形结构
|
||||
const deptList = ref() // 部门
|
||||
const orgList = ref([])
|
||||
|
||||
const props = defineProps({
|
||||
type: propTypes.string.def('')
|
||||
})
|
||||
const invoiceTemplateList = ref([])
|
||||
const { proxy }: any = getCurrentInstance();
|
||||
|
||||
|
|
|
|||
|
|
@ -58,23 +58,26 @@
|
|||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60">
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60" v-if="!type">
|
||||
<template #default="{ $index }">
|
||||
<el-button @click="handleDelete($index)" link>—</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<el-row justify="center" class="mt-3">
|
||||
<el-row justify="center" class="mt-3" v-if="!type">
|
||||
<el-button @click="handleAdd" round>+ 添加</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
|
||||
const props = defineProps<{
|
||||
contractId: undefined // 合同ID(主表的关联字段)
|
||||
}>()
|
||||
const props = defineProps({
|
||||
contractId: undefined, // 合同ID(主表的关联字段)
|
||||
type: propTypes.string.def('')
|
||||
|
||||
})
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formData = ref([])
|
||||
const formRules = reactive({
|
||||
|
|
|
|||
|
|
@ -65,14 +65,14 @@
|
|||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60">
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60" v-if="!type">
|
||||
<template #default="{ $index }">
|
||||
<el-button @click="handleDelete($index)" link>—</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<el-row justify="center" class="mt-3">
|
||||
<el-row justify="center" class="mt-3" v-if="!type">
|
||||
<el-button @click="handleAdd" round>+ 添加</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
|
|
@ -81,7 +81,8 @@ import * as ContractApi from '@/api/crm/contract'
|
|||
import { getIntDictOptions, getStrDictOptions, DICT_TYPE, getBoolDictOptions } from '@/utils/dict'
|
||||
|
||||
const props = defineProps<{
|
||||
contractId: undefined // 合同ID(主表的关联字段)
|
||||
contractId: undefined, // 合同ID(主表的关联字段)
|
||||
type: undefined
|
||||
}>()
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formData = ref([])
|
||||
|
|
|
|||
|
|
@ -79,14 +79,14 @@
|
|||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60">
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60" v-if="!type">
|
||||
<template #default="{ $index }">
|
||||
<el-button @click="handleDelete($index)" link>—</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form>
|
||||
<el-row justify="center" class="mt-3">
|
||||
<el-row justify="center" class="mt-3" v-if="!type">
|
||||
<el-button @click="handleAdd" round>+ 添加</el-button>
|
||||
</el-row>
|
||||
</template>
|
||||
|
|
@ -95,7 +95,8 @@ import * as ContractApi from '@/api/crm/contract'
|
|||
import { getIntDictOptions, getStrDictOptions, DICT_TYPE, getBoolDictOptions } from '@/utils/dict'
|
||||
|
||||
const props = defineProps<{
|
||||
contractId: undefined // 合同ID(主表的关联字段)
|
||||
contractId: undefined, // 合同ID(主表的关联字段)
|
||||
type: undefined
|
||||
}>()
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formData = ref([])
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<template>
|
||||
<ContentWrap class="mt-10px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
|
|
@ -10,7 +9,7 @@
|
|||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合作类型" prop="cooperationType">
|
||||
<el-select v-model="formData.cooperationType" filterable placeholder="请选择合作类型" class="w-1/1">
|
||||
<el-select v-model="formData.cooperationType" disabled filterable placeholder="请选择合作类型" class="w-1/1">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_COOPERATION_TYPE)"
|
||||
:key="dict.value"
|
||||
|
|
@ -27,7 +26,7 @@
|
|||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="上市情况" prop="customerId">
|
||||
<el-select v-model="formData.customerId" placeholder="请选择上市情况" @change="onCustomerChange">
|
||||
<el-select v-model="formData.customerId" placeholder="请选择上市情况" disabled @change="onCustomerChange">
|
||||
<el-option
|
||||
v-for="item in customerList"
|
||||
:key="item.id"
|
||||
|
|
@ -44,7 +43,7 @@
|
|||
</el-col> -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="融资信息" prop="companyType">
|
||||
<el-select v-model="formData.customerId" placeholder="请选择融资信息" @change="onCustomerChange">
|
||||
<el-select v-model="formData.customerId" placeholder="请选择融资信息" disabled @change="onCustomerChange">
|
||||
<el-option
|
||||
v-for="item in customerList"
|
||||
:key="item.id"
|
||||
|
|
@ -119,17 +118,17 @@
|
|||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="初始额度" prop="signPhoneNumber">
|
||||
<el-input v-model="formData.signPhoneNumber" placeholder="请输入初始额度" />
|
||||
<el-input v-model="formData.signPhoneNumber" placeholder="请输入初始额度" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="目前额度" prop="beforeAmount">
|
||||
<el-input v-model="formData.beforeAmount" placeholder="请输入目前额度" />
|
||||
<el-input v-model="formData.beforeAmount" placeholder="请输入目前额度" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="签约主体" prop="signWechat">
|
||||
<el-select v-model="formData.partnerCompanyId" placeholder="请选择签约主体" @change="onPartnerChange">
|
||||
<el-select v-model="formData.partnerCompanyId" disabled placeholder="请选择签约主体" @change="onPartnerChange">
|
||||
<el-option
|
||||
v-for="dict in orgList"
|
||||
:key="dict.id"
|
||||
|
|
@ -141,12 +140,12 @@
|
|||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="调整金额(元)" prop="changeAmount">
|
||||
<el-input v-model="formData.changeAmount" placeholder="请输入调整金额(元)" />
|
||||
<el-input v-model="formData.changeAmount" :disabled="!!type" placeholder="请输入调整金额(元)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="最终额度" prop="afterAmount">
|
||||
<el-input v-model="formData.afterAmount" placeholder="请输入最终额度" />
|
||||
<el-input v-model="formData.afterAmount" :disabled="!!type" placeholder="请输入最终额度" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
|
@ -154,6 +153,7 @@
|
|||
<el-date-picker
|
||||
v-model="formData.lastPayDate"
|
||||
type="date"
|
||||
:disabled="!!type"
|
||||
value-format="x"
|
||||
placeholder="请选择调整金额截止日期"
|
||||
style="width: 100%"
|
||||
|
|
@ -162,14 +162,13 @@
|
|||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="调额说明" prop="note">
|
||||
<el-input v-model="formData.note" type="textarea" :row="5" placeholder="请输入调额说明" />
|
||||
<el-input v-model="formData.note" type="textarea" :disabled="!!type" :row="5" placeholder="请输入调额说明" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!-- 子表的表单 -->
|
||||
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
|
|
@ -181,6 +180,7 @@ import * as CustomerApi from '@/api/crm/customer'
|
|||
import * as UserApi from '@/api/system/user'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
|
||||
/** CRM 方案报价 表单 */
|
||||
defineOptions({ name: 'QuotationForm' })
|
||||
|
|
@ -262,6 +262,9 @@ const formRef = ref() // 表单 Ref
|
|||
const subTabsName = ref('quotationProduct')
|
||||
const quotationProductFormRef = ref()
|
||||
|
||||
const props = defineProps({
|
||||
type: propTypes.string.def('')
|
||||
})
|
||||
const onBusinessChange = async (businessId: string) => {
|
||||
if (!businessId) return
|
||||
try {
|
||||
|
|
@ -349,7 +352,6 @@ const open = async (type: string) => {
|
|||
|
||||
/** 表单校验 */
|
||||
const validate = () => {
|
||||
console.log('%csrc/views/crm/contract/components/ContractChangeLimit.vue:352 object', 'color: #007acc;', formRef.value.validate());
|
||||
return formRef.value.validate()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
<template>
|
||||
<ContentWrap class="mt-10px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
|
|
@ -10,7 +9,7 @@
|
|||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合作类型" prop="cooperationType">
|
||||
<el-select v-model="formData.cooperationType" filterable placeholder="请选择合作类型" class="w-1/1">
|
||||
<el-select v-model="formData.cooperationType" :disabled="!!type" filterable placeholder="请选择合作类型" class="w-1/1">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_COOPERATION_TYPE)"
|
||||
:key="dict.value"
|
||||
|
|
@ -30,7 +29,7 @@
|
|||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="上市情况" prop="customerId">
|
||||
<el-select v-model="formData.customerId" placeholder="请选择上市情况" @change="onCustomerChange">
|
||||
<el-select v-model="formData.customerId" :disabled="!!type" placeholder="请选择上市情况" @change="onCustomerChange">
|
||||
<el-option
|
||||
v-for="item in customerList"
|
||||
:key="item.id"
|
||||
|
|
@ -47,7 +46,7 @@
|
|||
</el-col> -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="融资信息" prop="companyType">
|
||||
<el-select v-model="formData.customerId" placeholder="请选择融资信息" @change="onCustomerChange">
|
||||
<el-select v-model="formData.customerId" :disabled="!!type" placeholder="请选择融资信息" @change="onCustomerChange">
|
||||
<el-option
|
||||
v-for="item in customerList"
|
||||
:key="item.id"
|
||||
|
|
@ -123,6 +122,7 @@
|
|||
<el-col :span="8">
|
||||
<el-form-item label="协议截止日" prop="agreementDeadline">
|
||||
<el-date-picker
|
||||
:disabled="!!type"
|
||||
v-model="formData.lastPayDate"
|
||||
type="date"
|
||||
value-format="x"
|
||||
|
|
@ -133,13 +133,14 @@
|
|||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="顺延年限" prop="extensionYears">
|
||||
<el-input v-model="formData.extensionYears" placeholder="请输入顺延年限" />
|
||||
<el-input v-model="formData.extensionYears" :disabled="!!type" placeholder="请输入顺延年限" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="调整金额截止日期" prop="establishmentDate">
|
||||
<el-date-picker
|
||||
v-model="formData.lastPayDate"
|
||||
:disabled="!!type"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="调整金额截止日期"
|
||||
|
|
@ -149,14 +150,13 @@
|
|||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="延期说明" prop="signEmail">
|
||||
<el-input v-model="formData.signEmail" type="textarea" :row="5" placeholder="请输入延期说明" />
|
||||
<el-input v-model="formData.signEmail" :disabled="!!type" type="textarea" :row="5" placeholder="请输入延期说明" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!-- 子表的表单 -->
|
||||
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, getStrDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
|
|
@ -168,6 +168,7 @@ import * as CustomerApi from '@/api/crm/customer'
|
|||
import * as UserApi from '@/api/system/user'
|
||||
import * as DeptApi from '@/api/system/dept'
|
||||
import * as BusinessApi from '@/api/crm/business'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
|
||||
/** CRM 方案报价 表单 */
|
||||
defineOptions({ name: 'QuotationForm' })
|
||||
|
|
@ -181,7 +182,9 @@ const businessList = ref([])
|
|||
const deptTree = ref() // 部门树形结构
|
||||
const deptList = ref() // 部门
|
||||
const orgList = ref([])
|
||||
|
||||
const props = defineProps({
|
||||
type: propTypes.string.def('')
|
||||
})
|
||||
const invoiceTemplateList = ref([])
|
||||
const { proxy }: any = getCurrentInstance();
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@
|
|||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60">
|
||||
<el-table-column align="center" fixed="right" label="操作" width="60" v-if="!type">
|
||||
<template #default="{ $index }">
|
||||
<el-button @click="handleDelete($index)" link>—</el-button>
|
||||
</template>
|
||||
|
|
@ -109,7 +109,8 @@ import { DICT_TYPE } from '@/utils/dict'
|
|||
|
||||
const props = defineProps<{
|
||||
products: undefined
|
||||
disabled: false
|
||||
disabled: false,
|
||||
type: undefined
|
||||
}>()
|
||||
const formLoading = ref(false) // 表单的加载中
|
||||
const formData = ref([])
|
||||
|
|
@ -167,6 +168,7 @@ defineExpose({ validate })
|
|||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
console.log('%csrc/views/crm/contract/components/ContractProductForm.vue:171 props.type', 'color: #007acc;', props.type);
|
||||
productList.value = await ProductApi.getProductSimpleList()
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -112,7 +112,6 @@ const exportLoading = ref(false) // 导出的加载中
|
|||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
console.log('%csrc/views/crm/contract/components/QuotationList.vue:112 props.bizId', 'color: #007acc;', props.bizId);
|
||||
queryParams.customerId = props.bizId
|
||||
const data = await QuotationApi.getQuotationPage(queryParams)
|
||||
list.value = data.list
|
||||
|
|
|
|||
|
|
@ -0,0 +1,429 @@
|
|||
<template>
|
||||
<ContentWrap class="mt-10px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-row>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="合同查询" prop="quotationId">
|
||||
<el-select
|
||||
@change="handleQuotationChange"
|
||||
v-model="formData.quotationId"
|
||||
class="w-1/1"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in quotationList"
|
||||
:key="item.id"
|
||||
:label="item.no"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="客户名称" prop="customerId">
|
||||
<el-select
|
||||
v-model="formData.customerId"
|
||||
disabled=""
|
||||
placeholder="请选择客户"
|
||||
class="w-1/1"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in contactList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="协议编码" prop="name">
|
||||
<el-input v-model="formData.processInstanceId" disabled placeholder="协议编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合同状态" prop="quotationId">
|
||||
<el-select v-model="formData.auditStatus" disabled clearable placeholder="请选择合同状态">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="协议截止日期" prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="formData.endTime"
|
||||
disabled
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="请选择协议截止日期"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="变更项目" prop="endTime">
|
||||
<el-radio-group v-model="formData.radio">
|
||||
<el-radio :value="1">额度</el-radio>
|
||||
<el-radio :value="2">授权人</el-radio>
|
||||
<el-radio :value="3">延期</el-radio>
|
||||
<el-radio :value="4">终止</el-radio>
|
||||
<el-radio :value="5">甲方关联单位</el-radio>
|
||||
<el-radio :value="6">重签</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
<!-- 子表的表单 -->
|
||||
<ContentWrap>
|
||||
<ContractChangeLimit
|
||||
v-if="formData.radio == 1"
|
||||
:type="1"
|
||||
ref="limitFormRef"
|
||||
:formData="formData"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
<div v-if="formData.radio == 2">
|
||||
<ContentWrap style="border: none">
|
||||
甲方现授权人信息
|
||||
</ContentWrap>
|
||||
<ContractAuthPersonInfo
|
||||
ref="personDataRef"
|
||||
:products="formData.contractAAuthorizedPersons"
|
||||
/>
|
||||
<!-- <ContentWrap style="border: none">
|
||||
甲方授权人
|
||||
</ContentWrap>
|
||||
<ContractAAuthorizedCompanyForm ref="contractAAuthorizedCompanyFormRef" :contract-id="formData.id" /> -->
|
||||
</div>
|
||||
<ContracExtension ref="contractExtensionFormRef" :type="1" :formData="formData" v-if="formData.radio == 3" />
|
||||
<ContractStop ref="contractStopFormRef" :type="1" :formData="formData" v-if="formData.radio == 4" />
|
||||
<ContractAAuthorizedCompanyForm :type="1" ref="contractAAuthorizedCompanyFormRef1" v-if="formData.radio == 5" :contract-id="formData.id" />
|
||||
<ContractForm ref="contractFormRef" :type="1" :id="formType" :formData="formData" v-if="formData.radio == 6" />
|
||||
</el-tabs>
|
||||
</ContentWrap>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import * as ContactApi from '@/api/crm/contact'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import { QuotationApi,QuotationVO } from '@/api/crm/quotation'
|
||||
import { erpPriceMultiply, erpPriceInputFormatter, jsonParse } from '@/utils'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import ContractChangeLimit from '@/views/crm/contract/components/ContractChangeLimit.vue'
|
||||
import ContractAuthPersonInfo from '@/views/crm/contract/components/ContractAuthPersonInfo.vue'
|
||||
import ContracExtension from '@/views/crm/contract/components/ContractExtension.vue'
|
||||
import ContractStop from '@/views/crm/contract/components/ContracStop.vue'
|
||||
import ContractProductForm from '@/views/crm/contract/components/ContractProductForm.vue'
|
||||
import ContractAAuthorizedCompanyForm from '../components/ContractAAuthorizedCompanyForm.vue'
|
||||
import ContractForm from './ContractDetail.vue'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { proxy }: any = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
id: propTypes.number.def(undefined)
|
||||
})
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
authPerson: [],
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
no: undefined,
|
||||
customerId: undefined,
|
||||
quotationId: undefined,
|
||||
invoiceTemplateId: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
penaltyRate: undefined,
|
||||
latePaymentRate: undefined,
|
||||
settleMethod: undefined,
|
||||
lastPayDate: undefined,
|
||||
contractTerm: undefined,
|
||||
signUserId: undefined,
|
||||
signPhoneNumber: undefined,
|
||||
signEmail: undefined,
|
||||
signWechat: undefined,
|
||||
offlinePrice: undefined,
|
||||
onlinePrice: undefined,
|
||||
ownerUserId: undefined,
|
||||
expanderUserId: undefined,
|
||||
pricingUserId: undefined,
|
||||
afterSaleUserId: undefined,
|
||||
collUserId: undefined,
|
||||
totalPrice: undefined,
|
||||
contractBody: undefined,
|
||||
contractAgreement: undefined,
|
||||
creditMethod: undefined,
|
||||
creditCalcCycle: undefined,
|
||||
creditLimit: undefined,
|
||||
partnerCompanyId: undefined,
|
||||
deptId: undefined,
|
||||
quotationTimes: undefined,
|
||||
products: []
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }],
|
||||
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
|
||||
orderDate: [{ required: true, message: '下单日期不能为空', trigger: 'blur' }],
|
||||
ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
const customerList = ref([]) // 客户列表的数据
|
||||
const quotationList = ref<QuotationVO[]>([])
|
||||
const contactList = ref<ContactApi.ContactVO[]>([])
|
||||
|
||||
/** 子表的表单 */
|
||||
const subTabsName = ref('limit')
|
||||
const contractAAuthorizedCompanyFormRef = ref()
|
||||
const contractAAuthorizedCompanyFormRef1 = ref()
|
||||
const limitFormRef = ref()
|
||||
const contractExtensionFormRef = ref()
|
||||
const contractStopFormRef = ref()
|
||||
const contractFormRef = ref()
|
||||
|
||||
/** 计算 discountPrice、totalPrice 价格 */
|
||||
watch(
|
||||
() => formData.value,
|
||||
(val) => {
|
||||
if (!val) {
|
||||
return
|
||||
}
|
||||
// const totalPrice = val.products.reduce((prev, curr) => prev + curr.totalPrice, 0)
|
||||
// 赋值
|
||||
// formData.value.totalPrice = totalPrice
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string) => {
|
||||
if (type) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ContractApi.getChangeContract(type)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
|
||||
// const Authalid = await contractAAuthorizedCompanyFormRef.value.validate()
|
||||
// if (!Authalid) return
|
||||
|
||||
// const Authalid1 = await contractAAuthorizedCompanyFormRef1.value.validate()
|
||||
// if (!Authalid1) return
|
||||
|
||||
// const limitValid = await limitFormRef.value.validate()
|
||||
// if (!limitValid) return
|
||||
// const extensionValid = await contractExtensionFormRef.value.validate()
|
||||
// if (!extensionValid) return
|
||||
|
||||
// const stopValid = await contractStopFormRef.value.validate()
|
||||
// if (!stopValid) return
|
||||
|
||||
// const contractValid = await contractFormRef.value.validate()
|
||||
// if (!contractValid) return
|
||||
|
||||
|
||||
// console.log('%csrc/views/crm/contract/ContractChange.vue:247 123', 'color: #007acc;', extensionValid,123);
|
||||
// return
|
||||
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = unref(JSON.parse(JSON.stringify(formData.value))) as unknown as ContractApi.ContractVO
|
||||
// 拼接子表的数据
|
||||
data.contractAAuthorizedCompanys = limitFormRef.value.getData()
|
||||
data.contractAAuthorizedCompanys = contractExtensionFormRef.value.getData()
|
||||
data.contractAAuthorizedCompanys = contractStopFormRef.value.getData()
|
||||
data.contractAAuthorizedCompanys = contractFormRef.value.getData()
|
||||
data.contractAAuthorizedCompanys = contractAAuthorizedCompanyFormRef.value.getData()
|
||||
data.contractId = data.id
|
||||
delete data.id
|
||||
await ContractApi.changeContract(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
goBack()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const goBack = ()=> {
|
||||
proxy.$router.go(-1)
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
no: undefined,
|
||||
customerId: undefined,
|
||||
quotationId: undefined,
|
||||
invoiceTemplateId: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
penaltyRate: undefined,
|
||||
latePaymentRate: undefined,
|
||||
settleMethod: undefined,
|
||||
lastPayDate: undefined,
|
||||
contractTerm: undefined,
|
||||
signUserId: undefined,
|
||||
signPhoneNumber: undefined,
|
||||
signEmail: undefined,
|
||||
signWechat: undefined,
|
||||
offlinePrice: undefined,
|
||||
onlinePrice: undefined,
|
||||
ownerUserId: undefined,
|
||||
expanderUserId: undefined,
|
||||
pricingUserId: undefined,
|
||||
afterSaleUserId: undefined,
|
||||
collUserId: undefined,
|
||||
totalPrice: undefined,
|
||||
contractBody: undefined,
|
||||
contractAgreement: undefined,
|
||||
creditMethod: undefined,
|
||||
creditCalcCycle: undefined,
|
||||
creditLimit: undefined,
|
||||
partnerCompanyId: undefined,
|
||||
deptId: undefined,
|
||||
quotationTimes: undefined,
|
||||
products: []
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
|
||||
/** 处理商机变化 */
|
||||
const handleQuotationChange = async (quotationId: number) => {
|
||||
if (!quotationId) return
|
||||
try {
|
||||
const quotation = await QuotationApi.getQuotation(quotationId)
|
||||
formData.value.products = quotation.products;
|
||||
formData.value.customerId = quotation.customerId;
|
||||
|
||||
formData.value.invoiceTemplateId = quotation.invoiceTemplateId;
|
||||
|
||||
formData.value.ownerUserId = quotation.ownerUserId;
|
||||
formData.value.expanderUserId = quotation.expanderUserId;
|
||||
formData.value.pricingUserId = quotation.pricingUserId;
|
||||
formData.value.signUserId = quotation.signUserId;
|
||||
formData.value.signPhoneNumber = quotation.signPhoneNumber;
|
||||
formData.value.signEmail = quotation.signEmail;
|
||||
formData.value.signWechat = quotation.signWechat;
|
||||
|
||||
formData.value.partnerCompanyId = quotation.partnerCompanyId;
|
||||
|
||||
formData.value.creditLimit = quotation.creditLimit;
|
||||
formData.value.creditMethod = quotation.creditMethod;
|
||||
formData.value.creditCalcCycle = quotation.creditCalcCycle;
|
||||
|
||||
formData.value.deptId = quotation.deptId;
|
||||
formData.value.offlinePrice = quotation.offlinePrice;
|
||||
formData.value.onlinePrice = quotation.onlinePrice;
|
||||
formData.value.totalPrice = quotation.totalPrice;
|
||||
|
||||
// 🔁 自动加载客户详情
|
||||
await onCustomerChange(quotation.customerId);
|
||||
} catch (err) {
|
||||
} finally {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const onCustomerChange = async (customerId: string) => {
|
||||
if (!customerId) return;
|
||||
|
||||
try {
|
||||
formLoading.value = true;
|
||||
const customerRes = await CustomerApi.getCustomer(customerId);
|
||||
formData.value.cooperationType = customerRes.cooperationType;
|
||||
formData.value.companyType = customerRes.companyType;
|
||||
formData.value.listingStatus = customerRes.listingStatus;
|
||||
formData.value.financingInfo = customerRes.financingInfo;
|
||||
formData.value.paidInCapital = customerRes.paidInCapital;
|
||||
formData.value.insuredCount = customerRes.insuredCount;
|
||||
formData.value.establishmentDate = customerRes.establishmentDate;
|
||||
formData.value.enterpriseType = customerRes.enterpriseType;
|
||||
formData.value.businessStatus = customerRes.businessStatus;
|
||||
formData.value.defendantRecord = customerRes.defendantRecord;
|
||||
formData.value.businessAbnormal = customerRes.businessAbnormal;
|
||||
formData.value.equityPledge = customerRes.equityPledge;
|
||||
formData.value.dishonestRecord = customerRes.dishonestRecord;
|
||||
formData.value.financingRecord = customerRes.financingRecord;
|
||||
formData.value.enforcementRecord = customerRes.enforcementRecord;
|
||||
} catch (err) {
|
||||
console.error('获取客户详情失败:', err);
|
||||
} finally {
|
||||
formLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 动态获取客户联系人 */
|
||||
const getContactOptions = computed(() =>
|
||||
contactList.value.filter((item) => item.customerId == formData.value.customerId)
|
||||
)
|
||||
|
||||
const route = useRoute();
|
||||
onBeforeMount(async () => {
|
||||
console.log('%csrc/views/crm/contract/detail/ContractChangeDetail.vue:409 props.id,route.query.id', 'color: #007acc;', props.id,route.query.id);
|
||||
formType.value = props.id || route.query.id;
|
||||
|
||||
if (formType.value) open(formType.value)
|
||||
|
||||
// 获得客户列表
|
||||
customerList.value = await CustomerApi.getCustomerSimpleList()
|
||||
// 获得用户列表
|
||||
userOptions.value = await UserApi.getSimpleUserList()
|
||||
// 获得报价列表
|
||||
quotationList.value = await QuotationApi.getSimpleQuotationList()
|
||||
|
||||
// 默认新建时选中自己
|
||||
// if (formType.value === 'create') {
|
||||
// formData.value.ownerUserId = useUserStore().getUser.id
|
||||
// }
|
||||
// 获取联系人
|
||||
contactList.value = await ContactApi.getSimpleContactList()
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,652 @@
|
|||
<template>
|
||||
<ContentWrap class="mt-10px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
v-loading="formLoading"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-row>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合同名称" prop="name">
|
||||
<el-input v-model="formData.name" disabled placeholder="请输入合同名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" v-if="formType">
|
||||
<el-form-item label="合同编号" prop="no">
|
||||
<el-input v-model="formData.no" disabled placeholder="请输入合同编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="报价单编号" prop="quotationId">
|
||||
<el-select
|
||||
disabled
|
||||
@change="handleQuotationChange"
|
||||
v-model="formData.quotationId"
|
||||
class="w-1/1"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in quotationList"
|
||||
:key="item.id"
|
||||
:label="item.no"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="客户名称" prop="customerId">
|
||||
<el-select
|
||||
v-model="formData.customerId"
|
||||
disabled=""
|
||||
placeholder="请选择客户"
|
||||
class="w-1/1"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in contactList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合同签订日期" prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="formData.startTime"
|
||||
type="date"
|
||||
disabled
|
||||
value-format="x"
|
||||
placeholder="选择合同签订日期"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合同结束时间" prop="endTime">
|
||||
<el-date-picker
|
||||
v-model="formData.endTime"
|
||||
type="date"
|
||||
disabled
|
||||
value-format="x"
|
||||
placeholder="选择合同结束时间"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="票据模板" prop="invoiceTemplateId">
|
||||
<el-input v-model="formData.invoiceTemplateId" placeholder="请输入票据模板" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="违约金比例" prop="penaltyRate">
|
||||
<el-input v-model="formData.penaltyRate" disabled placeholder="请输入违约金比例" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="延期付款利率" prop="latePaymentRate">
|
||||
<el-input v-model="formData.latePaymentRate" disabled placeholder="请输入延期付款利率" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="财务结算方式" prop="settleMethod">
|
||||
<el-select v-model="formData.settleMethod" disabled placeholder="请选择财务结算方式">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions('settle_method')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="最晚付款日期" prop="lastPayDate">
|
||||
<el-date-picker
|
||||
v-model="formData.lastPayDate"
|
||||
type="date"
|
||||
disabled
|
||||
value-format="x"
|
||||
style="width: 100%"
|
||||
placeholder="选择最晚付款日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合同期限(月)" prop="contractTerm">
|
||||
<el-input v-model="formData.contractTerm" disabled placeholder="请输入合同期限(月)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="报价签约人" prop="signUserId">
|
||||
<el-select v-model="formData.signUserId" placeholder="请选择报价签约人" disabled >
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="签约人联系电话" prop="signPhoneNumber">
|
||||
<el-input v-model="formData.signPhoneNumber" placeholder="请输入签约人联系电话" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="签约人Email" prop="signEmail">
|
||||
<el-input v-model="formData.signEmail" placeholder="请输入签约人Email" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="签约人微信" prop="signWechat">
|
||||
<el-input v-model="formData.signWechat" placeholder="请输入签约人微信" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="商机负责人" prop="ownerUserId">
|
||||
<el-select v-model="formData.ownerUserId" placeholder="请选择商机负责人" disabled>
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="拓展人" prop="expanderUserId">
|
||||
<el-select v-model="formData.expanderUserId" placeholder="请选择拓展人" disabled>
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="方案报价人" prop="pricingUserId">
|
||||
<el-select v-model="formData.pricingUserId" placeholder="请选择方案报价人" disabled>
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="售后维护人" prop="afterSaleUserId">
|
||||
<el-select v-model="formData.afterSaleUserId" disabled placeholder="请选择售后维护人">
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="协作人" prop="collUserId">
|
||||
<el-select v-model="formData.collUserId" disabled placeholder="请选择协作人">
|
||||
<el-option
|
||||
v-for="dict in userOptions"
|
||||
:key="dict.id"
|
||||
:label="dict.nickname"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="授信方式" prop="creditMethod" >
|
||||
<el-select v-model="formData.creditMethod" placeholder="请选择授信方式" disabled>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions('credit_method')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="授信计算周期" prop="creditCalcCycle" >
|
||||
<el-select v-model="formData.creditCalcCycle" placeholder="请选择授信计算周期" disabled>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions('credit_calc_cycle')"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="授信额度" prop="creditLimit">
|
||||
<el-input v-model="formData.creditLimit" placeholder="请输入授信额度" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="合作主体" prop="partnerCompanyId">
|
||||
<el-select v-model="formData.partnerCompanyId" placeholder="请选择合作主体" disabled >
|
||||
<el-option
|
||||
v-for="dict in orgList"
|
||||
:key="dict.id"
|
||||
:label="dict.name"
|
||||
:value="dict.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="归属部门" prop="deptId" >
|
||||
<el-tree-select
|
||||
v-model="formData.deptId"
|
||||
:data="deptTree"
|
||||
:props="defaultProps"
|
||||
filterable
|
||||
disabled
|
||||
check-strictly
|
||||
node-key="id"
|
||||
placeholder="请选择归属部门"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="第几次报价" prop="quotationTimes">
|
||||
<el-input v-model="formData.quotationTimes" disabled placeholder="请输入第几次报价" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="合同正文" prop="contractBody">
|
||||
<el-input v-model="formData.contractBody" type="textarea" row="5" disabled placeholder="请输入合同正文" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="合同补充协议" prop="contractAgreement">
|
||||
<el-input v-model="formData.contractAgreement" type="textarea" row="5" disabled placeholder="请输入合同补充协议" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="线上总金额" prop="onlinePrice">
|
||||
<el-input
|
||||
disabled
|
||||
v-model="formData.onlinePrice"
|
||||
placeholder="请输入线上总金额,单位:元"
|
||||
:formatter="erpPriceInputFormatter"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="线下总金额" prop="offlinePrice">
|
||||
<el-input
|
||||
disabled
|
||||
v-model="formData.offlinePrice"
|
||||
placeholder="请输入线下总金额,单位:元"
|
||||
:formatter="erpPriceInputFormatter"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="总金额" prop="price">
|
||||
<el-input
|
||||
disabled
|
||||
v-model="formData.totalPrice"
|
||||
:formatter="erpPriceInputFormatter"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 子表的表单 -->
|
||||
<ContentWrap>
|
||||
<el-tabs v-model="subTabsName" class="-mt-15px -mb-10px">
|
||||
<el-tab-pane label="产品清单" name="product">
|
||||
<ContractProductForm
|
||||
ref="productFormRef"
|
||||
:type="1"
|
||||
:products="formData.products"
|
||||
:disabled="disabled"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="合同甲方关联单位" name="contractAAuthorizedCompany">
|
||||
<ContractAAuthorizedCompanyForm :type="1" ref="contractAAuthorizedCompanyFormRef" :contract-id="formData.id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="合同甲方授权人信息" name="contractAAuthorizedPerson">
|
||||
<ContractAAuthorizedPersonForm :type="1" ref="contractAAuthorizedPersonFormRef" :contract-id="formData.id" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="合同乙方授权人信息" name="contractBAuthorizedPerson">
|
||||
<ContractBAuthorizedPersonForm :type="1" ref="contractBAuthorizedPersonFormRef" :contract-id="formData.id" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</ContentWrap>
|
||||
</el-form>
|
||||
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import * as CustomerApi from '@/api/crm/customer'
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import * as ContactApi from '@/api/crm/contact'
|
||||
import * as UserApi from '@/api/system/user'
|
||||
import { QuotationApi,QuotationVO } from '@/api/crm/quotation'
|
||||
import { erpPriceMultiply, erpPriceInputFormatter } from '@/utils'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import ContractProductForm from '@/views/crm/contract/components/ContractProductForm.vue'
|
||||
import ContractAAuthorizedCompanyForm from '../components/ContractAAuthorizedCompanyForm.vue'
|
||||
import ContractAAuthorizedPersonForm from '../components/ContractAAuthorizedPersonForm.vue'
|
||||
import ContractBAuthorizedPersonForm from '../components/ContractBAuthorizedPersonForm.vue'
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { proxy }: any = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
id: propTypes.number.def(undefined),
|
||||
type: propTypes.number.def(undefined),
|
||||
})
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
no: undefined,
|
||||
customerId: undefined,
|
||||
quotationId: undefined,
|
||||
invoiceTemplateId: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
penaltyRate: undefined,
|
||||
latePaymentRate: undefined,
|
||||
settleMethod: undefined,
|
||||
lastPayDate: undefined,
|
||||
contractTerm: undefined,
|
||||
signUserId: undefined,
|
||||
signPhoneNumber: undefined,
|
||||
signEmail: undefined,
|
||||
signWechat: undefined,
|
||||
offlinePrice: undefined,
|
||||
onlinePrice: undefined,
|
||||
ownerUserId: undefined,
|
||||
expanderUserId: undefined,
|
||||
pricingUserId: undefined,
|
||||
afterSaleUserId: undefined,
|
||||
collUserId: undefined,
|
||||
totalPrice: undefined,
|
||||
contractBody: undefined,
|
||||
contractAgreement: undefined,
|
||||
creditMethod: undefined,
|
||||
creditCalcCycle: undefined,
|
||||
creditLimit: undefined,
|
||||
partnerCompanyId: undefined,
|
||||
deptId: undefined,
|
||||
quotationTimes: undefined,
|
||||
products: []
|
||||
})
|
||||
const formRules = reactive({
|
||||
name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }],
|
||||
customerId: [{ required: true, message: '客户不能为空', trigger: 'blur' }],
|
||||
orderDate: [{ required: true, message: '下单日期不能为空', trigger: 'blur' }],
|
||||
ownerUserId: [{ required: true, message: '负责人不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const userOptions = ref<UserApi.UserVO[]>([]) // 用户列表
|
||||
const customerList = ref([]) // 客户列表的数据
|
||||
const quotationList = ref<QuotationVO[]>([])
|
||||
const contactList = ref<ContactApi.ContactVO[]>([])
|
||||
const orgList = ref([])
|
||||
|
||||
/** 子表的表单 */
|
||||
const subTabsName = ref('product')
|
||||
const productFormRef = ref()
|
||||
const contractAAuthorizedCompanyFormRef = ref()
|
||||
const contractAAuthorizedPersonFormRef = ref()
|
||||
const contractBAuthorizedPersonFormRef = ref()
|
||||
|
||||
/** 计算 discountPrice、totalPrice 价格 */
|
||||
watch(
|
||||
() => formData.value,
|
||||
(val) => {
|
||||
if (!val) {
|
||||
return
|
||||
}
|
||||
// const totalPrice = val.products.reduce((prev, curr) => prev + curr.totalPrice, 0)
|
||||
// 赋值
|
||||
// formData.value.totalPrice = totalPrice
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string) => {
|
||||
if (type) {
|
||||
// formLoading.value = true
|
||||
try {
|
||||
formData.value = await ContractApi.getContract(type)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/** 表单校验 */
|
||||
const validate = () => {
|
||||
return formRef.value.validate()
|
||||
}
|
||||
|
||||
/** 表单值 */
|
||||
const getData = () => {
|
||||
return formData.value
|
||||
}
|
||||
defineExpose({ open, validate, getData }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
productFormRef.value.validate()
|
||||
try {
|
||||
const data = unref(formData.value) as unknown as ContractApi.ContractVO
|
||||
// 拼接子表的数据
|
||||
data.contractAAuthorizedCompanys = contractAAuthorizedCompanyFormRef.value.getData()
|
||||
data.contractAAuthorizedPersons = contractAAuthorizedPersonFormRef.value.getData()
|
||||
data.contractBAuthorizedPersons = contractBAuthorizedPersonFormRef.value.getData()
|
||||
if (!formType.value ) {
|
||||
await ContractApi.createContract(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await ContractApi.updateContract(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
goBack()
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const goBack = ()=> {
|
||||
proxy.$router.go(-1)
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
no: undefined,
|
||||
customerId: undefined,
|
||||
quotationId: undefined,
|
||||
invoiceTemplateId: undefined,
|
||||
processInstanceId: undefined,
|
||||
auditStatus: undefined,
|
||||
startTime: undefined,
|
||||
endTime: undefined,
|
||||
penaltyRate: undefined,
|
||||
latePaymentRate: undefined,
|
||||
settleMethod: undefined,
|
||||
lastPayDate: undefined,
|
||||
contractTerm: undefined,
|
||||
signUserId: undefined,
|
||||
signPhoneNumber: undefined,
|
||||
signEmail: undefined,
|
||||
signWechat: undefined,
|
||||
offlinePrice: undefined,
|
||||
onlinePrice: undefined,
|
||||
ownerUserId: undefined,
|
||||
expanderUserId: undefined,
|
||||
pricingUserId: undefined,
|
||||
afterSaleUserId: undefined,
|
||||
collUserId: undefined,
|
||||
totalPrice: undefined,
|
||||
contractBody: undefined,
|
||||
contractAgreement: undefined,
|
||||
creditMethod: undefined,
|
||||
creditCalcCycle: undefined,
|
||||
creditLimit: undefined,
|
||||
partnerCompanyId: undefined,
|
||||
deptId: undefined,
|
||||
quotationTimes: undefined,
|
||||
products: []
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
|
||||
/** 处理商机变化 */
|
||||
const handleQuotationChange = async (quotationId: number) => {
|
||||
if (!quotationId) return
|
||||
try {
|
||||
const quotation = await QuotationApi.getQuotation(quotationId)
|
||||
formData.value.products = quotation.products;
|
||||
formData.value.customerId = quotation.customerId;
|
||||
|
||||
formData.value.invoiceTemplateId = quotation.invoiceTemplateId;
|
||||
|
||||
formData.value.ownerUserId = quotation.ownerUserId;
|
||||
formData.value.expanderUserId = quotation.expanderUserId;
|
||||
formData.value.pricingUserId = quotation.pricingUserId;
|
||||
formData.value.signUserId = quotation.signUserId;
|
||||
formData.value.signPhoneNumber = quotation.signPhoneNumber;
|
||||
formData.value.signEmail = quotation.signEmail;
|
||||
formData.value.signWechat = quotation.signWechat;
|
||||
|
||||
formData.value.partnerCompanyId = quotation.partnerCompanyId;
|
||||
|
||||
formData.value.creditLimit = quotation.creditLimit;
|
||||
formData.value.creditMethod = quotation.creditMethod;
|
||||
formData.value.creditCalcCycle = quotation.creditCalcCycle;
|
||||
|
||||
formData.value.deptId = quotation.deptId;
|
||||
formData.value.offlinePrice = quotation.offlinePrice;
|
||||
formData.value.onlinePrice = quotation.onlinePrice;
|
||||
formData.value.totalPrice = quotation.totalPrice;
|
||||
|
||||
// 🔁 自动加载客户详情
|
||||
await onCustomerChange(quotation.customerId);
|
||||
} catch (err) {
|
||||
} finally {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const onCustomerChange = async (customerId: string) => {
|
||||
if (!customerId) return;
|
||||
|
||||
try {
|
||||
formLoading.value = true;
|
||||
const customerRes = await CustomerApi.getCustomer(customerId);
|
||||
formData.value.cooperationType = customerRes.cooperationType;
|
||||
formData.value.companyType = customerRes.companyType;
|
||||
formData.value.listingStatus = customerRes.listingStatus;
|
||||
formData.value.financingInfo = customerRes.financingInfo;
|
||||
formData.value.paidInCapital = customerRes.paidInCapital;
|
||||
formData.value.insuredCount = customerRes.insuredCount;
|
||||
formData.value.establishmentDate = customerRes.establishmentDate;
|
||||
formData.value.enterpriseType = customerRes.enterpriseType;
|
||||
formData.value.businessStatus = customerRes.businessStatus;
|
||||
formData.value.defendantRecord = customerRes.defendantRecord;
|
||||
formData.value.businessAbnormal = customerRes.businessAbnormal;
|
||||
formData.value.equityPledge = customerRes.equityPledge;
|
||||
formData.value.dishonestRecord = customerRes.dishonestRecord;
|
||||
formData.value.financingRecord = customerRes.financingRecord;
|
||||
formData.value.enforcementRecord = customerRes.enforcementRecord;
|
||||
} catch (err) {
|
||||
console.error('获取客户详情失败:', err);
|
||||
} finally {
|
||||
formLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 动态获取客户联系人 */
|
||||
const getContactOptions = computed(() =>
|
||||
contactList.value.filter((item) => item.customerId == formData.value.customerId)
|
||||
)
|
||||
|
||||
const route = useRoute();
|
||||
onMounted(async () => {
|
||||
console.log('%csrc/views/crm/contract/detail/ContractDetail.vue:627 props.id', 'color: #007acc;', props.id);
|
||||
formType.value = props.id || route.query.id
|
||||
|
||||
if (formType.value) await open(formType.value)
|
||||
|
||||
// 获得客户列表
|
||||
customerList.value = await CustomerApi.getCustomerSimpleList()
|
||||
// 获得用户列表
|
||||
userOptions.value = await UserApi.getSimpleUserList()
|
||||
// 获得报价列表
|
||||
quotationList.value = await QuotationApi.getSimpleQuotationList()
|
||||
|
||||
// 默认新建时选中自己
|
||||
// if (formType.value === 'create') {
|
||||
// formData.value.ownerUserId = useUserStore().getUser.id
|
||||
// }
|
||||
// 获取联系人
|
||||
contactList.value = await ContactApi.getSimpleContactList()
|
||||
const data = await ContractApi.getOrg({
|
||||
pageNo: 1,
|
||||
pageSize: 1000
|
||||
})
|
||||
orgList.value = data.list
|
||||
});
|
||||
</script>
|
||||
|
|
@ -6,12 +6,12 @@
|
|||
<el-tab-pane label="跟进记录">
|
||||
<FollowUpList :biz-id="contract.id" :type="1" :biz-type="BizTypeEnum.CRM_CONTRACT" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="基本信息">
|
||||
<el-tab-pane label="合同信息">
|
||||
<ContractDetailsInfo :contract="contract" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="产品">
|
||||
<!-- <el-tab-pane label="产品">
|
||||
<ContractProductList :contract="contract" />
|
||||
</el-tab-pane>
|
||||
</el-tab-pane> -->
|
||||
<!-- <el-tab-pane label="回款">
|
||||
<ReceivablePlanList
|
||||
:type="1"
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
import { useTagsViewStore } from '@/store/modules/tagsView'
|
||||
import { OperateLogVO } from '@/api/system/operatelog'
|
||||
import * as ContractApi from '@/api/crm/contract'
|
||||
import ContractDetailsInfo from './ContractDetailsInfo.vue'
|
||||
import ContractDetailsInfo from './ContractDetail.vue'
|
||||
import ContractDetailsHeader from './ContractDetailsHeader.vue'
|
||||
import ContractProductList from './ContractProductList.vue'
|
||||
import { BizTypeEnum } from '@/api/crm/permission'
|
||||
|
|
@ -81,7 +81,6 @@ const openForm = (type: string, id?: number) => {
|
|||
const getContractData = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
console.log('%csrc/views/crm/contract/detail/index.vue:92 234', 'color: #007acc;', contractId.value,234);
|
||||
contract.value = await ContractApi.getContract(contractId.value)
|
||||
await getOperateLog(contractId.value)
|
||||
} finally {
|
||||
|
|
@ -123,7 +122,7 @@ const close = () => {
|
|||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
console.log('%csrc/views/crm/contract/detail/index.vue:134 props.id', 'color: #007acc;', props.id);
|
||||
console.log('%csrc/views/crm/contract/detail/index.vue:125 props.id', 'color: #007acc;', props.id);
|
||||
const id = props.id || route.query.id
|
||||
if (!id) {
|
||||
message.warning('参数错误,合同不能为空!')
|
||||
|
|
|
|||
|
|
@ -25,7 +25,19 @@
|
|||
width="180px"
|
||||
/>
|
||||
<el-table-column label="图片" align="center" prop="picUrls" />
|
||||
<el-table-column label="附件" align="center" prop="fileUrls" />
|
||||
<el-table-column label="附件" align="center" prop="fileUrls">
|
||||
<!-- <template #default="scope">
|
||||
<el-link
|
||||
v-if="scope.row.fileUrls"
|
||||
:underline="false"
|
||||
type="primary"
|
||||
@click="previewFile(scope.row.fileUrls)"
|
||||
>
|
||||
预览
|
||||
</el-link>
|
||||
<span v-else>无附件</span>
|
||||
</template> -->
|
||||
</el-table-column>
|
||||
<el-table-column label="关联的联系人编号数组" align="center" prop="contactIds" />
|
||||
<el-table-column label="创建者" align="center" prop="creator" />
|
||||
<el-table-column
|
||||
|
|
@ -164,6 +176,36 @@ const handleExport = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
const previewFile = (fileUrls) => {
|
||||
// 假设 fileUrls 是一个字符串,包含文件的完整 URL
|
||||
if (!fileUrls) {
|
||||
message.error('没有附件');
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查文件类型
|
||||
const fileExtension = fileUrls.split('.').pop().toLowerCase();
|
||||
switch (fileExtension) {
|
||||
case 'pdf':
|
||||
// 预览 PDF 文件
|
||||
window.open(fileUrls, '_blank');
|
||||
break;
|
||||
case 'xlsx':
|
||||
case 'xls':
|
||||
// 预览 Excel 文件
|
||||
window.open(fileUrls, '_blank');
|
||||
break;
|
||||
case 'doc':
|
||||
case 'docx':
|
||||
// 预览 Word 文件
|
||||
window.open(fileUrls, '_blank');
|
||||
break;
|
||||
default:
|
||||
message.error('不支持的文件类型');
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
<el-table-column label="产品明细类型" min-width="150">
|
||||
<template #default="{ row, $index }">
|
||||
<el-form-item :prop="`${$index}.detailType`" :rules="formRules.detailType" class="mb-0px!">
|
||||
<el-select v-model="row.detailType" placeholder="请选择状态" disabled class="!w-240px">
|
||||
<el-select v-model="row.detailType" placeholder="请选择状态" class="!w-240px">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.CRM_PRODUCT_DETAIL_TYPE)"
|
||||
:key="dict.value"
|
||||
|
|
|
|||
Loading…
Reference in New Issue