2d06ff22 by simon

版本提交

1 parent 6ea0086f
...@@ -23,7 +23,8 @@ App({ ...@@ -23,7 +23,8 @@ App({
23 userInfo: null, 23 userInfo: null,
24 wxcode: store.getItem("wxcode"), 24 wxcode: store.getItem("wxcode"),
25 tlMemberCode: "", 25 tlMemberCode: "",
26 curCoupon: null 26 curCoupon: null,
27 questionResult:null,//答题的结果 弹力值 elasticValue
27 }, 28 },
28 // 获取用户基本信息 29 // 获取用户基本信息
29 queryIndex() { 30 queryIndex() {
......
...@@ -5,6 +5,18 @@ Component({ ...@@ -5,6 +5,18 @@ Component({
5 innerText: { 5 innerText: {
6 type: String, 6 type: String,
7 value: 'default value', 7 value: 'default value',
8 },
9 eleList: {
10 type: Object,
11 value: [],
12 },
13 eleVal: {
14 type: Number,
15 value: 0,
16 },
17 wishBillInfo:{
18 type: Object,
19 value: {},
8 } 20 }
9 }, 21 },
10 data: { 22 data: {
...@@ -26,7 +38,7 @@ Component({ ...@@ -26,7 +38,7 @@ Component({
26 }, 38 },
27 toMyWishHandler() { 39 toMyWishHandler() {
28 app.router.push({ 40 app.router.push({
29 openType: "reLaunchs", 41 openType: "reLaunch",
30 path: "wish" 42 path: "wish"
31 }) 43 })
32 } 44 }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
5 <view class="tit">· 太棒了 ·</view> 5 <view class="tit">· 太棒了 ·</view>
6 <view class="tips"> 6 <view class="tips">
7 共获得 7 共获得
8 <span class="val">100</span> 8 <span class="val">{{eleVal}}</span>
9 弹力值 9 弹力值
10 </view> 10 </view>
11 <!-- 心愿容器 --> 11 <!-- 心愿容器 -->
......
...@@ -22,6 +22,12 @@ Component({ ...@@ -22,6 +22,12 @@ Component({
22 this.triggerEvent('evtcomp', { 22 this.triggerEvent('evtcomp', {
23 name: "_evt_hide_mask" 23 name: "_evt_hide_mask"
24 }); 24 });
25 },
26 // 摇一摇
27 onShakeHandler() {
28 this.triggerEvent('evtcomp', {
29 name: "_evt_shake"
30 });
25 } 31 }
26 } 32 }
27 }) 33 })
......
1 <view class="comp-item"> 1 <view class="comp-item">
2 <image class="bg" src="../../image/oss/tips/tips-shake.png" mode="widthFix" /> 2 <image bindtap="onShakeHandler" class="bg" src="../../image/oss/tips/tips-shake.png" mode="widthFix" />
3 <!-- <view class="space1"></view> 3 <!-- <view class="space1"></view>
4 <view bindtap="hideMask" class="btn">知道了</view> --> 4 <view bindtap="hideMask" class="btn">知道了</view> -->
5 </view> 5 </view>
......
1 let app = getApp();
1 Component({ 2 Component({
2 properties: { 3 properties: {
3 // 这里定义了innerText属性,属性值可以在组件使用时指定 4 // 这里定义了innerText属性,属性值可以在组件使用时指定
...@@ -31,6 +32,7 @@ Component({ ...@@ -31,6 +32,7 @@ Component({
31 name: "_evt_hide_mask" 32 name: "_evt_hide_mask"
32 }); 33 });
33 }, 34 },
35 // 马上创建
34 onCreateHandler(){ 36 onCreateHandler(){
35 this.triggerEvent('evtcomp', { 37 this.triggerEvent('evtcomp', {
36 name: "_evt_create_wish" 38 name: "_evt_create_wish"
......
...@@ -15,17 +15,26 @@ Page({ ...@@ -15,17 +15,26 @@ Page({
15 tipsNewMemberVisible: false, 15 tipsNewMemberVisible: false,
16 tipsWishVisible: false, 16 tipsWishVisible: false,
17 tipsShakeVisible: false, 17 tipsShakeVisible: false,
18 tipsCreateCompleteVisible: false,
19 tipsCommonVisible: false, 18 tipsCommonVisible: false,
19 tipsCreateCompleteVisible: false,
20 tipsInnerText: "", 20 tipsInnerText: "",
21 curStatus: 1, // 当前场景 21 curStatus: 1, // 当前场景
22 candidate: [], // 心愿候选列表 22 candidate: [], // 心愿候选列表
23 myWishList: [], // 我的心愿列表 23 myWishList: [], // 我的心愿列表
24 valElasticTotal: 0, // 心愿单累计需要弹力值 24 valElasticTotal: 0, // 心愿单累计需要弹力值
25 taskTotalElasticValue: 0, // 任务分
26 wishBillInfo: {}, // 生成的心愿单
25 curWish: {}, // 当前选择心愿 27 curWish: {}, // 当前选择心愿
26 userInfo: {} 28 userInfo: {},
29 isPageVisible: false,
27 }, 30 },
28 onShareAppMessage() {}, 31 onShareAppMessage() {},
32 onShow() {
33 this.isPageVisible = true;
34 },
35 onHide() {
36 this.isPageVisible = false;
37 },
29 onLoad(options) { 38 onLoad(options) {
30 console.log("cwish------"); 39 console.log("cwish------");
31 this.initData(); 40 this.initData();
...@@ -43,8 +52,28 @@ Page({ ...@@ -43,8 +52,28 @@ Page({
43 }) 52 })
44 this.queryWishbillPrizeCandidate(); 53 this.queryWishbillPrizeCandidate();
45 }); 54 });
55 this.initShake();
56 },
57 // 添加摇一摇
58 initShake() {
59 let _this = this;
60 wx.onAccelerometerChange(function (res) {
61 if (this.data.isPageVisible && this.data.isPageVisible) {
62 if (res.x > 2) { //偏移量为2时触发,有的使用1
63 wx.showModal({
64 title: '提示',
65 content: '触发摇一摇',
66 success: res => {
67 _this.setData({
68 tipsShakeVisible: false,
69 tipsCreateCompleteVisible: true
70 })
71 }
72 })
73 }
74 }
75 });
46 }, 76 },
47
48 /** 77 /**
49 * 提交前判断状态 78 * 提交前判断状态
50 * 判断顺序 79 * 判断顺序
...@@ -113,7 +142,6 @@ Page({ ...@@ -113,7 +142,6 @@ Page({
113 myWishList.forEach(element => { 142 myWishList.forEach(element => {
114 valElasticTotal += element.conditionElasticValue 143 valElasticTotal += element.conditionElasticValue
115 }); 144 });
116
117 this.setData({ 145 this.setData({
118 tipsWishVisible: true, 146 tipsWishVisible: true,
119 valElasticTotal: valElasticTotal 147 valElasticTotal: valElasticTotal
...@@ -121,16 +149,20 @@ Page({ ...@@ -121,16 +149,20 @@ Page({
121 console.log("wish:", this.data.myWishList); 149 console.log("wish:", this.data.myWishList);
122 }).catch((err) => {});; 150 }).catch((err) => {});;
123 }, 151 },
124 // billCode 152 /**
125 // 创建心愿单 153 * 创建心愿单 prizeDefineCode
154 * 创建完毕后
155 *
156 * -新会员
157 * 1.请求创建表单 设置 wishBillInfo
158 * 2.显示心愿单完成
159 * -老会员
160 * 1.请求创建表单
161 * 2.显示摇一摇提示页面, 摇手机后,调用自我助力接口 设置 wishBillInfo
162 * 3.显示心愿单完成
163 */
126 queryWishbillCreate() { 164 queryWishbillCreate() {
127 console.log("queryWishbillCreate"); 165 let myWishList = this.data.myWishList
128 // let myWishList = this.data.candidate;
129 // console.log("this.data.candidate:",this.data.candidate);
130 // console.log("myWishList:",myWishList);
131 // let myWishList = this.data.myWishList;
132 let myWishList = this.data.candidate[0].products;
133
134 let wishBillCodeList = []; 166 let wishBillCodeList = [];
135 myWishList.forEach(element => { 167 myWishList.forEach(element => {
136 wishBillCodeList.push(element.prizeDefineCode); 168 wishBillCodeList.push(element.prizeDefineCode);
...@@ -138,10 +170,26 @@ Page({ ...@@ -138,10 +170,26 @@ Page({
138 console.log("wishBillCodeList:", wishBillCodeList); 170 console.log("wishBillCodeList:", wishBillCodeList);
139 app.post({ 171 app.post({
140 url: app.api.wishbillCreate, 172 url: app.api.wishbillCreate,
141 data: ["ee3e985407fd40abb22b5f75f0f489a1", "5e46119a5ad04649815b7c0171fd7e9a", "1301a7070b57433986a12ee982103b71"] 173 data: wishBillCodeList,
142 }).then((result) => { 174 }).then((result) => {
143 console.log("创建成功") 175 if (app.globalData.indexInfo.isNewMember == 1) {
144 console.log("result:", result); 176 // 新会员
177 this.setData({
178 tipsCreateCompleteVisible: true,
179 wishBillInfo: result
180 })
181 } else {
182 // 老会员,自动助力,出提示页面
183 app.post({
184 url: app.api.selfAssist,
185 data: {}
186 }).then((result2) => {
187 this.setData({
188 tipsShakeVisible: true,
189 wishBillInfo: result2
190 })
191 })
192 }
145 }).catch((err) => { 193 }).catch((err) => {
146 console.log("err:", err); 194 console.log("err:", err);
147 }); 195 });
...@@ -272,6 +320,18 @@ Page({ ...@@ -272,6 +320,18 @@ Page({
272 }); 320 });
273 }); 321 });
274 }, 322 },
323 // 隐藏所有蒙层
324 hideMask() {
325 this.setData({
326 ruleTipsVisible: false,
327 tipsGroupMemberVisible: false,
328 tipsNewMemberVisible: false,
329 tipsWishVisible: false,
330 tipsWishVisible: false,
331 tipsCreateCompleteVisible: false,
332 tipsCommonVisible: false
333 })
334 },
275 // 子组件事件 335 // 子组件事件
276 evtcomp(evt) { 336 evtcomp(evt) {
277 let { 337 let {
...@@ -281,23 +341,23 @@ Page({ ...@@ -281,23 +341,23 @@ Page({
281 switch (name) { 341 switch (name) {
282 // 隐藏蒙层 342 // 隐藏蒙层
283 case "_evt_hide_mask": 343 case "_evt_hide_mask":
284 this.setData({ 344 this.hideMask();
285 ruleTipsVisible: false,
286 tipsGroupMemberVisible: false,
287 tipsNewMemberVisible: false,
288 tipsWishVisible: false,
289 tipsWishVisible: false,
290 tipsCreateCompleteVisible: false,
291 tipsCommonVisible: false
292 })
293 break; 345 break;
294 346
347
348
295 // 创建心愿单 349 // 创建心愿单
296 case "_evt_create_wish": 350 case "_evt_create_wish":
351 this.hideMask();
352 this.queryWishbillCreate();
353 break;
354
355 // 模拟摇一摇
356 case "_evt_shake":
297 this.setData({ 357 this.setData({
298 tipsWishVisible: false 358 tipsShakeVisible: false,
359 tipsCreateCompleteVisible: true
299 }) 360 })
300 this.queryWishbillCreate();
301 break; 361 break;
302 362
303 default: 363 default:
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
71 <tips-shake-comp bind:evtcomp="evtcomp"></tips-shake-comp> 71 <tips-shake-comp bind:evtcomp="evtcomp"></tips-shake-comp>
72 </van-popup> 72 </van-popup>
73 <van-popup show="{{ tipsCreateCompleteVisible }}"> 73 <van-popup show="{{ tipsCreateCompleteVisible }}">
74 <tips-create-complete-comp bind:evtcomp="evtcomp"></tips-create-complete-comp> 74 <tips-create-complete-comp bind:evtcomp="evtcomp" wish-list="{{myWishList}}" ele-val="{{taskTotalElasticValue}}" wish-bill-info="{{wishBillInfo}}"></tips-create-complete-comp>
75 </van-popup> 75 </van-popup>
76 <van-popup show="{{ tipsCommonVisible }}"> 76 <van-popup show="{{ tipsCommonVisible }}">
77 <tips-common-comp bind:evtcomp="evtcomp" inner-text="{{tipsInnerText}}"></tips-common-comp> 77 <tips-common-comp bind:evtcomp="evtcomp" inner-text="{{tipsInnerText}}"></tips-common-comp>
......
...@@ -16,9 +16,15 @@ Page({ ...@@ -16,9 +16,15 @@ Page({
16 }, 16 },
17 // 开始互动游戏 17 // 开始互动游戏
18 onStartHandler() { 18 onStartHandler() {
19 let {
20 wishBillCode
21 } = app.globalData.indexInfo;
19 let path = "createWish"; 22 let path = "createWish";
23 if (wishBillCode) {
24 path = "wish"
25 }
20 app.router.push({ 26 app.router.push({
21 path: "createWish" 27 path: path
22 }) 28 })
23 }, 29 },
24 // 显示规则页面 30 // 显示规则页面
......
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
11 <view class="content"> 11 <view class="content">
12 <view class="coupon"> 12 <view class="coupon">
13 <view wx:for="{{prizeInfo}}" wx:key="{{index}}" class="coupon-item {{item.type==4?'coupon-item2':''}}"> 13 <view wx:for="{{prizeInfo}}" wx:key="{{index}}" class="coupon-item {{item.type==4?'coupon-item2':''}}">
14 <image class="ebg" mode="widthFix" src="../../image/oss/coupon/coupon-1.png" /> 14 <image wx:if="{{item.type==4}}" class="ebg" mode="widthFix" src="../../image/oss/coupon/coupon-2.png" />
15 <image wx:else class="ebg" mode="widthFix" src="../../image/oss/coupon/coupon-1.png" />
15 <view class="cont"> 16 <view class="cont">
16 <view class="name">{{item.name}}</view> 17 <view class="name">{{item.name}}</view>
17 <view bindtap="onShowDetailHandler" data-data="{{item}}" class="detail">查看详情</view> 18 <view bindtap="onShowDetailHandler" data-data="{{item}}" class="detail">查看详情</view>
......
...@@ -4,6 +4,7 @@ Page({ ...@@ -4,6 +4,7 @@ Page({
4 tipsRuleVisible: false, 4 tipsRuleVisible: false,
5 userInfo: {}, 5 userInfo: {},
6 wishInfo: {}, 6 wishInfo: {},
7 wishList: [],
7 helperInfo: {} 8 helperInfo: {}
8 }, 9 },
9 onShareAppMessage() {}, 10 onShareAppMessage() {},
...@@ -19,6 +20,18 @@ Page({ ...@@ -19,6 +20,18 @@ Page({
19 this.queryWishbillHelpers(); 20 this.queryWishbillHelpers();
20 }) 21 })
21 }, 22 },
23 /**
24 * 领取我的奖品
25 */
26 onGetGiftHandler(evt) {
27
28 },
29 /**
30 * 查看我的奖品
31 */
32 onCheckGiftHandler(evt) {
33
34 },
22 // 显示规则页面 35 // 显示规则页面
23 onShowRuleHandler() { 36 onShowRuleHandler() {
24 this.setData({ 37 this.setData({
...@@ -57,7 +70,8 @@ Page({ ...@@ -57,7 +70,8 @@ Page({
57 } 70 }
58 }).then((result) => { 71 }).then((result) => {
59 this.setData({ 72 this.setData({
60 wishInfo: result 73 wishInfo: result,
74 wishList: result.wishGifts
61 }) 75 })
62 }) 76 })
63 }); 77 });
......
...@@ -98,6 +98,120 @@ ...@@ -98,6 +98,120 @@
98 } 98 }
99 } 99 }
100 100
101 // 奖品
102 .wish {
103 margin: 0 auto 0;
104 position: relative;
105 width: 630px;
106
107 &-item {
108 position: relative;
109 display: flex;
110 justify-content: space-between;
111 height: 124px;
112 padding: 30px 0;
113 border-bottom: solid 1px #dadada;
114
115 .display {
116 position: relative;
117 width: 124px;
118 height: 124px;
119 border-radius: 62px;
120 background-image: radial-gradient(circle at 0 0, #ffffff, #f2e6e6);
121 @extend .fcc;
122
123 .prod {
124 max-width: 200px;
125 max-height: 200px;
126 }
127
128 }
129
130 .mid {
131 display: flex;
132 flex: 1;
133 // background-color: wheat;
134 flex-wrap: wrap;
135 padding: 0 20px;
136 @extend .bb;
137
138 .name {
139 color: #333333;
140 font-size: 28px;
141 @include ellipsis(2);
142 }
143
144 .progress {
145 display: flex;
146 align-items: flex-end;
147 align-self: flex-end;
148
149 $proWidth: 220px;
150
151 .pro {
152 width: $proWidth;
153 position: relative;
154
155 .flag {
156 position: absolute;
157 left: 0px;
158 bottom: 6px;
159 color: #a97a4b;
160 font-size: 16px;
161 width: 51px;
162 height: 30px;
163
164 image {
165 position: absolute;
166 width: 51px;
167 height: 30px;
168 }
169
170 .t1 {
171 position: relative;
172 text-align: center;
173 width: 51px;
174 padding-top: 2px;
175 }
176 }
177
178 .line {
179 width: $proWidth;
180 height: 4px;
181 background-color: #dcdcdc;
182
183 &-thumb {
184 // width: $proWidth;
185 height: 4px;
186 background-color: #ba3038;
187 }
188 }
189 }
190
191 .val {
192 font-size: 20px;
193 color: #999999;
194 padding-left: 8px;
195 }
196 }
197 }
198
199 .btn {
200 @include cb(180px, 60px);
201 align-self: center;
202 font-size: 28px;
203 }
204 .disable{
205 background: transparent;
206 background-color: #d2d2d2;
207 }
208 }
209
210 &-item2 {
211 border-bottom: none;
212 }
213 }
214
101 // 海报按钮 215 // 海报按钮
102 .poster-btn { 216 .poster-btn {
103 position: absolute; 217 position: absolute;
...@@ -149,15 +263,18 @@ ...@@ -149,15 +263,18 @@
149 // margin: 12px 0; 263 // margin: 12px 0;
150 margin-bottom: 20px; 264 margin-bottom: 20px;
151 text-align: left; 265 text-align: left;
152 .t1{ 266
267 .t1 {
153 color: #af435a; 268 color: #af435a;
154 } 269 }
155 270
156 } 271 }
157 .empty{ 272
273 .empty {
158 text-align: center; 274 text-align: center;
159 padding-top: 80px; 275 padding-top: 80px;
160 color: #333333; 276 color: #333333;
277 font-size: 24px;
161 } 278 }
162 } 279 }
163 } 280 }
......
...@@ -20,6 +20,34 @@ ...@@ -20,6 +20,34 @@
20 <view class="number">{{wishInfo.member.mobile}}</view> 20 <view class="number">{{wishInfo.member.mobile}}</view>
21 <view bindtap="onMyCardHandler" class="mycard">我的卡券</view> 21 <view bindtap="onMyCardHandler" class="mycard">我的卡券</view>
22 </view> 22 </view>
23 <!-- jiangp1 -->
24 <view class="wish">
25 <view wx:for="{{wishList}}" wx:key="{{index}}" class="wish-item">
26 <view class="display">
27 <image class="prod" mode="aspectFit" src="../../image/prize/prize-3.png" />
28 </view>
29 <view class="mid">
30 <view class="name">{{item.prizeName}}</view>
31 <view class="progress">
32 <view class="pro">
33 <view class="flag" style="left:{{(item.elasticValue/item.conditionElasticValue) * 220 - 51}}rpx;">
34 <image class="prod" mode="aspectFit" src="../../image/oss/my-wish/my-wish-c4.png" />
35 <view class="t1">{{item.elasticValue}}</view>
36 </view>
37 <view class="line">
38 <view class="line-thumb" style="width:{{item.elasticValue/item.conditionElasticValue}}%;"></view>
39 </view>
40 </view>
41 <view class="val">{{item.conditionElasticValue}}</view>
42 </view>
43 </view>
44 <view wx:if="{{item.accessStatus == 0}}" class="btn disable">
45 弹力充值中
46 </view>
47 <view bindtap="onGetGiftHandler" wx:if="{{item.accessStatus == 1}}" class="btn">马上领取</view>
48 <view bindtap="onCheckGiftHandler" wx:if="{{item.accessStatus == 2}}" class="btn">已领取</view>
49 </view>
50 </view>
23 <view bindtap="onCreatePosterHandler" class="poster-btn">生成海报</view> 51 <view bindtap="onCreatePosterHandler" class="poster-btn">生成海报</view>
24 </view> 52 </view>
25 <!-- 协作 --> 53 <!-- 协作 -->
...@@ -39,7 +67,9 @@ ...@@ -39,7 +67,9 @@
39 <span class="t1">{{item.elasticValue}}</span> 67 <span class="t1">{{item.elasticValue}}</span>
40 弹力值! 68 弹力值!
41 </view> 69 </view>
42 <view class="empty" wx:if="{{helperInfo.helpers.length <= 0}}">还没有好友助力,马上让她们帮你实现愿望吧!</view> 70 <view class="empty" wx:if="{{helperInfo.helpers.length <= 0}}">
71 还没有好友助力,马上让她们帮你实现愿望吧!
72 </view>
43 </scroll-view> 73 </scroll-view>
44 </view> 74 </view>
45 <view class="btn-wrap"> 75 <view class="btn-wrap">
......