Commit f71fdc86 by 宋毅

Merge branch 'center-order' of gitlab.gongsibao.com:jiangyong/zhichan into center-order

parents 6aa83998 69397723
...@@ -60,6 +60,18 @@ class IcAPI extends APIBase { ...@@ -60,6 +60,18 @@ class IcAPI extends APIBase {
case "solutionClose"://需求关闭 case "solutionClose"://需求关闭
opResult = await this.needinfoSve.solutionClose(pobj); opResult = await this.needinfoSve.solutionClose(pobj);
break; break;
case "abolishProgrammeByNeed"://根据需求关闭方案(关闭需求后调用)
opResult = await this.needsolutionSve.abolishProgrammeByNeed(pobj);
break;
case "createSolutionByOrder"://立即支付下单保存方案
opResult = await this.needsolutionSve.createSolutionByOrder(pobj);
break;
case "receiveSolutionPayInfo"://接收方案状态及支付信息(方案支付后创建订单时调用)
opResult = await this.needsolutionSve.receiveSolutionPayInfo(pobj);
break;
case "updateStausByRefundOrder"://修改退款方案状态
opResult = await this.needsolutionSve.updateStausByRefundOrder(pobj);
break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
break; break;
......
...@@ -294,10 +294,10 @@ class NeedsolutionService extends ServiceBase { ...@@ -294,10 +294,10 @@ class NeedsolutionService extends ServiceBase {
}else{ }else{
return system.getResultFail(-104,"操作类型有误"); return system.getResultFail(-104,"操作类型有误");
} }
var solution_status={"dqr":"待确认","ywc":"已完成","yzf":"已作废"}; // var solution_status={"dqr":"待确认","ywc":"已完成","yzf":"已作废"};
solutionContent["deliveryStatus"] = status; // solutionContent["deliveryStatus"] = status;
solutionContent["deliveryStatusName"] = solution_status[status]; // solutionContent["deliveryStatusName"] = solution_status[status];
solutionContent["updated"] = new Date(); // solutionContent["updated"] = new Date();
if(ab.note){ if(ab.note){
solutionContent["notes"] = ab.note; solutionContent["notes"] = ab.note;
} }
...@@ -369,15 +369,6 @@ class NeedsolutionService extends ServiceBase { ...@@ -369,15 +369,6 @@ class NeedsolutionService extends ServiceBase {
if(!app || !app.uapp_id){ if(!app || !app.uapp_id){
return system.getResultFail(-100,"未知渠道"); return system.getResultFail(-100,"未知渠道");
} }
if(!ab.solutionBizid){
return system.getResultFail(-101,"需求编号不能为空");
}
var needinfo = await this.needinfoDao.model.findOne({
where:{channelNeedNo:ab.intentionBizId,uapp_id:app.uapp_id},raw:true
});
if(!needinfo || !needinfo.id){
return system.getResultFail(-102,"未知需求信息");
}
var solution = ""; var solution = "";
var bizType = "esp.companyreg"; var bizType = "esp.companyreg";
if(ab.companyName){ if(ab.companyName){
...@@ -409,26 +400,77 @@ class NeedsolutionService extends ServiceBase { ...@@ -409,26 +400,77 @@ class NeedsolutionService extends ServiceBase {
// ab["solutionNo"] = solutionNo; // ab["solutionNo"] = solutionNo;
var solutionNo = await this.getBusUid("ns"); var solutionNo = await this.getBusUid("ns");
var reqObj = { var reqObj = {
solutionContent:solutionContent,solutionNo:solutionNo,status:"ywc",needNo:needinfo.needNo, solutionContent:solutionContent,solutionNo:solutionNo,status:"ywc",orderNo:ab.orderNo
channelNeedNo:needinfo.channelNeedNo,orderNo:ab.orderNo,createUserId:needinfo.followManUserId
}; };
await this.dao.create(reqObj); var ns = await this.dao.create(reqObj);
return system.getResultSuccess(); return system.getResultSuccess(ns);
}
//接收方案状态及支付信息
async receiveSolutionPayInfo(pobj){
var ab = pobj.actionBody;
var app = pobj.appInfo;
if(!app || !app.uapp_id){
return system.getResultFail(-100,"未知渠道");
}
if(!ab.channelSolutionNo){
return system.getResultFail(-101,"渠道方案编号不能为空");
}
// if(!ab.status){
// return system.getResultFail(-102,"状态不能为空");
// }
var needsolutioninfo = await this.dao.model.findOne({
where:{channelSolutionNo: ab.channelSolutionNo},raw:true
});
if(!needsolutioninfo || !needsolutioninfo.id){
return system.getResultFail(-400,"未知方案");
}
var solutionContent = needsolutioninfo.solutionContent;
if(ab.orderPrice){
// solutionContent = JSON.parse(solutionContent);
solutionContent["totalSum"] = ab.orderPrice;
needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
}
if(ab.status){
needsolutioninfo.status = ab.status;
}
await this.dao.update(needsolutioninfo);
var ns = await this.dao.model.findOne({
where:{channelSolutionNo: ab.channelSolutionNo},raw:true
});
return system.getResultSuccess(ns);
} }
//修改退款方案状态
async updateStausByRefundOrder(pobj){
var ab = pobj.actionBody;
var app = pobj.appInfo;
if(!ab.orderNo){
return system.getResultFail(-101,"订单号不能为空");
}
var ns = await this.dao.model.findOne({
where:{orderNo:ab.orderNo},raw:true
});
if(!ns || !ns.id){
return system.getResultFail(-103,"未知方案");
}
var status = "yzf";
var reqObj={
status:status,id:ns.id
};
await this.dao.model.update(reqObj, { where: { id: ns.id }});//修改方案信息
return system.getResultSuccess();
}
} }
module.exports = NeedsolutionService; module.exports = NeedsolutionService;
// var task = new NeedsolutionService();
// task.dao.model.findOne({
// where:{solutionNo: "NS202003181420k00Oec"},raw:true
// }).then(needsolutioninfo=>{
// console.log(needsolutioninfo,"1111111111111111111111111");
// var solutionContent = needsolutioninfo.solutionContent;
// console.log(solutionContent,"222222222222222222222");
// // var so = JSON.parse(solutionContent);
// console.log(solutionContent.bizType,"333333333333333333333");
// });
// orderNo
// orderPrice
// phone
// companyName
// city
// area
// companyCategory
// companyType
// orgType
// industryType
// scope
// remark
// solutionBizidchannelNeedNo
\ No newline at end of file
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