Commit fbde7aeea44187644770428912451e9363140e56

Authored by WXD-SEASON\season
2 parents f5920583 3da37e82

Merge branch 'dev_oa_fu38' into dev

packageA/pages/goodsInfo/goodsInfo.js
... ... @@ -27,6 +27,7 @@ Page({
27 27 color_type: 0, //线条控制
28 28 color_type_one: 0,
29 29 color_type_two: 1,
  30 + is_share_text: 1,
30 31  
31 32 gid: "",
32 33 stoid: o.stoid,
... ... @@ -38,6 +39,8 @@ Page({
38 39 data: null,
39 40 content: "", //商品详情
40 41  
  42 +
  43 +
41 44 gallery: null, //图片滚动
42 45 is_collect: 0,
43 46 collect_id: 0,
... ... @@ -236,6 +239,8 @@ Page({
236 239 th = ee,
237 240 gid = t.goods_id,
238 241 first_leader=t.first_leader,
  242 + prom_type=t.prom_type,
  243 + prom_id=t.prom_id,
239 244 room_id = t.room_id,
240 245 room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id
241 246  
... ... @@ -250,21 +255,27 @@ Page({
250 255 var gid_str = decodeURIComponent(t.scene);
251 256 gid_str=gid_str.split("_");
252 257 gid=gid_str[0];
253   - if(gid_str.length>1){
  258 + if(gid_str.length>1 && gid_str[1] && parseInt(gid_str[1])>0){
254 259 first_leader=gid_str[1];
255 260 }
256 261 //-- 如果有room_id的获取 --
257   - if(gid_str.length>2 && gid_str[2]) {
  262 + if(gid_str.length>2 && gid_str[2] && parseInt(gid_str[2])>0) {
258 263 room_id=gid_str[2];
259 264 room_user_share=1;
260 265 };
  266 +
  267 + if(gid_str.length>3 && gid_str[3] && parseInt(gid_str[3])>0) {
  268 + prom_type=gid_str[3];
  269 + prom_id=gid_str[4];
  270 + }
  271 +
261 272 };
262 273  
263 274 //-- 设置顶部高度 --
264 275 let height= getApp().globalData.navBarHeight;
265 276 ee.setData({ gid: gid,top_nav:height});
266 277  
267   - if(first_leader) {
  278 + if(first_leader>0) {
268 279 getApp().globalData.first_leader=first_leader;
269 280 //调用接口判断是不是会员
270 281 getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+os.stoid+"/"+first_leader,{}).then(res=>{
... ... @@ -347,7 +358,37 @@ Page({
347 358 }
348 359 });
349 360  
350   - },
  361 + //-- 自定义海报 --
  362 + getApp().request.promiseGet("/api/weshop/goods/poster/page", {
  363 + data: { store_id: os.stoid, type: 1, is_use: 1 }
  364 + }).then(res => {
  365 + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]) {
  366 +
  367 + var poster_data = res.data.data.pageData[0];
  368 + var json_str = poster_data.jsonStr;
  369 +
  370 + if (json_str) {
  371 + var json_data = JSON.parse(json_str);
  372 + if (json_data.bg_img) {
  373 +
  374 + //-- 把图片那到本地 --
  375 + wx.getImageInfo({
  376 + src: json_data.bg_img,
  377 + success: function (res) {
  378 + var path = res.path;
  379 + th.setData({ share_b_img: path })
  380 + },
  381 + fail: function (res) { }
  382 + });
  383 + }
  384 + th.setData({ poster: json_data })
  385 +
  386 + }
  387 + }
  388 + })
  389 +
  390 +
  391 + },
351 392  
352 393 //-- 获取直播的分享人的导购信息 --
353 394 async get_room_share_guide(share_openid) {
... ... @@ -568,14 +609,13 @@ Page({
568 609 // gid 在onload阶段已经保存在this.data中
569 610 onShow: function() {
570 611  
  612 + getApp().check_can_share(this);
571 613 //-- 看一下隐私政策要不要显示 --
572 614 var privacy_pop = this.selectComponent("#privacy_pop"); //组件的id
573 615 if (privacy_pop) {
574 616 privacy_pop.check_pri_show();
575 617 }
576 618  
577   - getApp().check_can_share();
578   -
579 619 var that=this;var th=this;
580 620 var ee = this,gid = this.data.gid, i = getApp().request;
581 621  
... ... @@ -1386,6 +1426,9 @@ Page({
1386 1426 },
1387 1427  
1388 1428 openSpecModel: function(t) {
  1429 +
  1430 + if(this.data.get_sto_ing) return false;
  1431 +
1389 1432 var th=this; var open_store = t.currentTarget.dataset.ind;
1390 1433 if(getApp().is_sp_hao() && open_store==1){
1391 1434 wx.showToast({
... ... @@ -1657,6 +1700,8 @@ Page({
1657 1700 })
1658 1701 }
1659 1702  
  1703 + this.data.get_sto_ing=1;
  1704 +
1660 1705 var timer_get = setInterval(function() {
1661 1706 if (th.data.is_get_local_ok == 0) return false;
1662 1707 if (!th.data.fir_def_store) return false;
... ... @@ -1772,6 +1817,7 @@ Page({
1772 1817 th.deal_pickup(e);
1773 1818 }
1774 1819 else{
  1820 + th.data.get_sto_ing=0;
1775 1821 th.setData({
1776 1822 isshow:1
1777 1823 })
... ... @@ -1901,160 +1947,162 @@ Page({
1901 1947 orderType:'asc',
1902 1948 },
1903 1949 success: function(ee) {
1904   - if (ee.data.code == 0) {
1905   -
1906   - var check_all_cate=0;
1907   - if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){
1908   - for(let i in ee.data.data.pageData){
1909   - let item=ee.data.data.pageData[i];
1910   - if(item.is_show==1){
1911   - check_all_cate=1;break
  1950 + if (ee.data.code == 0) {
  1951 +
  1952 + var check_all_cate=0;
  1953 + if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0){
  1954 + for(let i in ee.data.data.pageData){
  1955 + let item=ee.data.data.pageData[i];
  1956 + if(item.is_show==1){
  1957 + check_all_cate=1;break
  1958 + }
1912 1959 }
1913 1960 }
1914   - }
1915   -
1916   - if (check_all_cate) {
1917   -
1918   -
1919   - var sto_cate = ee.data.data.pageData;
1920   - var sto_arr = e.data.data.pageData;
1921   - var newarr = new Array();
1922   - var qita = new Array();
1923   -
1924   - var is_del_pk=0;
1925   -
1926   - //----要进行门店分组--------
1927   - for (var i = 0; i < sto_arr.length; i++) {
1928   - //找一下这个门店有没有在分类数组内
1929   - var find2 = 0, find2name = "",sort=0;
1930   - is_del_pk=0;
1931   - for (var m = 0; m < sto_cate.length; m++) {
1932   - if (sto_arr[i].category_id == sto_cate[m].cat_id) {
1933   - if (sto_cate[m].is_show != 1) {
1934   - is_del_pk = 1;
1935   - sto_arr.splice(i, 1);
1936   - i--;
1937   - } else {
1938   - find2 = sto_cate[m].cat_id;
1939   - find2name = sto_cate[m].cat_name;
1940   - sort = sto_cate[m].sort;
1941   - is_del_pk = 0;
  1961 +
  1962 + if (check_all_cate) {
  1963 +
  1964 +
  1965 + var sto_cate = ee.data.data.pageData;
  1966 + var sto_arr = e.data.data.pageData;
  1967 + var newarr = new Array();
  1968 + var qita = new Array();
  1969 +
  1970 + var is_del_pk=0;
  1971 +
  1972 + //----要进行门店分组--------
  1973 + for (var i = 0; i < sto_arr.length; i++) {
  1974 + //找一下这个门店有没有在分类数组内
  1975 + var find2 = 0, find2name = "",sort=0;
  1976 + is_del_pk=0;
  1977 + for (var m = 0; m < sto_cate.length; m++) {
  1978 + if (sto_arr[i].category_id == sto_cate[m].cat_id) {
  1979 + if (sto_cate[m].is_show != 1) {
  1980 + is_del_pk = 1;
  1981 + sto_arr.splice(i, 1);
  1982 + i--;
  1983 + } else {
  1984 + find2 = sto_cate[m].cat_id;
  1985 + find2name = sto_cate[m].cat_name;
  1986 + sort = sto_cate[m].sort;
  1987 + is_del_pk = 0;
  1988 + }
  1989 + break;
1942 1990 }
1943   - break;
1944 1991 }
1945   - }
1946   - if(is_del_pk) continue;
1947   -
1948   - if (newarr.length > 0) {
1949   - var find = 0;
1950   - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
1951   - if (find2 != 0) {
1952   - for (var ii = 0; ii < newarr.length; ii++) {
1953   - if (sto_arr[i].category_id == newarr[ii].cat_id) {
1954   - newarr[ii].s_arr.push(sto_arr[i]);
1955   - find = 1;
1956   - break;
  1992 + if(is_del_pk) continue;
  1993 +
  1994 + if (newarr.length > 0) {
  1995 + var find = 0;
  1996 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  1997 + if (find2 != 0) {
  1998 + for (var ii = 0; ii < newarr.length; ii++) {
  1999 + if (sto_arr[i].category_id == newarr[ii].cat_id) {
  2000 + newarr[ii].s_arr.push(sto_arr[i]);
  2001 + find = 1;
  2002 + break;
  2003 + }
  2004 + }
  2005 + if (find == 0) {
  2006 + var arr0 = new Array();
  2007 + arr0.push(sto_arr[i]);
  2008 + var item = {
  2009 + cat_id: find2,
  2010 + name: find2name,
  2011 + sort:sort,
  2012 + s_arr: arr0
  2013 + };
  2014 + newarr.push(item);
  2015 + }
  2016 + } else {
  2017 + qita.push(sto_arr[i]);
  2018 + }
  2019 + } else {
  2020 + //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
  2021 + if (find2 != 0) {
  2022 + var arr0 = new Array();
  2023 + arr0.push(sto_arr[i]);
  2024 + var item = {
  2025 + cat_id: find2,
  2026 + name: find2name,
  2027 + sort:sort,
  2028 + s_arr: arr0
  2029 + };
  2030 + newarr.push(item);
  2031 + } else {
  2032 + qita.push(sto_arr[i]);
1957 2033 }
1958 2034 }
1959   - if (find == 0) {
1960   - var arr0 = new Array();
1961   - arr0.push(sto_arr[i]);
1962   - var item = {
1963   - cat_id: find2,
1964   - name: find2name,
1965   - sort:sort,
1966   - s_arr: arr0
1967   - };
1968   - newarr.push(item);
  2035 + }
  2036 +
  2037 + var def_arr = new Array();
  2038 + //-- 开始就看10个门店 --
  2039 + for (var k = 0; k < 10; k++) {
  2040 + if (k == sto_arr.length) break;
  2041 + def_arr.push(sto_arr[k]);
1969 2042 }
1970   - } else {
1971   - qita.push(sto_arr[i]);
  2043 +
  2044 + th.setData({
  2045 + def_pickpu_list: def_arr,
  2046 + pickpu_list: ee.data.data.pageData
  2047 + });
  2048 +
  2049 + //门店分类要排序下
  2050 + function compare(property){
  2051 + return function(a,b){
  2052 + var value1 = a[property];
  2053 + var value2 = b[property];
  2054 + return value1 - value2;
  2055 + }
1972 2056 }
1973   - } else {
1974   - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
1975   - if (find2 != 0) {
1976   - var arr0 = new Array();
1977   - arr0.push(sto_arr[i]);
  2057 + if(newarr.length>0)
  2058 + newarr.sort(compare("sort"));
  2059 +
  2060 + //----安排其他的分类-----
  2061 + if (qita.length > 0) {
1978 2062 var item = {
1979   - cat_id: find2,
1980   - name: find2name,
1981   - sort:sort,
1982   - s_arr: arr0
  2063 + cat_id: -1,
  2064 + name: "其他",
  2065 + s_arr: qita
1983 2066 };
1984 2067 newarr.push(item);
1985   - } else {
1986   - qita.push(sto_arr[i]);
1987 2068 }
1988   - }
1989   - }
1990 2069  
1991   - var def_arr = new Array();
1992   - //-- 开始就看10个门店 --
1993   - for (var k = 0; k < 10; k++) {
1994   - if (k == sto_arr.length) break;
1995   - def_arr.push(sto_arr[k]);
1996   - }
  2070 + var sd={
  2071 + all_sto: newarr,
  2072 + is_show_sto_cat:1
  2073 + }
  2074 + if(!sto_arr || sto_arr.length<=10){
  2075 + sd.is_show_sto_cat=-1;
  2076 + sd.only_pk=sto_arr;
  2077 + }
  2078 + th.setData(sd);
1997 2079  
  2080 + } else {
  2081 + th.setData({
  2082 + is_show_sto_cat: -1,
  2083 + only_pk: e.data.data.pageData
  2084 + });
  2085 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  2086 + if (!th.data.def_pick_store) {
  2087 + th.setData({def_pick_store:e.data.data.pageData[0]})
  2088 + }
  2089 + }
  2090 + } else {
1998 2091 th.setData({
1999   - def_pickpu_list: def_arr,
2000   - pickpu_list: ee.data.data.pageData
  2092 + is_show_sto_cat: -1,
  2093 + only_pk: e.data.data.pageData
2001 2094 });
2002   -
2003   - //门店分类要排序下
2004   - function compare(property){
2005   - return function(a,b){
2006   - var value1 = a[property];
2007   - var value2 = b[property];
2008   - return value1 - value2;
2009   - }
2010   - }
2011   - if(newarr.length>0)
2012   - newarr.sort(compare("sort"));
2013   -
2014   - //----安排其他的分类-----
2015   - if (qita.length > 0) {
2016   - var item = {
2017   - cat_id: -1,
2018   - name: "其他",
2019   - s_arr: qita
2020   - };
2021   - newarr.push(item);
2022   - }
2023   -
2024   - var sd={
2025   - all_sto: newarr,
2026   - is_show_sto_cat:1
  2095 + //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
  2096 + if (!th.data.def_pick_store) {
  2097 + th.setData({def_pick_store:e.data.data.pageData[0]})
2027 2098 }
2028   - if(!sto_arr || sto_arr.length<=10){
2029   - sd.is_show_sto_cat=-1;
2030   - sd.only_pk=sto_arr;
2031   - }
2032   - th.setData(sd);
2033   -
2034   - } else {
2035   - th.setData({
2036   - is_show_sto_cat: -1,
2037   - only_pk: e.data.data.pageData
2038   - });
2039   - //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
2040   - if (!th.data.def_pick_store) {
2041   - th.setData({def_pick_store:e.data.data.pageData[0]})
2042 2099 }
2043   - }
2044   - } else {
2045   - th.setData({
2046   - is_show_sto_cat: -1,
2047   - only_pk: e.data.data.pageData
2048   - });
2049   - //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
2050   - if (!th.data.def_pick_store) {
2051   - th.setData({def_pick_store:e.data.data.pageData[0]})
2052   - }
2053   -
2054   - }
  2100 + th.data.get_sto_ing=0;
2055 2101 }
2056 2102 });
2057   - } else {
  2103 + } else {
  2104 + th.data.get_sto_ing=0;
  2105 +
2058 2106 th.setData({
2059 2107 is_show_sto_cat: 0,
2060 2108 only_pk: e.data.data.pageData
... ... @@ -2092,494 +2140,7 @@ Page({
2092 2140 return param < 10 ? '0' + param : param;
2093 2141 },
2094 2142  
2095   -
2096   - //--定义的保存图片方法,分享团---
2097   - saveImageToPhotosAlbum: function() {
2098   - //--先判断会员状态--
2099   - // var user_info = getApp().globalData.userInfo;
2100   - // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
2101   - // //getApp().my_warnning("请先登录",0,this);
2102   - // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', })
2103   - // return false;
2104   - // }
2105   -
2106   - //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
2107   - var type = this.data.prom_type;
2108   - if (type == 6) type = 2;
2109   - if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
2110   -
2111   - wx.showLoading({
2112   - title: '生成中...',
2113   - })
2114   - var that = this,
2115   - th = that;
2116   - //设置画板显示,才能开始绘图
2117   - that.setData({
2118   - canvasHidden: false
2119   - })
2120   -
2121   - var app = getApp();
2122   - var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
2123   - var path2 = that.data.data.original_img;
2124   - var scene = th.data.gid+"";
2125   - var user_id = getApp().globalData.user_id?getApp().globalData.user_id:0;
2126   - if(user_id>0) {
2127   - scene+="_"+user_id;
2128   - }
2129   - //-- 如果不是会员分享过来的要分享给别人 --
2130   - if(getApp().globalData.room_id && th.data.data.goods_id==getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
2131   - //固定房间是第3个字符
2132   - if(!user_id) scene+="_0";
2133   - scene+="_"+getApp().globalData.room_id ;
2134   - }
2135   - ///二微码
2136   - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
2137   - os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
2138   -
2139   - console.log(path3);
2140   -
2141   - //读取文件成功则OK--
2142   - wx.getImageInfo({
2143   - src: path3,
2144   - success: function(res) {
2145   - //回调写法
2146   - th.get_head_temp(th.get_goods_temp, function() {
2147   - var vpath = res.path;
2148   - var context = wx.createCanvasContext('share');
2149   - //先画背景
2150   - var pg_path = "../../../images/share/share_bg.png";
2151   -
2152   - // context.fillStyle="#FFFFFF";
2153   - // context.fillRect(0,0,554 * unit, 899 * unit);
2154   -
2155   - //-- 如果有自定义海报的时候,判断背景的图片 --
2156   - if(th.data.share_b_img){
2157   - pg_path=th.data.share_b_img;
2158   - }
2159   - context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
2160   -
2161   - //-- 是自定义海报的情况下 --
2162   - if(th.data.poster && parseInt(th.data.poster.style)==2) {
2163   - //在线上分享人的情况下
2164   - if(parseInt(th.data.poster.show_headpic)){
2165   - //获取坐标
2166   - var x=parseFloat(th.data.poster.head_x)*2;
2167   - var y=parseFloat(th.data.poster.head_y)*2;
2168   - var x1=(x+90) *unit;
2169   - var y1=(y+50) *unit;
2170   - //--昵称---
2171   - context.setFontSize(24 * unit)
2172   - context.setFillStyle("black")
2173   - context.fillText(app.globalData.userInfo.nickname, x1, y1);
2174   - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit;
2175   - //强烈推荐 改许程
2176   - var tj_path = "../../../images/share/q_tj.png";
2177   - context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit);
2178   - context.setFontSize(16 * unit)
2179   - context.setLineJoin('round'); //交点设置成圆角
2180   - context.setFillStyle("white")
2181   - context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit);
2182   -
2183   - //context.setFillStyle("black")
2184   - //context.setFontSize(24 * unit)
2185   - //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit);
2186   - }
2187   - } else {
2188   - //--昵称---
2189   - context.setFontSize(24 * unit)
2190   - context.setFillStyle("black")
2191   - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit);
2192   - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit;
2193   - //强烈推荐 改许程
2194   - var tj_path = "../../../images/share/q_tj.png";
2195   - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit);
2196   - context.setFontSize(16 * unit);
2197   - context.setLineJoin('round'); //交点设置成圆角
2198   - context.setFillStyle("white");
2199   - context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit);
2200   - }
2201   -
2202   -
2203   - //---产品名称---
2204   - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
2205   - if(type!=4){
2206   - context.setFillStyle("black");
2207   - context.setFontSize(21.3 * unit)
2208   - th.draw_Text(context, th.data.data.goods_name,
2209   - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit);
2210   - //------产品的价格-------
2211   - context.setFontSize(23 * unit)
2212   - context.setFillStyle("red")
2213   - context.fillText("¥", 416 * unit, 185 * unit);
2214   - context.setFontSize(31 * unit)
2215   - var pri0 = th.data.data.shop_price;
2216   - if (th.data.prom_act)
2217   - pri0 = th.data.prom_act.price;
2218   - pri0 = parseFloat(pri0).toFixed(2);
2219   - context.fillText(pri0, 438 * unit, 185 * unit);
2220   - //---市场价划掉---
2221   - context.setFillStyle("gray")
2222   - context.setFontSize(22 * unit)
2223   - context.fillText("¥" + th.data.data.market_price, 426 * unit, 213 * unit);
2224   - context.setStrokeStyle('gray');
2225   - context.setLineWidth(1 * unit);
2226   - context.moveTo(426 * unit, 206 * unit);
2227   - context.lineTo(510 * unit, 206 * unit);
2228   - context.stroke();
2229   -
2230   - }else{
2231   - context.setFillStyle("black");
2232   - context.setFontSize(21.3 * unit)
2233   - th.draw_Text(context, th.data.data.goods_name,
2234   - 38 * unit, 170 * unit, 20 * unit, 300*unit, unit);
2235   - //------ 产品的价格 -----
2236   - var pri0 = th.data.prom_act.addmoney;
2237   - var integral=th.data.prom_act.integral;
2238   - var text= "";
2239   - if(integral){text=integral+"积分"; }
2240   - if(pri0 && integral){ text+="+";}
2241   - if(pri0){ text+="¥"+pri0;}
2242   -
2243   - if(!pri0 && !integral){ text="0积分";}
2244   - context.setFillStyle("red");
2245   - context.fillText(text, 38 * unit, 235 * unit);
2246   -
2247   - }
2248   -
2249   - //---中间大图---
2250   - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
2251   - //-------大图后面就不一样了-----------
2252   - switch (type) {
2253   - case 0: //普通商品的展示
2254   - case 4:
2255   - //中间的几个字
2256   - if(th.data.poster && parseInt(th.data.poster.style)==2 ){
2257   - if(parseInt(th.data.poster.show_quality)){
2258   - var g_path = "../../../images/share/s_gou.png";
2259   - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
2260   - context.setFillStyle("red")
2261   - context.setFontSize(18 * unit)
2262   - context.fillText("正品保证", 84 * unit, 690 * unit);
2263   -
2264   - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
2265   - context.setFillStyle("red")
2266   - context.setFontSize(18 * unit)
2267   - context.fillText("纯实体店", 246 * unit, 690 * unit);
2268   -
2269   - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
2270   - context.setFillStyle("red")
2271   - context.setFontSize(18 * unit)
2272   - context.fillText("官方验证", 420 * unit, 690 * unit);
2273   - }
2274   -
2275   - }else{
2276   - var g_path = "../../../images/share/s_gou.png";
2277   - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);
2278   - context.setFillStyle("red")
2279   - context.setFontSize(18 * unit)
2280   - context.fillText("正品保证", 84 * unit, 690 * unit);
2281   -
2282   - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);
2283   - context.setFillStyle("red")
2284   - context.setFontSize(18 * unit)
2285   - context.fillText("纯实体店", 246 * unit, 690 * unit);
2286   -
2287   - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);
2288   - context.setFillStyle("red")
2289   - context.setFontSize(18 * unit)
2290   - context.fillText("官方验证", 420 * unit, 690 * unit);
2291   - }
2292   -
2293   -
2294   - //---画线---
2295   - context.setLineWidth(1 * unit)
2296   - context.moveTo(32 * unit, 710 * unit)
2297   - context.lineTo(520 * unit, 710 * unit)
2298   - context.stroke();
2299   -
2300   - //---文字---
2301   - context.setFillStyle("black")
2302   - context.setFontSize(22 * unit)
2303   -
2304   - if(type==0){
2305   - // 原来start --->
2306   - context.setFontSize(24 * unit)
2307   - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
2308   -
2309   - context.setFontSize(22 * unit)
2310   - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit);
2311   - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit);
2312   -
2313   - }else{
2314   - context.setFontSize(24 * unit)
2315   - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit);
2316   - context.setFontSize(22 * unit)
2317   - context.fillText("长按识别二维码", 40 * unit, 806 * unit);
2318   - context.fillText("立即开始兑换", 40 * unit, 846 * unit);
2319   -
2320   -
2321   - }
2322   -
2323   - //---二维吗图---
2324   - //-- 自定义海报 --
2325   - if(th.data.poster){
2326   - var erm_x= parseFloat(th.data.poster.ewm_x)*2;
2327   - var erm_y= parseFloat(th.data.poster.ewm_y)*2;
2328   - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
2329   - }else{
2330   - //---二维吗图---
2331   - context.drawImage(vpath, 410 * unit, 726 * unit, 115 * unit, 125 * unit);
2332   - }
2333   -
2334   - break;
2335   - case 1: //秒杀商品的展示
2336   - //---画线---
2337   - context.setLineWidth(1 * unit)
2338   - context.moveTo(32 * unit, 670 * unit)
2339   - context.lineTo(520 * unit, 670 * unit)
2340   - context.stroke();
2341   -
2342   - //画秒杀的图片
2343   - var miaos_path = '../../../images/share/miao_share.png';
2344   - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit);
2345   -
2346   - context.setFillStyle("black")
2347   - context.setFontSize(24 * unit)
2348   - context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit);
2349   - //---文字---
2350   - context.setFontSize(22 * unit)
2351   - context.setFillStyle("black")
2352   - context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit);
2353   - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);
2354   -
2355   -
2356   - //---二维吗图---
2357   - //-- 自定义海报 --
2358   - if(th.data.poster){
2359   - var erm_x= parseFloat(th.data.poster.ewm_x)*2;
2360   - var erm_y= parseFloat(th.data.poster.ewm_y)*2;
2361   - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
2362   - }else{
2363   - //---二维吗图---
2364   - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
2365   - }
2366   - break;
2367   -
2368   - case 2: //会员团和商家团的展示
2369   - //---画线---
2370   - context.setLineWidth(1 * unit)
2371   - context.moveTo(32 * unit, 670 * unit)
2372   - context.lineTo(520 * unit, 670 * unit)
2373   - context.stroke();
2374   - //---文字---
2375   -
2376   - context.setFillStyle("black")
2377   - context.setFontSize(24 * unit)
2378   - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
2379   -
2380   - //绘制成团图片
2381   - var ct_img = "../../../images/share/ct_num.png";
2382   - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit);
2383   - var ct_num = th.data.prom_act.ct_num;
2384   - context.setFontSize(14 * unit)
2385   - context.font = 'normal';
2386   - context.setFillStyle("red")
2387   - if (ct_num < 10) {
2388   - context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit);
2389   - } else {
2390   - context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit);
2391   - }
2392   - context.setFontSize(22 * unit)
2393   - context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit);
2394   -
2395   - context.setFillStyle("gray")
2396   - context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit);
2397   - context.setFillStyle("black")
2398   - context.font = 'normal bold 18px sans-serif';
2399   - context.setFontSize(21.3 * unit)
2400   - context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit);
2401   -
2402   -
2403   - //---二维吗图---
2404   - //-- 自定义海报 --
2405   - if(th.data.poster){
2406   - var erm_x= parseFloat(th.data.poster.ewm_x)*2;
2407   - var erm_y= parseFloat(th.data.poster.ewm_y)*2;
2408   - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
2409   - }else{
2410   - //---二维吗图---
2411   - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
2412   - }
2413   - break
2414   - case 3: //阶梯团的展示
2415   - //---画线---
2416   - context.setLineWidth(1 * unit)
2417   - context.moveTo(32 * unit, 670 * unit)
2418   - context.lineTo(520 * unit, 670 * unit)
2419   - context.stroke();
2420   - //---文字---
2421   -
2422   - context.setFillStyle("black")
2423   - context.setFontSize(24 * unit)
2424   - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit);
2425   -
2426   - //---绘制中间阶梯的价格---
2427   - var list = th.data.prom_act.ct_rylist;
2428   - for (var i = 0; i < list.length; i++) {
2429   - var item = list[i];
2430   - var wi = i * 90 * unit;
2431   - context.font = 'normal';
2432   - context.setFontSize(16 * unit)
2433   - context.setFillStyle("red")
2434   - context.fillText("¥", 40 * unit + wi, 756 * unit);
2435   - context.setFontSize(22 * unit)
2436   - var pri = parseFloat(item.price).toFixed(2);
2437   - context.fillText(pri, 56 * unit + wi, 756 * unit);
2438   - context.setFillStyle("gray")
2439   - context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit);
2440   - }
2441   - //----------------下面部分----------------
2442   - // context.setFillStyle("gray")
2443   - // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit);
2444   - // context.setFillStyle("black")
2445   - // context.font = 'normal bold 18px sans-serif';
2446   - // context.setFontSize(22 * unit)
2447   - // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit);
2448   - //context.setFillStyle("gray")
2449   - context.setFillStyle("black")
2450   - context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit);
2451   - //context.font = 'normal bold 18px sans-serif';
2452   - context.setFontSize(22 * unit)
2453   - context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit);
2454   -
2455   -
2456   - //-- 自定义海报 --
2457   - if(th.data.poster){
2458   - var erm_x= parseFloat(th.data.poster.ewm_x)*2;
2459   - var erm_y= parseFloat(th.data.poster.ewm_y)*2;
2460   - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit);
2461   - }else{
2462   - //---二维吗图---
2463   - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit);
2464   - }
2465   - break
2466   -
2467   -
2468   - }
2469   -
2470   -
2471   - //--- 如果是自定义海报的时候 ---
2472   - if(th.data.poster && parseInt(th.data.poster.style)==2){
2473   -
2474   - //如果显示会员信息的话
2475   - if(parseInt(th.data.poster.show_headpic)){
2476   - //获取坐标
2477   - var x= parseFloat(th.data.poster.head_x)*2;
2478   - var y=parseFloat(th.data.poster.head_y)*2;
2479   - //---绘制圆形要放在最后----
2480   - context.save();
2481   - context.beginPath();
2482   - var h_x = x* unit;
2483   - var h_y = y * unit;
2484   - var h_r = 40 * unit;
2485   - var cx = h_x + h_r;
2486   - var cy = h_y + h_r;
2487   - context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
2488   - context.closePath();
2489   - context.fill();
2490   - context.clip();
2491   - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
2492   - context.restore();
2493   - }
2494   -
2495   - }else{
2496   - //---绘制圆形要放在最后----
2497   - context.save();
2498   - context.beginPath();
2499   - var h_x = 60 * unit;
2500   - var h_y = 24 * unit;
2501   - var h_r = 40 * unit;
2502   - var cx = h_x + h_r;
2503   - var cy = h_y + h_r;
2504   - context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
2505   - context.closePath();
2506   - context.fill();
2507   - context.clip();
2508   - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
2509   - context.restore();
2510   - }
2511   -
2512   -
2513   - //把画板内容绘制成图片,并回调 画板图片路径
2514   - context.draw(false, function() {
2515   - setTimeout(function() {
2516   - wx.canvasToTempFilePath({
2517   - x: 0,
2518   - y: 0,
2519   - width: 750,
2520   - height: 1217,
2521   - destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
2522   - destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
2523   - canvasId: 'share',
2524   - success: function(res) {
2525   - that.setData({
2526   - shareImgPath: res.tempFilePath,
2527   - canvasHidden: true
2528   - })
2529   - if (!res.tempFilePath) {
2530   - wx.showModal({
2531   - title: '提示',
2532   - content: '图片绘制中,请稍后重试',
2533   - showCancel: false
2534   - })
2535   - return false;
2536   - }
2537   - // wx.previewImage({
2538   - // //将图片预览出来
2539   - // urls: [that.data.shareImgPath]
2540   - // });
2541   - that.setData({
2542   - showPoster: true,
2543   - });
2544   - wx.hideLoading();
2545   - }
2546   - })
2547   - }, 500)
2548   -
2549   - });
2550   - });
2551   - }
2552   - });
2553   - },
2554   -
2555 2143  
2556   - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
2557   - draw_Text: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) {
2558   - var lineWidth = 0;
2559   - var lastSubStrIndex = 0; //每次开始截取的字符串的索引
2560   - var han = 0;
2561   - for (let i = 0; i < str.length; i++) {
2562   - if (han == 2) return;
2563   - //lineWidth += ctx.measureText(str[i]).width;
2564   - lineWidth += ut.measureText(str[i], 21.3 * unit);
2565   - if (lineWidth > canvasWidth) {
2566   - han++;
2567   -
2568   - if (han == 2)
2569   - ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分
2570   - else
2571   - ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight);
2572   -
2573   - initHeight += 22; //22为字体的高度
2574   - lineWidth = 0;
2575   - lastSubStrIndex = i;
2576   - titleHeight += 20;
2577   - }
2578   - if (i == str.length - 1) { //绘制剩余部分
2579   - ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
2580   - }
2581   - }
2582   - },
2583 2144  
2584 2145 // ----视频图片----
2585 2146 // 图片计数器
... ... @@ -2636,7 +2197,7 @@ Page({
2636 2197 return false;
2637 2198 }
2638 2199 //---获取分享图片的本地地址,头像和商品图片----
2639   - var path2 = getApp().globalData.userInfo.head_pic;
  2200 + var path2 = getApp().globalData.userInfo?getApp().globalData.userInfo.head_pic:'';
2640 2201 if (path2 == "") {
2641 2202 ee.data.share_head = "../../../images/share/hui_hear_pic.png";
2642 2203 tt(func);
... ... @@ -2657,37 +2218,44 @@ Page({
2657 2218 });
2658 2219 }
2659 2220 },
  2221 +
2660 2222 //--获取商品图片的本地缓存,回调写法--
2661 2223 get_goods_temp: function(tt) {
2662   - var ee = this;
2663   - if (ee.data.share_goods_img) {
2664   - tt();
2665   - return false;
2666   - }
2667   - //获取商品是分享图信息
2668   - wx.getImageInfo({
2669   - src: ee.data.data.original_img,
2670   - success: function(res) {
2671   - //res.path是网络图片的本地地址
2672   - ee.data.share_goods_img = res.path;
2673   - tt();
2674   - },
2675   - fail: function(res) {
2676   - //获取默认空白图
2677   - wx.getImageInfo({
2678   - src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
2679   - success: function(res) {
2680   - ee.data.share_goods_img = res.path; //分享的图片不能用网络的
2681   - tt();
2682   - }
2683   - })
  2224 + var ee = this;
  2225 + if (ee.data.share_goods_img) {
  2226 + tt();
  2227 + return false;
  2228 + }
2684 2229  
2685   - }
2686   - });
2687   - },
  2230 + var img=ee.data.iurl+ee.data.data.image_url;
  2231 + if(ee.data.prom_act && ee.data.prom_act.share_img){
  2232 + img=ee.data.iurl+ee.data.prom_act.share_img;
  2233 + }
  2234 +
  2235 + //获取商品是分享图信息
  2236 + wx.getImageInfo({
  2237 + src: img,
  2238 + success: function(res) {
  2239 + //res.path是网络图片的本地地址
  2240 + ee.data.share_goods_img = res.path;
  2241 + tt();
  2242 + },
  2243 + fail: function(res) {
  2244 + //获取默认空白图
  2245 + wx.getImageInfo({
  2246 + src: ee.data.iurl+'/miniapp/images/default_g_img.gif',
  2247 + success: function(res) {
  2248 + ee.data.share_goods_img = res.path; //分享的图片不能用网络的
  2249 + tt();
  2250 + }
  2251 + })
  2252 +
  2253 + }
  2254 + });
  2255 + },
