Commit a1bf136b by 王昆

gsb

parent e46c4abf
...@@ -7,6 +7,7 @@ class BusinessmenService extends ServiceBase { ...@@ -7,6 +7,7 @@ class BusinessmenService extends ServiceBase {
constructor() { constructor() {
super(); super();
} }
async info(params) { async info(params) {
let rs = await this.callms("order", "queryObusinessmen", params); let rs = await this.callms("order", "queryObusinessmen", params);
this.transField([rs.data]); this.transField([rs.data]);
...@@ -25,7 +26,7 @@ class BusinessmenService extends ServiceBase { ...@@ -25,7 +26,7 @@ class BusinessmenService extends ServiceBase {
/** /**
* @params 个体户签约 * @params 个体户签约
*/ */
async signing(params){ async signing(params) {
try { try {
return await this.callms("order", "signing", params); return await this.callms("order", "signing", params);
} catch (error) { } catch (error) {
...@@ -34,7 +35,7 @@ class BusinessmenService extends ServiceBase { ...@@ -34,7 +35,7 @@ class BusinessmenService extends ServiceBase {
} }
} }
async signNames(params){ async signNames(params) {
try { try {
return await this.callms("order", "signNames", params); return await this.callms("order", "signNames", params);
} catch (error) { } catch (error) {
...@@ -46,7 +47,7 @@ class BusinessmenService extends ServiceBase { ...@@ -46,7 +47,7 @@ class BusinessmenService extends ServiceBase {
/** /**
* @params 建仗 * @params 建仗
*/ */
async createAccount(params){ async createAccount(params) {
try { try {
// 查个体户 // 查个体户
let businessmen = await this.callms("order", "queryObusinessmen", params); let businessmen = await this.callms("order", "queryObusinessmen", params);
...@@ -71,15 +72,24 @@ class BusinessmenService extends ServiceBase { ...@@ -71,15 +72,24 @@ class BusinessmenService extends ServiceBase {
let url = settings.ntapi().createCustomer; let url = settings.ntapi().createCustomer;
let res = await this.callApi(url, data, "建账"); let res = await this.callApi(url, data, "建账");
console.log(res); console.log(res);
if(!res || !res.data) { if (!res || !res.data) {
return system.getResult(null, "建账失败"); return system.getResult(null, "建账失败");
} }
if(res.data) { if (res.data) {
await this.callms("order", "createAccount", { await this.callms("order", "createAccount", {
id: params.id, id: params.id,
province: params.province, province: params.province,
customer_id: res.data, customer_id: res.data,
}); });
// 异步推送建账信息 TODO 孙总统测
this.pushBusinessmenInfo({
order_id: businessmen.order_id,
company_id: deliver.nt_company_id,
customer_id: res.data,
name: businessmen.name,
credit_code: businessmen.credit_code,
});
} }
return system.getResultSuccess(); return system.getResultSuccess();
} catch (error) { } catch (error) {
...@@ -88,13 +98,38 @@ class BusinessmenService extends ServiceBase { ...@@ -88,13 +98,38 @@ class BusinessmenService extends ServiceBase {
} }
} }
// 推送建账信息 TODO 孙总统测
async pushBusinessmenInfo(params) {
let order = await this.callms("order", "orderInfo", {id: params.order_id}) || {};
order = order.data;
if (!order) {
return;
}
if (!order.saas_deliver_api) {
return;
}
let data = {
source_no: order.source_no,
status: "1000000",
company_id: params.company_id,
customer_id: params.customer_id,
name: params.name,
credit_code: params.credit_code,
}
axios({
method: 'post',
url: order.saas_deliver_api,
data: data
});
}
transField(rows) { transField(rows) {
if (!rows) { if (!rows) {
return; return;
} }
for (var row of rows) { for (var row of rows) {
if(!row) { if (!row) {
continue; continue;
} }
row.costRate = system.f2y(row.costRate); row.costRate = system.f2y(row.costRate);
...@@ -115,7 +150,7 @@ class BusinessmenService extends ServiceBase { ...@@ -115,7 +150,7 @@ class BusinessmenService extends ServiceBase {
if (!f) { if (!f) {
continue; continue;
} }
if(!row[f]) { if (!row[f]) {
row[f] = []; row[f] = [];
continue; continue;
} }
......
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