Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
dev
/
marubi-wish-list-mp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
28e34513
authored
2019-07-30 19:06:09 +0800
by
simon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
版本提交
1 parent
cadba6d8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
2 deletions
src/pages/create-wish/create-wish.js
src/pages/create-wish/create-wish.js
View file @
28e3451
...
...
@@ -5,13 +5,18 @@ Page({
tipsGroupMemberVisible
:
false
,
tipsNewMemberVisible
:
false
,
curStatus
:
1
,
// 当前场景
candidate
:
[],
// 心愿候选列表
myWishList
:
[],
// 我的心愿列表
},
onShareAppMessage
()
{},
onLoad
(
options
)
{
this
.
initData
();
},
initData
()
{
app
.
queryIndex
().
then
((
result
)
=>
{});
app
.
queryIndex
().
then
((
result
)
=>
{
this
.
queryWishbillPrizeCandidate
();
});
},
/**
* 点击提交心愿单按钮
...
...
@@ -62,10 +67,15 @@ Page({
}
// 新老会员
// isNewMember
hadAnswerQuestion
=
1
;
//硬编码答题
if
(
isNewMember
==
1
)
{
// 新会员
if
(
hadAnswerQuestion
)
{
// 已经答题,提示创建心愿单
// todo 校验选择
// 校验完成后显示提示
this
.
queryWishbillCreate
();
}
else
{
// 未答题,提示答题
this
.
setData
({
...
...
@@ -78,7 +88,31 @@ Page({
}
resolve
();
});
},
// billCode
// 创建心愿单
queryWishbillCreate
()
{
console
.
log
(
"queryWishbillCreate"
);
// let myWishList = this.data.candidate;
// console.log("this.data.candidate:",this.data.candidate);
// console.log("myWishList:",myWishList);
// let myWishList = this.data.myWishList;
let
myWishList
=
this
.
data
.
candidate
[
0
].
products
;
let
wishBillCodeList
=
[];
myWishList
.
forEach
(
element
=>
{
wishBillCodeList
.
push
(
element
.
prizeDefineCode
);
});
console
.
log
(
"wishBillCodeList:"
,
wishBillCodeList
);
app
.
post
({
url
:
app
.
api
.
wishbillCreate
,
data
:
[
"ee3e985407fd40abb22b5f75f0f489a1"
,
"5e46119a5ad04649815b7c0171fd7e9a"
,
"1301a7070b57433986a12ee982103b71"
]
}).
then
((
result
)
=>
{
console
.
log
(
"创建成功"
)
console
.
log
(
"result:"
,
result
);
}).
catch
((
err
)
=>
{
console
.
log
(
"err:"
,
err
);
});
},
// 换一批
onChangeStatusHandler
()
{
...
...
@@ -91,6 +125,22 @@ Page({
curStatus
})
},
// 心愿单产品候选列表
queryWishbillPrizeCandidate
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
app
.
post
({
url
:
app
.
api
.
wishbillPrizeCandidate
,
data
:
{}
}).
then
((
result
)
=>
{
this
.
setData
({
candidate
:
result
})
resolve
();
}).
catch
((
err
)
=>
{
reject
();
});
});
},
// 子组件事件
evtcomp
(
evt
)
{
let
{
...
...
@@ -103,7 +153,7 @@ Page({
this
.
setData
({
ruleTipsVisible
:
false
,
tipsGroupMemberVisible
:
false
,
tipsNewMemberVisible
:
false
,
tipsNewMemberVisible
:
false
,
})
break
;
...
...
Please
register
or
sign in
to post a comment