Commit a13d2dae by 王昆

gsb

parent ae5e8fff
...@@ -6,21 +6,25 @@ class InvoiceCtl extends CtlBase { ...@@ -6,21 +6,25 @@ class InvoiceCtl extends CtlBase {
constructor() { constructor() {
super(); super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve"); this.invoiceSve = system.getObject("service.invoice.invoiceSve");
this.tradeSve = system.getObject("service.trade.tradeSve");
} }
// 审核 // 审核
async audit(params, pobj2, req) { async audit(params, pobj2, req) {
try { try {
let id = this.trim(params.id); params.id = this.trim(params.id);
if (!id) { if (!params.id) {
return system.getResult(null, "发票申请不存在"); return system.getResult(null, "发票申请不存在");
} }
let status = params.status || 0; params.remark = this.trim(params.remark);
let remark = this.trim(params.remark); if (!params.remark) {
if (!remark) {
return system.getResult(null, "请填写审核备注"); return system.getResult(null, "请填写审核备注");
} }
return system.getResultSuccess(); let rs = await this.invoiceSve.audit(params)
if (rs.status === 0 && !params.status) {
await this.tradeSve.cancelInvoice({saas_invoice_id: params.id});
}
return rs;
} catch (error) { } catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`); return system.getResult(null, `系统错误 错误信息 ${error}`);
} }
...@@ -35,8 +39,8 @@ class InvoiceCtl extends CtlBase { ...@@ -35,8 +39,8 @@ class InvoiceCtl extends CtlBase {
validation.check(params, 'invoice_time', {name: "开票时间", is_require: true}); validation.check(params, 'invoice_time', {name: "开票时间", is_require: true});
validation.check(params, 'mail_no', {name: "快递单号", is_require: true}); validation.check(params, 'mail_no', {name: "快递单号", is_require: true});
validation.check(params, 'invoice_img', {name: "发票图片", is_require: true}); validation.check(params, 'invoice_img', {name: "发票图片", is_require: true});
let rs = await this.invoiceSve.makeout(params);
return system.getResultSuccess(params); return rs;
} catch (error) { } catch (error) {
let msg = error.message; let msg = error.message;
if (msg.startsWith("bpo-validation-error:")) { if (msg.startsWith("bpo-validation-error:")) {
......
...@@ -54,6 +54,16 @@ class InvoiceService extends ServiceBase { ...@@ -54,6 +54,16 @@ class InvoiceService extends ServiceBase {
return rs; return rs;
} }
async audit(params) {
var rs = await this.callms("invoice", "invoiceapplyAudit", params);
return rs;
}
async makeout(params) {
var rs = await this.callms("invoice", "invoiceapplyMakeOut", params);
return rs;
}
transOrderField(rows) { transOrderField(rows) {
if (!rows || rows.length == 0) { if (!rows || rows.length == 0) {
return; return;
......
...@@ -87,6 +87,11 @@ class TradeService extends ServiceBase { ...@@ -87,6 +87,11 @@ class TradeService extends ServiceBase {
return rs; return rs;
} }
async cancelInvoice(params) {
let rs = await this.callms("trade", "cancelItemInvoice", params);
return rs;
}
transFields(rows) { transFields(rows) {
if (!rows || rows.length == 0) { if (!rows || rows.length == 0) {
return; return;
......
...@@ -194,7 +194,7 @@ class System { ...@@ -194,7 +194,7 @@ class System {
common: dev + ":3102" + path, common: dev + ":3102" + path,
// 商户服务 // 商户服务
merchant: local + ":3101" + path, merchant: dev + ":3101" + path,
// 订单服务 // 订单服务
order: dev + ":3103" + path, order: dev + ":3103" + path,
......
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