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 { ...@@ -63,7 +63,9 @@ class ActionAPI extends APIBase {
case "saveSaasInvoice": // 保存saasInvoice 信息 case "saveSaasInvoice": // 保存saasInvoice 信息
opResult = await this.saasinvoiceSve.saveSaasInvoice(action_body); opResult = await this.saasinvoiceSve.saveSaasInvoice(action_body);
break; break;
case "saasInvoiceInfo": // 保存saasInvoiceInfo 信息
opResult = await this.saasinvoiceapplySve.saasInvoiceInfo(action_body);
break;
case "merchantinvoicePage" : //发票列表(商户) case "merchantinvoicePage" : //发票列表(商户)
opResult = await this.saasinvoiceSve.merchantinvoicePage(action_body); opResult = await this.saasinvoiceSve.merchantinvoicePage(action_body);
break; break;
......
...@@ -49,9 +49,9 @@ class IInvoiceService extends ServiceBase { ...@@ -49,9 +49,9 @@ class IInvoiceService extends ServiceBase {
// if(!params.apply_time){ // if(!params.apply_time){
// return system.getResult(null,`发票申请时间错误`); // return system.getResult(null,`发票申请时间错误`);
// } // }
if (!params.invoice_content) { // if (!params.invoice_content) {
return system.getResult(null, `开票内容不能为空`); // return system.getResult(null, `开票内容不能为空`);
} // }
// if(!params.contract){ // if(!params.contract){
// return system.getResult(null,`合同不能为空`); // return system.getResult(null,`合同不能为空`);
// } // }
......
...@@ -16,7 +16,7 @@ class SaasinvoiceapplyService extends ServiceBase { ...@@ -16,7 +16,7 @@ class SaasinvoiceapplyService extends ServiceBase {
async byId(params) { async byId(params) {
let apply = await this.dao.getById(params.id); let apply = await this.dao.getById(params.id);
this.handleDate(apply, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss'); 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); return system.getResult(apply);
} }
async save(params) { async save(params) {
...@@ -52,18 +52,24 @@ class SaasinvoiceapplyService extends ServiceBase { ...@@ -52,18 +52,24 @@ class SaasinvoiceapplyService extends ServiceBase {
let total = await this.dao.countByParams(params); let total = await this.dao.countByParams(params);
if (total == 0) { if (total == 0) {
return system.getResult({count: 0, rows: []}); return system.getResult({
count: 0,
rows: []
});
} }
let list = await this.dao.pageByParams(params); let list = await this.dao.pageByParams(params);
if (list) { if (list) {
for (var item of list) { for (var item of list) {
this.handleDate(item, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss'); this.handleDate(item, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss');
// this.handleDate(item, ['invoice_time'], 'YYYY-MM-DD'); // 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) { async platforminvoiceapplyPage(params) {
...@@ -73,18 +79,24 @@ class SaasinvoiceapplyService extends ServiceBase { ...@@ -73,18 +79,24 @@ class SaasinvoiceapplyService extends ServiceBase {
let total = await this.dao.countByParams(params); let total = await this.dao.countByParams(params);
if (total == 0) { if (total == 0) {
return system.getResult({count: 0, rows: []}); return system.getResult({
count: 0,
rows: []
});
} }
let list = await this.dao.pageByParams(params); let list = await this.dao.pageByParams(params);
if (list) { if (list) {
for (var item of list) { for (var item of list) {
this.handleDate(item, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss'); this.handleDate(item, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss');
// this.handleDate(item, ['invoice_time'], 'YYYY-MM-DD'); // 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) { async audit(params) {
...@@ -125,12 +137,54 @@ class SaasinvoiceapplyService extends ServiceBase { ...@@ -125,12 +137,54 @@ class SaasinvoiceapplyService extends ServiceBase {
invoice.invoice_img = this.trim(params.invoice_img); invoice.invoice_img = this.trim(params.invoice_img);
invoice = await this.db.transaction(async t => { invoice = await this.db.transaction(async t => {
invoice = await this.saasinvoiceDao.create(invoice, 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 invoice;
}); });
return system.getResultSuccess(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; 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