Commit f5317565 by 王昆

gsb

parent 802212bf
......@@ -596,7 +596,7 @@ class OrderCtl extends CtlBase {
try {
let rs = await this.orderSve.handleStatus(pobj);
if (rs && rs.status === 0) {
this.createAccount(pobj);
// this.createAccount(pobj);
}
} catch (error) {
console.log(error);
......@@ -604,60 +604,60 @@ class OrderCtl extends CtlBase {
}
}
/**
* @params 建仗
*/
async createAccount(params) {
try {
// 查个体户
let businessmen = await this.callms("order", "queryObusinessmen", params);
businessmen = businessmen.data;
// 查个体户的交付商
var deliver = await this.callms("common", "deliverInfo", {id: params.deliver_id});
deliver = deliver.data;
let user = await this.callms("common", "deliverUserInfo", {id: deliver.admin_id}) || {};
user = (user.data || {}).user || {};
let data = {
customerName: businessmen.name,
initPeriod: Number(moment().format("YYYYMM")),
// initPeriod: moment().format("YYYYMM"),
accountStandard: 1,
valueAddedTax: 2,
bankStatus: businessmen.is_bank ? 1 : 0,
accountant: user.nt_user_id,
province: params.province,
companyId: deliver.nt_company_id,
}
let url = settings.ntapi().createCustomer;
let res = await this.callApi(url, data, "建账");
console.log(res);
if (!res || !res.data) {
return system.getResult(null, "建账失败");
}
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,
businessmen:businessmen
});
}
return system.getResultSuccess();
} catch (error) {
console.log(error);
return system.getResult(error);
}
}
// /**
// * @params 建仗
// */
// async createAccount(params) {
// try {
// // 查个体户
// let businessmen = await this.callms("order", "queryObusinessmen", params);
// businessmen = businessmen.data;
// // 查个体户的交付商
// var deliver = await this.callms("common", "deliverInfo", {id: params.deliver_id});
// deliver = deliver.data;
//
// let user = await this.callms("common", "deliverUserInfo", {id: deliver.admin_id}) || {};
// user = (user.data || {}).user || {};
// let data = {
// customerName: businessmen.name,
// initPeriod: Number(moment().format("YYYYMM")),
// // initPeriod: moment().format("YYYYMM"),
// accountStandard: 1,
// valueAddedTax: 2,
// bankStatus: businessmen.is_bank ? 1 : 0,
// accountant: user.nt_user_id,
// province: params.province,
// companyId: deliver.nt_company_id,
// }
// let url = settings.ntapi().createCustomer;
// let res = await this.callApi(url, data, "建账");
// console.log(res);
// if (!res || !res.data) {
// return system.getResult(null, "建账失败");
// }
// 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,
// businessmen:businessmen
// });
// }
// return system.getResultSuccess();
// } catch (error) {
// console.log(error);
// return system.getResult(error);
// }
// }
/**
* ali客户交付
......
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