2688 2256  
2689 2257  
2690   - //--跳转到商品详情页面--
  2258 + //--跳转到商品详情页面--
2691 2259 go_goods: function(e) {
2692 2260 var gid = e.currentTarget.dataset.gid;
2693 2261 var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + gid;
... ... @@ -3673,7 +3241,7 @@ Page({
3673 3241 ee.get_normal(gid);
3674 3242 return false;
3675 3243 }
3676   -
  3244 +
3677 3245 var t_gd = ee.data.data;
3678 3246 var prom_end_time = ut.formatTime(t.data.data.end_time, "yyyy-MM-dd hh:mm:ss");
3679 3247 var prom_start_time = ut.formatTime(t.data.data.start_time, "yyyy-MM-dd hh:mm:ss");
... ... @@ -3686,6 +3254,7 @@ Page({
3686 3254 prom_act: t.data.data,
3687 3255 prom_end_time: prom_end_time,
3688 3256 prom_start_time: prom_start_time,
  3257 + is_share_text: t.data.data.is_share_text
3689 3258 });
3690 3259  
3691 3260 ee.get_sto();
... ... @@ -3957,6 +3526,8 @@ Page({
3957 3526 openSpecModel_Nor: function () {
3958 3527 var th=this;
3959 3528  
  3529 + if(th.data.get_sto_ing) return false;
  3530 +
3960 3531 // 是否授权登陆
3961 3532 var user_info = getApp().globalData.userInfo;
3962 3533 if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
... ... @@ -4095,9 +3666,776 @@ Page({
4095 3666 })
4096 3667 }
4097 3668 },
4098   -
4099   -
4100   -
  3669 +
  3670 + clickShare() {
  3671 + this.setData({
  3672 + share_hidden: true,
  3673 + });
  3674 + },
  3675 + send() {
  3676 + this.setData({
  3677 + share_hidden: false,
  3678 + });
  3679 + },
  3680 + cancel() {
  3681 + this.setData({
  3682 + share_hidden: false,
  3683 + });
  3684 + },
  3685 +
  3686 +
  3687 + saveImageFn(){
  3688 + if(this.data.share_b_img){
  3689 + this.saveImageToPhotosAlbum()
  3690 + }else{
  3691 + this.saveImageToPhotosAlbumDef()
  3692 + }
  3693 + },
  3694 +
  3695 +
  3696 + //--定义的保存图片方法,分享团---
  3697 + saveImageToPhotosAlbum: function () {
  3698 + //--先判断会员状态--
  3699 + // var user_info = getApp().globalData.userInfo;
  3700 + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  3701 + // //getApp().my_warnning("请先登录",0,this);
  3702 + // wx.navigateTo({ url: '/packageE/pages/togoin/togoin', })
  3703 + // return false;
  3704 + // }
  3705 +
  3706 + if (this.data.share_hidden) {
  3707 + this.setData({
  3708 + share_hidden: false,
  3709 + });
  3710 + };
  3711 +
  3712 + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
  3713 + var type = this.data.prom_type || 0;
  3714 + console.log('商品类型-----');
  3715 + console.log(type);
  3716 + // if (type == 2) type = -1;
  3717 + if (type == 4) type = 0;
  3718 + if (type == 8) type = 0;
  3719 + if (type == 2) type = 0;
  3720 + if (type == 6) type = 2; // 6拼团 2团购
  3721 + if (type == 10) type = -1;
  3722 +
  3723 + wx.showLoading({
  3724 + title: '生成中...',
  3725 + })
  3726 + var that = this,
  3727 + th = that;
  3728 + //设置画板显示,才能开始绘图
  3729 + that.setData({
  3730 + canvasHidden: false
  3731 + })
  3732 +
  3733 + var app = getApp();
  3734 + var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
  3735 + var path2 = that.data.data.original_img;
  3736 +
  3737 + var scene = th.data.gid;
  3738 + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
  3739 + if (user_id > 0) {
  3740 + scene += "_" + user_id;
  3741 + }
  3742 + //-- 如果不是会员分享过来的要分享给别人 --
  3743 + if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
  3744 + //固定房间是第3个字符
  3745 + if (!user_id) scene += "_0";
  3746 + scene += "_" + getApp().globalData.room_id;
  3747 + }else{
  3748 + if (!user_id) scene += "_0";
  3749 + scene += "_0";
  3750 + }
  3751 + if(this.data.prom_type){
  3752 + scene += "_" + this.data.prom_type+"_"+th.data.prom_id;
  3753 + }
  3754 +
  3755 +
  3756 + ///二微码
  3757 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  3758 + os.stoid + "?sceneValue=" + scene + "&pageValue=packageA/pages/goodsInfo/goodsInfo";
  3759 +
  3760 +
  3761 + console.log(path3);
  3762 +
  3763 + //读取文件成功则OK--
  3764 + wx.getImageInfo({
  3765 + src: path3,
  3766 + success: function (res) {
  3767 + //回调写法
  3768 + th.get_head_temp(th.get_goods_temp, function () {
  3769 + var vpath = res.path;
  3770 + var context = wx.createCanvasContext('share');
  3771 + //先画背景
  3772 + var pg_path = "../../../images/share/share_bg.png";
  3773 +
  3774 + //-- 如果有自定义海报的时候,判断背景的图片 --
  3775 + if (th.data.share_b_img) {
  3776 + pg_path = th.data.share_b_img;
  3777 + }
  3778 + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit);
  3779 +
  3780 + let nick=app.globalData.userInfo?app.globalData.userInfo.nickname:'';
  3781 +
  3782 + //-- 是自定义海报的情况下 --
  3783 + if (th.data.poster && parseInt(th.data.poster.style) == 2) {
  3784 + //在线上分享人的情况下
  3785 + if (parseInt(th.data.poster.show_headpic)) {
  3786 + //获取坐标
  3787 + var x = parseFloat(th.data.poster.head_x) * 2;
  3788 + var y = parseFloat(th.data.poster.head_y) * 2;
  3789 + var x1 = (x + 90) * unit;
  3790 + var y1 = (y + 50) * unit;
  3791 + //--昵称---
  3792 + context.setFontSize(24 * unit)
  3793 + context.setFillStyle("black")
  3794 + context.fillText(nick, x1, y1);
  3795 + var width = 24 * nick.length * unit + 4 * unit;
  3796 + //强烈推荐 改许程
  3797 + var tj_path = "../../../images/share/q_tj.png";
  3798 + context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit);
  3799 + context.setFontSize(16 * unit)
  3800 + context.setLineJoin('round'); //交点设置成圆角
  3801 + context.setFillStyle("white")
  3802 + context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit);
  3803 +
  3804 + //context.setFillStyle("black")
  3805 + //context.setFontSize(24 * unit)
  3806 + //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit);
  3807 + }
  3808 + } else {
  3809 + //--昵称---
  3810 + context.setFontSize(24 * unit)
  3811 + context.setFillStyle("black")
  3812 + context.fillText(nick, 152 * unit, 76 * unit);
  3813 + var width = 24 * nick.length * unit + 2 * unit;
  3814 + //强烈推荐 改许程
  3815 + var tj_path = "../../../images/share/q_tj.png";
  3816 + context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit);
  3817 + context.setFontSize(16 * unit);
  3818 + context.setLineJoin('round'); //交点设置成圆角
  3819 + context.setFillStyle("white");
  3820 + context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit);
  3821 + }
  3822 +
  3823 + var share_title = th.data.data.goods_name;
  3824 +
  3825 + if (th.data.prom_type == 1 || th.data.prom_type == 2 || th.data.prom_type == 6 || th.data.prom_type == 4) {
  3826 + share_title = th.data.prom_act.share_title;
  3827 + if (!share_title) share_title = th.data.prom_act.title;
  3828 + if (th.data.prom_type == 4) share_title = th.data.prom_act.name;
  3829 +
  3830 + //-- 显示活动时间 --
  3831 + if (th.data.share_b_img) {
  3832 + act_time = "截止时间:" + ut.formatTime(th.data.prom_act.end_time);
  3833 + }
  3834 + }
  3835 +
  3836 + //---产品名称---
  3837 + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
  3838 +
  3839 + context.setFillStyle("black");
  3840 + context.setFontSize(21.3 * unit)
  3841 + th.draw_Text(context, share_title,
  3842 + 80 * unit, 160 * unit, 200 * unit, 279 * unit, unit);
  3843 +
  3844 + //------产品的价格-------
  3845 + context.setFontSize(23 * unit)
  3846 + context.setFillStyle("red")
  3847 +
  3848 + // 7.商品价格
  3849 + let price = th.data.data.shop_price;
  3850 + if (th.data.card_field && th.data.data[th.data.card_field]) {
  3851 + price = th.data.data[th.data.card_field];
  3852 + }
  3853 + if (th.data.prom_act) price = th.data.prom_price;
  3854 + price = parseFloat(price).toFixed(2);
  3855 +
  3856 + var wd1 = th.data.screenWidth - ut.measureText(price, 31 * unit) - 25;
  3857 + context.fillText("¥", wd1 - 15, 160 * unit);
  3858 + context.setFontSize(31 * unit)
  3859 + context.fillText(price, wd1, 165 * unit);
  3860 +
  3861 + //---市场价划掉---
  3862 + // context.setFillStyle("red")
  3863 + // context.setFontSize(22 * unit)
  3864 + // pri0 = "¥" + th.data.data.market_price.toFixed(2);
  3865 + // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25;
  3866 +
  3867 +
  3868 +
  3869 + // context.setStrokeStyle('gray');
  3870 + // context.fillText(pri0, wd2, 213 * unit);
  3871 + // context.setLineWidth(1 * unit);
  3872 + // context.moveTo(wd2 - 5, 206 * unit);
  3873 + // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
  3874 + // context.stroke();
  3875 +
  3876 + //-- 零售价的优化 --
  3877 + var wp = wd1;
  3878 + var hp = 203 * unit;
  3879 + if (th.data.prom_type != 4) wp -= 12;
  3880 + th.draw_pos_price(context,wp,hp,th.data.data.show_price,unit);
  3881 +
  3882 +
  3883 + //console.log(th.data.share_goods_img);
  3884 + //let share_goods_img=th.data.presellForm.share_img;
  3885 + //share_goods_img?share_goods_img:th.data.data.share_goods_img;
  3886 + //---中间大图---
  3887 + context.drawImage(th.data.share_goods_img, 70 * unit, 220 * unit, 408 * unit, 408 * unit);
  3888 + //---自定义海报 产品质量保证
  3889 + if(th.data.poster.show_quality==1 ){
  3890 + var g_path = "../../../images/share/s_gou.png";
  3891 + context.drawImage(g_path, 56 * unit, 644 * unit, 22 * unit, 22 * unit);
  3892 + context.setFillStyle("red")
  3893 + context.setFontSize(18 * unit)
  3894 + context.fillText("正品保证", 84 * unit, 664 * unit);
  3895 +
  3896 + context.drawImage(g_path, 218 * unit, 644 * unit, 22 * unit, 22 * unit);
  3897 + context.setFillStyle("red")
  3898 + context.setFontSize(18 * unit)
  3899 + context.fillText("纯实体店", 246 * unit, 664 * unit);
  3900 +
  3901 + context.drawImage(g_path, 388 * unit, 644 * unit, 22 * unit, 22 * unit);
  3902 + context.setFillStyle("red")
  3903 + context.setFontSize(18 * unit)
  3904 + context.fillText("官方验证", 420 * unit, 664 * unit);
  3905 +
  3906 + }
  3907 +
  3908 + //---画线---
  3909 + // context.setLineWidth(1 * unit)
  3910 + // context.moveTo(32 * unit, 662 * unit)
  3911 + // context.lineTo(520 * unit, 662 * unit)
  3912 + // context.stroke();
  3913 +
  3914 + //-- 图片底部文字 --
  3915 + switch (type){
  3916 + case 0:
  3917 + //---文字---
  3918 + //---文字---
  3919 + context.setFillStyle("black");
  3920 + context.setFontSize(22 * unit);
  3921 +
  3922 + context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 776 * unit);
  3923 + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 826 * unit);
  3924 +
  3925 + break;
  3926 +
  3927 + case 1:
  3928 +
  3929 + //画秒杀的图片
  3930 + if (th.data.is_share_text) {
  3931 + var miaos_path = '../../../images/share/miao_share.png';
  3932 + context.drawImage(miaos_path, 43 * unit, 690 * unit, 222 * unit, 40 * unit);
  3933 + }
  3934 +
  3935 + context.setFillStyle("black")
  3936 + context.setFontSize(24 * unit)
  3937 + context.fillText(th.data.sto_sele_name_1, 40 * unit, 770 * unit);
  3938 + //---文字---
  3939 + context.setFontSize(22 * unit)
  3940 + context.setFillStyle("black")
  3941 + if (th.data.is_share_text) {
  3942 + context.fillText("特惠好物,限时秒杀", 40 * unit, 807 * unit);
  3943 + }
  3944 + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 844 * unit);
  3945 +
  3946 + break;
  3947 +
  3948 + }
  3949 +
  3950 +
  3951 +
  3952 + //---二维吗图---
  3953 + //-- 自定义海报 --
  3954 + if (th.data.poster) {
  3955 + var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
  3956 + var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
  3957 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
  3958 + } else {
  3959 + //---二维吗图---
  3960 + context.drawImage(vpath, 390 * unit, 746 * unit, 130 * unit, 116 * unit);
  3961 + }
  3962 +
  3963 + //--- 如果是自定义海报的时候 ---
  3964 + if (th.data.poster && parseInt(th.data.poster.style) == 2) {
  3965 +
  3966 + //如果显示会员信息的话
  3967 + if (parseInt(th.data.poster.show_headpic)) {
  3968 + //获取坐标
  3969 + var x = parseFloat(th.data.poster.head_x) * 2;
  3970 + var y = parseFloat(th.data.poster.head_y) * 2;
  3971 + //---绘制圆形要放在最后----
  3972 + context.save();
  3973 + context.beginPath();
  3974 + var h_x = x * unit;
  3975 + var h_y = y * unit;
  3976 + var h_r = 40 * unit;
  3977 + var cx = h_x + h_r;
  3978 + var cy = h_y + h_r;
  3979 + context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  3980 + context.closePath();
  3981 + context.fill();
  3982 + context.clip();
  3983 + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
  3984 + context.restore();
  3985 + }
  3986 +
  3987 + } else {
  3988 + //---绘制圆形要放在最后----
  3989 + context.save();
  3990 + context.beginPath();
  3991 + var h_x = 60 * unit;
  3992 + var h_y = 24 * unit;
  3993 + var h_r = 40 * unit;
  3994 + var cx = h_x + h_r;
  3995 + var cy = h_y + h_r;
  3996 + context.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  3997 + context.closePath();
  3998 + context.fill();
  3999 + context.clip();
  4000 + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2);
  4001 + context.restore();
  4002 + }
  4003 +
  4004 +
  4005 + if(th.data.poster.show_time==1 && th.data.prom_act){
  4006 + var act_time='';
  4007 + act_time="截止时间:"+ ut.formatTime(th.data.prom_act.end_time);
  4008 + context.setFillStyle("red")
  4009 + getApp().draw_Text(context, act_time,38 * unit, 880 * unit, 200 * unit, 340 * unit, unit);
  4010 + }
  4011 +
  4012 + //把画板内容绘制成图片,并回调 画板图片路径
  4013 + context.draw(false, function () {
  4014 + setTimeout(function () {
  4015 + wx.canvasToTempFilePath({
  4016 + x: 0,
  4017 + y: 0,
  4018 + width: 750,
  4019 + height: 1217,
  4020 + destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
  4021 + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
  4022 + canvasId: 'share',
  4023 + success: function (res) {
  4024 +
  4025 + that.setData({
  4026 + shareImgPath: res.tempFilePath,
  4027 + canvasHidden: true
  4028 + })
  4029 +
  4030 + if (!res.tempFilePath) {
  4031 + wx.showModal({
  4032 + title: '提示',
  4033 + content: '图片绘制中,请稍后重试',
  4034 + showCancel: false
  4035 + })
  4036 + return false;
  4037 + }
  4038 +
  4039 + // wx.previewImage({
  4040 + // //将图片预览出来
  4041 + // urls: [that.data.shareImgPath]
  4042 + // });
  4043 + that.setData({
  4044 + showPoster: true,
  4045 + });
  4046 + wx.hideLoading();
  4047 + }
  4048 + })
  4049 + }, 500)
  4050 +
  4051 + });
  4052 + });
  4053 + },
  4054 + fail: function (res) {
  4055 + console.log(res);
  4056 + wx.hideLoading();
  4057 +
  4058 + }
  4059 + });
  4060 + },
  4061 + //--定义的保存图片方法,分享团---
  4062 + saveImageToPhotosAlbumDef: function () {
  4063 + //--先判断会员状态--
  4064 + // var user_info = getApp().globalData.userInfo;
  4065 + // if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
  4066 + // //getApp().my_warnning("请先登录",0,this);
  4067 + // wx.navigateTo({url: '/packageE/pages/togoin/togoin',})
  4068 + // return false;
  4069 + // }
  4070 +
  4071 + if (this.data.share_hidden) {
  4072 + this.setData({share_hidden: false,});
  4073 + };
  4074 +
  4075 + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团
  4076 + var type = this.data.prom_type || 0;
  4077 + console.log('商品类型-----');
  4078 + console.log(type);
  4079 + // if (type == 2) type = -1;
  4080 + if (type == 4) type = 0;
  4081 + if (type == 8) type = 0;
  4082 + if (type == 2) type = 0;
  4083 + if (type == 6) type = 2; // 6拼团 2团购
  4084 + if (type == 10) type = -1;
  4085 +
  4086 + if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
  4087 + console.log('商品类型。。。。。');
  4088 + console.log(type);
  4089 + wx.showLoading({title: '生成中...',})
  4090 + var that = this, th = that;
  4091 + //设置画板显示,才能开始绘图
  4092 + that.setData({
  4093 + canvasHidden: false
  4094 + })
  4095 +
  4096 + var app = getApp();
  4097 + var unit = that.data.screenWidth / 750 * 1.35; //基础单位,
  4098 + var path2 = that.data.data.original_img;
  4099 +
  4100 + var scene = th.data.gid;
  4101 + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0;
  4102 + if (user_id > 0) {
  4103 + scene += "_" + user_id;
  4104 + }
  4105 + //-- 如果不是会员分享过来的要分享给别人 --
  4106 + if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) {
  4107 + //固定房间是第3个字符
  4108 + if (!user_id) scene += "_0";
  4109 + scene += "_" + getApp().globalData.room_id;
  4110 + }else{
  4111 + if (!user_id) scene += "_0";
  4112 + scene += "_0";
  4113 + }
  4114 + if(this.data.prom_type){
  4115 + scene += "_" + this.data.prom_type+"_"+th.data.prom_id;
  4116 + }
  4117 +
  4118 + ///二微码
  4119 + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
  4120 + os.stoid + "?sceneValue=" + scene + "&pageValue=packageA/pages/goodsInfo/goodsInfo";
  4121 +
  4122 + console.log(path3);
  4123 +
  4124 +
  4125 + // 读取文件成功则OK--
  4126 + wx.getImageInfo({
  4127 + src: path3,
  4128 + success: function (res) {
  4129 + // 回调写法
  4130 + th.get_head_temp(th.get_goods_temp, function () {
  4131 + var vpath = res.path;
  4132 + var context = wx.createCanvasContext('share');
  4133 + // 先画背景
  4134 + var pg_path = "../../../../images/share/share_bg.png";
  4135 + th.drawPoster(context, unit, th.data.share_goods_img, vpath, type);
  4136 +
  4137 + //把画板内容绘制成图片,并回调 画板图片路径
  4138 + context.draw(false, function () {
  4139 + setTimeout(function () {
  4140 + wx.canvasToTempFilePath({
  4141 + x: 0,
  4142 + y: 0,
  4143 + width: 750,
  4144 + height: 1217,
  4145 + destWidth: 1.2 * 750 * 750 / that.data.screenWidth,
  4146 + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth,
  4147 + canvasId: 'share',
  4148 + success: function (res) {
  4149 +
  4150 + that.setData({
  4151 + shareImgPath: res.tempFilePath,
  4152 + canvasHidden: true
  4153 + })
  4154 +
  4155 + if (!res.tempFilePath) {
  4156 + wx.showModal({
  4157 + title: '提示',
  4158 + content: '图片绘制中,请稍后重试',
  4159 + showCancel: false
  4160 + })
  4161 + return false;
  4162 + }
  4163 +
  4164 + that.setData({
  4165 + showPoster: true,
  4166 + });
  4167 + wx.hideLoading();
  4168 + }
  4169 + })
  4170 + }, 500)
  4171 +
  4172 + });
  4173 + });
  4174 + },
  4175 + fail: function (res) {
  4176 + console.log(res);
  4177 + wx.hideLoading();
  4178 +
  4179 + }
  4180 + });
  4181 + },
  4182 +
  4183 + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度
  4184 + draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) {
  4185 + var lineWidth = 0;
  4186 + var lastSubStrIndex = 0; //每次开始截取的字符串的索引
  4187 + var han = 0;
  4188 + for (let i = 0; i < str.length; i++) {
  4189 + if (han == 2) return;
  4190 + //lineWidth += ctx.measureText(str[i]).width;
  4191 + lineWidth += ut.measureText(str[i], 21.3 * unit);
  4192 + if (lineWidth > canvasWidth) {
  4193 + han++;
  4194 +
  4195 + if (han == 2)
  4196 + ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分
  4197 + else
  4198 + ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight);
  4199 +
  4200 + initHeight += 22; //22为字体的高度
  4201 + lineWidth = 0;
  4202 + lastSubStrIndex = i;
  4203 + titleHeight += 20;
  4204 + }
  4205 + if (i == str.length - 1) { //绘制剩余部分
  4206 + ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight);
  4207 + }
  4208 + }
  4209 + },
  4210 +
  4211 + drawPoster(context, unit, img, vpath, type) {
  4212 + // 1.灰色背景
  4213 + context.setFillStyle('#f2f1f6');
  4214 + context.rect(0, 0, 554 * unit, 899 * unit);
  4215 + context.fill();
  4216 +
  4217 + // 2.商城名称
  4218 + let shopName = this.data.sto_sele_name_1;
  4219 + context.setTextAlign('center');
  4220 + context.setFontSize(26 * unit);
  4221 + context.setFillStyle('black');
  4222 + context.fillText(shopName, 277 * unit, 60 * unit);
  4223 +
  4224 + // 3.推荐来源
  4225 + if(getApp().globalData.userInfo) {
  4226 + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`;
  4227 + context.setTextAlign('center');
  4228 + context.setFontSize(22 * unit);
  4229 + context.setFillStyle('#96959a');
  4230 + context.fillText(fromText, 277 * unit, 105 * unit);
  4231 + }
  4232 + // 4.海报背景
  4233 + context.setFillStyle('white');
  4234 + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit);
  4235 +
  4236 + // 5.商品图片
  4237 + // 图片的x坐标
  4238 + let bg_x = 37 * unit
  4239 + // 图片的y坐标
  4240 + let bg_y = 157 * unit
  4241 + // 图片宽度
  4242 + let bg_w = 480 * unit
  4243 + // 图片高度
  4244 + let bg_h = 474 * unit
  4245 + // 图片圆角
  4246 + let bg_r = 4
  4247 + // 绘制海报背景图片圆角
  4248 + context.save()
  4249 + context.beginPath()
  4250 + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5)
  4251 + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2)
  4252 + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5)
  4253 + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI)
  4254 + context.clip()
  4255 + context.drawImage(img, bg_x, bg_y, bg_w, bg_h);
  4256 + context.restore();
  4257 +
  4258 + // 6.强烈推荐
  4259 + let src = '';
  4260 + context.beginPath();
  4261 + if (type == 0) { // 普通
  4262 + src = '../../../images/share/q_tj.png';
  4263 + context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit);
  4264 + context.setFontSize(16 * unit)
  4265 + context.setFillStyle("white")
  4266 + context.setTextAlign('left');
  4267 + context.fillText('强烈推荐', 64 * unit, 668 * unit);
  4268 + }
  4269 + if (type == 1) { // 秒杀
  4270 +
  4271 + if (this.data.is_share_text == 1) {
  4272 + src = '../../../images/share/miao_share.png';
  4273 + context.drawImage(src, 54 * unit, 648 * unit, 200 * unit, 36 * unit);
  4274 + }
  4275 + context.setTextAlign('left');
  4276 + }
  4277 +
  4278 +
  4279 + // 7.商品价格
  4280 + let price = this.data.data.shop_price;
  4281 + if (this.data.card_field && this.data.data[this.data.card_field]) {
  4282 + price = this.data.data[this.data.card_field];
  4283 + }
  4284 + if (this.data.prom_act) price = this.data.prom_price;
  4285 + price = parseFloat(price).toFixed(2);
  4286 + context.setFontSize(32 * unit);
  4287 + context.setFillStyle('#DE1117');
  4288 +
  4289 + //price = this.data.presellList.presell_price
  4290 + context.fillText('¥' + price, 54 * unit, 735 * unit);
  4291 + //-- 零售价的优化 --
  4292 + var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit);
  4293 + var hp=735 * unit
  4294 + this.draw_pos_price(context,wp,hp,this.data.data.show_price,unit);
  4295 +
  4296 +
  4297 + // 8.商品标题
  4298 + context.setFontSize(20 * unit);
  4299 + context.setFillStyle('#898989');
  4300 + getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1);
  4301 +
  4302 + // 9.小程序码
  4303 + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit);
  4304 + context.setFontSize(16 * unit);
  4305 + context.setFillStyle('#777');
  4306 + context.fillText('长按识别二维码', 378 * unit, 810 * unit);
  4307 +
  4308 + // 10.竖线
  4309 + context.beginPath();
  4310 + context.setFillStyle('#eee');
  4311 + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit);
  4312 + context.fill();
  4313 + },
  4314 +
  4315 + //---市场价划掉---
  4316 + draw_pos_price(context,w,h,market_price,unit){
  4317 +
  4318 + if(!this.data.sys_switch) return false;
  4319 + if(!this.data.sys_switch.is_retail_price) return false;
  4320 +
  4321 + context.setFillStyle("gray")
  4322 + context.setFontSize(22 * unit)
  4323 + var pri0 = "¥" + market_price.toFixed(2);
  4324 + context.fillText(pri0, w, h);
  4325 +
  4326 + var c_h=h-6;
  4327 + context.setStrokeStyle('gray');
  4328 + context.setLineWidth(1 * unit);
  4329 + context.moveTo(w - 5, c_h);
  4330 + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h);
  4331 + context.stroke();
  4332 +
  4333 + },
  4334 +
  4335 +
  4336 + closePoster() {
  4337 + this.setData({
  4338 + showPoster: false,
  4339 + });
  4340 + },
  4341 +
  4342 + // 保存图片到手机
  4343 + savePic() {
  4344 + console.log('保存图片');
  4345 + var self = this;
  4346 + // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限
  4347 + this.getSetting().then((res) => {
  4348 + // 判断用户是否授权了保存到相册的权限,如果没有发起授权
  4349 + if (!res.authSetting['scope.writePhotosAlbum']) {
  4350 + this.authorize().then(() => {
  4351 + // 同意授权后保存下载文件
  4352 + this.saveImage(self.data.shareImgPath)
  4353 + .then(() => {
  4354 + self.setData({
  4355 + showPoster: false
  4356 + });
  4357 + });
  4358 + })
  4359 + } else {
  4360 + // 如果已经授权,保存下载文件
  4361 + this.saveImage(self.data.shareImgPath)
  4362 + .then(() => {
  4363 + self.setData({
  4364 + showPoster: false
  4365 + });
  4366 + });
  4367 + }
  4368 +
  4369 + })
  4370 + },
  4371 +
  4372 + // 发起首次授权请求
  4373 + authorize() {
  4374 + // isFirst 用来记录是否为首次发起授权,
  4375 + // 如果首次授权拒绝后,isFirst赋值为1
  4376 + let isFirst = wx.getStorageSync('isFirst') || 0;
  4377 + return new Promise((resolve, reject) => {
  4378 + wx.authorize({
  4379 + scope: 'scope.writePhotosAlbum',
  4380 + // 同意授权
  4381 + success: () => {
  4382 + resolve();
  4383 + },
  4384 + // 拒绝授权,这里是用户拒绝授权后的回调
  4385 + fail: res => {
  4386 + if (isFirst === 0) {
  4387 + wx.setStorageSync('isFirst', 1);
  4388 + wx.showToast({
  4389 + title: '保存失败',
  4390 + icon: 'none',
  4391 + duration: 1000
  4392 + })
  4393 + } else {
  4394 + this.showModal();
  4395 + }
  4396 + console.log('拒绝授权');
  4397 + reject();
  4398 + }
  4399 + })
  4400 + })
  4401 + },
  4402 +
  4403 +
  4404 + // 保存图片到系统相册
  4405 + saveImage(saveUrl) {
  4406 + var self = this;
  4407 + return new Promise((resolve, reject) => {
  4408 + wx.saveImageToPhotosAlbum({
  4409 + filePath: saveUrl,
  4410 + success: (res) => {
  4411 + wx.showToast({
  4412 + title: '保存成功',
  4413 + duration: 1000,
  4414 + });
  4415 + self.setData({
  4416 + showPlaybill: 'true'
  4417 + });
  4418 + resolve();
  4419 + },
  4420 + fail: () => {
  4421 + wx.showToast({
  4422 + title: '保存失败',
  4423 + duration: 1000,
  4424 + });
  4425 + }
  4426 + })
  4427 + })
  4428 + },
  4429 +
  4430 + // 预览海报
  4431 + previewPoster() {
  4432 + getApp().globalData.no_clear = 1;
  4433 + wx.previewImage({
  4434 + current: this.data.shareImgPath, // 当前显示图片的http链接
  4435 + urls: [this.data.shareImgPath], // 需要预览的图片http链接列表
  4436 + });
  4437 + },
  4438 +
4101 4439  
4102 4440 });
4103 4441  
... ...
packageA/pages/goodsInfo/goodsInfo.json
... ... @@ -6,7 +6,8 @@
6 6 "warn": "/components/long_warn/long_warn",
7 7 "serviceCard_recommend": "/components/serviceCard_list/serviceCard_list",
8 8 "privacy_pop": "/components/privacy_pop/privacy_pop",
9   - "top_nav": "/components/diy_top_nav/diy_top_nav"
  9 + "top_nav": "/components/diy_top_nav/diy_top_nav",
  10 + "share": "/components/share/share"
10 11 },
11 12 "navigationStyle": "custom"
12 13 }
13 14 \ No newline at end of file
... ...
packageA/pages/goodsInfo/goodsInfo.wxml
... ... @@ -11,7 +11,7 @@
11 11 <view class="container">
12 12  
13 13 <view class="type-navbar_box">
14   - <top_nav id="my-nav" bindclickShare="clickShare" nav_type="{{nav_type}}" is_share="{{false}}"
  14 + <top_nav id="my-nav" bindclickShare="clickShare" nav_type="{{nav_type}}" is_share="{{true}}"
15 15 nav_frontColor="{{nav_frontColor}}" istop="{{(istop && searchbox_transparent && activeCategoryId==0) ? 1 : 0 }}" nav_backgroundColor="{{nav_backgroundColor}}" nav_title="{{gtitle}}"></top_nav>
16 16 </view>
17 17  
... ... @@ -106,16 +106,25 @@
106 106 <view class="market-price" style="overflow: hidden"></view>
107 107 </view>
108 108  
109   - <view>
110   - <!-- 秒杀价 -->
111   - <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view>
112   - <!-- 手店价 -->
113   - <view class="co-red" wx:else><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view>
114   - <!-- <view class="word-line fs20 xc-qtunit-price">
115   - 零售价¥{{filters.toFix(data.market_price,2)}}
116   - </view> -->
117   - <view class="goods-title">
118   - <view class="goods-name elli">{{data.goods_name}}</view>
  109 +
  110 + <view class="flex jc_sb">
  111 + <view>
  112 + <!-- 秒杀价 -->
  113 + <view class="co-red" wx:if="{{options.prom_type == 1}}"><text class="rel yuan fs28">¥</text>{{filters.toFix(prom_price,2)}}</view>
  114 + <!-- 手店价 -->
  115 + <view class="co-red" wx:else><text class="rel yuan fs28">¥</text>{{filters.toFix(data.shop_price,2)}}</view>
  116 + <!-- <view class="word-line fs20 xc-qtunit-price">
  117 + 零售价¥{{filters.toFix(data.market_price,2)}}
  118 + </view> -->
  119 + <view class="goods-title">
  120 + <view class="goods-name elli">{{data.goods_name}}</view>
  121 + </view>
  122 + </view>
  123 +
  124 + <!-- 这个是分享按钮 -->
  125 + <view wx:if="{{isLogin}}" class="xc-share-frame t-c shrink0" bindtap="clickShare">
  126 + <view class="iconfont icon-share"></view>
  127 + <view class="fs22 c-7b">分享</view>
119 128 </view>
120 129 </view>
121 130  
... ... @@ -970,14 +979,20 @@
970 979 <canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if='{{!canvasHidden}}'></canvas>
971 980 <warn id="warn"></warn>
972 981  
973   -
974 982 <view wx:if="{{showPoster}}">
975 983 <view class="mask" catchtap="closePoster"></view>
976 984 <view class="poster-container">
977 985 <view class="poster-wrapper">
978   - <view class="poster">
  986 + <view class="poster" bindtap="previewPoster">
  987 + <!-- <view class="poster" bindtap="previewImage"> -->
979 988 <image src="{{shareImgPath}}" class="poster-img" show-menu-by-longpress></image>
980   - <view class="btn-close" catchtap="closePoster"><text class="iconfont icon-close"></text></view>
  989 + <view class="btn-close" catchtap="closePoster">
  990 + <text class="iconfont icon-close"></text>
  991 + </view>
  992 + </view>
  993 + <view class="btn-container">
  994 + <!-- <button class="btn-share" open-type="share" bindtap="">微信好友分享</button> -->
  995 + <button class="btn-share" bindtap="savePic">保存到相册</button>
981 996 </view>
982 997 </view>
983 998 </view>
... ... @@ -1015,3 +1030,5 @@
1015 1030 </view>
1016 1031  
1017 1032 <view class="mask2" bindtap="closeCS"></view>
  1033 +<!-- 分享控件,底部弹出 -->
  1034 +<share id="share_button" bind:send="send" bind:cancel="cancel" bind:share_img="saveImageFn" wx:if="{{share_hidden}}"></share>
... ...
packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.js
... ... @@ -12,6 +12,7 @@ var more = function (e) {
12 12 }(require("../../../../utils/LoadMore.js")),
13 13 n = new more.default();
14 14 var regeneratorRuntime = require('../../../../utils/runtime.js');
  15 +var self=null;
15 16  
16 17 Page({
17 18 data: {
... ... @@ -1256,6 +1257,8 @@ Page({
1256 1257 })
1257 1258 }
1258 1259  
  1260 + this.data.get_sto_ing=1;
  1261 +
1259 1262 var timer_get = setInterval(function () {
1260 1263 if (th.data.is_get_local_ok == 0) return false;
1261 1264 if (!th.data.fir_def_store) return false;
... ... @@ -1374,13 +1377,19 @@ Page({
1374 1377 th.setData({all_pick_list: e.data.data.pageData});
1375 1378 th.deal_pickup(e);
1376 1379 }else{
  1380 + th.data.get_sto_ing=0;
1377 1381 th.setData({all_pick_list: null, only_pk:null,def_pickpu_list:null });
1378   -
1379 1382 wx.hideLoading();
1380 1383 }
1381 1384 }, 800)
1382 1385  
1383 1386 }
  1387 + else{
  1388 + th.data.get_sto_ing=0;
  1389 + th.setData({all_pick_list: null, only_pk:null,def_pickpu_list:null });
  1390 +
  1391 + wx.hideLoading();
  1392 + }
1384 1393 })
1385 1394 }, 200)
1386 1395 },
... ... @@ -1554,9 +1563,11 @@ Page({
1554 1563 }
1555 1564  
1556 1565 }
  1566 + th.data.get_sto_ing=0;
1557 1567 }
1558 1568 });
1559 1569 } else {
  1570 + th.data.get_sto_ing=0;
1560 1571 th.setData({
1561 1572 is_show_sto_cat: 0,
1562 1573 only_pk: e.data.data.pageData
... ... @@ -1605,6 +1616,12 @@ Page({
1605 1616 // return false;
1606 1617 // }
1607 1618  
  1619 + if (this.data.share_hidden) {
  1620 + this.setData({
  1621 + share_hidden: false,
  1622 + });
  1623 + };
  1624 +
1608 1625 //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4积分购
1609 1626 var type = 2
1610 1627 if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3;
... ... @@ -3569,6 +3586,9 @@ Page({
3569 3586 });
3570 3587 },
3571 3588  
  3589 + send() {
  3590 + this.setData({ share_hidden: false, });
  3591 + },
3572 3592 cancel() {
3573 3593 this.setData({
3574 3594 share_hidden: false,
... ... @@ -3965,6 +3985,15 @@ Page({
3965 3985 }
3966 3986 },
3967 3987  
  3988 + // 预览海报
  3989 + previewPoster() {
  3990 + getApp().globalData.no_clear = 1;
  3991 + wx.previewImage({
  3992 + current: this.data.shareImgPath, // 当前显示图片的http链接
  3993 + urls: [this.data.shareImgPath], // 需要预览的图片http链接列表
  3994 + });
  3995 + },
  3996 +
3968 3997 });
3969 3998  
3970 3999  
... ...
packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxml
... ... @@ -807,14 +807,20 @@
807 807 <canvas canvas-id='share' style='width:750rpx;height:1217rpx;background-color:white;' wx:if='{{!canvasHidden}}'></canvas>
808 808 <warn id="warn"></warn>
809 809  
810   -
811 810 <view wx:if="{{showPoster}}">
812 811 <view class="mask" catchtap="closePoster"></view>
813 812 <view class="poster-container">
814 813 <view class="poster-wrapper">
815   - <view class="poster">
  814 + <view class="poster" bindtap="previewPoster">
  815 + <!-- <view class="poster" bindtap="previewImage"> -->
816 816 <image src="{{shareImgPath}}" class="poster-img" show-menu-by-longpress></image>
817   - <view class="btn-close" catchtap="closePoster"><text class="iconfont icon-close"></text></view>
  817 + <view class="btn-close" catchtap="closePoster">
  818 + <text class="iconfont icon-close"></text>
  819 + </view>
  820 + </view>
  821 + <view class="btn-container">
  822 + <!-- <button class="btn-share" open-type="share" bindtap="">微信好友分享</button> -->
  823 + <button class="btn-share" bindtap="savePic">保存到相册</button>
818 824 </view>
819 825 </view>
820 826 </view>
... ...
packageA/pages/serviceCard_pd/goodsInfo/goodsInfo.wxss
... ... @@ -2744,7 +2744,7 @@ button.custom-service::after{
2744 2744 left: 50%;
2745 2745 transform: translate(-50%, -50%);
2746 2746 width: calc(100% - 120rpx);
2747   - z-index: 1000;
  2747 + z-index: 10001;
2748 2748 }
2749 2749 .mask {
2750 2750 position: fixed;
... ... @@ -2752,7 +2752,7 @@ button.custom-service::after{
2752 2752 left: 0;
2753 2753 width: 100%;
2754 2754 height: 100%;
2755   - z-index: 999;
  2755 + z-index: 10000;
2756 2756 background-color: rgba(0,0,0,.4);
2757 2757 }
2758 2758 .poster-wrapper {
... ...
packageA/pages/serviceCard_pd/team_success/team_success.js
... ... @@ -823,7 +823,7 @@ Page({
823 823 tt(func);;
824 824 },
825 825 fail: function (res) {
826   - ee.data.share_head = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
  826 + ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
827 827 tt(func);
828 828 }
829 829 });
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... ... @@ -3129,6 +3129,7 @@ Page({
3129 3129  
3130 3130 //---------拿出门店分类和门店------------
3131 3131 get_sto(e,func) {
  3132 +
3132 3133 var th = this, that = this;
3133 3134 var is_normal = e;
3134 3135  
... ... @@ -3137,12 +3138,13 @@ Page({
3137 3138 } else {
3138 3139 th.setData({ is_normal: 0 })
3139 3140 }
  3141 + th.data.get_sto_ing=1;
3140 3142  
3141 3143 var timer_get = setInterval(function () {
3142 3144 if (th.data.is_get_local_ok == 0) return false;
3143 3145 if (!th.data.fir_def_store) return false;
3144 3146 var dd = null, i = getApp().request;
3145   - if (!th.data.sele_g) return false;
  3147 + if (!th.data.sele_g){th.data.get_sto_ing=0; return false;}
3146 3148  
3147 3149 var g_distr_type = th.data.sele_g.distr_type;
3148 3150 if (g_distr_type != 0) {
... ... @@ -3277,6 +3279,7 @@ Page({
3277 3279  
3278 3280 }
3279 3281 },err=>{
  3282 + th.data.get_sto_ing=0;
3280 3283 ut.m_toast('网络繁忙,请稍后重试');
3281 3284 wx.hideLoading();
3282 3285 })
... ... @@ -3403,12 +3406,15 @@ Page({
3403 3406 front_is_show_sto_cat:th.data.is_show_sto_cat,
3404 3407 })
3405 3408 }
  3409 +
  3410 + this.data.get_sto_ing=0;
  3411 +
3406 3412 },
3407 3413  
3408 3414 //------------处理门店---------------
3409 3415 deal_pickup(e) {
3410 3416 var th = this;
3411   - if (!th.data.sele_g) return false
  3417 + if (!th.data.sele_g){th.data.get_sto_ing=0;return false}
3412 3418  
3413 3419 var g_distr_type = th.data.sele_g.distr_type;
3414 3420 wx.hideLoading();
... ... @@ -3580,7 +3586,7 @@ Page({
3580 3586 //------------处理线下门店库存--------
3581 3587 deal_pickup_dline(e) {
3582 3588 var pkno = [], th = this;
3583   - if (!th.data.sele_g) return false;
  3589 + if (!th.data.sele_g){th.data.get_sto_ing=0;return false;}
3584 3590  
3585 3591 if (this.data.def_pick_store) {
3586 3592 pkno.push(this.data.def_pick_store.pickup_no);
... ... @@ -3673,6 +3679,7 @@ Page({
3673 3679  
3674 3680  
3675 3681 } else {
  3682 + th.data.get_sto_ing=0;
3676 3683 th.setData({
3677 3684 all_sto: null,
3678 3685 only_pk: null,
... ... @@ -3739,9 +3746,11 @@ Page({
3739 3746 //---把数组组装进去---
3740 3747 th.deal_pickup(em);
3741 3748 } else {
  3749 + th.data.get_sto_ing=0;
3742 3750 th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null })
3743 3751 }
3744 3752 } else {
  3753 + th.data.get_sto_ing=0;
3745 3754 th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null })
3746 3755 }
3747 3756 })
... ... @@ -4504,6 +4513,7 @@ Page({
4504 4513 // ind == 1 为普通购买
4505 4514 openSpecModel_pt: function (e) {
4506 4515  
  4516 + if(this.data.get_sto_ing) return false;
4507 4517 this.setData({ open_ind_store: 9 });
4508 4518 // 判断是否有待支付订单
4509 4519 var aid = this.data.group_id;
... ...
packageC/pages/presell/cardInfo/goodsInfo.js
... ... @@ -1186,6 +1186,9 @@ Page({
1186 1186 },
1187 1187  
1188 1188 openSpecModel: function(t) {
  1189 +
  1190 + if(this.data.get_sto_ing) return false;
  1191 +
1189 1192 var th=this; var open_store = t.currentTarget.dataset.ind;
1190 1193 if(getApp().is_sp_hao() && open_store==1){
1191 1194 wx.showToast({
... ... @@ -1443,6 +1446,8 @@ Page({
1443 1446 })
1444 1447 }
1445 1448  
  1449 + this.data.get_sto_ing=1;
  1450 +
1446 1451 var timer_get = setInterval(function() {
1447 1452 if (th.data.is_get_local_ok == 0) return false;
1448 1453 if (!th.data.fir_def_store) return false;
... ... @@ -1557,6 +1562,9 @@ Page({
1557 1562 th.deal_pickup(e);
1558 1563 }
1559 1564 else{
  1565 +
  1566 + th.data.get_sto_ing=0;
  1567 +
1560 1568 th.setData({
1561 1569 isshow:1
1562 1570 })
... ... @@ -1835,11 +1843,14 @@ Page({
1835 1843 if (!th.data.def_pick_store) {
1836 1844 th.setData({def_pick_store:e.data.data.pageData[0]})
1837 1845 }
1838   -
1839 1846 }
  1847 +
  1848 + th.data.get_sto_ing=0;
1840 1849 }
1841 1850 });
1842   - } else {
  1851 + } else {
  1852 +
  1853 + th.data.get_sto_ing=0;
1843 1854 th.setData({
1844 1855 is_show_sto_cat: 0,
1845 1856 only_pk: e.data.data.pageData
... ... @@ -1991,8 +2002,8 @@ Page({
1991 2002 return false;
1992 2003 }
1993 2004  
1994   - var img=ee.data.iurl+ee.data.data.img_url;
1995   - if(ee.data.prom_act){
  2005 + var img=ee.data.iurl+ee.data.data.image_url;
  2006 + if(ee.data.prom_act && ee.data.prom_act.share_img){
1996 2007 img=ee.data.iurl+ee.data.prom_act.share_img;
1997 2008 }
1998 2009  
... ... @@ -4062,7 +4073,14 @@ Page({
4062 4073 })
4063 4074 },
4064 4075  
4065   -
  4076 + // 预览海报
  4077 + previewPoster() {
  4078 + getApp().globalData.no_clear = 1;
  4079 + wx.previewImage({
  4080 + current: this.data.shareImgPath, // 当前显示图片的http链接
  4081 + urls: [this.data.shareImgPath], // 需要预览的图片http链接列表
  4082 + });
  4083 + },
4066 4084  
4067 4085  
4068 4086  
... ...
packageC/pages/presell/cardInfo/goodsInfo.wxml
... ... @@ -990,6 +990,7 @@
990 990 <warn id="warn"></warn>
991 991 <!-- 分享控件,底部弹出 -->
992 992 <share id="share_button" bind:send="send" bind:cancel="cancel" bind:share_img="saveImageFn" wx:if="{{share_hidden}}"></share>
  993 +
993 994 <view wx:if="{{showPoster}}">
994 995 <view class="mask" catchtap="closePoster"></view>
995 996 <view class="poster-container">
... ...
packageC/pages/presell/goodsInfo/goodsInfo.js
... ... @@ -1439,6 +1439,9 @@ Page({
1439 1439 },
1440 1440  
1441 1441 openSpecModel: function (t) {
  1442 +
  1443 + if(this.data.get_sto_ing) return false;
  1444 +
1442 1445 var th = this;
1443 1446 var open_store = t.currentTarget.dataset.ind;
1444 1447 this.setData({
... ... @@ -1993,6 +1996,9 @@ Page({
1993 1996  
1994 1997 //---------拿出门店分类和门店------------
1995 1998 get_sto(e) {
  1999 +
  2000 + this.data.get_sto_ing=1;
  2001 +
1996 2002 var th = this, is_normal = e;
1997 2003 var that=th;
1998 2004  
... ... @@ -2007,7 +2013,7 @@ Page({
2007 2013 if (!th.data.fir_def_store) return false;
2008 2014  
2009 2015 var dd = null, i = getApp().request;
2010   - if (!th.data.sele_g) return false;
  2016 + if (!th.data.sele_g) {th.data.get_sto_ing=0; return false;}
2011 2017  
2012 2018 var g_distr_type = th.data.sele_g.distr_type;
2013 2019 if (g_distr_type != 0) {
... ... @@ -2149,10 +2155,12 @@ Page({
2149 2155 }
2150 2156 }
2151 2157 else{
  2158 + th.data.get_sto_ing=0;
2152 2159 wx.hideLoading();
2153 2160 }
2154 2161 }
2155 2162 else{
  2163 + th.data.get_sto_ing=0;
2156 2164 wx.hideLoading();
2157 2165 }
2158 2166 })
... ... @@ -2263,7 +2271,7 @@ Page({
2263 2271 //------------处理门店---------------
2264 2272 deal_pickup(e) {
2265 2273 var th = this;
2266   - if (!th.data.sele_g) return false
  2274 + if (!th.data.sele_g) { th.data.get_sto_ing=0; return false }
2267 2275  
2268 2276 var g_distr_type = th.data.sele_g.distr_type;
2269 2277 wx.hideLoading();
... ... @@ -2419,6 +2427,9 @@ Page({
2419 2427 th.setData({ def_pick_store: e.data.data.pageData[0] })
2420 2428 }
2421 2429 }
  2430 +
  2431 + th.data.get_sto_ing=0;
  2432 +
2422 2433 } else {
2423 2434 th.setData({
2424 2435 is_show_sto_cat: -1,
... ... @@ -2429,10 +2440,12 @@ Page({
2429 2440 th.setData({ def_pick_store: e.data.data.pageData[0] })
2430 2441 }
2431 2442  
  2443 + th.data.get_sto_ing=0;
2432 2444 }
2433 2445 }
2434 2446 });
2435 2447 } else {
  2448 + th.data.get_sto_ing=0;
2436 2449 th.setData({
2437 2450 is_show_sto_cat: 0,
2438 2451 only_pk: e.data.data.pageData
... ... @@ -2453,7 +2466,7 @@ Page({
2453 2466 deal_pickup_dline(e) {
2454 2467 var pkno = [],
2455 2468 th = this;
2456   - if (!th.data.sele_g) return false;
  2469 + if (!th.data.sele_g){ th.data.get_sto_ing=0; return false;}
2457 2470  
2458 2471 if (this.data.def_pick_store) {
2459 2472 pkno.push(this.data.def_pick_store.pickup_no);
... ... @@ -2539,6 +2552,7 @@ Page({
2539 2552 }
2540 2553  
2541 2554 } else {
  2555 + th.data.get_sto_ing=0;
2542 2556 th.setData({
2543 2557 all_sto: null,
2544 2558 only_pk: null,
... ... @@ -2613,6 +2627,7 @@ Page({
2613 2627 th.deal_pickup(em);
2614 2628  
2615 2629 } else {
  2630 + th.data.get_sto_ing=0;
2616 2631 th.setData({
2617 2632 all_sto: null,
2618 2633 only_pk: null,
... ... @@ -2621,6 +2636,7 @@ Page({
2621 2636 }
2622 2637  
2623 2638 } else {
  2639 + th.data.get_sto_ing=0;
2624 2640 th.setData({
2625 2641 all_sto: null,
2626 2642 only_pk: null,
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -2761,6 +2761,8 @@ Page({
2761 2761 },
2762 2762  
2763 2763 openSpecModel: function (t) {
  2764 +
  2765 + if(this.data.get_sto_ing) return false;
2764 2766  
2765 2767 var th = this;
2766 2768 var open_store = t.currentTarget.dataset.ind;
... ... @@ -3748,6 +3750,7 @@ Page({
3748 3750 sp_seleing:0
3749 3751 })
3750 3752  
  3753 +
3751 3754 },
3752 3755  
3753 3756  
... ... @@ -3758,6 +3761,8 @@ Page({
3758 3761 that = this;
3759 3762 var is_normal = e;
3760 3763  
  3764 + th.data.get_sto_ing=1;
  3765 +
3761 3766 if (e == 1) {
3762 3767 th.setData({
3763 3768 is_normal: 1
... ... @@ -3772,9 +3777,10 @@ Page({
3772 3777 if (th.data.is_get_local_ok == 0) return false;
3773 3778 if (!th.data.fir_def_store) return false;
3774 3779  
  3780 +
3775 3781 var dd = null,
3776 3782 i = getApp().request;
3777   - if (!th.data.sele_g) return false;
  3783 + if (!th.data.sele_g) {th.data.get_sto_ing=0; return false; }
3778 3784  
3779 3785 var g_distr_type = th.data.sele_g.distr_type;
3780 3786 if (g_distr_type != 0) {
... ... @@ -3959,12 +3965,14 @@ Page({
3959 3965 th.setData({sp_seleing:0})
3960 3966 wx.hideLoading();
3961 3967 th.data.fir_set_sto=0;
  3968 + th.data.get_sto_ing=0;
3962 3969 }
3963 3970 } else {
3964 3971 if(func) func();
3965 3972 th.setData({sp_seleing:0})
3966 3973 wx.hideLoading();
3967 3974 th.data.fir_set_sto=0;
  3975 + th.data.get_sto_ing=0;
3968 3976 }
3969 3977 },err=>{
3970 3978 ut.m_toast('网络繁忙,请稍后重试');
... ... @@ -3972,6 +3980,7 @@ Page({
3972 3980 th.setData({sp_seleing:0})
3973 3981 wx.hideLoading();
3974 3982 th.data.fir_set_sto=0;
  3983 + th.data.get_sto_ing=0;
3975 3984 })
3976 3985 }, 200)
3977 3986  
... ... @@ -4105,6 +4114,7 @@ Page({
4105 4114 var th = this;
4106 4115 if (!th.data.sele_g){
4107 4116 wx.hideLoading();
  4117 + th.data.get_sto_ing=0;
4108 4118 return false
4109 4119 }
4110 4120  
... ... @@ -4337,6 +4347,8 @@ Page({
4337 4347 th.deal_front_pk();
4338 4348 }
4339 4349  
  4350 + th.data.get_sto_ing=0;
  4351 +
4340 4352 },
4341 4353  
4342 4354 //------------处理线下门店库存--------
... ... @@ -4443,6 +4455,7 @@ Page({
4443 4455  
4444 4456  
4445 4457 } else {
  4458 + th.data.get_sto_ing=0;
4446 4459 th.data.fir_set_sto=0;
4447 4460 th.setData({
4448 4461 all_sto: null,
... ... @@ -4542,6 +4555,7 @@ Page({
4542 4555  
4543 4556 } else {
4544 4557  
  4558 + th.data.get_sto_ing=0;
4545 4559 th.data.fir_set_sto=0;
4546 4560 th.setData({
4547 4561 all_sto: null,
... ... @@ -4552,6 +4566,7 @@ Page({
4552 4566  
4553 4567 } else {
4554 4568  
  4569 + th.data.get_sto_ing=0;
4555 4570 th.data.fir_set_sto=0;
4556 4571 th.setData({
4557 4572 all_sto: null,
... ... @@ -5488,6 +5503,8 @@ Page({
5488 5503 //--点击弹起拼单--
5489 5504 openSpecModel_pt:function (e) {
5490 5505  
  5506 + if(this.data.get_sto_ing) return false;
  5507 +
5491 5508 this.setData({
5492 5509 open_ind_store: 4,
5493 5510 goodsInputNum: 1
... ... @@ -6842,8 +6859,17 @@ Page({
6842 6859 // context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 816 * unit);
6843 6860 // context.setFontSize(18 * unit)
6844 6861 // context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 850 * unit);
6845   - //---二维吗图---
6846   - context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit);
  6862 +
  6863 + if (th.data.share_b_img || th.data.poster) {
  6864 + var erm_x = parseFloat(th.data.poster.ewm_x) * 2;
  6865 + var erm_y = parseFloat(th.data.poster.ewm_y) * 2;
  6866 + context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
  6867 + }else{
  6868 + //---二维吗图---
  6869 + context.drawImage(vpath, 380 * unit, 736 * unit, 120 * unit, 120 * unit);
  6870 + }
  6871 +
  6872 +
6847 6873 break; //普通商品的展示
6848 6874 case 4:
6849 6875  
... ... @@ -8559,7 +8585,8 @@ Page({
8559 8585  
8560 8586 //-- 积分购购买弹出框 --
8561 8587 go_pay_integral: function () {
8562   -
  8588 +
  8589 + if(this.data.get_sto_ing) return false;
8563 8590 //-- 在打开弹出框的时候,front_pk门店要赋值 --
8564 8591 this.setData({def_pick_store: ut.deep_cp(this.data.front_pick)});
8565 8592  
... ... @@ -8574,6 +8601,7 @@ Page({
8574 8601 //-- 积分购普通购买弹出框 --
8575 8602 go_pay_integral_normal:async function () {
8576 8603  
  8604 + if(this.data.get_sto_ing) return false;
8577 8605 this.data.g_buy_num = new Map();
8578 8606 var th = this;
8579 8607  
... ... @@ -9148,6 +9176,9 @@ Page({
9148 9176  
9149 9177 //-- 秒杀的普通购买 --
9150 9178 openSpecModel_Nor: function () {
  9179 +
  9180 + if(this.data.get_sto_ing) return false;
  9181 +
9151 9182 this.data.g_buy_num = new Map();
9152 9183 var th = this;
9153 9184  
... ...
pages/user/index/iconfont.ttf 0 → 100644
No preview for this file type
pages/user/index/index.js
... ... @@ -55,8 +55,8 @@ Page({
55 55 showvipcode:false,
56 56 pshow:0,
57 57  
58   -
59 58 is_show_yq:0, //是不是要显示邀请
  59 + show_erm_u:1,//弹出框显示会员二维码
60 60 },
61 61 goto_nav: function (e) {
62 62 var th = this;
... ... @@ -1244,6 +1244,38 @@ Page({
1244 1244 })
1245 1245 },
1246 1246  
  1247 + hide_u_ewm(){
  1248 + this.setData({show_erm_u:0})
  1249 + },
  1250 + show_u_ewm(){
  1251 + var th=this;
  1252 +
  1253 + var getnowtime;
  1254 + rq.get("/api/weshop/users/getServerTime", {
  1255 + success: function (res) {
  1256 + if (res.data.code == 0)
  1257 + {
  1258 + th.setData({show_erm_u:1})
  1259 + getnowtime=res.data.data;
  1260 + if (!getnowtime)
  1261 + {
  1262 + getApp().showWarning("获取服务时间失败");
  1263 + return;
  1264 + }
  1265 + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s')
  1266 + var val = th.data.userInfo.mobile + "|" +getnowtime+"|"+th.data.getusercode_vailtime;
  1267 + val = "^" + ut.base64_encode(val);
  1268 +
  1269 + qrcode('qrcode', val, 350, 350, th);
  1270 +
  1271 +
  1272 + }
  1273 + }
  1274 + })
  1275 +
  1276 +
  1277 + }
  1278 +
1247 1279  
1248 1280  
1249 1281  
... ...
pages/user/index/index.wxml
... ... @@ -435,7 +435,7 @@
435 435 <!--弹出层内容,其中的“我知道”中绑定让弹出层消失的函数:bindtap="hide"-->
436 436 <view class="tc_view" hidden='{{tc_hide}}' bindtap='hide_tc'>
437 437 <view class="modal-box" hidden="{{flag}}" bindtap="hide" catchtouchmove="true"></view>
438   - <view class="modal-body" catchtouchmove="true">
  438 + <view class="modal-body {{show_erm_u?'':'low'}} " catchtouchmove="true">
439 439 <view class="modal-content">
440 440 <view class="flex">
441 441 <image src="{{userInfo.head_pic}}" class="hd_img"></image>
... ... @@ -448,11 +448,24 @@
448 448 </view>
449 449 </view>
450 450  
451   - <view class="canvas_box">
452   - <!--<image class='g_img' src='https://mshop.yolipai.net//index.php?m=Home&c=Index&a=qr_code&data={{userInfo.mobile}}'></image>-->
453   - <canvas class="g_img" canvas-id="qrcode" />
  451 +
  452 + <block wx:if="{{show_erm_u}}">
  453 + <view class="canvas_box">
  454 + <!--<image class='g_img' src='https://mshop.yolipai.net//index.php?m=Home&c=Index&a=qr_code&data={{userInfo.mobile}}'></image>-->
  455 + <canvas class="g_img" canvas-id="qrcode" />
  456 + </view>
  457 + </block>
  458 +
  459 + <view style=" position: relative;top: -25rpx;">
  460 + <view wx:if="{{show_erm_u}}" catchtap="hide_u_ewm" class="fs24 flex ai-center jc-center" style="width: 100%;color: #898989;line-height: normal; ">
  461 + 点击隐藏<text class="icon_yan icon-yanjing_yincang_o fs36"></text>
  462 + </view>
  463 + <view wx:else catchtap="show_u_ewm" class="fs24 flex ai-center jc-center" style="width: 100%;color: #898989; line-height: normal; ">
  464 + 点击显示<text class="icon_yan icon-yanjing_xianshi_o fs36"></text>
  465 + </view>
454 466 </view>
455   - <view style="width: 100%;display: flex;justify-content: center;">
  467 +
  468 + <view style="width: 100%;display: flex;justify-content: center; margin-top: 8rpx;" >
456 469 <canvas class="barcode" style="width: 100%;height: 140rpx;" canvas-id="barcode" />
457 470 </view>
458 471 <view wx:if="{{showvipcode}}" class="fs24" style="width: 100%;color: #898989;display: flex;text-align: center;align-content: center;justify-content: center;">
... ...
pages/user/index/index.wxss
... ... @@ -553,11 +553,15 @@
553 553 background: #fff;
554 554 /* margin-left: 73rpx; */
555 555 width: 600rpx;
556   - height: 860rpx;
  556 + height:860rpx;
557 557 border-radius: 8px;
558 558 text-align: center;
559 559 }
560 560  
  561 +.modal-body.low{
  562 + height:600rpx;
  563 +}
  564 +
561 565 .modal-content {
562 566 width: 480rpx;
563 567 margin: 0 auto;
... ... @@ -784,4 +788,31 @@ button::after {
784 788 align-items: center;
785 789 justify-content: center;
786 790 /* margin-top: 20rpx; */
787   -}
788 791 \ No newline at end of file
  792 +
  793 + position: relative;top: -10rpx;
  794 +}
  795 +
  796 +
  797 +@font-face {
  798 + font-family: "iconfont_yan"; /* Project id 4449681 */
  799 + src: url('data:font/woff2;charset=utf-8;base64,d09GMgABAAAAAANUAA0AAAAAB4wAAAL+AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGh4GYACCQhEICoJYgj4LDAABNgIkAxIEIAWFAgdQG38GyB6D424J0UpZYooBbRj+ksfDf2P97pt5s18lmcPpoknEknhJRJJ5pURKIorVLWF/8k/fFWKMLamk8Er8bJV3au6kCdLWTXPif+CcvCJMnkvmj2+Pokq7RgIdD3bMoCih64UOehC/MH1w3m4lM1lHIeC3CUcLwH9TUgD/bIRhzAJFqFJIFGSKFxrlWTkCnoP3R5ck+ilaxf8Lz7n74WWw/X30fWxI9AjqTwQCAEsQKirmILCfocAcI0tASkH3WE/3SD+9CxAQHQIQBQUAEMBLRU8BDQxiAE+AD4AEQGpDQwMj4w6OJvmk9yrt+rrvNvPmJqv3JuP2duA6/eoqo+9Sd9F7Rpz7957s6vZO+453iO2j0sBry1DODK6/bEGwYWlbwmG/ecakRRqB5EzuBJv6Helicpa7BMFXsZi/MnMbSSSVsstk+rTWrapglURr5h8V13LVe9MVDdOw6QQHe5ap9hFwBoc24h7lPhIFJ8Kprw4RzjHxR6kjcb74uSognogKm96bbHx6O0waqOCSev149g6kTa8g318RrJLE/eyNP9e5UO2pVq2z/mzCprlPUQ0fd1PCw6iGPxffn/XzAAJBefP7qdDW779/KHWS7dIRdaWsoF8BQcOOvZUAPqXcb4ZMQCK5LB1Cc4gxKBg0iB6ASS+AAFNYEAj9zkCg6PMAAlW/pwKkfl8EaIZ8E6Cj3w9AYNDO2A8IDJmKF6rIAWwAHQ3j/NBi1FW0GoeBRHrRZtYc2jFuHx10xde4IRvxEELVKlesXiOXISnRQlUohWlVtNWDA3t24GQH9hoQQnKeCxeUq9RArVgt+Jet2uDVQ9QrytWqo8glERMQgRVd/2KBKCpwdLBWudo6nlKnUSWJevUqkFSohWmQRCTxiXJqahhJtVqYUrlS9QTgMiCxrrFSUl9fsQZ0RWDtJG3iP4LdAA/Tp/nhZISEKlJ2C5TmacAC3aiIzI5x0hBaj0H8soZQokSdaCnWKhXaysJmRbG2rkpRiG1yi+ooLaZUDAAA') format('woff2'),
  800 + url('data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAU8AA0AAAAAB4wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAFIAAAABoAAAAcohRq60dERUYAAAUAAAAAHgAAAB4AKQALT1MvMgAAAaAAAABGAAAAYEIBTpxjbWFwAAAB/AAAAEIAAAFCAA/veGdhc3AAAAT4AAAACAAAAAj//wADZ2x5ZgAAAkwAAAEsAAABWH3W0xtoZWFkAAABMAAAADAAAAA2JyyEpGhoZWEAAAFgAAAAHQAAACQHiQOFaG10eAAAAegAAAARAAAAEgxVAFVsb2NhAAACQAAAAAwAAAAMAEgArG1heHAAAAGAAAAAHgAAACABFABLbmFtZQAAA3gAAAFGAAACgl6CAQJwb3N0AAAEwAAAADYAAABQUf1A0HjaY2BkYGAAYqEpty7E89t8ZeBmYQCBR+wKdnA6lKGBeTXTaiCXg4EJJAoAB0UIyXjaY2BkYGBu+N/AEMPCAALMqxkYGVABCwBTpwMXAAAAeNpjYGRgYGBlsAdiEGACYi4gZGD4D+YzAAAPawFgAAB42mNgYWFgnMDAysDA1Ml0hoGBoR9CM75mMGLkAIoysDIzYAUBaa4pDAden3l9lrnhfwMDA/MdBiDJwIikRIGBEQCTww4iAAB42mNhgAAWCA5lCAUAAe4AtwAAAHjaY2BgYGaAYBkGRgYQsAHyGMF8FgYFIM0ChED+67P//wPJM///i5hDVTIwsjHAmAyMTECCiQEVMDIMewAAJFcIcgAAAAAAAAAAAAAASACseNotjzFLw0AUx9/LpYlIrVTTZJFD72yCBDrcpQ1UTUuhtQbqIHR1cUpNwbnTiZP9IF3yEbr6Ady6+xmci3fQB++/vN+D3x9smIMilaXgGFpAIQZA5rgURS/tIGFhlOGlHzQwEr0kZI7nB6yDSYaCotdAC1bb0Wj7Z2K13uX5Dj2Tay7ERAh+3WesPzVhzYuyLMzuY3WYyjATER8QHVDTPp9kY1VwCleQQB8ygHbqS+0TRqkx4U5krKQI3DAKubb1gwEaopt0DdPSYtwgqee2A4xwxh5y7Tl9ocXT4279/DMeasU7yc7O6xf6IIff9MjnAgltslvefCMTqWvTPbAN94vlu6CDD6Wc12Sh1AkjiItyJpvUFrxecx0a3Oie9pcc2+T+V39R+AdnzksMeNp9kM1Kw0AUhc/0T21BxILrWRVBSH+WpbtC3blwUddtOklbkkyYTAtdunXlA7j1MXwAn0Fw5YN4Gq8IFZqQyzfn3nNmJgAu8QmFn6eNa2GFU9wJV3CCWLhK/VG4Rn4RrqOFN+EG9Q/hJm7USLiFtnpmgqqdcdUp0/ascIGRcAXneBCuUrfCNfKTcB1XeBVuUH8XbmKKL+EWOmqJMRwMZvCsC2jMsWNdIWRuhqisHhg7M/Nmoec7vQptFtmM4r+pv9Y942JskDDacWniTTJzRy1HWlOmORQc2bc0+gjQo2xcsbKZ7ge9o/Zb2rMy4vCeBbY85oCqp1Hzc7SnpInEGF4hIWvkZW9NJaQeMNZkxv3+lWIbD7yPdORsqifc1iSJ1bmzaxN6Di/LPXIM0eUbHaQH5eFTjnmfD7vdSAKC0Kb4Bg9qcIcAAHjaY2BigAAuMMnIgA5YwaJMjEyMzIKViXlZmXnp8RWZiXnFGZnx+XCRysy85EQgnQ8ACQsOVgAAAAAAAf//AAIAAQAAAAwAAAAWAAAAAgABAAMABAABAAQAAAACAAAAAHjaY2BgYGQAgntsWnkg+hG7gh2MBgAurwQMAAA=') format('woff'),
  801 + url('iconfont.ttf?999') format('truetype');
  802 +}
  803 +.icon_yan{
  804 + font-family: "iconfont_yan" !important;
  805 + font-style: normal;
  806 + -webkit-font-smoothing: antialiased;
  807 + -moz-osx-font-smoothing: grayscale;
  808 +}
  809 +.icon-yanjing_xianshi_o:before {
  810 + content: "\ebcc";
  811 +}
  812 +.icon-yanjing_yincang_o:before {
  813 + content: "\ebcd";
  814 +}
  815 +
  816 +.fs36{ font-size: 36rpx}
  817 +
  818 +
  819 +
... ...