Commit f5fa03cc by 王昆

gsb

parent f50cf729
var system = require("../../../system")
const CtlBase = require("../../ctlms.base");
var moment = require('moment');
class InvoiceCtl extends CtlBase {
constructor() {
super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
this.userSve = system.getObject("service.uc.userSve");
this.INVOICE_TYPE = ["10","20","30"];
this.INVOICE_TYPE = ["10", "20", "30"];
}
/**
* 业务进度字典
* @param {*} pobj
* @param {*} pobj
*/
async processDics(pobj, pobj2, req) {
try {
......@@ -24,7 +25,7 @@ class InvoiceCtl extends CtlBase {
/**
* 发票申请列表-平台(管理员)
* @param {*} pobj
* @param {*} pobj
*/
async invoicePage(pobj, pobj2, req) {
try {
......@@ -38,7 +39,7 @@ class InvoiceCtl extends CtlBase {
/**
* 发票申请列表-业务员
* @param {*} pobj
* @param {*} pobj
*/
async myInvoicePage(pobj, pobj2, req) {
try {
......@@ -53,7 +54,7 @@ class InvoiceCtl extends CtlBase {
/**
* 发票申请
* @param {*} pobj
* @param {*} pobj
*/
async invoiceApply(pobj, pobj2, req) {
try {
......@@ -72,7 +73,7 @@ class InvoiceCtl extends CtlBase {
/**
* 进度处理
* @param {*} pobj
* @param {*} pobj
*/
async handleStatus(pobj, pobj2, req) {
try {
......@@ -103,7 +104,7 @@ class InvoiceCtl extends CtlBase {
/**
* 根据ID查详细信息
* @param {*} pobj
* @param {*} pobj
*/
async invoice(pobj, pobj2, req) {
try {
......@@ -116,9 +117,9 @@ class InvoiceCtl extends CtlBase {
/**
* 发票推送
* @param {*} pobj
* @param {*} pobj2
* @param {*} req
* @param {*} pobj
* @param {*} pobj2
* @param {*} req
*/
async uploadDetail(pobj, pobj2, req) {
if (!pobj.invoice_id) {
......@@ -128,24 +129,24 @@ class InvoiceCtl extends CtlBase {
return res;
}
/**
* 发票试算接口
* @param {*} pobj
*/
async calcInvoice(pobj) {
try {
return await this.invoiceSve.calcInvoice(pobj);
} catch (error) {
console.log(error);
return system.getResultFail(500, `接口错误 错误信息 ${error}`);
}
}
// /**
// * 发票试算接口
// * @param {*} pobj
// */
// async calcInvoice(pobj) {
// try {
// return await this.invoiceSve.calcInvoice(pobj);
// } catch (error) {
// console.log(error);
// return system.getResultFail(500, `接口错误 错误信息 ${error}`);
// }
// }
/**
* 发票试算接口
* @param {*} pobj
* @param {*} query
* @param {*} req
* @param {*} pobj
* @param {*} query
* @param {*} req
*/
async calcInvoice(pobj, query, req) {
let res = [],
......@@ -168,15 +169,24 @@ class InvoiceCtl extends CtlBase {
}
try {
let rs = await this.invoiceSve.calcInvoice(params);
if (!rs) {
rs = {
if (rs.status !== 0) {
res.push({
credit_code: item.credit_code,
msg: "试算失败"
};
status: rs.status,
msg: rs.msg
});
continue;
}
res.push(rs);
let data = rs.data;
data.status = rs.status;
res.push(data);
} catch (error) {
console.log(error);
res.push({
credit_code: item.credit_code,
status: rs.status,
msg: "试算异常," + error.message
});
}
}
return system.getResult(res);
......@@ -234,7 +244,6 @@ class InvoiceCtl extends CtlBase {
// }
// /**
// * 计算发票增值税
// * @param {*} pobj
......@@ -430,4 +439,5 @@ class InvoiceCtl extends CtlBase {
// }
// }
}
module.exports = InvoiceCtl;
\ No newline at end of file
......@@ -377,10 +377,16 @@ class InvoiceService extends ServiceBase {
value_added_tax = system.f2y(value_added_tax);
additional_tax = system.f2y(additional_tax);
service_amount = system.f2y(service_amount);
return {personal_invoice_tax:personal_invoice_tax,value_added_tax:value_added_tax,additional_tax:additional_tax,service_amount:service_amount,credit_code:params.credit_code};
return system.getResultSuccess({
personal_invoice_tax: personal_invoice_tax,
value_added_tax: value_added_tax,
additional_tax: additional_tax,
service_amount: service_amount,
credit_code: params.credit_code
});
} catch (error) {
console.log(error);
return 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