From 6c8ece97e0fe22dd62598d3118bf0b718a4730eb Mon Sep 17 00:00:00 2001 From: taiyuan Date: Sat, 20 Nov 2021 10:42:50 +0800 Subject: [PATCH] 幸运购订单详情退款信息 --- packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js | 987 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml | 14 ++++++++------ 2 files changed, 650 insertions(+), 351 deletions(-) diff --git a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js index 09b2cd9..4a28f1c 100644 --- a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js +++ b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.js @@ -47,6 +47,7 @@ Page({ showRules: false, isSuccess: false, + showPoster: false, }, onLoad: function (t) { // wx.setNavigationBarTitle({ title: "拼团订单",}) @@ -319,28 +320,28 @@ Page({ }) //--当是成团的时候的操作-- - if(order.pt_status==2 || order.pt_status==4 || order.pt_status==5){ - //设置值 - - ee.setData({ - ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, min_price: min_price, - order: order, share_img: share_img,max_num:max_num, - pindGoods: teamlist,is_show:1, zk:false, - hiddenName: false, ct_price:ct_price,p_status:p_status,sf_arr:sf_arr}); - - //--是否支付了尾款-- - if(order.pt_status==4 || order.pt_status==5){ - ee.setData({is_pay_wk:1}); - } - }else{ - console.log("239什么鬼", teamlist); - //设置值 - ee.setData({ - ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, - order: order, p_status: p_status, min_price:min_price, - share_img: share_img, max_num: max_num, pindGoods: teamlist, is_show: 1, - ct_price: ct_price, p_status: p_status,sf_arr:sf_arr}); - } + // if(order.pt_status==2 || order.pt_status==4 || order.pt_status==5){ + // //设置值 + + // ee.setData({ + // ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, min_price: min_price, + // order: order, share_img: share_img,max_num:max_num, + // pindGoods: teamlist,is_show:1, zk:false, + // hiddenName: false, ct_price:ct_price,p_status:p_status,sf_arr:sf_arr}); + + // //--是否支付了尾款-- + // if(order.pt_status==4 || order.pt_status==5){ + // ee.setData({is_pay_wk:1}); + // } + // }else{ + // console.log("239什么鬼", teamlist); + // //设置值 + // ee.setData({ + // ordertx2: ordertx2, ordertx: ordertx, teamlist: teamlist, teamgroup: teamgroup, + // order: order, p_status: p_status, min_price:min_price, + // share_img: share_img, max_num: max_num, pindGoods: teamlist, is_show: 1, + // ct_price: ct_price, p_status: p_status,sf_arr:sf_arr}); + // } wx.hideLoading(); @@ -351,17 +352,17 @@ Page({ ee.countDown2(); //获取分享图片的本地地址 - var path2 = os.imghost + teamlist.share_imgurl; - wx.getImageInfo({ - src: path2, - success: function (res) { - //res.path是网络图片的本地地址 - ee.data.share_img_localpath = res.path; - }, - fail: function (res) { - //失败回调 - } - }); + // var path2 = os.imghost + th.data.luckyGoInfo.original_img; + // wx.getImageInfo({ + // src: path2, + // success: function (res) { + // //res.path是网络图片的本地地址 + // ee.data.share_img_localpath = res.path; + // }, + // fail: function (res) { + // //失败回调 + // } + // }); }, @@ -415,320 +416,616 @@ Page({ setTimeout(th.countDown2, 1000); }, - //--定义的保存图片方法,分享团--- - saveImageToPhotosAlbum: function () { - //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 - var type=1; - if(this.data.teamlist.kttype==3) type=2; - - wx.showLoading({ title: '生成中...', }) - var that = this, th = that; - //设置画板显示,才能开始绘图 - that.setData({ - canvasHidden: true, - }) - - if(this.data.share_hidden) { - this.setData({ - share_hidden: false, - }); - }; - - var app = getApp(); - var unit = that.data.screenWidth / 750 * 1.35; - var scene=th.data.teamgroup.id; - var user_id=getApp().globalData.user_id?getApp().globalData.user_id:0; - if(user_id>0){ - scene+="_"+user_id; - } - - //二微码 - var path3 = os.url+ "/api/wx/open/app/user/getWeAppEwm/"+ - os.stoid+"?sceneValue="+scene+"&pageValue=pages/team/team_show/team_show"; - //读取文件成功则OK-- - wx.getImageInfo({ - src: path3, - success:function (res) { - //回调写法 - th.get_head_temp(th.get_goods_temp,function () { - var vpath = res.path; - var context = wx.createCanvasContext('share'); - - - //先画背景 - var pg_path = "../../../../images/share/share_bg.png"; - //-- 如果有自定义海报的时候,判断背景的图片 -- - if(th.data.share_b_img){ - pg_path=th.data.share_b_img; - } - - var share_title=th.data.teamlist.share_title; - if(!share_title) - share_title=th.data.teamlist.title; - context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); - - //-- 是自定义海报的情况下 -- - if(th.data.poster && parseInt(th.data.poster.style)==2){ - //在线上分享人的情况下 - if(parseInt(th.data.poster.show_headpic)){ - //获取坐标 - var x=parseFloat(th.data.poster.head_x)*2; - var y=parseFloat(th.data.poster.head_y)*2; - var x1=(x+90) *unit; - var y1=(y+50) *unit; - //--昵称--- - context.setFontSize(24 * unit) - context.setFillStyle("black") - context.fillText(app.globalData.userInfo.nickname, x1, y1); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; - //强烈推荐 改许程 - var tj_path = "../../../../images/share/q_tj.png"; - context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit); - context.setFontSize(16 * unit) - context.setLineJoin('round'); //交点设置成圆角 - context.setFillStyle("white") - context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit); - } - - }else{ - //--昵称--- - context.setFontSize(24 * unit) - context.setFillStyle("black") - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; - //强烈推荐 - var tj_path = "../../../../images/share/q_tj.png"; - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 110 * unit, 30 * unit); - context.setFontSize(18 * unit) - context.setFillStyle("white") - context.fillText('强烈推荐', 152 * unit + width + 20 * unit, 76 * unit); - } - - //---产品名称--- - context.setFontSize(21.3 * unit); - context.setFillStyle("black"); - - - - - th.draw_Text(context,share_title, - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); - //------产品的价格------- - context.setFontSize(24 * unit) - context.setFillStyle("red") - - var pri0 = th.data.teamlist.price; - pri0=parseFloat(pri0).toFixed(2); - var wd1=th.data.screenWidth-ut.measureText(pri0, 31 * unit)-25; - context.fillText("¥", wd1-15, 180 * unit); - context.setFontSize(31 * unit) - context.fillText(pri0, wd1, 180 * unit); - - //---市场价划掉--- - context.setFillStyle("gray") - context.setFontSize(22 * unit) - pri0= "¥" + parseFloat(th.data.goods.market_price).toFixed(2); - var wd2=th.data.screenWidth-ut.measureText(pri0, 22 * unit)-25; - context.fillText(pri0, wd2, 210 * unit); - - context.setStrokeStyle('gray') - context.setLineWidth(1 * unit) - context.moveTo(wd2-5, 204 * unit) - context.lineTo(wd2+ut.measureText(pri0, 22 * unit)+5, 204 * unit) - context.stroke(); - console.log(th.data.share_img_localpath); - - - //---中间大图--- - context.drawImage(th.data.share_img_localpath, 68 * unit, 242 * unit, 410 * unit, 410 * unit); - - var g_ct=th.data.teamlist.ct_num-th.data.ordertx.length; - var wz= ""; - if(g_ct>0) wz="还差"+g_ct+"人成团,"; - else{ - g_ct= th.data.max_num -th.data.ordertx.length; - if(g_ct>0){ - wz="还差"+g_ct+"人享最低优惠,"; - }else{ - wz="已享受最优惠,"; - } - } - - //-------大图后面就不一样了----------- - switch (type) { - case 1://会员团和商家团的展示 - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 670 * unit) - context.lineTo(520 * unit, 670 * unit) - context.stroke(); - - //---文字--- - context.setFontSize(22 * unit) - context.setFillStyle("black") - context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); - - //绘制成团图片 - var ct_img ="../../../../images/share/ct_num.png"; - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); - var ct_num = th.data.teamlist.ct_num; - context.setFontSize(14 * unit) - - context.setFillStyle("red") - if(ct_num<10){ - context.fillText(ct_num+"人拼团", 92 * unit, 760 * unit); - }else{ - context.fillText(ct_num+"人拼团", 86 * unit, 760 * unit); - } - context.setFontSize(22 * unit) - context.fillText("已拼"+th.data.teamlist.buy_num+"份", 166 * unit, 763 * unit); - context.setFillStyle("gray") - context.fillText(wz+"快来和我一起拼团吧!", 40 * unit, 826 * unit); - context.setFillStyle("black") - - context.setFontSize(22 * unit) - context.fillText("长按识别二维码,立即参团", 40 * unit, 856 * unit); - //---二维吗图--- - //-- 自定义海报 -- - if(th.data.poster){ - var erm_x= parseFloat(th.data.poster.ewm_x)*2; - var erm_y= parseFloat(th.data.poster.ewm_y)*2; - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit); - }else{ - //---二维吗图--- - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); - } - break - case 2://阶梯团的展示 - //---画线--- - context.setLineWidth(1 * unit) - context.moveTo(32 * unit, 670 * unit) - context.lineTo(520 * unit, 670 * unit) - context.stroke(); - //---文字--- - context.setFontSize(22 * unit) - context.setFillStyle("black") - context.fillText("好物拼起来,拼拼更划算", 40 * unit, 726 * unit); - //---绘制中间阶梯的价格--- - var list= JSON.parse(th.data.teamlist.ct_rylist); - for(var i=0; i 0) { + scene += "_" + user_id; + } + //-- 如果不是会员分享过来的要分享给别人 -- + if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) { + //固定房间是第3个字符 + if (!user_id) scene += "_0"; + scene += "_" + getApp().globalData.room_id; + } + ///二微码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; + + console.log(path3); + + + // 读取文件成功则OK-- + wx.getImageInfo({ + src: path3, + success: function (res) { + // 回调写法 + th.get_head_temp(th.get_goods_temp, function () { + var vpath = res.path; + var context = wx.createCanvasContext('share'); + // 先画背景 + var pg_path = "../../../../images/share/share_bg.png"; + + // context.fillStyle="#FFFFFF"; + // context.fillRect(0,0,554 * unit, 899 * unit); + + // if(type == 0) { + // this.drawPoster(context); + // return false; + // }; + + + //-- 如果有自定义海报的时候,判断背景的图片 -- + if (th.data.share_b_img) { + pg_path = th.data.share_b_img; + } + // context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); + + + if(type == 0) { // 如果是普通商品,绘制新海报 + th.drawPoster(context, unit, th.data.share_goods_img, vpath); + } else { + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); + }; + + // th.drawPoster(context, unit, th.data.share_goods_img, vpath); + + + //-- 是自定义海报的情况下 -- + // if(type != 0) { + + + + // if (th.data.poster && parseInt(th.data.poster.style) == 2) { + // //在线上分享人的情况下 + // if (parseInt(th.data.poster.show_headpic)) { + // //获取坐标 + // var x = parseFloat(th.data.poster.head_x) * 2; + // var y = parseFloat(th.data.poster.head_y) * 2; + // var x1 = (x + 90) * unit; + // var y1 = (y + 50) * unit; + // //--昵称--- + // context.setFontSize(24 * unit) + // context.setFillStyle("black") + // context.fillText(app.globalData.userInfo.nickname, x1, y1); + // var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; + // //强烈推荐 改许程 + // var tj_path = "../../../../images/share/q_tj.png"; + // context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); + // context.setFontSize(16 * unit); + // context.setLineJoin('round'); //交点设置成圆角 + // context.setFillStyle("white"); + // context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit); + + // //context.setFillStyle("black") + // //context.setFontSize(24 * unit) + // //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); + // } + // } else { + // //--昵称--- + // context.setFontSize(24 * unit); + // context.setFillStyle("black"); + // context.fillText(app.globalData.userInfo.nickname, 152 * unit, 60 * unit); + // var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; + // //强烈推荐 改许程 + // // var tj_path = "../../../../images/share/q_tj.png"; + // // let txt_gn = th.data.luckGoInfo.group_num + '人团'; + // // let width_gn = ut.measureText(txt_gn, 15); + // // context.drawImage(tj_path, 152 * unit + width, 54 * unit, (width_gn + 20) * unit, 30 * unit); + // // context.setFontSize(16 * unit); + // // context.setLineJoin('round'); //交点设置成圆角 + // // context.setFillStyle("white"); + // // context.fillText(txt_gn, 149 * unit + width + 15 * unit, 75 * unit); + // // 发出幸运购活动邀请 + // context.setFillStyle("#7f7f7f") + // context.setFontSize(21.3 * unit) + // context.fillText("向您发出幸运购邀请", 152 * unit, 90 * unit); + + // } + + // }; + + + // // var share_title = th.data.data.goods_name; + // var share_title = th.data.param.goods_name; + // if (th.data.prom_type == 1 || th.data.prom_type == 6 || th.data.prom_type == 4) { + // share_title = th.data.prom_act.share_title; + // if (!share_title) share_title = th.data.prom_act.title; + // if (th.data.prom_type == 4) share_title = th.data.prom_act.name; + // } + + // //---产品名称--- + // //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 + // if (type != 4 && type != 0) { + // context.setFillStyle("black"); + // context.setFontSize(21.3 * unit) + // th.draw_Text(context, share_title, + // 38 * unit, 180 * unit, 220 * unit, 220 * unit, unit); + + // //------产品的价格------- + // context.setFontSize(23 * unit) + // context.setFillStyle("red") + + + // // var pri0 = th.data.data.shop_price; + // var pri0 = th.data.luckyGoInfo.group_price; + // if (th.data.prom_act) + // pri0 = th.data.prom_act.price; + // pri0 = parseFloat(pri0).toFixed(2); + // var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; + // context.fillText("¥", wd1 - 15, 185 * unit); + // context.setFontSize(31 * unit) + // context.fillText(pri0, wd1, 185 * unit); + + // var tj_path = "../../../../images/share/q_tj.png"; + // context.drawImage(tj_path, 315 * unit, 158 * unit, 85 * unit, 30 * unit); + // context.setLineJoin('round'); //交点设置成圆角 + // context.setFontSize(18 * unit); + // context.setFillStyle("white"); + // context.fillText('参团价', 330 * unit, 179 * unit); + + // //---市场价划掉--- + // context.setFillStyle("gray") + // context.setFontSize(22 * unit) + // pri0 = "零售价:¥" + th.data.luckyGoInfo.market_price.toFixed(2); + // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; + // context.fillText(pri0, wd2, 213 * unit); + + // context.setStrokeStyle('gray'); + // context.setLineWidth(1 * unit); + // context.moveTo(wd2 - 5, 206 * unit); + // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); + // context.stroke(); + + // } else if(type == 4 && type != 0) { + // context.setFillStyle("black"); + // context.setFontSize(21.3 * unit) + // th.draw_Text(context, share_title, + // 38 * unit, 170 * unit, 20 * unit, 300 * unit, unit); + // //------ 产品的价格 ----- + // var pri0 = th.data.prom_act.addmoney; + // var integral = th.data.prom_act.integral; + // var text = ""; + // if (integral) { text = integral + "积分"; } + // if (pri0 && integral) { text += "+"; } + // if (pri0) { text += "¥" + pri0; } + + // if (!pri0 && !integral) { text = "0积分"; } + // context.setFillStyle("red"); + // context.fillText(text, 38 * unit, 235 * unit); + + // } + + // //---中间大图--- + // if(type != 0) { + // // context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); + // context.drawImage(th.data.luckyGoInfo.original_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); + // }; + + + + // //-------大图后面就不一样了----------- + // switch (type) { + // case 0: break;//普通商品的展示 + // case 4: + // //中间的几个字 + // if (th.data.poster && parseInt(th.data.poster.style) == 2) { + // if (parseInt(th.data.poster.show_quality)) { + // var g_path = "../../../../images/share/s_gou.png"; + // context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); + // context.setFillStyle("red") + // context.setFontSize(18 * unit) + // context.fillText("正品保证", 84 * unit, 690 * unit); + + // context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); + // context.setFillStyle("red") + // context.setFontSize(18 * unit) + // context.fillText("纯实体店", 246 * unit, 690 * unit); + + // context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); + // context.setFillStyle("red") + // context.setFontSize(18 * unit) + // context.fillText("官方验证", 420 * unit, 690 * unit); + // } + + // } else { + // var g_path = "../../../../images/share/s_gou.png"; + // context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); + // context.setFillStyle("red") + // context.setFontSize(18 * unit) + // context.fillText("正品保证", 84 * unit, 690 * unit); + + // context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); + // context.setFillStyle("red") + // context.setFontSize(18 * unit) + // context.fillText("纯实体店", 246 * unit, 690 * unit); + + // context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); + // context.setFillStyle("red") + // context.setFontSize(18 * unit) + // context.fillText("官方验证", 420 * unit, 690 * unit); + // } + + + // //---画线--- + // context.setLineWidth(1 * unit) + // context.moveTo(32 * unit, 710 * unit) + // context.lineTo(520 * unit, 710 * unit) + // context.stroke(); + + // //---文字--- + // context.setFillStyle("black") + // context.setFontSize(22 * unit) + + // if (type == 0) { + // // 原来start ---> + // context.setFontSize(24 * unit) + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); + + // context.setFontSize(22 * unit) + // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit); + // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit); + + // } else { + // context.setFontSize(24 * unit) + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); + // context.setFontSize(22 * unit) + // context.fillText("长按识别二维码", 40 * unit, 806 * unit); + // context.fillText("立即开始兑换", 40 * unit, 846 * unit); + + // } + + // //---二维吗图--- + // //-- 自定义海报 -- + // if (th.data.poster) { + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2; + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2; + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); + // } else { + // //---二维吗图--- + // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); + // }; + + // break; + // case 1: //秒杀商品的展示 + // //---画线--- + // context.setLineWidth(1 * unit) + // context.moveTo(32 * unit, 670 * unit) + // context.lineTo(520 * unit, 670 * unit) + // context.stroke(); + + // //画秒杀的图片 + // var miaos_path = '../../../../images/share/miao_share.png'; + // context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); + + // context.setFillStyle("black") + // context.setFontSize(24 * unit) + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit); + // //---文字--- + // context.setFontSize(22 * unit) + // context.setFillStyle("black") + // context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit); + // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); + + + // //---二维吗图--- + // //-- 自定义海报 -- + // if (th.data.poster) { + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2; + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2; + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 135 * unit, 135 * unit); + // } else { + // //---二维吗图--- + // context.drawImage(vpath, 390 * unit, 726 * unit, 135 * unit, 135 * unit); + // } + // break; + + // case 2: //会员团和商家团的展示 + // //---画线--- + // context.setLineWidth(1 * unit) + // context.moveTo(32 * unit, 670 * unit) + // context.lineTo(520 * unit, 670 * unit) + // context.stroke(); + // //---文字--- + // context.setFillStyle("black") + // context.setFontSize(24 * unit) + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); + + // //绘制成团图片 + // var ct_img = "../../../../images/share/ct_num.png"; + // context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); + // var ct_num = th.data.prom_act.ct_num; + // context.setFontSize(14 * unit) + // // context.font = 'normal'; + // context.setFillStyle("red") + // if (ct_num < 10) { + // context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit); + // } else { + // context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit); + // } + // context.setFontSize(22 * unit) + // context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit); + + // context.setFillStyle("gray") + // context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit); + // context.setFillStyle("black") + // // context.font = 'normal bold 18px sans-serif'; + // context.setFontSize(21.3 * unit) + // context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit); + + + // //---二维吗图--- + // //-- 自定义海报 -- + // if (th.data.poster) { + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2; + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2; + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); + // } else { + // //---二维吗图--- + // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); + // } + // break + // case 3: //阶梯团的展示 + // //---画线--- + // context.setLineWidth(1 * unit) + // context.moveTo(32 * unit, 670 * unit) + // context.lineTo(520 * unit, 670 * unit) + // context.stroke(); + // //---文字--- + // context.setFillStyle("black") + // context.setFontSize(24 * unit) + // context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); + + // //---绘制中间阶梯的价格--- + // var list = th.data.prom_act.ct_rylist; + // for (var i = 0; i < list.length; i++) { + // var item = list[i]; + // var wi = i * 90 * unit; + // // context.font = 'normal'; + // context.setFontSize(16 * unit) + // context.setFillStyle("red") + // context.fillText("¥", 40 * unit + wi, 756 * unit); + // context.setFontSize(22 * unit) + // var pri = parseFloat(item.price).toFixed(2); + // context.fillText(pri, 56 * unit + wi, 756 * unit); + // context.setFillStyle("gray") + // context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit); + // } + // //----------------下面部分---------------- + // // context.setFillStyle("gray") + // // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit); + // // context.setFillStyle("black") + // // context.font = 'normal bold 18px sans-serif'; + // // context.setFontSize(22 * unit) + // // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit); + // //context.setFillStyle("gray") + // context.setFillStyle("black") + // context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit); + // //context.font = 'normal bold 18px sans-serif'; + // context.setFontSize(21 * unit) + // context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit); + + + // //-- 自定义海报 -- + // if (th.data.poster) { + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2; + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2; + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); + // } else { + // //---二维吗图--- + // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); + // } + // break; + + + // case 9: + + // //---画线--- + // context.setLineWidth(1 * unit) + // context.moveTo(32 * unit, 680 * unit) + // context.lineTo(520 * unit, 680 * unit) + // context.stroke(); + + // //---文字--- + // context.setFillStyle("black") + // context.setFontSize(24 * unit) + // // context.font = 'normal bold 18px'; + // // context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); + + // //还差N人,即可成团 + // let group_num = th.data.luckyGoInfo.group_num; + // let num_joined = th.data.luckyGoInfo.num; + // let delta1 = group_num - num_joined; + // let width_delta1 = ut.measureText(delta1, 15); + // context.setFillStyle("black"); + // context.setFontSize(21.3 * unit); + // context.fillText(group_num + "人团,还差", 40 * unit, 772 * unit); + // context.setFillStyle("#FF6768"); + // context.setFontSize(21.3 * unit); + // context.fillText(delta1, 160 * unit, 772 * unit); + // context.setFillStyle("black"); + // context.setFontSize(21.3 * unit); + // context.fillText("人,即可成团", (170 + width_delta1) * unit, 772 * unit); + + // // N人得商品,N人全额退款 + // let group_win = th.data.luckyGoInfo.group_win; + // let delta2 = group_num - group_win; + // let width_delta2 = ut.measureText(delta2, 16); + // let width_groupNum = ut.measureText(group_num, 15); + // let width_groupWin = ut.measureText(group_win, 15); + // context.setFillStyle("#FF6768"); + // context.setFontSize(21.3 * unit); + // context.fillText(group_win, 40 * unit, 806 * unit); + // context.setFillStyle("black"); + // context.setFontSize(21.3 * unit); + // context.fillText("人得商品,", (54 + width_groupWin) * unit, 806 * unit); + // context.setFillStyle("#FF6768"); + // context.setFontSize(21.3 * unit); + // context.fillText(delta2, 160 * unit, 806 * unit); + // context.setFillStyle("black"); + // context.setFontSize(21.3 * unit); + // context.fillText("人全额退款", (170 + width_delta2) * unit, 806 * unit); + + // // 并得帮团惊喜礼品 + // context.setFillStyle("black") + // context.setFontSize(21.3 * unit) + // context.fillText("并得帮团", 40 * unit, 840 * unit); + // context.setFillStyle("#FF6768") + // context.setFontSize(21.3 * unit) + // context.fillText("惊喜礼品", 130 * unit, 840 * unit); + // context.setFillStyle("black") + // context.setFontSize(21.3 * unit) + // context.fillText("!", 220 * unit, 840 * unit); + + + // //---二维吗图--- + // //-- 自定义海报 -- + // if (th.data.poster) { + // var erm_x = parseFloat(th.data.poster.ewm_x) * 2; + // var erm_y = parseFloat(th.data.poster.ewm_y) * 2; + // context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); + // } else { + // //---二维吗图--- + // context.drawImage(vpath, 390 * unit, 726 * unit, 136 * unit, 136 * unit); + // } + + // break; + + + // } + + + // //--- 如果是自定义海报的时候 --- + // if(type != 0) { + + // if (th.data.poster && parseInt(th.data.poster.style) == 2) { + + // //如果显示会员信息的话 + // if (parseInt(th.data.poster.show_headpic)) { + // //获取坐标 + // var x = parseFloat(th.data.poster.head_x) * 2; + // var y = parseFloat(th.data.poster.head_y) * 2; + // //---绘制圆形要放在最后---- + // context.save(); + // context.beginPath(); + // var h_x = x * unit; + // var h_y = y * unit; + // var h_r = 40 * unit; + // var cx = h_x + h_r; + // var cy = h_y + h_r; + // context.arc(cx, cy, h_r, 0, Math.PI * 2, false); + // context.closePath(); + // context.fill(); + // context.clip(); + // context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); + // context.restore(); + // } + + // } else { + // //---绘制圆形要放在最后---- + // // context.save(); + // // context.beginPath(); + // // var h_x = 60 * unit; + // // var h_y = 24 * unit; + // // var h_r = 40 * unit; + // // var cx = h_x + h_r; + // // var cy = h_y + h_r; + // // context.arc(cx, cy, h_r, 0, Math.PI * 2, false); + // // context.closePath(); + // // context.fill(); + // // context.clip(); + // // context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); + // // context.restore(); + // } + + // }; + + + + //把画板内容绘制成图片,并回调 画板图片路径 + context.draw(false, function () { + setTimeout(function () { + wx.canvasToTempFilePath({ + x: 0, + y: 0, + width: 750, + height: 1217, + destWidth: 1.2 * 750 * 750 / that.data.screenWidth, + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth, + canvasId: 'share', + success: function (res) { + console.log('生成成功'); + that.setData({ + shareImgPath: res.tempFilePath, + canvasHidden: true + }) + + if (!res.tempFilePath) { + wx.showModal({ + title: '提示', + content: '图片绘制中,请稍后重试', + showCancel: false + }) + return false; + } + + // wx.previewImage({ + // //将图片预览出来 + // urls: [that.data.shareImgPath] + // }); + that.setData({ + showPoster: true, + }); + wx.hideLoading(); + }, + fail: function() { + console.log('生成失败'); + }, + }) + }, 500) + + }); }); - }, + }, + fail: function (res) { + console.log(res); + wx.hideLoading(); + + } + }); + }, //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 @@ -818,7 +1115,7 @@ Page({ tt(); return false; } - var path2 = os.imghost + ee.data.teamlist.share_imgurl; + var path2 = os.imghost + ee.data.luckyGoInfo.original_img; //获取商品是分享图信息 wx.getImageInfo({ src: path2, diff --git a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml index e9afd09..58b58df 100644 --- a/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml +++ b/packageC/pages/luckyGo/luckyGo_details/luckyGo_details.wxml @@ -328,13 +328,15 @@ - - + + + + + + + + - - - - -- libgit2 0.21.4