Commit c395fb97 by 王昆

gsb

parent 35cdcea9
......@@ -24,6 +24,7 @@ class InvoiceCtl extends CtlBase {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
// 交易信息列表页
async tradePage(params, pobj2, req) {
try {
......@@ -36,13 +37,14 @@ class InvoiceCtl extends CtlBase {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
// 交易列表
async platformPage(params, pobj2, req) {
try {
if (["00", "10", "20"].indexOf(params.fee_type) == -1) {
return system.getResultSuccess({count:0, rows:[], fee_type: params.fee_type});
return system.getResultSuccess({count: 0, rows: [], fee_type: params.fee_type});
}
if(params.fee_type == "00") {
if (params.fee_type == "00") {
return this.orderPage(params, pobj2, req);
} else {
return this.tradePage(params, pobj2, req);
......@@ -67,14 +69,14 @@ class InvoiceCtl extends CtlBase {
try {
let fee_type = this.trim(params.fee_type);
if (fee_type == "00") {
return await this.apply00(params, pobj2, req);
} else if (fee_type == "10") {
return await this.apply10(params, pobj2, req);
} else if (fee_type == "20") {
return await this.apply20(params, pobj2, req);
} else {
return system.getResult(null, "费用类型错误");
}
return await this.orderSve.page(params);
} catch (error) {
let msg = error.message;
if (msg.startsWith("bpo-validation-error:")) {
......@@ -178,19 +180,19 @@ class InvoiceCtl extends CtlBase {
/**
* 发票账单列表
* @param {*} params
* @param {*} pobj2
* @param {*} req
* @param {*} params
* @param {*} pobj2
* @param {*} req
*/
async invoiceOrder(params, pobj2, req){
if(!params.id){
return system.getResult(null,`发票ID 不能为空`);
async invoiceOrder(params, pobj2, req) {
if (!params.id) {
return system.getResult(null, `发票ID 不能为空`);
}
try {
return await this.invoiceSve.invoiceOrder(params);
} catch (error) {
console.log(error);
return system.getResult(null,`系统错误`);
return system.getResult(null, `系统错误`);
}
}
......@@ -206,20 +208,23 @@ class InvoiceCtl extends CtlBase {
return await this.invoiceSve.invoiceOrder(params);
} catch (error) {
console.log(error);
return system.getResult(null,`系统错误`);
return system.getResult(null, `系统错误`);
}
}
async buildTradeInvoice(params) {
let invoiceId = params.id;
validation.check(params, 'data_ids', {name: "交易信息", arr_require: true});
let invoice_type = params.invoice_type;
// 查交易
let items = await this.tradeSve.itemByInvoiceId({saas_invoice_id: invoiceId});
let items = await this.tradeSve.byIds({
ids: params.data_ids,
saas_merchant_id: params.saas_merchant_id,
trade_statuses: ['00'],
unInvoice: true,
}) || [];
items = items.data;
if (!items || items.length == 0) {
return system.getResult(null, "该发票缺少交易信息,请联系平台查看原因");
return system.getResult(null, "注册订单信息有误,请刷新重新选择");
}
let bmMap = {};
let creditCodes = [];
......@@ -282,8 +287,8 @@ class InvoiceCtl extends CtlBase {
url: url,
data: calcParams
});
if(!res || !res.data || res.data.status !=0 || res.data.data.length==0){
return system.getResult(null,`试算错误`);
if (!res || !res.data || res.data.status != 0 || res.data.data.length == 0) {
return system.getResult(null, `试算错误`);
}
let calcList = res.data.data;
......@@ -324,7 +329,7 @@ class InvoiceCtl extends CtlBase {
});
} catch (error) {
console.log(error);
return system.getResult(null,`系统错误`);
return system.getResult(null, `系统错误`);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment