Commit de190e5c17df4037cc3027df11c364d60b2cbaf3

Authored by 前端开发-罗建龙
1 parent b689638b

oa单大转盘门店选择

components/store_popup/store_popup.js
@@ -314,10 +314,12 @@ Component({ @@ -314,10 +314,12 @@ Component({
314 314
315 }, 315 },
316 close_popup() { 316 close_popup() {
  317 + this.triggerEvent('closeback',{})
317 this.setData({ 318 this.setData({
318 store: 0, 319 store: 0,
319 keyword:'' 320 keyword:''
320 }) 321 })
  322 +
321 }, 323 },
322 //选择更多门店 324 //选择更多门店
323 more_store: function () { 325 more_store: function () {
packageB/pages/luckactivity/luckinfo/luckinfo.js
@@ -4,1448 +4,1489 @@ const app = getApp(); @@ -4,1448 +4,1489 @@ const app = getApp();
4 let imghost = app.globalData.setting.imghost; 4 let imghost = app.globalData.setting.imghost;
5 let self = null; 5 let self = null;
6 let imgDraw = { 6 let imgDraw = {
7 - "width": "554px",  
8 - "height": "899px",  
9 - "background": imghost + "miniapp/images/share_bg.png",  
10 - "views": [  
11 - { //0.头像  
12 - "type": "image",  
13 - // "url": app.globalData.userInfo.head_pic,  
14 - "css": {  
15 - "background": "white",  
16 - "width": "80px",  
17 - "height": "80px",  
18 - "top": "24px",  
19 - "left": "40px",  
20 - "borderRadius": "80px",  
21 - }  
22 - },  
23 - { //1.昵称  
24 - "type": "text",  
25 - // "text": "",  
26 - "css": {  
27 - "color": "#000000",  
28 - "width": "400px",  
29 - "top": "25px",  
30 - "left": "140px",  
31 - "fontSize": "26px",  
32 - "maxLines": "1",  
33 - }  
34 - },  
35 - { //2.强烈推荐  
36 - "type": "text",  
37 - "text": "强烈推荐",  
38 - "css": {  
39 - "color": "#fff",  
40 - "background": "#FF6768",  
41 - "width": "105px",  
42 - "height": "26px",  
43 - "lineHeight": "26px",  
44 - "top": "70px",  
45 - "left": "140px",  
46 - "borderRadius": "10px",  
47 - "fontSize": "18px",  
48 - "textAlign": "center"  
49 -  
50 - }  
51 - },  
52 - { //3.分享标题  
53 - "type": "text",  
54 - "text": "",  
55 - "css": {  
56 - "width": "554px",  
57 - "padding": "20px",  
58 - "left": "20px",  
59 - "top": "160px",  
60 - "fontSize": "28px",  
61 - "textAlign": "left",  
62 - "maxLines": "1",  
63 - }  
64 - },  
65 - { //4.分享内容  
66 - "type": "text",  
67 - // "text": "",  
68 - "css": {  
69 - "color": "#000000",  
70 - "width": "554px",  
71 - "padding": "20px",  
72 - "left": "20px",  
73 - "top": "190px",  
74 - "fontSize": "26px",  
75 - "textAlign": "center",  
76 - "maxLines": "1",  
77 - }  
78 - },  
79 - { //5.分享图片  
80 - "type": "image",  
81 - "url": "/packageB/images/luckDraw/jiang.png",  
82 - "css": {  
83 - "width": "auto",  
84 - "height": "380px",  
85 - "top": "220px",  
86 - "left": "277px",  
87 - "align": "center",  
88 - "mode": "aspectFill",  
89 - }  
90 - },  
91 - { //6  
92 - "type": "image",  
93 - "url": "/images/share/s_gou.png",  
94 - "css": {  
95 - "width": "30px",  
96 - "height": "30px",  
97 - "top": "630px",  
98 - "left": "18px",  
99 - "rotate": "0",  
100 - "borderRadius": "30px",  
101 - }  
102 - },  
103 - { //7  
104 - "type": "text",  
105 - "text": "正品保障",  
106 - "css": {  
107 - "color": "red",  
108 - "width": "110px",  
109 - "top": "630px",  
110 - "left": "52px",  
111 - "fontSize": "22px",  
112 - }  
113 - },  
114 - { //8  
115 - "type": "image",  
116 - "url": "/images/share/s_gou.png",  
117 - "css": {  
118 - "width": "30px",  
119 - "height": "30px",  
120 - "top": "630px",  
121 - "left": "208px",  
122 - "borderRadius": "30px",  
123 - }  
124 - },  
125 - { //9  
126 - "type": "text",  
127 - "text": "纯实体店",  
128 - "css": {  
129 - "color": "red",  
130 - "width": "129px",  
131 - "top": "630px",  
132 - "left": "243px",  
133 - "fontSize": "22px",  
134 - }  
135 - },  
136 - { //10  
137 - "type": "image",  
138 - "url": "/images/share/s_gou.png",  
139 - "css": {  
140 - "width": "30px",  
141 - "height": "30px",  
142 - "top": "630px",  
143 - "left": "410px",  
144 - "borderRadius": "30px",  
145 - }  
146 - },  
147 - { //11  
148 - "type": "text",  
149 - "text": "官方验证",  
150 - "css": {  
151 - "color": "red",  
152 - "width": "121px",  
153 - "top": "630px",  
154 - "left": "450px",  
155 - "fontSize": "22px",  
156 - }  
157 - },  
158 - { //12.横线  
159 - "type": "rect",  
160 - "css": {  
161 - "color": "#eee",  
162 - "width": "548px",  
163 - "height": "1px",  
164 - "top": "676px",  
165 - "left": "277px",  
166 - "align": "center",  
167 - }  
168 - },  
169 - { //13  
170 - "type": "text",  
171 - "text": "特惠活动时间仅限",  
172 - "css": {  
173 - "color": "#000000",  
174 - "width": "245px",  
175 - "top": "730px",  
176 - "left": "28px",  
177 - "fontSize": "24px",  
178 - "textAlign": "left"  
179 - }  
180 - },  
181 - { //14.时间  
182 - "type": "text",  
183 - // "text": "",  
184 - "css": {  
185 - "width": "377px",  
186 - "top": "770px",  
187 - "left": "28px",  
188 - "fontSize": "24px",  
189 - }  
190 - },  
191 - { //15  
192 - "type": "text",  
193 - "text": "长按识别小程序码有惊喜哦!",  
194 - "css": {  
195 - "color": "#7c7c7c",  
196 - "width": "348px",  
197 - "top": "820px",  
198 - "left": "27px",  
199 - "fontSize": "24px",  
200 - }  
201 - },  
202 -  
203 - { //16.码  
204 - "type": "image",  
205 - // "url": "",  
206 - "css": {  
207 - "width": "150px",  
208 - "height": "150px",  
209 - "top": "715px",  
210 - "left": "380px",  
211 - "mode": "scaleToFill"  
212 - }  
213 - },  
214 -  
215 - ]  
216 - };  
217 - 7 + "width": "554px",
  8 + "height": "899px",
  9 + "background": imghost + "miniapp/images/share_bg.png",
  10 + "views": [
  11 + { //0.头像
  12 + "type": "image",
  13 + // "url": app.globalData.userInfo.head_pic,
  14 + "css": {
  15 + "background": "white",
  16 + "width": "80px",
  17 + "height": "80px",
  18 + "top": "24px",
  19 + "left": "40px",
  20 + "borderRadius": "80px",
  21 + }
  22 + },
  23 + { //1.昵称
  24 + "type": "text",
  25 + // "text": "",
  26 + "css": {
  27 + "color": "#000000",
  28 + "width": "400px",
  29 + "top": "25px",
  30 + "left": "140px",
  31 + "fontSize": "26px",
  32 + "maxLines": "1",
  33 + }
  34 + },
  35 + { //2.强烈推荐
  36 + "type": "text",
  37 + "text": "强烈推荐",
  38 + "css": {
  39 + "color": "#fff",
  40 + "background": "#FF6768",
  41 + "width": "105px",
  42 + "height": "26px",
  43 + "lineHeight": "26px",
  44 + "top": "70px",
  45 + "left": "140px",
  46 + "borderRadius": "10px",
  47 + "fontSize": "18px",
  48 + "textAlign": "center"
  49 +
  50 + }
  51 + },
  52 + { //3.分享标题
  53 + "type": "text",
  54 + "text": "",
  55 + "css": {
  56 + "width": "554px",
  57 + "padding": "20px",
  58 + "left": "20px",
  59 + "top": "160px",
  60 + "fontSize": "28px",
  61 + "textAlign": "left",
  62 + "maxLines": "1",
  63 + }
  64 + },
  65 + { //4.分享内容
  66 + "type": "text",
  67 + // "text": "",
  68 + "css": {
  69 + "color": "#000000",
  70 + "width": "554px",
  71 + "padding": "20px",
  72 + "left": "20px",
  73 + "top": "190px",
  74 + "fontSize": "26px",
  75 + "textAlign": "center",
  76 + "maxLines": "1",
  77 + }
  78 + },
  79 + { //5.分享图片
  80 + "type": "image",
  81 + "url": "/packageB/images/luckDraw/jiang.png",
  82 + "css": {
  83 + "width": "auto",
  84 + "height": "380px",
  85 + "top": "220px",
  86 + "left": "277px",
  87 + "align": "center",
  88 + "mode": "aspectFill",
  89 + }
  90 + },
  91 + { //6
  92 + "type": "image",
  93 + "url": "/images/share/s_gou.png",
  94 + "css": {
  95 + "width": "30px",
  96 + "height": "30px",
  97 + "top": "630px",
  98 + "left": "18px",
  99 + "rotate": "0",
  100 + "borderRadius": "30px",
  101 + }
  102 + },
  103 + { //7
  104 + "type": "text",
  105 + "text": "正品保障",
  106 + "css": {
  107 + "color": "red",
  108 + "width": "110px",
  109 + "top": "630px",
  110 + "left": "52px",
  111 + "fontSize": "22px",
  112 + }
  113 + },
  114 + { //8
  115 + "type": "image",
  116 + "url": "/images/share/s_gou.png",
  117 + "css": {
  118 + "width": "30px",
  119 + "height": "30px",
  120 + "top": "630px",
  121 + "left": "208px",
  122 + "borderRadius": "30px",
  123 + }
  124 + },
  125 + { //9
  126 + "type": "text",
  127 + "text": "纯实体店",
  128 + "css": {
  129 + "color": "red",
  130 + "width": "129px",
  131 + "top": "630px",
  132 + "left": "243px",
  133 + "fontSize": "22px",
  134 + }
  135 + },
  136 + { //10
  137 + "type": "image",
  138 + "url": "/images/share/s_gou.png",
  139 + "css": {
  140 + "width": "30px",
  141 + "height": "30px",
  142 + "top": "630px",
  143 + "left": "410px",
  144 + "borderRadius": "30px",
  145 + }
  146 + },
  147 + { //11
  148 + "type": "text",
  149 + "text": "官方验证",
  150 + "css": {
  151 + "color": "red",
  152 + "width": "121px",
  153 + "top": "630px",
  154 + "left": "450px",
  155 + "fontSize": "22px",
  156 + }
  157 + },
  158 + { //12.横线
  159 + "type": "rect",
  160 + "css": {
  161 + "color": "#eee",
  162 + "width": "548px",
  163 + "height": "1px",
  164 + "top": "676px",
  165 + "left": "277px",
  166 + "align": "center",
  167 + }
  168 + },
  169 + { //13
  170 + "type": "text",
  171 + "text": "特惠活动时间仅限",
  172 + "css": {
  173 + "color": "#000000",
  174 + "width": "245px",
  175 + "top": "730px",
  176 + "left": "28px",
  177 + "fontSize": "24px",
  178 + "textAlign": "left"
  179 + }
  180 + },
  181 + { //14.时间
  182 + "type": "text",
  183 + // "text": "",
  184 + "css": {
  185 + "width": "377px",
  186 + "top": "770px",
  187 + "left": "28px",
  188 + "fontSize": "24px",
  189 + }
  190 + },
  191 + { //15
  192 + "type": "text",
  193 + "text": "长按识别小程序码有惊喜哦!",
  194 + "css": {
  195 + "color": "#7c7c7c",
  196 + "width": "348px",
  197 + "top": "820px",
  198 + "left": "27px",
  199 + "fontSize": "24px",
  200 + }
  201 + },
  202 +
  203 + { //16.码
  204 + "type": "image",
  205 + // "url": "",
  206 + "css": {
  207 + "width": "150px",
  208 + "height": "150px",
  209 + "top": "715px",
  210 + "left": "380px",
  211 + "mode": "scaleToFill"
  212 + }
  213 + },
  214 +
  215 + ]
  216 +};
  217 +
218 218
219 Page({ 219 Page({
220 data: { 220 data: {
221 - imgDraw: imgDraw,  
222 -  
223 - start: false,  
224 - list: null,  
225 - isLoading: false, // 检测是否已经发送请求,防止重复发送请求  
226 - noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据  
227 - pageNum: 1, // 当前页数  
228 - imghost: imghost,  
229 - num: 3,  
230 - canStart: false, 221 + imgDraw: imgDraw,
  222 +
  223 + start: false,
  224 + list: null,
  225 + isLoading: false, // 检测是否已经发送请求,防止重复发送请求
  226 + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据
  227 + pageNum: 1, // 当前页数
  228 + imghost: imghost,
  229 + num: 3,
  230 + canStart: false,
231 // store:1, 231 // store:1,
232 prizes: [], 232 prizes: [],
233 - defaultConfig: {  
234 - offsetDegree: 22.5,  
235 - }, 233 + defaultConfig: {
  234 + offsetDegree: 22.5,
  235 + },
236 // defaultStyle: { 236 // defaultStyle: {
237 // fontColor: '#d64737', 237 // fontColor: '#d64737',
238 // fontSize: '14px' 238 // fontSize: '14px'
239 // }, 239 // },
240 blocks: [{ 240 blocks: [{
241 - padding: '76rpx',  
242 - imgs: [{  
243 - src: imghost + 'miniapp/images/luckDraw/weel.png?v=3',  
244 - width: '700rpx',  
245 - height: '700rpx',  
246 - rotate: true,  
247 - }],  
248 - }], 241 + padding: '76rpx',
  242 + imgs: [{
  243 + src: imghost + 'miniapp/images/luckDraw/weel.png?v=3',
  244 + width: '700rpx',
  245 + height: '700rpx',
  246 + rotate: true,
  247 + }],
  248 + }],
249 buttons: [{ 249 buttons: [{
250 - radius: '60rpx',  
251 - imgs: [{  
252 - src: imghost + 'miniapp/images/luckDraw/pointer.png?v=3',  
253 - width: '188rpx',  
254 - height: '230rpx',  
255 - top: '-130rpx',  
256 - }],  
257 - }], 250 + radius: '60rpx',
  251 + imgs: [{
  252 + src: imghost + 'miniapp/images/luckDraw/pointer.png?v=3',
  253 + width: '188rpx',
  254 + height: '230rpx',
  255 + top: '-130rpx',
  256 + }],
  257 + }],
  258 + },
  259 +
  260 + onLoad(options) {
  261 + self = this;
  262 + let first_leader = null;
  263 + this.data.options = options;
  264 +
  265 +
  266 + wx.setNavigationBarTitle({
  267 + title: options.title,
  268 + });
  269 +
  270 +
  271 + app.isLogin().then(function (data) {//进入页面前已经授权登录成功
  272 + self.setData({
  273 + userInfo: data,
  274 + });
  275 + });
  276 +
  277 +
  278 +
  279 + //从分享的跳转过来
  280 + if (options.id == undefined || options.id == null || options.id == '') {
  281 + var scene = decodeURIComponent(options.scene);
  282 + scene = scene.split('_');
  283 + first_leader = scene[0];
  284 + this.data.options.id = scene[1];
  285 + };
  286 +
  287 + if (first_leader) {
  288 + // console.log("log---", first_leader);
  289 + app.globalData.first_leader = first_leader;
  290 + //调用接口判断是不是会员
  291 + app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid + "/" + first_leader, {}).then(res => {
  292 + if (res.data.code == 0) {
  293 + app.globalData.guide_id = res.data.data.id;
  294 + }
  295 + })
  296 + };
  297 +
  298 + },
  299 +
  300 + onShow() {
  301 + // console.log('show~~`');
  302 +
  303 + if (app.globalData.userInfo) {
  304 + if (!this.data.isLogin) {
  305 +
  306 + // 下载头像
  307 + let path = app.globalData.userInfo.head_pic;
  308 + path = path.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  309 + path = path.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  310 + wx.downloadFile({
  311 + url: path, //仅为示例,并非真实的资源
  312 + success(res) {
  313 + // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  314 + if (res.statusCode === 200) {
  315 + self.setData({
  316 + 'imgDraw.views[0].url': res.tempFilePath,//头像
  317 + });
  318 +
  319 + }
  320 + }
  321 + });
  322 +
  323 +
  324 + this.setData({
  325 + userInfo: app.globalData.userInfo,
  326 + isLogin: true,
  327 + 'imgDraw.views[1].text': app.globalData.userInfo.nickname,//昵称
  328 + });
  329 +
  330 +
  331 + // console.log('imgDraw.views[1].text+++++++++', imgDraw.views[1], app.globalData.userInfo.nickname);
  332 + let user_id = app.globalData.userInfo.user_id;
  333 + let store_id = app.globalData.setting.stoid;
  334 + let id = this.data.options.id;
  335 + let url = `/api/weshop/marketing/marketingLuckForm/getLuckInfo/${store_id}/${id}/${user_id}`;
  336 +
  337 + //获取小程序码
  338 + this.getMiniCode({
  339 + url: app.globalData.setting.url,
  340 + store_id: app.globalData.setting.stoid,
  341 + user_id: app.globalData.userInfo.user_id,
  342 + id: this.data.options.id,
  343 + });
  344 +
  345 +
  346 + app.request.get(url, {
  347 + success: function (res) {
  348 + if (res.data.code == 0) {
  349 + self.setData({
  350 + luckInfo: res.data.data,
  351 + });
  352 + WxParse.wxParse('content', 'html', self.data.luckInfo.remark, self);
  353 +
  354 + // 如果is_share为1,隐藏发送给朋友和分享到朋友圈功能
  355 + if (!self.data.luckInfo.is_share) {
  356 + wx.hideShareMenu();
  357 + };
  358 +
  359 + } else {
  360 + wx.showToast({
  361 + title: res.data.msg,
  362 + icon: 'none',
  363 + });
  364 + self.data.msg = res.data.msg;
  365 + // self.setData({
  366 + // bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2',
  367 + // 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘
  368 + // 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针
  369 + // });
  370 +
  371 + };
  372 +
  373 + // console.log('luckInfo', res.data.data);
  374 + let luckInfo = res.data.data;
  375 +
  376 +
  377 +
  378 + self.setData({
  379 + 'imgDraw.views[3].text': self.data.luckInfo.act_name,//分享标题
  380 + // 'imgDraw.views[4].text': '快来一起抽奖吧,精美奖品等着你!',//分享内容
  381 + 'imgDraw.views[14].text': util.formar_no_full(luckInfo.begindate) + ' 至 ' + util.formar_no_full(luckInfo.enddate),//活动时间
  382 + });
  383 +
  384 +
  385 +
  386 + let luckStyle = null;
  387 +
  388 +
  389 + if (luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板
  390 + let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`;
  391 + app.request.get(url, {
  392 + success: function (res) {
  393 + let template = null;
  394 + if (res.data.code == 0) {
  395 + template = res.data.data;
  396 + self.setData({
  397 + template,
  398 + bannerUrl: imghost + template.bannerUrl, //背景图
  399 + 'blocks[0].imgs[0].src': imghost + ((template && template.wheelBaseUrl) ? template.wheelBaseUrl : 'miniapp/images/luckDraw/weel.png?v=3'),
  400 + 'buttons[0].imgs[0].src': imghost + ((template && template.wheelPointerUrl) ? template.wheelPointerUrl : 'miniapp/images/luckDraw/pointer.png?v=3'), //指针
  401 + 'imgDraw.views[3].text': template.share_title ? template.share_title : self.data.luckInfo.act_name, //分享标题
  402 + 'imgDraw.views[5].url': imghost + (template && template.share_image ? template.share_image : self.data.luckInfo.imageurl), //分享图片
  403 +
  404 + });
  405 +
  406 + let color = template && template.colorCode ? template.colorCode : '#da104b';
  407 + luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`;
  408 + self.setData({
  409 + luckStyle,
  410 +
  411 + });
  412 + // self.setData({
  413 + // template: res.data.data,
  414 + // bannerUrl: imghost + res.data.data.bannerUrl, //背景图
  415 + // //bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图
  416 + // 'blocks[0].imgs[0].src': imghost + res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘
  417 + // 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针
  418 + // 'imgDraw.views[3].text': (res.data.data&&res.data.data.title) ? res.data.data.title : self.data.luckInfo.act_name,//分享标题
  419 + // // 'imgDraw.views[4].text': (res.data.data&&res.data.data.share_content) ? res.data.data.share_content : '快来一起抽奖吧,精美奖品等着你!',//分享内容
  420 + // 'imgDraw.views[5].url': (res.data.data&&res.data.data.share_image) ? (imghost + res.data.data.share_image):(self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packpageB/images/luckDraw/jiang.png'),//分享图片
  421 + // 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间
  422 + // });
  423 + } else {
  424 + luckStyle = `background: #da104b url(${imghost + 'miniapp/images/luckDraw/bg.png?v=2'}) no-repeat;`;
  425 + self.setData({
  426 + luckStyle,
  427 + 'imgDraw.views[5].url': self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl) : '/packageB/images/luckDraw/jiang.png', //分享图片
  428 + 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘
  429 + 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针
  430 + });
  431 + // let color = template&&template.colorCode ? template.colorCode:'#da104b';
  432 +
  433 + // self.setData({
  434 + // luckStyle,
  435 + // });
  436 + };
  437 +
  438 + },
  439 + });
  440 + } else {
  441 +
  442 + if (luckInfo && luckInfo.imageurl) {
  443 + self.setData({
  444 + 'imgDraw.views[5].url': imghost + self.data.luckInfo.imageurl, //分享图片
  445 + });
  446 + };
  447 +
  448 + if (luckInfo && luckInfo.store_bannerUrl) {
  449 + self.setData({
  450 + bannerUrl: imghost + luckInfo.store_bannerUrl,
  451 + custom: true,
  452 + });
  453 + } else {
  454 + self.setData({
  455 + bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2',
  456 + custom: false,
  457 + });
  458 + };
  459 +
  460 + let color = self.data.custom ? '#f0f0f0' : '#da104b';
  461 + luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`;
  462 + self.setData({
  463 + luckStyle,
  464 + 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘
  465 + 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针
  466 + });
  467 +
  468 + };
  469 +
  470 +
  471 + if (self.data.luckInfo.msgInfo) {
  472 + wx.showToast({
  473 + title: self.data.luckInfo.msgInfo,
  474 + icon: 'none',
  475 + });
  476 + };
  477 +
  478 + },
  479 + });
  480 +
  481 + // 获取奖品展示的奖品
  482 + app.request.get('/api/weshop/marketing/marketingLuckList/page', {
  483 + data: {
  484 + store_id,
  485 + luck_formid: id,
  486 + },
  487 + success: function (res) {
  488 +
  489 + let award = res.data.data.pageData;
  490 + self.setData({
  491 + award,
  492 + });
  493 + // console.log('award', award);
  494 + self.prizeLayout(award);
  495 +
  496 + },
  497 + });
  498 +
  499 +
  500 + //获取兑奖记录
  501 + app.request.get('/api/weshop/marketing/marketingLuckRecord/page', {
  502 + isShowLoading: false,
  503 + data: {
  504 + store_id: app.globalData.setting.stoid,
  505 + user_id: app.globalData.userInfo.user_id,
  506 + luck_formid: this.data.options.id,
  507 + luck_state: 1
  508 + },
  509 + success: function (res) {
  510 + if (res.data.code == 0) {
  511 + self.setData({
  512 + record: res.data.data.pageData,
  513 + });
  514 + }
  515 + },
  516 + });
  517 +
  518 +
  519 + //获取中奖人员名单
  520 + app.request.get('/api/weshop/marketing/marketingLuckRecord/page', {
  521 + isShowLoading: false,
  522 + data: {
  523 + store_id: app.globalData.setting.stoid,
  524 + luck_formid: this.data.options.id,
  525 + luck_state: 1,
  526 + pageSize: 20,
  527 + },
  528 + success: function (res) {
  529 + if (res.data.code == 0) {
  530 + self.setData({
  531 + nameList: res.data.data.pageData,
  532 + });
  533 + };
  534 + },
  535 + });
  536 +
  537 +
  538 +
  539 +
  540 + };
  541 + };
  542 + },
  543 +
  544 + //获取小程序码
  545 + getMiniCode(objData) {
  546 + wx.getImageInfo({
  547 + src: `${objData.url}/api/wx/open/app/user/getWeAppEwm/${objData.store_id}?sceneValue=${objData.user_id}_${objData.id}&pageValue=packageB/pages/luckactivity/luckinfo/luckinfo`,
  548 + success(res) {
  549 + if (res.code != -1) {
  550 + self.setData({
  551 + 'imgDraw.views[16].url': res.path,
  552 + getMiniCode: true,
  553 + });
  554 + };
  555 + }
  556 + });
  557 + },
  558 +
  559 + // 设置转盘奖品布局
  560 + prizeLayout(award) {
  561 + let prizes = [];
  562 + // let length = award.length;
  563 + if (award) {
  564 + var length = award.length;
  565 + } else {
  566 + wx.showToast({
  567 + title: '请设置奖品',
  568 + icon: 'none',
  569 + });
  570 + return;
  571 + };
  572 +
  573 + let thx = { fonts: [{ text: '谢谢\n参与', top: '18%', wordWrap: false, fontColor: 'rgba(255,255,255,.6)' }] };
  574 +
  575 + if (length == 1) {
  576 + [0, 2, 4, 6].map(function (item, index) {
  577 + prizes[item] = {
  578 + id: award[0].id,
  579 + lbtype: award[0].lbtype,
  580 + fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap: false, fontColor: 'transparent' }],
  581 + imgs: [
  582 + {
  583 + src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'),
  584 + width: '135rpx',
  585 + height: '107rpx',
  586 + top: '12%',
  587 + }
  588 + ],
  589 + };
  590 + });
  591 +
  592 + [1, 3, 5, 7].map(function (item, index) {
  593 + prizes[item] = thx;
  594 + });
  595 +
  596 + this.data.thxIndexArr = [1, 3, 5, 7];
  597 + };
  598 +
  599 + if (length == 2) {
  600 + [0, 4].map(function (item, index) {
  601 + prizes[item] = {
  602 + id: award[0].id,
  603 + lbtype: award[0].lbtype,
  604 + fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap: false, fontColor: 'transparent' }],
  605 + imgs: [
  606 + {
  607 + src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'),
  608 + width: '135rpx',
  609 + height: '107rpx',
  610 + top: '12%',
  611 + }
  612 + ],
  613 + };
  614 + });
  615 +
  616 + [2, 6].map(function (item, index) {
  617 + prizes[item] = {
  618 + id: award[1].id,
  619 + lbtype: award[1].lbtype,
  620 + fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap: false, fontColor: 'transparent' }],
  621 + imgs: [
  622 + {
  623 + src: self.prizeSrc(award[1].lbtype) ? self.prizeSrc(award[1].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'),
  624 + width: '135rpx',
  625 + height: '107rpx',
  626 + top: '12%',
  627 + }
  628 + ],
  629 + };
  630 + });
  631 +
  632 + [1, 3, 5, 7].map(function (item, index) {
  633 + prizes[item] = thx;
  634 + });
  635 + this.data.thxIndexArr = [1, 3, 5, 7];
  636 + };
  637 +
  638 +
  639 + if (length == 3) {
  640 + [0, 4].map(function (item, index) {
  641 + prizes[item] = {
  642 + id: award[0].id,
  643 + lbtype: award[0].lbtype,
  644 + fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap: false, fontColor: 'transparent' }],
  645 + imgs: [
  646 + {
  647 + src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'),
  648 + width: '135rpx',
  649 + height: '107rpx',
  650 + top: '12%',
  651 + }
  652 + ],
  653 + };
  654 + });
  655 +
  656 + [1, 5].map(function (item, index) {
  657 + prizes[item] = {
  658 + id: award[1].id,
  659 + lbtype: award[1].lbtype,
  660 + fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap: false, fontColor: 'transparent' }],
  661 + imgs: [
  662 + {
  663 + src: self.prizeSrc(award[1].lbtype) ? self.prizeSrc(award[1].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'),
  664 + width: '135rpx',
  665 + height: '107rpx',
  666 + top: '12%',
  667 + }
  668 + ],
  669 + };
  670 + });
  671 +
  672 + [2, 6].map(function (item, index) {
  673 + prizes[item] = {
  674 + id: award[2].id,
  675 + lbtype: award[2].lbtype,
  676 + fonts: [{ text: award[2].luck_goods_name + ' x' + award[2].num, top: '18%', wordWrap: false, fontColor: 'transparent' }],
  677 + imgs: [
  678 + {
  679 + src: self.prizeSrc(award[2].lbtype) ? self.prizeSrc(award[2].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'),
  680 + width: '135rpx',
  681 + height: '107rpx',
  682 + top: '12%',
  683 + }
  684 + ],
  685 + };
  686 + });
  687 +
  688 + [3, 7].map(function (item, index) {
  689 + prizes[item] = thx;
  690 + });
  691 +
  692 + this.data.thxIndexArr = [3, 7];
  693 + };
  694 +
  695 +
  696 + if (length == 4) {
  697 + [0, 2, 4, 6].map(function (item, index) {
  698 + prizes[item] = {
  699 + id: award[index].id,
  700 + lbtype: award[index].lbtype,
  701 + fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap: false, fontColor: 'transparent' }],
  702 + imgs: [
  703 + {
  704 + src: self.prizeSrc(award[index].lbtype) ? self.prizeSrc(award[index].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'),
  705 + width: '135rpx',
  706 + height: '107rpx',
  707 + top: '12%',
  708 + }
  709 + ],
  710 + };
  711 + });
  712 +
  713 + [1, 3, 5, 7].map(function (item, index) {
  714 + prizes[item] = thx;
  715 + });
  716 +
  717 + this.data.thxIndexArr = [1, 3, 5, 7];
  718 + };
  719 +
  720 + if (length == 5) {
  721 + [0, 2, 3, 5, 6].map(function (item, index) {
  722 + prizes[item] = {
  723 + id: award[index].id,
  724 + lbtype: award[index].lbtype,
  725 + fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap: false, fontColor: 'transparent' }],
  726 + imgs: [
  727 + {
  728 + src: self.prizeSrc(award[index].lbtype) ? self.prizeSrc(award[index].lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'),
  729 + width: '135rpx',
  730 + height: '107rpx',
  731 + top: '12%',
  732 + }
  733 + ],
  734 + };
  735 + });
  736 +
  737 + [1, 4, 7].map(function (item, index) {
  738 + prizes[item] = thx;
  739 + });
  740 +
  741 + this.data.thxIndexArr = [1, 4, 7];
  742 + };
  743 +
  744 + if (length == 6) {
  745 + prizes = award.map(function (item, index) {
  746 + return {
  747 + id: item.id,
  748 + lbtype: item.lbtype,
  749 + fonts: [{ text: item.luck_goods_name + ' x' + item.num, top: '18%', wordWrap: false, fontColor: 'transparent' }],
  750 + imgs: [
  751 + {
  752 + src: self.prizeSrc(item.lbtype) ? self.prizeSrc(item.lbtype) : (imghost + 'miniapp/images/luckDraw/lb.png'),
  753 + width: '135rpx',
  754 + height: '107rpx',
  755 + top: '12%',
  756 + }
  757 + ],
  758 + };
  759 + });
  760 +
  761 + prizes.push(thx);
  762 + prizes.splice(3, 0, thx);
  763 +
  764 + this.data.thxIndexArr = [3, 7];
  765 + };
  766 +
  767 + // console.log('prizes', prizes);
  768 +
  769 + this.setData({
  770 + prizes,
  771 + });
  772 + },
  773 +
  774 + // 根据lbtype指定奖品类别图标
  775 + prizeSrc(lbtype) {
  776 + let src = '';
  777 + switch (lbtype) {
  778 + case 1: { //积分
  779 + src = imghost + 'miniapp/images/luckDraw/jf.png';
  780 + break;
  781 + };
  782 + case 2: { //成长值
  783 + src = imghost + 'miniapp/images/luckDraw/czz.png';
  784 + break;
  785 + };
  786 + case 3: { //优惠券
  787 + src = imghost + 'miniapp/images/luckDraw/yhq.png';
  788 + break;
  789 + };
  790 + case 4: { //服务项目
  791 + src = imghost + 'miniapp/images/luckDraw/fw.png';
  792 + break;
  793 + };
  794 + case 5: { //赠品
  795 + src = imghost + 'miniapp/images/luckDraw/zp.png';
  796 + break;
  797 + };
  798 + case 6: { //礼包
  799 + src = imghost + 'miniapp/images/luckDraw/lb.png';
  800 + break;
  801 + };
  802 + };
  803 + return src;
  804 + },
  805 +
  806 + // 获取抽奖结果匹配对应奖品在奖品列表里的所有索引号
  807 + luckyIndex(arr, target) {
  808 + var results = [],
  809 + len = arr.length,
  810 + pos = 0;
  811 + while (pos < len) {
  812 + // pos = arr[pos].indexOf(target, pos);
  813 + if (arr[pos].id == target) {
  814 + results.push(pos);//找到就存储索引
  815 +
  816 + };
  817 + pos += 1;//并从下个位置开始搜索
  818 + // if(pos === -1){//未找到就退出循环完成搜索
  819 + // break;
  820 + // };
  821 +
  822 + }
  823 + // console.log('当前奖品列表', this.data.prizes);
  824 + // console.log('中奖结果在当前奖品列表中的索引', results);
  825 +
  826 + return results;
258 }, 827 },
259 -  
260 - onLoad(options) {  
261 - self = this;  
262 - let first_leader = null;  
263 - this.data.options = options;  
264 -  
265 -  
266 - wx.setNavigationBarTitle({  
267 - title: options.title,  
268 - });  
269 -  
270 -  
271 - app.isLogin().then(function(data) {//进入页面前已经授权登录成功  
272 - self.setData({  
273 - userInfo: data,  
274 - });  
275 - });  
276 -  
277 -  
278 -  
279 - //从分享的跳转过来  
280 - if (options.id == undefined || options.id == null || options.id == '') {  
281 - var scene = decodeURIComponent(options.scene);  
282 - scene = scene.split('_');  
283 - first_leader = scene[0];  
284 - this.data.options.id = scene[1];  
285 - };  
286 -  
287 - if(first_leader) {  
288 - // console.log("log---", first_leader);  
289 - app.globalData.first_leader = first_leader;  
290 - //调用接口判断是不是会员  
291 - app.request.promiseGet("/api/weshop/shoppingGuide/get/" + app.globalData.setting.stoid +"/" + first_leader,{}).then(res=>{  
292 - if(res.data.code==0){  
293 - app.globalData.guide_id = res.data.data.id;  
294 - }  
295 - })  
296 - };  
297 -  
298 - },  
299 -  
300 - onShow() {  
301 - // console.log('show~~`');  
302 -  
303 - if(app.globalData.userInfo) {  
304 - if(!this.data.isLogin) {  
305 -  
306 - // 下载头像  
307 - let path = app.globalData.userInfo.head_pic;  
308 - path = path.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");  
309 - path = path.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn");  
310 - wx.downloadFile({  
311 - url: path, //仅为示例,并非真实的资源  
312 - success (res) {  
313 - // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容  
314 - if (res.statusCode === 200) {  
315 - self.setData({  
316 - 'imgDraw.views[0].url': res.tempFilePath,//头像  
317 - });  
318 -  
319 - }  
320 - }  
321 - });  
322 -  
323 -  
324 - this.setData({  
325 - userInfo: app.globalData.userInfo,  
326 - isLogin: true,  
327 - 'imgDraw.views[1].text': app.globalData.userInfo.nickname,//昵称  
328 - });  
329 -  
330 -  
331 - // console.log('imgDraw.views[1].text+++++++++', imgDraw.views[1], app.globalData.userInfo.nickname);  
332 - let user_id = app.globalData.userInfo.user_id;  
333 - let store_id = app.globalData.setting.stoid;  
334 - let id = this.data.options.id;  
335 - let url = `/api/weshop/marketing/marketingLuckForm/getLuckInfo/${store_id}/${id}/${user_id}`;  
336 -  
337 - //获取小程序码  
338 - this.getMiniCode({  
339 - url: app.globalData.setting.url,  
340 - store_id: app.globalData.setting.stoid,  
341 - user_id: app.globalData.userInfo.user_id,  
342 - id: this.data.options.id,  
343 - });  
344 -  
345 -  
346 - app.request.get(url, {  
347 - success: function(res) {  
348 - if(res.data.code == 0) {  
349 - self.setData({  
350 - luckInfo: res.data.data,  
351 - });  
352 - WxParse.wxParse('content', 'html', self.data.luckInfo.remark, self);  
353 -  
354 - // 如果is_share为1,隐藏发送给朋友和分享到朋友圈功能  
355 - if(!self.data.luckInfo.is_share) {  
356 - wx.hideShareMenu();  
357 - };  
358 -  
359 - } else {  
360 - wx.showToast({  
361 - title: res.data.msg,  
362 - icon: 'none',  
363 - });  
364 - self.data.msg = res.data.msg;  
365 - // self.setData({  
366 - // bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2',  
367 - // 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘  
368 - // 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针  
369 - // });  
370 -  
371 - };  
372 -  
373 - // console.log('luckInfo', res.data.data);  
374 - let luckInfo = res.data.data;  
375 -  
376 -  
377 -  
378 - self.setData({  
379 - 'imgDraw.views[3].text': self.data.luckInfo.act_name,//分享标题  
380 - // 'imgDraw.views[4].text': '快来一起抽奖吧,精美奖品等着你!',//分享内容  
381 - 'imgDraw.views[14].text': util.formar_no_full(luckInfo.begindate) + ' 至 ' + util.formar_no_full(luckInfo.enddate),//活动时间  
382 - });  
383 -  
384 -  
385 -  
386 - let luckStyle = null;  
387 -  
388 -  
389 - if(luckInfo && luckInfo.template_type != null && luckInfo.template_type == 1) { //获取模板  
390 - let url = `/api/weshop/marketing/marketingLuckTemplate/get/0/${luckInfo.template_id}`;  
391 - app.request.get(url, {  
392 - success: function(res) {  
393 - let template = null;  
394 - if(res.data.code == 0) {  
395 - template = res.data.data;  
396 - self.setData({  
397 - template,  
398 - bannerUrl: imghost + template.bannerUrl, //背景图  
399 - 'blocks[0].imgs[0].src': imghost + ((template&&template.wheelBaseUrl) ? template.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=3'),  
400 - 'buttons[0].imgs[0].src': imghost + ((template&&template.wheelPointerUrl) ? template.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=3'), //指针  
401 - 'imgDraw.views[3].text': template.share_title ? template.share_title:self.data.luckInfo.act_name, //分享标题  
402 - 'imgDraw.views[5].url': imghost + (template&&template.share_image ? template.share_image:self.data.luckInfo.imageurl), //分享图片  
403 -  
404 - });  
405 -  
406 - let color = template&&template.colorCode ? template.colorCode:'#da104b';  
407 - luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`;  
408 - self.setData({  
409 - luckStyle,  
410 -  
411 - });  
412 - // self.setData({  
413 - // template: res.data.data,  
414 - // bannerUrl: imghost + res.data.data.bannerUrl, //背景图  
415 - // //bannerUrl: imghost + ((res.data.data&&res.data.data.bannerUrl) ? res.data.data.bannerUrl:'miniapp/images/luckDraw/bg.png?v=2'), //背景图  
416 - // 'blocks[0].imgs[0].src': imghost + res.data.data&&res.data.data.wheelBaseUrl) ? res.data.data.wheelBaseUrl:'miniapp/images/luckDraw/weel.png?v=2'), //转盘  
417 - // 'buttons[0].imgs[0].src': imghost + ((res.data.data&&res.data.data.wheelPointerUrl) ? res.data.data.wheelPointerUrl:'miniapp/images/luckDraw/pointer.png?v=2'), //指针  
418 - // 'imgDraw.views[3].text': (res.data.data&&res.data.data.title) ? res.data.data.title : self.data.luckInfo.act_name,//分享标题  
419 - // // 'imgDraw.views[4].text': (res.data.data&&res.data.data.share_content) ? res.data.data.share_content : '快来一起抽奖吧,精美奖品等着你!',//分享内容  
420 - // 'imgDraw.views[5].url': (res.data.data&&res.data.data.share_image) ? (imghost + res.data.data.share_image):(self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packpageB/images/luckDraw/jiang.png'),//分享图片  
421 - // 'imgDraw.views[14].text': util.formar_no_full(self.data.luckInfo.begindate) + ' 至 ' + util.formar_no_full(self.data.luckInfo.enddate),//活动时间  
422 - // });  
423 - } else {  
424 - luckStyle = `background: #da104b url(${imghost + 'miniapp/images/luckDraw/bg.png?v=2'}) no-repeat;`;  
425 - self.setData({  
426 - luckStyle,  
427 - 'imgDraw.views[5].url': self.data.luckInfo.imageurl ? (imghost + self.data.luckInfo.imageurl):'/packageB/images/luckDraw/jiang.png', //分享图片  
428 - 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘  
429 - 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针  
430 - });  
431 - // let color = template&&template.colorCode ? template.colorCode:'#da104b';  
432 -  
433 - // self.setData({  
434 - // luckStyle,  
435 - // });  
436 - };  
437 -  
438 - },  
439 - });  
440 - } else {  
441 -  
442 - if(luckInfo && luckInfo.imageurl) {  
443 - self.setData({  
444 - 'imgDraw.views[5].url': imghost + self.data.luckInfo.imageurl, //分享图片  
445 - });  
446 - };  
447 -  
448 - if(luckInfo && luckInfo.store_bannerUrl) {  
449 - self.setData({  
450 - bannerUrl: imghost + luckInfo.store_bannerUrl,  
451 - custom: true,  
452 - });  
453 - } else {  
454 - self.setData({  
455 - bannerUrl: imghost + 'miniapp/images/luckDraw/bg.png?v=2',  
456 - custom: false,  
457 - });  
458 - };  
459 -  
460 - let color = self.data.custom ? '#f0f0f0':'#da104b';  
461 - luckStyle = `background: ${color} url(${self.data.bannerUrl}) no-repeat;`;  
462 - self.setData({  
463 - luckStyle,  
464 - 'blocks[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/weel.png?v=3', //转盘  
465 - 'buttons[0].imgs[0].src': imghost + 'miniapp/images/luckDraw/pointer.png?v=3', //指针  
466 - });  
467 -  
468 - };  
469 -  
470 -  
471 - if(self.data.luckInfo.msgInfo) {  
472 - wx.showToast({  
473 - title: self.data.luckInfo.msgInfo,  
474 - icon: 'none',  
475 - });  
476 - };  
477 -  
478 - },  
479 - });  
480 -  
481 - // 获取奖品展示的奖品  
482 - app.request.get('/api/weshop/marketing/marketingLuckList/page', {  
483 - data: {  
484 - store_id,  
485 - luck_formid: id,  
486 - },  
487 - success: function(res) {  
488 -  
489 - let award = res.data.data.pageData;  
490 - self.setData({  
491 - award,  
492 - });  
493 - // console.log('award', award);  
494 - self.prizeLayout(award);  
495 -  
496 - },  
497 - });  
498 -  
499 -  
500 - //获取兑奖记录  
501 - app.request.get('/api/weshop/marketing/marketingLuckRecord/page', {  
502 - isShowLoading: false,  
503 - data: {  
504 - store_id: app.globalData.setting.stoid,  
505 - user_id: app.globalData.userInfo.user_id,  
506 - luck_formid: this.data.options.id,  
507 - luck_state: 1  
508 - },  
509 - success: function(res) {  
510 - if(res.data.code == 0) {  
511 - self.setData({  
512 - record: res.data.data.pageData,  
513 - });  
514 - }  
515 - },  
516 - });  
517 -  
518 -  
519 - //获取中奖人员名单  
520 - app.request.get('/api/weshop/marketing/marketingLuckRecord/page', {  
521 - isShowLoading: false,  
522 - data: {  
523 - store_id: app.globalData.setting.stoid,  
524 - luck_formid: this.data.options.id,  
525 - luck_state: 1,  
526 - pageSize: 20,  
527 - },  
528 - success: function(res) {  
529 - if(res.data.code == 0) {  
530 - self.setData({  
531 - nameList: res.data.data.pageData,  
532 - });  
533 - };  
534 - },  
535 - });  
536 -  
537 -  
538 -  
539 -  
540 - };  
541 - };  
542 - },  
543 -  
544 - //获取小程序码  
545 - getMiniCode(objData) {  
546 - wx.getImageInfo({  
547 - src: `${objData.url}/api/wx/open/app/user/getWeAppEwm/${objData.store_id}?sceneValue=${objData.user_id}_${objData.id}&pageValue=packageB/pages/luckactivity/luckinfo/luckinfo`,  
548 - success (res) {  
549 - if(res.code != -1) {  
550 - self.setData({  
551 - 'imgDraw.views[16].url': res.path,  
552 - getMiniCode: true,  
553 - });  
554 - };  
555 - }  
556 - });  
557 - },  
558 -  
559 - // 设置转盘奖品布局  
560 - prizeLayout(award) {  
561 - let prizes = [];  
562 - // let length = award.length;  
563 - if(award) {  
564 - var length = award.length;  
565 - } else {  
566 - wx.showToast({  
567 - title: '请设置奖品',  
568 - icon: 'none',  
569 - });  
570 - return;  
571 - };  
572 -  
573 - let thx = {fonts: [{ text: '谢谢\n参与', top: '18%', wordWrap:false, fontColor: 'rgba(255,255,255,.6)'}]};  
574 -  
575 - if(length == 1) {  
576 - [0,2,4,6].map(function(item, index) {  
577 - prizes[item] = {  
578 - id: award[0].id,  
579 - lbtype: award[0].lbtype,  
580 - fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],  
581 - imgs: [  
582 - {  
583 - src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'),  
584 - width: '135rpx',  
585 - height: '107rpx',  
586 - top: '12%',  
587 - }  
588 - ],  
589 - };  
590 - });  
591 -  
592 - [1,3,5,7].map(function(item, index) {  
593 - prizes[item] = thx;  
594 - });  
595 -  
596 - this.data.thxIndexArr = [1,3,5,7];  
597 - };  
598 -  
599 - if(length == 2) {  
600 - [0,4].map(function(item, index) {  
601 - prizes[item] = {  
602 - id: award[0].id,  
603 - lbtype: award[0].lbtype,  
604 - fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],  
605 - imgs: [  
606 - {  
607 - src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'),  
608 - width: '135rpx',  
609 - height: '107rpx',  
610 - top: '12%',  
611 - }  
612 - ],  
613 - };  
614 - });  
615 -  
616 - [2,6].map(function(item, index) {  
617 - prizes[item] = {  
618 - id: award[1].id,  
619 - lbtype: award[1].lbtype,  
620 - fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],  
621 - imgs: [  
622 - {  
623 - src: self.prizeSrc(award[1].lbtype) ? self.prizeSrc(award[1].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'),  
624 - width: '135rpx',  
625 - height: '107rpx',  
626 - top: '12%',  
627 - }  
628 - ],  
629 - };  
630 - });  
631 -  
632 - [1,3,5,7].map(function(item, index) {  
633 - prizes[item] = thx;  
634 - });  
635 - this.data.thxIndexArr = [1,3,5,7];  
636 - };  
637 -  
638 -  
639 - if(length == 3) {  
640 - [0,4].map(function(item, index) {  
641 - prizes[item] = {  
642 - id: award[0].id,  
643 - lbtype: award[0].lbtype,  
644 - fonts: [{ text: award[0].luck_goods_name + ' x' + award[0].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],  
645 - imgs: [  
646 - {  
647 - src: self.prizeSrc(award[0].lbtype) ? self.prizeSrc(award[0].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'),  
648 - width: '135rpx',  
649 - height: '107rpx',  
650 - top: '12%',  
651 - }  
652 - ],  
653 - };  
654 - });  
655 -  
656 - [1,5].map(function(item, index) {  
657 - prizes[item] = {  
658 - id: award[1].id,  
659 - lbtype: award[1].lbtype,  
660 - fonts: [{ text: award[1].luck_goods_name + ' x' + award[1].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],  
661 - imgs: [  
662 - {  
663 - src: self.prizeSrc(award[1].lbtype) ? self.prizeSrc(award[1].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'),  
664 - width: '135rpx',  
665 - height: '107rpx',  
666 - top: '12%',  
667 - }  
668 - ],  
669 - };  
670 - });  
671 -  
672 - [2,6].map(function(item, index) {  
673 - prizes[item] = {  
674 - id: award[2].id,  
675 - lbtype: award[2].lbtype,  
676 - fonts: [{ text: award[2].luck_goods_name + ' x' + award[2].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],  
677 - imgs: [  
678 - {  
679 - src: self.prizeSrc(award[2].lbtype) ? self.prizeSrc(award[2].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'),  
680 - width: '135rpx',  
681 - height: '107rpx',  
682 - top: '12%',  
683 - }  
684 - ],  
685 - };  
686 - });  
687 -  
688 - [3,7].map(function(item, index) {  
689 - prizes[item] = thx;  
690 - });  
691 -  
692 - this.data.thxIndexArr = [3,7];  
693 - };  
694 -  
695 -  
696 - if(length == 4) {  
697 - [0,2,4,6].map(function(item, index) {  
698 - prizes[item] = {  
699 - id: award[index].id,  
700 - lbtype: award[index].lbtype,  
701 - fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],  
702 - imgs: [  
703 - {  
704 - src: self.prizeSrc(award[index].lbtype) ? self.prizeSrc(award[index].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'),  
705 - width: '135rpx',  
706 - height: '107rpx',  
707 - top: '12%',  
708 - }  
709 - ],  
710 - };  
711 - });  
712 -  
713 - [1,3,5,7].map(function(item, index) {  
714 - prizes[item] = thx;  
715 - });  
716 -  
717 - this.data.thxIndexArr = [1,3,5,7];  
718 - };  
719 -  
720 - if(length == 5) {  
721 - [0,2,3,5,6].map(function(item, index) {  
722 - prizes[item] = {  
723 - id: award[index].id,  
724 - lbtype: award[index].lbtype,  
725 - fonts: [{ text: award[index].luck_goods_name + ' x' + award[index].num, top: '18%', wordWrap:false, fontColor: 'transparent'}],  
726 - imgs: [  
727 - {  
728 - src: self.prizeSrc(award[index].lbtype) ? self.prizeSrc(award[index].lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'),  
729 - width: '135rpx',  
730 - height: '107rpx',  
731 - top: '12%',  
732 - }  
733 - ],  
734 - };  
735 - });  
736 -  
737 - [1,4,7].map(function(item, index) {  
738 - prizes[item] = thx;  
739 - });  
740 -  
741 - this.data.thxIndexArr = [1,4,7];  
742 - };  
743 -  
744 - if(length == 6) {  
745 - prizes = award.map(function(item, index) {  
746 - return {  
747 - id: item.id,  
748 - lbtype: item.lbtype,  
749 - fonts: [{ text: item.luck_goods_name + ' x' + item.num, top: '18%', wordWrap:false, fontColor: 'transparent'}],  
750 - imgs: [  
751 - {  
752 - src: self.prizeSrc(item.lbtype) ? self.prizeSrc(item.lbtype): (imghost + 'miniapp/images/luckDraw/lb.png'),  
753 - width: '135rpx',  
754 - height: '107rpx',  
755 - top: '12%',  
756 - }  
757 - ],  
758 - };  
759 - });  
760 -  
761 - prizes.push(thx);  
762 - prizes.splice(3, 0, thx);  
763 -  
764 - this.data.thxIndexArr = [3,7];  
765 - };  
766 -  
767 - // console.log('prizes', prizes);  
768 -  
769 - this.setData({  
770 - prizes,  
771 - });  
772 - },  
773 -  
774 - // 根据lbtype指定奖品类别图标  
775 - prizeSrc(lbtype) {  
776 - let src = '';  
777 - switch(lbtype) {  
778 - case 1: { //积分  
779 - src = imghost + 'miniapp/images/luckDraw/jf.png';  
780 - break;  
781 - };  
782 - case 2: { //成长值  
783 - src = imghost + 'miniapp/images/luckDraw/czz.png';  
784 - break;  
785 - };  
786 - case 3: { //优惠券  
787 - src = imghost + 'miniapp/images/luckDraw/yhq.png';  
788 - break;  
789 - };  
790 - case 4: { //服务项目  
791 - src = imghost + 'miniapp/images/luckDraw/fw.png';  
792 - break;  
793 - };  
794 - case 5: { //赠品  
795 - src = imghost + 'miniapp/images/luckDraw/zp.png';  
796 - break;  
797 - };  
798 - case 6: { //礼包  
799 - src = imghost + 'miniapp/images/luckDraw/lb.png';  
800 - break;  
801 - };  
802 - };  
803 - return src;  
804 - },  
805 -  
806 - // 获取抽奖结果匹配对应奖品在奖品列表里的所有索引号  
807 - luckyIndex(arr, target) {  
808 - var results=[],  
809 - len = arr.length,  
810 - pos = 0;  
811 - while(pos < len){  
812 - // pos = arr[pos].indexOf(target, pos);  
813 - if(arr[pos].id == target) {  
814 - results.push(pos);//找到就存储索引  
815 -  
816 - };  
817 - pos += 1;//并从下个位置开始搜索  
818 - // if(pos === -1){//未找到就退出循环完成搜索  
819 - // break;  
820 - // };  
821 -  
822 - }  
823 - // console.log('当前奖品列表', this.data.prizes);  
824 - // console.log('中奖结果在当前奖品列表中的索引', results);  
825 -  
826 - return results;  
827 - },  
828 -  
829 - start () {  
830 - // self.data.start = true;  
831 - if(this.data.start) return;  
832 - this.data.start = true;  
833 -  
834 - if(!this.data.luckInfo) {  
835 - wx.showToast({  
836 - title: this.data.msg,  
837 - icon: 'none',  
838 - });  
839 - return;  
840 - };  
841 -  
842 - if(this.data.luckInfo.msgInfo) {  
843 - wx.showToast({  
844 - title: self.data.luckInfo.msgInfo,  
845 - icon: 'none',  
846 - success: function() {  
847 - self.setData({  
848 - start: false  
849 - });  
850 - }  
851 - });  
852 - return;  
853 - };  
854 - wx.showLoading({  
855 - title: '准备开始抽奖',  
856 - mask: true,  
857 - });  
858 - // 获取积分  
859 - app.request.promisePost('/api/weshop/marketing/marketingLuckForm/startLuckIntegral', {  
860 - isShowLoading: false,  
861 - data: {  
862 - storeId: app.globalData.setting.stoid,  
863 - userId: app.globalData.userInfo.user_id,  
864 - LuckId: this.data.options.id,  
865 - },  
866 - })  
867 - .then(function(res) {  
868 - if(res.data.code == -1) {  
869 - //积分不足,弹出提示  
870 - wx.hideLoading();  
871 - self.data.luckInfo.msgInfo = res.data.msg  
872 - wx.showToast({  
873 - title: res.data.msg,  
874 - icon: 'none',  
875 - success: function() {  
876 - self.data.start = false;  
877 - }  
878 - });  
879 - return;  
880 - };  
881 -  
882 - if(res.data.code == 0) {  
883 -  
884 - if(self.data.luckInfo.user_LuckNumDay > 0 || self.data.luckInfo.vip_act_num == 0) {  
885 - // console.log('start choujiang');  
886 - // let start = false;  
887 - if(self.data.start) {  
888 - // self.data.start = true;  
889 - // 获取抽奖组件实例  
890 - const $lucky = self.selectComponent('#myLucky');  
891 - // 调用play方法开始旋转  
892 - $lucky.play();  
893 - wx.hideLoading();  
894 - // 获取抽奖结果  
895 - app.request.post('/api/weshop/marketing/marketingLuckForm/startLuck', {  
896 - isShowLoading: false,  
897 - data: {  
898 - storeId: app.globalData.setting.stoid,  
899 - userId: app.globalData.userInfo.user_id,  
900 - LuckId: self.data.options.id,  
901 - },  
902 - success: function(res) {  
903 -  
904 - if(res.data.code == 0) {  
905 - // console.log('开始摇奖', res.data.data);  
906 - if(self.data.luckInfo.vip_act_num != 0) {  
907 - self.setData({  
908 - 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1,  
909 - // isActive: true,  
910 - });  
911 - };  
912 -  
913 - self.setData({  
914 - // 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1,  
915 - isActive: true,  
916 - wow: res.data.data,  
917 - });  
918 - // console.log('wow', self.data.wow);  
919 - // console.log('请求成功', res.data.data);  
920 - let luckyId = res.data.data.id;  
921 - let indexArr = self.luckyIndex(self.data.prizes, luckyId);  
922 - // console.log('抽奖奖品id', luckyId);  
923 - // console.log('奖品列表', self.data.prizes);  
924 - // console.log('奖品对应的索引数组', indexArr);  
925 - let random = Math.random() * indexArr.length >> 0;  
926 - // console.log('random', random);  
927 - let index = indexArr[random];  
928 -  
929 - $lucky.stop(index);  
930 -  
931 - // setTimeout(() => {  
932 - // Promise.resolve($lucky.stop(index)).then(()=>{  
933 - // self.data.start = false;  
934 - // });  
935 -  
936 - // }, 2000);  
937 -  
938 -  
939 - //获取兑奖记录  
940 - // app.request.get('/api/weshop/marketing/marketingLuckRecord/page', {  
941 - // isShowLoading: false,  
942 - // data: {  
943 - // store_id: app.globalData.setting.stoid,  
944 - // user_id: app.globalData.userInfo.user_id,  
945 - // luck_formid: self.data.options.id,  
946 - // luck_state: 1  
947 - // },  
948 - // success: function(res) {  
949 - // if(res.data.code == 0) {  
950 - // // console.log('res===>', res.data.data.pageData);  
951 - // self.setData({  
952 - // record: res.data.data.pageData,  
953 - // });  
954 - // };  
955 - // },  
956 - // });  
957 -  
958 -  
959 - } else {  
960 - let thxIndexArr = self.data.thxIndexArr;  
961 - const random = Math.random() * thxIndexArr.length >> 0;  
962 - const index = thxIndexArr[random];  
963 - // console.log('谢谢参与数组', thxIndexArr);  
964 - // console.log('请求出错产生谢谢参与的随机数', index);  
965 - $lucky.stop(index);  
966 - // setTimeout(() => {  
967 - // Promise.resolve($lucky.stop(index)).then(()=>{  
968 - // self.data.start = false;  
969 - // });  
970 - // }, 2000);  
971 -  
972 -  
973 -  
974 -  
975 - if(res.data.code == -1) {  
976 - wx.showToast({  
977 - title: res.data.msg,  
978 - icon: 'none',  
979 - success: function() {  
980 - self.setData({  
981 - start: false  
982 - });  
983 - }  
984 - });  
985 - self.data.luckInfo.msgInfo = res.data.msg;  
986 - return;  
987 - // self.data.start = true;  
988 - };  
989 -  
990 -  
991 - if(res.data.code == -2 && self.data.luckInfo.vip_act_num != 0) {  
992 - self.setData({  
993 - 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1,  
994 - });  
995 - };  
996 -  
997 -  
998 - };  
999 -  
1000 -  
1001 - },  
1002 -  
1003 - fail: function(res) {  
1004 - // console.log('出错');  
1005 - wx.showToast({  
1006 - title: '数据请求失败',  
1007 - icon: 'error',  
1008 - });  
1009 - let thxIndexArr = self.data.thxIndexArr;  
1010 - const random = Math.random() * thxIndexArr.length >> 0;  
1011 - const index = thxIndexArr[random];  
1012 - $lucky.stop(index);  
1013 - // setTimeout(() => {  
1014 - // Promise.resolve($lucky.stop(index)).then(()=>{  
1015 - // self.data.start = false;  
1016 - // });  
1017 - // }, 2000);  
1018 - },  
1019 -  
1020 -  
1021 -  
1022 - });  
1023 -  
1024 - }  
1025 -  
1026 -  
1027 - } else {  
1028 - wx.showToast({  
1029 - title: '你今天的抽奖次数已用完啦!~',  
1030 - icon: 'none',  
1031 - success: function() {  
1032 - self.setData({  
1033 - start: false  
1034 - });  
1035 - }  
1036 - });  
1037 - };  
1038 -  
1039 - };  
1040 - });  
1041 -  
1042 -  
1043 -  
1044 -  
1045 - 828 +
  829 + start() {
1046 830
  831 + // self.data.start = true;
  832 + if (this.data.start) return;
  833 + this.data.start = true;
  834 +
  835 + if (!this.data.luckInfo) {
  836 + wx.showToast({
  837 + title: this.data.msg,
  838 + icon: 'none',
  839 + });
  840 + return;
  841 + };
  842 +
  843 + if (this.data.luckInfo.msgInfo) {
  844 + wx.showToast({
  845 + title: self.data.luckInfo.msgInfo,
  846 + icon: 'none',
  847 + success: function () {
  848 + self.setData({
  849 + start: false
  850 + });
  851 + }
  852 + });
  853 + return;
  854 + };
  855 + wx.showLoading({
  856 + title: '准备开始抽奖',
  857 + mask: true,
  858 + });
  859 + // 获取积分
  860 + app.request.promisePost('/api/weshop/marketing/marketingLuckForm/startLuckIntegral', {
  861 + isShowLoading: false,
  862 + data: {
  863 + storeId: app.globalData.setting.stoid,
  864 + userId: app.globalData.userInfo.user_id,
  865 + LuckId: this.data.options.id,
  866 + },
  867 + })
  868 + .then(function (res) {
  869 + if (res.data.code == -1) {
  870 + //积分不足,弹出提示
  871 + wx.hideLoading();
  872 + self.data.luckInfo.msgInfo = res.data.msg
  873 + wx.showToast({
  874 + title: res.data.msg,
  875 + icon: 'none',
  876 + success: function () {
  877 + self.data.start = false;
  878 + }
  879 + });
  880 + return;
  881 + };
  882 +
  883 + if (res.data.code == 0) {
  884 +
  885 + if (self.data.luckInfo.user_LuckNumDay > 0 || self.data.luckInfo.vip_act_num == 0) {
  886 + // console.log('start choujiang');
  887 + // let start = false;
  888 + if (self.data.start) {
  889 + // self.data.start = true;
  890 + // 获取抽奖组件实例
  891 + const $lucky = self.selectComponent('#myLucky');
  892 + // 调用play方法开始旋转
  893 + $lucky.play();
  894 + wx.hideLoading();
  895 + // 获取抽奖结果
  896 + app.request.post('/api/weshop/marketing/marketingLuckForm/startLuck', {
  897 + isShowLoading: false,
  898 + data: {
  899 + storeId: app.globalData.setting.stoid,
  900 + userId: app.globalData.userInfo.user_id,
  901 + LuckId: self.data.options.id,
  902 + },
  903 + success: function (res) {
  904 +
  905 + if (res.data.code == 0) {
  906 + // console.log('开始摇奖', res.data.data);
  907 + if (self.data.luckInfo.vip_act_num != 0) {
  908 + self.setData({
  909 + 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1,
  910 + // isActive: true,
  911 + });
  912 + };
  913 +
  914 + self.setData({
  915 + // 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1,
  916 + isActive: true,
  917 + wow: res.data.data,
  918 + });
  919 + // console.log('wow', self.data.wow);
  920 + // console.log('请求成功', res.data.data);
  921 + let luckyId = res.data.data.id;
  922 + let indexArr = self.luckyIndex(self.data.prizes, luckyId);
  923 + // console.log('抽奖奖品id', luckyId);
  924 + // console.log('奖品列表', self.data.prizes);
  925 + // console.log('奖品对应的索引数组', indexArr);
  926 + let random = Math.random() * indexArr.length >> 0;
  927 + // console.log('random', random);
  928 + let index = indexArr[random];
  929 +
  930 + $lucky.stop(index);
  931 +
  932 + // setTimeout(() => {
  933 + // Promise.resolve($lucky.stop(index)).then(()=>{
  934 + // self.data.start = false;
  935 + // });
  936 +
  937 + // }, 2000);
  938 +
  939 +
  940 + //获取兑奖记录
  941 + // app.request.get('/api/weshop/marketing/marketingLuckRecord/page', {
  942 + // isShowLoading: false,
  943 + // data: {
  944 + // store_id: app.globalData.setting.stoid,
  945 + // user_id: app.globalData.userInfo.user_id,
  946 + // luck_formid: self.data.options.id,
  947 + // luck_state: 1
  948 + // },
  949 + // success: function(res) {
  950 + // if(res.data.code == 0) {
  951 + // // console.log('res===>', res.data.data.pageData);
  952 + // self.setData({
  953 + // record: res.data.data.pageData,
  954 + // });
  955 + // };
  956 + // },
  957 + // });
  958 +
  959 +
  960 + } else {
  961 + let thxIndexArr = self.data.thxIndexArr;
  962 + const random = Math.random() * thxIndexArr.length >> 0;
  963 + const index = thxIndexArr[random];
  964 + // console.log('谢谢参与数组', thxIndexArr);
  965 + // console.log('请求出错产生谢谢参与的随机数', index);
  966 + $lucky.stop(index);
  967 + // setTimeout(() => {
  968 + // Promise.resolve($lucky.stop(index)).then(()=>{
  969 + // self.data.start = false;
  970 + // });
  971 + // }, 2000);
  972 +
  973 +
  974 +
  975 +
  976 + if (res.data.code == -1) {
  977 + wx.showToast({
  978 + title: res.data.msg,
  979 + icon: 'none',
  980 + success: function () {
  981 + self.setData({
  982 + start: false
  983 + });
  984 + }
  985 + });
  986 + self.data.luckInfo.msgInfo = res.data.msg;
  987 + return;
  988 + // self.data.start = true;
  989 + };
  990 +
  991 +
  992 + if (res.data.code == -2 && self.data.luckInfo.vip_act_num != 0) {
  993 + self.setData({
  994 + 'luckInfo.user_LuckNumDay': self.data.luckInfo.user_LuckNumDay - 1,
  995 + });
  996 + };
  997 +
  998 +
  999 + };
  1000 +
  1001 +
  1002 + },
  1003 +
  1004 + fail: function (res) {
  1005 + // console.log('出错');
  1006 + wx.showToast({
  1007 + title: '数据请求失败',
  1008 + icon: 'error',
  1009 + });
  1010 + let thxIndexArr = self.data.thxIndexArr;
  1011 + const random = Math.random() * thxIndexArr.length >> 0;
  1012 + const index = thxIndexArr[random];
  1013 + $lucky.stop(index);
  1014 + // setTimeout(() => {
  1015 + // Promise.resolve($lucky.stop(index)).then(()=>{
  1016 + // self.data.start = false;
  1017 + // });
  1018 + // }, 2000);
  1019 + },
  1020 +
  1021 +
  1022 +
  1023 + });
  1024 +
  1025 + }
  1026 +
  1027 +
  1028 + } else {
  1029 + wx.showToast({
  1030 + title: '你今天的抽奖次数已用完啦!~',
  1031 + icon: 'none',
  1032 + success: function () {
  1033 + self.setData({
  1034 + start: false
  1035 + });
  1036 + }
  1037 + });
  1038 + };
  1039 +
  1040 + };
  1041 + });
  1042 +
  1043 +
  1044 +
  1045 +
  1046 +
  1047 +
1047 }, 1048 },
1048 - end (event) { 1049 + end(event) {
1049 // 中奖奖品详情 1050 // 中奖奖品详情
1050 // console.log('抽奖结果:',event.detail); 1051 // console.log('抽奖结果:',event.detail);
1051 - let no_luck_urltype = this.data.luckInfo.no_luck_urltype;  
1052 - let lbtype = null;  
1053 - // let good_id = null;  
1054 - let resultTitle = event.detail.fonts[0].text.replace('\n','');  
1055 - // if(event.detail.id) {  
1056 - // console.log('~~~~~~----++++++',event.detail.id);  
1057 - // good_id = event.detail.id;  
1058 - // };  
1059 - if(event.detail.lbtype == 5) {  
1060 - lbtype = 5;  
1061 - } else {  
1062 - lbtype = -1;  
1063 - };  
1064 - this.setData({  
1065 - num: 3,  
1066 - hiddenCanvas: true,  
1067 - showResult: true,  
1068 - showMask: true,  
1069 - resultTitle,  
1070 - showPopup: false,  
1071 - currentLbtype: lbtype,  
1072 - // good_id,  
1073 - });  
1074 -  
1075 -  
1076 -  
1077 -  
1078 - if(no_luck_urltype == 1 && resultTitle == '谢谢参与') {  
1079 - if(this.data.luckInfo.no_luck_weappurl) {  
1080 - let num = this.data.num;  
1081 - let url = this.data.luckInfo.no_luck_weappurl;  
1082 - self.timer = setInterval(function() {  
1083 - if(num == 0) {  
1084 - clearInterval(self.timer);  
1085 - app.goto(url);  
1086 - } else {  
1087 - self.setData({  
1088 - num: --num,  
1089 - });  
1090 - }  
1091 - }, 500);  
1092 -  
1093 - };  
1094 -  
1095 - };  
1096 -  
1097 -  
1098 - if(self.data.luckInfo.give_user) {  
1099 - if(resultTitle == '谢谢参与') {  
1100 - if(self.data.luckInfo.give_type == 1) {  
1101 - if(self.data.luckInfo.give_integral > 0) {  
1102 - wx.showToast({  
1103 - title: `获得游戏奖励积分${self.data.luckInfo.give_integral}`,  
1104 - icon: 'none',  
1105 - });  
1106 - };  
1107 - } else if((self.data.luckInfo.give_type == 2)) {  
1108 - if(self.data.luckInfo.give_growth > 0) {  
1109 - wx.showToast({  
1110 - title: `获得游戏奖励成长值${self.data.luckInfo.give_growth}`,  
1111 - icon: 'none',  
1112 - });  
1113 - };  
1114 - };  
1115 - };  
1116 - } else {  
1117 - if(self.data.luckInfo.give_type == 1) {  
1118 - if(self.data.luckInfo.give_integral > 0) {  
1119 - wx.showToast({  
1120 - title: `获得游戏奖励积分${self.data.luckInfo.give_integral}`,  
1121 - icon: 'none',  
1122 - });  
1123 - };  
1124 - } else if((self.data.luckInfo.give_type == 2)) {  
1125 - if(self.data.luckInfo.give_growth > 0) {  
1126 - wx.showToast({  
1127 - title: `获得游戏奖励成长值${self.data.luckInfo.give_growth}`,  
1128 - icon: 'none',  
1129 - });  
1130 - };  
1131 - };  
1132 - };  
1133 -  
1134 - 1052 + let no_luck_urltype = this.data.luckInfo.no_luck_urltype;
  1053 + let lbtype = null;
  1054 + // let good_id = null;
  1055 + let resultTitle = event.detail.fonts[0].text.replace('\n', '');
  1056 + // if(event.detail.id) {
  1057 + // console.log('~~~~~~----++++++',event.detail.id);
  1058 + // good_id = event.detail.id;
  1059 + // };
  1060 + if (event.detail.lbtype == 5) {
  1061 + lbtype = 5;
  1062 + } else {
  1063 + lbtype = -1;
  1064 + };
  1065 + this.setData({
  1066 + num: 3,
  1067 + hiddenCanvas: true,
  1068 + showResult: true,
  1069 + showMask: true,
  1070 + resultTitle,
  1071 + showPopup: false,
  1072 + currentLbtype: lbtype,
  1073 + // good_id,
  1074 + });
  1075 +
  1076 +
  1077 +
  1078 +
  1079 + if (no_luck_urltype == 1 && resultTitle == '谢谢参与') {
  1080 + if (this.data.luckInfo.no_luck_weappurl) {
  1081 + let num = this.data.num;
  1082 + let url = this.data.luckInfo.no_luck_weappurl;
  1083 + self.timer = setInterval(function () {
  1084 + if (num == 0) {
  1085 + clearInterval(self.timer);
  1086 + app.goto(url);
  1087 + } else {
  1088 + self.setData({
  1089 + num: --num,
  1090 + });
  1091 + }
  1092 + }, 500);
  1093 +
  1094 + };
  1095 +
  1096 + };
  1097 +
  1098 +
  1099 + if (self.data.luckInfo.give_user) {
  1100 + if (resultTitle == '谢谢参与') {
  1101 + if (self.data.luckInfo.give_type == 1) {
  1102 + if (self.data.luckInfo.give_integral > 0) {
  1103 + wx.showToast({
  1104 + title: `获得游戏奖励积分${self.data.luckInfo.give_integral}`,
  1105 + icon: 'none',
  1106 + });
  1107 + };
  1108 + } else if ((self.data.luckInfo.give_type == 2)) {
  1109 + if (self.data.luckInfo.give_growth > 0) {
  1110 + wx.showToast({
  1111 + title: `获得游戏奖励成长值${self.data.luckInfo.give_growth}`,
  1112 + icon: 'none',
  1113 + });
  1114 + };
  1115 + };
  1116 + };
  1117 + } else {
  1118 + if (self.data.luckInfo.give_type == 1) {
  1119 + if (self.data.luckInfo.give_integral > 0) {
  1120 + wx.showToast({
  1121 + title: `获得游戏奖励积分${self.data.luckInfo.give_integral}`,
  1122 + icon: 'none',
  1123 + });
  1124 + };
  1125 + } else if ((self.data.luckInfo.give_type == 2)) {
  1126 + if (self.data.luckInfo.give_growth > 0) {
  1127 + wx.showToast({
  1128 + title: `获得游戏奖励成长值${self.data.luckInfo.give_growth}`,
  1129 + icon: 'none',
  1130 + });
  1131 + };
  1132 + };
  1133 + };
  1134 +
  1135 +
1135 }, 1136 },
1136 - //门店回调  
1137 - async callback(e){  
1138 - let item = e.detail;  
1139 - console.log('门店信息');  
1140 - console.log(item);  
1141 - if (item && item.pickup_no) {  
1142 - // let qr_code_object=this.data.qr_code_object  
1143 - // let data={  
1144 - // store_id:os.stoid,//商家编号  
1145 - // user_id:getApp().globalData.user_id, //会员编号  
1146 - // storageId:item.keyid,  
1147 - // writeOffCode:qr_code_object.WriteOffCode,//核销码  
1148 - // }  
1149 - // let res = await getApp().request.promisePut("/api/weshop/users/grade/storage/update", {  
1150 - // data: data  
1151 - // });  
1152 - // if (res && res.data && res.data.code==0) {  
1153 - // let text='qr_code_object.StorageID'  
1154 - // this.setData({  
1155 - // [text]:item.keyid  
1156 - // })  
1157 - // }else{  
1158 - // wx.showToast({  
1159 - // title: '门店选择失败',  
1160 - // icon: 'none',  
1161 - // duration: 2000  
1162 - // })  
1163 - // }  
1164 - }else{  
1165 - wx.showToast({  
1166 - title: '门店选择失败',  
1167 - icon: 'none',  
1168 - duration: 2000 1137 + //门店回调
  1138 + async callback(e) {
  1139 + let item = e.detail;
  1140 + console.log('门店信息');
  1141 + console.log(item);
  1142 +
  1143 + if (item && item.pickup_id) {
  1144 + if (this.data.wow) {
  1145 + let text = 'wow.goods_pickup_id'
  1146 + this.setData({
  1147 + [text]: item.pickup_id
1169 }) 1148 })
  1149 + this.showQr()
  1150 + } else {
  1151 + let action_item = this.data.action_item
  1152 + if (!action_item.currentTarget.dataset.verify_pickup_id) {
  1153 + action_item.verify_pickup_id = item.pickup_id
  1154 + }
  1155 + this.showQr(action_item)
1170 } 1156 }
1171 - },  
1172 - //门店选择  
1173 - select_product(){  
1174 1157
  1158 +
  1159 + } else {
  1160 + wx.showToast({
  1161 + title: '门店选择失败',
  1162 + icon: 'none',
  1163 + duration: 2000
  1164 + })
  1165 + }
  1166 + },
  1167 + //门店选择1
  1168 + select_product() {
  1169 + if (this.data.luckInfo.is_store==1) {
1175 this.setData({ 1170 this.setData({
1176 - store:1, 1171 + store: 1,
1177 showResult: false, 1172 showResult: false,
1178 }) 1173 })
1179 - },  
1180 - showPopup() {  
1181 - this.setData({  
1182 - list: null,  
1183 - pageNum: 1,  
1184 - noMore: false,  
1185 - });  
1186 - this.getData(true, '/api/weshop/marketing/marketingLuckRecord/page', {  
1187 - store_id: app.globalData.setting.stoid,  
1188 - user_id: app.globalData.userInfo.user_id,  
1189 - luck_formid: this.data.options.id,  
1190 - luck_state: 1,  
1191 - }).then(function(res) {  
1192 - self.setData({  
1193 - showPopup: true,  
1194 - showMask: true,  
1195 - hiddenCanvas: true,  
1196 - });  
1197 - });  
1198 -  
1199 - // this.setData({  
1200 - // showPopup: true,  
1201 - // showMask: true,  
1202 - // hiddenCanvas: true,  
1203 - // 'list.pageData': this.data.record,  
1204 - // // record: self.data.list.pageData,  
1205 - // });  
1206 -  
1207 - },  
1208 -  
1209 - closePopup() {  
1210 - this.setData({  
1211 - showPopup: false,  
1212 - showMask: false,  
1213 - hiddenCanvas: false,  
1214 - });  
1215 - },  
1216 -  
1217 - /**  
1218 - * 关闭中奖结果  
1219 - */  
1220 - closeResult() {  
1221 - clearInterval(this.timer);  
1222 - this.setData({  
1223 - num: 3,  
1224 - showResult: false,  
1225 - showMask: false,  
1226 - hiddenCanvas: false,  
1227 - start: false,  
1228 - });  
1229 - },  
1230 -  
1231 - loadmore() {  
1232 - this.scrollToLower('/api/weshop/marketing/marketingLuckRecord/page', {  
1233 - store_id: app.globalData.setting.stoid,  
1234 - user_id: app.globalData.userInfo.user_id,  
1235 - luck_formid: this.data.options.id,  
1236 - luck_state: 1,  
1237 - });  
1238 - },  
1239 -  
1240 -  
1241 - /**  
1242 - * 请求数据  
1243 - */  
1244 - getData: function(isInit, url, data) {  
1245 - let p = app.request.promiseGet(url, {  
1246 - data: data,  
1247 - isShowLoading: true,  
1248 - })  
1249 - .then(function(res) {  
1250 - if(res.data.code == 0) {  
1251 -  
1252 - self.setData({  
1253 - isLoading: false  
1254 - });  
1255 -  
1256 - if(isInit) {// 第一次加载  
1257 - self.setData({  
1258 - list: res.data.data  
1259 - });  
1260 - } else {  
1261 - self.setData({  
1262 - 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData)  
1263 - });  
1264 - };  
1265 -  
1266 - if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) {  
1267 - self.setData({  
1268 - noMore: true  
1269 - });  
1270 - };  
1271 -  
1272 - } else {  
1273 - self.setData({  
1274 - 'list.pageData': []  
1275 - });  
1276 - };  
1277 -  
1278 - });  
1279 -  
1280 - return p;  
1281 - },  
1282 -  
1283 -  
1284 - /**  
1285 - * 上拉加载  
1286 - */  
1287 - scrollToLower(url, requestData) {  
1288 - // 数据总量  
1289 - let total = this.data.list.total;  
1290 - // 单页最大数据量  
1291 - let pageSize = this.data.list.pageSize;  
1292 - // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’  
1293 - if((total != 0)&&(total <= pageSize)) {  
1294 - this.setData({  
1295 - noMore: true  
1296 - });  
1297 - };  
1298 -  
1299 - if(!this.data.isLoading && !this.data.noMore) {  
1300 - this.setData({  
1301 - isLoading: true,  
1302 - pageNum: this.data.pageNum + 1  
1303 - });  
1304 - requestData.page = this.data.pageNum;  
1305 - this.getData(false, url, requestData);  
1306 - };  
1307 - },  
1308 -  
1309 -  
1310 - goto(e) {  
1311 - let url = '';  
1312 - let type = e.currentTarget.dataset.type;  
1313 - let ordersn = null;  
1314 - let buyreceive_id = null;  
1315 - if(e.currentTarget.dataset.ordersn) {  
1316 - ordersn = e.currentTarget.dataset.ordersn;  
1317 - };  
1318 - if(e.currentTarget.dataset.buyreceiveid) {  
1319 - buyreceive_id = e.currentTarget.dataset.buyreceiveid;  
1320 - };  
1321 - switch(type) {  
1322 - case 1: {  
1323 - url = '/packageD/pages/user/integral/integral';  
1324 - break;  
1325 - };  
1326 - case 2: {  
1327 - url = '/packageE/pages/user/grow_value/grow_value';  
1328 - break;  
1329 - };  
1330 - case 3: {  
1331 - url = '/packageD/pages/user/coupons/coupons';  
1332 - break;  
1333 - };  
1334 - case 4: {  
1335 - url = '/pages/user/my_service/i_service';  
1336 - break;  
1337 - };  
1338 - case 6: {  
1339 - url = `/pages/giftpack/giftpacklist/giftpacklist?isBuy=0&orderSn=${ordersn}&lbId=${buyreceive_id}`;  
1340 - break;  
1341 - };  
1342 - };  
1343 - app.goto(url);  
1344 - },  
1345 -  
1346 - showQr(e) {  
1347 - let id = null;  
1348 - let store_id = app.globalData.setting.stoid;  
1349 - if(e && e.currentTarget.dataset.id) {  
1350 - id = e.currentTarget.dataset.id;  
1351 - } else {  
1352 - id = this.data.wow.record_id;  
1353 - };  
1354 - let url = `/api/weshop/marketing/marketingLuckList/updateGoodsVerifyCode/${store_id}/${id}`;  
1355 - // console.log('good_id', id, url);  
1356 - app.request.put(url, {  
1357 - success: function(res) {  
1358 - if(res.data.code == 0) {  
1359 - let data = res.data.data;  
1360 - let barcode = self.selectComponent("#qrcode");  
1361 - barcode.open({val: data});  
1362 - self.setData({  
1363 - hiddenCanvas: true,  
1364 - showPopup: false,  
1365 - });  
1366 - } else {  
1367 - wx.showToast({  
1368 - title: res.data.msg,  
1369 - icon: 'none',  
1370 - });  
1371 - };  
1372 - },  
1373 -  
1374 - });  
1375 - },  
1376 -  
1377 - closeQr() {  
1378 - this.setData({  
1379 - hiddenCanvas: false,  
1380 - showMask: false,  
1381 - });  
1382 - },  
1383 -  
1384 - clickReceive() {  
1385 - this.setData({  
1386 - showResult: false,  
1387 - });  
1388 - this.showQr();  
1389 - },  
1390 -  
1391 -  
1392 -  
1393 - showPoster() {  
1394 -  
1395 - console.log('已经生成图片!!!!!!', self.data.imgPath);  
1396 - // console.log(Promise.resolve(this.onImgOK));  
1397 - wx.showLoading({  
1398 - title: '生成海报中',  
1399 - });  
1400 - var timer;  
1401 - if(this.data.isImgOk && this.data.getMiniCode) {  
1402 - wx.hideLoading();  
1403 - self.setData({  
1404 - myimg: self.data.imgPath,  
1405 - hiddenCanvas: true,  
1406 - showMask: true,  
1407 - showPoster: true,  
1408 - });  
1409 - } else {  
1410 - timer = setInterval(function() {  
1411 - if(self.data.isImgOk && self.data.getMiniCode) {  
1412 - clearInterval(timer);  
1413 - wx.hideLoading();  
1414 - self.setData({  
1415 - myimg: self.data.imgPath,  
1416 - hiddenCanvas: true,  
1417 - showMask: true,  
1418 - showPoster: true,  
1419 - });  
1420 - };  
1421 - }, 500);  
1422 - };  
1423 - },  
1424 -  
1425 - closePoster() {  
1426 - this.setData({  
1427 - showMask: false,  
1428 - showPoster: false,  
1429 - hiddenCanvas: false,  
1430 - });  
1431 - },  
1432 -  
1433 -  
1434 -  
1435 - onImgOK(e) {  
1436 - console.log('图片绘制成功', e.detail.path);  
1437 - // this.setData({  
1438 - // imgPath: e.detail.path,  
1439 - // });  
1440 - if(e&&e.detail.path) {  
1441 - this.setData({  
1442 - isImgOk: true,  
1443 - imgPath: e.detail.path,  
1444 - });  
1445 - };  
1446 -  
1447 - },  
1448 -  
1449 -  
1450 - 1174 + }else{
  1175 + this.clickReceive()
  1176 + }
  1177 + },
  1178 + //门店选择2
  1179 + select_product2(e) {
  1180 + if (e.currentTarget.dataset.verify_pickup_id) {
  1181 + this.showQr(e)
  1182 + } else {
  1183 + if (this.data.luckInfo.is_store==1) {
  1184 + this.setData({
  1185 + store: 1,
  1186 + showResult: false,
  1187 + showPopup: false,
  1188 + action_item: e,
  1189 + wow: ''
  1190 + })
  1191 + }else{
  1192 + this.showQr(e)
  1193 + }
  1194 + }
  1195 +
  1196 + },
  1197 + showPopup() {
  1198 + this.setData({
  1199 + list: null,
  1200 + pageNum: 1,
  1201 + noMore: false,
  1202 + });
  1203 + this.getData(true, '/api/weshop/marketing/marketingLuckRecord/page', {
  1204 + store_id: app.globalData.setting.stoid,
  1205 + user_id: app.globalData.userInfo.user_id,
  1206 + luck_formid: this.data.options.id,
  1207 + luck_state: 1,
  1208 + }).then(function (res) {
  1209 + self.setData({
  1210 + showPopup: true,
  1211 + showMask: true,
  1212 + hiddenCanvas: true,
  1213 + });
  1214 + });
  1215 +
  1216 + // this.setData({
  1217 + // showPopup: true,
  1218 + // showMask: true,
  1219 + // hiddenCanvas: true,
  1220 + // 'list.pageData': this.data.record,
  1221 + // // record: self.data.list.pageData,
  1222 + // });
  1223 +
  1224 + },
  1225 +
  1226 + closePopup() {
  1227 + this.setData({
  1228 + showPopup: false,
  1229 + showMask: false,
  1230 + hiddenCanvas: false,
  1231 + });
  1232 + },
  1233 +
  1234 + /**
  1235 + * 关闭中奖结果
  1236 + */
  1237 + closeResult() {
  1238 + clearInterval(this.timer);
  1239 + this.setData({
  1240 + num: 3,
  1241 + showResult: false,
  1242 + showMask: false,
  1243 + hiddenCanvas: false,
  1244 + start: false,
  1245 + });
  1246 + },
  1247 +
  1248 + loadmore() {
  1249 + this.scrollToLower('/api/weshop/marketing/marketingLuckRecord/page', {
  1250 + store_id: app.globalData.setting.stoid,
  1251 + user_id: app.globalData.userInfo.user_id,
  1252 + luck_formid: this.data.options.id,
  1253 + luck_state: 1,
  1254 + });
  1255 + },
  1256 +
  1257 +
  1258 + /**
  1259 + * 请求数据
  1260 + */
  1261 + getData: function (isInit, url, data) {
  1262 + let p = app.request.promiseGet(url, {
  1263 + data: data,
  1264 + isShowLoading: true,
  1265 + })
  1266 + .then(function (res) {
  1267 + if (res.data.code == 0) {
  1268 +
  1269 + self.setData({
  1270 + isLoading: false
  1271 + });
  1272 +
  1273 + if (isInit) {// 第一次加载
  1274 + self.setData({
  1275 + list: res.data.data
  1276 + });
  1277 + } else {
  1278 + self.setData({
  1279 + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData)
  1280 + });
  1281 + };
  1282 +
  1283 + if ((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) {
  1284 + self.setData({
  1285 + noMore: true
  1286 + });
  1287 + };
  1288 +
  1289 + } else {
  1290 + self.setData({
  1291 + 'list.pageData': []
  1292 + });
  1293 + };
  1294 +
  1295 + });
  1296 +
  1297 + return p;
  1298 + },
  1299 +
  1300 +
  1301 + /**
  1302 + * 上拉加载
  1303 + */
  1304 + scrollToLower(url, requestData) {
  1305 + // 数据总量
  1306 + let total = this.data.list.total;
  1307 + // 单页最大数据量
  1308 + let pageSize = this.data.list.pageSize;
  1309 + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’
  1310 + if ((total != 0) && (total <= pageSize)) {
  1311 + this.setData({
  1312 + noMore: true
  1313 + });
  1314 + };
  1315 +
  1316 + if (!this.data.isLoading && !this.data.noMore) {
  1317 + this.setData({
  1318 + isLoading: true,
  1319 + pageNum: this.data.pageNum + 1
  1320 + });
  1321 + requestData.page = this.data.pageNum;
  1322 + this.getData(false, url, requestData);
  1323 + };
  1324 + },
  1325 +
  1326 +
  1327 + goto(e) {
  1328 + let url = '';
  1329 + let type = e.currentTarget.dataset.type;
  1330 + let ordersn = null;
  1331 + let buyreceive_id = null;
  1332 + if (e.currentTarget.dataset.ordersn) {
  1333 + ordersn = e.currentTarget.dataset.ordersn;
  1334 + };
  1335 + if (e.currentTarget.dataset.buyreceiveid) {
  1336 + buyreceive_id = e.currentTarget.dataset.buyreceiveid;
  1337 + };
  1338 + switch (type) {
  1339 + case 1: {
  1340 + url = '/packageD/pages/user/integral/integral';
  1341 + break;
  1342 + };
  1343 + case 2: {
  1344 + url = '/packageE/pages/user/grow_value/grow_value';
  1345 + break;
  1346 + };
  1347 + case 3: {
  1348 + url = '/packageD/pages/user/coupons/coupons';
  1349 + break;
  1350 + };
  1351 + case 4: {
  1352 + url = '/pages/user/my_service/i_service';
  1353 + break;
  1354 + };
  1355 + case 6: {
  1356 + url = `/pages/giftpack/giftpacklist/giftpacklist?isBuy=0&orderSn=${ordersn}&lbId=${buyreceive_id}`;
  1357 + break;
  1358 + };
  1359 + };
  1360 + app.goto(url);
  1361 + },
  1362 +
  1363 + showQr(e) {
  1364 + let id = null;
  1365 + let store_id = app.globalData.setting.stoid;
  1366 + let goods_pickup_id = ''
  1367 + let off = false //是否需要携带登记的门店id
  1368 +
  1369 + if (e && e.currentTarget.dataset.id) {
  1370 + id = e.currentTarget.dataset.id;
  1371 + if (e.verify_pickup_id) {
  1372 + goods_pickup_id = e.verify_pickup_id;
  1373 + off = true
  1374 + }
  1375 + } else {
  1376 + id = this.data.wow.record_id;
  1377 + goods_pickup_id = this.data.wow.goods_pickup_id;
  1378 + off = true
  1379 + };
  1380 + let url = `/api/weshop/marketing/marketingLuckList/updateGoodsVerifyCode/${store_id}/${id}`;
  1381 +
  1382 + //判断是否需要登记门店,才可以核销商品
  1383 + if (this.data.luckInfo.is_store == 1 && goods_pickup_id && off) {
  1384 + url += `/${goods_pickup_id}`
  1385 + }
  1386 +
  1387 + // console.log('good_id', id, url);
  1388 + app.request.put(url, {
  1389 + success: function (res) {
  1390 + if (res.data.code == 0) {
  1391 + let data = res.data.data;
  1392 + let barcode = self.selectComponent("#qrcode");
  1393 + barcode.open({ val: data });
  1394 + self.setData({
  1395 + hiddenCanvas: true,
  1396 + showPopup: false,
  1397 + });
  1398 + } else {
  1399 + wx.showToast({
  1400 + title: res.data.msg,
  1401 + icon: 'none',
  1402 + });
  1403 + };
  1404 + },
  1405 +
  1406 + });
  1407 + },
  1408 +
  1409 + closeQr() {
  1410 + this.setData({
  1411 + hiddenCanvas: false,
  1412 + showMask: false,
  1413 + });
  1414 + },
  1415 +
  1416 + clickReceive() {
  1417 + this.setData({
  1418 + showResult: false,
  1419 + });
  1420 + this.showQr();
  1421 + },
  1422 +
  1423 +
  1424 +
  1425 + showPoster() {
  1426 +
  1427 + console.log('已经生成图片!!!!!!', self.data.imgPath);
  1428 + // console.log(Promise.resolve(this.onImgOK));
  1429 + wx.showLoading({
  1430 + title: '生成海报中',
  1431 + });
  1432 + var timer;
  1433 + if (this.data.isImgOk && this.data.getMiniCode) {
  1434 + wx.hideLoading();
  1435 + self.setData({
  1436 + myimg: self.data.imgPath,
  1437 + hiddenCanvas: true,
  1438 + showMask: true,
  1439 + showPoster: true,
  1440 + });
  1441 + } else {
  1442 + timer = setInterval(function () {
  1443 + if (self.data.isImgOk && self.data.getMiniCode) {
  1444 + clearInterval(timer);
  1445 + wx.hideLoading();
  1446 + self.setData({
  1447 + myimg: self.data.imgPath,
  1448 + hiddenCanvas: true,
  1449 + showMask: true,
  1450 + showPoster: true,
  1451 + });
  1452 + };
  1453 + }, 500);
  1454 + };
  1455 + },
  1456 +
  1457 + closePoster() {
  1458 + this.setData({
  1459 + showMask: false,
  1460 + showPoster: false,
  1461 + hiddenCanvas: false,
  1462 + });
  1463 + },
  1464 + //门店退出回调
  1465 + closeback(){
  1466 + console.log('门店关闭回调');
  1467 + this.setData({
  1468 + store: 0,
  1469 + showPopup: false,
  1470 + showMask: false,
  1471 + hiddenCanvas: false,
  1472 + })
  1473 + },
  1474 +
  1475 +
  1476 + onImgOK(e) {
  1477 + console.log('图片绘制成功', e.detail.path);
  1478 + // this.setData({
  1479 + // imgPath: e.detail.path,
  1480 + // });
  1481 + if (e && e.detail.path) {
  1482 + this.setData({
  1483 + isImgOk: true,
  1484 + imgPath: e.detail.path,
  1485 + });
  1486 + };
  1487 +
  1488 + },
  1489 +
  1490 +
  1491 +
1451 }) 1492 })
1452 \ No newline at end of file 1493 \ No newline at end of file
packageB/pages/luckactivity/luckinfo/luckinfo.wxml
@@ -143,9 +143,9 @@ @@ -143,9 +143,9 @@
143 <view class="fs26 xc-black3">价值:<text class="rmb">{{item.luck_goods_price}}</text></view> 143 <view class="fs26 xc-black3">价值:<text class="rmb">{{item.luck_goods_price}}</text></view>
144 <view class="flex ai_c {{item.luck_type == 5 ? 'jc_sb':'jc_fe'}} fs26 xc-black3 "> 144 <view class="flex ai_c {{item.luck_type == 5 ? 'jc_sb':'jc_fe'}} fs26 xc-black3 ">
145 <!-- <view style="visibility: {{item.luck_type == 5 ? 'visible':'hidden'}};">兑换状态:{{item.state == 0 ? '未兑换':'已兑换'}}</view> --> 145 <!-- <view style="visibility: {{item.luck_type == 5 ? 'visible':'hidden'}};">兑换状态:{{item.state == 0 ? '未兑换':'已兑换'}}</view> -->
146 - <!-- <view style="">兑换状态:{{item.state == 0 ? '未兑换':'已兑换'}}</view> --> 146 + <!-- <view style="">兑换状态:{{item.state == 0 ? '未兑换':'已兑换'}}</view> -->
147 <view class="fs24 c-a" wx:if="{{item.luck_type == 5}}">兑换截止时间:{{filter.show_default(item.changeDate, '不限')}}</view> 147 <view class="fs24 c-a" wx:if="{{item.luck_type == 5}}">兑换截止时间:{{filter.show_default(item.changeDate, '不限')}}</view>
148 - <view class="btn" bindtap="{{item.luck_type == 5 ? (item.state == 0 ? 'showQr':'showQr'):'goto'}}" data-type="{{item.luck_type}}" data-id="{{item.id}}" data-ordersn="{{item.order_sn}}" data-buyreceiveid="{{item.buyreceive_id}}">{{item.luck_type == 5 ? (item.state == 1 ? '已兑换':'兑换'):'查看'}}</view> 148 + <view class="btn" bindtap="{{item.luck_type == 5 ? (item.state == 0 ? 'select_product2':'select_product2'):'goto'}}" data-verify_pickup_id="{{item.verify_pickup_id}}" data-type="{{item.luck_type}}" data-id="{{item.id}}" data-ordersn="{{item.order_sn}}" data-buyreceiveid="{{item.buyreceive_id}}">{{item.luck_type == 5 ? (item.state == 1 ? '已兑换':'兑换'):'查看'}}</view>
149 </view> 149 </view>
150 </view> 150 </view>
151 </view> 151 </view>
@@ -202,6 +202,6 @@ @@ -202,6 +202,6 @@
202 <qrcode id="qrcode" bind:close="closeQr"></qrcode> 202 <qrcode id="qrcode" bind:close="closeQr"></qrcode>
203 203
204 <!-- 门店选择弹窗 --> 204 <!-- 门店选择弹窗 -->
205 -<store_popup store="{{store}}" bindcallback="callback" ></store_popup> 205 +<store_popup store="{{store}}" bind:closeback="closeback" bind:callback="callback" ></store_popup>
206 206
207 <painter style="position: absolute;left: -9999rpx;" palette="{{imgDraw}}" bind:imgOK="onImgOK"/> 207 <painter style="position: absolute;left: -9999rpx;" palette="{{imgDraw}}" bind:imgOK="onImgOK"/>
208 \ No newline at end of file 208 \ No newline at end of file