Commit 5e474e27 by 王昆

dd

parents 2333da26 c8ec1a44
......@@ -7,6 +7,7 @@ class BusinessmenService extends ServiceBase {
constructor() {
super();
}
async info(params) {
let rs = await this.callms("order", "queryObusinessmen", params);
this.transField([rs.data]);
......@@ -25,7 +26,7 @@ class BusinessmenService extends ServiceBase {
/**
* @params 个体户签约
*/
async signing(params){
async signing(params) {
try {
return await this.callms("order", "signing", params);
} catch (error) {
......@@ -34,7 +35,7 @@ class BusinessmenService extends ServiceBase {
}
}
async signNames(params){
async signNames(params) {
try {
return await this.callms("order", "signNames", params);
} catch (error) {
......@@ -46,7 +47,7 @@ class BusinessmenService extends ServiceBase {
/**
* @params 建仗
*/
async createAccount(params){
async createAccount(params) {
try {
// 查个体户
let businessmen = await this.callms("order", "queryObusinessmen", params);
......@@ -71,15 +72,24 @@ class BusinessmenService extends ServiceBase {
let url = settings.ntapi().createCustomer;
let res = await this.callApi(url, data, "建账");
console.log(res);
if(!res || !res.data) {
if (!res || !res.data) {
return system.getResult(null, "建账失败");
}
if(res.data) {
if (res.data) {
await this.callms("order", "createAccount", {
id: params.id,
province: params.province,
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();
} catch (error) {
......@@ -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) {
if (!rows) {
return;
}
for (var row of rows) {
if(!row) {
if (!row) {
continue;
}
row.costRate = system.f2y(row.costRate);
......@@ -115,7 +150,7 @@ class BusinessmenService extends ServiceBase {
if (!f) {
continue;
}
if(!row[f]) {
if (!row[f]) {
row[f] = [];
continue;
}
......
......@@ -182,12 +182,12 @@ class System {
// merchant: "http://127.0.0.1:3101" + path,
// 订单服务
order: domain + ":3103" + path,
// order: domain2 + ":3103" + path,
order: domain2 + ":3103" + path,
// order: domain + ":3103" + path,
// 发票服务
invoice: domain2 + ":3105" + path,
// invoice: "http://127.0.0.1:3105" + path,
// invoice: domain2 + ":3105" + path,
invoice: domain + ":3105" + path,
// 用户中心
uc: domain + ":3106" + 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