Commit 22ee19038e6b590992d6b9b8728b6f7d79fb255e
Merge branch 'dev' into 'test'
Dev See merge request !1152
Showing
17 changed files
with
1524 additions
and
1672 deletions
packageA/pages/liveStream/liveStream.js
... | ... | @@ -10,7 +10,6 @@ var t = require("../../../utils/util"), |
10 | 10 | o = s.globalData.setting, |
11 | 11 | os = o; |
12 | 12 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
13 | - | |
14 | 13 | const app = getApp(); |
15 | 14 | let self = null; |
16 | 15 | |
... | ... | @@ -21,14 +20,34 @@ Page({ |
21 | 20 | */ |
22 | 21 | data: { |
23 | 22 | curPage: 1, |
23 | + ad_data: null, | |
24 | + sharimg: "", | |
24 | 25 | living: {}, |
25 | 26 | livetoBegin: {}, |
26 | 27 | liveOver: {}, |
27 | - list: null, | |
28 | - isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
29 | - noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
30 | - pageNum: 1, // 当前页数 | |
31 | - | |
28 | + list: null, | |
29 | + isLoading: false, // 检测是否已经发送请求,防止重复发送请求 | |
30 | + noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 | |
31 | + pageNum: 1, // 当前页数 | |
32 | + details: {}, | |
33 | + status: '', | |
34 | + btnText: '', | |
35 | + showActionSheet: true, | |
36 | + showPlaybill: true, | |
37 | + windowWidth: 0, | |
38 | + windowHeight: 0, | |
39 | + dpr: 0, | |
40 | + canvasScale: 1.0, | |
41 | + nickName: '', | |
42 | + avatarUrl: '', | |
43 | + coverImg: '', | |
44 | + canvasToImgPath: '', | |
45 | + screenWidth: 0, | |
46 | + canvasHidden: 1, | |
47 | + gid: '', | |
48 | + shareImgPath: '', | |
49 | + shartitle: "", | |
50 | + anchorname:"" | |
32 | 51 | }, |
33 | 52 | // list: [], |
34 | 53 | // live: { |
... | ... | @@ -41,8 +60,18 @@ Page({ |
41 | 60 | clickItem: function (e) { |
42 | 61 | // id:列表项id |
43 | 62 | // live:直播类别 即将开始/直播中/精彩回放 |
63 | + | |
64 | + if (e.currentTarget.dataset.live == 101) { | |
65 | + var live_status = 'ing' | |
66 | + } | |
67 | + if (e.currentTarget.dataset.live == 102) { | |
68 | + var live_status = 'toBegin' | |
69 | + } | |
70 | + if (e.currentTarget.dataset.live == 103) { | |
71 | + var live_status = 'over' | |
72 | + } | |
44 | 73 | wx.navigateTo({ |
45 | - url: '/packageA/pages/liveStreamDetails/liveStreamDetails?id=' + e.currentTarget.dataset.id + '&live=' + e.currentTarget.dataset.live | |
74 | + url: '/packageA/pages/liveStreamDetails/liveStreamDetails?id=' + e.currentTarget.dataset.id + '&live=' + live_status | |
46 | 75 | }) |
47 | 76 | // console.log('options-->'); |
48 | 77 | }, |
... | ... | @@ -69,9 +98,9 @@ Page({ |
69 | 98 | }, |
70 | 99 | success: function (res) { |
71 | 100 | // console.log('我发起了PUT请求,请求结果:', res.data); |
72 | - if(res.data.code == 0) { | |
73 | - resolve(); | |
74 | - }; | |
101 | + if (res.data.code == 0) { | |
102 | + resolve(); | |
103 | + }; | |
75 | 104 | } |
76 | 105 | }); |
77 | 106 | }); |
... | ... | @@ -208,88 +237,90 @@ Page({ |
208 | 237 | * 生命周期函数--监听页面加载 |
209 | 238 | */ |
210 | 239 | onLoad: function (options) { |
211 | - self=this; | |
212 | - getApp().is_Single_page(this,function(){ | |
213 | - app.isLogin().then(function(data) {//进入页面前已经授权登录成功 | |
214 | - self.setData({ | |
240 | + self = this; | |
241 | + getApp().is_Single_page(this, function () { | |
242 | + app.isLogin().then(function (data) {//进入页面前已经授权登录成功 | |
243 | + self.setData({ | |
215 | 244 | userInfo: data, |
216 | 245 | }); |
217 | 246 | }); |
218 | 247 | }) |
219 | - | |
248 | + | |
249 | + | |
250 | + getApp().request.promiseGet("/api/weshop/ad/page?pid=1207&store_id=" + os.stoid, { | |
251 | + data: { | |
252 | + enabled: 1 | |
253 | + } | |
254 | + }).then(res => { | |
255 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { | |
256 | + var a = res.data.data.pageData; | |
257 | + var narr = []; | |
258 | + for (var i in a) { | |
259 | + var tt = { | |
260 | + 'ad_code': os.imghost + a[i].ad_code, | |
261 | + 'media_link': '', | |
262 | + 'ad_weapplink': a[i].ad_weapplink | |
263 | + }; | |
264 | + narr.push(tt); | |
265 | + } | |
266 | + self.setData({ | |
267 | + ad_data: narr | |
268 | + }); | |
269 | + } | |
270 | + }) | |
220 | 271 | }, |
221 | 272 | |
222 | 273 | /** |
223 | 274 | * 生命周期函数--监听页面初次渲染完成 |
224 | 275 | */ |
225 | 276 | onReady: function () { |
226 | - | |
277 | + | |
227 | 278 | }, |
228 | 279 | |
280 | + | |
229 | 281 | /** |
230 | 282 | * 生命周期函数--监听页面显示 |
231 | 283 | */ |
232 | 284 | onShow: function () { |
233 | 285 | |
234 | - getApp().check_can_share(); | |
235 | - if(app.globalData.userInfo) { | |
236 | - if(!this.data.isLogin) { | |
237 | - this.setData({ | |
238 | - userInfo: app.globalData.userInfo, | |
239 | - imghost: app.globalData.setting.imghost, | |
240 | - isLogin: true, | |
241 | - }); | |
242 | - | |
243 | - this.updateLiveList().then(() => { | |
244 | - | |
245 | - self.getData(true, '/api/weshop/wx/livelist/page', { //请求直播中列表 | |
246 | - storedId: o.stoid, | |
247 | - live_status: 101, | |
248 | - pageSize: 100, | |
249 | - }).then((res) => { | |
250 | - self.setData({ | |
251 | - living: self.data.list, | |
252 | - }); | |
253 | - | |
254 | - | |
255 | - console.log(self.data.living); | |
256 | - | |
257 | - //直播中列表请求完后,请求即将开始列表 | |
258 | - self.getData(true, '/api/weshop/wx/livelist/page', { | |
259 | - storedId: o.stoid, | |
260 | - live_status: 102, | |
261 | - pageSize: 100, | |
262 | - }).then((res) => { | |
263 | - self.setData({ | |
264 | - livetoBegin: self.data.list, | |
265 | - }); | |
266 | - | |
267 | - //即将开始列表请求完后,请求结束列表 | |
268 | - self.getData(true, '/api/weshop/wx/livelist/page', { | |
269 | - storedId: o.stoid, | |
270 | - live_status: 103, | |
271 | - }).then((res) => { | |
272 | - self.setData({ | |
273 | - liveOver: self.data.list, | |
274 | - }); | |
275 | - }); | |
276 | - | |
277 | - | |
278 | - }); | |
279 | - | |
280 | - | |
281 | - }); | |
282 | - | |
283 | - | |
284 | - | |
285 | - | |
286 | - | |
287 | - }); | |
288 | - | |
289 | - | |
290 | - | |
291 | - }; | |
292 | - }; | |
286 | + getApp().check_can_share(); | |
287 | + if (app.globalData.userInfo) { | |
288 | + if (!this.data.isLogin) { | |
289 | + this.setData({ | |
290 | + userInfo: app.globalData.userInfo, | |
291 | + imghost: app.globalData.setting.imghost, | |
292 | + isLogin: true, | |
293 | + }); | |
294 | + | |
295 | + this.updateLiveList().then(() => { | |
296 | + | |
297 | + self.getData(true, '/api/weshop/wx/livelist/page', { //请求直播中列表 | |
298 | + storedId: o.stoid, | |
299 | + pageSize: 100, | |
300 | + ordertype: 1, | |
301 | + liveshow: 1 | |
302 | + }).then((res) => { | |
303 | + var list = self.data.list | |
304 | + for (var i in list.pageData) { | |
305 | + var share_img = list.pageData[i].share_img | |
306 | + list.pageData[i].share_img = share_img.replace("http://", 'https://') | |
307 | + } | |
308 | + self.setData({ | |
309 | + living: list, | |
310 | + }); | |
311 | + | |
312 | + }); | |
313 | + | |
314 | + | |
315 | + | |
316 | + | |
317 | + | |
318 | + }); | |
319 | + | |
320 | + | |
321 | + | |
322 | + }; | |
323 | + }; | |
293 | 324 | }, |
294 | 325 | |
295 | 326 | /** |
... | ... | @@ -306,6 +337,340 @@ Page({ |
306 | 337 | |
307 | 338 | }, |
308 | 339 | |
340 | + | |
341 | + | |
342 | + // 分享操作表 | |
343 | + clickShare: function (e) { | |
344 | + var sharimg = e.currentTarget.dataset.sharimg | |
345 | + var shartitle = e.currentTarget.dataset.shartitle | |
346 | + var anchorname= e.currentTarget.dataset.anchorname | |
347 | + if (!getApp().globalData.user_id) { | |
348 | + getApp().goto("/packageE/pages/togoin/togoin"); | |
349 | + return false; | |
350 | + } | |
351 | + this.setData({ | |
352 | + showActionSheet: !this.data.showActionSheet, | |
353 | + sharimg: sharimg, | |
354 | + shartitle: shartitle, | |
355 | + anchorname:anchorname | |
356 | + }) | |
357 | + }, | |
358 | + | |
359 | + // actionSheet - 取消按钮 | |
360 | + hiddenActionSheet: function () { | |
361 | + this.setData({ | |
362 | + showActionSheet: 'false' | |
363 | + }) | |
364 | + if (!this.data.showPlaybill) { | |
365 | + this.setData({ | |
366 | + showPlaybill: 'true' | |
367 | + }); | |
368 | + } | |
369 | + }, | |
370 | + | |
371 | + // 获取图片信息 | |
372 | + getImageInfo(src) { | |
373 | + return new Promise((resolve, reject) => { | |
374 | + wx.getImageInfo({ | |
375 | + src: src, | |
376 | + success: (res) => { | |
377 | + resolve(res); | |
378 | + } | |
379 | + }) | |
380 | + }); | |
381 | + }, | |
382 | + | |
383 | + closeWin: function () { | |
384 | + this.setData({ | |
385 | + showPlaybill: 'true' | |
386 | + }); | |
387 | + }, | |
388 | + | |
389 | + //生成海报 | |
390 | + createPlaybill: function () { | |
391 | + // 1.提示 “正在生成海报...” | |
392 | + wx.showLoading({ | |
393 | + title: '正在生成海报...' | |
394 | + }); | |
395 | + | |
396 | + // 3.展示生成的海报 | |
397 | + this.setData({ | |
398 | + showActionSheet: 'false', | |
399 | + // showPlaybill: !this.data.showPlaybill | |
400 | + }); | |
401 | + | |
402 | + // 2.生成海报,如果生成完毕,关闭提示 | |
403 | + this.drawPlaybill(); | |
404 | + | |
405 | + }, | |
406 | + | |
407 | + | |
408 | + // 生成海报 | |
409 | + drawPlaybill: async function () { | |
410 | + | |
411 | + var that = this; | |
412 | + // wx.showLoading({ | |
413 | + // title: '正在生成海报...' | |
414 | + // }); | |
415 | + | |
416 | + | |
417 | + | |
418 | + | |
419 | + // 请求主图 | |
420 | + await that.getImageInfo(that.data.sharimg).then(res => { | |
421 | + that.setData({ | |
422 | + coverImg: res.path, | |
423 | + coverImgWidth: res.width, | |
424 | + coverImgHeight: res.height, | |
425 | + coverImgSize: that.imageResize(res.width, res.height), | |
426 | + // coverImgHeight: res.height, | |
427 | + }); | |
428 | + // console.log('主图加载成功~', that.data.coverImgSize); | |
429 | + }); | |
430 | + | |
431 | + | |
432 | + | |
433 | + | |
434 | + | |
435 | + var path2 = getApp().globalData.userInfo.head_pic; | |
436 | + if (path2 == "") { | |
437 | + path2 = "../../../images/share/hui_hear_pic.png"; | |
438 | + } else { | |
439 | + getApp().request.promiseGet("/api/weshop/marketing/help/help/imgbase64/get", { | |
440 | + data: { | |
441 | + imgurl: path2 | |
442 | + } | |
443 | + }).then(res => { | |
444 | + if (res.data.code == 0) { | |
445 | + console.log(9999) | |
446 | + | |
447 | + var imgSrc = res.data.data;//base64编码 | |
448 | + var save = wx.getFileSystemManager(); | |
449 | + var number = Math.random(); | |
450 | + save.writeFile({ | |
451 | + filePath: wx.env.USER_DATA_PATH + '/pic' + number + '.png', | |
452 | + data: imgSrc, | |
453 | + encoding: 'base64', | |
454 | + success: res => { | |
455 | + that.setData({ | |
456 | + avatarUrl: wx.env.USER_DATA_PATH + '/pic' + number + '.png' | |
457 | + }); | |
458 | + console.log(wx.env.USER_DATA_PATH + '/pic' + number + '.png') | |
459 | + }, fail: err => { | |
460 | + console.log(err) | |
461 | + } | |
462 | + }) | |
463 | + } | |
464 | + }) | |
465 | + } | |
466 | + | |
467 | + | |
468 | + // 请求二维码 | |
469 | + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | |
470 | + os.stoid + "?sceneValue=1012" + "&pageValue=pages/goods/goodsInfo/goodsInfo"; | |
471 | + | |
472 | + if (!this.data.ewm) { | |
473 | + | |
474 | + await that.getImageInfo(path3).then(res => { | |
475 | + that.setData({ | |
476 | + ewm: res.path | |
477 | + }); | |
478 | + console.log('二维码加载成功~') | |
479 | + }); | |
480 | + } | |
481 | + | |
482 | + | |
483 | + | |
484 | + // 数据准备 | |
485 | + const title = this.data.shartitle; | |
486 | + // const headImg = app.globalData.userInfo['head_pic']; | |
487 | + | |
488 | + // console.log('----------------v', headImg); | |
489 | + | |
490 | + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | |
491 | + os.stoid + "?sceneValue=1012" + "&pageValue=packageA/pages/liveStreamDetails/liveStreamDetails"; | |
492 | + | |
493 | + // 以iPhone6为例,375/750 = 0.5 | |
494 | + // let scale = this.data.windowWidth / 375; | |
495 | + let scale = this.data.screenWidth / 750 * 1.35 | |
496 | + | |
497 | + | |
498 | + // 适配屏get幕 | |
499 | + // let scale = this.data.windowWidth / 375.0; | |
500 | + // this.setData({totalHeight: 667 * scale}); | |
501 | + | |
502 | + // 获取Canvas | |
503 | + let ctx = wx.createCanvasContext('myCanvas'); | |
504 | + | |
505 | + // 放大 因为不放大的话,生成的分享图会模糊。暂时先注释 | |
506 | + // ctx.scale(this.data.canvasScale, this.data.canvasScale) | |
507 | + | |
508 | + | |
509 | + | |
510 | + // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | |
511 | + // os.stoid + "?sceneValue=1012" + "&pageValue=pages/goods/goodsInfo/goodsInfo"; | |
512 | + // + "?sceneValue=1012" + "&pageValue=packageA/pages/liveStreamDetails/liveStreamDetails" | |
513 | + // console.log('path3---->', path3); | |
514 | + | |
515 | + | |
516 | + // 绘制主背景白色 | |
517 | + ctx.setFillStyle('#ffffff'); | |
518 | + ctx.fillRect(0, 0, 480, 738); | |
519 | + | |
520 | + // 绘制头像 | |
521 | + ctx.save(); | |
522 | + ctx.beginPath(); | |
523 | + ctx.arc(58, 52, 28, 0, 2 * Math.PI); | |
524 | + ctx.clip(); | |
525 | + // console.log('1__________________>',app.globalData.userInfo['head_pic']); | |
526 | + ctx.drawImage(this.data.avatarUrl, 30, 24, 56, 56); | |
527 | + ctx.restore(); | |
528 | + | |
529 | + // 绘制昵称 | |
530 | + ctx.setFontSize(22); | |
531 | + ctx.setFillStyle('#ADADAD'); | |
532 | + ctx.fillText(app.globalData.userInfo.nickname, 106, 60); | |
533 | + | |
534 | + // 绘制主图 | |
535 | + ctx.setFillStyle('#f8f8f8'); | |
536 | + ctx.fillRect(0, 104, 480, 380); | |
537 | + | |
538 | + // var w = this.data.coverImgWidth; | |
539 | + // var h = this.data.coverImgHeight; | |
540 | + var w = this.data.coverImgSize.imageWidth; | |
541 | + var h = this.data.coverImgSize.imageHeight; | |
542 | + // var dw = 480/w //canvas与图片的宽高比 | |
543 | + // var dh = 380/h | |
544 | + // var ratio | |
545 | + // // 裁剪图片中间部分 | |
546 | + // if(w > 480 && h > 380 || w < 480 && h < 380){ | |
547 | + // if (dw > dh) { | |
548 | + // ctx.drawImage(this.data.coverImg, 0, (h - 380/dw)/2, w, 380/dw, 0, 104, 480, 380); | |
549 | + // } else { | |
550 | + // ctx.drawImage(this.data.coverImg, (w - 480/dh)/2, 0, 480/dh, h, 0, 104, 480, 380); | |
551 | + // }; | |
552 | + // } | |
553 | + // // 拉伸图片 | |
554 | + // else{ | |
555 | + // if(w < 300){ | |
556 | + // ctx.drawImage(this.data.coverImg, 0, (h - 380/dw)/2, w, 380/dw, 0, 104, 480, 380); | |
557 | + // }else { | |
558 | + // ctx.drawImage(this.data.coverImg, (w - 480/dh)/2, 0, 480/dh, h, 0, 104, 480, 380); | |
559 | + // } | |
560 | + // }; | |
561 | + ctx.drawImage(this.data.coverImg, (480 - w) / 2, (380 - h) / 2 + 104, w, h); | |
562 | + | |
563 | + | |
564 | + // 绘制文字 | |
565 | + ctx.setFontSize(24); | |
566 | + ctx.setFillStyle('#1E1E1E'); | |
567 | + this.drawText(ctx, title, 30, 600, 200, 460, 2); | |
568 | + | |
569 | + // 绘制小程序码 | |
570 | + ctx.drawImage(this.data.ewm, 310, 540, 132, 132); | |
571 | + | |
572 | + | |
573 | + //绘制文字:长按识别 | |
574 | + ctx.setFontSize(20); | |
575 | + ctx.setFillStyle('#1E1E1E'); | |
576 | + ctx.fillText('长按识别小程序', 309, 710); | |
577 | + | |
578 | + ctx.draw(true, function () { | |
579 | + setTimeout(function () { | |
580 | + // console.log("我进来了~~~~~"); | |
581 | + wx.canvasToTempFilePath({ | |
582 | + x: 0, | |
583 | + y: 0, | |
584 | + width: 750, | |
585 | + height: 1217, | |
586 | + destWidth: 750, | |
587 | + destHeight: 1217, | |
588 | + canvasId: 'myCanvas', | |
589 | + fileType: 'jpg', | |
590 | + success: function (res) { | |
591 | + wx.hideLoading(); | |
592 | + that.setData({ | |
593 | + canvasToImgPath: res.tempFilePath, | |
594 | + showPlaybill: !that.data.showPlaybill | |
595 | + }); | |
596 | + // console.log('生成海报陈宫啦', that.data.canvasToImgPath); | |
597 | + // that.saveImageToPhotosAlbum(res.tempFilePath); | |
598 | + // console.log('截图陈宫:', that.data.canvasToImgPath); | |
599 | + // wx.previewImage({ | |
600 | + // //将图片预览出来 | |
601 | + // urls: [that.data.canvasToImgPath] | |
602 | + // }); | |
603 | + } | |
604 | + }) | |
605 | + }, 1000) | |
606 | + }); | |
607 | + | |
608 | + | |
609 | + | |
610 | + }, | |
611 | + | |
612 | + | |
613 | + | |
614 | + imageResize(imgWidth, imgHeight) { | |
615 | + var imageSize = {}; | |
616 | + var originalWidth = imgWidth;//图片原始宽 | |
617 | + var originalHeight = imgHeight;//图片原始高 | |
618 | + var originalScale = originalHeight / originalWidth;//图片高宽比 | |
619 | + // console.log('originalWidth: ' + originalWidth) | |
620 | + // console.log('originalHeight: ' + originalHeight) | |
621 | + | |
622 | + //获取屏幕宽高 | |
623 | + var winWidth = 480; | |
624 | + var winHeight = 380; | |
625 | + var winScale = winHeight / winWidth;//屏幕高宽比 | |
626 | + // console.log('windowWidth: ' + winWidth) | |
627 | + // console.log('windowHeight: ' + winHeight) | |
628 | + if (originalScale < winScale) {//图片高宽比小于屏幕高宽比 | |
629 | + //图片缩放后的宽为屏幕宽 | |
630 | + imageSize.imageWidth = winWidth; | |
631 | + imageSize.imageHeight = (winWidth * originalHeight) / originalWidth; | |
632 | + } else {//图片高宽比大于屏幕高宽比 | |
633 | + //图片缩放后的高为屏幕高 | |
634 | + imageSize.imageHeight = winHeight; | |
635 | + imageSize.imageWidth = (winHeight * originalWidth) / originalHeight; | |
636 | + } | |
637 | + console.log('缩放后的宽: ' + imageSize.imageWidth) | |
638 | + console.log('缩放后的高: ' + imageSize.imageHeight) | |
639 | + return imageSize; | |
640 | + }, | |
641 | + | |
642 | + | |
643 | + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | |
644 | + drawText: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { | |
645 | + var lineWidth = 0; | |
646 | + var lastSubStrIndex = 0; //每次开始截取的字符串的索引 | |
647 | + var han = 0; | |
648 | + for (let i = 0; i < str.length; i++) { | |
649 | + if (han == 2) return; | |
650 | + //lineWidth += ctx.measureText(str[i]).width; | |
651 | + lineWidth += ut.measureText(str[i], 21.3 * unit); | |
652 | + if (lineWidth > canvasWidth) { | |
653 | + han++; | |
654 | + | |
655 | + if (han == 2) { | |
656 | + ctx.textAlign = 'justify'; | |
657 | + ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分 | |
658 | + } else { | |
659 | + ctx.textAlign = 'justify'; | |
660 | + ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); | |
661 | + } | |
662 | + initHeight += 35; //22为字体的高度 | |
663 | + lineWidth = 0; | |
664 | + lastSubStrIndex = i; | |
665 | + titleHeight += 20; | |
666 | + } | |
667 | + if (i == str.length - 1) { //绘制剩余部分 | |
668 | + ctx.textAlign = 'justify'; | |
669 | + ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight); | |
670 | + } | |
671 | + } | |
672 | + }, | |
673 | + | |
309 | 674 | /** |
310 | 675 | * 页面相关事件处理函数--监听用户下拉动作 |
311 | 676 | */ |
... | ... | @@ -343,108 +708,256 @@ Page({ |
343 | 708 | // duration: 1000 |
344 | 709 | // }) |
345 | 710 | // } |
346 | - | |
347 | - // console.log('触底啦'); | |
348 | - this.scrollToLower('/api/weshop/wx/livelist/page', { | |
349 | - storedId: o.stoid, | |
350 | - live_status: 103 | |
351 | - }); | |
711 | + | |
712 | + // console.log('触底啦'); | |
713 | + this.scrollToLower('/api/weshop/wx/livelist/page', { | |
714 | + storedId: o.stoid, | |
715 | + live_status: 103 | |
716 | + }); | |
352 | 717 | }, |
353 | 718 | |
354 | 719 | /** |
355 | - * 用户点击右上角分享 | |
356 | - */ | |
357 | - onShareAppMessage: function () { getApp().globalData.no_clear=1; | |
720 | + * 用户点击右上角分享 | |
721 | + */ | |
722 | + onShareAppMessage: function (res) { | |
723 | + getApp().globalData.clear = 1; | |
724 | + this.setData({ | |
725 | + showActionSheet: 'false' | |
726 | + }) | |
727 | + var self = this; | |
358 | 728 | if (res.from === 'button') { |
359 | 729 | // 来自页面内转发按钮 |
360 | - // console.log(res.target) | |
730 | + console.log(res.target) | |
361 | 731 | } |
362 | 732 | return { |
363 | - title: '直播列表' | |
364 | - // path: '/page/user?id=123' | |
733 | + title: this.data.details.name, | |
734 | + success: function (res) { | |
735 | + console.log('res---->', res); | |
736 | + }, | |
737 | + complete: function (res) { | |
738 | + console.log('comple', res) | |
739 | + } | |
365 | 740 | } |
366 | 741 | }, |
367 | 742 | |
368 | - onShareTimeline: function (res) { | |
369 | - getApp().globalData.no_clear=1; | |
370 | - var user_id=getApp().globalData.user_id; | |
371 | - if(!user_id) user_id=0; | |
743 | + onShareTimeline: function (res) { | |
744 | + getApp().globalData.no_clear = 1; | |
745 | + var user_id = getApp().globalData.user_id; | |
746 | + if (!user_id) user_id = 0; | |
747 | + | |
748 | + return { | |
749 | + title: '直播列表', | |
750 | + query: 'first_leader=' + user_id | |
751 | + } | |
752 | + }, | |
753 | + | |
754 | + | |
755 | + /** | |
756 | + * 请求数据 | |
757 | + */ | |
758 | + getData: function (isInit, url, data) { | |
759 | + let p = app.request.promiseGet(url, { | |
760 | + data: data, | |
761 | + isShowLoading: true, | |
762 | + }) | |
763 | + .then(function (res) { | |
764 | + if (res.data.code == 0) { | |
765 | + | |
766 | + self.setData({ | |
767 | + isLoading: false | |
768 | + }); | |
769 | + | |
770 | + if (isInit) {// 第一次加载 | |
771 | + self.setData({ | |
772 | + list: res.data.data | |
773 | + }); | |
774 | + } else { | |
775 | + self.setData({ | |
776 | + 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
777 | + }); | |
778 | + }; | |
779 | + | |
780 | + if ((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
781 | + self.setData({ | |
782 | + noMore: true | |
783 | + }); | |
784 | + }; | |
785 | + | |
786 | + } else { | |
787 | + self.setData({ | |
788 | + 'list.pageData': [] | |
789 | + }); | |
790 | + }; | |
791 | + | |
792 | + }); | |
793 | + | |
794 | + return p; | |
795 | + }, | |
796 | + | |
372 | 797 | |
373 | - return { | |
374 | - title: '直播列表', | |
375 | - query: 'first_leader='+user_id | |
798 | + // 保存图片到手机 | |
799 | + onSaveToPhone() { | |
800 | + var self = this; | |
801 | + // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限 | |
802 | + this.getSetting().then((res) => { | |
803 | + // 判断用户是否授权了保存到相册的权限,如果没有发起授权 | |
804 | + if (!res.authSetting['scope.writePhotosAlbum']) { | |
805 | + this.authorize().then(() => { | |
806 | + // 同意授权后保存下载文件 | |
807 | + this.saveImageToPhotosAlbum(self.data.canvasToImgPath) | |
808 | + }) | |
809 | + } else { | |
810 | + // 如果已经授权,保存下载文件 | |
811 | + this.saveImageToPhotosAlbum(self.data.canvasToImgPath) | |
812 | + } | |
813 | + }) | |
814 | + }, | |
815 | + | |
816 | + //打开设置,引导用户授权 | |
817 | + onOpenSetting() { | |
818 | + wx.openSetting({ | |
819 | + success: (res) => { | |
820 | + // console.log(res.authSetting) | |
821 | + } | |
822 | + }) | |
823 | + }, | |
824 | + | |
825 | + // 获取用户已经授予了哪些权限 | |
826 | + getSetting() { | |
827 | + return new Promise((resolve, reject) => { | |
828 | + wx.getSetting({ | |
829 | + success: res => { | |
830 | + resolve(res) | |
831 | + } | |
832 | + }) | |
833 | + }) | |
834 | + }, | |
835 | + | |
836 | + // 发起首次授权请求 | |
837 | + authorize() { | |
838 | + // isFirst 用来记录是否为首次发起授权, | |
839 | + // 如果首次授权拒绝后,isFirst赋值为1 | |
840 | + let isFirst = wx.getStorageSync('isFirst') || 0; | |
841 | + return new Promise((resolve, reject) => { | |
842 | + wx.authorize({ | |
843 | + scope: 'scope.writePhotosAlbum', | |
844 | + // 同意授权 | |
845 | + success: () => { | |
846 | + resolve(); | |
847 | + }, | |
848 | + // 拒绝授权,这里是用户拒绝授权后的回调 | |
849 | + fail: res => { | |
850 | + if (isFirst === 0) { | |
851 | + wx.setStorageSync('isFirst', 1); | |
852 | + wx.showToast({ | |
853 | + title: '保存失败', | |
854 | + icon: 'none', | |
855 | + duration: 1000 | |
856 | + }) | |
857 | + } else { | |
858 | + this.showModal(); | |
859 | + } | |
860 | + console.log('拒绝授权'); | |
861 | + reject(); | |
862 | + } | |
863 | + }) | |
864 | + }) | |
865 | + }, | |
866 | + | |
867 | + //保存下载文件 | |
868 | + savedownloadFile(img) { | |
869 | + this.downLoadFile(img).then((res) => { | |
870 | + return this.saveImageToPhotosAlbum(res.tempFilePath) | |
871 | + }).then(() => { | |
872 | + // resolve() | |
873 | + }) | |
874 | + }, | |
875 | + | |
876 | + //单文件下载(下载文件资源到本地),客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径。 | |
877 | + downLoadFile(img) { | |
878 | + var self = this; | |
879 | + return new Promise((resolve, reject) => { | |
880 | + wx.showLoading({ | |
881 | + title: '保存中...', | |
882 | + mask: true, | |
883 | + }); | |
884 | + wx.downloadFile({ | |
885 | + url: img, | |
886 | + success: (res) => { | |
887 | + resolve(res); | |
888 | + } | |
889 | + }) | |
890 | + }) | |
891 | + }, | |
892 | + | |
893 | + // 保存图片到系统相册 | |
894 | + saveImageToPhotosAlbum(saveUrl) { | |
895 | + var self = this; | |
896 | + return new Promise((resolve, reject) => { | |
897 | + wx.saveImageToPhotosAlbum({ | |
898 | + filePath: saveUrl, | |
899 | + success: (res) => { | |
900 | + wx.showToast({ | |
901 | + title: '保存成功', | |
902 | + duration: 1000, | |
903 | + }); | |
904 | + self.setData({ | |
905 | + showPlaybill: 'true' | |
906 | + }); | |
907 | + resolve(); | |
908 | + }, | |
909 | + fail: () => { | |
910 | + wx.showToast({ | |
911 | + title: '保存失败', | |
912 | + duration: 1000, | |
913 | + }); | |
376 | 914 | } |
377 | - }, | |
378 | - | |
379 | - | |
380 | - /** | |
381 | - * 请求数据 | |
382 | - */ | |
383 | - getData: function(isInit, url, data) { | |
384 | - let p = app.request.promiseGet(url, { | |
385 | - data: data, | |
386 | - isShowLoading: true, | |
387 | - }) | |
388 | - .then(function(res) { | |
389 | - if(res.data.code == 0) { | |
390 | - | |
391 | - self.setData({ | |
392 | - isLoading: false | |
393 | - }); | |
394 | - | |
395 | - if(isInit) {// 第一次加载 | |
396 | - self.setData({ | |
397 | - list: res.data.data | |
398 | - }); | |
399 | - } else { | |
400 | - self.setData({ | |
401 | - 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
402 | - }); | |
403 | - }; | |
404 | - | |
405 | - if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
406 | - self.setData({ | |
407 | - noMore: true | |
408 | - }); | |
409 | - }; | |
410 | - | |
411 | - } else { | |
412 | - self.setData({ | |
413 | - 'list.pageData': [] | |
414 | - }); | |
415 | - }; | |
416 | - | |
417 | - }); | |
418 | - | |
419 | - return p; | |
420 | - }, | |
421 | - | |
422 | - | |
423 | - /** | |
424 | - * 上拉加载 | |
425 | - */ | |
426 | - scrollToLower(url, requestData) { | |
427 | - // 数据总量 | |
428 | - let total = this.data.list.total; | |
429 | - // 单页最大数据量 | |
430 | - let pageSize = this.data.list.pageSize; | |
431 | - // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
432 | - if((total != 0)&&(total <= pageSize)) { | |
433 | - this.setData({ | |
434 | - noMore: true | |
435 | - }); | |
436 | - }; | |
437 | - | |
438 | - if(!this.data.isLoading && !this.data.noMore) { | |
439 | - this.setData({ | |
440 | - isLoading: true, | |
441 | - pageNum: this.data.pageNum + 1 | |
442 | - }); | |
443 | - requestData.page = this.data.pageNum; | |
444 | - this.getData(false, url, requestData); | |
445 | - }; | |
446 | - }, | |
447 | - | |
448 | - | |
915 | + }) | |
916 | + }) | |
917 | + }, | |
918 | + | |
919 | + | |
920 | + // 弹出模态框提示用户是否要去设置页授权 | |
921 | + showModal() { | |
922 | + wx.showModal({ | |
923 | + title: '检测到您没有打开保存到相册的权限,是否前往设置打开?', | |
924 | + success: (res) => { | |
925 | + if (res.confirm) { | |
926 | + console.log('用户点击确定') | |
927 | + this.onOpenSetting() // 打开设置页面 | |
928 | + } else if (res.cancel) { | |
929 | + console.log('用户点击取消') | |
930 | + } | |
931 | + } | |
932 | + }) | |
933 | + }, | |
934 | + | |
935 | + | |
936 | + /** | |
937 | + * 上拉加载 | |
938 | + */ | |
939 | + scrollToLower(url, requestData) { | |
940 | + // 数据总量 | |
941 | + let total = this.data.list.total; | |
942 | + // 单页最大数据量 | |
943 | + let pageSize = this.data.list.pageSize; | |
944 | + // 如果数据总量不为0且小于或等于单页最大数据量,说明数据已全部加载,显示‘没有更多了’ | |
945 | + if ((total != 0) && (total <= pageSize)) { | |
946 | + this.setData({ | |
947 | + noMore: true | |
948 | + }); | |
949 | + }; | |
950 | + | |
951 | + if (!this.data.isLoading && !this.data.noMore) { | |
952 | + this.setData({ | |
953 | + isLoading: true, | |
954 | + pageNum: this.data.pageNum + 1 | |
955 | + }); | |
956 | + requestData.page = this.data.pageNum; | |
957 | + this.getData(false, url, requestData); | |
958 | + }; | |
959 | + }, | |
960 | + | |
961 | + | |
449 | 962 | |
450 | 963 | }) |
451 | 964 | \ No newline at end of file | ... | ... |
packageA/pages/liveStream/liveStream.wxml
1 | 1 | <!--pages/liveStream/liveStream.wxml--> |
2 | 2 | <wxs src="../../../utils/filter.wxs" module="filter"></wxs> |
3 | 3 | <view> |
4 | - <!-- 即将开始 --> | |
5 | - <block wx:if="{{livetoBegin.pageData.length > 0}}"> | |
4 | + <!-- 即将开始 --> | |
5 | + <!-- <block wx:if="{{livetoBegin.pageData.length > 0}}"> | |
6 | 6 | <view class="title">即将开始</view> |
7 | 7 | <view class="list"> |
8 | 8 | <block wx:for="{{livetoBegin.pageData}}" wx:key="item"> |
... | ... | @@ -22,34 +22,89 @@ |
22 | 22 | |
23 | 23 | </block> |
24 | 24 | </view> |
25 | - </block> | |
26 | - | |
25 | + </block> --> | |
27 | 26 | |
28 | - <!-- 直播中 --> | |
29 | - <block wx:if="{{living.pageData.length > 0}}"> | |
30 | - <view class="title">直播中</view> | |
31 | - <view class="list"> | |
32 | - <block wx:for="{{living.pageData}}" wx:key="item"> | |
33 | - <view class="list-item" catchtap="clickItem" data-id="{{item.id}}" data-live="ing"> | |
34 | - <view class="list-item-left"> | |
35 | - <image src="{{item.share_img}}" class="item-pic" mode="aspectFit"></image> | |
36 | - </view> | |
37 | - <view class="list-item-right"> | |
38 | - <view> | |
39 | - <view class="item-title">{{item.name}}</view> | |
40 | - <view class="item-time">{{filter.format_time(item.start_time, 2)}} 开始</view> | |
41 | - <view class="item-anchor">主播:{{item['anchor_name']}}</view> | |
42 | - </view> | |
43 | - <view class="item-btn" catchtap="clickLive" data-roomid="{{item.roomid}}">观看直播</view> | |
44 | - </view> | |
45 | - </view> | |
46 | - </block> | |
47 | - </view> | |
48 | - </block> | |
49 | - | |
50 | 27 | |
51 | - <!-- 精彩回放 --> | |
52 | - <block wx:if="{{liveOver.pageData.length > 0}}"> | |
28 | + | |
29 | + <block wx:if="{{ad_data}}"> | |
30 | + <view style="z-index: 1;"> | |
31 | + <swiper class="swiper" circular="true" autoplay="true" indicator-dots="true" interval="2500" style="height:{{max_sw_height}}rpx"> | |
32 | + <block wx:for="{{ad_data}}"> | |
33 | + | |
34 | + <navigator url="{{item.ad_weapplink}}" class="s1_gk_a1" wx:if="{{g_filter.has_char(item.ad_weapplink,'plugin')>=0}}"> | |
35 | + <swiper-item> | |
36 | + <image src="{{item.ad_code}}" style="width: 100%;" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" lazy-load="true" /> | |
37 | + </swiper-item> | |
38 | + </navigator> | |
39 | + | |
40 | + <view data-url="{{item.ad_weapplink}}" class="s1_gk_a1" bindtap="go_url" wx:else> | |
41 | + <swiper-item> | |
42 | + <image src="{{item.ad_code}}" style="width: 100%;" bindload="imageLoad" data-index="{{index}}" class="slide-image" mode="widthFix" lazy-load="true" /> | |
43 | + </swiper-item> | |
44 | + </view> | |
45 | + | |
46 | + </block> | |
47 | + </swiper> | |
48 | + </view> | |
49 | + | |
50 | + | |
51 | + </block> | |
52 | + <!-- <block wx:else> | |
53 | + <image class="xc-top-img" src="{{url}}/miniapp/images/seckill_top_img.jpg"></image> | |
54 | + </block> --> | |
55 | + | |
56 | + <view style="width: 100%;height: 100rpx;background-color: #eee;border-radius: 25rpx;position: absolute;top: 290rpx;"> | |
57 | + | |
58 | + </view> | |
59 | + | |
60 | + <!-- 直播中 --> | |
61 | + <block wx:if="{{living.pageData.length > 0}}"> | |
62 | + <!-- <view class="title">直播中</view> --> | |
63 | + <view class="list" style="margin-top: 23rpx;"> | |
64 | + <block wx:for="{{living.pageData}}" wx:key="item"> | |
65 | + <view class="list-item" data-id="{{item.id}}" data-live="ing" style="display: block;margin-top: 23rpx;margin: 20rpx 4%; border-radius: 25rpx;;background-color: white;"> | |
66 | + <view class="list-item-left" catchtap="clickItem" data-id="{{item.id}}" data-live="{{item.live_status}}"> | |
67 | + <view class="item-btn" catchtap="clickLive" data-roomid="{{item.roomid}}" wx:if="{{item.live_status==101}}">正在直播</view> | |
68 | + <view class="item-btnjjkb" catchtap="clickLive" data-roomid="{{item.roomid}}" wx:if="{{item.live_status==102}}">即将开播</view> | |
69 | + <view class="item-btnhf" catchtap="clickLive" data-roomid="{{item.roomid}}" wx:if="{{item.live_status==103}}">回放</view> | |
70 | + <view class="item-btnhf" catchtap="clickLive" data-roomid="{{item.roomid}}" wx:if="{{item.live_status==107}}">已失效</view> | |
71 | + <view class="item-btnld" catchtap="clickLive" data-roomid="{{item.roomid}}"></view> | |
72 | + <view class="item-btnxcx xcx-image" catchtap="clickLive" data-roomid="{{item.roomid}}"></view> | |
73 | + <view class="item-btnldt" catchtap="clickLive" data-roomid="{{item.roomid}}"> | |
74 | + 小程序直播</view> | |
75 | + <image src="{{item.share_img}}" class="item-pic" mode="aspectFill" style="width: 690rpx;height: 360rpx;"></image> | |
76 | + </view> | |
77 | + | |
78 | + <view class="list-item-right"> | |
79 | + <view style="display: flex;"> | |
80 | + <view style="display: block;width: 70%;" catchtap="clickItem" data-id="{{item.id}}" data-live="{{item.live_status}}"> | |
81 | + <view class="item-title">{{item.name}}</view> | |
82 | + <view class="item-anchor"> | |
83 | + <image src="../../images/bar/user_on.png" mode="" style="width: 25rpx;height: 25rpx;"/> | |
84 | + | |
85 | + {{item['anchor_name']}}</view> | |
86 | + </view> | |
87 | + <view style="width: 30%;height: 90rpx;align-items: center;justify-items: center;"> | |
88 | + <view bindtap="clickShare" data-sharimg="{{item.share_img}}" data-shartitle="{{item.name}}" data-anchorname="{{item['anchor_name']}}" class="display: flex;" style="width: 70%;border-radius: 25rpx;border: 1rpx solid #fc6247;height: 46rpx;margin-top: 25rpx;margin-left: 30rpx;"> | |
89 | + <view class="share-image"></view> | |
90 | + <view class="fs26" style="color: #fc6247;margin-left: 10rpx;line-height: 46rpx;"> 分享 </view> | |
91 | + </view> | |
92 | + </view> | |
93 | + </view> | |
94 | + | |
95 | + </view> | |
96 | + </view> | |
97 | + </block> | |
98 | + | |
99 | + <view style="width: 100%;height: 30rpx;"> | |
100 | + | |
101 | + </view> | |
102 | + </view> | |
103 | + </block> | |
104 | + | |
105 | + | |
106 | + <!-- 精彩回放 --> | |
107 | + <!-- <block wx:if="{{liveOver.pageData.length > 0}}"> | |
53 | 108 | <view class="title">精彩回放</view> |
54 | 109 | <view class="list"> |
55 | 110 | <block wx:for="{{liveOver.pageData}}" wx:key="item"> |
... | ... | @@ -68,11 +123,45 @@ |
68 | 123 | </view> |
69 | 124 | </block> |
70 | 125 | </view> |
71 | - </block> | |
72 | - | |
73 | - | |
74 | - <nodata nodataContainer="t-c" wx:if="{{livetoBegin.pageData.length == 0 && liveing.pageData.length == 0 && liveOver.pageData.length == 0}}"></nodata> | |
75 | - <view class="no-more" hidden="{{!noMore}}" wx:if="{{living.pageData.length != 0 && livetoBegin.pageData.length == 0 && liveO.pageData.length == 0}}">- 没有更多了 -</view> | |
76 | - <view class="no-more" hidden="{{!noMore}}" wx:if="{{living.pageData.length == 0 && livetoBegin.pageData.length != 0 && liveO.pageData.length == 0}}">- 没有更多了 -</view> | |
77 | - <view class="no-more" hidden="{{!noMore}}" wx:if="{{living.pageData.length == 0 && livetoBegin.pageData.length == 0 && liveO.pageData.length != 0}}">- 没有更多了 -</view> | |
78 | -</view> | |
79 | 126 | \ No newline at end of file |
127 | + </block> --> | |
128 | + | |
129 | + | |
130 | + | |
131 | + <!-- actionSheet --> | |
132 | + <view class="{{showActionSheet ? 'share-actionSheet':'share-actionSheet active'}}" hidden="{{showActionSheet}}"> | |
133 | + <view class="share-actionSheet-title">分享</view> | |
134 | + <view class="share-actionSheet-list"> | |
135 | + <view class="share-actionSheet-item" hover-class="active"> | |
136 | + <button open-type="share"> | |
137 | + <image src="/packageA/images/liveStreamDetails/friend.jpg" class="share-actionSheet-pic"></image> | |
138 | + <text class="share-actionSheet-desc">发送给朋友</text> | |
139 | + </button> | |
140 | + </view> | |
141 | + <view class="share-actionSheet-item" hover-class="active" bindtap="createPlaybill"> | |
142 | + <image src="/packageA/images/liveStreamDetails/circle.jpg" class="share-actionSheet-pic"></image> | |
143 | + <text class="share-actionSheet-desc">生成分享海报</text> | |
144 | + </view> | |
145 | + </view> | |
146 | + <view class="share-actionSheet-cancle" bindtap="hiddenActionSheet">取消</view> | |
147 | + </view> | |
148 | + | |
149 | + <!-- 生成海报 --> | |
150 | + <view class="{{showPlaybill ? 'playbill':'playbill active'}}" hidden="{{showPlaybill}}"> | |
151 | + <image src="{{canvasToImgPath}}" class="playbill-pic" mode="widthFix" bindtap="closeWin"></image> | |
152 | + <!-- style="width:{{windowWidth}}px;height:{{windowHeight}}px;" --> | |
153 | + <view class="playbill-save" bindtap="onSaveToPhone">保存至相册</view> | |
154 | + </view> | |
155 | + | |
156 | + <!-- <canvas canvas-id="myCanvas" class="" catchtouchmove="true" style="width:{{windowWidth}}px;height:{{windowHeight}}px;"></canvas> --> | |
157 | + | |
158 | + <!-- mask --> | |
159 | + <!-- 这里mask必须强制放在actionsheet和playbill的后面 --> | |
160 | + <view class="mask" bindtap="hiddenActionSheet" catchtouchmove="true"></view> | |
161 | + | |
162 | + | |
163 | + <nodata nodataContainer="t-c" wx:if="{{livetoBegin.pageData.length == 0 && liveing.pageData.length == 0 && liveOver.pageData.length == 0}}"></nodata> | |
164 | + <view class="no-more" hidden="{{!noMore}}" wx:if="{{living.pageData.length != 0 && livetoBegin.pageData.length == 0 && liveO.pageData.length == 0}}">- 没有更多了 -</view> | |
165 | + <view class="no-more" hidden="{{!noMore}}" wx:if="{{living.pageData.length == 0 && livetoBegin.pageData.length != 0 && liveO.pageData.length == 0}}">- 没有更多了 -</view> | |
166 | + <view class="no-more" hidden="{{!noMore}}" wx:if="{{living.pageData.length == 0 && livetoBegin.pageData.length == 0 && liveO.pageData.length != 0}}">- 没有更多了 -</view> | |
167 | +</view> | |
168 | +<canvas canvas-id="myCanvas" catchtouchmove="true" style="width:480px;height:738px;position:absolute;left:-9999px;"></canvas> | |
80 | 169 | \ No newline at end of file | ... | ... |
packageA/pages/liveStream/liveStream.wxss
1 | 1 | /* pages/liveStream/liveStream.wxss */ |
2 | +page{ | |
3 | + background-color: #eee; | |
4 | +} | |
2 | 5 | .title { |
3 | 6 | font-size: 30rpx; |
4 | 7 | padding: 50rpx 32rpx; |
5 | 8 | } |
6 | 9 | .list-item { |
7 | - padding: 0 32rpx 30rpx; | |
8 | 10 | display: flex; |
9 | 11 | } |
10 | 12 | .list-item-left { |
11 | 13 | position: relative; |
12 | - width: 340rpx; | |
13 | - height: 220rpx; | |
14 | 14 | flex-shrink: 0; |
15 | 15 | } |
16 | + | |
17 | +.xcx-image { | |
18 | + width: 20rpx; | |
19 | + height: 20rpx; | |
20 | + margin-left: 18rpx; | |
21 | + margin-top: 8rpx; | |
22 | + background-size:contain; | |
23 | + background-repeat: no-repeat; | |
24 | + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkAgMAAAANjH3HAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAAAlQTFRFPcRKAAAA////QjSLrQAAAAN0Uk5T/wD/aewfvgAAATZJREFUeJzt1MFxBSEIANDfRErTAyXQj+nAg1T58wVUEDObnfxLJl52xrcKKvr4SIf2OMG/vF0yUY2FvlqJBF9CgeQOPJ8VYGm7kLTiJatUL3AUVCEvdEGKlTylXhXgPlmrl8ZDAymciBOUbcZImo69Knoy+YakSMr3Es52W8L1lLniSPYdFQlOQQTsmdYp9rSRhoCpHeh/cQ8aoUVMJUo2XbIR9NJU5LcusN6FvEkRgU2SCNISRwqVRWt8ZKB3e+Sp6+lDhrQ096CqjGz4k+e7M2KOqlqlhoLLKe+STtJuSP1V+XEGIJLD3TlLSXqhVnn1fKZll4xIwQcij5cTfurGmXshLSAjeJTxtK/LcZKcjNe4eUlRmHmzfBgWCMLMG+zDiOA+mci2NVPQR5nvjkt5kb39NXkCPTYQh7BBvFgAAAAASUVORK5CYII= | |
25 | + | |
26 | + ) ; | |
27 | +} | |
28 | + | |
29 | +.share-image { | |
30 | + width: 30rpx; | |
31 | + height: 30rpx; | |
32 | + margin-left: 18rpx; | |
33 | + margin-top: 8rpx; | |
34 | + background-size:contain; | |
35 | + background-repeat: no-repeat; | |
36 | + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkBAMAAACCzIhnAAAAAXNSR0IB2cksfwAAAAlwSFlzAAAuIwAALiMBeKU/dgAAACFQTFRFAAAA/04w/04w/04w/04w/04w/0ww/0Aw/0AA/00w/04wncLKIgAAAAt0Uk5TAP8/LxsOQBAE4ZBG21G1AAABIUlEQVR4nO3W2w3CMAwF0AYEEnzRDRiBEViFERiBzUEg+vK913ZFEUjxRyWanDqP4rRpatT4YpR2EIdlyAg8YhEyFQEyFT4xSfzp55M0qh++X4QoeJRqLKRJTZg8Tk14LrGtclkpYVN5bzK4jQndW7pg/A1iRLxChJQ0ka92hIBGQ/S/ARGyH4rgKShSZA5BeAWwrZ5gRFWZjxBP2A5uEkKUwESXWEPccZke/rj+gRw74pxJPTl1RIsBOXe/TacyStyTTZ6sn9cLIJPB9mT1vF4JOSDyilue7PJknydbsJMOQV8HHgFRSSW/TwKlzvSZR+LlMUpMZZ9J/OM0R+yp7n2yoHaHtGAYbSRQ5owIpcETzIhAGroqGeEYvfwJUGOZuAN2OElDEXSpWQAAAABJRU5ErkJggg== | |
37 | + ) ; | |
38 | +} | |
16 | 39 | .list-item-right { |
17 | 40 | display: flex; |
18 | 41 | flex-direction: column; |
... | ... | @@ -21,11 +44,54 @@ |
21 | 44 | /* position: relative; |
22 | 45 | padding-bottom: 70rpx; */ |
23 | 46 | } |
47 | + | |
48 | +.share-actionSheet { | |
49 | + background-color: white; | |
50 | + padding-top: 45rpx; | |
51 | + position: fixed; | |
52 | + width: 100%; | |
53 | + bottom: 0; | |
54 | + z-index: 2; | |
55 | +} | |
56 | +.share-actionSheet-title { | |
57 | + font-size: 38rpx; | |
58 | + | |
59 | +} | |
60 | +.share-actionSheet-list { | |
61 | + display: flex; | |
62 | + justify-content: space-around; | |
63 | + padding-bottom: 30rpx; | |
64 | +} | |
65 | +.share-actionSheet-item { | |
66 | + text-align: center; | |
67 | + padding: 20rpx; | |
68 | +} | |
69 | +.share-actionSheet-pic { | |
70 | + display: block; | |
71 | + width: 118rpx; | |
72 | + height: 118rpx; | |
73 | + border-radius: 50%; | |
74 | + margin: 0 auto; | |
75 | +} | |
76 | +.share-actionSheet-desc { | |
77 | + font-size: 28rpx; | |
78 | +} | |
79 | + | |
80 | +.share-actionSheet-title, | |
81 | +.share-actionSheet-cancle { | |
82 | + text-align: center; | |
83 | +} | |
84 | + | |
85 | +.share-actionSheet-cancle { | |
86 | + padding: 30rpx 0; | |
87 | + border-top: 2rpx solid #CBCBCB; | |
88 | +} | |
24 | 89 | .item-pic { |
25 | 90 | /* width: 400rpx; */ |
26 | 91 | width: 100%; |
27 | 92 | height: 100%; |
28 | 93 | background-color: #eee; |
94 | + border-radius: 15rpx; | |
29 | 95 | } |
30 | 96 | .item-desc { |
31 | 97 | position: absolute; |
... | ... | @@ -55,7 +121,7 @@ |
55 | 121 | |
56 | 122 | display: -webkit-box; |
57 | 123 | -webkit-box-orient: vertical; |
58 | - -webkit-line-clamp: 2; | |
124 | + -webkit-line-clamp: 1; | |
59 | 125 | overflow: hidden; |
60 | 126 | } |
61 | 127 | .item-time { |
... | ... | @@ -66,6 +132,12 @@ |
66 | 132 | .item-anchor { |
67 | 133 | color: #999; |
68 | 134 | font-size: 24rpx; |
135 | + text-align: justify; | |
136 | + | |
137 | + display: -webkit-box; | |
138 | + -webkit-box-orient: vertical; | |
139 | + -webkit-line-clamp: 1; | |
140 | + overflow: hidden; | |
69 | 141 | } |
70 | 142 | |
71 | 143 | .item-btn { |
... | ... | @@ -76,7 +148,81 @@ |
76 | 148 | color: #fff; |
77 | 149 | font-size: 24rpx; |
78 | 150 | text-align: center; |
151 | + position: absolute;top: 15rpx;left: 7px; | |
152 | + border-radius: 15rpx; | |
153 | +} | |
154 | +.item-btnhf { | |
155 | + width: 172rpx; | |
156 | + height: 56rpx; | |
157 | + line-height: 56rpx; | |
158 | + background-color: #acacac; | |
159 | + color: #fff; | |
160 | + font-size: 24rpx; | |
161 | + text-align: center; | |
162 | + position: absolute;top: 15rpx;left: 7px; | |
163 | + border-radius: 15rpx; | |
79 | 164 | } |
165 | +.item-btnjjkb { | |
166 | + width: 172rpx; | |
167 | + height: 56rpx; | |
168 | + line-height: 56rpx; | |
169 | + background-color: rgb(250, 182, 36); | |
170 | + color: #fff; | |
171 | + font-size: 24rpx; | |
172 | + text-align: center; | |
173 | + position: absolute;top: 15rpx;left: 7px; | |
174 | + border-radius: 15rpx; | |
175 | +} | |
176 | + | |
177 | + | |
178 | +.item-btnld { | |
179 | + width: 202rpx; | |
180 | + height: 56rpx; | |
181 | + line-height: 56rpx; | |
182 | + background-color: #c9c9c9; | |
183 | + font-size: 24rpx; | |
184 | + text-align: center; | |
185 | + position: absolute; | |
186 | + bottom: 12rpx; | |
187 | + border-top-right-radius: 15rpx; | |
188 | + overflow: hidden; | |
189 | + opacity: 0.3; | |
190 | +} | |
191 | +.item-btnldt { | |
192 | + width: 202rpx; | |
193 | + height: 56rpx; | |
194 | + line-height: 56rpx; | |
195 | + color: white; | |
196 | + font-size: 24rpx; | |
197 | + text-align: center; | |
198 | + position: absolute; | |
199 | + bottom: 12rpx; | |
200 | + overflow: hidden; | |
201 | + margin-left: 20rpx; | |
202 | +} | |
203 | + | |
204 | +.item-btnxcx { | |
205 | + width: 32rpx; | |
206 | + height: 32rpx; | |
207 | + line-height: 56rpx; | |
208 | + color: rgb(233, 233, 233); | |
209 | + font-size: 24rpx; | |
210 | + left: 0; | |
211 | + bottom: 22rpx; | |
212 | + position: absolute; | |
213 | + overflow: hidden; | |
214 | + | |
215 | +} | |
216 | + | |
217 | +.content { | |
218 | + background-color: white; | |
219 | + padding-bottom: 168rpx; | |
220 | + position: relative; | |
221 | +} | |
222 | +button::after { | |
223 | + border: none; | |
224 | +} | |
225 | + | |
80 | 226 | subscribe { |
81 | 227 | position: relative; |
82 | 228 | } |
... | ... | @@ -108,4 +254,53 @@ subscribe { |
108 | 254 | line-height: 3; |
109 | 255 | color: #909090; |
110 | 256 | text-align: center; |
111 | -} | |
112 | 257 | \ No newline at end of file |
258 | +} | |
259 | + | |
260 | +.share-actionSheet.active ~ .mask, | |
261 | + | |
262 | +.mask { | |
263 | + display: none; | |
264 | + background-color: rgba(0,0,0,.7); | |
265 | + position: fixed; | |
266 | + top: 0; | |
267 | + bottom: 0; | |
268 | + left: 0; | |
269 | + right: 0; | |
270 | +} | |
271 | +.playbill { | |
272 | + position: fixed; | |
273 | + left: 50%; | |
274 | + top: 50%; | |
275 | + transform: translate(-50%, -50%); | |
276 | + z-index: 9999; | |
277 | + background: none; | |
278 | +} | |
279 | +.share-actionSheet.active ~ .mask, | |
280 | +.playbill.active ~ .mask { | |
281 | + display: block; | |
282 | +} | |
283 | +.playbill-pic { | |
284 | + display: block; | |
285 | + width: 560rpx; | |
286 | + height: auto; | |
287 | + margin: 0 auto 26rpx; | |
288 | + border-radius: 10rpx; | |
289 | + overflow: hidden; | |
290 | +} | |
291 | + | |
292 | +.playbill-save { | |
293 | + width: 560rpx; | |
294 | + height: 100rpx; | |
295 | + line-height: 100rpx; | |
296 | + background-color: #f23030; | |
297 | + color: #fff; | |
298 | + font-size: 36rpx; | |
299 | + text-align: center; | |
300 | + margin: 0 auto; | |
301 | +} | |
302 | +.playbill-save image { | |
303 | + width: 44rpx; | |
304 | + height: 36rpx; | |
305 | + margin-right: 23rpx; | |
306 | +} | |
307 | + | ... | ... |
packageA/pages/liveStreamDetails/liveStreamDetails.js
... | ... | @@ -157,7 +157,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un |
157 | 157 | // }); |
158 | 158 | |
159 | 159 | |
160 | - if(!this.data.coverImg) { | |
160 | + | |
161 | 161 | |
162 | 162 | // 请求主图 |
163 | 163 | await that.getImageInfo(that.data.details['share_img']).then(res => { |
... | ... | @@ -170,18 +170,49 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un |
170 | 170 | }); |
171 | 171 | // console.log('主图加载成功~', that.data.coverImgSize); |
172 | 172 | }); |
173 | + | |
174 | + | |
175 | + var path2 = getApp().globalData.userInfo.head_pic; | |
176 | + if (path2 == "") { | |
177 | + path2 = "../../../images/share/hui_hear_pic.png"; | |
178 | + } else { | |
179 | + getApp().request.promiseGet("/api/weshop/marketing/help/help/imgbase64/get", { | |
180 | + data: { | |
181 | + imgurl: path2 | |
182 | + } | |
183 | + }).then(res => { | |
184 | + if (res.data.code == 0) { | |
185 | + console.log(9999) | |
186 | + | |
187 | + var imgSrc = res.data.data;//base64编码 | |
188 | + var save = wx.getFileSystemManager(); | |
189 | + var number = Math.random(); | |
190 | + save.writeFile({ | |
191 | + filePath: wx.env.USER_DATA_PATH + '/pic' + number + '.png', | |
192 | + data: imgSrc, | |
193 | + encoding: 'base64', | |
194 | + success: res => { | |
195 | + that.setData({ | |
196 | + avatarUrl: wx.env.USER_DATA_PATH + '/pic' + number + '.png' | |
197 | + }); | |
198 | + console.log(wx.env.USER_DATA_PATH + '/pic' + number + '.png') | |
199 | + }, fail: err => { | |
200 | + console.log(err) | |
201 | + } | |
202 | + }) | |
203 | + } | |
204 | + }) | |
173 | 205 | } |
174 | - | |
175 | - if(!this.data.avatarUrl) { | |
206 | + // if(!this.data.avatarUrl) { | |
176 | 207 | |
177 | 208 | // 请求头像 |
178 | - await that.getImageInfo(app.globalData.userInfo['head_pic']).then(res => { | |
179 | - that.setData({ | |
180 | - avatarUrl: res.path | |
181 | - }); | |
182 | - console.log('头像加载成功~') | |
183 | - }); | |
184 | - } | |
209 | + // await that.getImageInfo(app.globalData.userInfo['head_pic']).then(res => { | |
210 | + // that.setData({ | |
211 | + // avatarUrl: res.path | |
212 | + // }); | |
213 | + // console.log('头像加载成功~') | |
214 | + // }); | |
215 | + // } | |
185 | 216 | |
186 | 217 | // 请求二维码 |
187 | 218 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
... | ... | @@ -530,7 +561,7 @@ drawText: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, un |
530 | 561 | switch(options.live) { |
531 | 562 | case 'toBegin': { |
532 | 563 | this.setData({ |
533 | - btnText: '订阅' | |
564 | + btnText: '即将开播' | |
534 | 565 | }) |
535 | 566 | break; |
536 | 567 | } | ... | ... |
packageC/pages/group_list/group_list.js
... | ... | @@ -14,10 +14,12 @@ Page({ |
14 | 14 | // goodlist: null, |
15 | 15 | |
16 | 16 | isLogin: false, |
17 | - list: null, | |
17 | + list: [], | |
18 | 18 | isLoading: false, // 检测是否已经发送请求,防止重复发送请求 |
19 | 19 | noMore: false, // 检测是否有更多数据,true为没有更多数据,false为还有数据 |
20 | 20 | pageNum: 1, // 当前页数 |
21 | + | |
22 | + time_arr:[] | |
21 | 23 | }, |
22 | 24 | |
23 | 25 | /** |
... | ... | @@ -63,7 +65,7 @@ Page({ |
63 | 65 | }; |
64 | 66 | |
65 | 67 | this.setData({ |
66 | - list: null, | |
68 | + list: [], | |
67 | 69 | pageNum: 1, |
68 | 70 | noMore: false, |
69 | 71 | }); |
... | ... | @@ -110,7 +112,7 @@ Page({ |
110 | 112 | |
111 | 113 | |
112 | 114 | this.setData({ |
113 | - list: null, | |
115 | + list: [], | |
114 | 116 | type: typeValue, |
115 | 117 | }); |
116 | 118 | |
... | ... | @@ -141,6 +143,9 @@ Page({ |
141 | 143 | * 页面上拉触底事件的处理函数 |
142 | 144 | */ |
143 | 145 | onReachBottom: function () { |
146 | + | |
147 | + if(this.data.isLoading) return false; | |
148 | + | |
144 | 149 | let data = this.data.currentData; |
145 | 150 | this.scrollToLower('/api/weshop/goods/groupBuy/page', data); |
146 | 151 | }, |
... | ... | @@ -148,47 +153,48 @@ Page({ |
148 | 153 | /** |
149 | 154 | * 用户点击右上角分享 |
150 | 155 | */ |
151 | - onShareAppMessage: function () { getApp().globalData.no_clear=1 | |
152 | - | |
153 | - }, | |
156 | + onShareAppMessage: function () { getApp().globalData.no_clear=1; }, | |
154 | 157 | |
155 | 158 | |
156 | 159 | /** |
157 | 160 | * 请求数据 |
158 | 161 | */ |
159 | 162 | getData: function(isInit, url, data) { |
163 | + | |
164 | + wx.showLoading(); | |
165 | + | |
160 | 166 | let p = app.request.promiseGet(url, { |
161 | 167 | data: data, |
162 | - isShowLoading: true, | |
168 | + isShowLoading: false, | |
163 | 169 | }) |
164 | 170 | .then(function(res) { |
165 | - if(res.data.code == 0) { | |
166 | - | |
171 | + | |
172 | + | |
173 | + | |
174 | + if(ut.ajax_ok(res)) { | |
175 | + | |
167 | 176 | self.setData({ |
168 | - isLoading: false | |
169 | - }); | |
177 | + ['list['+(self.data.pageNum-1)+']']:res.data.data.pageData | |
178 | + }) | |
170 | 179 | |
171 | - if(isInit) {// 第一次加载 | |
172 | - self.setData({ | |
173 | - list: res.data.data | |
174 | - }); | |
175 | - } else { | |
176 | - self.setData({ | |
177 | - 'list.pageData': self.data.list.pageData.concat(res.data.data.pageData) | |
178 | - }); | |
179 | - }; | |
180 | - | |
181 | - if((res.data.data.pageData.length == 0) || (res.data.data.pageSize * res.data.data.page >= res.data.data.total)) { | |
180 | + if(res.data.data.pageSize * res.data.data.page >= res.data.data.total){ | |
182 | 181 | self.setData({ |
183 | 182 | noMore: true |
184 | 183 | }); |
185 | 184 | }; |
185 | + | |
186 | + | |
186 | 187 | |
187 | 188 | } else { |
188 | - self.setData({ | |
189 | - 'list.pageData': [] | |
190 | - }); | |
189 | + self.setData({ noMore: true }); | |
191 | 190 | }; |
191 | + | |
192 | + self.setData({ | |
193 | + isLoading: false, | |
194 | + is_get:1 | |
195 | + }); | |
196 | + | |
197 | + wx.hideLoading(); | |
192 | 198 | |
193 | 199 | }); |
194 | 200 | |
... | ... | @@ -218,6 +224,7 @@ Page({ |
218 | 224 | }); |
219 | 225 | requestData.page = this.data.pageNum; |
220 | 226 | this.getData(false, url, requestData); |
227 | + | |
221 | 228 | }; |
222 | 229 | }, |
223 | 230 | |
... | ... | @@ -229,38 +236,64 @@ Page({ |
229 | 236 | |
230 | 237 | |
231 | 238 | //----倒计时函数----- |
232 | - countDown() { | |
233 | - if(!this.data.is_timer) return false; | |
234 | - var th=this; | |
235 | - // 获取当前时间,同时得到活动结束时间数组 | |
236 | - let newTime = ut.gettimestamp(); | |
237 | - var endTimeList = this.data.list.pageData; | |
238 | - if(endTimeList == null) return null; | |
239 | - // 对结束时间进行处理渲染到页面 | |
240 | - for(var i = 0; i < endTimeList.length; i++) { | |
241 | - var o = endTimeList[i]; | |
242 | - var endTime = this.data.type == 1?o.end_time:o.start_time; | |
243 | - // if(th.data.type==0) endTime = o.start_time; | |
244 | - let obj = null; | |
245 | - // 如果活动未结束,对时间进行处理 | |
246 | - if (endTime - newTime > 0) { | |
247 | - let time = (endTime - newTime); | |
248 | - // 获取天、时、分、秒 | |
249 | - let day = parseInt(time / (60 * 60 * 24)); | |
250 | - let hou = parseInt(time % (60 * 60 * 24) / 3600); | |
251 | - let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
252 | - let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
253 | - obj = { | |
254 | - day: this.timeFormat(day), hou: this.timeFormat(hou), min: this.timeFormat(min), sec: this.timeFormat(sec), hide: 1 | |
255 | - } | |
256 | - } else { | |
257 | - //活动已结束,全部设置为'00' | |
258 | - obj = { day: '00', hou: '00', min: '00', sec: '00' } | |
259 | - } | |
260 | - var txt ="goodlist["+i+"].djs"; | |
261 | - th.setData({ [txt]: obj}); | |
262 | - } | |
263 | - }, | |
239 | + countDown() { | |
240 | + | |
241 | + if (!this.data.is_timer) return false; | |
242 | + var th = this; | |
243 | + // 获取当前时间,同时得到活动结束时间数组 | |
244 | + let newTime = ut.gettimestamp(); | |
245 | + | |
246 | + | |
247 | + var time_arr=[]; | |
248 | + | |
249 | + for (let j = 0; j < this.data.list.length; j++) { | |
250 | + var endTimeList = this.data.list[j]; | |
251 | + if (endTimeList == null) return null; | |
252 | + | |
253 | + var arr_new=[]; | |
254 | + | |
255 | + // 对结束时间进行处理渲染到页面 | |
256 | + for (var i = 0; i < endTimeList.length; i++) { | |
257 | + | |
258 | + var o = endTimeList[i]; | |
259 | + var endTime = this.data.type == 1 ? o.end_time : o.start_time; | |
260 | + // if(th.data.type==0) endTime = o.start_time; | |
261 | + let obj = null; | |
262 | + // 如果活动未结束,对时间进行处理 | |
263 | + if (endTime - newTime > 0) { | |
264 | + let time = (endTime - newTime); | |
265 | + // 获取天、时、分、秒 | |
266 | + let day = parseInt(time / (60 * 60 * 24)); | |
267 | + let hou = parseInt(time % (60 * 60 * 24) / 3600); | |
268 | + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); | |
269 | + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); | |
270 | + obj = { | |
271 | + day: this.timeFormat(day), | |
272 | + hou: this.timeFormat(hou), | |
273 | + min: this.timeFormat(min), | |
274 | + sec: this.timeFormat(sec), | |
275 | + hide: 1 | |
276 | + } | |
277 | + } else { | |
278 | + //活动已结束,全部设置为'00' | |
279 | + obj = {day: '00', hou: '00', min: '00', sec: '00'} | |
280 | + } | |
281 | + //var txt = "goodlist[" + i + "].djs"; | |
282 | + //th.setData({[txt]: obj}); | |
283 | + | |
284 | + var e={djs:obj}; | |
285 | + arr_new.push(e); | |
286 | + | |
287 | + } | |
288 | + | |
289 | + time_arr.push(arr_new); | |
290 | + | |
291 | + | |
292 | + } | |
293 | + | |
294 | + this.setData({time_arr:time_arr}); | |
295 | + | |
296 | + }, | |
264 | 297 | |
265 | 298 | |
266 | 299 | ... | ... |
packageC/pages/group_list/group_list.wxml
1 | 1 | <view class="list"> |
2 | - <block wx:for="{{list.pageData}}"> | |
3 | - <view class="list-item" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_id={{item.id}}&prom_type=2"> | |
2 | + | |
3 | + <!-- --> | |
4 | + <block wx:for="{{list}}" wx:for-item="p_item" wx:for-index="p_idx"> | |
5 | + | |
6 | + <block wx:for="{{p_item}}"> | |
7 | + <view class="list-item" bindtap="goto" data-url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&prom_id={{item.id}}&prom_type=2"> | |
4 | 8 | <view class="img-container"> |
5 | 9 | <image class="img-block" src="{{imghost + item.original_img}}" data-val="{{item.original_img}}" |
6 | - data-errorimg="list.pageData[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image> | |
10 | + data-errorimg="list[{{p_idx}}][{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image> | |
7 | 11 | </view> |
8 | 12 | <view class="mgl20 flex fdc f1 jc_sb"> |
9 | 13 | <view> |
... | ... | @@ -24,7 +28,9 @@ |
24 | 28 | |
25 | 29 | <view>已售<block wx:if="{{type == 1}}">{{item.buy_num+item.virtual_num}}</block><block wx:else>0</block>件</view> |
26 | 30 | |
27 | - <view class=""><text class="iconfont icon-shizhong fs24"></text>{{goodlist[index].djs.day}}天{{goodlist[index].djs.hou}}时{{goodlist[index].djs.min}}分{{goodlist[index].djs.sec}}秒</view> | |
31 | + <view class=""><text class="iconfont icon-shizhong fs24"></text> | |
32 | + {{time_arr[p_idx][index].djs.day}}天{{time_arr[p_idx][index].djs.hou}}时{{time_arr[p_idx][index].djs.min}}分{{time_arr[p_idx][index].djs.sec}}秒 | |
33 | + </view> | |
28 | 34 | </view> |
29 | 35 | |
30 | 36 | |
... | ... | @@ -35,24 +41,11 @@ |
35 | 41 | </view> |
36 | 42 | </view> |
37 | 43 | </view> |
38 | - | |
44 | + </block> | |
39 | 45 | </block> |
40 | 46 | <view style="height:60rpx"></view> |
41 | 47 | </view> |
42 | 48 | |
43 | -<view class="no-more" hidden="{{!noMore}}" wx:if="{{list.pageData.length !== 0}}">—— 已经到底啦 ——</view> | |
44 | -<nodata nodataContainer="t-c" wx:if="{{list.pageData.length == 0}}"></nodata> | |
49 | +<view class="no-more" hidden="{{!noMore}}" wx:if="{{list.length >= 0 && noMore }}">—— 已经到底啦 ——</view> | |
50 | +<nodata nodataContainer="t-c" wx:if="{{list.length == 0 && is_get}}"></nodata> | |
45 | 51 | |
46 | - | |
47 | -<!-- | |
48 | -<view class="kill-time xc-seckill-bottom"> | |
49 | - <view class="theader" > | |
50 | - <view bindtap='tip' data-ty="1" class="xc-border-right flex-center timeac left {{type==1?'active':''}}"> | |
51 | - <image class="xc-bottom" src="{{url}}{{type==1?'/miniapp/images/fire-red.png':'/miniapp/images/fire-black.png'}}"></image> | |
52 | - 火热进行中</view> | |
53 | - <view bindtap='tip' data-ty="0" class=" flex-center timeac right {{type==0?'active':''}}"> | |
54 | - <image class="xc-bottom" src="{{url}}{{type==0?'/miniapp/images/clock-rad.png':'/miniapp/images/clock-black.png'}}"></image> | |
55 | - 即将开始</view> | |
56 | - </view> | |
57 | -</view> | |
58 | ---> | |
59 | 52 | \ No newline at end of file | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral.wxml deleted
1 | -<view bindtap="closeSpecModal_inte" class="cover-layer"></view> | |
2 | - <view class="spec-model"> | |
3 | - <view class="pding"> | |
4 | - <icon bindtap="closeSpecModal_inte" class="modal-close" color="black" size="22" type="cancel"></icon> | |
5 | - <view class="spec-goods"> | |
6 | - <image class="wh100 spec-img xc-distance-bottom" src="{{data.original_img}}" binderror="pop_err_img" data-errorimg="data.original_img"></image> | |
7 | - <view class="spec-goods-info"> | |
8 | - <view class="spec-goods-name ellipsis-2">{{data.goods_name}}</view> | |
9 | - <view class="flex ai_end xc-val-money"> | |
10 | - <view class="spec-goods-price"> | |
11 | - <text wx:if="{{prom_integral}}">{{prom_integral}}积分</text> | |
12 | - <text wx:if="{{prom_integral && prom_price}}">+</text> | |
13 | - <text wx:if="{{prom_price}}">{{prom_price}}元</text> | |
14 | - <text wx:if="{{!prom_integral && !prom_price}}">0积分</text> | |
15 | - </view> | |
16 | - </view> | |
17 | - | |
18 | - | |
19 | - <view class="flex"> | |
20 | - <view class="spec-goods-stock">已售:{{prom_act.buy_num}}</view> | |
21 | - <view class="spec-goods-stock">可售:{{prom_act.limitqty-prom_act.buy_num}}</view> | |
22 | - </view> | |
23 | - | |
24 | - </view> | |
25 | - | |
26 | - <!-- 选择门店模块 --> | |
27 | - <view class="flex-space-between address ai_end xc-width "> | |
28 | - | |
29 | - <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | |
30 | - <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> | |
31 | - <view class="distance fs24 xc-ash"wx:if="{{def_pick_store.distance!=null}}"> | |
32 | - 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} | |
33 | - | |
34 | - </view> | |
35 | - </view> | |
36 | - | |
37 | - <!-- 没有门店的时候 --> | |
38 | - <view class="flex" bindtap="choice_store" wx:else> | |
39 | - <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | |
40 | - <view class="fs30" style="color:black;">选择门店</view> | |
41 | - </view> | |
42 | - | |
43 | - <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" > | |
44 | - 更多门店 | |
45 | - <text class="right-arrow"></text> | |
46 | - </view> | |
47 | - </view> | |
48 | - <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | |
49 | - <block wx:else> | |
50 | - <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> | |
51 | - <block wx:else> | |
52 | - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
53 | - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view> | |
54 | - </block> | |
55 | - </block> | |
56 | - | |
57 | - <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view> | |
58 | - | |
59 | - | |
60 | - <!--商品的属性项目--> | |
61 | - <view class="xc-goods-attribute"> | |
62 | - <view hidden="{{ismend==1}}" class="spec-name">商品规格</view> | |
63 | - <view hidden="{{ismend==1}}" style="max-height: 120rpx;overflow-y: auto;"> | |
64 | - <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g"> | |
65 | - {{item.gg}} | |
66 | - </view> | |
67 | - </view> | |
68 | - </view> | |
69 | - | |
70 | - <view class="b_num"> | |
71 | - <view>购买数量</view> | |
72 | - <view class="count"> | |
73 | - <view bindtap="{{goodsInputNum <= 1 ? '':'subCartNum_inte'}}" class="sub {{goodsInputNum <= 1 ? 'active':''}}">-</view> | |
74 | - <input bindblur="inputCartNum_inte" type="number" value="{{goodsInputNum}}"></input> | |
75 | - <view bindtap="addCartNum_inte" class="add">+</view> | |
76 | - </view> | |
77 | - </view> | |
78 | - </view> | |
79 | - | |
80 | - <!-- 按钮部分 --> | |
81 | - <view class="spec-cart-btns"> | |
82 | - <!-- 根本就找不到门店 --> | |
83 | - <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> | |
84 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> | |
85 | - </block> | |
86 | - | |
87 | - <block wx:else> | |
88 | - | |
89 | - <!-- 根本就找不到门店 --> | |
90 | - <block wx:if="{{!only_pk && !def_pickpu_list}}"> | |
91 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view> | |
92 | - </block> | |
93 | - <block wx:else> | |
94 | - | |
95 | - | |
96 | - <block wx:if="{{only_pk.length && !only_pk.length}}"> | |
97 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view> | |
98 | - </block> | |
99 | - <block wx:else> | |
100 | - <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}"> | |
101 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> | |
102 | - </block> | |
103 | - <block wx:else> | |
104 | - <block wx:if="{{!def_pick_store}}"> | |
105 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view> | |
106 | - </block> | |
107 | - <block wx:else> | |
108 | - <block wx:if="{{data.store_count<=0}}"> | |
109 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> | |
110 | - </block> | |
111 | - <block wx:else> | |
112 | - <view bindtap="addCart_inte" class="spec-cart-btn spec-buy" data-action="buy">立即兑换</view> | |
113 | - </block> | |
114 | - | |
115 | - </block> | |
116 | - </block> | |
117 | - </block> | |
118 | - </block> | |
119 | - </block> | |
120 | - </view> | |
121 | - | |
122 | - | |
123 | - </view> | |
124 | - </view> | |
125 | - <view class="clear"></view> | |
126 | 0 | \ No newline at end of file |
packageC/pages/luckyGo/luckyGo_goodsInfo/buy_integral_normal.wxml deleted
1 | -<view bindtap="closeSpecModal_inte_normal" class="cover-layer"></view> | |
2 | - <view class="spec-model"> | |
3 | - <view class="pding"> | |
4 | - <icon bindtap="closeSpecModal_inte_normal" class="modal-close" color="black" size="22" type="cancel"></icon> | |
5 | - <view class="spec-goods"> | |
6 | - <image class="wh100 spec-img xc-distance-bottom" src="{{sele_g.original_img}}" binderror="pop_err_img" data-errorimg="data.original_img"></image> | |
7 | - <view class="spec-goods-info"> | |
8 | - <view class="spec-goods-name ellipsis-2">{{sele_g.goods_name}}</view> | |
9 | - <view class="flex ai_end xc-val-money"> | |
10 | - <text class="fs20">¥</text> | |
11 | - <!-- 如果是等级会员,且有等级价 --> | |
12 | - <block wx:if="{{card_field && sele_g[card_field]>0}}">{{sele_g[card_field]}} </block> | |
13 | - <block wx:else>{{sele_g.shop_price}}</block> | |
14 | - </view> | |
15 | - | |
16 | - <view class="flex"> | |
17 | - <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view> | |
18 | - <block wx:if="{{sales_rules==2}}"> | |
19 | - <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">可售:{{def_pick_store.CanOutQty}}</view> | |
20 | - <view class="spec-goods-stock" wx:else>可售:0</view> | |
21 | - </block> | |
22 | - <block wx:else><view class="spec-goods-stock">可售:{{sele_g.store_count}}</view></block> | |
23 | - </view> | |
24 | - | |
25 | - | |
26 | - </view> | |
27 | - | |
28 | - <!-- 选择门店模块 --> | |
29 | - <view class="flex-space-between address ai_end xc-width "> | |
30 | - | |
31 | - <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}"> | |
32 | - <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> | |
33 | - <view class="distance fs24 xc-ash"wx:if="{{def_pick_store.distance!=null}}"> | |
34 | - 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} | |
35 | - | |
36 | - </view> | |
37 | - </view> | |
38 | - | |
39 | - <!-- 没有门店的时候 --> | |
40 | - <view class="flex" bindtap="choice_store" wx:else> | |
41 | - <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> | |
42 | - <view class="fs30" style="color:black;">选择门店</view> | |
43 | - </view> | |
44 | - | |
45 | - <view hidden="{{has_def && sys_switch.is_pricing_open_store}}" class="red-co fs28" bindtap="choice_store" > | |
46 | - 更多门店 | |
47 | - <text class="right-arrow"></text> | |
48 | - </view> | |
49 | - </view> | |
50 | - <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view> | |
51 | - <block wx:else> | |
52 | - <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> | |
53 | - <block wx:else> | |
54 | - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | |
55 | - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view> | |
56 | - </block> | |
57 | - </block> | |
58 | - <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view> | |
59 | - | |
60 | - | |
61 | - <!--商品的属性项目--> | |
62 | - <view class="xc-goods-attribute"> | |
63 | - <view hidden="{{ismend==1}}" class="spec-name">商品规格</view> | |
64 | - <view hidden="{{ismend==1}}" style="max-height: 120rpx;overflow-y: auto;"> | |
65 | - <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-nor="1" data-gid='{{item.goods_id}}' wx:for="{{sku_g_pt}}" wx:key="sku_g"> | |
66 | - {{item.gg}} | |
67 | - </view> | |
68 | - </view> | |
69 | - </view> | |
70 | - | |
71 | - <view class="b_num"> | |
72 | - <view>购买数量</view> | |
73 | - <view class="count"> | |
74 | - <view bindtap="{{goodsInputNum <= 1 ? '':'subCartNum'}}" class="sub {{goodsInputNum <= 1 ? 'active':''}}">-</view> | |
75 | - <input bindblur="inputCartNum" type="number" value="{{goodsInputNum}}"></input> | |
76 | - <view bindtap="addCartNum" class="add">+</view> | |
77 | - </view> | |
78 | - </view> | |
79 | - </view> | |
80 | - | |
81 | - | |
82 | - <!-- 提示再买多少优惠 --> | |
83 | - <view style="margin-top: 35rpx;color:#333;font-size:28rpx;" wx:if="{{hui_condition}}"> | |
84 | - 再买{{hui_condition.need}} | |
85 | - <text wx:if="{{hui_condition.money}}">,免{{hui_condition.money}}元</text> | |
86 | - <text wx:if="{{hui_condition.sale}}">,打{{hui_condition.sale}}折</text> | |
87 | - <text wx:if="{{hui_condition.past==1}}">,包邮</text> | |
88 | - <text wx:if="{{hui_condition.intValue>0}}">,送{{hui_condition.intValue}}积分</text> | |
89 | - <text wx:if="{{hui_condition.couponId>0}}">,送优惠券</text> | |
90 | - <text wx:if="{{hui_condition.gift_id>0}}">,送赠品</text> | |
91 | - <text wx:if="{{hui_condition.lb_id>0}}">,送礼包</text> | |
92 | - <text wx:if="{{hui_condition.zxlb_id>0}}">,送专享礼包</text> | |
93 | - </view> | |
94 | - | |
95 | - | |
96 | - <!-- 按钮部分 --> | |
97 | - <view class="spec-cart-btns"> | |
98 | - | |
99 | - | |
100 | - <!-- 根本就找不到门店 --> | |
101 | - <block wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> | |
102 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">配送不匹配</view> | |
103 | - </block> | |
104 | - <block wx:else> | |
105 | - <!-- 根本就找不到门店 --> | |
106 | - <block wx:if="{{!only_pk && !def_pickpu_list}}"> | |
107 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view> | |
108 | - </block> | |
109 | - <block wx:else> | |
110 | - | |
111 | - | |
112 | - <block wx:if="{{only_pk.length && !only_pk.length}}"> | |
113 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">库存不足</view> | |
114 | - </block> | |
115 | - <block wx:else> | |
116 | - <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}"> | |
117 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> | |
118 | - </block> | |
119 | - <block wx:else> | |
120 | - <block wx:if="{{!def_pick_store}}"> | |
121 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view> | |
122 | - </block> | |
123 | - <block wx:else> | |
124 | - <block wx:if="{{data.store_count<=0}}"> | |
125 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> | |
126 | - </block> | |
127 | - <block wx:else> | |
128 | - <view class="flex jc_sb"> | |
129 | - <view class="spec-cart-btn spec-buy w40" bindtap="addCart" | |
130 | - data-action="add" style="background-color: #ffb03f;">加入购物车</view> | |
131 | - <view class="spec-cart-btn spec-buy w40" bindtap="addCart" | |
132 | - data-action="buy">立即购买</view> | |
133 | - </view> | |
134 | - </block> | |
135 | - | |
136 | - </block> | |
137 | - </block> | |
138 | - </block> | |
139 | - </block> | |
140 | - </block> | |
141 | - </view> | |
142 | - | |
143 | - | |
144 | - </view> | |
145 | - </view> | |
146 | - <view class="clear"></view> | |
147 | 0 | \ No newline at end of file |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... | ... | @@ -4066,8 +4066,6 @@ Page({ |
4066 | 4066 | // ind == 1 为普通购买 |
4067 | 4067 | openSpecModel_pt: function (e) { |
4068 | 4068 | |
4069 | - | |
4070 | - | |
4071 | 4069 | this.setData({ open_ind_store: 9, goodsInputNum: 1 }); |
4072 | 4070 | // 判断是否有待支付订单 |
4073 | 4071 | var aid = this.data.group_id; |
... | ... | @@ -4190,7 +4188,9 @@ Page({ |
4190 | 4188 | // } |
4191 | 4189 | // }); |
4192 | 4190 | |
4191 | + | |
4193 | 4192 | th.data.prom_type=9; |
4193 | + | |
4194 | 4194 | th.get_sto(); |
4195 | 4195 | th.setData({ |
4196 | 4196 | is_normal: 0, |
... | ... | @@ -4809,12 +4809,16 @@ Page({ |
4809 | 4809 | context.setTextAlign('left'); |
4810 | 4810 | context.fillText('强烈推荐', 64 * unit, 672 * unit); |
4811 | 4811 | // 7.商品价格 |
4812 | - let price = '¥' + this.data.data.shop_price; | |
4813 | - // if (th.data.prom_act) | |
4814 | - // pri0 = th.data.prom_act.price; | |
4812 | + let price = '¥' + parseFloat( this.data.luckGoInfo.group_price/100).toFixed(2); | |
4815 | 4813 | context.setFontSize(32 * unit); |
4816 | 4814 | context.setFillStyle('#DE1117'); |
4817 | 4815 | context.fillText(price, 54 * unit, 730 * unit); |
4816 | + | |
4817 | + //-- 零售价的优化 -- | |
4818 | + var wp= 60 * unit+ut.measureText( price, 32 * unit); | |
4819 | + var hp=730 * unit | |
4820 | + this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit); | |
4821 | + | |
4818 | 4822 | // 8.商品标题 |
4819 | 4823 | context.setFontSize(20 * unit); |
4820 | 4824 | context.setFillStyle('#898989'); |
... | ... | @@ -4835,6 +4839,29 @@ Page({ |
4835 | 4839 | |
4836 | 4840 | |
4837 | 4841 | |
4842 | + //---市场价划掉--- | |
4843 | + draw_pos_price(context,w,h,market_price,unit){ | |
4844 | + | |
4845 | + if(!this.data.sys_switch) return false; | |
4846 | + if(!this.data.sys_switch.is_retail_price) return false; | |
4847 | + | |
4848 | + | |
4849 | + context.setFillStyle("gray") | |
4850 | + context.setFontSize(22 * unit) | |
4851 | + var pri0 = "¥" + market_price; | |
4852 | + context.fillText(pri0, w, h); | |
4853 | + | |
4854 | + var c_h=h-6; | |
4855 | + context.setStrokeStyle('gray'); | |
4856 | + context.setLineWidth(1 * unit); | |
4857 | + context.moveTo(w - 5, c_h); | |
4858 | + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h); | |
4859 | + context.stroke(); | |
4860 | + | |
4861 | + }, | |
4862 | + | |
4863 | + | |
4864 | + | |
4838 | 4865 | //--定义的保存图片方法,分享团--- |
4839 | 4866 | saveImageToPhotosAlbum: function () { |
4840 | 4867 | //--先判断会员状态-- |
... | ... | @@ -4851,8 +4878,8 @@ Page({ |
4851 | 4878 | |
4852 | 4879 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 9幸运购 |
4853 | 4880 | var type = 9; |
4854 | - console.log('type', type); | |
4855 | - if (type == 6) type = 2; | |
4881 | + var th=this; | |
4882 | + | |
4856 | 4883 | if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; |
4857 | 4884 | |
4858 | 4885 | wx.showLoading({ title: '生成中...', }) |
... | ... | @@ -4882,8 +4909,6 @@ Page({ |
4882 | 4909 | ///二微码 |
4883 | 4910 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
4884 | 4911 | os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; |
4885 | - // var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | |
4886 | - // os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo"; | |
4887 | 4912 | |
4888 | 4913 | console.log('path3......', path3); |
4889 | 4914 | |
... | ... | @@ -4899,14 +4924,6 @@ Page({ |
4899 | 4924 | // 先画背景 |
4900 | 4925 | var pg_path = "../../../../images/share/share_bg.png"; |
4901 | 4926 | |
4902 | - // context.fillStyle="#FFFFFF"; | |
4903 | - // context.fillRect(0,0,554 * unit, 899 * unit); | |
4904 | - | |
4905 | - // if(type == 0) { | |
4906 | - // this.drawPoster(context); | |
4907 | - // return false; | |
4908 | - // }; | |
4909 | - | |
4910 | 4927 | |
4911 | 4928 | //-- 如果有自定义海报的时候,判断背景的图片 -- |
4912 | 4929 | if (th.data.share_b_img) { |
... | ... | @@ -4915,17 +4932,17 @@ Page({ |
4915 | 4932 | // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
4916 | 4933 | |
4917 | 4934 | |
4918 | - if (!th.data.share_b_img && (type == 9)) { // 如果是普通商品,绘制新海报 | |
4935 | + if (!th.data.share_b_img) { // 如果是普通商品,绘制新海报 | |
4919 | 4936 | th.drawPoster(context, unit, th.data.share_goods_img, vpath); |
4920 | 4937 | } else { |
4921 | 4938 | context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
4922 | 4939 | }; |
4923 | 4940 | |
4924 | - // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | |
4941 | + | |
4925 | 4942 | |
4926 | 4943 | |
4927 | 4944 | //-- 是自定义海报的情况下 -- |
4928 | - if (th.data.share_b_img || type != 0) { | |
4945 | + if (th.data.share_b_img ) { | |
4929 | 4946 | |
4930 | 4947 | |
4931 | 4948 | |
... | ... | @@ -4973,28 +4990,22 @@ Page({ |
4973 | 4990 | // context.setFillStyle("#7f7f7f") |
4974 | 4991 | // context.setFontSize(21.3 * unit) |
4975 | 4992 | // context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); |
4976 | - | |
4977 | 4993 | } |
4978 | - | |
4979 | - }; | |
4994 | + } | |
4980 | 4995 | |
4981 | 4996 | |
4982 | 4997 | |
4983 | 4998 | var share_title = th.data.data.goods_name; |
4984 | - if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) { | |
4985 | - share_title = th.data.prom_act.share_title; | |
4986 | - if (!share_title) share_title = th.data.prom_act.title; | |
4987 | - if (th.data.prom_type == 4) share_title = th.data.prom_act.name; | |
4988 | - } | |
4989 | - | |
4990 | 4999 | //---产品名称--- |
4991 | 5000 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
4992 | - if (th.data.share_b_img || (type != 4 && type != 9)) { | |
5001 | + if (th.data.share_b_img ) { | |
4993 | 5002 | context.setFillStyle("black"); |
4994 | 5003 | context.setFontSize(21.3 * unit) |
4995 | - th.draw_Text(context, share_title, | |
5004 | + getApp().draw_Text(context, share_title, | |
4996 | 5005 | 38 * unit, 180 * unit, 220 * unit, 220 * unit, unit); |
4997 | 5006 | |
5007 | + | |
5008 | + | |
4998 | 5009 | //------产品的价格------- |
4999 | 5010 | context.setFontSize(23 * unit) |
5000 | 5011 | context.setFillStyle("red") |
... | ... | @@ -5018,276 +5029,49 @@ Page({ |
5018 | 5029 | context.fillText('参团价', 330 * unit, 179 * unit); |
5019 | 5030 | |
5020 | 5031 | //---市场价划掉--- |
5021 | - context.setFillStyle("gray") | |
5022 | - context.setFontSize(22 * unit) | |
5023 | - pri0 = "零售价:¥" + th.data.data.market_price.toFixed(2); | |
5024 | - var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | |
5025 | - context.fillText(pri0, wd2, 213 * unit); | |
5026 | - | |
5027 | - context.setStrokeStyle('gray'); | |
5028 | - context.setLineWidth(1 * unit); | |
5029 | - context.moveTo(wd2 - 5, 206 * unit); | |
5030 | - context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | |
5031 | - context.stroke(); | |
5032 | - | |
5033 | - } else if (type == 4 && type != 0) { | |
5034 | - context.setFillStyle("black"); | |
5035 | - context.setFontSize(21.3 * unit) | |
5036 | - th.draw_Text(context, share_title, | |
5037 | - 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); | |
5038 | - //------ 产品的价格 ----- | |
5039 | - var pri0 = th.data.prom_act.addmoney; | |
5040 | - var integral = th.data.prom_act.integral; | |
5041 | - var text = ""; | |
5042 | - if (integral) { text = integral + "积分"; } | |
5043 | - if (pri0 && integral) { text += "+"; } | |
5044 | - if (pri0) { text += "¥" + pri0; } | |
5045 | - | |
5046 | - if (!pri0 && !integral) { text = "0积分"; } | |
5047 | - context.setFillStyle("red"); | |
5048 | - context.fillText(text, 38 * unit, 235 * unit); | |
5032 | + // context.setFillStyle("gray") | |
5033 | + // context.setFontSize(22 * unit) | |
5034 | + pri0 = "零售价:¥" + th.data.data.market_price.toFixed(2); | |
5035 | + var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | |
5036 | + | |
5037 | + // context.fillText(pri0, wd2, 213 * unit); | |
5038 | + // context.setStrokeStyle('gray'); | |
5039 | + // context.setLineWidth(1 * unit); | |
5040 | + // context.moveTo(wd2 - 5, 206 * unit); | |
5041 | + // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | |
5042 | + // context.stroke(); | |
5043 | + | |
5044 | + th.draw_pos_price(context,wd2, 213 * unit,pri0,unit); | |
5049 | 5045 | |
5050 | 5046 | } |
5051 | 5047 | |
5052 | 5048 | //---中间大图--- |
5053 | - if ( th.data.share_b_img || type != 9) { | |
5054 | - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | |
5049 | + if ( th.data.share_b_img ) { | |
5050 | + context.drawImage(th.data.share_goods_img, 70 * unit, 245 * unit, 408 * unit, 408 * unit); | |
5055 | 5051 | }; |
5056 | 5052 | |
5057 | 5053 | //---自定义海报 产品质量保证 |
5058 | 5054 | if(th.data.share_b_img && th.data.poster.show_quality==1 ){ |
5059 | 5055 | var g_path = "../../../../images/share/s_gou.png"; |
5060 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5056 | + context.drawImage(g_path, 56 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5061 | 5057 | context.setFillStyle("red") |
5062 | 5058 | context.setFontSize(18 * unit) |
5063 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
5059 | + context.fillText("正品保证", 84 * unit, 670 * unit); | |
5064 | 5060 | |
5065 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5061 | + context.drawImage(g_path, 218 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5066 | 5062 | context.setFillStyle("red") |
5067 | 5063 | context.setFontSize(18 * unit) |
5068 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
5064 | + context.fillText("纯实体店", 246 * unit, 670 * unit); | |
5069 | 5065 | |
5070 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5066 | + context.drawImage(g_path, 388 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5071 | 5067 | context.setFillStyle("red") |
5072 | 5068 | context.setFontSize(18 * unit) |
5073 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
5069 | + context.fillText("官方验证", 420 * unit, 670 * unit); | |
5074 | 5070 | |
5075 | 5071 | } |
5076 | 5072 | |
5077 | 5073 | //-------大图后面就不一样了----------- |
5078 | 5074 | switch (type) { |
5079 | - case 0: break;//普通商品的展示 | |
5080 | - case 4: | |
5081 | - //中间的几个字 | |
5082 | - if (th.data.poster && parseInt(th.data.poster.style) == 2) { | |
5083 | - if (parseInt(th.data.poster.show_quality)) { | |
5084 | - var g_path = "../../../../images/share/s_gou.png"; | |
5085 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5086 | - context.setFillStyle("red") | |
5087 | - context.setFontSize(18 * unit) | |
5088 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
5089 | - | |
5090 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5091 | - context.setFillStyle("red") | |
5092 | - context.setFontSize(18 * unit) | |
5093 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
5094 | - | |
5095 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5096 | - context.setFillStyle("red") | |
5097 | - context.setFontSize(18 * unit) | |
5098 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
5099 | - } | |
5100 | - | |
5101 | - } else { | |
5102 | - var g_path = "../../../../images/share/s_gou.png"; | |
5103 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5104 | - context.setFillStyle("red") | |
5105 | - context.setFontSize(18 * unit) | |
5106 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
5107 | - | |
5108 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5109 | - context.setFillStyle("red") | |
5110 | - context.setFontSize(18 * unit) | |
5111 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
5112 | - | |
5113 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
5114 | - context.setFillStyle("red") | |
5115 | - context.setFontSize(18 * unit) | |
5116 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
5117 | - } | |
5118 | - | |
5119 | - | |
5120 | - //---画线--- | |
5121 | - context.setLineWidth(1 * unit) | |
5122 | - context.moveTo(32 * unit, 710 * unit) | |
5123 | - context.lineTo(520 * unit, 710 * unit) | |
5124 | - context.stroke(); | |
5125 | - | |
5126 | - //---文字--- | |
5127 | - context.setFillStyle("black") | |
5128 | - context.setFontSize(22 * unit) | |
5129 | - | |
5130 | - if (type == 0) { | |
5131 | - // 原来start ---> | |
5132 | - context.setFontSize(24 * unit) | |
5133 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | |
5134 | - | |
5135 | - context.setFontSize(22 * unit) | |
5136 | - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit); | |
5137 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit); | |
5138 | - | |
5139 | - } else { | |
5140 | - context.setFontSize(24 * unit) | |
5141 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | |
5142 | - context.setFontSize(22 * unit) | |
5143 | - context.fillText("长按识别二维码", 40 * unit, 806 * unit); | |
5144 | - context.fillText("立即开始兑换", 40 * unit, 846 * unit); | |
5145 | - | |
5146 | - } | |
5147 | - | |
5148 | - //---二维吗图--- | |
5149 | - //-- 自定义海报 -- | |
5150 | - if (th.data.poster) { | |
5151 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
5152 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
5153 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
5154 | - } else { | |
5155 | - //---二维吗图--- | |
5156 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
5157 | - }; | |
5158 | - | |
5159 | - break; | |
5160 | - case 1: //秒杀商品的展示 | |
5161 | - //---画线--- | |
5162 | - context.setLineWidth(1 * unit) | |
5163 | - context.moveTo(32 * unit, 670 * unit) | |
5164 | - context.lineTo(520 * unit, 670 * unit) | |
5165 | - context.stroke(); | |
5166 | - | |
5167 | - //画秒杀的图片 | |
5168 | - var miaos_path = '../../../../images/share/miao_share.png'; | |
5169 | - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); | |
5170 | - | |
5171 | - context.setFillStyle("black") | |
5172 | - context.setFontSize(24 * unit) | |
5173 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit); | |
5174 | - //---文字--- | |
5175 | - context.setFontSize(22 * unit) | |
5176 | - context.setFillStyle("black") | |
5177 | - context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit); | |
5178 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); | |
5179 | - | |
5180 | - | |
5181 | - //---二维吗图--- | |
5182 | - //-- 自定义海报 -- | |
5183 | - if (th.data.poster) { | |
5184 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
5185 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
5186 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); | |
5187 | - } else { | |
5188 | - //---二维吗图--- | |
5189 | - context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit); | |
5190 | - } | |
5191 | - break; | |
5192 | - | |
5193 | - case 2: //会员团和商家团的展示 | |
5194 | - //---画线--- | |
5195 | - context.setLineWidth(1 * unit) | |
5196 | - context.moveTo(32 * unit, 670 * unit) | |
5197 | - context.lineTo(520 * unit, 670 * unit) | |
5198 | - context.stroke(); | |
5199 | - //---文字--- | |
5200 | - context.setFillStyle("black") | |
5201 | - context.setFontSize(24 * unit) | |
5202 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | |
5203 | - | |
5204 | - //绘制成团图片 | |
5205 | - var ct_img = "../../../../images/share/ct_num.png"; | |
5206 | - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); | |
5207 | - var ct_num = th.data.prom_act.ct_num; | |
5208 | - context.setFontSize(14 * unit) | |
5209 | - context.font = 'normal'; | |
5210 | - context.setFillStyle("red") | |
5211 | - if (ct_num < 10) { | |
5212 | - context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit); | |
5213 | - } else { | |
5214 | - context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit); | |
5215 | - } | |
5216 | - context.setFontSize(22 * unit) | |
5217 | - context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit); | |
5218 | - | |
5219 | - context.setFillStyle("gray") | |
5220 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit); | |
5221 | - context.setFillStyle("black") | |
5222 | - context.font = 'normal bold 18px sans-serif'; | |
5223 | - context.setFontSize(21.3 * unit) | |
5224 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit); | |
5225 | - | |
5226 | - | |
5227 | - //---二维吗图--- | |
5228 | - //-- 自定义海报 -- | |
5229 | - if (th.data.poster) { | |
5230 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
5231 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
5232 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
5233 | - } else { | |
5234 | - //---二维吗图--- | |
5235 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
5236 | - } | |
5237 | - break | |
5238 | - case 3: //阶梯团的展示 | |
5239 | - //---画线--- | |
5240 | - context.setLineWidth(1 * unit) | |
5241 | - context.moveTo(32 * unit, 670 * unit) | |
5242 | - context.lineTo(520 * unit, 670 * unit) | |
5243 | - context.stroke(); | |
5244 | - //---文字--- | |
5245 | - context.setFillStyle("black") | |
5246 | - context.setFontSize(24 * unit) | |
5247 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | |
5248 | - | |
5249 | - //---绘制中间阶梯的价格--- | |
5250 | - var list = th.data.prom_act.ct_rylist; | |
5251 | - for (var i = 0; i < list.length; i++) { | |
5252 | - var item = list[i]; | |
5253 | - var wi = i * 90 * unit; | |
5254 | - context.font = 'normal'; | |
5255 | - context.setFontSize(16 * unit) | |
5256 | - context.setFillStyle("red") | |
5257 | - context.fillText("¥", 40 * unit + wi, 756 * unit); | |
5258 | - context.setFontSize(22 * unit) | |
5259 | - var pri = parseFloat(item.price).toFixed(2); | |
5260 | - context.fillText(pri, 56 * unit + wi, 756 * unit); | |
5261 | - context.setFillStyle("gray") | |
5262 | - context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit); | |
5263 | - } | |
5264 | - //----------------下面部分---------------- | |
5265 | - // context.setFillStyle("gray") | |
5266 | - // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit); | |
5267 | - // context.setFillStyle("black") | |
5268 | - // context.font = 'normal bold 18px sans-serif'; | |
5269 | - // context.setFontSize(22 * unit) | |
5270 | - // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit); | |
5271 | - //context.setFillStyle("gray") | |
5272 | - context.setFillStyle("black") | |
5273 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit); | |
5274 | - //context.font = 'normal bold 18px sans-serif'; | |
5275 | - context.setFontSize(21 * unit) | |
5276 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit); | |
5277 | - | |
5278 | - | |
5279 | - //-- 自定义海报 -- | |
5280 | - if (th.data.poster) { | |
5281 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
5282 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
5283 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
5284 | - } else { | |
5285 | - //---二维吗图--- | |
5286 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
5287 | - } | |
5288 | - break; | |
5289 | - | |
5290 | - | |
5291 | 5075 | case 9: |
5292 | 5076 | if(th.data.share_b_img){ |
5293 | 5077 | |
... | ... | @@ -5363,12 +5147,11 @@ Page({ |
5363 | 5147 | |
5364 | 5148 | break; |
5365 | 5149 | |
5366 | - | |
5367 | 5150 | } |
5368 | 5151 | |
5369 | 5152 | |
5370 | 5153 | //--- 如果是自定义海报的时候 --- |
5371 | - if ( th.data.share_b_img || type != 9) { | |
5154 | + if ( th.data.share_b_img ) { | |
5372 | 5155 | |
5373 | 5156 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
5374 | 5157 | |
... | ... | @@ -5413,6 +5196,14 @@ Page({ |
5413 | 5196 | }; |
5414 | 5197 | |
5415 | 5198 | |
5199 | + if(th.data.poster.show_time==1){ | |
5200 | + var act_time = ''; | |
5201 | + act_time="截止时间:"+ ut.formatTime(th.data.luckGoInfo.end_time); | |
5202 | + context.setFillStyle("red") | |
5203 | + getApp().draw_Text(context, act_time, 38 * unit, 880 * unit, 200 * unit, 340 * unit, unit); | |
5204 | + } | |
5205 | + | |
5206 | + | |
5416 | 5207 | |
5417 | 5208 | //把画板内容绘制成图片,并回调 画板图片路径 |
5418 | 5209 | context.draw(false, function () { |
... | ... | @@ -5464,35 +5255,6 @@ Page({ |
5464 | 5255 | }); |
5465 | 5256 | }, |
5466 | 5257 | |
5467 | - | |
5468 | - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | |
5469 | - draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { | |
5470 | - var lineWidth = 0; | |
5471 | - var lastSubStrIndex = 0; //每次开始截取的字符串的索引 | |
5472 | - var han = 0; | |
5473 | - for (let i = 0; i < str.length; i++) { | |
5474 | - if (han == 2) return; | |
5475 | - //lineWidth += ctx.measureText(str[i]).width; | |
5476 | - lineWidth += ut.measureText(str[i], 21.3 * unit); | |
5477 | - if (lineWidth > canvasWidth) { | |
5478 | - han++; | |
5479 | - | |
5480 | - if (han == 2) | |
5481 | - ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分 | |
5482 | - else | |
5483 | - ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); | |
5484 | - | |
5485 | - initHeight += 22; //22为字体的高度 | |
5486 | - lineWidth = 0; | |
5487 | - lastSubStrIndex = i; | |
5488 | - titleHeight += 20; | |
5489 | - } | |
5490 | - if (i == str.length - 1) { //绘制剩余部分 | |
5491 | - ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight); | |
5492 | - } | |
5493 | - } | |
5494 | - }, | |
5495 | - | |
5496 | 5258 | // ----视频图片---- |
5497 | 5259 | // 图片计数器 |
5498 | 5260 | swiperChange: function (e) { | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
... | ... | @@ -113,12 +113,22 @@ |
113 | 113 | <!-- <view class="fs50 val">{{filters.toFix(data.shop_price,2)}}</view> --> |
114 | 114 | <view class="fs50 val">{{filters.toFix(luckGoInfo.group_price/100,2)}}</view> |
115 | 115 | </view> |
116 | - <view class="word-line fs20 xc-qtunit-price"> | |
117 | -<!-- 手店价--> | |
118 | - <!-- ¥{{filters.toFix(data.shop_price,2)}} --> | |
119 | - <block wx:if="{{card_field && sele_g[card_field]>0}}"><text class="rmb lh1">{{sele_g[card_field]}}</text></block> | |
120 | - <block wx:else><text class="rmb lh1">{{sele_g.shop_price}}</text></block> | |
116 | + <view class="word-line fs20 xc-qtunit-price" wx:if="{{sys_switch.is_retail_price}}" style="margin-left:0" > | |
117 | + 零售价:<text class="rmb lh1">{{data.market_price}}</text> | |
121 | 118 | </view> |
119 | + | |
120 | + <view class="word-line fs20 xc-qtunit-price" wx:else> | |
121 | + | |
122 | + <!-- 手店价--> | |
123 | + <!-- {{filters.toFix(data.shop_price,2)}} --> | |
124 | + <block wx:if="{{card_field && sele_g[card_field]>0}}"><text class="rmb lh1">{{sele_g[card_field]}}</text></block> | |
125 | + <block wx:else><text class="rmb lh1">{{data.shop_price}}</text></block> | |
126 | + </view> | |
127 | + | |
128 | + | |
129 | + | |
130 | + | |
131 | + | |
122 | 132 | </view> |
123 | 133 | |
124 | 134 | |
... | ... | @@ -1049,8 +1059,6 @@ |
1049 | 1059 | <!-- <nav_box></nav_box> --> |
1050 | 1060 | </block> |
1051 | 1061 | |
1052 | - | |
1053 | - | |
1054 | 1062 | <!-- --弹起来,选择规格数量,普通商品购买和秒杀---- --> |
1055 | 1063 | <view hidden="{{!openSpecModal}}"> |
1056 | 1064 | <view bindtap="closeSpecModal" class="cover-layer"></view> |
... | ... | @@ -1336,40 +1344,7 @@ |
1336 | 1344 | <view class="top-frame"> |
1337 | 1345 | <view class="xc-coupon-frame "> |
1338 | 1346 | |
1339 | - <view class="rel" wx:for="{{quan_list}}" wx:key="{{index}}"> | |
1340 | - <view class="coupon flex"> | |
1341 | - <view class="circle xc-circular-one"></view> | |
1342 | - <view class="xc-coupon-left "> | |
1343 | - <view class="flex ai_c xc-money-frame"> | |
1344 | - <text class="xc-money two-level-word xc-rmb">¥</text> | |
1345 | - <text class="one-level-word xc-money">{{item.money}}</text> | |
1346 | - </view> | |
1347 | - <view class="xc-money four-level-word xc-spacing">满{{item.condition}}元可用</view> | |
1348 | - </view> | |
1349 | - <view class="xc-coupon-right flex"> | |
1350 | - <view class="xc-detail-coupon"> | |
1351 | - <view class="four-level-word">订单金额满{{item.condition}}元可用</view> | |
1352 | - <view class="four-level-word xc-below"> | |
1353 | - {{filters.replace_time2(item.start)}} 至 {{filters.replace_time2(item.end)}} | |
1354 | - </view> | |
1355 | - </view> | |
1356 | - <view class="flex-vertical"> | |
1357 | - <view class="three-level-word xc-get background {{item.everyone_num>0 && item.lqnum>=item.everyone_num?'nouse':''}}" data-ind="{{index}}" data-cid="{{item.id}}" bindtap="get_quan"> | |
1358 | - {{ item.linging==1?'领取中':'领取'}} | |
1359 | - </view> | |
1360 | - </view> | |
1361 | - </view> | |
1362 | - <view class="circle xc-circular-two"></view> | |
1363 | - </view> | |
1364 | - </view> | |
1365 | - </view> | |
1366 | - </view> | |
1367 | - </view> | |
1368 | - <view class="cx-confirm pd20" data-coupon='0' bindtap="switchCoupon"> | |
1369 | - <view class="confirm t-c">关闭</view> | |
1370 | - </view> | |
1371 | - </view> | |
1372 | -</view> --> | |
1347 | + | |
1373 | 1348 | <!-- 选择门店的弹框,1.1版最新的 --> |
1374 | 1349 | <block wx:if="{{store==1}}"> |
1375 | 1350 | <view class="mongolia-layer" bindtap="close_popup"></view> | ... | ... |
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxss
packageC/pages/presell/goodsInfo/goodsInfo.js
... | ... | @@ -2775,6 +2775,8 @@ Page({ |
2775 | 2775 | } |
2776 | 2776 | }, |
2777 | 2777 | |
2778 | + | |
2779 | + | |
2778 | 2780 | //--定义的保存图片方法,分享团--- |
2779 | 2781 | saveImageToPhotosAlbum: function () { |
2780 | 2782 | //--先判断会员状态-- |
... | ... | @@ -2823,7 +2825,7 @@ Page({ |
2823 | 2825 | ///二微码 |
2824 | 2826 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
2825 | 2827 | os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/presell/goodsInfo/goodsInfo"; |
2826 | - | |
2828 | + | |
2827 | 2829 | |
2828 | 2830 | console.log(path3); |
2829 | 2831 | |
... | ... | @@ -2838,9 +2840,6 @@ Page({ |
2838 | 2840 | //先画背景 |
2839 | 2841 | var pg_path = "../../../../images/share/share_bg.png"; |
2840 | 2842 | |
2841 | - // context.fillStyle="#FFFFFF"; | |
2842 | - // context.fillRect(0,0,554 * unit, 899 * unit); | |
2843 | - | |
2844 | 2843 | //-- 如果有自定义海报的时候,判断背景的图片 -- |
2845 | 2844 | if (th.data.share_b_img) { |
2846 | 2845 | pg_path = th.data.share_b_img; |
... | ... | @@ -2893,11 +2892,11 @@ Page({ |
2893 | 2892 | |
2894 | 2893 | //---产品名称--- |
2895 | 2894 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
2896 | - if (type != 4) { | |
2895 | + | |
2897 | 2896 | context.setFillStyle("black"); |
2898 | 2897 | context.setFontSize(21.3 * unit) |
2899 | 2898 | th.draw_Text(context, share_title, |
2900 | - 80 * unit, 200 * unit, 200 * unit, 279 * unit, unit); | |
2899 | + 80 * unit, 160 * unit, 200 * unit, 279 * unit, unit); | |
2901 | 2900 | |
2902 | 2901 | //------产品的价格------- |
2903 | 2902 | context.setFontSize(22 * unit) |
... | ... | @@ -2909,15 +2908,16 @@ Page({ |
2909 | 2908 | // pri0 = th.data.prom_act.price; |
2910 | 2909 | pri0 = parseFloat(pri0).toFixed(2); |
2911 | 2910 | var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; |
2912 | - context.fillText("¥", wd1 - 15, 185 * unit); | |
2911 | + context.fillText("¥", wd1 - 15, 160 * unit); | |
2913 | 2912 | context.setFontSize(22 * unit) |
2914 | - context.fillText(pri0, wd1, 185 * unit); | |
2913 | + context.fillText(pri0, wd1, 165 * unit); | |
2915 | 2914 | |
2916 | 2915 | //---市场价划掉--- |
2917 | - context.setFillStyle("red") | |
2918 | - context.setFontSize(22 * unit) | |
2919 | - pri0 = "¥" + th.data.data.market_price.toFixed(2); | |
2920 | - var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | |
2916 | + // context.setFillStyle("red") | |
2917 | + // context.setFontSize(22 * unit) | |
2918 | + // pri0 = "¥" + th.data.data.market_price.toFixed(2); | |
2919 | + // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | |
2920 | + | |
2921 | 2921 | |
2922 | 2922 | if(th.data.presellForm.presell_type==1){ |
2923 | 2923 | // context.setStrokeStyle('gray'); |
... | ... | @@ -2926,75 +2926,62 @@ Page({ |
2926 | 2926 | // context.moveTo(wd2 - 5, 206 * unit); |
2927 | 2927 | // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); |
2928 | 2928 | // context.stroke(); |
2929 | - }else{ | |
2930 | - context.fillText('定金', wd2, 213 * unit); | |
2929 | + | |
2930 | + //-- 零售价的优化 -- | |
2931 | + var wp= th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50; | |
2932 | + var hp= 180 * unit | |
2933 | + th.draw_pos_price(context,wp,hp,th.data.data.market_price,unit); | |
2934 | + | |
2935 | + }else{ | |
2936 | + var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50; | |
2937 | + context.fillText('定金', wd2, 190 * unit); | |
2931 | 2938 | } |
2932 | 2939 | |
2933 | - | |
2934 | - | |
2935 | - } else { | |
2936 | - context.setFillStyle("black"); | |
2937 | - context.setFontSize(21.3 * unit) | |
2938 | - th.draw_Text(context, share_title, | |
2939 | - 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); | |
2940 | - //------ 产品的价格 ----- | |
2941 | - var pri0 = th.data.prom_act.addmoney; | |
2942 | - var integral = th.data.prom_act.integral; | |
2943 | - var text = ""; | |
2944 | - if (integral) { text = integral + "积分"; } | |
2945 | - if (pri0 && integral) { text += "+"; } | |
2946 | - if (pri0) { text += "¥" + pri0; } | |
2947 | - | |
2948 | - if (!pri0 && !integral) { text = "0积分"; } | |
2949 | - context.setFillStyle("red"); | |
2950 | - context.fillText(text, 38 * unit, 235 * unit); | |
2951 | 2940 | |
2952 | - } | |
2953 | - | |
2954 | 2941 | //console.log(th.data.share_goods_img); |
2955 | 2942 | //let share_goods_img=th.data.presellForm.share_img; |
2956 | 2943 | //share_goods_img?share_goods_img:th.data.data.share_goods_img; |
2957 | 2944 | //---中间大图--- |
2958 | - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | |
2945 | + context.drawImage(th.data.share_goods_img, 70 * unit, 210 * unit, 408 * unit, 408 * unit); | |
2959 | 2946 | //---自定义海报 产品质量保证 |
2960 | 2947 | if(th.data.poster.show_quality==1 ){ |
2961 | 2948 | var g_path = "/images/share/s_gou.png"; |
2962 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
2949 | + context.drawImage(g_path, 56 * unit, 630 * unit, 22 * unit, 22 * unit); | |
2963 | 2950 | context.setFillStyle("red") |
2964 | 2951 | context.setFontSize(18 * unit) |
2965 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
2952 | + context.fillText("正品保证", 84 * unit, 650 * unit); | |
2966 | 2953 | |
2967 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
2954 | + context.drawImage(g_path, 218 * unit, 630 * unit, 22 * unit, 22 * unit); | |
2968 | 2955 | context.setFillStyle("red") |
2969 | 2956 | context.setFontSize(18 * unit) |
2970 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
2957 | + context.fillText("纯实体店", 246 * unit, 650 * unit); | |
2971 | 2958 | |
2972 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
2959 | + context.drawImage(g_path, 388 * unit, 630 * unit, 22 * unit, 22 * unit); | |
2973 | 2960 | context.setFillStyle("red") |
2974 | 2961 | context.setFontSize(18 * unit) |
2975 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
2962 | + context.fillText("官方验证", 420 * unit, 650 * unit); | |
2976 | 2963 | |
2977 | 2964 | } |
2978 | 2965 | |
2979 | 2966 | //---画线--- |
2980 | 2967 | context.setLineWidth(1 * unit) |
2981 | - context.moveTo(32 * unit, 665 * unit) | |
2982 | - context.lineTo(520 * unit, 665 * unit) | |
2968 | + context.moveTo(32 * unit, 662 * unit) | |
2969 | + context.lineTo(520 * unit, 662 * unit) | |
2983 | 2970 | context.stroke(); |
2984 | 2971 | |
2985 | 2972 | //---文字--- |
2986 | 2973 | context.setFillStyle("black") |
2987 | 2974 | // context.setFontSize(22 * unit) |
2988 | 2975 | context.setFontSize(24 * unit) |
2989 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 730 * unit); | |
2976 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 700 * unit); | |
2990 | 2977 | context.setFillStyle("red") |
2991 | 2978 | context.setFontSize(20 * unit) |
2992 | 2979 | var presell_price = `预售价:${th.data.presellList.presell_price}` |
2993 | - context.fillText(presell_price, 40 * unit, 780 * unit); | |
2980 | + context.fillText(presell_price, 40 * unit, 750 * unit); | |
2994 | 2981 | context.setFillStyle("black") |
2995 | 2982 | context.setFontSize(22 * unit) |
2996 | - context.fillText("特惠好物,限时预售", 40 * unit, 826 * unit); | |
2997 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); | |
2983 | + context.fillText("特惠好物,限时预售", 40 * unit, 800 * unit); | |
2984 | + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 840 * unit); | |
2998 | 2985 | |
2999 | 2986 | //---二维吗图--- |
3000 | 2987 | //-- 自定义海报 -- |
... | ... | @@ -3007,8 +2994,6 @@ Page({ |
3007 | 2994 | context.drawImage(vpath, 390 * unit, 746 * unit, 130 * unit, 116 * unit); |
3008 | 2995 | } |
3009 | 2996 | |
3010 | - | |
3011 | - | |
3012 | 2997 | //--- 如果是自定义海报的时候 --- |
3013 | 2998 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
3014 | 2999 | |
... | ... | @@ -3051,6 +3036,13 @@ Page({ |
3051 | 3036 | } |
3052 | 3037 | |
3053 | 3038 | |
3039 | + if(th.data.poster.show_time==1){ | |
3040 | + var act_time=''; | |
3041 | + act_time="截止时间:"+ ut.formatTime(th.data.presellForm.end_time); | |
3042 | + context.setFillStyle("red") | |
3043 | + getApp().draw_Text(context, act_time,38 * unit, 880 * unit, 200 * unit, 340 * unit, unit); | |
3044 | + } | |
3045 | + | |
3054 | 3046 | //把画板内容绘制成图片,并回调 画板图片路径 |
3055 | 3047 | context.draw(false, function () { |
3056 | 3048 | setTimeout(function () { |
... | ... | @@ -3170,490 +3162,7 @@ Page({ |
3170 | 3162 | // 先画背景 |
3171 | 3163 | var pg_path = "../../../../images/share/share_bg.png"; |
3172 | 3164 | |
3173 | - | |
3174 | - //-- 如果有自定义海报的时候,判断背景的图片 -- | |
3175 | - if (th.data.share_b_img) { | |
3176 | - pg_path = th.data.share_b_img; | |
3177 | - } | |
3178 | - // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | |
3179 | - console.log('海报类型-----') | |
3180 | - console.log(type); | |
3181 | - | |
3182 | - if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3 )){ // 如果是普通商品,绘制新海报 | |
3183 | - th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); | |
3184 | - } else { | |
3185 | - context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | |
3186 | - // var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3187 | - // var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3188 | - // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
3189 | - // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | |
3190 | - }; | |
3191 | - | |
3192 | - // th.drawPoster(context, unit, th.data.share_goods_img, vpath); | |
3193 | - | |
3194 | - | |
3195 | - //-- 是自定义海报的情况下 -- | |
3196 | - if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
3197 | - | |
3198 | - if (th.data.poster && parseInt(th.data.poster.style) == 2) { | |
3199 | - //在线上分享人的情况下 | |
3200 | - if (parseInt(th.data.poster.show_headpic)) { | |
3201 | - //获取坐标 | |
3202 | - var x = parseFloat(th.data.poster.head_x) * 2; | |
3203 | - var y = parseFloat(th.data.poster.head_y) * 2; | |
3204 | - var x1 = (x + 90) * unit; | |
3205 | - var y1 = (y + 50) * unit; | |
3206 | - //--昵称--- | |
3207 | - context.setFontSize(24 * unit) | |
3208 | - context.setFillStyle("black") | |
3209 | - context.fillText(app.globalData.userInfo.nickname, x1, y1); | |
3210 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; | |
3211 | - //强烈推荐 改许程 | |
3212 | - var tj_path = "../../../../images/share/q_tj.png"; | |
3213 | - context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); | |
3214 | - context.setFontSize(16 * unit); | |
3215 | - context.setLineJoin('round'); //交点设置成圆角 | |
3216 | - context.setFillStyle("white"); | |
3217 | - context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit); | |
3218 | - | |
3219 | - //context.setFillStyle("black") | |
3220 | - //context.setFontSize(24 * unit) | |
3221 | - //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); | |
3222 | - } | |
3223 | - } else { | |
3224 | - //--昵称--- | |
3225 | - context.setFontSize(24 * unit); | |
3226 | - context.setFillStyle("black"); | |
3227 | - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); | |
3228 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | |
3229 | - //强烈推荐 改许程 | |
3230 | - var tj_path = "../../../../images/share/q_tj.png"; | |
3231 | - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); | |
3232 | - context.setFontSize(16 * unit); | |
3233 | - context.setLineJoin('round'); //交点设置成圆角 | |
3234 | - context.setFillStyle("white"); | |
3235 | - context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); | |
3236 | - } | |
3237 | - | |
3238 | - }; | |
3239 | - | |
3240 | - | |
3241 | - var share_title = th.data.data.goods_name; | |
3242 | - if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) { | |
3243 | - share_title = th.data.prom_act.share_title; | |
3244 | - if (!share_title) share_title = th.data.prom_act.title; | |
3245 | - if (th.data.prom_type == 4) share_title = th.data.prom_act.name; | |
3246 | - } | |
3247 | - | |
3248 | - //---产品名称--- | |
3249 | - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | |
3250 | - if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) { | |
3251 | - context.setFillStyle("black"); | |
3252 | - context.setFontSize(21.3 * unit) | |
3253 | - getApp().draw_Text(context, share_title, | |
3254 | - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); | |
3255 | - | |
3256 | - //------产品的价格------- | |
3257 | - context.setFontSize(23 * unit) | |
3258 | - context.setFillStyle("red") | |
3259 | - | |
3260 | - var pri0 = th.data.data.shop_price; | |
3261 | - if (th.data.card_field && th.data.data[th.data.card_field]) { | |
3262 | - pri0 = th.data.data[th.data.card_field]; | |
3263 | - } | |
3264 | - | |
3265 | - if (th.data.prom_act) | |
3266 | - pri0 = th.data.prom_price; | |
3267 | - pri0 = parseFloat(pri0).toFixed(2); | |
3268 | - var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; | |
3269 | - context.fillText("¥", wd1 - 15, 185 * unit); | |
3270 | - context.setFontSize(31 * unit) | |
3271 | - context.fillText(pri0, wd1, 185 * unit); | |
3272 | - | |
3273 | - //---市场价划掉--- | |
3274 | - /*-- | |
3275 | - context.setFillStyle("gray") | |
3276 | - context.setFontSize(22 * unit) | |
3277 | - pri0 = "¥" + th.data.data.market_price.toFixed(2); | |
3278 | - var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | |
3279 | - context.fillText(pri0, wd2, 213 * unit); | |
3280 | - | |
3281 | - context.setStrokeStyle('gray'); | |
3282 | - context.setLineWidth(1 * unit); | |
3283 | - context.moveTo(wd2 - 5, 206 * unit); | |
3284 | - context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | |
3285 | - context.stroke();--*/ | |
3286 | - | |
3287 | - } else if ( ( type == 4 && type != 0 && type != 1 && type != 2 && type != 3)) { | |
3288 | - context.setFillStyle("black"); | |
3289 | - context.setFontSize(21.3 * unit) | |
3290 | - getApp().draw_Text(context, share_title, | |
3291 | - 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); | |
3292 | - //------ 产品的价格 ----- | |
3293 | - var pri0 = th.data.prom_act.addmoney; | |
3294 | - var integral = th.data.prom_act.integral; | |
3295 | - var text = ""; | |
3296 | - if (integral) { | |
3297 | - text = integral + "积分"; | |
3298 | - } | |
3299 | - if (pri0 && integral) { | |
3300 | - text += "+"; | |
3301 | - } | |
3302 | - if (pri0) { | |
3303 | - text += "¥" + pri0; | |
3304 | - } | |
3305 | - | |
3306 | - if (!pri0 && !integral) { | |
3307 | - text = "0积分"; | |
3308 | - } | |
3309 | - context.setFillStyle("red"); | |
3310 | - context.fillText(text, 38 * unit, 235 * unit); | |
3311 | - | |
3312 | - } | |
3313 | - | |
3314 | - //---中间大图--- | |
3315 | - if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
3316 | - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | |
3317 | - } | |
3318 | - ; | |
3319 | - | |
3320 | - //---自定义海报 产品质量保证 | |
3321 | - if(th.data.share_b_img && th.data.poster.show_quality==1 ){ | |
3322 | - var g_path = "../../../../images/share/s_gou.png"; | |
3323 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3324 | - context.setFillStyle("red") | |
3325 | - context.setFontSize(18 * unit) | |
3326 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
3327 | - | |
3328 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3329 | - context.setFillStyle("red") | |
3330 | - context.setFontSize(18 * unit) | |
3331 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
3332 | - | |
3333 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3334 | - context.setFillStyle("red") | |
3335 | - context.setFontSize(18 * unit) | |
3336 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
3337 | - | |
3338 | - } | |
3339 | - //-------大图后面就不一样了----------- | |
3340 | - switch (type) { | |
3341 | - case 0: | |
3342 | - if(!th.data.share_b_img){ | |
3343 | - break | |
3344 | - } | |
3345 | - //---画线--- | |
3346 | - context.setLineWidth(1 * unit) | |
3347 | - context.moveTo(32 * unit, 710 * unit) | |
3348 | - context.lineTo(520 * unit, 710 * unit) | |
3349 | - context.stroke(); | |
3350 | - //---文字--- | |
3351 | - context.setFillStyle("black") | |
3352 | - context.setFontSize(22 * unit) | |
3353 | - // 原来start ---> | |
3354 | - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit); | |
3355 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit); | |
3356 | - // <--- 原来end | |
3357 | - // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit); | |
3358 | - // context.setFontSize(18 * unit) | |
3359 | - // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit); | |
3360 | - //---二维吗图--- | |
3361 | - context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); | |
3362 | - break;//普通商品的展示 | |
3363 | - case 4: | |
3364 | - // 中间的几个字 | |
3365 | - if (th.data.poster && parseInt(th.data.poster.style) == 2) { | |
3366 | - if (parseInt(th.data.poster.show_quality)) { | |
3367 | - var g_path = "../../../../images/share/s_gou.png"; | |
3368 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3369 | - context.setFillStyle("red") | |
3370 | - context.setFontSize(18 * unit) | |
3371 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
3372 | - | |
3373 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3374 | - context.setFillStyle("red") | |
3375 | - context.setFontSize(18 * unit) | |
3376 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
3377 | - | |
3378 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3379 | - context.setFillStyle("red") | |
3380 | - context.setFontSize(18 * unit) | |
3381 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
3382 | - } | |
3383 | - | |
3384 | - } else { | |
3385 | - var g_path = "../../../../images/share/s_gou.png"; | |
3386 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3387 | - context.setFillStyle("red") | |
3388 | - context.setFontSize(18 * unit) | |
3389 | - context.fillText("正品保证", 84 * unit, 690 * unit); | |
3390 | - | |
3391 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3392 | - context.setFillStyle("red") | |
3393 | - context.setFontSize(18 * unit) | |
3394 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | |
3395 | - | |
3396 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | |
3397 | - context.setFillStyle("red") | |
3398 | - context.setFontSize(18 * unit) | |
3399 | - context.fillText("官方验证", 420 * unit, 690 * unit); | |
3400 | - } | |
3401 | - | |
3402 | - | |
3403 | - //---画线--- | |
3404 | - context.setLineWidth(1 * unit) | |
3405 | - context.moveTo(32 * unit, 710 * unit) | |
3406 | - context.lineTo(520 * unit, 710 * unit) | |
3407 | - context.stroke(); | |
3408 | - | |
3409 | - //---文字--- | |
3410 | - context.setFillStyle("black") | |
3411 | - context.setFontSize(22 * unit) | |
3412 | - | |
3413 | - if (type == 0 || type == -1) { | |
3414 | - // 原来start ---> | |
3415 | - context.setFontSize(24 * unit) | |
3416 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | |
3417 | - | |
3418 | - context.setFontSize(22 * unit) | |
3419 | - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit); | |
3420 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit); | |
3421 | - | |
3422 | - } else { | |
3423 | - context.setFontSize(24 * unit) | |
3424 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | |
3425 | - context.setFontSize(22 * unit) | |
3426 | - context.fillText("长按识别二维码", 40 * unit, 806 * unit); | |
3427 | - context.fillText("立即开始兑换", 40 * unit, 846 * unit); | |
3428 | - | |
3429 | - } | |
3430 | - | |
3431 | - //---二维吗图--- | |
3432 | - //-- 自定义海报 -- | |
3433 | - if (th.data.share_b_img || th.data.poster) { | |
3434 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3435 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3436 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
3437 | - } else { | |
3438 | - //---二维吗图--- | |
3439 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
3440 | - } | |
3441 | - ; | |
3442 | - | |
3443 | - break; | |
3444 | - case 1: //秒杀商品的展示 | |
3445 | - if(!th.data.share_b_img){ | |
3446 | - break | |
3447 | - } | |
3448 | - //---画线--- | |
3449 | - context.setLineWidth(1 * unit) | |
3450 | - context.moveTo(32 * unit, 670 * unit) | |
3451 | - context.lineTo(520 * unit, 670 * unit) | |
3452 | - context.stroke(); | |
3453 | - | |
3454 | - //画秒杀的图片 | |
3455 | - var miaos_path = '../../../../images/share/miao_share.png'; | |
3456 | - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); | |
3457 | - | |
3458 | - context.setFillStyle("black") | |
3459 | - context.setFontSize(24 * unit) | |
3460 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit); | |
3461 | - //---文字--- | |
3462 | - context.setFontSize(22 * unit) | |
3463 | - context.setFillStyle("black") | |
3464 | - context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit); | |
3465 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); | |
3466 | - | |
3467 | - | |
3468 | - //---二维吗图--- | |
3469 | - //-- 自定义海报 -- | |
3470 | - if (th.data.share_b_img || th.data.poster) { | |
3471 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3472 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3473 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); | |
3474 | - } else { | |
3475 | - //---二维吗图--- | |
3476 | - context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit); | |
3477 | - } | |
3478 | - break; | |
3479 | - | |
3480 | - case 2: //会员团和商家团的展示 | |
3481 | - if(!th.data.share_b_img){ | |
3482 | - break | |
3483 | - } | |
3484 | - //---画线--- | |
3485 | - context.setLineWidth(1 * unit) | |
3486 | - context.moveTo(32 * unit, 670 * unit) | |
3487 | - context.lineTo(520 * unit, 670 * unit) | |
3488 | - context.stroke(); | |
3489 | - //---文字--- | |
3490 | - context.setFillStyle("black") | |
3491 | - context.setFontSize(24 * unit) | |
3492 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | |
3493 | - | |
3494 | - //绘制成团图片 | |
3495 | - var ct_img = "../../../../images/share/ct_num.png"; | |
3496 | - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); | |
3497 | - var ct_num = th.data.prom_act.ct_num; | |
3498 | - context.setFontSize(14 * unit) | |
3499 | - context.font = 'normal'; | |
3500 | - context.setFillStyle("red") | |
3501 | - if (ct_num < 10) { | |
3502 | - context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit); | |
3503 | - } else { | |
3504 | - context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit); | |
3505 | - } | |
3506 | - context.setFontSize(22 * unit) | |
3507 | - context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit); | |
3508 | - | |
3509 | - context.setFillStyle("gray") | |
3510 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit); | |
3511 | - context.setFillStyle("black") | |
3512 | - context.font = 'normal bold 18px sans-serif'; | |
3513 | - context.setFontSize(21.3 * unit) | |
3514 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit); | |
3515 | - | |
3516 | - | |
3517 | - //---二维吗图--- | |
3518 | - //-- 自定义海报 -- | |
3519 | - if (th.data.share_b_img || th.data.poster) { | |
3520 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3521 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3522 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
3523 | - } else { | |
3524 | - //---二维吗图--- | |
3525 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
3526 | - } | |
3527 | - break | |
3528 | - case 3: //阶梯团的展示 | |
3529 | - if(!th.data.share_b_img){ | |
3530 | - break | |
3531 | - } | |
3532 | - //---画线--- | |
3533 | - context.setLineWidth(1 * unit) | |
3534 | - context.moveTo(32 * unit, 670 * unit) | |
3535 | - context.lineTo(520 * unit, 670 * unit) | |
3536 | - context.stroke(); | |
3537 | - //---文字--- | |
3538 | - context.setFillStyle("black") | |
3539 | - context.setFontSize(24 * unit) | |
3540 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | |
3541 | - | |
3542 | - //---绘制中间阶梯的价格--- | |
3543 | - var list = th.data.prom_act.ct_rylist; | |
3544 | - for (var i = 0; i < list.length; i++) { | |
3545 | - var item = list[i]; | |
3546 | - var wi = i * 90 * unit; | |
3547 | - context.font = 'normal'; | |
3548 | - context.setFontSize(16 * unit) | |
3549 | - context.setFillStyle("red") | |
3550 | - context.fillText("¥", 40 * unit + wi, 756 * unit); | |
3551 | - context.setFontSize(22 * unit) | |
3552 | - var pri = parseFloat(item.price).toFixed(2); | |
3553 | - context.fillText(pri, 56 * unit + wi, 756 * unit); | |
3554 | - context.setFillStyle("gray") | |
3555 | - context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit); | |
3556 | - } | |
3557 | - //----------------下面部分---------------- | |
3558 | - | |
3559 | - context.setFillStyle("black") | |
3560 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit); | |
3561 | - //context.font = 'normal bold 18px sans-serif'; | |
3562 | - context.setFontSize(21 * unit) | |
3563 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit); | |
3564 | - | |
3565 | - | |
3566 | - //-- 自定义海报 -- | |
3567 | - if (th.data.share_b_img || th.data.poster) { | |
3568 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3569 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3570 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | |
3571 | - } else { | |
3572 | - //---二维吗图--- | |
3573 | - context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); | |
3574 | - } | |
3575 | - break | |
3576 | - | |
3577 | - | |
3578 | - case -1: //秒杀商品的展示 | |
3579 | - //---画线--- | |
3580 | - context.setLineWidth(1 * unit) | |
3581 | - context.moveTo(32 * unit, 670 * unit) | |
3582 | - context.lineTo(520 * unit, 670 * unit) | |
3583 | - context.stroke(); | |
3584 | - | |
3585 | - | |
3586 | - context.setFillStyle("black") | |
3587 | - context.setFontSize(24 * unit) | |
3588 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 744 * unit); | |
3589 | - //---文字--- | |
3590 | - context.setFontSize(22 * unit) | |
3591 | - context.setFillStyle("black") | |
3592 | - context.fillText("长按识别二维码", 40 * unit, 800 * unit); | |
3593 | - context.fillText("立即开始抢购", 40 * unit, 846 * unit); | |
3594 | - | |
3595 | - | |
3596 | - //---二维吗图--- | |
3597 | - //-- 自定义海报 -- | |
3598 | - if (th.data.share_b_img || th.data.poster) { | |
3599 | - var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | |
3600 | - var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | |
3601 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); | |
3602 | - } else { | |
3603 | - //---二维吗图--- | |
3604 | - context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit); | |
3605 | - } | |
3606 | - break; | |
3607 | - | |
3608 | - | |
3609 | - } | |
3610 | - | |
3611 | - | |
3612 | - //--- 如果是自定义海报的时候 --- | |
3613 | - if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
3614 | - | |
3615 | - if (th.data.poster && parseInt(th.data.poster.style) == 2) { | |
3616 | - | |
3617 | - //如果显示会员信息的话 | |
3618 | - if (parseInt(th.data.poster.show_headpic)) { | |
3619 | - //获取坐标 | |
3620 | - var x = parseFloat(th.data.poster.head_x) * 2; | |
3621 | - var y = parseFloat(th.data.poster.head_y) * 2; | |
3622 | - //---绘制圆形要放在最后---- | |
3623 | - context.save(); | |
3624 | - context.beginPath(); | |
3625 | - var h_x = x * unit; | |
3626 | - var h_y = y * unit; | |
3627 | - var h_r = 40 * unit; | |
3628 | - var cx = h_x + h_r; | |
3629 | - var cy = h_y + h_r; | |
3630 | - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | |
3631 | - context.closePath(); | |
3632 | - context.fill(); | |
3633 | - context.clip(); | |
3634 | - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | |
3635 | - context.restore(); | |
3636 | - } | |
3637 | - | |
3638 | - } else { | |
3639 | - //---绘制圆形要放在最后---- | |
3640 | - context.save(); | |
3641 | - context.beginPath(); | |
3642 | - var h_x = 60 * unit; | |
3643 | - var h_y = 24 * unit; | |
3644 | - var h_r = 40 * unit; | |
3645 | - var cx = h_x + h_r; | |
3646 | - var cy = h_y + h_r; | |
3647 | - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | |
3648 | - context.closePath(); | |
3649 | - context.fill(); | |
3650 | - context.clip(); | |
3651 | - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | |
3652 | - context.restore(); | |
3653 | - } | |
3654 | - | |
3655 | - } | |
3656 | - ; | |
3165 | + th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); | |
3657 | 3166 | |
3658 | 3167 | |
3659 | 3168 | //把画板内容绘制成图片,并回调 画板图片路径 |
... | ... | @@ -3729,144 +3238,126 @@ Page({ |
3729 | 3238 | } |
3730 | 3239 | } |
3731 | 3240 | }, |
3241 | + | |
3732 | 3242 | drawPoster(context, unit, img, vpath, type) { |
3733 | - // 1.灰色背景 | |
3734 | - context.setFillStyle('#f2f1f6'); | |
3735 | - context.rect(0, 0, 554 * unit, 899 * unit); | |
3736 | - context.fill(); | |
3737 | - | |
3738 | - // 2.商城名称 | |
3739 | - let shopName = this.data.sto_sele_name_1; | |
3740 | - context.setTextAlign('center'); | |
3741 | - context.setFontSize(26 * unit); | |
3742 | - context.setFillStyle('black'); | |
3743 | - context.fillText(shopName, 277 * unit, 60 * unit); | |
3744 | - | |
3745 | - // 3.推荐来源 | |
3746 | - let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | |
3747 | - context.setTextAlign('center'); | |
3748 | - context.setFontSize(22 * unit); | |
3749 | - context.setFillStyle('#96959a'); | |
3750 | - context.fillText(fromText, 277 * unit, 105 * unit); | |
3751 | - | |
3752 | - // 4.海报背景 | |
3753 | - context.setFillStyle('white'); | |
3754 | - context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); | |
3755 | - | |
3756 | - // 5.商品图片 | |
3757 | - // 图片的x坐标 | |
3758 | - let bg_x = 37 * unit | |
3759 | - // 图片的y坐标 | |
3760 | - let bg_y = 157 * unit | |
3761 | - // 图片宽度 | |
3762 | - let bg_w = 480 * unit | |
3763 | - // 图片高度 | |
3764 | - let bg_h = 474 * unit | |
3765 | - // 图片圆角 | |
3766 | - let bg_r = 4 | |
3767 | - // 绘制海报背景图片圆角 | |
3768 | - context.save() | |
3769 | - context.beginPath() | |
3770 | - context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) | |
3771 | - context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) | |
3772 | - context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) | |
3773 | - context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) | |
3774 | - context.clip() | |
3775 | - context.drawImage(img, bg_x, bg_y, bg_w, bg_h); | |
3776 | - context.restore(); | |
3777 | - | |
3778 | - // 6.强烈推荐 | |
3779 | - let src = ''; | |
3780 | - context.beginPath(); | |
3781 | - if(type == 0) { // 普通 | |
3782 | - src = '../../../../images/share/q_tj.png'; | |
3783 | - context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit); | |
3784 | - context.setFontSize(16 * unit) | |
3785 | - context.setFillStyle("white") | |
3786 | - context.setTextAlign('left'); | |
3787 | - context.fillText('强烈推荐', 64 * unit, 668 * unit); | |
3788 | - }; | |
3789 | - if(type == 1) { // 秒杀 | |
3790 | - src = '../../../images/share/miao_share.png'; | |
3791 | - context.drawImage(src, 54 * unit, 648 * unit, 200 * unit, 36 * unit); | |
3792 | - context.setTextAlign('left'); | |
3793 | - }; | |
3794 | - if(type == 2) { // 商家和会员团 | |
3795 | - src = '../../../images/share/ct_num.png'; | |
3796 | - context.drawImage(src, 54 * unit, 648 * unit, 120 * unit, 30 * unit); | |
3797 | - context.setTextAlign('left'); | |
3798 | - | |
3799 | - let ct_num = self.data.prom_act.ct_num; | |
3800 | - context.setFontSize(16 * unit) | |
3801 | - context.font = 'normal'; | |
3802 | - context.setFillStyle("red") | |
3803 | - if (ct_num < 10) { | |
3804 | - context.fillText(ct_num + "人拼团", 100 * unit, 670 * unit); | |
3805 | - } else { | |
3806 | - context.fillText(ct_num + "人拼团", 96 * unit, 670 * unit); | |
3807 | - } | |
3808 | - context.setFontSize(22 * unit) | |
3809 | - context.fillText("已拼" + self.data.prom_act.buy_num + "份", 186 * unit, 672 * unit); | |
3810 | - }; | |
3811 | - if(type == 3) { // 阶梯团 | |
3812 | - let list = self.data.prom_act.ct_rylist; | |
3813 | - for (let i = 0; i < list.length; i++) { | |
3814 | - let item = list[i]; | |
3815 | - let wi = i * 90 * unit; | |
3816 | - context.font = 'normal'; | |
3817 | - context.setTextAlign('left'); | |
3818 | - context.setFontSize(16 * unit) | |
3819 | - context.setFillStyle("red") | |
3820 | - context.fillText("¥", 50 * unit + wi, 680 * unit); | |
3821 | - context.setFontSize(22 * unit) | |
3822 | - let pri = parseFloat(item.price).toFixed(2); | |
3823 | - context.fillText(pri, 66 * unit + wi, 680 * unit); | |
3824 | - context.setFillStyle("gray") | |
3825 | - context.fillText("满" + item.rynum + "人", 50 * unit + wi, 716 * unit); | |
3826 | - } | |
3827 | - }; | |
3828 | - | |
3829 | - // 7.商品价格 | |
3830 | - if(type != 3) { | |
3831 | - let price = this.data.data.shop_price; | |
3832 | - if (this.data.card_field && this.data.data[this.data.card_field]) { | |
3833 | - price = this.data.data[this.data.card_field]; | |
3834 | - } | |
3835 | - if (this.data.prom_act) price = this.data.prom_price; | |
3836 | - price = parseFloat(price).toFixed(2); | |
3837 | - context.setFontSize(32 * unit); | |
3838 | - context.setFillStyle('#DE1117'); | |
3839 | - if (this.data.prom_type == 4 && this.data.prom_integral){ | |
3840 | - context.fillText(this.data.prom_integral+'积分+¥' + price, 54 * unit, 735 * unit); | |
3841 | - }else{ | |
3842 | - if(this.data.prom_type ==8){ | |
3843 | - price = this.data.presellList.presell_price | |
3844 | - context.fillText('¥' + price, 54 * unit, 735 * unit); | |
3845 | - }else{ | |
3846 | - context.fillText('¥' + price, 54 * unit, 735 * unit); | |
3847 | - } | |
3848 | - } | |
3849 | - | |
3243 | + // 1.灰色背景 | |
3244 | + context.setFillStyle('#f2f1f6'); | |
3245 | + context.rect(0, 0, 554 * unit, 899 * unit); | |
3246 | + context.fill(); | |
3247 | + | |
3248 | + // 2.商城名称 | |
3249 | + let shopName = this.data.sto_sele_name_1; | |
3250 | + context.setTextAlign('center'); | |
3251 | + context.setFontSize(26 * unit); | |
3252 | + context.setFillStyle('black'); | |
3253 | + context.fillText(shopName, 277 * unit, 60 * unit); | |
3254 | + | |
3255 | + // 3.推荐来源 | |
3256 | + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | |
3257 | + context.setTextAlign('center'); | |
3258 | + context.setFontSize(22 * unit); | |
3259 | + context.setFillStyle('#96959a'); | |
3260 | + context.fillText(fromText, 277 * unit, 105 * unit); | |
3261 | + | |
3262 | + // 4.海报背景 | |
3263 | + context.setFillStyle('white'); | |
3264 | + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); | |
3265 | + | |
3266 | + // 5.商品图片 | |
3267 | + // 图片的x坐标 | |
3268 | + let bg_x = 37 * unit | |
3269 | + // 图片的y坐标 | |
3270 | + let bg_y = 157 * unit | |
3271 | + // 图片宽度 | |
3272 | + let bg_w = 480 * unit | |
3273 | + // 图片高度 | |
3274 | + let bg_h = 474 * unit | |
3275 | + // 图片圆角 | |
3276 | + let bg_r = 4 | |
3277 | + // 绘制海报背景图片圆角 | |
3278 | + context.save() | |
3279 | + context.beginPath() | |
3280 | + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) | |
3281 | + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) | |
3282 | + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) | |
3283 | + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) | |
3284 | + context.clip() | |
3285 | + context.drawImage(img, bg_x, bg_y, bg_w, bg_h); | |
3286 | + context.restore(); | |
3287 | + | |
3288 | + // 6.强烈推荐 | |
3289 | + let src = ''; | |
3290 | + context.beginPath(); | |
3291 | + if (type == 0) { // 普通 | |
3292 | + src = '../../../../images/share/q_tj.png'; | |
3293 | + context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit); | |
3294 | + context.setFontSize(16 * unit) | |
3295 | + context.setFillStyle("white") | |
3296 | + context.setTextAlign('left'); | |
3297 | + context.fillText('强烈推荐', 64 * unit, 668 * unit); | |
3298 | + } | |
3299 | + | |
3300 | + | |
3301 | + // 7.商品价格 | |
3302 | + let price = this.data.data.shop_price; | |
3303 | + if (this.data.card_field && this.data.data[this.data.card_field]) { | |
3304 | + price = this.data.data[this.data.card_field]; | |
3305 | + } | |
3306 | + if (this.data.prom_act) price = this.data.prom_price; | |
3307 | + price = parseFloat(price).toFixed(2); | |
3308 | + context.setFontSize(32 * unit); | |
3309 | + context.setFillStyle('#DE1117'); | |
3310 | + | |
3311 | + price = this.data.presellList.presell_price | |
3312 | + context.fillText('¥' + price, 54 * unit, 735 * unit); | |
3313 | + | |
3314 | + | |
3315 | + //-- 零售价的优化 -- | |
3316 | + var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit); | |
3317 | + var hp=735 * unit | |
3318 | + this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit); | |
3319 | + | |
3320 | + | |
3321 | + // 8.商品标题 | |
3322 | + context.setFontSize(20 * unit); | |
3323 | + context.setFillStyle('#898989'); | |
3324 | + getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1); | |
3325 | + | |
3326 | + // 9.小程序码 | |
3327 | + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); | |
3328 | + context.setFontSize(16 * unit); | |
3329 | + context.setFillStyle('#777'); | |
3330 | + context.fillText('长按识别二维码', 378 * unit, 810 * unit); | |
3331 | + | |
3332 | + // 10.竖线 | |
3333 | + context.beginPath(); | |
3334 | + context.setFillStyle('#eee'); | |
3335 | + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); | |
3336 | + context.fill(); | |
3337 | + }, | |
3338 | + | |
3339 | + | |
3340 | + //---市场价划掉--- | |
3341 | + draw_pos_price(context,w,h,market_price,unit){ | |
3342 | + | |
3343 | + if(!this.data.sys_switch) return false; | |
3344 | + if(!this.data.sys_switch.is_retail_price) return false; | |
3345 | + | |
3346 | + context.setFillStyle("gray") | |
3347 | + context.setFontSize(22 * unit) | |
3348 | + var pri0 = "¥" + market_price.toFixed(2); | |
3349 | + context.fillText(pri0, w, h); | |
3350 | + | |
3351 | + var c_h=h-6; | |
3352 | + context.setStrokeStyle('gray'); | |
3353 | + context.setLineWidth(1 * unit); | |
3354 | + context.moveTo(w - 5, c_h); | |
3355 | + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h); | |
3356 | + context.stroke(); | |
3850 | 3357 | |
3851 | - }; | |
3852 | - | |
3853 | - // 8.商品标题 | |
3854 | - context.setFontSize(20 * unit); | |
3855 | - context.setFillStyle('#898989'); | |
3856 | - getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1); | |
3857 | - | |
3858 | - // 9.小程序码 | |
3859 | - context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); | |
3860 | - context.setFontSize(16 * unit); | |
3861 | - context.setFillStyle('#777'); | |
3862 | - context.fillText('长按识别二维码', 378 * unit, 810 * unit); | |
3863 | - | |
3864 | - // 10.竖线 | |
3865 | - context.beginPath(); | |
3866 | - context.setFillStyle('#eee'); | |
3867 | - context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); | |
3868 | - context.fill(); | |
3869 | 3358 | }, |
3359 | + | |
3360 | + | |
3870 | 3361 | // ----视频图片---- |
3871 | 3362 | // 图片计数器 |
3872 | 3363 | swiperChange: function (e) { | ... | ... |
pages/giftpack/giftpacklist/giftpacklist.js
... | ... | @@ -1104,6 +1104,10 @@ Page({ |
1104 | 1104 | context.fillText(price_txt, 54 * unit, 735 * unit); |
1105 | 1105 | |
1106 | 1106 | |
1107 | + var wp= 62 * unit; | |
1108 | + var hp=765 * unit | |
1109 | + this.draw_pos_price(context,wp,hp,this.giftPosPrice,unit); | |
1110 | + | |
1107 | 1111 | // 8.商品标题 |
1108 | 1112 | context.setFontSize(20 * unit); |
1109 | 1113 | context.setFillStyle('#898989'); |
... | ... | @@ -1122,6 +1126,26 @@ Page({ |
1122 | 1126 | context.fill(); |
1123 | 1127 | }, |
1124 | 1128 | |
1129 | + | |
1130 | + //---市场价划掉--- | |
1131 | + draw_pos_price(context,w,h,market_price,unit){ | |
1132 | + | |
1133 | + if(!this.is_retail_price) return false; | |
1134 | + | |
1135 | + context.setFillStyle("gray") | |
1136 | + context.setFontSize(22 * unit) | |
1137 | + var pri0 = "¥" + market_price.toFixed(2); | |
1138 | + context.fillText(pri0, w, h); | |
1139 | + | |
1140 | + var c_h=h-6; | |
1141 | + context.setStrokeStyle('gray'); | |
1142 | + context.setLineWidth(1 * unit); | |
1143 | + context.moveTo(w - 5, c_h); | |
1144 | + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h); | |
1145 | + context.stroke(); | |
1146 | + | |
1147 | + }, | |
1148 | + | |
1125 | 1149 | //--获取商品图片的本地缓存,回调写法-- |
1126 | 1150 | get_goods_temp: function (tt) { |
1127 | 1151 | var ee = this; | ... | ... |
pages/goods/categoryList/categoryList.wxml
... | ... | @@ -292,7 +292,8 @@ |
292 | 292 | |
293 | 293 | <!-- 品类--> |
294 | 294 | <block wx:if="{{is_show_pl&&select_classify_on!=221&&select_classify_on!=220&&select_classify_on!=223}}"> |
295 | - <block wx:if="{{select_classify_on!=221&&select_classify_on!=220&&select_classify_on!=223&&is_level_three!=1}}"> | |
295 | + <!-- <block wx:if="{{select_classify_on!=221&&select_classify_on!=220&&select_classify_on!=223&&is_level_three!=1}}"> --> | |
296 | + <block> | |
296 | 297 | <!-- <block wx:if="{{select_classify_on == 0&&is_level_three!=1}}"> --> |
297 | 298 | <view class="my-container"> |
298 | 299 | <view class="classify_name fs28 flex-space-between ai-center" data-pid="0" data-cid="{{cat_id}}" bindtap='select_more'> |
... | ... | @@ -303,7 +304,7 @@ |
303 | 304 | </view> |
304 | 305 | </view> |
305 | 306 | <!-- 显示2级列表 --> |
306 | - <view class="classify_content-frame flex-wrap"> | |
307 | + <!-- <view class="classify_content-frame flex-wrap"> | |
307 | 308 | <block wx:if="{{goodslist && goodslist.length>0}}"> |
308 | 309 | <block wx:for="{{goodslist}}" wx:for-item="goods" wx:for-index="indx"> |
309 | 310 | <view class="type_img_frame t-c ib" data-cid="{{goods.items.id}}" data-pid="{{goods.items.parent_id}}" bindtap="go_cate"> |
... | ... | @@ -315,19 +316,20 @@ |
315 | 316 | <block wx:else> |
316 | 317 | <view class="no_child_lev fs28">该类别无子级</view> |
317 | 318 | </block> |
318 | - </view> | |
319 | + </view> --> | |
319 | 320 | |
320 | 321 | </view> |
321 | 322 | </block> |
322 | 323 | |
323 | 324 | <!-- 商品 含有3级的--> |
324 | - <block wx:if="{{select_classify_on!=220&&select_classify_on!=221&&select_classify_on!=223&&is_level_three==1}}"> | |
325 | + <!-- <block wx:if="{{select_classify_on!=220&&select_classify_on!=221&&select_classify_on!=223&&is_level_three==1}}"> --> | |
326 | + <block> | |
325 | 327 | <block wx:for="{{goodslist}}" wx:for-item="goods" wx:for-index="inds"> |
326 | 328 | <view> |
327 | 329 | |
328 | 330 | <view class="classify_name fs28 flex-space-between ai-center" data-pid="{{goods.items.parent_id}}" data-cid="{{goods.items.id}}" bindtap='select_more'> |
329 | 331 | |
330 | - <view class="classify_title ellipsis-1">{{goods.items.name}}</view> | |
332 | + <view class="classify_title ellipsis-1" style="margin-left: 25rpx;">{{goods.items.name}}</view> | |
331 | 333 | <view class="flex select_more ai-center"> |
332 | 334 | <view class="red-co fs24">更多</view> |
333 | 335 | <view class="bg_right width_height" style="margin-top: 0;"></view> |
... | ... | @@ -335,7 +337,7 @@ |
335 | 337 | </view> |
336 | 338 | |
337 | 339 | <block wx:if="{{goods.arrays.length>0}}"> |
338 | - <view class="classify_content-frame flex-wrap"> | |
340 | + <view class="classify_content-frame flex-wrap" style="margin-left: 50rpx;"> | |
339 | 341 | <view class="type_img_frame t-c ib" data-cid="{{item.id}}" data-pid="three" wx:for="{{goods.arrays}}" wx:for-index="index" wx:for-item="item" bindtap="go_cate"> |
340 | 342 | <image class=" type_img" src="{{item.icoimg==null||item.icoimg==''?iurl+'/miniapp/images/no_cate_def.png':item.icoimg}}" binderror="goods_bnerr" data-err="goodslist[{{index}}].logo"></image> |
341 | 343 | <view class="brand_img_name fs24 ellipsis-1 pdh10">{{item.name}}</view> | ... | ... |
pages/goods/categoryList/categoryList.wxss
pages/goods/goodsInfo/goodsInfo.js
... | ... | @@ -5371,13 +5371,15 @@ Page({ |
5371 | 5371 | let pri = parseFloat(item.price).toFixed(2); |
5372 | 5372 | context.fillText(pri, 66 * unit + wi, 680 * unit); |
5373 | 5373 | |
5374 | - var wp = 62 * unit + wi + ut.measureText('¥' + pri, 32 * unit); | |
5375 | - var hp = 735 * unit | |
5376 | - self.draw_pos_price(context, wp, hp, self.data.data.market_price, unit); | |
5377 | 5374 | |
5378 | 5375 | context.setFillStyle("gray") |
5379 | 5376 | context.fillText("满" + item.rynum + "人", 50 * unit + wi, 716 * unit); |
5380 | 5377 | } |
5378 | + | |
5379 | + | |
5380 | + var wp= 52 * unit; | |
5381 | + var hp=755 * unit | |
5382 | + self.draw_pos_price(context,wp,hp,self.data.data.market_price,unit); | |
5381 | 5383 | } |
5382 | 5384 | |
5383 | 5385 | |
... | ... | @@ -5394,16 +5396,16 @@ Page({ |
5394 | 5396 | if (this.data.prom_type == 4 && this.data.prom_integral) { |
5395 | 5397 | context.fillText(this.data.prom_integral + '积分+¥' + price, 54 * unit, 735 * unit); |
5396 | 5398 | |
5397 | - var wp = 62 * unit + ut.measureText(this.data.prom_integral + '积分+¥' + price, 32 * unit); | |
5398 | - var hp = 735 * unit | |
5399 | - this.draw_pos_price(context, wp, hp, this.data.data.market_price, unit); | |
5399 | + var wp= 62 * unit+ut.measureText(this.data.prom_integral + '积分+¥' + price, 32 * unit); | |
5400 | + var hp=735 * unit | |
5401 | + this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit); | |
5400 | 5402 | |
5401 | 5403 | } else { |
5402 | 5404 | context.fillText('¥' + price, 54 * unit, 735 * unit); |
5403 | 5405 | |
5404 | - var wp = 62 * unit + ut.measureText('¥' + price, 32 * unit); | |
5405 | - var hp = 735 * unit | |
5406 | - this.draw_pos_price(context, wp, hp, this.data.data.market_price, unit); | |
5406 | + var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit); | |
5407 | + var hp=735 * unit | |
5408 | + this.draw_pos_price(context,wp,hp,this.data.data.market_price,unit); | |
5407 | 5409 | |
5408 | 5410 | } |
5409 | 5411 | |
... | ... | @@ -5429,17 +5431,17 @@ Page({ |
5429 | 5431 | }, |
5430 | 5432 | |
5431 | 5433 | //---市场价划掉--- |
5432 | - draw_pos_price(context, w, h, market_price, unit) { | |
5434 | + draw_pos_price(context,w,h,market_price,unit){ | |
5433 | 5435 | |
5434 | - if (!this.data.sys_switch) return false; | |
5435 | - if (!this.data.sys_switch.is_retail_price) return false; | |
5436 | + if(!this.data.sys_switch) return false; | |
5437 | + if(!this.data.sys_switch.is_retail_price) return false; | |
5436 | 5438 | |
5437 | 5439 | context.setFillStyle("gray") |
5438 | 5440 | context.setFontSize(22 * unit) |
5439 | 5441 | var pri0 = "¥" + market_price.toFixed(2); |
5440 | 5442 | context.fillText(pri0, w, h); |
5441 | 5443 | |
5442 | - var c_h = h - 6; | |
5444 | + var c_h=h-6; | |
5443 | 5445 | context.setStrokeStyle('gray'); |
5444 | 5446 | context.setLineWidth(1 * unit); |
5445 | 5447 | context.moveTo(w - 5, c_h); |
... | ... | @@ -5456,16 +5458,12 @@ Page({ |
5456 | 5458 | var user_info = getApp().globalData.userInfo; |
5457 | 5459 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
5458 | 5460 | //getApp().my_warnning("请先登录",0,this); |
5459 | - wx.navigateTo({ | |
5460 | - url: '/packageE/pages/togoin/togoin', | |
5461 | - }) | |
5461 | + wx.navigateTo({url: '/packageE/pages/togoin/togoin',}) | |
5462 | 5462 | return false; |
5463 | 5463 | } |
5464 | 5464 | |
5465 | 5465 | if (this.data.share_hidden) { |
5466 | - this.setData({ | |
5467 | - share_hidden: false, | |
5468 | - }); | |
5466 | + this.setData({share_hidden: false,}); | |
5469 | 5467 | }; |
5470 | 5468 | |
5471 | 5469 | //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 |
... | ... | @@ -5482,18 +5480,15 @@ Page({ |
5482 | 5480 | if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; |
5483 | 5481 | console.log('商品类型。。。。。'); |
5484 | 5482 | console.log(type); |
5485 | - wx.showLoading({ | |
5486 | - title: '生成中...', | |
5487 | - }) | |
5488 | - var that = this, | |
5489 | - th = that; | |
5483 | + wx.showLoading({title: '生成中...',}) | |
5484 | + var that = this, th = that; | |
5490 | 5485 | //设置画板显示,才能开始绘图 |
5491 | 5486 | that.setData({ |
5492 | 5487 | canvasHidden: false |
5493 | 5488 | }) |
5494 | 5489 | |
5495 | 5490 | var app = getApp(); |
5496 | - var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | |
5491 | + var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | |
5497 | 5492 | var path2 = that.data.data.original_img; |
5498 | 5493 | var scene = th.data.gid + ""; |
5499 | 5494 | scene += "." + th.data.sele_g.prom_type + "." + th.data.sele_g.prom_id; |
... | ... | @@ -5510,7 +5505,7 @@ Page({ |
5510 | 5505 | } |
5511 | 5506 | ///二微码 |
5512 | 5507 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
5513 | - os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; | |
5508 | + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; | |
5514 | 5509 | |
5515 | 5510 | console.log(path3); |
5516 | 5511 | |
... | ... | @@ -5535,7 +5530,7 @@ Page({ |
5535 | 5530 | console.log('海报类型-----') |
5536 | 5531 | console.log(type); |
5537 | 5532 | |
5538 | - if (!th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3)) { // 如果是普通商品,绘制新海报 | |
5533 | + if ( !th.data.share_b_img && (type == 0 || type == 1 || type == 2 || type == 3 )){ // 如果是普通商品,绘制新海报 | |
5539 | 5534 | th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); |
5540 | 5535 | } else { |
5541 | 5536 | context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); |
... | ... | @@ -5546,10 +5541,10 @@ Page({ |
5546 | 5541 | }; |
5547 | 5542 | |
5548 | 5543 | |
5549 | - | |
5544 | + var act_time=''; | |
5550 | 5545 | |
5551 | 5546 | //-- 是自定义海报的情况下 -- |
5552 | - if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
5547 | + if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
5553 | 5548 | |
5554 | 5549 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
5555 | 5550 | //在线上分享人的情况下 |
... | ... | @@ -5595,19 +5590,27 @@ Page({ |
5595 | 5590 | |
5596 | 5591 | |
5597 | 5592 | var share_title = th.data.data.goods_name; |
5593 | + | |
5594 | + | |
5598 | 5595 | if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) { |
5599 | 5596 | share_title = th.data.prom_act.share_title; |
5600 | 5597 | if (!share_title) share_title = th.data.prom_act.title; |
5601 | 5598 | if (th.data.prom_type == 4) share_title = th.data.prom_act.name; |
5599 | + | |
5600 | + //-- 显示活动时间 -- | |
5601 | + if(th.data.share_b_img) { | |
5602 | + act_time="截止时间:"+ ut.formatTime(th.data.prom_act.end_time); | |
5603 | + } | |
5602 | 5604 | } |
5603 | 5605 | |
5604 | 5606 | //---产品名称--- |
5605 | 5607 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
5606 | - if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) { | |
5608 | + if (th.data.share_b_img || (type != 4 && type != 0 && type != 1 && type != 2 && type != 3)) { | |
5607 | 5609 | context.setFillStyle("black"); |
5608 | 5610 | context.setFontSize(21.3 * unit) |
5609 | 5611 | getApp().draw_Text(context, share_title, |
5610 | - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); | |
5612 | + 38 * unit, 170 * unit, 200 * unit, 279 * unit, unit); | |
5613 | + | |
5611 | 5614 | |
5612 | 5615 | //------产品的价格------- |
5613 | 5616 | context.setFontSize(23 * unit) |
... | ... | @@ -5621,17 +5624,18 @@ Page({ |
5621 | 5624 | if (th.data.prom_act) |
5622 | 5625 | pri0 = th.data.prom_price; |
5623 | 5626 | pri0 = parseFloat(pri0).toFixed(2); |
5627 | + | |
5624 | 5628 | var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; |
5625 | 5629 | |
5626 | - if (th.data.prom_type != 4) | |
5627 | - context.fillText("¥", wd1 - 15, 185 * unit); | |
5630 | + if(th.data.prom_type!=4) | |
5631 | + context.fillText("¥", wd1 - 15, 175 * unit); | |
5628 | 5632 | |
5629 | 5633 | context.setFontSize(31 * unit) |
5630 | - var pri_str = pri0; | |
5631 | - if (th.data.prom_type == 4) { | |
5632 | - pri_str = ''; | |
5634 | + var pri_str=pri0; | |
5635 | + if(th.data.prom_type==4){ | |
5636 | + pri_str=''; | |
5633 | 5637 | |
5634 | - if (th.data.prom_integral) pri_str = th.data.prom_integral + '积分'; | |
5638 | + if(th.data.prom_integral) pri_str=th.data.prom_integral+'积分'; | |
5635 | 5639 | if (pri0 && th.data.prom_integral) { |
5636 | 5640 | pri_str += "+"; |
5637 | 5641 | } |
... | ... | @@ -5640,8 +5644,9 @@ Page({ |
5640 | 5644 | } |
5641 | 5645 | |
5642 | 5646 | wd1 = th.data.screenWidth - ut.measureText(pri_str, 31 * unit) - 20; |
5647 | + | |
5643 | 5648 | } |
5644 | - context.fillText(pri_str, wd1, 185 * unit); | |
5649 | + context.fillText(pri_str, wd1, 175 * unit); | |
5645 | 5650 | //---市场价划掉--- |
5646 | 5651 | // context.setFillStyle("gray") |
5647 | 5652 | // context.setFontSize(22 * unit) |
... | ... | @@ -5655,15 +5660,18 @@ Page({ |
5655 | 5660 | // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); |
5656 | 5661 | // context.stroke(); |
5657 | 5662 | |
5658 | - var wp = 62 * unit + wi + ut.measureText(pri_str, 32 * unit); | |
5659 | - var hp = 735 * unit | |
5660 | - th.draw_pos_price(context, wp, hp, self.data.data.market_price, unit); | |
5663 | + var wp= wd1; | |
5664 | + var hp=203 * unit; | |
5665 | + if(th.data.prom_type!=4) wp-=12; | |
5666 | + th.draw_pos_price(context,wp,hp,self.data.data.market_price,unit); | |
5661 | 5667 | |
5662 | - } else if (type == 4) { | |
5668 | + } else if (type == 4 ) { | |
5663 | 5669 | context.setFillStyle("black"); |
5664 | 5670 | context.setFontSize(21.3 * unit) |
5665 | 5671 | getApp().draw_Text(context, share_title, |
5666 | - 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); | |
5672 | + 38 * unit, 160 * unit, 20 * unit, 300 * unit, unit); | |
5673 | + | |
5674 | + | |
5667 | 5675 | //------ 产品的价格 ----- |
5668 | 5676 | var pri0 = th.data.prom_act.addmoney; |
5669 | 5677 | var integral = th.data.prom_act.integral; |
... | ... | @@ -5682,7 +5690,7 @@ Page({ |
5682 | 5690 | text = "0积分"; |
5683 | 5691 | } |
5684 | 5692 | context.setFillStyle("red"); |
5685 | - context.fillText(text, 38 * unit, 235 * unit); | |
5693 | + context.fillText(text, 38 * unit, 175 * unit); | |
5686 | 5694 | |
5687 | 5695 | //---市场价划掉--- |
5688 | 5696 | // context.setFillStyle("gray") |
... | ... | @@ -5697,44 +5705,42 @@ Page({ |
5697 | 5705 | // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); |
5698 | 5706 | // context.stroke(); |
5699 | 5707 | |
5700 | - | |
5701 | - | |
5702 | - var wp = 62 * unit + wi + ut.measureText(text, 32 * unit); | |
5703 | - var hp = 735 * unit | |
5704 | - th.draw_pos_price(context, wp, hp, self.data.data.market_price, unit); | |
5708 | + var wp= wd1-12; | |
5709 | + var hp=203 * unit | |
5710 | + th.draw_pos_price(context,wp,hp,self.data.data.market_price,unit); | |
5705 | 5711 | |
5706 | 5712 | |
5707 | 5713 | } |
5708 | 5714 | |
5709 | 5715 | //---中间大图--- |
5710 | - if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
5711 | - context.drawImage(th.data.share_goods_img, 70 * unit, 240 * unit, 408 * unit, 408 * unit); | |
5716 | + if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
5717 | + context.drawImage(th.data.share_goods_img, 70 * unit, 220 * unit, 408 * unit, 408 * unit); | |
5712 | 5718 | } |
5713 | 5719 | |
5714 | 5720 | |
5715 | 5721 | //---自定义海报 产品质量保证 |
5716 | - if (th.data.share_b_img && th.data.poster.show_quality == 1 && type != 4) { | |
5722 | + if(th.data.share_b_img && th.data.poster.show_quality==1 && type!=4){ | |
5717 | 5723 | var g_path = "../../../images/share/s_gou.png"; |
5718 | - context.drawImage(g_path, 56 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5724 | + context.drawImage(g_path, 56 * unit, 640 * unit, 22 * unit, 22 * unit); | |
5719 | 5725 | context.setFillStyle("red") |
5720 | 5726 | context.setFontSize(18 * unit) |
5721 | - context.fillText("正品保证", 84 * unit, 670 * unit); | |
5727 | + context.fillText("正品保证", 84 * unit, 660 * unit); | |
5722 | 5728 | |
5723 | - context.drawImage(g_path, 218 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5729 | + context.drawImage(g_path, 218 * unit, 640 * unit, 22 * unit, 22 * unit); | |
5724 | 5730 | context.setFillStyle("red") |
5725 | 5731 | context.setFontSize(18 * unit) |
5726 | - context.fillText("纯实体店", 246 * unit, 670 * unit); | |
5732 | + context.fillText("纯实体店", 246 * unit, 660 * unit); | |
5727 | 5733 | |
5728 | - context.drawImage(g_path, 388 * unit, 650 * unit, 22 * unit, 22 * unit); | |
5734 | + context.drawImage(g_path, 388 * unit, 640 * unit, 22 * unit, 22 * unit); | |
5729 | 5735 | context.setFillStyle("red") |
5730 | 5736 | context.setFontSize(18 * unit) |
5731 | - context.fillText("官方验证", 420 * unit, 670 * unit); | |
5737 | + context.fillText("官方验证", 420 * unit, 660 * unit); | |
5732 | 5738 | |
5733 | 5739 | } |
5734 | - //-------大图后面就不一样了----------- | |
5740 | + //-------大图后面就不一样了----------- | |
5735 | 5741 | switch (type) { |
5736 | 5742 | case 0: |
5737 | - if (!th.data.share_b_img) { | |
5743 | + if(!th.data.share_b_img){ | |
5738 | 5744 | break |
5739 | 5745 | } |
5740 | 5746 | //---画线--- |
... | ... | @@ -5754,10 +5760,10 @@ Page({ |
5754 | 5760 | // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit); |
5755 | 5761 | //---二维吗图--- |
5756 | 5762 | context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); |
5757 | - break; //普通商品的展示 | |
5763 | + break;//普通商品的展示 | |
5758 | 5764 | case 4: |
5759 | 5765 | |
5760 | - if (th.data.share_b_img && th.data.poster.show_quality == 1 && type != 4) { | |
5766 | + if(th.data.share_b_img && th.data.poster.show_quality==1 && type!=4){ | |
5761 | 5767 | var g_path = "../../../images/share/s_gou.png"; |
5762 | 5768 | context.drawImage(g_path, 56 * unit, 660 * unit, 22 * unit, 22 * unit); |
5763 | 5769 | context.setFillStyle("red") |
... | ... | @@ -5845,7 +5851,7 @@ Page({ |
5845 | 5851 | |
5846 | 5852 | //---二维吗图--- |
5847 | 5853 | //-- 自定义海报 -- |
5848 | - if (th.data.share_b_img || th.data.poster) { | |
5854 | + if (th.data.share_b_img || th.data.poster) { | |
5849 | 5855 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5850 | 5856 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5851 | 5857 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); |
... | ... | @@ -5857,32 +5863,32 @@ Page({ |
5857 | 5863 | |
5858 | 5864 | break; |
5859 | 5865 | case 1: //秒杀商品的展示 |
5860 | - if (!th.data.share_b_img) { | |
5866 | + if(!th.data.share_b_img){ | |
5861 | 5867 | break |
5862 | 5868 | } |
5863 | 5869 | //---画线--- |
5864 | 5870 | context.setLineWidth(1 * unit) |
5865 | - context.moveTo(32 * unit, 690 * unit) | |
5866 | - context.lineTo(520 * unit, 690 * unit) | |
5871 | + context.moveTo(32 * unit, 670 * unit) | |
5872 | + context.lineTo(520 * unit, 670 * unit) | |
5867 | 5873 | context.stroke(); |
5868 | 5874 | |
5869 | 5875 | //画秒杀的图片 |
5870 | 5876 | var miaos_path = '../../../images/share/miao_share.png'; |
5871 | - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); | |
5877 | + context.drawImage(miaos_path, 43 * unit, 690 * unit, 222 * unit, 40 * unit); | |
5872 | 5878 | |
5873 | 5879 | context.setFillStyle("black") |
5874 | 5880 | context.setFontSize(24 * unit) |
5875 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit); | |
5881 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 770 * unit); | |
5876 | 5882 | //---文字--- |
5877 | 5883 | context.setFontSize(22 * unit) |
5878 | 5884 | context.setFillStyle("black") |
5879 | - context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit); | |
5880 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); | |
5885 | + context.fillText("特惠好物,限时秒杀", 40 * unit, 807 * unit); | |
5886 | + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 844 * unit); | |
5881 | 5887 | |
5882 | 5888 | |
5883 | 5889 | //---二维吗图--- |
5884 | 5890 | //-- 自定义海报 -- |
5885 | - if (th.data.share_b_img || th.data.poster) { | |
5891 | + if (th.data.share_b_img || th.data.poster) { | |
5886 | 5892 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5887 | 5893 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5888 | 5894 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); |
... | ... | @@ -5893,7 +5899,7 @@ Page({ |
5893 | 5899 | break; |
5894 | 5900 | |
5895 | 5901 | case 2: //会员团和商家团的展示 |
5896 | - if (!th.data.share_b_img) { | |
5902 | + if(!th.data.share_b_img){ | |
5897 | 5903 | break |
5898 | 5904 | } |
5899 | 5905 | //---画线--- |
... | ... | @@ -5931,7 +5937,7 @@ Page({ |
5931 | 5937 | |
5932 | 5938 | //---二维吗图--- |
5933 | 5939 | //-- 自定义海报 -- |
5934 | - if (th.data.share_b_img || th.data.poster) { | |
5940 | + if (th.data.share_b_img || th.data.poster) { | |
5935 | 5941 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5936 | 5942 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5937 | 5943 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); |
... | ... | @@ -5941,7 +5947,7 @@ Page({ |
5941 | 5947 | } |
5942 | 5948 | break |
5943 | 5949 | case 3: //阶梯团的展示 |
5944 | - if (!th.data.share_b_img) { | |
5950 | + if(!th.data.share_b_img){ | |
5945 | 5951 | break |
5946 | 5952 | } |
5947 | 5953 | //---画线--- |
... | ... | @@ -5979,7 +5985,7 @@ Page({ |
5979 | 5985 | |
5980 | 5986 | |
5981 | 5987 | //-- 自定义海报 -- |
5982 | - if (th.data.share_b_img || th.data.poster) { | |
5988 | + if (th.data.share_b_img || th.data.poster) { | |
5983 | 5989 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
5984 | 5990 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
5985 | 5991 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); |
... | ... | @@ -6010,7 +6016,7 @@ Page({ |
6010 | 6016 | |
6011 | 6017 | //---二维吗图--- |
6012 | 6018 | //-- 自定义海报 -- |
6013 | - if (th.data.share_b_img || th.data.poster) { | |
6019 | + if (th.data.share_b_img || th.data.poster) { | |
6014 | 6020 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
6015 | 6021 | var erm_y = parseFloat(th.data.poster.ewm_y) * 2; |
6016 | 6022 | context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); |
... | ... | @@ -6025,7 +6031,7 @@ Page({ |
6025 | 6031 | |
6026 | 6032 | |
6027 | 6033 | //--- 如果是自定义海报的时候 --- |
6028 | - if (th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
6034 | + if ( th.data.share_b_img || (type != 0 && type != 1 && type != 2 && type != 3)) { | |
6029 | 6035 | |
6030 | 6036 | if (th.data.poster && parseInt(th.data.poster.style) == 2) { |
6031 | 6037 | |
... | ... | @@ -6070,6 +6076,15 @@ Page({ |
6070 | 6076 | } |
6071 | 6077 | |
6072 | 6078 | |
6079 | + | |
6080 | + //-- 自定义的时候 -- | |
6081 | + if(th.data.share_b_img && act_time && th.data.poster.show_time){ | |
6082 | + context.setFillStyle("red") | |
6083 | + getApp().draw_Text(context, act_time,38 * unit, 880 * unit, 200 * unit, 340 * unit, unit); | |
6084 | + } | |
6085 | + | |
6086 | + | |
6087 | + | |
6073 | 6088 | //把画板内容绘制成图片,并回调 画板图片路径 |
6074 | 6089 | context.draw(false, function () { |
6075 | 6090 | setTimeout(function () { | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -2051,7 +2051,6 @@ Page({ |
2051 | 2051 | let list= []; |
2052 | 2052 | |
2053 | 2053 | if(currentIndex == 1) { |
2054 | - list = th.data.list2; | |
2055 | 2054 | list = list.concat(data); |
2056 | 2055 | th.setData({list2:list}); |
2057 | 2056 | }; |
... | ... | @@ -2228,7 +2227,8 @@ Page({ |
2228 | 2227 | this.setData({ |
2229 | 2228 | currentPage2: 1, |
2230 | 2229 | list2: [], |
2231 | - is_no_data2: 0, | |
2230 | + is_no_data2: 0, | |
2231 | + is_no_more2:0 | |
2232 | 2232 | }); |
2233 | 2233 | |
2234 | 2234 | ... | ... |