Commit cb90f682 by 王悦

阿里直购创建需求方案

parent 4a145b04
...@@ -118,7 +118,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -118,7 +118,7 @@ class NeedsolutionService extends ServiceBase {
needObj = { needObj = {
id: needinfo.id, id: needinfo.id,
followManUserId: user.id,//跟进人id followManUserId: user.id,//跟进人id
followManName: user.channel_username,//跟进人姓名 followManName: user.channel_username,//跟进人姓名
followManMobile: user.mobile,//跟进人手机号(合伙人) followManMobile: user.mobile,//跟进人手机号(合伙人)
followManOnlyCode: user.channel_userid followManOnlyCode: user.channel_userid
}; };
...@@ -485,37 +485,48 @@ class NeedsolutionService extends ServiceBase { ...@@ -485,37 +485,48 @@ class NeedsolutionService extends ServiceBase {
if (!app || !app.uapp_id) { if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道"); return system.getResultFail(-100, "未知渠道");
} }
if (!ab.channelSolutionNo) { var ns
return system.getResultFail(-101, "渠道方案编号不能为空"); if (ab.isDirectBuy){//直购先创建空方案
} var solutionNo = await this.getBusUid("ns");
// if(!ab.status){ ns = await this.create({
// return system.getResultFail(-102,"状态不能为空"); solutionNo,
// } ...ab,
var needsolutioninfo = await this.dao.model.findOne({ status:"ywc",
attributes:["id","solutionContent","status","orderNo"], solutionContent:JSON.stringify({totalSum: Number(ab.orderPrice || "0")})
where: { channelSolutionNo: ab.channelSolutionNo,isInvalid:0 }, raw: true })
}); }else {
if (!needsolutioninfo || !needsolutioninfo.id) { if (!ab.channelSolutionNo) {
return system.getResultFail(-400, "未知方案"); return system.getResultFail(-101, "渠道方案编号不能为空");
} }
var solutionContent = needsolutioninfo.solutionContent; // if(!ab.status){
if (ab.orderPrice) { // return system.getResultFail(-102,"状态不能为空");
// solutionContent = JSON.parse(solutionContent); // }
solutionContent["totalSum"] = Number(ab.orderPrice || "0"); var needsolutioninfo = await this.dao.model.findOne({
} attributes: ["id", "solutionContent", "status", "orderNo"],
// 2020 1017 lin 新增去掉status的判断,生成订单这个方案才算完成,所以没必要再判断,另一个原因网文2.3每个状态都有不同status,所以不能以来有没有status来决定方案完成情况。 where: {channelSolutionNo: ab.channelSolutionNo, isInvalid: 0}, raw: true
// if (ab.status) { });
// needsolutioninfo.status = "ywc"; if (!needsolutioninfo || !needsolutioninfo.id) {
// } return system.getResultFail(-400, "未知方案");
if (ab.orderNo) { }
needsolutioninfo.orderNo = ab.orderNo; var solutionContent = needsolutioninfo.solutionContent;
needsolutioninfo.status = "ywc"; if (ab.orderPrice) {
// solutionContent = JSON.parse(solutionContent);
solutionContent["totalSum"] = Number(ab.orderPrice || "0");
}
// 2020 1017 lin 新增去掉status的判断,生成订单这个方案才算完成,所以没必要再判断,另一个原因网文2.3每个状态都有不同status,所以不能以来有没有status来决定方案完成情况。
// if (ab.status) {
// needsolutioninfo.status = "ywc";
// }
if (ab.orderNo) {
needsolutioninfo.orderNo = ab.orderNo;
needsolutioninfo.status = "ywc";
}
needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
await this.dao.update(needsolutioninfo);
ns = await this.dao.model.findOne({
where: { id: needsolutioninfo.id }, raw: true
});
} }
needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
await this.dao.update(needsolutioninfo);
var ns = await this.dao.model.findOne({
where: { id: needsolutioninfo.id }, raw: true
});
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
...@@ -688,7 +699,7 @@ class NeedsolutionService extends ServiceBase { ...@@ -688,7 +699,7 @@ class NeedsolutionService extends ServiceBase {
needObj = { needObj = {
id: needinfo.id, id: needinfo.id,
followManUserId: user.id,//跟进人id followManUserId: user.id,//跟进人id
followManName: user.channel_username,//跟进人姓名 followManName: user.channel_username,//跟进人姓名
followManMobile: user.mobile,//跟进人手机号(合伙人) followManMobile: user.mobile,//跟进人手机号(合伙人)
followManOnlyCode: user.channel_userid followManOnlyCode: user.channel_userid
}; };
......
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