70 lines
2.0 KiB
JavaScript
70 lines
2.0 KiB
JavaScript
"use strict";
|
|
const utils_request = require("../../../utils/request.js");
|
|
const config_setting = require("../../../config/setting.js");
|
|
async function pageUserInvoice(params) {
|
|
const res = await utils_request.http.get(
|
|
config_setting.MODULES_API_URL + "/booking/user-invoice/page",
|
|
{
|
|
params
|
|
}
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
async function addUserInvoice(data) {
|
|
const res = await utils_request.http.post(
|
|
config_setting.MODULES_API_URL + "/booking/user-invoice",
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
async function updateUserInvoice(data) {
|
|
const res = await utils_request.http.put(
|
|
config_setting.MODULES_API_URL + "/booking/user-invoice",
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
async function removeUserInvoice(id) {
|
|
const res = await utils_request.http.delete(
|
|
config_setting.MODULES_API_URL + "/booking/user-invoice/" + id
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
async function doInvoice(data) {
|
|
const res = await utils_request.http.post(
|
|
config_setting.MODULES_API_URL + "/booking/user-invoice/doInvoice",
|
|
data
|
|
);
|
|
if (res.data.code === 0) {
|
|
return res.data.message;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
async function showInvoice(orderNo) {
|
|
const res = await utils_request.http.get(
|
|
config_setting.MODULES_API_URL + "/booking/user-invoice/showInvoice/" + orderNo
|
|
);
|
|
if (res.data.code === 0 && res.data.data) {
|
|
return res.data.data;
|
|
}
|
|
return Promise.reject(new Error(res.data.message));
|
|
}
|
|
exports.addUserInvoice = addUserInvoice;
|
|
exports.doInvoice = doInvoice;
|
|
exports.pageUserInvoice = pageUserInvoice;
|
|
exports.removeUserInvoice = removeUserInvoice;
|
|
exports.showInvoice = showInvoice;
|
|
exports.updateUserInvoice = updateUserInvoice;
|