Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
b0c461a2
Commit
b0c461a2
authored
Feb 14, 2020
by
王栋源
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wdy
parent
56158abf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
74 deletions
+74
-74
scratch-web/app/base/wxapplet/impl/businesschanceApplet.js
+74
-74
No files found.
scratch-web/app/base/wxapplet/impl/businesschanceApplet.js
View file @
b0c461a2
...
...
@@ -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
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment