feat(订单页面): 开票

This commit is contained in:
李琦
2026-07-28 12:45:56 +08:00
parent 8b455b1920
commit 77a690a071
9 changed files with 763 additions and 59 deletions

33
request/api/invoice.js Normal file
View File

@@ -0,0 +1,33 @@
import { get, post } from './http'
/**
* 将 xk-api 的 code/result 规范为 errcode/data便于页面统一判断
*/
function normalizeXkApiResponse(res) {
if (res && res.data && (res.data.code === 0 || res.data.code === '0')) {
res.data.errcode = 0
res.data.data = res.data.result
}
return res
}
/**
* 申请开票
* @param {object} params order_id, title_type, title_name, tax_no, receive_type, email
*/
export async function applyInvoiceApi(params) {
const data = await post('/invoice/apply', params, 3)
return normalizeXkApiResponse(data)
}
/**
* 开票详情
* @param {object} params id 或 order_id
*/
export async function getInvoiceDetailApi(params) {
const data = await get('/invoice/detail', params, 3)
return normalizeXkApiResponse(data)
}
/** 与 config/xk.php invoice_notice 保持一致的订阅消息模板 ID */
export const INVOICE_NOTICE_TMPL_ID = '2FuQhhO74mABSqGx2cF7vRR2wGekrIMM9kZMvVI6h-Q'