Commit 2fcebe4f by 王昆

Merge branch 'xggsve-invoice' of gitlab.gongsibao.com:jiangyong/zhichan into xggsve-invoice

parents aacf881d a7dee9bb
......@@ -63,7 +63,9 @@ class ActionAPI extends APIBase {
case "saveSaasInvoice": // 保存saasInvoice 信息
opResult = await this.saasinvoiceSve.saveSaasInvoice(action_body);
break;
case "saasInvoiceInfo": // 保存saasInvoiceInfo 信息
opResult = await this.saasinvoiceapplySve.saasInvoiceInfo(action_body);
break;
case "merchantinvoicePage" : //发票列表(商户)
opResult = await this.saasinvoiceSve.merchantinvoicePage(action_body);
break;
......
......@@ -49,9 +49,9 @@ class IInvoiceService extends ServiceBase {
// if(!params.apply_time){
// return system.getResult(null,`发票申请时间错误`);
// }
if (!params.invoice_content) {
return system.getResult(null, `开票内容不能为空`);
}
// if (!params.invoice_content) {
// return system.getResult(null, `开票内容不能为空`);
// }
// if(!params.contract){
// return system.getResult(null,`合同不能为空`);
// }
......
......@@ -16,7 +16,7 @@ class SaasinvoiceapplyService extends ServiceBase {
async byId(params) {
let apply = await this.dao.getById(params.id);
this.handleDate(apply, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss');
this.dictionary.setRowName("SAAS_INVOICE_APPLY",apply,["owner_type","fee_type","invoice_type","invoice_join"]);
this.dictionary.setRowName("SAAS_INVOICE_APPLY", apply, ["owner_type", "fee_type", "invoice_type", "invoice_join"]);
return system.getResult(apply);
}
async save(params) {
......@@ -52,7 +52,10 @@ class SaasinvoiceapplyService extends ServiceBase {
let total = await this.dao.countByParams(params);
if (total == 0) {
return system.getResult({count: 0, rows: []});
return system.getResult({
count: 0,
rows: []
});
}
let list = await this.dao.pageByParams(params);
......@@ -60,10 +63,13 @@ class SaasinvoiceapplyService extends ServiceBase {
for (var item of list) {
this.handleDate(item, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss');
// this.handleDate(item, ['invoice_time'], 'YYYY-MM-DD');
this.dictionary.setRowName("SAAS_INVOICE_APPLY",item,["owner_type","fee_type","invoice_type","invoice_join", "status"]);
this.dictionary.setRowName("SAAS_INVOICE_APPLY", item, ["owner_type", "fee_type", "invoice_type", "invoice_join", "status"]);
}
}
return system.getResultSuccess({count: total, rows: list});
return system.getResultSuccess({
count: total,
rows: list
});
}
async platforminvoiceapplyPage(params) {
......@@ -73,7 +79,10 @@ class SaasinvoiceapplyService extends ServiceBase {
let total = await this.dao.countByParams(params);
if (total == 0) {
return system.getResult({count: 0, rows: []});
return system.getResult({
count: 0,
rows: []
});
}
let list = await this.dao.pageByParams(params);
......@@ -81,10 +90,13 @@ class SaasinvoiceapplyService extends ServiceBase {
for (var item of list) {
this.handleDate(item, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss');
// this.handleDate(item, ['invoice_time'], 'YYYY-MM-DD');
this.dictionary.setRowName("SAAS_INVOICE_APPLY",item,["owner_type","fee_type","invoice_type","invoice_join", "status"]);
this.dictionary.setRowName("SAAS_INVOICE_APPLY", item, ["owner_type", "fee_type", "invoice_type", "invoice_join", "status"]);
}
}
return system.getResultSuccess({count: total, rows: list});
return system.getResultSuccess({
count: total,
rows: list
});
}
async audit(params) {
......@@ -125,12 +137,54 @@ class SaasinvoiceapplyService extends ServiceBase {
invoice.invoice_img = this.trim(params.invoice_img);
invoice = await this.db.transaction(async t => {
invoice = await this.saasinvoiceDao.create(invoice, t);
await this.dao.update({id: apply.id, status: "1040"}, t);
await this.dao.update({
id: apply.id,
status: "1040"
}, t);
return invoice;
});
return system.getResultSuccess(invoice);
}
/**
* fn:发票详情
* @param {*} params
*/
async saasInvoiceInfo(params) {
if (!params.id) {
return system.getResult(null, `参数错误 发票${params.id}不存在`);
}
try {
let saasInvoiceApply = await this.dao.getById(params.id);
if (!saasInvoiceApply) {
return system.getResult(null, `参数错误 发票${params.id}不存在`);
}
// 费用类型 00注册订单费用 10平台转账费用 20商户转账费用
if (saasInvoiceApply.fee_type == "00") {
saasInvoiceApply.fee_type_name = "注册订单费用";
} else if (saasInvoiceApply.fee_type == "10") {
saasInvoiceApply.fee_type_name = "平台转账费用";
} else if (saasInvoiceApply.fee_type == "20") {
saasInvoiceApply.fee_type_name = "商户转账费用";
}
// 发票类型 10 增值税专用发票 20 增值税普通发票 30 普通发票
if (saasInvoiceApply.invoice_type == "10") {
saasInvoiceApply.invoice_type_name = "增值税专用发票";
} else if (saasInvoiceApply.invoice_type == "20") {
saasInvoiceApply.invoice_type_name = "增值税普通发票";
} else if (saasInvoiceApply.invoice_type == "30") {
saasInvoiceApply.invoice_type_name = "普通发票";
}
this.handleDate(saasInvoiceApply, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss');
let saasInvoice = await this.saasinvoiceDao.getById(params.id) || {};
saasInvoiceApply.saasInvoice = saasInvoice;
return system.getResult(saasInvoiceApply);
} catch (error) {
console.log(error);
return system.getResult(null, `系统错误`);
}
}
}
module.exports = SaasinvoiceapplyService;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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