Commit 3a85cecc by linboxuan

lin

parents c101a775 cb90f682
...@@ -485,6 +485,16 @@ class NeedsolutionService extends ServiceBase { ...@@ -485,6 +485,16 @@ class NeedsolutionService extends ServiceBase {
if (!app || !app.uapp_id) { if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道"); return system.getResultFail(-100, "未知渠道");
} }
var ns
if (ab.isDirectBuy){//直购先创建空方案
var solutionNo = await this.getBusUid("ns");
ns = await this.create({
solutionNo,
...ab,
status:"ywc",
solutionContent:JSON.stringify({totalSum: Number(ab.orderPrice || "0")})
})
}else {
if (!ab.channelSolutionNo) { if (!ab.channelSolutionNo) {
return system.getResultFail(-101, "渠道方案编号不能为空"); return system.getResultFail(-101, "渠道方案编号不能为空");
} }
...@@ -492,8 +502,8 @@ class NeedsolutionService extends ServiceBase { ...@@ -492,8 +502,8 @@ class NeedsolutionService extends ServiceBase {
// return system.getResultFail(-102,"状态不能为空"); // return system.getResultFail(-102,"状态不能为空");
// } // }
var needsolutioninfo = await this.dao.model.findOne({ var needsolutioninfo = await this.dao.model.findOne({
attributes:["id","solutionContent","status","orderNo"], attributes: ["id", "solutionContent", "status", "orderNo"],
where: { channelSolutionNo: ab.channelSolutionNo,isInvalid:0 }, raw: true where: {channelSolutionNo: ab.channelSolutionNo, isInvalid: 0}, raw: true
}); });
if (!needsolutioninfo || !needsolutioninfo.id) { if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案"); return system.getResultFail(-400, "未知方案");
...@@ -513,9 +523,10 @@ class NeedsolutionService extends ServiceBase { ...@@ -513,9 +523,10 @@ class NeedsolutionService extends ServiceBase {
} }
needsolutioninfo.solutionContent = JSON.stringify(solutionContent); needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
await this.dao.update(needsolutioninfo); await this.dao.update(needsolutioninfo);
var ns = await this.dao.model.findOne({ ns = await this.dao.model.findOne({
where: { id: needsolutioninfo.id }, raw: true where: { id: needsolutioninfo.id }, raw: true
}); });
}
return system.getResultSuccess(ns); return system.getResultSuccess(ns);
} }
......
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