Files
xk-client-wx/request/api/invoice.js
2026-07-28 12:45:56 +08:00

34 lines
939 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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'