Commit 6c8ece97e0fe22dd62598d3118bf0b718a4730eb

Authored by taiyuan
1 parent 8357d4cc

幸运购订单详情退款信息

packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js
@@ -47,6 +47,7 @@ Page({ @@ -47,6 +47,7 @@ Page({
47 47
48 showRules: false, 48 showRules: false,
49 isSuccess: false, 49 isSuccess: false,
  50 + showPoster: false,
50 }, 51 },
51 onLoad: function (t) { 52 onLoad: function (t) {
52 // wx.setNavigationBarTitle({ title: "拼团订单",}) 53 // wx.setNavigationBarTitle({ title: "拼团订单",})
@@ -319,28 +320,28 @@ Page({ @@ -319,28 +320,28 @@ Page({
319 }) 320 })
320 321
321 //--当是成团的时候的操作-- 322 //--当是成团的时候的操作--
322 - if(order.pt_status==2 || order.pt_status==4 || order.pt_status==5){  
323 - //设置值  
324 -  
325 - ee.setData({  
326 - ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, min_price: min_price,  
327 - order: order, share_img: share_img,max_num:max_num,  
328 - pindGoods: teamlist,is_show:1, zk:false,  
329 - hiddenName: false, ct_price:ct_price,p_status:p_status,sf_arr:sf_arr});  
330 -  
331 - //--是否支付了尾款--  
332 - if(order.pt_status==4 || order.pt_status==5){  
333 - ee.setData({is_pay_wk:1});  
334 - }  
335 - }else{  
336 - console.log("239什么鬼", teamlist);  
337 - //设置值  
338 - ee.setData({  
339 - ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup,  
340 - order: order, p_status: p_status, min_price:min_price,  
341 - share_img: share_img, max_num: max_num, pindGoods: teamlist, is_show: 1,  
342 - ct_price: ct_price, p_status: p_status,sf_arr:sf_arr});  
343 - } 323 + // if(order.pt_status==2 || order.pt_status==4 || order.pt_status==5){
  324 + // //设置值
  325 +
  326 + // ee.setData({
  327 + // ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, min_price: min_price,
  328 + // order: order, share_img: share_img,max_num:max_num,
  329 + // pindGoods: teamlist,is_show:1, zk:false,
  330 + // hiddenName: false, ct_price:ct_price,p_status:p_status,sf_arr:sf_arr});
  331 +
  332 + // //--是否支付了尾款--
  333 + // if(order.pt_status==4 || order.pt_status==5){
  334 + // ee.setData({is_pay_wk:1});
  335 + // }
  336 + // }else{
  337 + // console.log("239什么鬼", teamlist);
  338 + // //设置值
  339 + // ee.setData({
  340 + // ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup,
  341 + // order: order, p_status: p_status, min_price:min_price,
  342 + // share_img: share_img, max_num: max_num, pindGoods: teamlist, is_show: 1,
  343 + // ct_price: ct_price, p_status: p_status,sf_arr:sf_arr});
  344 + // }
344 345
345 wx.hideLoading(); 346 wx.hideLoading();
346 347
@@ -351,17 +352,17 @@ Page({ @@ -351,17 +352,17 @@ Page({
351 ee.countDown2(); 352 ee.countDown2();
352 353
353 //获取分享图片的本地地址 354 //获取分享图片的本地地址
354 - var path2 = os.imghost + teamlist.share_imgurl;  
355 - wx.getImageInfo({  
356 - src: path2,  
357 - success: function (res) {  
358 - //res.path是网络图片的本地地址  
359 - ee.data.share_img_localpath = res.path;  
360 - },  
361 - fail: function (res) {  
362 - //失败回调  
363 - }  
364 - }); 355 + // var path2 = os.imghost + th.data.luckyGoInfo.original_img;
  356 + // wx.getImageInfo({
  357 + // src: path2,
  358 + // success: function (res) {
  359 + // //res.path是网络图片的本地地址
  360 + // ee.data.share_img_localpath = res.path;
  361 + // },
  362 + // fail: function (res) {
  363 + // //失败回调
  364 + // }
  365 + // });
365 366
366 367
367 }, 368 },
@@ -415,320 +416,616 @@ Page({ @@ -415,320 +416,616 @@ Page({
415 setTimeout(th.countDown2, 1000); 416 setTimeout(th.countDown2, 1000);
416 }, 417 },
417 418
418 - //--定义的保存图片方法,分享团---  
419 - saveImageToPhotosAlbum: function () {  
420 - //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团  
421 - var type=1;  
422 - if(this.data.teamlist.kttype==3) type=2;  
423 -  
424 - wx.showLoading({ title: '生成中...', })  
425 - var that = this, th = that;  
426 - //设置画板显示,才能开始绘图  
427 - that.setData({  
428 - canvasHidden: true,  
429 - })  
430 -  
431 - if(this.data.share_hidden) {  
432 - this.setData({  
433 - share_hidden: false,  
434 - });  
435 - };  
436 -  
437 - var app = getApp();  
438 - var unit = that.data.screenWidth / 750 * 1.35;  
439 - var scene=th.data.teamgroup.id;  
440 - var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0;  
441 - if(user_id>0){  
442 - scene+="_"+user_id;  
443 - }  
444 -  
445 - //二微码  
446 - var path3 = os.url+ "/api/wx/open/app/user/getWeAppEwm/"+  
447 - os.stoid+"?sceneValue="+scene+"&pageValue=pages/team/team_show/team_show";  
448 419
449 - //读取文件成功则OK--  
450 - wx.getImageInfo({  
451 - src: path3,  
452 - success:function (res) {  
453 - //回调写法  
454 - th.get_head_temp(th.get_goods_temp,function () {  
455 - var vpath = res.path;  
456 - var context = wx.createCanvasContext('share');  
457 -  
458 -  
459 - //先画背景  
460 - var pg_path = "../../../../images/share/share_bg.png";  
461 - //-- 如果有自定义海报的时候,判断背景的图片 --  
462 - if(th.data.share_b_img){  
463 - pg_path=th.data.share_b_img;  
464 - }  
465 -  
466 - var share_title=th.data.teamlist.share_title;  
467 - if(!share_title)  
468 - share_title=th.data.teamlist.title;  
469 - context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);  
470 -  
471 - //-- 是自定义海报的情况下 --  
472 - if(th.data.poster && parseInt(th.data.poster.style)==2){  
473 - //在线上分享人的情况下  
474 - if(parseInt(th.data.poster.show_headpic)){  
475 - //获取坐标  
476 - var x=parseFloat(th.data.poster.head_x)*2;  
477 - var y=parseFloat(th.data.poster.head_y)*2;  
478 - var x1=(x+90) *unit;  
479 - var y1=(y+50) *unit;  
480 - //--昵称---  
481 - context.setFontSize(24 * unit)  
482 - context.setFillStyle("black")  
483 - context.fillText(app.globalData.userInfo.nickname, x1, y1);  
484 - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit;  
485 - //强烈推荐 改许程  
486 - var tj_path = "../../../../images/share/q_tj.png";  
487 - context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit);  
488 - context.setFontSize(16 * unit)  
489 - context.setLineJoin('round'); //交点设置成圆角  
490 - context.setFillStyle("white")  
491 - context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit);  
492 - }  
493 -  
494 - }else{  
495 - //--昵称---  
496 - context.setFontSize(24 * unit)  
497 - context.setFillStyle("black")  
498 - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit);  
499 - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;  
500 - //强烈推荐  
501 - var tj_path = "../../../../images/share/q_tj.png";  
502 - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 110 * unit, 30 * unit);  
503 - context.setFontSize(18 * unit)  
504 - context.setFillStyle("white")  
505 - context.fillText('强烈推荐', 152 * unit + width + 20 * unit, 76 * unit);  
506 - }  
507 -  
508 420
509 - //---产品名称---  
510 - context.setFontSize(21.3 * unit);  
511 - context.setFillStyle("black");  
512 -  
513 -  
514 -  
515 -  
516 - th.draw_Text(context,share_title,  
517 - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);  
518 - //------产品的价格-------  
519 - context.setFontSize(24 * unit)  
520 - context.setFillStyle("red")  
521 -  
522 - var pri0 = th.data.teamlist.price;  
523 - pri0=parseFloat(pri0).toFixed(2);  
524 - var wd1=th.data.screenWidth-ut.measureText(pri0, 31 * unit)-25;  
525 - context.fillText("¥", wd1-15, 180 * unit);  
526 - context.setFontSize(31 * unit)  
527 - context.fillText(pri0, wd1, 180 * unit);  
528 -  
529 - //---市场价划掉---  
530 - context.setFillStyle("gray")  
531 - context.setFontSize(22 * unit)  
532 - pri0= "¥" + parseFloat(th.data.goods.market_price).toFixed(2);  
533 - var wd2=th.data.screenWidth-ut.measureText(pri0, 22 * unit)-25;  
534 - context.fillText(pri0, wd2, 210 * unit);  
535 -  
536 - context.setStrokeStyle('gray')  
537 - context.setLineWidth(1 * unit)  
538 - context.moveTo(wd2-5, 204 * unit)  
539 - context.lineTo(wd2+ut.measureText(pri0, 22 * unit)+5, 204 * unit)  
540 - context.stroke();  
541 - console.log(th.data.share_img_localpath);  
542 -  
543 -  
544 - //---中间大图---  
545 - context.drawImage(th.data.share_img_localpath, 68 * unit, 242 * unit, 410 * unit, 410 * unit);  
546 -  
547 - var g_ct=th.data.teamlist.ct_num-th.data.ordertx.length;  
548 - var wz= "";  
549 - if(g_ct>0) wz="还差"+g_ct+"人成团,";  
550 - else{  
551 - g_ct= th.data.max_num -th.data.ordertx.length;  
552 - if(g_ct>0){  
553 - wz="还差"+g_ct+"人享最低优惠,";  
554 - }else{  
555 - wz="已享受最优惠,";  
556 - }  
557 - }  
558 -  
559 - //-------大图后面就不一样了-----------  
560 - switch (type) {  
561 - case 1://会员团和商家团的展示  
562 - //---画线---  
563 - context.setLineWidth(1 * unit)  
564 - context.moveTo(32 * unit, 670 * unit)  
565 - context.lineTo(520 * unit, 670 * unit)  
566 - context.stroke();  
567 -  
568 - //---文字---  
569 - context.setFontSize(22 * unit)  
570 - context.setFillStyle("black")  
571 - context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit);  
572 -  
573 - //绘制成团图片  
574 - var ct_img ="../../../../images/share/ct_num.png";  
575 - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit);  
576 - var ct_num = th.data.teamlist.ct_num;  
577 - context.setFontSize(14 * unit)  
578 -  
579 - context.setFillStyle("red")  
580 - if(ct_num<10){  
581 - context.fillText(ct_num+"人拼团", 92 * unit, 760 * unit);  
582 - }else{  
583 - context.fillText(ct_num+"人拼团", 86 * unit, 760 * unit);  
584 - }  
585 - context.setFontSize(22 * unit)  
586 - context.fillText("已拼"+th.data.teamlist.buy_num+"份", 166 * unit, 763 * unit);  
587 - context.setFillStyle("gray")  
588 - context.fillText(wz+"快来和我一起拼团吧!", 40 * unit, 826 * unit);  
589 - context.setFillStyle("black")  
590 -  
591 - context.setFontSize(22 * unit)  
592 - context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit);  
593 - //---二维吗图---  
594 - //-- 自定义海报 --  
595 - if(th.data.poster){  
596 - var erm_x= parseFloat(th.data.poster.ewm_x)*2;  
597 - var erm_y= parseFloat(th.data.poster.ewm_y)*2;  
598 - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);  
599 - }else{  
600 - //---二维吗图---  
601 - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);  
602 - }  
603 - break  
604 - case 2://阶梯团的展示  
605 - //---画线---  
606 - context.setLineWidth(1 * unit)  
607 - context.moveTo(32 * unit, 670 * unit)  
608 - context.lineTo(520 * unit, 670 * unit)  
609 - context.stroke();  
610 - //---文字---  
611 - context.setFontSize(22 * unit)  
612 - context.setFillStyle("black")  
613 - context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit);  
614 - //---绘制中间阶梯的价格---  
615 - var list= JSON.parse(th.data.teamlist.ct_rylist);  
616 - for(var i=0; i<list.length;i++){  
617 - var item=list[i];  
618 - var wi=i*90*unit;  
619 - context.setFontSize(16 * unit)  
620 - context.setFillStyle("red")  
621 - context.fillText("¥", 40 * unit+wi, 756 * unit);  
622 - context.setFontSize(22 * unit)  
623 - var pri=parseFloat(item.price).toFixed(2);  
624 - context.fillText(pri, 56 * unit+wi, 756 * unit);  
625 - context.setFillStyle("gray")  
626 - context.fillText("满"+item.rynum+"人", 40 * unit+wi, 786 * unit);  
627 - }  
628 -  
629 - //----------------下面部分----------------  
630 - context.setFillStyle("gray")  
631 - context.fillText(wz+"快来和我一起拼团吧!", 40 * unit, 830 * unit);  
632 - context.setFillStyle("black")  
633 - context.setFontSize(22 * unit)  
634 -  
635 - context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit);  
636 - //---二维吗图---  
637 - //-- 自定义海报 --  
638 - if(th.data.poster){  
639 - var erm_x= parseFloat(th.data.poster.ewm_x)*2;  
640 - var erm_y= parseFloat(th.data.poster.ewm_y)*2;  
641 - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);  
642 - }else{  
643 - //---二维吗图---  
644 - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);  
645 - }  
646 - break  
647 - }  
648 -  
649 - //--- 如果是自定义海报的时候 ---  
650 - if(th.data.poster && parseInt(th.data.poster.style)==2){  
651 -  
652 - //如果显示会员信息的话  
653 - if(parseInt(th.data.poster.show_headpic)){  
654 - //获取坐标  
655 - var x= parseFloat(th.data.poster.head_x)*2;  
656 - var y=parseFloat(th.data.poster.head_y)*2;  
657 - //---绘制圆形要放在最后----  
658 - context.save();  
659 - context.beginPath();  
660 - var h_x = x* unit;  
661 - var h_y = y * unit;  
662 - var h_r = 40 * unit;  
663 - var cx = h_x + h_r;  
664 - var cy = h_y + h_r;  
665 - context.arc(cx, cy, h_r, 0, Math.PI * 2, false);  
666 - context.closePath();  
667 - context.fill();  
668 - context.clip();  
669 - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);  
670 - context.restore();  
671 - }  
672 -  
673 - }else{  
674 - //---绘制圆形要放在最后----  
675 - context.save();  
676 - context.beginPath();  
677 - var h_x = 60 * unit;  
678 - var h_y = 24 * unit;  
679 - var h_r = 40 * unit;  
680 - var cx = h_x + h_r;  
681 - var cy = h_y + h_r;  
682 - context.arc(cx, cy, h_r, 0, Math.PI * 2, false);  
683 - context.closePath();  
684 - context.fill();  
685 - context.clip();  
686 - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);  
687 - context.restore();  
688 - }  
689 -  
690 - //把画板内容绘制成图片,并回调 画板图片路径  
691 - context.draw(false, function () {  
692 - setTimeout(function () {  
693 - wx.canvasToTempFilePath({  
694 - x: 0, y: 0,  
695 - width: 750,  
696 - height: 1217,  
697 - destWidth: 750 * 750 / that.data.screenWidth,  
698 - destHeight: 1217 * 750 / that.data.screenWidth,  
699 - canvasId: 'share',  
700 - success: function (res) {  
701 -  
702 - that.setData({  
703 - shareImgPath: res.tempFilePath, canvasHidden: false,  
704 - })  
705 - if (!res.tempFilePath) {  
706 - wx.showModal({  
707 - title: '提示',  
708 - content: '图片绘制中,请稍后重试',  
709 - showCancel: false  
710 - })  
711 - return false;  
712 - }  
713 -  
714 - // wx.previewImage({  
715 - // //将图片预览出来  
716 - // urls: [that.data.shareImgPath]  
717 - // });  
718 -  
719 - that.setData({  
720 - showPoster: true,  
721 - });  
722 -  
723 - wx.hideLoading();  
724 - }  
725 - })  
726 - },500)  
727 - });  
728 - });  
729 - } 421 + //--定义的保存图片方法,分享团---
  422 + saveImageToPhotosAlbum: function () {
  423 + //--先判断会员状态--
  424 + var user_info = getApp().globalData.userInfo;
  425 + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  426 + //getApp().my_warnning("请先登录",0,this);
  427 + wx.navigateTo({ url: '/pages/togoin/togoin', })
  428 + return false;
  429 + }
  430 +
  431 + if (this.data.share_hidden) {
  432 + this.setData({ share_hidden: false,});
  433 + };
  434 +
  435 + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 9幸运购
  436 + var type = 9;
  437 + if (type == 6) type = 2;
  438 + if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
  439 +
  440 + wx.showLoading({ title: '生成中...',})
  441 + var that = this, th = that;
  442 + //设置画板显示,才能开始绘图
  443 + that.setData({
  444 + canvasHidden: false
  445 + })
  446 +
  447 + var app = getApp();
  448 + var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
  449 + var path2 = that.data.luckyGoInfo.original_img;
  450 + var scene = th.data.param.goods_id + "";
  451 + scene+="."+9+"."+th.data.luckyGoInfo.id;
  452 +
  453 + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
  454 + if (user_id > 0) {
  455 + scene += "_" + user_id;
  456 + }
  457 + //-- 如果不是会员分享过来的要分享给别人 --
  458 + if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
  459 + //固定房间是第3个字符
  460 + if (!user_id) scene += "_0";
  461 + scene += "_" + getApp().globalData.room_id;
  462 + }
  463 + ///二微码
  464 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  465 + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
  466 +
  467 + console.log(path3);
  468 +
  469 +
  470 + // 读取文件成功则OK--
  471 + wx.getImageInfo({
  472 + src: path3,
  473 + success: function (res) {
  474 + // 回调写法
  475 + th.get_head_temp(th.get_goods_temp, function () {
  476 + var vpath = res.path;
  477 + var context = wx.createCanvasContext('share');
  478 + // 先画背景
  479 + var pg_path = "../../../../images/share/share_bg.png";
  480 +
  481 + // context.fillStyle="#FFFFFF";
  482 + // context.fillRect(0,0,554 * unit, 899 * unit);
  483 +
  484 + // if(type == 0) {
  485 + // this.drawPoster(context);
  486 + // return false;
  487 + // };
  488 +
  489 +
  490 + //-- 如果有自定义海报的时候,判断背景的图片 --
  491 + if (th.data.share_b_img) {
  492 + pg_path = th.data.share_b_img;
  493 + }
  494 + // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
  495 +
  496 +
  497 + if(type == 0) { // 如果是普通商品,绘制新海报
  498 + th.drawPoster(context, unit, th.data.share_goods_img, vpath);
  499 + } else {
  500 + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
  501 + };
  502 +
  503 + // th.drawPoster(context, unit, th.data.share_goods_img, vpath);
  504 +
  505 +
  506 + //-- 是自定义海报的情况下 --
  507 + // if(type != 0) {
  508 +
  509 +
  510 +
  511 + // if (th.data.poster && parseInt(th.data.poster.style) == 2) {
  512 + // //在线上分享人的情况下
  513 + // if (parseInt(th.data.poster.show_headpic)) {
  514 + // //获取坐标
  515 + // var x = parseFloat(th.data.poster.head_x) * 2;
  516 + // var y = parseFloat(th.data.poster.head_y) * 2;
  517 + // var x1 = (x + 90) * unit;
  518 + // var y1 = (y + 50) * unit;
  519 + // //--昵称---
  520 + // context.setFontSize(24 * unit)
  521 + // context.setFillStyle("black")
  522 + // context.fillText(app.globalData.userInfo.nickname, x1, y1);
  523 + // var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit;
  524 + // //强烈推荐 改许程
  525 + // var tj_path = "../../../../images/share/q_tj.png";
  526 + // context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit);
  527 + // context.setFontSize(16 * unit);
  528 + // context.setLineJoin('round'); //交点设置成圆角
  529 + // context.setFillStyle("white");
  530 + // context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit);
  531 +
  532 + // //context.setFillStyle("black")
  533 + // //context.setFontSize(24 * unit)
  534 + // //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit);
  535 + // }
  536 + // } else {
  537 + // //--昵称---
  538 + // context.setFontSize(24 * unit);
  539 + // context.setFillStyle("black");
  540 + // context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit);
  541 + // var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
  542 + // //强烈推荐 改许程
  543 + // // var tj_path = "../../../../images/share/q_tj.png";
  544 + // // let txt_gn = th.data.luckGoInfo.group_num + '人团';
  545 + // // let width_gn = ut.measureText(txt_gn, 15);
  546 + // // context.drawImage(tj_path, 152 * unit + width, 54 * unit, (width_gn + 20) * unit, 30 * unit);
  547 + // // context.setFontSize(16 * unit);
  548 + // // context.setLineJoin('round'); //交点设置成圆角
  549 + // // context.setFillStyle("white");
  550 + // // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit);
  551 + // // 发出幸运购活动邀请
  552 + // context.setFillStyle("#7f7f7f")
  553 + // context.setFontSize(21.3 * unit)
  554 + // context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit);
  555 +
  556 + // }
  557 +
  558 + // };
  559 +
  560 +
  561 + // // var share_title = th.data.data.goods_name;
  562 + // var share_title = th.data.param.goods_name;
  563 + // if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) {
  564 + // share_title = th.data.prom_act.share_title;
  565 + // if (!share_title) share_title = th.data.prom_act.title;
  566 + // if (th.data.prom_type == 4) share_title = th.data.prom_act.name;
  567 + // }
  568 +
  569 + // //---产品名称---
  570 + // //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
  571 + // if (type != 4 && type != 0) {
  572 + // context.setFillStyle("black");
  573 + // context.setFontSize(21.3 * unit)
  574 + // th.draw_Text(context, share_title,
  575 + // 38 * unit, 180 * unit, 220 * unit, 220 * unit, unit);
  576 +
  577 + // //------产品的价格-------
  578 + // context.setFontSize(23 * unit)
  579 + // context.setFillStyle("red")
  580 +
  581 +
  582 + // // var pri0 = th.data.data.shop_price;
  583 + // var pri0 = th.data.luckyGoInfo.group_price;
  584 + // if (th.data.prom_act)
  585 + // pri0 = th.data.prom_act.price;
  586 + // pri0 = parseFloat(pri0).toFixed(2);
  587 + // var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25;
  588 + // context.fillText("¥", wd1 - 15, 185 * unit);
  589 + // context.setFontSize(31 * unit)
  590 + // context.fillText(pri0, wd1, 185 * unit);
  591 +
  592 + // var tj_path = "../../../../images/share/q_tj.png";
  593 + // context.drawImage(tj_path, 315 * unit, 158 * unit, 85 * unit, 30 * unit);
  594 + // context.setLineJoin('round'); //交点设置成圆角
  595 + // context.setFontSize(18 * unit);
  596 + // context.setFillStyle("white");
  597 + // context.fillText('参团价', 330 * unit, 179 * unit);
  598 +
  599 + // //---市场价划掉---
  600 + // context.setFillStyle("gray")
  601 + // context.setFontSize(22 * unit)
  602 + // pri0 = "零售价:¥" + th.data.luckyGoInfo.market_price.toFixed(2);
  603 + // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25;
  604 + // context.fillText(pri0, wd2, 213 * unit);
  605 +
  606 + // context.setStrokeStyle('gray');
  607 + // context.setLineWidth(1 * unit);
  608 + // context.moveTo(wd2 - 5, 206 * unit);
  609 + // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
  610 + // context.stroke();
  611 +
  612 + // } else if(type == 4 && type != 0) {
  613 + // context.setFillStyle("black");
  614 + // context.setFontSize(21.3 * unit)
  615 + // th.draw_Text(context, share_title,
  616 + // 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit);
  617 + // //------ 产品的价格 -----
  618 + // var pri0 = th.data.prom_act.addmoney;
  619 + // var integral = th.data.prom_act.integral;
  620 + // var text = "";
  621 + // if (integral) { text = integral + "积分"; }
  622 + // if (pri0 && integral) { text += "+"; }
  623 + // if (pri0) { text += "¥" + pri0; }
  624 +
  625 + // if (!pri0 && !integral) { text = "0积分"; }
  626 + // context.setFillStyle("red");
  627 + // context.fillText(text, 38 * unit, 235 * unit);
  628 +
  629 + // }
  630 +
  631 + // //---中间大图---
  632 + // if(type != 0) {
  633 + // // context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
  634 + // context.drawImage(th.data.luckyGoInfo.original_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
  635 + // };
  636 +
  637 +
  638 +
  639 + // //-------大图后面就不一样了-----------
  640 + // switch (type) {
  641 + // case 0: break;//普通商品的展示
  642 + // case 4:
  643 + // //中间的几个字
  644 + // if (th.data.poster && parseInt(th.data.poster.style) == 2) {
  645 + // if (parseInt(th.data.poster.show_quality)) {
  646 + // var g_path = "../../../../images/share/s_gou.png";
  647 + // context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
  648 + // context.setFillStyle("red")
  649 + // context.setFontSize(18 * unit)
  650 + // context.fillText("正品保证", 84 * unit, 690 * unit);
  651 +
  652 + // context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
  653 + // context.setFillStyle("red")
  654 + // context.setFontSize(18 * unit)
  655 + // context.fillText("纯实体店", 246 * unit, 690 * unit);
  656 +
  657 + // context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
  658 + // context.setFillStyle("red")
  659 + // context.setFontSize(18 * unit)
  660 + // context.fillText("官方验证", 420 * unit, 690 * unit);
  661 + // }
  662 +
  663 + // } else {
  664 + // var g_path = "../../../../images/share/s_gou.png";
  665 + // context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
  666 + // context.setFillStyle("red")
  667 + // context.setFontSize(18 * unit)
  668 + // context.fillText("正品保证", 84 * unit, 690 * unit);
  669 +
  670 + // context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
  671 + // context.setFillStyle("red")
  672 + // context.setFontSize(18 * unit)
  673 + // context.fillText("纯实体店", 246 * unit, 690 * unit);
  674 +
  675 + // context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
  676 + // context.setFillStyle("red")
  677 + // context.setFontSize(18 * unit)
  678 + // context.fillText("官方验证", 420 * unit, 690 * unit);
  679 + // }
  680 +
  681 +
  682 + // //---画线---
  683 + // context.setLineWidth(1 * unit)
  684 + // context.moveTo(32 * unit, 710 * unit)
  685 + // context.lineTo(520 * unit, 710 * unit)
  686 + // context.stroke();
  687 +
  688 + // //---文字---
  689 + // context.setFillStyle("black")
  690 + // context.setFontSize(22 * unit)
  691 +
  692 + // if (type == 0) {
  693 + // // 原来start --->
  694 + // context.setFontSize(24 * unit)
  695 + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
  696 +
  697 + // context.setFontSize(22 * unit)
  698 + // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit);
  699 + // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit);
  700 +
  701 + // } else {
  702 + // context.setFontSize(24 * unit)
  703 + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
  704 + // context.setFontSize(22 * unit)
  705 + // context.fillText("长按识别二维码", 40 * unit, 806 * unit);
  706 + // context.fillText("立即开始兑换", 40 * unit, 846 * unit);
  707 +
  708 + // }
  709 +
  710 + // //---二维吗图---
  711 + // //-- 自定义海报 --
  712 + // if (th.data.poster) {
  713 + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
  714 + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
  715 + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
  716 + // } else {
  717 + // //---二维吗图---
  718 + // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
  719 + // };
  720 +
  721 + // break;
  722 + // case 1: //秒杀商品的展示
  723 + // //---画线---
  724 + // context.setLineWidth(1 * unit)
  725 + // context.moveTo(32 * unit, 670 * unit)
  726 + // context.lineTo(520 * unit, 670 * unit)
  727 + // context.stroke();
  728 +
  729 + // //画秒杀的图片
  730 + // var miaos_path = '../../../../images/share/miao_share.png';
  731 + // context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);
  732 +
  733 + // context.setFillStyle("black")
  734 + // context.setFontSize(24 * unit)
  735 + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit);
  736 + // //---文字---
  737 + // context.setFontSize(22 * unit)
  738 + // context.setFillStyle("black")
  739 + // context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit);
  740 + // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);
  741 +
  742 +
  743 + // //---二维吗图---
  744 + // //-- 自定义海报 --
  745 + // if (th.data.poster) {
  746 + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
  747 + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
  748 + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit);
  749 + // } else {
  750 + // //---二维吗图---
  751 + // context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit);
  752 + // }
  753 + // break;
  754 +
  755 + // case 2: //会员团和商家团的展示
  756 + // //---画线---
  757 + // context.setLineWidth(1 * unit)
  758 + // context.moveTo(32 * unit, 670 * unit)
  759 + // context.lineTo(520 * unit, 670 * unit)
  760 + // context.stroke();
  761 + // //---文字---
  762 + // context.setFillStyle("black")
  763 + // context.setFontSize(24 * unit)
  764 + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
  765 +
  766 + // //绘制成团图片
  767 + // var ct_img = "../../../../images/share/ct_num.png";
  768 + // context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit);
  769 + // var ct_num = th.data.prom_act.ct_num;
  770 + // context.setFontSize(14 * unit)
  771 + // // context.font = 'normal';
  772 + // context.setFillStyle("red")
  773 + // if (ct_num < 10) {
  774 + // context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit);
  775 + // } else {
  776 + // context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit);
  777 + // }
  778 + // context.setFontSize(22 * unit)
  779 + // context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit);
  780 +
  781 + // context.setFillStyle("gray")
  782 + // context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit);
  783 + // context.setFillStyle("black")
  784 + // // context.font = 'normal bold 18px sans-serif';
  785 + // context.setFontSize(21.3 * unit)
  786 + // context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit);
  787 +
  788 +
  789 + // //---二维吗图---
  790 + // //-- 自定义海报 --
  791 + // if (th.data.poster) {
  792 + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
  793 + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
  794 + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
  795 + // } else {
  796 + // //---二维吗图---
  797 + // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
  798 + // }
  799 + // break
  800 + // case 3: //阶梯团的展示
  801 + // //---画线---
  802 + // context.setLineWidth(1 * unit)
  803 + // context.moveTo(32 * unit, 670 * unit)
  804 + // context.lineTo(520 * unit, 670 * unit)
  805 + // context.stroke();
  806 + // //---文字---
  807 + // context.setFillStyle("black")
  808 + // context.setFontSize(24 * unit)
  809 + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
  810 +
  811 + // //---绘制中间阶梯的价格---
  812 + // var list = th.data.prom_act.ct_rylist;
  813 + // for (var i = 0; i < list.length; i++) {
  814 + // var item = list[i];
  815 + // var wi = i * 90 * unit;
  816 + // // context.font = 'normal';
  817 + // context.setFontSize(16 * unit)
  818 + // context.setFillStyle("red")
  819 + // context.fillText("¥", 40 * unit + wi, 756 * unit);
  820 + // context.setFontSize(22 * unit)
  821 + // var pri = parseFloat(item.price).toFixed(2);
  822 + // context.fillText(pri, 56 * unit + wi, 756 * unit);
  823 + // context.setFillStyle("gray")
  824 + // context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);
  825 + // }
  826 + // //----------------下面部分----------------
  827 + // // context.setFillStyle("gray")
  828 + // // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit);
  829 + // // context.setFillStyle("black")
  830 + // // context.font = 'normal bold 18px sans-serif';
  831 + // // context.setFontSize(22 * unit)
  832 + // // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit);
  833 + // //context.setFillStyle("gray")
  834 + // context.setFillStyle("black")
  835 + // context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit);
  836 + // //context.font = 'normal bold 18px sans-serif';
  837 + // context.setFontSize(21 * unit)
  838 + // context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit);
  839 +
  840 +
  841 + // //-- 自定义海报 --
  842 + // if (th.data.poster) {
  843 + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
  844 + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
  845 + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
  846 + // } else {
  847 + // //---二维吗图---
  848 + // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
  849 + // }
  850 + // break;
  851 +
  852 +
  853 + // case 9:
  854 +
  855 + // //---画线---
  856 + // context.setLineWidth(1 * unit)
  857 + // context.moveTo(32 * unit, 680 * unit)
  858 + // context.lineTo(520 * unit, 680 * unit)
  859 + // context.stroke();
  860 +
  861 + // //---文字---
  862 + // context.setFillStyle("black")
  863 + // context.setFontSize(24 * unit)
  864 + // // context.font = 'normal bold 18px';
  865 + // // context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
  866 +
  867 + // //还差N人,即可成团
  868 + // let group_num = th.data.luckyGoInfo.group_num;
  869 + // let num_joined = th.data.luckyGoInfo.num;
  870 + // let delta1 = group_num - num_joined;
  871 + // let width_delta1 = ut.measureText(delta1, 15);
  872 + // context.setFillStyle("black");
  873 + // context.setFontSize(21.3 * unit);
  874 + // context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit);
  875 + // context.setFillStyle("#FF6768");
  876 + // context.setFontSize(21.3 * unit);
  877 + // context.fillText(delta1, 160 * unit, 772 * unit);
  878 + // context.setFillStyle("black");
  879 + // context.setFontSize(21.3 * unit);
  880 + // context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit);
  881 +
  882 + // // N人得商品,N人全额退款
  883 + // let group_win = th.data.luckyGoInfo.group_win;
  884 + // let delta2 = group_num - group_win;
  885 + // let width_delta2 = ut.measureText(delta2, 16);
  886 + // let width_groupNum = ut.measureText(group_num, 15);
  887 + // let width_groupWin = ut.measureText(group_win, 15);
  888 + // context.setFillStyle("#FF6768");
  889 + // context.setFontSize(21.3 * unit);
  890 + // context.fillText(group_win, 40 * unit, 806 * unit);
  891 + // context.setFillStyle("black");
  892 + // context.setFontSize(21.3 * unit);
  893 + // context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit);
  894 + // context.setFillStyle("#FF6768");
  895 + // context.setFontSize(21.3 * unit);
  896 + // context.fillText(delta2, 160 * unit, 806 * unit);
  897 + // context.setFillStyle("black");
  898 + // context.setFontSize(21.3 * unit);
  899 + // context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit);
  900 +
  901 + // // 并得帮团惊喜礼品
  902 + // context.setFillStyle("black")
  903 + // context.setFontSize(21.3 * unit)
  904 + // context.fillText("并得帮团", 40 * unit, 840 * unit);
  905 + // context.setFillStyle("#FF6768")
  906 + // context.setFontSize(21.3 * unit)
  907 + // context.fillText("惊喜礼品", 130 * unit, 840 * unit);
  908 + // context.setFillStyle("black")
  909 + // context.setFontSize(21.3 * unit)
  910 + // context.fillText("!", 220 * unit, 840 * unit);
  911 +
  912 +
  913 + // //---二维吗图---
  914 + // //-- 自定义海报 --
  915 + // if (th.data.poster) {
  916 + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
  917 + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
  918 + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
  919 + // } else {
  920 + // //---二维吗图---
  921 + // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit);
  922 + // }
  923 +
  924 + // break;
  925 +
  926 +
  927 + // }
  928 +
  929 +
  930 + // //--- 如果是自定义海报的时候 ---
  931 + // if(type != 0) {
  932 +
  933 + // if (th.data.poster && parseInt(th.data.poster.style) == 2) {
  934 +
  935 + // //如果显示会员信息的话
  936 + // if (parseInt(th.data.poster.show_headpic)) {
  937 + // //获取坐标
  938 + // var x = parseFloat(th.data.poster.head_x) * 2;
  939 + // var y = parseFloat(th.data.poster.head_y) * 2;
  940 + // //---绘制圆形要放在最后----
  941 + // context.save();
  942 + // context.beginPath();
  943 + // var h_x = x * unit;
  944 + // var h_y = y * unit;
  945 + // var h_r = 40 * unit;
  946 + // var cx = h_x + h_r;
  947 + // var cy = h_y + h_r;
  948 + // context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  949 + // context.closePath();
  950 + // context.fill();
  951 + // context.clip();
  952 + // context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
  953 + // context.restore();
  954 + // }
  955 +
  956 + // } else {
  957 + // //---绘制圆形要放在最后----
  958 + // // context.save();
  959 + // // context.beginPath();
  960 + // // var h_x = 60 * unit;
  961 + // // var h_y = 24 * unit;
  962 + // // var h_r = 40 * unit;
  963 + // // var cx = h_x + h_r;
  964 + // // var cy = h_y + h_r;
  965 + // // context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  966 + // // context.closePath();
  967 + // // context.fill();
  968 + // // context.clip();
  969 + // // context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
  970 + // // context.restore();
  971 + // }
  972 +
  973 + // };
  974 +
  975 +
  976 +
  977 + //把画板内容绘制成图片,并回调 画板图片路径
  978 + context.draw(false, function () {
  979 + setTimeout(function () {
  980 + wx.canvasToTempFilePath({
  981 + x: 0,
  982 + y: 0,
  983 + width: 750,
  984 + height: 1217,
  985 + destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
  986 + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
  987 + canvasId: 'share',
  988 + success: function (res) {
  989 + console.log('生成成功');
  990 + that.setData({
  991 + shareImgPath: res.tempFilePath,
  992 + canvasHidden: true
  993 + })
  994 +
  995 + if (!res.tempFilePath) {
  996 + wx.showModal({
  997 + title: '提示',
  998 + content: '图片绘制中,请稍后重试',
  999 + showCancel: false
  1000 + })
  1001 + return false;
  1002 + }
  1003 +
  1004 + // wx.previewImage({
  1005 + // //将图片预览出来
  1006 + // urls: [that.data.shareImgPath]
  1007 + // });
  1008 + that.setData({
  1009 + showPoster: true,
  1010 + });
  1011 + wx.hideLoading();
  1012 + },
  1013 + fail: function() {
  1014 + console.log('生成失败');
  1015 + },
  1016 + })
  1017 + }, 500)
  1018 +
  1019 + });
730 }); 1020 });
731 - }, 1021 + },
  1022 + fail: function (res) {
  1023 + console.log(res);
  1024 + wx.hideLoading();
  1025 +
  1026 + }
  1027 + });
  1028 + },
