Files
xk-client-wx/request/api/invoice.js

34 lines
939 B
JavaScript
Raw Normal View History

2026-07-28 12:45:56 +08:00
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'