148 lines
5.2 KiB
TypeScript
148 lines
5.2 KiB
TypeScript
import request from '@/config/axios'
|
||
import { TransferReqVO } from '@/api/crm/permission'
|
||
|
||
export interface ContractVO {
|
||
id: number // 编号,主键自增
|
||
name: string // 合同名称
|
||
no: string // 合同编号
|
||
customerId: number // 客户编号
|
||
quotationId: number // 报价单编号
|
||
invoiceTemplateId: number // 票据模板Id
|
||
processInstanceId: string // 工作流编号
|
||
auditStatus: number // 审批状态
|
||
startTime: Date // 合同签订日期
|
||
endTime: Date // 合同结束时间
|
||
penaltyRate: number // 违约金比例
|
||
latePaymentRate: number // 延期付款利率
|
||
settleMethod: string // 财务结算方式 1按月 2按项目
|
||
lastPayDate: Date // 最晚付款日期
|
||
contractTerm: number // 合同期限(月)
|
||
signUserId: number // 报价签约人
|
||
signPhoneNumber: number // 签约人联系电话
|
||
signEmail: string // 签约人Email
|
||
signWechat: string // 签约人微信
|
||
offlinePrice: number // 线下总金额,单位:元
|
||
onlinePrice: number // 线上总金额,单位:元
|
||
ownerUserId: number // 商机负责人
|
||
expanderUserId: number // 拓展人
|
||
pricingUserId: number // 方案报价人
|
||
afterSaleUserId: number // 售后维护人
|
||
collUserId: number // 协作人id
|
||
totalPrice: number // 合同总金额
|
||
contractBody: string // 合同正文
|
||
contractAgreement: string // 合同补充协议
|
||
creditMethod: number // 授信方式
|
||
creditCalcCycle: number // 授信计算周期
|
||
creditLimit: number // 授信额度
|
||
partnerCompanyId: number // 合作主体 关联部门id
|
||
deptId: number // 归属部门Id
|
||
quotationTimes: number // 第几次报价
|
||
products?: [
|
||
{
|
||
id: number
|
||
productId: number
|
||
productName: string
|
||
productNo: string
|
||
productUnit: number
|
||
productPrice: number
|
||
contractPrice: number
|
||
count: number
|
||
totalPrice: number
|
||
}
|
||
]
|
||
}
|
||
|
||
// 查询 CRM 合同列表
|
||
export const getContractPage = async (params) => {
|
||
return await request.get({ url: `/crm/contract/page`, params })
|
||
}
|
||
|
||
// 查询 CRM 联系人列表,基于指定客户
|
||
export const getContractPageByCustomer = async (params: any) => {
|
||
return await request.get({ url: `/crm/contract/page-by-customer`, params })
|
||
}
|
||
|
||
// 查询 CRM 联系人列表,基于指定商机
|
||
export const getContractPageByBusiness = async (params: any) => {
|
||
return await request.get({ url: `/crm/contract/page-by-business`, params })
|
||
}
|
||
|
||
// 查询 CRM 合同详情
|
||
export const getContract = async (id: number) => {
|
||
return await request.get({ url: `/crm/contract/get?id=` + id })
|
||
}
|
||
|
||
// 查询 CRM 合同下拉列表
|
||
export const getContractSimpleList = async (customerId: number) => {
|
||
return await request.get({
|
||
url: `/crm/contract/simple-list?customerId=${customerId}`
|
||
})
|
||
}
|
||
|
||
// 新增 CRM 合同
|
||
export const createContract = async (data: ContractVO) => {
|
||
return await request.post({ url: `/crm/contract/create`, data })
|
||
}
|
||
|
||
// 修改 CRM 合同
|
||
export const updateContract = async (data: ContractVO) => {
|
||
return await request.put({ url: `/crm/contract/update`, data })
|
||
}
|
||
|
||
// 删除 CRM 合同
|
||
export const deleteContract = async (id: number) => {
|
||
return await request.delete({ url: `/crm/contract/delete?id=` + id })
|
||
}
|
||
|
||
// 导出 CRM 合同 Excel
|
||
export const exportContract = async (params) => {
|
||
return await request.download({ url: `/crm/contract/export-excel`, params })
|
||
}
|
||
|
||
// 提交审核
|
||
export const submitContract = async (id: number) => {
|
||
return await request.put({ url: `/crm/contract/submit?id=${id}` })
|
||
}
|
||
|
||
// 合同转移
|
||
export const transferContract = async (data: TransferReqVO) => {
|
||
return await request.put({ url: '/crm/contract/transfer', data })
|
||
}
|
||
|
||
// 获得待审核合同数量
|
||
export const getAuditContractCount = async () => {
|
||
return await request.get({ url: '/crm/contract/audit-count' })
|
||
}
|
||
|
||
// 获得即将到期(提醒)的合同数量
|
||
export const getRemindContractCount = async () => {
|
||
return await request.get({ url: '/crm/contract/remind-count' })
|
||
}
|
||
|
||
// ==================== 子表(CRM 合同产品关联) ====================
|
||
|
||
// 获得CRM 合同产品关联列表
|
||
export const getContractProductListByContractId = async (contractId) => {
|
||
return await request.get({ url: `/crm/contract/contract-product/list-by-contract-id?contractId=` + contractId })
|
||
}
|
||
|
||
// ==================== 子表(合同甲方关联单位) ====================
|
||
|
||
// 获得合同甲方关联单位列表
|
||
export const getContractAAuthorizedCompanyListByContractId = async (contractId) => {
|
||
return await request.get({ url: `/crm/contract/contract-A-authorized-company/list-by-contract-id?contractId=` + contractId })
|
||
}
|
||
// ==================== 子表(合同甲方授权人信息) ====================
|
||
|
||
// 获得合同甲方授权人信息列表
|
||
export const getContractAAuthorizedPersonListByContractId = async (contractId) => {
|
||
return await request.get({ url: `/crm/contract/contract-A-authorized-person/list-by-contract-id?contractId=` + contractId })
|
||
}
|
||
|
||
// ==================== 子表(合同乙方授权人信息) ====================
|
||
|
||
// 获得合同乙方授权人信息列表
|
||
export const getContractBAuthorizedPersonListByContractId = async (contractId) => {
|
||
return await request.get({ url: `/crm/contract/contract-B-authorized-person/list-by-contract-id?contractId=` + contractId })
|
||
}
|