版本提交
Showing
1 changed file
with
52 additions
and
2 deletions
... | @@ -5,13 +5,18 @@ Page({ | ... | @@ -5,13 +5,18 @@ Page({ |
5 | tipsGroupMemberVisible: false, | 5 | tipsGroupMemberVisible: false, |
6 | tipsNewMemberVisible: false, | 6 | tipsNewMemberVisible: false, |
7 | curStatus: 1, // 当前场景 | 7 | curStatus: 1, // 当前场景 |
8 | candidate: [], // 心愿候选列表 | ||
9 | myWishList: [], // 我的心愿列表 | ||
8 | }, | 10 | }, |
9 | onShareAppMessage() {}, | 11 | onShareAppMessage() {}, |
10 | onLoad(options) { | 12 | onLoad(options) { |
11 | this.initData(); | 13 | this.initData(); |
12 | }, | 14 | }, |
13 | initData() { | 15 | initData() { |
14 | app.queryIndex().then((result) => {}); | 16 | app.queryIndex().then((result) => { |
17 | this.queryWishbillPrizeCandidate(); | ||
18 | }); | ||
19 | |||
15 | }, | 20 | }, |
16 | /** | 21 | /** |
17 | * 点击提交心愿单按钮 | 22 | * 点击提交心愿单按钮 |
... | @@ -62,10 +67,15 @@ Page({ | ... | @@ -62,10 +67,15 @@ Page({ |
62 | } | 67 | } |
63 | // 新老会员 | 68 | // 新老会员 |
64 | // isNewMember | 69 | // isNewMember |
70 | hadAnswerQuestion = 1; //硬编码答题 | ||
65 | if (isNewMember == 1) { | 71 | if (isNewMember == 1) { |
66 | // 新会员 | 72 | // 新会员 |
67 | if (hadAnswerQuestion) { | 73 | if (hadAnswerQuestion) { |
68 | // 已经答题,提示创建心愿单 | 74 | // 已经答题,提示创建心愿单 |
75 | // todo 校验选择 | ||
76 | // 校验完成后显示提示 | ||
77 | |||
78 | this.queryWishbillCreate(); | ||
69 | } else { | 79 | } else { |
70 | // 未答题,提示答题 | 80 | // 未答题,提示答题 |
71 | this.setData({ | 81 | this.setData({ |
... | @@ -78,7 +88,31 @@ Page({ | ... | @@ -78,7 +88,31 @@ Page({ |
78 | } | 88 | } |
79 | resolve(); | 89 | resolve(); |
80 | }); | 90 | }); |
91 | }, | ||
92 | // billCode | ||
93 | // 创建心愿单 | ||
94 | queryWishbillCreate() { | ||
95 | console.log("queryWishbillCreate"); | ||
96 | // let myWishList = this.data.candidate; | ||
97 | // console.log("this.data.candidate:",this.data.candidate); | ||
98 | // console.log("myWishList:",myWishList); | ||
99 | // let myWishList = this.data.myWishList; | ||
100 | let myWishList = this.data.candidate[0].products; | ||
81 | 101 | ||
102 | let wishBillCodeList = []; | ||
103 | myWishList.forEach(element => { | ||
104 | wishBillCodeList.push(element.prizeDefineCode); | ||
105 | }); | ||
106 | console.log("wishBillCodeList:", wishBillCodeList); | ||
107 | app.post({ | ||
108 | url: app.api.wishbillCreate, | ||
109 | data: ["ee3e985407fd40abb22b5f75f0f489a1", "5e46119a5ad04649815b7c0171fd7e9a", "1301a7070b57433986a12ee982103b71"] | ||
110 | }).then((result) => { | ||
111 | console.log("创建成功") | ||
112 | console.log("result:", result); | ||
113 | }).catch((err) => { | ||
114 | console.log("err:", err); | ||
115 | }); | ||
82 | }, | 116 | }, |
83 | // 换一批 | 117 | // 换一批 |
84 | onChangeStatusHandler() { | 118 | onChangeStatusHandler() { |
... | @@ -91,6 +125,22 @@ Page({ | ... | @@ -91,6 +125,22 @@ Page({ |
91 | curStatus | 125 | curStatus |
92 | }) | 126 | }) |
93 | }, | 127 | }, |
128 | // 心愿单产品候选列表 | ||
129 | queryWishbillPrizeCandidate() { | ||
130 | return new Promise((resolve, reject) => { | ||
131 | app.post({ | ||
132 | url: app.api.wishbillPrizeCandidate, | ||
133 | data: {} | ||
134 | }).then((result) => { | ||
135 | this.setData({ | ||
136 | candidate: result | ||
137 | }) | ||
138 | resolve(); | ||
139 | }).catch((err) => { | ||
140 | reject(); | ||
141 | }); | ||
142 | }); | ||
143 | }, | ||
94 | // 子组件事件 | 144 | // 子组件事件 |
95 | evtcomp(evt) { | 145 | evtcomp(evt) { |
96 | let { | 146 | let { |
... | @@ -103,7 +153,7 @@ Page({ | ... | @@ -103,7 +153,7 @@ Page({ |
103 | this.setData({ | 153 | this.setData({ |
104 | ruleTipsVisible: false, | 154 | ruleTipsVisible: false, |
105 | tipsGroupMemberVisible: false, | 155 | tipsGroupMemberVisible: false, |
106 | tipsNewMemberVisible:false, | 156 | tipsNewMemberVisible: false, |
107 | }) | 157 | }) |
108 | break; | 158 | break; |
109 | 159 | ... | ... |
-
Please register or sign in to post a comment