Commit c395fb97 by 王昆

gsb

parent 35cdcea9
...@@ -24,6 +24,7 @@ class InvoiceCtl extends CtlBase { ...@@ -24,6 +24,7 @@ class InvoiceCtl extends CtlBase {
return system.getResult(null, `系统错误 错误信息 ${error}`); return system.getResult(null, `系统错误 错误信息 ${error}`);
} }
} }
// 交易信息列表页 // 交易信息列表页
async tradePage(params, pobj2, req) { async tradePage(params, pobj2, req) {
try { try {
...@@ -36,13 +37,14 @@ class InvoiceCtl extends CtlBase { ...@@ -36,13 +37,14 @@ class InvoiceCtl extends CtlBase {
return system.getResult(null, `系统错误 错误信息 ${error}`); return system.getResult(null, `系统错误 错误信息 ${error}`);
} }
} }
// 交易列表 // 交易列表
async platformPage(params, pobj2, req) { async platformPage(params, pobj2, req) {
try { try {
if (["00", "10", "20"].indexOf(params.fee_type) == -1) { 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); return this.orderPage(params, pobj2, req);
} else { } else {
return this.tradePage(params, pobj2, req); return this.tradePage(params, pobj2, req);
...@@ -67,14 +69,14 @@ class InvoiceCtl extends CtlBase { ...@@ -67,14 +69,14 @@ class InvoiceCtl extends CtlBase {
try { try {
let fee_type = this.trim(params.fee_type); let fee_type = this.trim(params.fee_type);
if (fee_type == "00") { if (fee_type == "00") {
return await this.apply00(params, pobj2, req);
} else if (fee_type == "10") { } else if (fee_type == "10") {
return await this.apply10(params, pobj2, req); return await this.apply10(params, pobj2, req);
} else if (fee_type == "20") { } else if (fee_type == "20") {
return await this.apply20(params, pobj2, req);
} else { } else {
return system.getResult(null, "费用类型错误"); return system.getResult(null, "费用类型错误");
} }
return await this.orderSve.page(params);
} catch (error) { } catch (error) {
let msg = error.message; let msg = error.message;
if (msg.startsWith("bpo-validation-error:")) { if (msg.startsWith("bpo-validation-error:")) {
...@@ -182,15 +184,15 @@ class InvoiceCtl extends CtlBase { ...@@ -182,15 +184,15 @@ class InvoiceCtl extends CtlBase {
* @param {*} pobj2 * @param {*} pobj2
* @param {*} req * @param {*} req
*/ */
async invoiceOrder(params, pobj2, req){ async invoiceOrder(params, pobj2, req) {
if(!params.id){ if (!params.id) {
return system.getResult(null,`发票ID 不能为空`); return system.getResult(null, `发票ID 不能为空`);
} }
try { try {
return await this.invoiceSve.invoiceOrder(params); return await this.invoiceSve.invoiceOrder(params);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
return system.getResult(null,`系统错误`); return system.getResult(null, `系统错误`);
} }
} }
...@@ -206,20 +208,23 @@ class InvoiceCtl extends CtlBase { ...@@ -206,20 +208,23 @@ class InvoiceCtl extends CtlBase {
return await this.invoiceSve.invoiceOrder(params); return await this.invoiceSve.invoiceOrder(params);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
return system.getResult(null,`系统错误`); return system.getResult(null, `系统错误`);
} }
} }
async buildTradeInvoice(params) { async buildTradeInvoice(params) {
let invoiceId = params.id; validation.check(params, 'data_ids', {name: "交易信息", arr_require: true});
let invoice_type = params.invoice_type; 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; items = items.data;
if (!items || items.length == 0) { if (!items || items.length == 0) {
return system.getResult(null, "该发票缺少交易信息,请联系平台查看原因"); return system.getResult(null, "注册订单信息有误,请刷新重新选择");
} }
let bmMap = {}; let bmMap = {};
let creditCodes = []; let creditCodes = [];
...@@ -282,8 +287,8 @@ class InvoiceCtl extends CtlBase { ...@@ -282,8 +287,8 @@ class InvoiceCtl extends CtlBase {
url: url, url: url,
data: calcParams data: calcParams
}); });
if(!res || !res.data || res.data.status !=0 || res.data.data.length==0){ if (!res || !res.data || res.data.status != 0 || res.data.data.length == 0) {
return system.getResult(null,`试算错误`); return system.getResult(null, `试算错误`);
} }
let calcList = res.data.data; let calcList = res.data.data;
...@@ -324,7 +329,7 @@ class InvoiceCtl extends CtlBase { ...@@ -324,7 +329,7 @@ class InvoiceCtl extends CtlBase {
}); });
} catch (error) { } catch (error) {
console.log(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