732 1029
733 1030
734 //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 1031 //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
@@ -818,7 +1115,7 @@ Page({ @@ -818,7 +1115,7 @@ Page({
818 tt(); 1115 tt();
819 return false; 1116 return false;
820 } 1117 }
821 - var path2 = os.imghost + ee.data.teamlist.share_imgurl; 1118 + var path2 = os.imghost + ee.data.luckyGoInfo.original_img;
822 //获取商品是分享图信息 1119 //获取商品是分享图信息
823 wx.getImageInfo({ 1120 wx.getImageInfo({
824 src: path2, 1121 src: path2,
packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml
@@ -328,13 +328,15 @@ @@ -328,13 +328,15 @@
328 <view class="poster-wrapper"> 328 <view class="poster-wrapper">
329 <view class="poster"> 329 <view class="poster">
330 <!-- <view class="poster" bindtap="previewImage"> --> 330 <!-- <view class="poster" bindtap="previewImage"> -->
331 - <image src="{{shareImgPath}}" class="poster-img" show-menu-by-longpress></image>  
332 - <view class="btn-close" catchtap="closePoster"><text class="iconfont icon-close"></text></view> 331 + <image src="{{shareImgPath}}" class="poster-img"></image>
  332 + <view class="btn-close" catchtap="closePoster">
  333 + <text class="iconfont icon-close"></text>
  334 + </view>
  335 + </view>
  336 + <view class="btn-container">
  337 + <!-- <button class="btn-share" open-type="share" bindtap="">微信好友分享</button> -->
  338 + <button class="btn-share" bindtap="savePic">保存到相册</button>
333 </view> 339 </view>
334 - <view class="btn-container">  
335 - <!--<button class="btn-share" open-type="share" bindtap="">微信好友分享</button>-->  
336 - <button class="btn-share" bindtap="savePic">保存到相册</button>  
337 - </view>  
338 </view> 340 </view>
339 </view> 341 </view>
340 </view> 342 </view>