| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- import request from '@/utils/request';
- /**
- * 查询参数接口
- */
- export interface QuoteQuery {
- pageNum?: number;
- pageSize?: number;
- quoteNo?: string;
- quoteTitle?: string;
- customerId?: number;
- customerName?: string;
- opportunityId?: number;
- status?: string;
- ownerUserId?: number;
- approvedByUserId?: number; // 审批人ID(用于查询某个用户已审批过的报价单)
- minAmount?: number;
- maxAmount?: number;
- isLatest?: number;
- quoteDateBegin?: string;
- quoteDateEnd?: string;
- beginTime?: string;
- endTime?: string;
- }
- /**
- * 报价单产品
- */
- export interface QuoteProduct {
- id?: string | number;
- quoteId?: string | number;
- productId: string | number;
- productName: string;
- productNo?: string;
- categoryId?: string | number;
- categoryName?: string;
- model?: string;
- unit?: string;
- quantity: number;
- price: number;
- discount?: number;
- subtotal?: number;
- description?: string;
- sort?: number;
- remark?: string;
- }
- /**
- * 报价单产品表单(用于新增/编辑)
- */
- export interface QuoteProductForm {
- id?: string | number;
- productId?: string | number;
- productName?: string;
- categoryId?: string | number;
- categoryName?: string;
- model?: string;
- unit?: string; // 单位
- price?: number; // 含税单价/元
- unitPrice?: number;
- quantity?: number;
- discount?: number;
- subtotal?: number; // 含税总价/元
- discountAmount?: number;
- totalPrice?: number;
- taxAmount?: number; // 税费/元
- taxRate?: number; // 税率(%)
- packageSpec?: string; // 包装规格
- deliveryMethod?: string; // 送货方式
- description?: string;
- }
- /**
- * 表单数据接口
- */
- export interface QuoteForm {
- id?: string | number;
- quoteNo?: string;
- title?: string;
- quoteTitle?: string;
- customerId?: string | number;
- customerName?: string;
- opportunityId?: string | number;
- opportunityName?: string;
- contactId?: string | number;
- contactName?: string;
- contactMobile?: string;
- contactEmail?: string;
- businessId?: string | number;
- businessName?: string;
- saleStage?: string;
- version?: string;
- parentId?: string | number;
- isLatest?: number;
- discountRate?: number;
- validityDays?: number;
- quoteDate?: string;
- expireDate?: string;
- status?: string;
- ownerUserId?: string | number;
- ownerUserName?: string;
- totalAmount?: number;
- discountAmount?: number;
- finalAmount?: number;
- paymentMethod?: string;
- paymentTerms?: string;
- deliveryMethod?: string;
- deliveryTerms?: string;
- deliveryCycle?: number;
- description?: string;
- serviceTerms?: string;
- attachments?: string;
- remark?: string;
- products?: QuoteProductForm[];
- }
- /**
- * 视图对象接口
- */
- export interface QuoteVO {
- id: string | number;
- quoteNo: string;
- quoteTitle: string;
- customerId: string | number;
- customerName: string;
- opportunityId?: string | number;
- opportunityName?: string;
- contactId?: string | number;
- contactName?: string;
- contactMobile?: string;
- contactEmail?: string;
- version: string;
- parentId: string | number;
- isLatest: number;
- totalAmount: number;
- discountRate?: number;
- discountAmount?: number;
- finalAmount: number;
- validityDays: number;
- quoteDate: string;
- expireDate: string;
- status: string;
- rejectReason?: string;
- pdfUrl?: string;
- pdfGenerated: number;
- shareLink?: string;
- shareCode?: string;
- shareExpireTime?: string;
- viewCount: number;
- lastViewTime?: string;
- ownerUserId: string | number;
- ownerUserName: string;
- contractId?: string | number;
- paymentTerms?: string;
- deliveryTerms?: string;
- attachments?: string;
- createTime: string;
- updateTime?: string;
- remark?: string;
- productList?: QuoteProduct[];
- canApprove?: boolean; // 当前用户是否可以审批
- }
- /**
- * 提交审批参数
- */
- export interface SubmitApprovalForm {
- id: string | number;
- approverIds: (string | number)[];
- remark?: string;
- }
- /**
- * 审批参数
- */
- export interface ApprovalForm {
- id: string | number;
- approvalResult: string;
- approvalOpinion?: string;
- remark?: string;
- }
- /**
- * 分享参数
- */
- export interface GenerateShareForm {
- id: string | number;
- validityDays?: number;
- }
- /**
- * 转合同参数
- */
- export interface ToContractForm {
- id: string | number;
- contractNo: string;
- contractTitle: string;
- signDate?: string;
- effectiveDate?: string;
- expiryDate?: string;
- remark?: string;
- }
- /**
- * 新版本参数
- */
- export interface NewVersionForm {
- id: string | number;
- version: string;
- remark?: string;
- }
- /**
- * 查询报价单列表
- */
- export function listQuote(query: QuoteQuery) {
- return request({
- url: '/crm/quote/list',
- method: 'get',
- params: query
- });
- }
- /**
- * 查询报价单详细
- */
- export function getQuote(id: string | number) {
- return request({
- url: `/crm/quote/${id}`,
- method: 'get'
- });
- }
- /**
- * 新增报价单
- */
- export function addQuote(data: QuoteForm) {
- return request({
- url: '/crm/quote',
- method: 'post',
- data: data
- });
- }
- /**
- * 修改报价单
- */
- export function updateQuote(data: QuoteForm) {
- return request({
- url: '/crm/quote',
- method: 'put',
- data: data
- });
- }
- /**
- * 删除报价单
- */
- export function delQuote(ids: string | number | (string | number)[]) {
- return request({
- url: `/crm/quote/${ids}`,
- method: 'delete'
- });
- }
- /**
- * 提交审批
- */
- export function submitQuote(data: SubmitApprovalForm) {
- return request({
- url: '/crm/quote/submit',
- method: 'put',
- data: data
- });
- }
- /**
- * 生成PDF
- */
- export function generatePdf(id: string | number) {
- return request({
- url: '/crm/quote/generatePdf',
- method: 'post',
- data: { id }
- });
- }
- /**
- * 生成分享链接
- */
- export function generateShare(data: GenerateShareForm) {
- return request({
- url: '/crm/quote/generateShare',
- method: 'post',
- data: data
- });
- }
- /**
- * 通过分享码查看报价单
- */
- export function viewByShareCode(shareCode: string) {
- return request({
- url: `/crm/quote/share/${shareCode}`,
- method: 'get'
- });
- }
- /**
- * 接受报价单
- */
- export function acceptQuote(id: string | number, remark?: string) {
- return request({
- url: '/crm/quote/accept',
- method: 'put',
- data: { id, remark }
- });
- }
- /**
- * 拒绝报价单
- */
- export function rejectQuote(id: string | number, rejectReason: string, remark?: string) {
- return request({
- url: '/crm/quote/reject',
- method: 'put',
- data: { id, rejectReason, remark }
- });
- }
- /**
- * 转为合同
- */
- export function toContract(data: ToContractForm) {
- return request({
- url: '/crm/quote/toContract',
- method: 'post',
- data: data
- });
- }
- /**
- * 创建新版本
- */
- export function createNewVersion(data: NewVersionForm) {
- return request({
- url: '/crm/quote/newVersion',
- method: 'post',
- data: data
- });
- }
- /**
- * 查询版本历史
- */
- export function queryVersions(quoteNo: string) {
- return request({
- url: '/crm/quote/versions',
- method: 'get',
- params: { quoteNo }
- });
- }
- /**
- * 导出报价单
- */
- export function exportQuote(query: QuoteQuery) {
- return request({
- url: '/crm/quote/export',
- method: 'post',
- data: query,
- responseType: 'blob'
- });
- }
- /**
- * 统计概览视图对象
- */
- export interface QuoteStatisticsVO {
- totalCount: number;
- draftCount: number;
- submittedCount: number;
- approvedCount: number;
- rejectedCount: number;
- sentCount: number;
- acceptedCount: number;
- expiredCount: number;
- totalAmount: number;
- monthAmount: number;
- }
- /**
- * 查询统计概览
- */
- export function statisticsOverview() {
- return request({
- url: '/crm/quote/statistics/overview',
- method: 'get'
- });
- }
- // ==================== 审批相关接口 ====================
- /**
- * 审批记录视图对象
- */
- export interface QuoteApprovalVO {
- id: string | number;
- quoteId: string | number;
- quoteNo: string;
- step: number;
- approverId: string | number;
- approverName: string;
- approvalResult?: string;
- approvalOpinion?: string;
- approvalTime?: string;
- createTime: string;
- remark?: string;
- }
- /**
- * 查询审批记录列表
- */
- export function listApproval(quoteId: string | number) {
- return request({
- url: '/crm/quote/approval/list',
- method: 'get',
- params: { quoteId }
- });
- }
- /**
- * 审批报价单
- */
- export function approveQuote(data: ApprovalForm) {
- return request({
- url: '/crm/quote/approval',
- method: 'post',
- data: data
- });
- }
- /**
- * 撤回审批
- */
- export function withdrawApproval(id: string | number, remark?: string) {
- return request({
- url: '/crm/quote/approval/withdraw',
- method: 'put',
- data: { id, remark }
- });
- }
- /**
- * 刷新审批人姓名(修复旧数据)
- */
- export function refreshApproverNames(quoteId?: string | number) {
- return request({
- url: '/crm/quote/approval/refreshNames',
- method: 'post',
- data: quoteId ? { quoteId } : {}
- });
- }
- // ==================== 分享日志相关接口 ====================
- /**
- * 分享访问日志视图对象
- */
- export interface ShareLogVO {
- id: string | number;
- quoteId: string | number;
- shareCode: string;
- ipAddress: string;
- location?: string;
- deviceType: string;
- browser?: string;
- visitTime: string;
- stayDuration?: number;
- remark?: string;
- }
- /**
- * 分享统计视图对象
- */
- export interface ShareStatisticsVO {
- totalVisits: number;
- uniqueIps: number;
- avgStayDuration?: number;
- lastVisitTime?: string;
- deviceStats?: Record<string, number>;
- }
- /**
- * 查询分享访问日志列表
- */
- export function listShareLog(quoteId: string | number) {
- return request({
- url: '/crm/quote/shareLog/list',
- method: 'get',
- params: { quoteId }
- });
- }
- /**
- * 查询分享访问统计
- */
- export function shareLogStatistics(quoteId: string | number) {
- return request({
- url: '/crm/quote/shareLog/statistics',
- method: 'get',
- params: { quoteId }
- });
- }
|