Commit a13d2dae by 王昆

gsb

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