diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js index 6fa67cd..d99a0e6 100644 --- a/packageA/pages/goodsInfo/goodsInfo.js +++ b/packageA/pages/goodsInfo/goodsInfo.js @@ -27,6 +27,7 @@ Page({ color_type: 0, //线条控制 color_type_one: 0, color_type_two: 1, + is_share_text: 1, gid: "", stoid: o.stoid, @@ -38,6 +39,8 @@ Page({ data: null, content: "", //商品详情 + + gallery: null, //图片滚动 is_collect: 0, collect_id: 0, @@ -236,6 +239,8 @@ Page({ th = ee, gid = t.goods_id, first_leader=t.first_leader, + prom_type=t.prom_type, + prom_id=t.prom_id, room_id = t.room_id, room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id @@ -250,21 +255,27 @@ Page({ var gid_str = decodeURIComponent(t.scene); gid_str=gid_str.split("_"); gid=gid_str[0]; - if(gid_str.length>1){ + if(gid_str.length>1 && gid_str[1] && parseInt(gid_str[1])>0){ first_leader=gid_str[1]; } //-- 如果有room_id的获取 -- - if(gid_str.length>2 && gid_str[2]) { + if(gid_str.length>2 && gid_str[2] && parseInt(gid_str[2])>0) { room_id=gid_str[2]; room_user_share=1; }; + + if(gid_str.length>3 && gid_str[3] && parseInt(gid_str[3])>0) { + prom_type=gid_str[3]; + prom_id=gid_str[4]; + } + }; //-- 设置顶部高度 -- let height= getApp().globalData.navBarHeight; ee.setData({ gid: gid,top_nav:height}); - if(first_leader) { + if(first_leader>0) { getApp().globalData.first_leader=first_leader; //调用接口判断是不是会员 getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{ @@ -347,7 +358,37 @@ Page({ } }); - }, + //-- 自定义海报 -- + getApp().request.promiseGet("/api/weshop/goods/poster/page", { + data: { store_id: os.stoid, type: 1, is_use: 1 } + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]) { + + var poster_data = res.data.data.pageData[0]; + var json_str = poster_data.jsonStr; + + if (json_str) { + var json_data = JSON.parse(json_str); + if (json_data.bg_img) { + + //-- 把图片那到本地 -- + wx.getImageInfo({ + src: json_data.bg_img, + success: function (res) { + var path = res.path; + th.setData({ share_b_img: path }) + }, + fail: function (res) { } + }); + } + th.setData({ poster: json_data }) + + } + } + }) + + + }, //-- 获取直播的分享人的导购信息 -- async get_room_share_guide(share_openid) { @@ -568,14 +609,13 @@ Page({ // gid 在onload阶段已经保存在this.data中 onShow: function() { + getApp().check_can_share(this); //-- 看一下隐私政策要不要显示 -- var privacy_pop = this.selectComponent("#privacy_pop"); //组件的id if (privacy_pop) { privacy_pop.check_pri_show(); } - getApp().check_can_share(); - var that=this;var th=this; var ee = this,gid = this.data.gid, i = getApp().request; @@ -1386,6 +1426,9 @@ Page({ }, openSpecModel: function(t) { + + if(this.data.get_sto_ing) return false; + var th=this; var open_store = t.currentTarget.dataset.ind; if(getApp().is_sp_hao() && open_store==1){ wx.showToast({ @@ -1657,6 +1700,8 @@ Page({ }) } + this.data.get_sto_ing=1; + var timer_get = setInterval(function() { if (th.data.is_get_local_ok == 0) return false; if (!th.data.fir_def_store) return false; @@ -1772,6 +1817,7 @@ Page({ th.deal_pickup(e); } else{ + th.data.get_sto_ing=0; th.setData({ isshow:1 }) @@ -1901,160 +1947,162 @@ Page({ orderType:'asc', }, success: function(ee) { - if (ee.data.code == 0) { - - var check_all_cate=0; - if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){ - for(let i in ee.data.data.pageData){ - let item=ee.data.data.pageData[i]; - if(item.is_show==1){ - check_all_cate=1;break + if (ee.data.code == 0) { + + var check_all_cate=0; + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){ + for(let i in ee.data.data.pageData){ + let item=ee.data.data.pageData[i]; + if(item.is_show==1){ + check_all_cate=1;break + } } } - } - - if (check_all_cate) { - - - var sto_cate = ee.data.data.pageData; - var sto_arr = e.data.data.pageData; - var newarr = new Array(); - var qita = new Array(); - - var is_del_pk=0; - - //----要进行门店分组-------- - for (var i = 0; i < sto_arr.length; i++) { - //找一下这个门店有没有在分类数组内 - var find2 = 0, find2name = "",sort=0; - is_del_pk=0; - for (var m = 0; m < sto_cate.length; m++) { - if (sto_arr[i].category_id == sto_cate[m].cat_id) { - if (sto_cate[m].is_show != 1) { - is_del_pk = 1; - sto_arr.splice(i, 1); - i--; - } else { - find2 = sto_cate[m].cat_id; - find2name = sto_cate[m].cat_name; - sort = sto_cate[m].sort; - is_del_pk = 0; + + if (check_all_cate) { + + + var sto_cate = ee.data.data.pageData; + var sto_arr = e.data.data.pageData; + var newarr = new Array(); + var qita = new Array(); + + var is_del_pk=0; + + //----要进行门店分组-------- + for (var i = 0; i < sto_arr.length; i++) { + //找一下这个门店有没有在分类数组内 + var find2 = 0, find2name = "",sort=0; + is_del_pk=0; + for (var m = 0; m < sto_cate.length; m++) { + if (sto_arr[i].category_id == sto_cate[m].cat_id) { + if (sto_cate[m].is_show != 1) { + is_del_pk = 1; + sto_arr.splice(i, 1); + i--; + } else { + find2 = sto_cate[m].cat_id; + find2name = sto_cate[m].cat_name; + sort = sto_cate[m].sort; + is_del_pk = 0; + } + break; } - break; } - } - if(is_del_pk) continue; - - if (newarr.length > 0) { - var find = 0; - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 - if (find2 != 0) { - for (var ii = 0; ii < newarr.length; ii++) { - if (sto_arr[i].category_id == newarr[ii].cat_id) { - newarr[ii].s_arr.push(sto_arr[i]); - find = 1; - break; + if(is_del_pk) continue; + + if (newarr.length > 0) { + var find = 0; + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 + if (find2 != 0) { + for (var ii = 0; ii < newarr.length; ii++) { + if (sto_arr[i].category_id == newarr[ii].cat_id) { + newarr[ii].s_arr.push(sto_arr[i]); + find = 1; + break; + } + } + if (find == 0) { + var arr0 = new Array(); + arr0.push(sto_arr[i]); + var item = { + cat_id: find2, + name: find2name, + sort:sort, + s_arr: arr0 + }; + newarr.push(item); + } + } else { + qita.push(sto_arr[i]); + } + } else { + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 + if (find2 != 0) { + var arr0 = new Array(); + arr0.push(sto_arr[i]); + var item = { + cat_id: find2, + name: find2name, + sort:sort, + s_arr: arr0 + }; + newarr.push(item); + } else { + qita.push(sto_arr[i]); } } - if (find == 0) { - var arr0 = new Array(); - arr0.push(sto_arr[i]); - var item = { - cat_id: find2, - name: find2name, - sort:sort, - s_arr: arr0 - }; - newarr.push(item); + } + + var def_arr = new Array(); + //-- 开始就看10个门店 -- + for (var k = 0; k < 10; k++) { + if (k == sto_arr.length) break; + def_arr.push(sto_arr[k]); } - } else { - qita.push(sto_arr[i]); + + th.setData({ + def_pickpu_list: def_arr, + pickpu_list: ee.data.data.pageData + }); + + //门店分类要排序下 + function compare(property){ + return function(a,b){ + var value1 = a[property]; + var value2 = b[property]; + return value1 - value2; + } } - } else { - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 - if (find2 != 0) { - var arr0 = new Array(); - arr0.push(sto_arr[i]); + if(newarr.length>0) + newarr.sort(compare("sort")); + + //----安排其他的分类----- + if (qita.length > 0) { var item = { - cat_id: find2, - name: find2name, - sort:sort, - s_arr: arr0 + cat_id: -1, + name: "其他", + s_arr: qita }; newarr.push(item); - } else { - qita.push(sto_arr[i]); } - } - } - var def_arr = new Array(); - //-- 开始就看10个门店 -- - for (var k = 0; k < 10; k++) { - if (k == sto_arr.length) break; - def_arr.push(sto_arr[k]); - } + var sd={ + all_sto: newarr, + is_show_sto_cat:1 + } + if(!sto_arr || sto_arr.length<=10){ + sd.is_show_sto_cat=-1; + sd.only_pk=sto_arr; + } + th.setData(sd); + } else { + th.setData({ + is_show_sto_cat: -1, + only_pk: e.data.data.pageData + }); + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------ + if (!th.data.def_pick_store) { + th.setData({def_pick_store:e.data.data.pageData[0]}) + } + } + } else { th.setData({ - def_pickpu_list: def_arr, - pickpu_list: ee.data.data.pageData + is_show_sto_cat: -1, + only_pk: e.data.data.pageData }); - - //门店分类要排序下 - function compare(property){ - return function(a,b){ - var value1 = a[property]; - var value2 = b[property]; - return value1 - value2; - } - } - if(newarr.length>0) - newarr.sort(compare("sort")); - - //----安排其他的分类----- - if (qita.length > 0) { - var item = { - cat_id: -1, - name: "其他", - s_arr: qita - }; - newarr.push(item); - } - - var sd={ - all_sto: newarr, - is_show_sto_cat:1 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------ + if (!th.data.def_pick_store) { + th.setData({def_pick_store:e.data.data.pageData[0]}) } - if(!sto_arr || sto_arr.length<=10){ - sd.is_show_sto_cat=-1; - sd.only_pk=sto_arr; - } - th.setData(sd); - - } else { - th.setData({ - is_show_sto_cat: -1, - only_pk: e.data.data.pageData - }); - //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------ - if (!th.data.def_pick_store) { - th.setData({def_pick_store:e.data.data.pageData[0]}) } - } - } else { - th.setData({ - is_show_sto_cat: -1, - only_pk: e.data.data.pageData - }); - //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------ - if (!th.data.def_pick_store) { - th.setData({def_pick_store:e.data.data.pageData[0]}) - } - - } + th.data.get_sto_ing=0; } }); - } else { + } else { + th.data.get_sto_ing=0; + th.setData({ is_show_sto_cat: 0, only_pk: e.data.data.pageData @@ -2092,494 +2140,7 @@ Page({ return param < 10 ? '0' + param : param; }, - - //--定义的保存图片方法,分享团--- - saveImageToPhotosAlbum: function() { - //--先判断会员状态-- - // var user_info = getApp().globalData.userInfo; - // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { - // //getApp().my_warnning("请先登录",0,this); - // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) - // return false; - // } - - //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 - var type = this.data.prom_type; - if (type == 6) type = 2; - if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; - - wx.showLoading({ - title: '生成中...', - }) - var that = this, - th = that; - //设置画板显示,才能开始绘图 - that.setData({ - canvasHidden: false - }) - - var app = getApp(); - var unit = that.data.screenWidth / 750 * 1.35; //基础单位, - var path2 = that.data.data.original_img; - var scene = th.data.gid+""; - var user_id = getApp().globalData.user_id?getApp().globalData.user_id:0; - if(user_id>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(th.data.share_b_img){ - pg_path=th.data.share_b_img; - } - 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); - - //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, 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, 85 * unit, 30 * unit); - context.setFontSize(16 * unit); - context.setLineJoin('round'); //交点设置成圆角 - context.setFillStyle("white"); - context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); - } - - - //---产品名称--- - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 - if(type!=4){ - context.setFillStyle("black"); - context.setFontSize(21.3 * unit) - th.draw_Text(context, th.data.data.goods_name, - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); - //------产品的价格------- - context.setFontSize(23 * unit) - context.setFillStyle("red") - context.fillText("¥", 416 * unit, 185 * unit); - context.setFontSize(31 * unit) - var pri0 = th.data.data.shop_price; - if (th.data.prom_act) - pri0 = th.data.prom_act.price; - pri0 = parseFloat(pri0).toFixed(2); - context.fillText(pri0, 438 * unit, 185 * unit); - //---市场价划掉--- - context.setFillStyle("gray") - context.setFontSize(22 * unit) - context.fillText("¥" + th.data.data.market_price, 426 * unit, 213 * unit); - context.setStrokeStyle('gray'); - context.setLineWidth(1 * unit); - context.moveTo(426 * unit, 206 * unit); - context.lineTo(510 * unit, 206 * unit); - context.stroke(); - - }else{ - context.setFillStyle("black"); - context.setFontSize(21.3 * unit) - th.draw_Text(context, th.data.data.goods_name, - 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); - - } - - //---中间大图--- - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); - //-------大图后面就不一样了----------- - switch (type) { - case 0: //普通商品的展示 - 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, 120 * unit, 120 * unit); - }else{ - //---二维吗图--- - context.drawImage(vpath, 410 * unit, 726 * unit, 115 * unit, 125 * 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, 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.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, 120 * unit, 120 * unit); - }else{ - //---二维吗图--- - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * 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(22 * 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, 120 * unit, 120 * unit); - }else{ - //---二维吗图--- - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); - } - break - - - } - - - //--- 如果是自定义海报的时候 --- - 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) { - 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(); - } - }) - }, 500) - - }); - }); - } - }); - }, - - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 - draw_Text: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { - var lineWidth = 0; - var lastSubStrIndex = 0; //每次开始截取的字符串的索引 - var han = 0; - for (let i = 0; i < str.length; i++) { - if (han == 2) return; - //lineWidth += ctx.measureText(str[i]).width; - lineWidth += ut.measureText(str[i], 21.3 * unit); - if (lineWidth > canvasWidth) { - han++; - - if (han == 2) - ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分 - else - ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); - - initHeight += 22; //22为字体的高度 - lineWidth = 0; - lastSubStrIndex = i; - titleHeight += 20; - } - if (i == str.length - 1) { //绘制剩余部分 - ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight); - } - } - }, // ----视频图片---- // 图片计数器 @@ -2636,7 +2197,7 @@ Page({ return false; } //---获取分享图片的本地地址,头像和商品图片---- - var path2 = getApp().globalData.userInfo.head_pic; + var path2 = getApp().globalData.userInfo?getApp().globalData.userInfo.head_pic:''; if (path2 == "") { ee.data.share_head = "../../../images/share/hui_hear_pic.png"; tt(func); @@ -2657,37 +2218,44 @@ Page({ }); } }, + //--获取商品图片的本地缓存,回调写法-- get_goods_temp: function(tt) { - var ee = this; - if (ee.data.share_goods_img) { - tt(); - return false; - } - //获取商品是分享图信息 - wx.getImageInfo({ - src: ee.data.data.original_img, - success: function(res) { - //res.path是网络图片的本地地址 - ee.data.share_goods_img = res.path; - tt(); - }, - fail: function(res) { - //获取默认空白图 - wx.getImageInfo({ - src: ee.data.iurl+'/miniapp/images/default_g_img.gif', - success: function(res) { - ee.data.share_goods_img = res.path; //分享的图片不能用网络的 - tt(); - } - }) + var ee = this; + if (ee.data.share_goods_img) { + tt(); + return false; + } - } - }); - }, + var img=ee.data.iurl+ee.data.data.image_url; + if(ee.data.prom_act && ee.data.prom_act.share_img){ + img=ee.data.iurl+ee.data.prom_act.share_img; + } + + //获取商品是分享图信息 + wx.getImageInfo({ + src: img, + success: function(res) { + //res.path是网络图片的本地地址 + ee.data.share_goods_img = res.path; + tt(); + }, + fail: function(res) { + //获取默认空白图 + wx.getImageInfo({ + src: ee.data.iurl+'/miniapp/images/default_g_img.gif', + success: function(res) { + ee.data.share_goods_img = res.path; //分享的图片不能用网络的 + tt(); + } + }) + + } + }); + }, - //--跳转到商品详情页面-- + //--跳转到商品详情页面-- go_goods: function(e) { var gid = e.currentTarget.dataset.gid; var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid; @@ -3673,7 +3241,7 @@ Page({ ee.get_normal(gid); return false; } - + var t_gd = ee.data.data; var prom_end_time = ut.formatTime(t.data.data.end_time, "yyyy-MM-dd hh:mm:ss"); var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss"); @@ -3686,6 +3254,7 @@ Page({ prom_act: t.data.data, prom_end_time: prom_end_time, prom_start_time: prom_start_time, + is_share_text: t.data.data.is_share_text }); ee.get_sto(); @@ -3957,6 +3526,8 @@ Page({ openSpecModel_Nor: function () { var th=this; + if(th.data.get_sto_ing) return false; + // 是否授权登陆 var user_info = getApp().globalData.userInfo; if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { @@ -4095,9 +3666,776 @@ Page({ }) } }, - - - + + clickShare() { + this.setData({ + share_hidden: true, + }); + }, + send() { + this.setData({ + share_hidden: false, + }); + }, + cancel() { + this.setData({ + share_hidden: false, + }); + }, + + + saveImageFn(){ + if(this.data.share_b_img){ + this.saveImageToPhotosAlbum() + }else{ + this.saveImageToPhotosAlbumDef() + } + }, + + + //--定义的保存图片方法,分享团--- + saveImageToPhotosAlbum: function () { + //--先判断会员状态-- + // var user_info = getApp().globalData.userInfo; + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + // //getApp().my_warnning("请先登录",0,this); + // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) + // return false; + // } + + if (this.data.share_hidden) { + this.setData({ + share_hidden: false, + }); + }; + + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 + var type = this.data.prom_type || 0; + console.log('商品类型-----'); + console.log(type); + // if (type == 2) type = -1; + if (type == 4) type = 0; + if (type == 8) type = 0; + if (type == 2) type = 0; + if (type == 6) type = 2; // 6拼团 2团购 + if (type == 10) type = -1; + + wx.showLoading({ + title: '生成中...', + }) + var that = this, + th = that; + //设置画板显示,才能开始绘图 + that.setData({ + canvasHidden: false + }) + + var app = getApp(); + var unit = that.data.screenWidth / 750 * 1.35; //基础单位, + var path2 = that.data.data.original_img; + + var scene = th.data.gid; + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; + if (user_id > 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; + }else{ + if (!user_id) scene += "_0"; + scene += "_0"; + } + if(this.data.prom_type){ + scene += "_" + this.data.prom_type+"_"+th.data.prom_id; + } + + + ///二微码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=packageA/pages/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"; + + //-- 如果有自定义海报的时候,判断背景的图片 -- + if (th.data.share_b_img) { + pg_path = th.data.share_b_img; + } + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); + + let nick=app.globalData.userInfo?app.globalData.userInfo.nickname:''; + + //-- 是自定义海报的情况下 -- + 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(nick, x1, y1); + var width = 24 * nick.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(nick, 152 * unit, 76 * unit); + var width = 24 * nick.length * unit + 2 * unit; + //强烈推荐 改许程 + var tj_path = "../../../images/share/q_tj.png"; + context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); + context.setFontSize(16 * unit); + context.setLineJoin('round'); //交点设置成圆角 + context.setFillStyle("white"); + context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); + } + + var share_title = th.data.data.goods_name; + + if (th.data.prom_type == 1 || th.data.prom_type == 2 || 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; + + //-- 显示活动时间 -- + if (th.data.share_b_img) { + act_time = "截止时间:" + ut.formatTime(th.data.prom_act.end_time); + } + } + + //---产品名称--- + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 + + context.setFillStyle("black"); + context.setFontSize(21.3 * unit) + th.draw_Text(context, share_title, + 80 * unit, 160 * unit, 200 * unit, 279 * unit, unit); + + //------产品的价格------- + context.setFontSize(23 * unit) + context.setFillStyle("red") + + // 7.商品价格 + let price = th.data.data.shop_price; + if (th.data.card_field && th.data.data[th.data.card_field]) { + price = th.data.data[th.data.card_field]; + } + if (th.data.prom_act) price = th.data.prom_price; + price = parseFloat(price).toFixed(2); + + var wd1 = th.data.screenWidth - ut.measureText(price, 31 * unit) - 25; + context.fillText("¥", wd1 - 15, 160 * unit); + context.setFontSize(31 * unit) + context.fillText(price, wd1, 165 * unit); + + //---市场价划掉--- + // context.setFillStyle("red") + // context.setFontSize(22 * unit) + // pri0 = "¥" + th.data.data.market_price.toFixed(2); + // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; + + + + // context.setStrokeStyle('gray'); + // context.fillText(pri0, wd2, 213 * unit); + // context.setLineWidth(1 * unit); + // context.moveTo(wd2 - 5, 206 * unit); + // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); + // context.stroke(); + + //-- 零售价的优化 -- + var wp = wd1; + var hp = 203 * unit; + if (th.data.prom_type != 4) wp -= 12; + th.draw_pos_price(context,wp,hp,th.data.data.show_price,unit); + + + //console.log(th.data.share_goods_img); + //let share_goods_img=th.data.presellForm.share_img; + //share_goods_img?share_goods_img:th.data.data.share_goods_img; + //---中间大图--- + context.drawImage(th.data.share_goods_img, 70 * unit, 220 * unit, 408 * unit, 408 * unit); + //---自定义海报 产品质量保证 + if(th.data.poster.show_quality==1 ){ + var g_path = "../../../images/share/s_gou.png"; + context.drawImage(g_path, 56 * unit, 644 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("正品保证", 84 * unit, 664 * unit); + + context.drawImage(g_path, 218 * unit, 644 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("纯实体店", 246 * unit, 664 * unit); + + context.drawImage(g_path, 388 * unit, 644 * unit, 22 * unit, 22 * unit); + context.setFillStyle("red") + context.setFontSize(18 * unit) + context.fillText("官方验证", 420 * unit, 664 * unit); + + } + + //---画线--- + // context.setLineWidth(1 * unit) + // context.moveTo(32 * unit, 662 * unit) + // context.lineTo(520 * unit, 662 * unit) + // context.stroke(); + + //-- 图片底部文字 -- + switch (type){ + case 0: + //---文字--- + //---文字--- + context.setFillStyle("black"); + context.setFontSize(22 * unit); + + context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit); + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit); + + break; + + case 1: + + //画秒杀的图片 + if (th.data.is_share_text) { + var miaos_path = '../../../images/share/miao_share.png'; + context.drawImage(miaos_path, 43 * unit, 690 * unit, 222 * unit, 40 * unit); + } + + context.setFillStyle("black") + context.setFontSize(24 * unit) + context.fillText(th.data.sto_sele_name_1, 40 * unit, 770 * unit); + //---文字--- + context.setFontSize(22 * unit) + context.setFillStyle("black") + if (th.data.is_share_text) { + context.fillText("特惠好物,限时秒杀", 40 * unit, 807 * unit); + } + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 844 * unit); + + break; + + } + + + + //---二维吗图--- + //-- 自定义海报 -- + 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, 746 * unit, 130 * unit, 116 * 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; + //---绘制圆形要放在最后---- + 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(); + } + + + if(th.data.poster.show_time==1 && th.data.prom_act){ + var act_time=''; + act_time="截止时间:"+ ut.formatTime(th.data.prom_act.end_time); + context.setFillStyle("red") + getApp().draw_Text(context, act_time,38 * unit, 880 * unit, 200 * unit, 340 * unit, unit); + } + + //把画板内容绘制成图片,并回调 画板图片路径 + 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) { + + 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(); + } + }) + }, 500) + + }); + }); + }, + fail: function (res) { + console.log(res); + wx.hideLoading(); + + } + }); + }, + //--定义的保存图片方法,分享团--- + saveImageToPhotosAlbumDef: function () { + //--先判断会员状态-- + // var user_info = getApp().globalData.userInfo; + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { + // //getApp().my_warnning("请先登录",0,this); + // wx.navigateTo({url: '/packageE/pages/togoin/togoin',}) + // return false; + // } + + if (this.data.share_hidden) { + this.setData({share_hidden: false,}); + }; + + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 + var type = this.data.prom_type || 0; + console.log('商品类型-----'); + console.log(type); + // if (type == 2) type = -1; + if (type == 4) type = 0; + if (type == 8) type = 0; + if (type == 2) type = 0; + if (type == 6) type = 2; // 6拼团 2团购 + if (type == 10) type = -1; + + if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; + console.log('商品类型。。。。。'); + console.log(type); + wx.showLoading({title: '生成中...',}) + var that = this, th = that; + //设置画板显示,才能开始绘图 + that.setData({ + canvasHidden: false + }) + + var app = getApp(); + var unit = that.data.screenWidth / 750 * 1.35; //基础单位, + var path2 = that.data.data.original_img; + + var scene = th.data.gid; + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; + if (user_id > 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; + }else{ + if (!user_id) scene += "_0"; + scene += "_0"; + } + if(this.data.prom_type){ + scene += "_" + this.data.prom_type+"_"+th.data.prom_id; + } + + ///二微码 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=packageA/pages/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"; + th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); + + //把画板内容绘制成图片,并回调 画板图片路径 + 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) { + + that.setData({ + shareImgPath: res.tempFilePath, + canvasHidden: true + }) + + if (!res.tempFilePath) { + wx.showModal({ + title: '提示', + content: '图片绘制中,请稍后重试', + showCancel: false + }) + return false; + } + + that.setData({ + showPoster: true, + }); + wx.hideLoading(); + } + }) + }, 500) + + }); + }); + }, + fail: function (res) { + console.log(res); + wx.hideLoading(); + + } + }); + }, + + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 + draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { + var lineWidth = 0; + var lastSubStrIndex = 0; //每次开始截取的字符串的索引 + var han = 0; + for (let i = 0; i < str.length; i++) { + if (han == 2) return; + //lineWidth += ctx.measureText(str[i]).width; + lineWidth += ut.measureText(str[i], 21.3 * unit); + if (lineWidth > canvasWidth) { + han++; + + if (han == 2) + ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分 + else + ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); + + initHeight += 22; //22为字体的高度 + lineWidth = 0; + lastSubStrIndex = i; + titleHeight += 20; + } + if (i == str.length - 1) { //绘制剩余部分 + ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight); + } + } + }, + + drawPoster(context, unit, img, vpath, type) { + // 1.灰色背景 + context.setFillStyle('#f2f1f6'); + context.rect(0, 0, 554 * unit, 899 * unit); + context.fill(); + + // 2.商城名称 + let shopName = this.data.sto_sele_name_1; + context.setTextAlign('center'); + context.setFontSize(26 * unit); + context.setFillStyle('black'); + context.fillText(shopName, 277 * unit, 60 * unit); + + // 3.推荐来源 + if(getApp().globalData.userInfo) { + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; + context.setTextAlign('center'); + context.setFontSize(22 * unit); + context.setFillStyle('#96959a'); + context.fillText(fromText, 277 * unit, 105 * unit); + } + // 4.海报背景 + context.setFillStyle('white'); + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); + + // 5.商品图片 + // 图片的x坐标 + let bg_x = 37 * unit + // 图片的y坐标 + let bg_y = 157 * unit + // 图片宽度 + let bg_w = 480 * unit + // 图片高度 + let bg_h = 474 * unit + // 图片圆角 + let bg_r = 4 + // 绘制海报背景图片圆角 + context.save() + context.beginPath() + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) + context.clip() + context.drawImage(img, bg_x, bg_y, bg_w, bg_h); + context.restore(); + + // 6.强烈推荐 + let src = ''; + context.beginPath(); + if (type == 0) { // 普通 + src = '../../../images/share/q_tj.png'; + context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit); + context.setFontSize(16 * unit) + context.setFillStyle("white") + context.setTextAlign('left'); + context.fillText('强烈推荐', 64 * unit, 668 * unit); + } + if (type == 1) { // 秒杀 + + if (this.data.is_share_text == 1) { + src = '../../../images/share/miao_share.png'; + context.drawImage(src, 54 * unit, 648 * unit, 200 * unit, 36 * unit); + } + context.setTextAlign('left'); + } + + + // 7.商品价格 + let price = this.data.data.shop_price; + if (this.data.card_field && this.data.data[this.data.card_field]) { + price = this.data.data[this.data.card_field]; + } + if (this.data.prom_act) price = this.data.prom_price; + price = parseFloat(price).toFixed(2); + context.setFontSize(32 * unit); + context.setFillStyle('#DE1117'); + + //price = this.data.presellList.presell_price + context.fillText('¥' + price, 54 * unit, 735 * unit); + //-- 零售价的优化 -- + var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit); + var hp=735 * unit + this.draw_pos_price(context,wp,hp,this.data.data.show_price,unit); + + + // 8.商品标题 + context.setFontSize(20 * unit); + context.setFillStyle('#898989'); + getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1); + + // 9.小程序码 + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); + context.setFontSize(16 * unit); + context.setFillStyle('#777'); + context.fillText('长按识别二维码', 378 * unit, 810 * unit); + + // 10.竖线 + context.beginPath(); + context.setFillStyle('#eee'); + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); + context.fill(); + }, + + //---市场价划掉--- + draw_pos_price(context,w,h,market_price,unit){ + + if(!this.data.sys_switch) return false; + if(!this.data.sys_switch.is_retail_price) return false; + + context.setFillStyle("gray") + context.setFontSize(22 * unit) + var pri0 = "¥" + market_price.toFixed(2); + context.fillText(pri0, w, h); + + var c_h=h-6; + context.setStrokeStyle('gray'); + context.setLineWidth(1 * unit); + context.moveTo(w - 5, c_h); + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h); + context.stroke(); + + }, + + + closePoster() { + this.setData({ + showPoster: false, + }); + }, + + // 保存图片到手机 + savePic() { + console.log('保存图片'); + var self = this; + // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限 + this.getSetting().then((res) => { + // 判断用户是否授权了保存到相册的权限,如果没有发起授权 + if (!res.authSetting['scope.writePhotosAlbum']) { + this.authorize().then(() => { + // 同意授权后保存下载文件 + this.saveImage(self.data.shareImgPath) + .then(() => { + self.setData({ + showPoster: false + }); + }); + }) + } else { + // 如果已经授权,保存下载文件 + this.saveImage(self.data.shareImgPath) + .then(() => { + self.setData({ + showPoster: false + }); + }); + } + + }) + }, + + // 发起首次授权请求 + authorize() { + // isFirst 用来记录是否为首次发起授权, + // 如果首次授权拒绝后,isFirst赋值为1 + let isFirst = wx.getStorageSync('isFirst') || 0; + return new Promise((resolve, reject) => { + wx.authorize({ + scope: 'scope.writePhotosAlbum', + // 同意授权 + success: () => { + resolve(); + }, + // 拒绝授权,这里是用户拒绝授权后的回调 + fail: res => { + if (isFirst === 0) { + wx.setStorageSync('isFirst', 1); + wx.showToast({ + title: '保存失败', + icon: 'none', + duration: 1000 + }) + } else { + this.showModal(); + } + console.log('拒绝授权'); + reject(); + } + }) + }) + }, + + + // 保存图片到系统相册 + saveImage(saveUrl) { + var self = this; + return new Promise((resolve, reject) => { + wx.saveImageToPhotosAlbum({ + filePath: saveUrl, + success: (res) => { + wx.showToast({ + title: '保存成功', + duration: 1000, + }); + self.setData({ + showPlaybill: 'true' + }); + resolve(); + }, + fail: () => { + wx.showToast({ + title: '保存失败', + duration: 1000, + }); + } + }) + }) + }, + + // 预览海报 + previewPoster() { + getApp().globalData.no_clear = 1; + wx.previewImage({ + current: this.data.shareImgPath, // 当前显示图片的http链接 + urls: [this.data.shareImgPath], // 需要预览的图片http链接列表 + }); + }, + }); diff --git a/packageA/pages/goodsInfo/goodsInfo.json b/packageA/pages/goodsInfo/goodsInfo.json index 5b20c87..57137c1 100644 --- a/packageA/pages/goodsInfo/goodsInfo.json +++ b/packageA/pages/goodsInfo/goodsInfo.json @@ -6,7 +6,8 @@ "warn": "/components/long_warn/long_warn", "serviceCard_recommend": "/components/serviceCard_list/serviceCard_list", "privacy_pop": "/components/privacy_pop/privacy_pop", - "top_nav": "/components/diy_top_nav/diy_top_nav" + "top_nav": "/components/diy_top_nav/diy_top_nav", + "share": "/components/share/share" }, "navigationStyle": "custom" } \ No newline at end of file diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml index 451107d..9a2d0e9 100644 --- a/packageA/pages/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/goodsInfo/goodsInfo.wxml @@ -11,7 +11,7 @@ - @@ -106,16 +106,25 @@ - - - {{filters.toFix(prom_price,2)}} - - {{filters.toFix(data.shop_price,2)}} - - - {{data.goods_name}} + + + + + {{filters.toFix(prom_price,2)}} + + {{filters.toFix(data.shop_price,2)}} + + + {{data.goods_name}} + + + + + @@ -970,14 +979,20 @@ - - + + - + + + + + + + @@ -1015,3 +1030,5 @@ + + diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js index fda382d..c2d1534 100644 --- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js +++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js @@ -12,6 +12,7 @@ var more = function (e) { }(require("../../../../utils/LoadMore.js")), n = new more.default(); var regeneratorRuntime = require('../../../../utils/runtime.js'); +var self=null; Page({ data: { @@ -1256,6 +1257,8 @@ Page({ }) } + this.data.get_sto_ing=1; + var timer_get = setInterval(function () { if (th.data.is_get_local_ok == 0) return false; if (!th.data.fir_def_store) return false; @@ -1374,13 +1377,19 @@ Page({ th.setData({all_pick_list: e.data.data.pageData}); th.deal_pickup(e); }else{ + th.data.get_sto_ing=0; th.setData({all_pick_list: null, only_pk:null,def_pickpu_list:null }); - wx.hideLoading(); } }, 800) } + else{ + th.data.get_sto_ing=0; + th.setData({all_pick_list: null, only_pk:null,def_pickpu_list:null }); + + wx.hideLoading(); + } }) }, 200) }, @@ -1554,9 +1563,11 @@ Page({ } } + th.data.get_sto_ing=0; } }); } else { + th.data.get_sto_ing=0; th.setData({ is_show_sto_cat: 0, only_pk: e.data.data.pageData @@ -1605,6 +1616,12 @@ Page({ // return false; // } + if (this.data.share_hidden) { + this.setData({ + share_hidden: false, + }); + }; + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4积分购 var type = 2 if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; @@ -3569,6 +3586,9 @@ Page({ }); }, + send() { + this.setData({ share_hidden: false, }); + }, cancel() { this.setData({ share_hidden: false, @@ -3965,6 +3985,15 @@ Page({ } }, + // 预览海报 + previewPoster() { + getApp().globalData.no_clear = 1; + wx.previewImage({ + current: this.data.shareImgPath, // 当前显示图片的http链接 + urls: [this.data.shareImgPath], // 需要预览的图片http链接列表 + }); + }, + }); diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml index 904d6e7..196a2b7 100644 --- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml +++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml @@ -807,14 +807,20 @@ - - + + - + + + + + + + diff --git a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss index d38ba36..de42797 100644 --- a/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss +++ b/packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss @@ -2744,7 +2744,7 @@ button.custom-service::after{ left: 50%; transform: translate(-50%, -50%); width: calc(100% - 120rpx); - z-index: 1000; + z-index: 10001; } .mask { position: fixed; @@ -2752,7 +2752,7 @@ button.custom-service::after{ left: 0; width: 100%; height: 100%; - z-index: 999; + z-index: 10000; background-color: rgba(0,0,0,.4); } .poster-wrapper { diff --git a/packageA/pages/serviceCard_pd/team_success/team_success.js b/packageA/pages/serviceCard_pd/team_success/team_success.js index 7da1340..459d929 100644 --- a/packageA/pages/serviceCard_pd/team_success/team_success.js +++ b/packageA/pages/serviceCard_pd/team_success/team_success.js @@ -823,7 +823,7 @@ Page({ tt(func);; }, fail: function (res) { - ee.data.share_head = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的 + ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的 tt(func); } }); diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index 46c2ffb..acfe1d7 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -3129,6 +3129,7 @@ Page({ //---------拿出门店分类和门店------------ get_sto(e,func) { + var th = this, that = this; var is_normal = e; @@ -3137,12 +3138,13 @@ Page({ } else { th.setData({ is_normal: 0 }) } + th.data.get_sto_ing=1; var timer_get = setInterval(function () { if (th.data.is_get_local_ok == 0) return false; if (!th.data.fir_def_store) return false; var dd = null, i = getApp().request; - if (!th.data.sele_g) return false; + if (!th.data.sele_g){th.data.get_sto_ing=0; return false;} var g_distr_type = th.data.sele_g.distr_type; if (g_distr_type != 0) { @@ -3277,6 +3279,7 @@ Page({ } },err=>{ + th.data.get_sto_ing=0; ut.m_toast('网络繁忙,请稍后重试'); wx.hideLoading(); }) @@ -3403,12 +3406,15 @@ Page({ front_is_show_sto_cat:th.data.is_show_sto_cat, }) } + + this.data.get_sto_ing=0; + }, //------------处理门店--------------- deal_pickup(e) { var th = this; - if (!th.data.sele_g) return false + if (!th.data.sele_g){th.data.get_sto_ing=0;return false} var g_distr_type = th.data.sele_g.distr_type; wx.hideLoading(); @@ -3580,7 +3586,7 @@ Page({ //------------处理线下门店库存-------- deal_pickup_dline(e) { var pkno = [], th = this; - if (!th.data.sele_g) return false; + if (!th.data.sele_g){th.data.get_sto_ing=0;return false;} if (this.data.def_pick_store) { pkno.push(this.data.def_pick_store.pickup_no); @@ -3673,6 +3679,7 @@ Page({ } else { + th.data.get_sto_ing=0; th.setData({ all_sto: null, only_pk: null, @@ -3739,9 +3746,11 @@ Page({ //---把数组组装进去--- th.deal_pickup(em); } else { + th.data.get_sto_ing=0; th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null }) } } else { + th.data.get_sto_ing=0; th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null }) } }) @@ -4504,6 +4513,7 @@ Page({ // ind == 1 为普通购买 openSpecModel_pt: function (e) { + if(this.data.get_sto_ing) return false; this.setData({ open_ind_store: 9 }); // 判断是否有待支付订单 var aid = this.data.group_id; diff --git a/packageC/pages/presell/cardInfo/goodsInfo.js b/packageC/pages/presell/cardInfo/goodsInfo.js index 82d582e..05f2a54 100644 --- a/packageC/pages/presell/cardInfo/goodsInfo.js +++ b/packageC/pages/presell/cardInfo/goodsInfo.js @@ -1186,6 +1186,9 @@ Page({ }, openSpecModel: function(t) { + + if(this.data.get_sto_ing) return false; + var th=this; var open_store = t.currentTarget.dataset.ind; if(getApp().is_sp_hao() && open_store==1){ wx.showToast({ @@ -1443,6 +1446,8 @@ Page({ }) } + this.data.get_sto_ing=1; + var timer_get = setInterval(function() { if (th.data.is_get_local_ok == 0) return false; if (!th.data.fir_def_store) return false; @@ -1557,6 +1562,9 @@ Page({ th.deal_pickup(e); } else{ + + th.data.get_sto_ing=0; + th.setData({ isshow:1 }) @@ -1835,11 +1843,14 @@ Page({ if (!th.data.def_pick_store) { th.setData({def_pick_store:e.data.data.pageData[0]}) } - } + + th.data.get_sto_ing=0; } }); - } else { + } else { + + th.data.get_sto_ing=0; th.setData({ is_show_sto_cat: 0, only_pk: e.data.data.pageData @@ -1991,8 +2002,8 @@ Page({ return false; } - var img=ee.data.iurl+ee.data.data.img_url; - if(ee.data.prom_act){ + var img=ee.data.iurl+ee.data.data.image_url; + if(ee.data.prom_act && ee.data.prom_act.share_img){ img=ee.data.iurl+ee.data.prom_act.share_img; } @@ -4062,7 +4073,14 @@ Page({ }) }, - + // 预览海报 + previewPoster() { + getApp().globalData.no_clear = 1; + wx.previewImage({ + current: this.data.shareImgPath, // 当前显示图片的http链接 + urls: [this.data.shareImgPath], // 需要预览的图片http链接列表 + }); + }, diff --git a/packageC/pages/presell/cardInfo/goodsInfo.wxml b/packageC/pages/presell/cardInfo/goodsInfo.wxml index c0e78b1..cd988ad 100644 --- a/packageC/pages/presell/cardInfo/goodsInfo.wxml +++ b/packageC/pages/presell/cardInfo/goodsInfo.wxml @@ -990,6 +990,7 @@ + diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js index 1e00ca6..3c7a7ce 100644 --- a/packageC/pages/presell/goodsInfo/goodsInfo.js +++ b/packageC/pages/presell/goodsInfo/goodsInfo.js @@ -1439,6 +1439,9 @@ Page({ }, openSpecModel: function (t) { + + if(this.data.get_sto_ing) return false; + var th = this; var open_store = t.currentTarget.dataset.ind; this.setData({ @@ -1993,6 +1996,9 @@ Page({ //---------拿出门店分类和门店------------ get_sto(e) { + + this.data.get_sto_ing=1; + var th = this, is_normal = e; var that=th; @@ -2007,7 +2013,7 @@ Page({ if (!th.data.fir_def_store) return false; var dd = null, i = getApp().request; - if (!th.data.sele_g) return false; + if (!th.data.sele_g) {th.data.get_sto_ing=0; return false;} var g_distr_type = th.data.sele_g.distr_type; if (g_distr_type != 0) { @@ -2149,10 +2155,12 @@ Page({ } } else{ + th.data.get_sto_ing=0; wx.hideLoading(); } } else{ + th.data.get_sto_ing=0; wx.hideLoading(); } }) @@ -2263,7 +2271,7 @@ Page({ //------------处理门店--------------- deal_pickup(e) { var th = this; - if (!th.data.sele_g) return false + if (!th.data.sele_g) { th.data.get_sto_ing=0; return false } var g_distr_type = th.data.sele_g.distr_type; wx.hideLoading(); @@ -2419,6 +2427,9 @@ Page({ th.setData({ def_pick_store: e.data.data.pageData[0] }) } } + + th.data.get_sto_ing=0; + } else { th.setData({ is_show_sto_cat: -1, @@ -2429,10 +2440,12 @@ Page({ th.setData({ def_pick_store: e.data.data.pageData[0] }) } + th.data.get_sto_ing=0; } } }); } else { + th.data.get_sto_ing=0; th.setData({ is_show_sto_cat: 0, only_pk: e.data.data.pageData @@ -2453,7 +2466,7 @@ Page({ deal_pickup_dline(e) { var pkno = [], th = this; - if (!th.data.sele_g) return false; + if (!th.data.sele_g){ th.data.get_sto_ing=0; return false;} if (this.data.def_pick_store) { pkno.push(this.data.def_pick_store.pickup_no); @@ -2539,6 +2552,7 @@ Page({ } } else { + th.data.get_sto_ing=0; th.setData({ all_sto: null, only_pk: null, @@ -2613,6 +2627,7 @@ Page({ th.deal_pickup(em); } else { + th.data.get_sto_ing=0; th.setData({ all_sto: null, only_pk: null, @@ -2621,6 +2636,7 @@ Page({ } } else { + th.data.get_sto_ing=0; th.setData({ all_sto: null, only_pk: null, diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 40104f3..2755d5d 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -2761,6 +2761,8 @@ Page({ }, openSpecModel: function (t) { + + if(this.data.get_sto_ing) return false; var th = this; var open_store = t.currentTarget.dataset.ind; @@ -3748,6 +3750,7 @@ Page({ sp_seleing:0 }) + }, @@ -3758,6 +3761,8 @@ Page({ that = this; var is_normal = e; + th.data.get_sto_ing=1; + if (e == 1) { th.setData({ is_normal: 1 @@ -3772,9 +3777,10 @@ Page({ if (th.data.is_get_local_ok == 0) return false; if (!th.data.fir_def_store) return false; + var dd = null, i = getApp().request; - if (!th.data.sele_g) return false; + if (!th.data.sele_g) {th.data.get_sto_ing=0; return false; } var g_distr_type = th.data.sele_g.distr_type; if (g_distr_type != 0) { @@ -3959,12 +3965,14 @@ Page({ th.setData({sp_seleing:0}) wx.hideLoading(); th.data.fir_set_sto=0; + th.data.get_sto_ing=0; } } else { if(func) func(); th.setData({sp_seleing:0}) wx.hideLoading(); th.data.fir_set_sto=0; + th.data.get_sto_ing=0; } },err=>{ ut.m_toast('网络繁忙,请稍后重试'); @@ -3972,6 +3980,7 @@ Page({ th.setData({sp_seleing:0}) wx.hideLoading(); th.data.fir_set_sto=0; + th.data.get_sto_ing=0; }) }, 200) @@ -4105,6 +4114,7 @@ Page({ var th = this; if (!th.data.sele_g){ wx.hideLoading(); + th.data.get_sto_ing=0; return false } @@ -4337,6 +4347,8 @@ Page({ th.deal_front_pk(); } + th.data.get_sto_ing=0; + }, //------------处理线下门店库存-------- @@ -4443,6 +4455,7 @@ Page({ } else { + th.data.get_sto_ing=0; th.data.fir_set_sto=0; th.setData({ all_sto: null, @@ -4542,6 +4555,7 @@ Page({ } else { + th.data.get_sto_ing=0; th.data.fir_set_sto=0; th.setData({ all_sto: null, @@ -4552,6 +4566,7 @@ Page({ } else { + th.data.get_sto_ing=0; th.data.fir_set_sto=0; th.setData({ all_sto: null, @@ -5488,6 +5503,8 @@ Page({ //--点击弹起拼单-- openSpecModel_pt:function (e) { + if(this.data.get_sto_ing) return false; + this.setData({ open_ind_store: 4, goodsInputNum: 1 @@ -6842,8 +6859,17 @@ Page({ // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit); // context.setFontSize(18 * unit) // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit); - //---二维吗图--- - context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit); + + if (th.data.share_b_img || 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, 380 * unit, 736 * unit, 120 * unit, 120 * unit); + } + + break; //普通商品的展示 case 4: @@ -8559,7 +8585,8 @@ Page({ //-- 积分购购买弹出框 -- go_pay_integral: function () { - + + if(this.data.get_sto_ing) return false; //-- 在打开弹出框的时候,front_pk门店要赋值 -- this.setData({def_pick_store: ut.deep_cp(this.data.front_pick)}); @@ -8574,6 +8601,7 @@ Page({ //-- 积分购普通购买弹出框 -- go_pay_integral_normal:async function () { + if(this.data.get_sto_ing) return false; this.data.g_buy_num = new Map(); var th = this; @@ -9148,6 +9176,9 @@ Page({ //-- 秒杀的普通购买 -- openSpecModel_Nor: function () { + + if(this.data.get_sto_ing) return false; + this.data.g_buy_num = new Map(); var th = this; diff --git a/pages/user/index/iconfont.ttf b/pages/user/index/iconfont.ttf new file mode 100644 index 0000000..4b13094 --- /dev/null +++ b/pages/user/index/iconfont.ttf diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 6485176..3308413 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -55,8 +55,8 @@ Page({ showvipcode:false, pshow:0, - is_show_yq:0, //是不是要显示邀请 + show_erm_u:1,//弹出框显示会员二维码 }, goto_nav: function (e) { var th = this; @@ -1244,6 +1244,38 @@ Page({ }) }, + hide_u_ewm(){ + this.setData({show_erm_u:0}) + }, + show_u_ewm(){ + var th=this; + + var getnowtime; + rq.get("/api/weshop/users/getServerTime", { + success: function (res) { + if (res.data.code == 0) + { + th.setData({show_erm_u:1}) + getnowtime=res.data.data; + if (!getnowtime) + { + getApp().showWarning("获取服务时间失败"); + return; + } + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') + var val = th.data.userInfo.mobile + "|" +getnowtime+"|"+th.data.getusercode_vailtime; + val = "^" + ut.base64_encode(val); + + qrcode('qrcode', val, 350, 350, th); + + + } + } + }) + + + } + diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml index a5ffb04..28bbf37 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -435,7 +435,7 @@