Commit f164c03b by 孙亚楠

Merge branch 'xgg-saas-platform' of gitlab.gongsibao.com:jiangyong/zhichan into xgg-saas-platform

parents df25f7d1 0bca57a0
......@@ -5,22 +5,26 @@ const validation = system.getObject("util.validation");
class InvoiceCtl extends CtlBase {
constructor() {
super();
this.invoiceSve = system.getObject("service.invoice.invoiceSve");
this.invoiceSve = system.getObject("service.saas.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:")) {
......@@ -47,7 +51,13 @@ class InvoiceCtl extends CtlBase {
}
async platformTitleAddr(params, pobj2, req) {
try {
let id = params.id;
this.invoiceSve.byid
let result = {};
//
result.title = {"merchant_name": "舟山兰和有限公司", "merchant_credit_code": "KHSDLKFJAFJ", "merchant_tax_type": "00", "merchant_addr": "河南信阳", "merchant_mobile": "18833836395", "merchant_bank": "北京银行栓秀支行", "merchant_account": "zhousanlanhe"};
result.addr = {"mail_addr": "北京朝阳区国创元", "mail_mobile": "010-4525821-44", "mail_to": "张娇哒哒哒",};
return system.getResultSuccess(result);
......@@ -87,7 +97,6 @@ class InvoiceCtl extends CtlBase {
}
}
//发票列表
async invoicePage(params, pobj2, req) {
try {
......@@ -138,41 +147,6 @@ class InvoiceCtl extends CtlBase {
}
}
// 审核
async platformAudit(params, pobj2, req) {
try {
let id = this.trim(params.id);
if (!id) {
return system.getResult(null, "发票申请不存在");
}
let status = params.status || 0;
let remark = this.trim(params.remark);
if (!remark) {
return system.getResult(null, "请填写审核备注");
}
return system.getResultSuccess();
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
// 审核
async platformAudit(params, pobj2, req) {
try {
let id = this.trim(params.id);
if (!id) {
return system.getResult(null, "发票申请不存在");
}
let status = params.status || 0;
let remark = this.trim(params.remark);
if (!remark) {
return system.getResult(null, "请填写审核备注");
}
return system.getResultSuccess();
} catch (error) {
return system.getResult(null, `系统错误 错误信息 ${error}`);
}
}
}
......
......@@ -36,33 +36,5 @@ class InvoiceService extends ServiceBase {
var rs = await this.callms("invoice", "invoice", params);
return rs;
}
async platforminvoicePage(params){
var rs = await this.callms("invoice", "platforminvoicePage", params);
if (rs && rs.data && rs.data.rows) {
this.transOrderField(rs.data.rows);
}
return rs;
}
async platforminvoiceapplyPage(params){
var rs = await this.callms("invoice", "platforminvoiceapplyPage", params);
if (rs && rs.data && rs.data.rows) {
this.transOrderField(rs.data.rows);
}
return rs;
}
transOrderField(rows) {
if (!rows || rows.length == 0) {
return;
}
for (let row of rows) {
row.price = system.f2y(row.price);
}
}
}
module.exports = InvoiceService;
const system = require("../../../system");
const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings")
class InvoiceService extends ServiceBase {
constructor() {
super();
}
async platforminvoicePage(params){
var rs = await this.callms("invoice", "platforminvoicePage", params);
if (rs && rs.data && rs.data.rows) {
this.transOrderField(rs.data.rows);
}
return rs;
}
async platforminvoiceapplyPage(params){
var rs = await this.callms("invoice", "platforminvoiceapplyPage", params);
if (rs && rs.data && rs.data.rows) {
this.transOrderField(rs.data.rows);
}
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;
}
async invoiceapplyById(params) {
var rs = await this.callms("invoice", "invoiceapplyById", params);
return rs;
}
transOrderField(rows) {
if (!rows || rows.length == 0) {
return;
}
for (let row of rows) {
row.price = system.f2y(row.price);
}
}
}
module.exports = InvoiceService;
......@@ -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;
......
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