Commit 72b93f00 by 王昆

dd

parent 2d72407f
......@@ -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,18 +52,24 @@ 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);
if (list) {
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.handleDate(item, ['invoice_time'], 'YYYY-MM-DD');
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,18 +79,24 @@ 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);
if (list) {
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.handleDate(item, ['invoice_time'], 'YYYY-MM-DD');
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,7 +137,10 @@ 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);
......@@ -135,41 +150,41 @@ class SaasinvoiceapplyService extends ServiceBase {
* fn:发票详情
* @param {*} params
*/
async saasInvoiceInfo(params){
if(!params.id){
return system.getResult(null,`参数错误 发票${params.id}不存在`);
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}不存在`);
let saasInvoiceApply = await this.dao.getById(params.id);
if (!saasInvoiceApply) {
return system.getResult(null, `参数错误 发票${params.id}不存在`);
}
// 费用类型 00注册订单费用 10平台转账费用 20商户转账费用
if(saasInvoiceApply.fee_type == "00"){
if (saasInvoiceApply.fee_type == "00") {
saasInvoiceApply.fee_type_name = "注册订单费用";
}else if(saasInvoiceApply.fee_type == "10"){
} else if (saasInvoiceApply.fee_type == "10") {
saasInvoiceApply.fee_type_name = "平台转账费用";
}else if(this.saasinvoiceDao.fee_type == "20"){
} else if (this.saasinvoiceDao.fee_type == "20") {
saasInvoiceApply.fee_type_name = "商户转账费用";
}
// 发票类型 10 增值税专用发票 20 增值税普通发票 30 普通发票
if(saasInvoiceApply.invoice_type == "10"){
if (saasInvoiceApply.invoice_type == "10") {
saasInvoiceApply.invoice_type_name = "增值税专用发票";
}else if(saasInvoiceApply.invoice_type == "20"){
} else if (saasInvoiceApply.invoice_type == "20") {
saasInvoiceApply.invoice_type_name = "增值税普通发票";
}else if(this.saasinvoiceDao.invoice_type == "30"){
} else if (this.saasinvoiceDao.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) || null;
let saasInvoice = await this.saasinvoiceDao.getById(params.id) || null;
saasInvoiceApply.saasInvoice = saasInvoice;
return system.getResult(saasInvoiceApply);
return system.getResult(saasInvoiceApply);
} catch (error) {
console.log(error);
return system.getResult(null,`系统错误`);
return system.getResult(null, `系统错误`);
}
}
}
module.exports = SaasinvoiceapplyService;
module.exports = SaasinvoiceapplyService;
\ No newline at end of file
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