完成基础信息与开票的逻辑

This commit is contained in:
BBIT-Kai
2026-05-11 09:31:23 +08:00
parent 3bbd8941a9
commit 4b23f3546a
37 changed files with 4975 additions and 538 deletions
+3 -1
View File
@@ -30,7 +30,9 @@ http.interceptors.response.use(
return response.data
}
if (payload.code !== '0') {
throw new BizError(payload.code, payload.message || '请求失败', payload.traceId ?? traceId)
const errMsg = payload.message || '请求失败'
message.error(payload.traceId ?? traceId ? `${errMsg}(追踪ID${payload.traceId ?? traceId}` : errMsg)
throw new BizError(payload.code, errMsg, payload.traceId ?? traceId)
}
return payload.data
},
+337
View File
@@ -0,0 +1,337 @@
import http from '@/api/http'
/**
* 账号状态
* 0:无需认证
* 1:风险认证
* 2:登录认证
* 3:风险+登录认证
*/
export type AuthStatus = '0' | '1' | '2' | '3'
/**
* 登录身份类型
* 01:法定代表人
* 02:财务负责人
* 03:办税员
* 04:涉税服务人员
* 05:管理员
* 07:领票人
* 09:开票员
* 99:其他人员
*/
export type IdentityType = '01' | '02' | '03' | '04' | '05' | '07' | '09' | '99'
/**
* 操作建议
* 0:无需认证
* 1:需扫码认证
* 2:需扫码或短信认证
* 3:需短信认证
*/
export type OperationProposed = '0' | '1' | '2' | '3'
/**
* 可切换状态
* 0:不可切换
* 1:可切换,代表该数电账号在该地区的其他企业有登录状态
*/
export type Switchable = '0' | '1'
/**
* 微信绑定状态
* 0:否
* 1:是
*/
export type WechatBindStatus = '0' | '1'
/**
* 登录认证状态
* 0:未登录
* 1:已登录
*/
export type LoginAuthStatus = '0' | '1'
/**
* 风险认证状态
* 0:未认证
* 1:已认证
*/
export type RiskAuthStatus = '0' | '1'
export interface TaxBureauAccountAuth {
/** 姓名 */
name: string
/** 销售方纳税人识别号 (15-20位) */
taxpayerNum: string
/** 电子税局登录账号 */
account: string
/** 登录身份类型: 01法定代表人, 02财务负责人, 03办税员, 04涉税服务人员, 05管理员, 07领票人, 09开票员, 99其他人员 */
identityType: string
/** 操作建议: 0无需认证, 1需扫码认证, 2需扫码或短信认证, 3需短信认证 */
operationProposed: string
/** 账号状态: 0无需认证, 1风险认证, 2登录认证, 3风险+登录认证 */
authStatus: string
/** 当前企业是否可切换: 0不可切换, 1可切换 */
switchable: string
/** 是否绑定微信公众号: 0否, 1是 */
wechatUserBindStatus: string
/** 最新认证成功时间 (yyyy-MM-dd HH:mm:ss) */
lastAuthSuccTime: string
/** 登录认证状态: 0未登录, 1已登录 */
loginAuthStatus: string
/** 最新登录认证时间 (yyyy-MM-dd HH:mm:ss) */
lastLoginAuthTime: string
/** 风险认证状态: 0未认证, 1已认证 */
riskAuthStatus: string
/** 最新风险认证时间 (yyyy-MM-dd HH:mm:ss) */
lastRiskAuthTime: string
}
/**
* 获取票通账号认证状态信息
*/
export function getPTInfoApi(): Promise<TaxBureauAccountAuth> {
return http.get('/pt/info')
}
export interface TaxEnterpriseRegisterRequest {
taxpayerNum: string
enterpriseName: string
legalPersonName: string
contactsName: string
contactsEmail: string
contactsPhone: string
regionCode: string
cityName: string
enterpriseAddress: string
taxRegistrationCertificate: string
}
/**
* 注册企业(纳税人)
*/
export function registerEnterpriseApi(payload: TaxEnterpriseRegisterRequest): Promise<string> {
return http.post('/pt/register', payload)
}
export interface TaxRegisterUserRequest {
taxpayerNum: string
taxAccount: string
}
/**
* 登记账号
*/
export function registerUserApi(payload: TaxRegisterUserRequest): Promise<string> {
return http.post('/pt/registerUser', payload)
}
// =============================================
// 基础信息配置(本地 CRUD
// =============================================
/** 企业信息 */
export interface EnterpriseInfo {
taxpayerNum: string
enterpriseName: string
legalPersonName: string
contactsName: string
contactsEmail: string
contactsPhone: string
regionCode: string
cityName: string
enterpriseAddress: string
taxRegistrationCertificate: string
}
/** 获取企业信息 */
export function getEnterpriseInfoApi(): Promise<EnterpriseInfo> {
return http.get('/pt/enterprise')
}
/** 更新企业信息 */
export function updateEnterpriseInfoApi(payload: Partial<EnterpriseInfo>): Promise<string> {
return http.put('/pt/enterprise', payload)
}
/** 数电账号信息 */
export interface DigitalAccountInfo {
taxpayerNum: string
taxAccount: string
}
/** 获取数电账号信息 */
export function getDigitalAccountApi(): Promise<DigitalAccountInfo> {
return http.get('/pt/digital-account')
}
/** 更新数电账号信息 */
export function updateDigitalAccountApi(payload: DigitalAccountInfo): Promise<string> {
return http.put('/pt/digital-account', payload)
}
/** 开票预设数据 */
export interface PresetData {
bankName: string
bankAccount: string
}
/** 获取开票预设数据 */
export function getPresetDataApi(): Promise<PresetData> {
return http.get('/pt/preset')
}
/** 更新开票预设数据 */
export function updatePresetDataApi(payload: PresetData): Promise<string> {
return http.put('/pt/preset', payload)
}
// =============================================
// 开票相关
// =============================================
/** 发票商品项目 */
export interface InvoiceItem {
/** 商品/服务名称 */
goodsName: string
/** 税收分类编码 */
taxClassificationCode: string
/** 规格型号 */
specificationModel?: string
/** 计量单位 */
meteringUnit?: string
/** 数量 */
quantity?: string
/** 含税标识:0不含税,1含税 */
includeTaxFlag?: string
/** 单价 */
unitPrice?: string
/** 金额 */
invoiceAmount: string
/** 税率 如 0.13 = 13% */
taxRateValue: string
/** 税额 */
taxRateAmount?: string
/** 折扣金额(负数) */
discountAmount?: string
/** 折扣税额 */
discountTaxRateAmount?: string
/** 优惠政策标识:1使用优惠政策 */
preferentialPolicyFlag?: string
/** 零税率标识:1免税,2不征税,3普通零税率 */
zeroTaxFlag?: string
/** 增值税特殊管理说明 */
vatSpecialManage?: string
}
/** 差额征税凭证明细 */
export interface VariableLevyProof {
/** 凭证类型:01数电票,02增值税专票,03增值税普票 */
proofType: string
/** 数电票号码 */
electronicInvoiceNo?: string
/** 发票代码 */
invoiceCode?: string
/** 发票号码 */
invoiceNo?: string
/** 凭证号码 */
proofNo?: string
/** 开具日期 yyyy-MM-dd */
issueDate?: string
/** 凭证总金额 */
proofAmount: string
/** 本次扣除金额 */
deductionAmount: string
/** 备注 */
proofRemark?: string
/** 来源 */
source?: string
}
/** 订单信息 */
export interface OrderInfo {
/** 业务单据号 */
orderNo: string
}
/**
* 数电发票开票请求
*/
export interface InvoiceRequest {
/** 销方纳税人识别号 */
taxpayerNum: string
/** 发票请求流水号 */
invoiceReqSerialNo: string
/** 开票种类:81数电专票,82数电普票,10电子普票,08电子专票 */
invoiceIssueKindCode?: string
/** 购买方名称(发票抬头) */
buyerName: string
/** 农产品收购发票销售方证件类型:201居民身份证, 208外国护照, 210港澳居民来往内地通行证, 213台湾居民来往大陆通行证, 215外国人居留证, 219香港永久性居民身份证, 220台湾身份证, 221澳门特别行政区永久性居民身份证, 233外国人永久居留身份证, 103税务登记证, 299其他个人证件 */
purchaseInvSellerIdType?: string
/** 购买方纳税人识别号 */
buyerTaxpayerNum?: string
/** 是否自然人:0否,1是 */
naturalPersonFlag?: string
/** 购买方地址 */
buyerAddress?: string
/** 购买方电话 */
buyerTel?: string
/** 购买方开户银行 */
buyerBankName?: string
/** 购买方银行账号 */
buyerBankAccount?: string
/** 销方地址 */
sellerAddress?: string
/** 销方电话 */
sellerTel?: string
/** 销方开户银行 */
sellerBankName?: string
/** 销方银行账号 */
sellerBankAccount?: string
/** 备注显示购买方银行:0不显示,1显示 */
showBuyerBank?: string
/** 备注显示销售方银行:0不显示,1显示 */
showSellerBank?: string
/** 备注显示购买方地址电话 */
showBuyerAddrTel?: string
/** 备注显示销售方地址电话 */
showSellerAddrTel?: string
/** 开票员税局账号 */
account?: string
/** 差额征税标识:1全额,2差额 */
variableLevyFlag?: string
/** 收款人名称 */
casherName?: string
/** 复核人名称 */
reviewerName?: string
/** 收票人姓名 */
takerName?: string
/** 收票人手机号 */
takerTel?: string
/** 收票人邮箱 */
takerEmail?: string
/** 特殊票种:08成品油,02农产品收购,12自产农产品 */
specialInvoiceKind?: string
/** 发票备注 */
remark?: string
/** 自定义数据 */
definedData?: string
/** 业务订单号 */
tradeNo?: string
/** 门店编号(集团版) */
shopNum?: string
/** 发票商品明细 */
itemList: InvoiceItem[]
/** 差额征税凭证明细 */
variableLevyProofList?: VariableLevyProof[]
/** 订单列表(支持合并开票) */
orderList?: OrderInfo[]
}
/**
* 提交开票
*/
export function invoiceIssueApi(payload: InvoiceRequest): Promise<string> {
return http.post('/pt/invoiceBlue', payload)
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,35 @@
<template>
<div class="page">
<div class="placeholder">
<h2>开票历史</h2>
<p>功能开发中敬请期待</p>
</div>
</div>
</template>
<style scoped>
.page {
min-height: 100%;
background: #f7f8fa;
display: flex;
align-items: center;
justify-content: center;
}
.placeholder {
text-align: center;
color: #bbb;
}
.placeholder h2 {
margin: 0 0 8px;
font-size: 18px;
font-weight: 600;
color: #999;
}
.placeholder p {
margin: 0;
font-size: 14px;
}
</style>
File diff suppressed because it is too large Load Diff
+8
View File
@@ -16,6 +16,14 @@ export interface CurrentUserProfile {
realName?: string | null
orgId?: string | null
status: string
avatar?: string | null
email?: string | null
phone?: string | null
createdAt?: string | null
taxpayerNum?: string | null
account?: string | null
taxPassword?: string | null
taxIdentityType?: string | null
}
export interface MenuNode {
+8
View File
@@ -23,6 +23,10 @@ export interface UserDetail {
status: string
statusLabel?: string
roleIds: string[]
taxpayerNum?: string | null
account?: string | null
taxPassword?: string | null
taxIdentityType?: string | null
}
export interface UserQuery {
@@ -55,6 +59,10 @@ export interface UpdateUserRequest {
email?: string
avatar?: string
orgId?: string
taxpayerNum?: string
account?: string
taxPassword?: string
taxIdentityType?: string
}
export interface UpdateUserStatusRequest {