Commit b0c461a2 by 王栋源

wdy

parent 56158abf
......@@ -122,84 +122,84 @@ class businesschanceApplet extends AppletBase {
}
//发布需求
async submitneed(pobj, obj) {
// var serviceItem_name = "";
// var chanceType = "yzc";
// if (obj.publisherName == "" || obj.publisherName == null) {
// return { code: -100, msg: "请填写您的姓名" };
// }
// if (obj.publisherMobile == "" || obj.publisherMobile == null) {
// return { code: -100, msg: "请填写您的电话" };
// }
// if (obj.notes != "" && obj.notes.length > 255) {
// return { code: -100, msg: "备注字数超出限制,请重新填写" };
// }
var serviceItem_name = "";
var chanceType = "yzc";
if (obj.publisherName == "" || obj.publisherName == null) {
return { code: -100, msg: "请填写您的姓名" };
}
if (obj.publisherMobile == "" || obj.publisherMobile == null) {
return { code: -100, msg: "请填写您的电话" };
}
if (obj.notes != "" && obj.notes.length > 255) {
return { code: -100, msg: "备注字数超出限制,请重新填写" };
}
// if (obj.channelCode == "") {
// return { code: -110, msg: "channelCode参数传递错误" };
// }
// var channelItem = await this.channelSve.getChannelItem(obj.channelCode);
// if (channelItem == "" || channelItem == null) {
// return { code: -110, msg: "channelCode参数传递错误" };
// }
if (obj.channelCode == "") {
return { code: -110, msg: "channelCode参数传递错误" };
}
var channelItem = await this.channelSve.getChannelItem(obj.channelCode);
if (channelItem == "" || channelItem == null) {
return { code: -110, msg: "channelCode参数传递错误" };
}
// if (obj.serviceItem_code == "") {
// return { code: -110, msg: "serviceItem_code参数传递错误" };
// }
// var serviceItem = await this.servicesitemSve.findOneByCode(obj.serviceItem_code);
// if (serviceItem == "" || serviceItem == null) {
// return { code: -110, msg: "serviceItem_code参数传递错误" };
// } else {
// serviceItem_name = serviceItem.name;
// chanceType = serviceItem.itemType;
// }
if (obj.serviceItem_code == "") {
return { code: -110, msg: "serviceItem_code参数传递错误" };
}
var serviceItem = await this.servicesitemSve.findOneByCode(obj.serviceItem_code);
if (serviceItem == "" || serviceItem == null) {
return { code: -110, msg: "serviceItem_code参数传递错误" };
} else {
serviceItem_name = serviceItem.name;
chanceType = serviceItem.itemType;
}
// if (obj.publisherOnlyCode != "" && obj.shopOnlyCode != "") {
// var pobj = {
// publisherOnlyCode: obj.publisherOnlyCode,
// shopOnlyCode: obj.shopOnlyCode,
// serviceItem_code: obj.serviceItem_code,
// channelCode: obj.channelCode,
// chanceStatus: "1"
// }
// var result = await this.businesschanceService.findchance(pobj);
// if (result != "" && result != null) {
// return { code: "0", msg: "您已经发布需求,请不要重复提交" };
// }
// }
if (obj.publisherOnlyCode != "" && obj.shopOnlyCode != "") {
var pobj = {
publisherOnlyCode: obj.publisherOnlyCode,
shopOnlyCode: obj.shopOnlyCode,
serviceItem_code: obj.serviceItem_code,
channelCode: obj.channelCode,
chanceStatus: "1"
}
var result = await this.businesschanceService.findchance(pobj);
if (result != "" && result != null) {
return { code: "0", msg: "您已经发布需求,请不要重复提交" };
}
}
try {
// var reqParams = {
// notes: obj.notes,
// publisherName: obj.publisherName,
// publisherMobile: obj.publisherMobile,
// channelCode: obj.channelCode,
// serviceItem_code: obj.serviceItem_code,
// serviceItem_name: serviceItem_name,
// publisherOnlyCode: obj.publisherOnlyCode,
// shopOnlyCode: obj.shopOnlyCode,
// chanceStatus: "1",
// chanceType: chanceType,
// channelProfitRatio: channelItem.profitType == 1 ? (channelItem.everySingleProfit || 0) : 0,//渠道分成比率(如:总额100,字段值30,则渠道的利润为30/100,剩下的则为平台利润)
// channelProfit: channelItem.profitType == 2 ? (channelItem.everySingleProfit || 0) : 0,//渠道利润
// profitType: channelItem.profitType//渠道利润类型:1: "比例分成", 2: "每单分成"
// }
// //新增的省份和城市
// var tCity = obj.city || "";
// var tProvince = obj.province || "";
// if (tCity && tProvince) {
// reqParams.city = tCity;
// reqParams.province = tProvince;
// }
// // console.log(reqParams);
// var chance = await this.businesschanceService.create(reqParams);
// if (obj.shopOnlyCode != null && obj.shopOnlyCode != "" && obj.shopOnlyCode != "undefined" && chance) {
// var shopItem = await this.shopSve.getShopItem(obj.shopOnlyCode);
// if (shopItem != null && shopItem.userMobile != null && shopItem.userMobile != "" && shopItem.userMobile != "undefined") {
// //发送短信
// var smsClient = system.getObject("util.smsClient");
// smsClient.sendMsg(shopItem.userMobile, "亲,您的客户【" + obj.publisherName + "】于" + (new Date()).Format("yyyy-MM-dd") + "发布了关于【" +
// serviceItem_name + "】求购需求,赶紧到知产合伙人小程序中【我的商机】进行查看!");
// }
// }
var reqParams = {
notes: obj.notes,
publisherName: obj.publisherName,
publisherMobile: obj.publisherMobile,
channelCode: obj.channelCode,
serviceItem_code: obj.serviceItem_code,
serviceItem_name: serviceItem_name,
publisherOnlyCode: obj.publisherOnlyCode,
shopOnlyCode: obj.shopOnlyCode,
chanceStatus: "1",
chanceType: chanceType,
channelProfitRatio: channelItem.profitType == 1 ? (channelItem.everySingleProfit || 0) : 0,//渠道分成比率(如:总额100,字段值30,则渠道的利润为30/100,剩下的则为平台利润)
channelProfit: channelItem.profitType == 2 ? (channelItem.everySingleProfit || 0) : 0,//渠道利润
profitType: channelItem.profitType//渠道利润类型:1: "比例分成", 2: "每单分成"
}
//新增的省份和城市
var tCity = obj.city || "";
var tProvince = obj.province || "";
if (tCity && tProvince) {
reqParams.city = tCity;
reqParams.province = tProvince;
}
// console.log(reqParams);
var chance = await this.businesschanceService.create(reqParams);
if (obj.shopOnlyCode != null && obj.shopOnlyCode != "" && obj.shopOnlyCode != "undefined" && chance) {
var shopItem = await this.shopSve.getShopItem(obj.shopOnlyCode);
if (shopItem != null && shopItem.userMobile != null && shopItem.userMobile != "" && shopItem.userMobile != "undefined") {
//发送短信
var smsClient = system.getObject("util.smsClient");
smsClient.sendMsg(shopItem.userMobile, "亲,您的客户【" + obj.publisherName + "】于" + (new Date()).Format("yyyy-MM-dd") + "发布了关于【" +
serviceItem_name + "】求购需求,赶紧到知产合伙人小程序中【我的商机】进行查看!");
}
}
var token = "";
var app = {
......
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