feat(订单页面): 开票
This commit is contained in:
33
request/api/invoice.js
Normal file
33
request/api/invoice.js
Normal 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'
|
||||
Reference in New Issue
Block a user