Commit 19ea3ffd75e74c81ff48a701fd96b56baeaa7a28
Merge branch 'test' of http://git.vipzhuang.cn/wxd/MShopWeApp into qa
Showing
16 changed files
with
1064 additions
and
586 deletions
packageA/pages/cardList/cardList.wxml
@@ -58,9 +58,13 @@ | @@ -58,9 +58,13 @@ | ||
58 | 58 | ||
59 | <block wx:else> | 59 | <block wx:else> |
60 | <view class="page"> | 60 | <view class="page"> |
61 | - <swiper class="swiper" autoplay indicator-dots circular easing-function="easeOutCubic"> | ||
62 | - <swiper-item wx:for="{{banner}}"><image src="{{item.ad_code ? item.ad_code : (imghost + default_img)}}" class="swiper-img"/></swiper-item> | ||
63 | - </swiper> | 61 | + |
62 | + <block wx:if="{{banner && banner.length}}"> | ||
63 | + <swiper class="swiper" autoplay indicator-dots circular easing-function="easeOutCubic"> | ||
64 | + <swiper-item wx:for="{{banner}}"><image src="{{item.ad_code ? item.ad_code : (imghost + default_img)}}" class="swiper-img"/></swiper-item> | ||
65 | + </swiper> | ||
66 | + </block> | ||
67 | + | ||
64 | <scroll-view class="scroll-view" scroll-y> | 68 | <scroll-view class="scroll-view" scroll-y> |
65 | <view class="bg-white"> | 69 | <view class="bg-white"> |
66 | <view class="flex pd20" wx:for="{{list.pageData}}" bindtap="go_goods" data-gid="{{item.id}}"> | 70 | <view class="flex pd20" wx:for="{{list.pageData}}" bindtap="go_goods" data-gid="{{item.id}}"> |
packageA/pages/quan_pro/quan_pro.js
@@ -35,7 +35,12 @@ Page({ | @@ -35,7 +35,12 @@ Page({ | ||
35 | } | 35 | } |
36 | 36 | ||
37 | var id=t.id; | 37 | var id=t.id; |
38 | + //如果二维码分享过来的 | ||
39 | + if(!id){ | ||
40 | + id = decodeURIComponent(t.scene); | ||
41 | + } | ||
38 | this.data.id=id; | 42 | this.data.id=id; |
43 | + | ||
39 | var goods_list = this.selectComponent("#goods_list"); //组件的id | 44 | var goods_list = this.selectComponent("#goods_list"); //组件的id |
40 | goods_list.init(); | 45 | goods_list.init(); |
41 | setTimeout(function() { | 46 | setTimeout(function() { |
packageA/pages/quan_pro/quan_pro.wxml
@@ -79,7 +79,7 @@ | @@ -79,7 +79,7 @@ | ||
79 | <view class="up flex jc-center"> | 79 | <view class="up flex jc-center"> |
80 | <view class="t-c"> | 80 | <view class="t-c"> |
81 | <image src="{{iurl}}/miniapp/images/coupon_img/success.png"></image> | 81 | <image src="{{iurl}}/miniapp/images/coupon_img/success.png"></image> |
82 | - <view style="margin-top:32rpx;color:#4e220b" class="fs36 ellipsis-1">恭喜您获得【{{q_data.name}}】优惠券</view> | 82 | + <view class="q_title fs36">恭喜您获得【{{q_data.name}}】优惠券</view> |
83 | </view> | 83 | </view> |
84 | </view> | 84 | </view> |
85 | <view class="down co-w t-c fs35" bindtap="go_quan">查看我的优惠券</view> | 85 | <view class="down co-w t-c fs35" bindtap="go_quan">查看我的优惠券</view> |
packageA/pages/quan_pro/quan_pro.wxss
@@ -19,7 +19,7 @@ page{background-color: #f8f8f8;} | @@ -19,7 +19,7 @@ page{background-color: #f8f8f8;} | ||
19 | top:50%; margin-top: -150rpx;background-color: #fff; z-index: 999999; | 19 | top:50%; margin-top: -150rpx;background-color: #fff; z-index: 999999; |
20 | } | 20 | } |
21 | 21 | ||
22 | -.suc_content .up{ height:200rpx;} | 22 | +.suc_content .up{ min-height:200rpx;} |
23 | .suc_content .up image{ width: 280rpx; height: 220rpx; margin-top: -130rpx} | 23 | .suc_content .up image{ width: 280rpx; height: 220rpx; margin-top: -130rpx} |
24 | .suc_content .down{ background-color: #c4182e; height:106rpx; line-height: 106rpx; | 24 | .suc_content .down{ background-color: #c4182e; height:106rpx; line-height: 106rpx; |
25 | border-bottom-right-radius:25rpx; | 25 | border-bottom-right-radius:25rpx; |
@@ -29,3 +29,6 @@ page{background-color: #f8f8f8;} | @@ -29,3 +29,6 @@ page{background-color: #f8f8f8;} | ||
29 | .btn.gray{background-color: #dcdcdc; color: #adb3be;} | 29 | .btn.gray{background-color: #dcdcdc; color: #adb3be;} |
30 | .coupon_remark{padding: 30rpx 0 10rpx 0; box-sizing: border-box; overflow: hidden;} | 30 | .coupon_remark{padding: 30rpx 0 10rpx 0; box-sizing: border-box; overflow: hidden;} |
31 | 31 | ||
32 | +.q_title{ | ||
33 | + margin-top:30rpx;color:#4e220b; padding: 0 10rpx; padding-bottom: 10rpx; | ||
34 | +} | ||
32 | \ No newline at end of file | 35 | \ No newline at end of file |
packageC/pages/presell/cardInfo/goodsInfo.js
@@ -223,7 +223,8 @@ Page({ | @@ -223,7 +223,8 @@ Page({ | ||
223 | nav_backgroundColor: "#ffffff", | 223 | nav_backgroundColor: "#ffffff", |
224 | nav_type: 2, //导航类型 | 224 | nav_type: 2, //导航类型 |
225 | istop: 0, //是否置顶风格为1 | 225 | istop: 0, //是否置顶风格为1 |
226 | - searchbox_transparent: 1 | 226 | + searchbox_transparent: 1, |
227 | + prom_type: 8, | ||
227 | 228 | ||
228 | }, | 229 | }, |
229 | 230 | ||
@@ -250,25 +251,56 @@ Page({ | @@ -250,25 +251,56 @@ Page({ | ||
250 | //检查测肤 | 251 | //检查测肤 |
251 | getApp().check_skin_face(t,1,gid); | 252 | getApp().check_skin_face(t,1,gid); |
252 | 253 | ||
254 | + | ||
255 | + //-- 自定义海报 -- | ||
256 | + getApp().request.promiseGet("/api/weshop/goods/poster/page", { | ||
257 | + data: { store_id: os.stoid, type: 1, is_use: 1 } | ||
258 | + }).then(res => { | ||
259 | + if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData[0]) { | ||
260 | + | ||
261 | + var poster_data = res.data.data.pageData[0]; | ||
262 | + var json_str = poster_data.jsonStr; | ||
263 | + | ||
264 | + if (json_str) { | ||
265 | + var json_data = JSON.parse(json_str); | ||
266 | + if (json_data.bg_img) { | ||
267 | + | ||
268 | + //-- 把图片那到本地 -- | ||
269 | + wx.getImageInfo({ | ||
270 | + src: json_data.bg_img, | ||
271 | + success: function (res) { | ||
272 | + var path = res.path; | ||
273 | + th.setData({ share_b_img: path }) | ||
274 | + }, | ||
275 | + fail: function (res) { } | ||
276 | + }); | ||
277 | + } | ||
278 | + th.setData({ poster: json_data }) | ||
279 | + | ||
280 | + } | ||
281 | + } | ||
282 | + }) | ||
283 | + | ||
253 | //-- 设置顶部高度 -- | 284 | //-- 设置顶部高度 -- |
254 | let height= getApp().globalData.navBarHeight; | 285 | let height= getApp().globalData.navBarHeight; |
255 | ee.setData({ top_nav:height}); | 286 | ee.setData({ top_nav:height}); |
256 | 287 | ||
257 | - //---获取手机地址坐标-- | ||
258 | - //--如果tg_id是空的话,分享回来-- | ||
259 | - if (gid == undefined || gid == null || gid == "") { | ||
260 | - var gid_str = decodeURIComponent(t.scene); | ||
261 | - gid_str=gid_str.split("_"); | ||
262 | - gid=gid_str[0]; | ||
263 | - if(gid_str.length>1){ | ||
264 | - first_leader=gid_str[1]; | ||
265 | - } | ||
266 | - //-- 如果有room_id的获取 -- | ||
267 | - if(gid_str.length>2 && gid_str[2]) { | ||
268 | - room_id=gid_str[2]; | ||
269 | - room_user_share=1; | ||
270 | - }; | ||
271 | - }; | 288 | + |
289 | + //--如果tg_id是空的话,分享回来-- | ||
290 | + if (gid == undefined || gid == null || gid == "") { | ||
291 | + var gid_str = decodeURIComponent(t.scene); | ||
292 | + gid_str = gid_str.split("_"); | ||
293 | + gid = gid_str[0]; | ||
294 | + if (gid_str.length > 1) { | ||
295 | + pre_id = gid_str[1]; | ||
296 | + first_leader = gid_str[2]; | ||
297 | + } | ||
298 | + //-- 如果有room_id的获取 -- | ||
299 | + if (gid_str.length > 2 && gid_str[3]) { | ||
300 | + room_id = gid_str[3]; | ||
301 | + room_user_share = 1; | ||
302 | + } | ||
303 | + } | ||
272 | 304 | ||
273 | ee.setData({ gid: gid, pre_id: pre_id, presell_id: presell_id}); | 305 | ee.setData({ gid: gid, pre_id: pre_id, presell_id: presell_id}); |
274 | 306 | ||
@@ -582,7 +614,7 @@ Page({ | @@ -582,7 +614,7 @@ Page({ | ||
582 | privacy_pop.check_pri_show(); | 614 | privacy_pop.check_pri_show(); |
583 | } | 615 | } |
584 | 616 | ||
585 | - getApp().check_can_share(); | 617 | + getApp().check_can_share(this); |
586 | 618 | ||
587 | var that=this;var th=this; | 619 | var that=this;var th=this; |
588 | var ee = this,gid = this.data.gid, i = getApp().request; | 620 | var ee = this,gid = this.data.gid, i = getApp().request; |
@@ -1845,466 +1877,6 @@ Page({ | @@ -1845,466 +1877,6 @@ Page({ | ||
1845 | return param < 10 ? '0' + param : param; | 1877 | return param < 10 ? '0' + param : param; |
1846 | }, | 1878 | }, |
1847 | 1879 | ||
1848 | - | ||
1849 | - //--定义的保存图片方法,分享团--- | ||
1850 | - saveImageToPhotosAlbum: function() { | ||
1851 | - //--先判断会员状态-- | ||
1852 | - var user_info = getApp().globalData.userInfo; | ||
1853 | - if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
1854 | - //getApp().my_warnning("请先登录",0,this); | ||
1855 | - wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
1856 | - return false; | ||
1857 | - } | ||
1858 | - | ||
1859 | - //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 | ||
1860 | - var type = this.data.prom_type; | ||
1861 | - if (type == 6) type = 2; | ||
1862 | - if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; | ||
1863 | - | ||
1864 | - wx.showLoading({ | ||
1865 | - title: '生成中...', | ||
1866 | - }) | ||
1867 | - var that = this, | ||
1868 | - th = that; | ||
1869 | - //设置画板显示,才能开始绘图 | ||
1870 | - that.setData({ | ||
1871 | - canvasHidden: false | ||
1872 | - }) | ||
1873 | - | ||
1874 | - var app = getApp(); | ||
1875 | - var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | ||
1876 | - var path2 = that.data.data.original_img; | ||
1877 | - var scene = th.data.gid+""; | ||
1878 | - var user_id = getApp().globalData.user_id?getApp().globalData.user_id:0; | ||
1879 | - if(user_id>0) { | ||
1880 | - scene+="_"+user_id; | ||
1881 | - } | ||
1882 | - //-- 如果不是会员分享过来的要分享给别人 -- | ||
1883 | - if(getApp().globalData.room_id && th.data.data.goods_id==getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) { | ||
1884 | - //固定房间是第3个字符 | ||
1885 | - if(!user_id) scene+="_0"; | ||
1886 | - scene+="_"+getApp().globalData.room_id ; | ||
1887 | - } | ||
1888 | - ///二微码 | ||
1889 | - var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
1890 | - os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo"; | ||
1891 | - | ||
1892 | - console.log(path3); | ||
1893 | - | ||
1894 | - //读取文件成功则OK-- | ||
1895 | - wx.getImageInfo({ | ||
1896 | - src: path3, | ||
1897 | - success: function(res) { | ||
1898 | - //回调写法 | ||
1899 | - th.get_head_temp(th.get_goods_temp, function() { | ||
1900 | - var vpath = res.path; | ||
1901 | - var context = wx.createCanvasContext('share'); | ||
1902 | - //先画背景 | ||
1903 | - var pg_path = "../../../images/share/share_bg.png"; | ||
1904 | - | ||
1905 | - // context.fillStyle="#FFFFFF"; | ||
1906 | - // context.fillRect(0,0,554 * unit, 899 * unit); | ||
1907 | - | ||
1908 | - //-- 如果有自定义海报的时候,判断背景的图片 -- | ||
1909 | - if(th.data.share_b_img){ | ||
1910 | - pg_path=th.data.share_b_img; | ||
1911 | - } | ||
1912 | - context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | ||
1913 | - | ||
1914 | - //-- 是自定义海报的情况下 -- | ||
1915 | - if(th.data.poster && parseInt(th.data.poster.style)==2) { | ||
1916 | - //在线上分享人的情况下 | ||
1917 | - if(parseInt(th.data.poster.show_headpic)){ | ||
1918 | - //获取坐标 | ||
1919 | - var x=parseFloat(th.data.poster.head_x)*2; | ||
1920 | - var y=parseFloat(th.data.poster.head_y)*2; | ||
1921 | - var x1=(x+90) *unit; | ||
1922 | - var y1=(y+50) *unit; | ||
1923 | - //--昵称--- | ||
1924 | - context.setFontSize(24 * unit) | ||
1925 | - context.setFillStyle("black") | ||
1926 | - context.fillText(app.globalData.userInfo.nickname, x1, y1); | ||
1927 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; | ||
1928 | - //强烈推荐 改许程 | ||
1929 | - var tj_path = "../../../images/share/q_tj.png"; | ||
1930 | - context.drawImage(tj_path, x1 + width, y1-22*unit, 85 * unit, 30 * unit); | ||
1931 | - context.setFontSize(16 * unit) | ||
1932 | - context.setLineJoin('round'); //交点设置成圆角 | ||
1933 | - context.setFillStyle("white") | ||
1934 | - context.fillText('强烈推荐', x1 + width+8*unit, y1-1*unit); | ||
1935 | - | ||
1936 | - //context.setFillStyle("black") | ||
1937 | - //context.setFontSize(24 * unit) | ||
1938 | - //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); | ||
1939 | - } | ||
1940 | - } else { | ||
1941 | - //--昵称--- | ||
1942 | - context.setFontSize(24 * unit) | ||
1943 | - context.setFillStyle("black") | ||
1944 | - context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); | ||
1945 | - var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | ||
1946 | - //强烈推荐 改许程 | ||
1947 | - var tj_path = "../../../images/share/q_tj.png"; | ||
1948 | - context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); | ||
1949 | - context.setFontSize(16 * unit); | ||
1950 | - context.setLineJoin('round'); //交点设置成圆角 | ||
1951 | - context.setFillStyle("white"); | ||
1952 | - context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); | ||
1953 | - } | ||
1954 | - | ||
1955 | - | ||
1956 | - //---产品名称--- | ||
1957 | - //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | ||
1958 | - if(type!=4){ | ||
1959 | - context.setFillStyle("black"); | ||
1960 | - context.setFontSize(21.3 * unit) | ||
1961 | - th.draw_Text(context, th.data.data.goods_name, | ||
1962 | - 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); | ||
1963 | - //------产品的价格------- | ||
1964 | - context.setFontSize(23 * unit) | ||
1965 | - context.setFillStyle("red") | ||
1966 | - context.fillText("¥", 416 * unit, 185 * unit); | ||
1967 | - context.setFontSize(31 * unit) | ||
1968 | - var pri0 = th.data.data.shop_price; | ||
1969 | - if (th.data.prom_act) | ||
1970 | - pri0 = th.data.prom_act.price; | ||
1971 | - pri0 = parseFloat(pri0).toFixed(2); | ||
1972 | - context.fillText(pri0, 438 * unit, 185 * unit); | ||
1973 | - //---市场价划掉--- | ||
1974 | - context.setFillStyle("gray") | ||
1975 | - context.setFontSize(22 * unit) | ||
1976 | - context.fillText("¥" + th.data.data.market_price, 426 * unit, 213 * unit); | ||
1977 | - context.setStrokeStyle('gray'); | ||
1978 | - context.setLineWidth(1 * unit); | ||
1979 | - context.moveTo(426 * unit, 206 * unit); | ||
1980 | - context.lineTo(510 * unit, 206 * unit); | ||
1981 | - context.stroke(); | ||
1982 | - | ||
1983 | - }else{ | ||
1984 | - context.setFillStyle("black"); | ||
1985 | - context.setFontSize(21.3 * unit) | ||
1986 | - th.draw_Text(context, th.data.data.goods_name, | ||
1987 | - 38 * unit, 170 * unit, 20 * unit, 300*unit, unit); | ||
1988 | - //------ 产品的价格 ----- | ||
1989 | - var pri0 = th.data.prom_act.addmoney; | ||
1990 | - var integral=th.data.prom_act.integral; | ||
1991 | - var text= ""; | ||
1992 | - if(integral){text=integral+"积分"; } | ||
1993 | - if(pri0 && integral){ text+="+";} | ||
1994 | - if(pri0){ text+="¥"+pri0;} | ||
1995 | - | ||
1996 | - if(!pri0 && !integral){ text="0积分";} | ||
1997 | - context.setFillStyle("red"); | ||
1998 | - context.fillText(text, 38 * unit, 235 * unit); | ||
1999 | - | ||
2000 | - } | ||
2001 | - | ||
2002 | - //---中间大图--- | ||
2003 | - context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); | ||
2004 | - //-------大图后面就不一样了----------- | ||
2005 | - switch (type) { | ||
2006 | - case 0: //普通商品的展示 | ||
2007 | - case 4: | ||
2008 | - //中间的几个字 | ||
2009 | - if(th.data.poster && parseInt(th.data.poster.style)==2 ){ | ||
2010 | - if(parseInt(th.data.poster.show_quality)){ | ||
2011 | - var g_path = "../../../images/share/s_gou.png"; | ||
2012 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
2013 | - context.setFillStyle("red") | ||
2014 | - context.setFontSize(18 * unit) | ||
2015 | - context.fillText("正品保证", 84 * unit, 690 * unit); | ||
2016 | - | ||
2017 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
2018 | - context.setFillStyle("red") | ||
2019 | - context.setFontSize(18 * unit) | ||
2020 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | ||
2021 | - | ||
2022 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
2023 | - context.setFillStyle("red") | ||
2024 | - context.setFontSize(18 * unit) | ||
2025 | - context.fillText("官方验证", 420 * unit, 690 * unit); | ||
2026 | - } | ||
2027 | - | ||
2028 | - }else{ | ||
2029 | - var g_path = "../../../images/share/s_gou.png"; | ||
2030 | - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
2031 | - context.setFillStyle("red") | ||
2032 | - context.setFontSize(18 * unit) | ||
2033 | - context.fillText("正品保证", 84 * unit, 690 * unit); | ||
2034 | - | ||
2035 | - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
2036 | - context.setFillStyle("red") | ||
2037 | - context.setFontSize(18 * unit) | ||
2038 | - context.fillText("纯实体店", 246 * unit, 690 * unit); | ||
2039 | - | ||
2040 | - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit); | ||
2041 | - context.setFillStyle("red") | ||
2042 | - context.setFontSize(18 * unit) | ||
2043 | - context.fillText("官方验证", 420 * unit, 690 * unit); | ||
2044 | - } | ||
2045 | - | ||
2046 | - | ||
2047 | - //---画线--- | ||
2048 | - context.setLineWidth(1 * unit) | ||
2049 | - context.moveTo(32 * unit, 710 * unit) | ||
2050 | - context.lineTo(520 * unit, 710 * unit) | ||
2051 | - context.stroke(); | ||
2052 | - | ||
2053 | - //---文字--- | ||
2054 | - context.setFillStyle("black") | ||
2055 | - context.setFontSize(22 * unit) | ||
2056 | - | ||
2057 | - if(type==0){ | ||
2058 | - // 原来start ---> | ||
2059 | - context.setFontSize(24 * unit) | ||
2060 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | ||
2061 | - | ||
2062 | - context.setFontSize(22 * unit) | ||
2063 | - context.fillText("优惠乐翻天,精彩就在你身边", 40 * unit, 806 * unit); | ||
2064 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 846 * unit); | ||
2065 | - | ||
2066 | - }else{ | ||
2067 | - context.setFontSize(24 * unit) | ||
2068 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); | ||
2069 | - context.setFontSize(22 * unit) | ||
2070 | - context.fillText("长按识别二维码", 40 * unit, 806 * unit); | ||
2071 | - context.fillText("立即开始兑换", 40 * unit, 846 * unit); | ||
2072 | - | ||
2073 | - | ||
2074 | - } | ||
2075 | - | ||
2076 | - //---二维吗图--- | ||
2077 | - //-- 自定义海报 -- | ||
2078 | - if(th.data.poster){ | ||
2079 | - var erm_x= parseFloat(th.data.poster.ewm_x)*2; | ||
2080 | - var erm_y= parseFloat(th.data.poster.ewm_y)*2; | ||
2081 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit); | ||
2082 | - }else{ | ||
2083 | - //---二维吗图--- | ||
2084 | - context.drawImage(vpath, 410 * unit, 726 * unit, 115 * unit, 125 * unit); | ||
2085 | - } | ||
2086 | - | ||
2087 | - break; | ||
2088 | - case 1: //秒杀商品的展示 | ||
2089 | - //---画线--- | ||
2090 | - context.setLineWidth(1 * unit) | ||
2091 | - context.moveTo(32 * unit, 670 * unit) | ||
2092 | - context.lineTo(520 * unit, 670 * unit) | ||
2093 | - context.stroke(); | ||
2094 | - | ||
2095 | - //画秒杀的图片 | ||
2096 | - var miaos_path = '../../../images/share/miao_share.png'; | ||
2097 | - context.drawImage(miaos_path, 43 * unit, 700 * unit, 222 * unit, 40 * unit); | ||
2098 | - | ||
2099 | - context.setFillStyle("black") | ||
2100 | - context.setFontSize(24 * unit) | ||
2101 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 786 * unit); | ||
2102 | - //---文字--- | ||
2103 | - context.setFontSize(22 * unit) | ||
2104 | - context.setFillStyle("black") | ||
2105 | - context.fillText("特惠好物,限时秒杀", 40 * unit, 826 * unit); | ||
2106 | - context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); | ||
2107 | - | ||
2108 | - | ||
2109 | - //---二维吗图--- | ||
2110 | - //-- 自定义海报 -- | ||
2111 | - if(th.data.poster){ | ||
2112 | - var erm_x= parseFloat(th.data.poster.ewm_x)*2; | ||
2113 | - var erm_y= parseFloat(th.data.poster.ewm_y)*2; | ||
2114 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit); | ||
2115 | - }else{ | ||
2116 | - //---二维吗图--- | ||
2117 | - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); | ||
2118 | - } | ||
2119 | - break; | ||
2120 | - | ||
2121 | - case 2: //会员团和商家团的展示 | ||
2122 | - //---画线--- | ||
2123 | - context.setLineWidth(1 * unit) | ||
2124 | - context.moveTo(32 * unit, 670 * unit) | ||
2125 | - context.lineTo(520 * unit, 670 * unit) | ||
2126 | - context.stroke(); | ||
2127 | - //---文字--- | ||
2128 | - | ||
2129 | - context.setFillStyle("black") | ||
2130 | - context.setFontSize(24 * unit) | ||
2131 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | ||
2132 | - | ||
2133 | - //绘制成团图片 | ||
2134 | - var ct_img = "../../../images/share/ct_num.png"; | ||
2135 | - context.drawImage(ct_img, 40 * unit, 740 * unit, 120 * unit, 30 * unit); | ||
2136 | - var ct_num = th.data.prom_act.ct_num; | ||
2137 | - context.setFontSize(14 * unit) | ||
2138 | - context.font = 'normal'; | ||
2139 | - context.setFillStyle("red") | ||
2140 | - if (ct_num < 10) { | ||
2141 | - context.fillText(ct_num + "人拼团", 92 * unit, 760 * unit); | ||
2142 | - } else { | ||
2143 | - context.fillText(ct_num + "人拼团", 86 * unit, 760 * unit); | ||
2144 | - } | ||
2145 | - context.setFontSize(22 * unit) | ||
2146 | - context.fillText("已拼" + th.data.prom_act.buy_num + "份", 166 * unit, 763 * unit); | ||
2147 | - | ||
2148 | - context.setFillStyle("gray") | ||
2149 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 806 * unit); | ||
2150 | - context.setFillStyle("black") | ||
2151 | - context.font = 'normal bold 18px sans-serif'; | ||
2152 | - context.setFontSize(21.3 * unit) | ||
2153 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 836 * unit); | ||
2154 | - | ||
2155 | - | ||
2156 | - //---二维吗图--- | ||
2157 | - //-- 自定义海报 -- | ||
2158 | - if(th.data.poster){ | ||
2159 | - var erm_x= parseFloat(th.data.poster.ewm_x)*2; | ||
2160 | - var erm_y= parseFloat(th.data.poster.ewm_y)*2; | ||
2161 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit); | ||
2162 | - }else{ | ||
2163 | - //---二维吗图--- | ||
2164 | - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); | ||
2165 | - } | ||
2166 | - break | ||
2167 | - case 3: //阶梯团的展示 | ||
2168 | - //---画线--- | ||
2169 | - context.setLineWidth(1 * unit) | ||
2170 | - context.moveTo(32 * unit, 670 * unit) | ||
2171 | - context.lineTo(520 * unit, 670 * unit) | ||
2172 | - context.stroke(); | ||
2173 | - //---文字--- | ||
2174 | - | ||
2175 | - context.setFillStyle("black") | ||
2176 | - context.setFontSize(24 * unit) | ||
2177 | - context.fillText(th.data.sto_sele_name_1, 40 * unit, 720 * unit); | ||
2178 | - | ||
2179 | - //---绘制中间阶梯的价格--- | ||
2180 | - var list = th.data.prom_act.ct_rylist; | ||
2181 | - for (var i = 0; i < list.length; i++) { | ||
2182 | - var item = list[i]; | ||
2183 | - var wi = i * 90 * unit; | ||
2184 | - context.font = 'normal'; | ||
2185 | - context.setFontSize(16 * unit) | ||
2186 | - context.setFillStyle("red") | ||
2187 | - context.fillText("¥", 40 * unit + wi, 756 * unit); | ||
2188 | - context.setFontSize(22 * unit) | ||
2189 | - var pri = parseFloat(item.price).toFixed(2); | ||
2190 | - context.fillText(pri, 56 * unit + wi, 756 * unit); | ||
2191 | - context.setFillStyle("gray") | ||
2192 | - context.fillText("满" + item.rynum + "人", 40 * unit + wi, 786 * unit); | ||
2193 | - } | ||
2194 | - //----------------下面部分---------------- | ||
2195 | - // context.setFillStyle("gray") | ||
2196 | - // context.fillText("快来和我一起拼团吧!", 40 * unit, 830 * unit); | ||
2197 | - // context.setFillStyle("black") | ||
2198 | - // context.font = 'normal bold 18px sans-serif'; | ||
2199 | - // context.setFontSize(22 * unit) | ||
2200 | - // context.fillText("长按识别二维码,立即参团", 40 * unit, 860 * unit); | ||
2201 | - //context.setFillStyle("gray") | ||
2202 | - context.setFillStyle("black") | ||
2203 | - context.fillText("快来和我一起拼团吧!", 40 * unit, 820 * unit); | ||
2204 | - //context.font = 'normal bold 18px sans-serif'; | ||
2205 | - context.setFontSize(22 * unit) | ||
2206 | - context.fillText("长按识别二维码,立即参团", 40 * unit, 850 * unit); | ||
2207 | - | ||
2208 | - | ||
2209 | - //-- 自定义海报 -- | ||
2210 | - if(th.data.poster){ | ||
2211 | - var erm_x= parseFloat(th.data.poster.ewm_x)*2; | ||
2212 | - var erm_y= parseFloat(th.data.poster.ewm_y)*2; | ||
2213 | - context.drawImage(vpath, erm_x * unit, erm_y * unit, 120 * unit, 120 * unit); | ||
2214 | - }else{ | ||
2215 | - //---二维吗图--- | ||
2216 | - context.drawImage(vpath, 420 * unit, 726 * unit, 120 * unit, 120 * unit); | ||
2217 | - } | ||
2218 | - break | ||
2219 | - | ||
2220 | - | ||
2221 | - } | ||
2222 | - | ||
2223 | - | ||
2224 | - //--- 如果是自定义海报的时候 --- | ||
2225 | - if(th.data.poster && parseInt(th.data.poster.style)==2){ | ||
2226 | - | ||
2227 | - //如果显示会员信息的话 | ||
2228 | - if(parseInt(th.data.poster.show_headpic)){ | ||
2229 | - //获取坐标 | ||
2230 | - var x= parseFloat(th.data.poster.head_x)*2; | ||
2231 | - var y=parseFloat(th.data.poster.head_y)*2; | ||
2232 | - //---绘制圆形要放在最后---- | ||
2233 | - context.save(); | ||
2234 | - context.beginPath(); | ||
2235 | - var h_x = x* unit; | ||
2236 | - var h_y = y * unit; | ||
2237 | - var h_r = 40 * unit; | ||
2238 | - var cx = h_x + h_r; | ||
2239 | - var cy = h_y + h_r; | ||
2240 | - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | ||
2241 | - context.closePath(); | ||
2242 | - context.fill(); | ||
2243 | - context.clip(); | ||
2244 | - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | ||
2245 | - context.restore(); | ||
2246 | - } | ||
2247 | - | ||
2248 | - }else{ | ||
2249 | - //---绘制圆形要放在最后---- | ||
2250 | - context.save(); | ||
2251 | - context.beginPath(); | ||
2252 | - var h_x = 60 * unit; | ||
2253 | - var h_y = 24 * unit; | ||
2254 | - var h_r = 40 * unit; | ||
2255 | - var cx = h_x + h_r; | ||
2256 | - var cy = h_y + h_r; | ||
2257 | - context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | ||
2258 | - context.closePath(); | ||
2259 | - context.fill(); | ||
2260 | - context.clip(); | ||
2261 | - context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | ||
2262 | - context.restore(); | ||
2263 | - } | ||
2264 | - | ||
2265 | - | ||
2266 | - //把画板内容绘制成图片,并回调 画板图片路径 | ||
2267 | - context.draw(false, function() { | ||
2268 | - setTimeout(function() { | ||
2269 | - wx.canvasToTempFilePath({ | ||
2270 | - x: 0, | ||
2271 | - y: 0, | ||
2272 | - width: 750, | ||
2273 | - height: 1217, | ||
2274 | - destWidth: 1.2 * 750 * 750 / that.data.screenWidth, | ||
2275 | - destHeight: 1.2 * 1217 * 750 / that.data.screenWidth, | ||
2276 | - canvasId: 'share', | ||
2277 | - success: function(res) { | ||
2278 | - that.setData({ | ||
2279 | - shareImgPath: res.tempFilePath, | ||
2280 | - canvasHidden: true | ||
2281 | - }) | ||
2282 | - if (!res.tempFilePath) { | ||
2283 | - wx.showModal({ | ||
2284 | - title: '提示', | ||
2285 | - content: '图片绘制中,请稍后重试', | ||
2286 | - showCancel: false | ||
2287 | - }) | ||
2288 | - return false; | ||
2289 | - } | ||
2290 | - // wx.previewImage({ | ||
2291 | - // //将图片预览出来 | ||
2292 | - // urls: [that.data.shareImgPath] | ||
2293 | - // }); | ||
2294 | - that.setData({ | ||
2295 | - showPoster: true, | ||
2296 | - }); | ||
2297 | - wx.hideLoading(); | ||
2298 | - } | ||
2299 | - }) | ||
2300 | - }, 500) | ||
2301 | - | ||
2302 | - }); | ||
2303 | - }); | ||
2304 | - } | ||
2305 | - }); | ||
2306 | - }, | ||
2307 | - | ||
2308 | 1880 | ||
2309 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | 1881 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
2310 | draw_Text: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { | 1882 | draw_Text: function(ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { |
@@ -2381,45 +1953,52 @@ Page({ | @@ -2381,45 +1953,52 @@ Page({ | ||
2381 | }, 500) | 1953 | }, 500) |
2382 | }, | 1954 | }, |
2383 | 1955 | ||
2384 | - //--获取头像的本地缓存,回调写法-- | ||
2385 | - get_head_temp: function(tt, func) { | ||
2386 | - var ee = this; | ||
2387 | - if (ee.data.share_head) { | ||
2388 | - tt(func); | ||
2389 | - return false; | ||
2390 | - } | ||
2391 | - //---获取分享图片的本地地址,头像和商品图片---- | ||
2392 | - var path2 = getApp().globalData.userInfo.head_pic; | ||
2393 | - if (path2 == "") { | ||
2394 | - ee.data.share_head = "../../../images/share/hui_hear_pic.png"; | ||
2395 | - tt(func); | ||
2396 | - } else { | ||
2397 | - path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); | ||
2398 | - path2 = path2.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); | ||
2399 | - wx.getImageInfo({ | ||
2400 | - src: path2, | ||
2401 | - success: function(res) { | ||
2402 | - //res.path是网络图片的本地地址 | ||
2403 | - ee.data.share_head = res.path; | ||
2404 | - tt(func); | ||
2405 | - }, | ||
2406 | - fail: function(res) { | ||
2407 | - ee.data.share_head = "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的 | ||
2408 | - tt(func); | 1956 | + //--获取头像的本地缓存,回调写法-- |
1957 | + get_head_temp: function (tt, func) { | ||
1958 | + var ee = this; | ||
1959 | + if (ee.data.share_head) { | ||
1960 | + tt(func); | ||
1961 | + return false; | ||
2409 | } | 1962 | } |
2410 | - }); | ||
2411 | - } | ||
2412 | - }, | ||
2413 | - //--获取商品图片的本地缓存,回调写法-- | 1963 | + //---获取分享图片的本地地址,头像和商品图片---- |
1964 | + var path2 = getApp().globalData.userInfo.head_pic; | ||
1965 | + if (path2 == "") { | ||
1966 | + ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; | ||
1967 | + tt(func); | ||
1968 | + } else { | ||
1969 | + path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); | ||
1970 | + path2 = path2.replace("https://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); | ||
1971 | + wx.getImageInfo({ | ||
1972 | + src: path2, | ||
1973 | + success: function (res) { | ||
1974 | + //res.path是网络图片的本地地址 | ||
1975 | + ee.data.share_head = res.path; | ||
1976 | + tt(func); | ||
1977 | + }, | ||
1978 | + fail: function (res) { | ||
1979 | + ee.data.share_head = "../../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的 | ||
1980 | + tt(func); | ||
1981 | + } | ||
1982 | + }); | ||
1983 | + } | ||
1984 | + }, | ||
1985 | + | ||
1986 | + //--获取商品图片的本地缓存,回调写法-- | ||
2414 | get_goods_temp: function(tt) { | 1987 | get_goods_temp: function(tt) { |
2415 | var ee = this; | 1988 | var ee = this; |
2416 | if (ee.data.share_goods_img) { | 1989 | if (ee.data.share_goods_img) { |
2417 | tt(); | 1990 | tt(); |
2418 | return false; | 1991 | return false; |
2419 | } | 1992 | } |
1993 | + | ||
1994 | + var img=ee.data.iurl+ee.data.data.img_url; | ||
1995 | + if(ee.data.prom_act){ | ||
1996 | + img=ee.data.iurl+ee.data.prom_act.share_img; | ||
1997 | + } | ||
1998 | + | ||
2420 | //获取商品是分享图信息 | 1999 | //获取商品是分享图信息 |
2421 | wx.getImageInfo({ | 2000 | wx.getImageInfo({ |
2422 | - src: ee.data.data.original_img, | 2001 | + src: img, |
2423 | success: function(res) { | 2002 | success: function(res) { |
2424 | //res.path是网络图片的本地地址 | 2003 | //res.path是网络图片的本地地址 |
2425 | ee.data.share_goods_img = res.path; | 2004 | ee.data.share_goods_img = res.path; |
@@ -3349,13 +2928,7 @@ Page({ | @@ -3349,13 +2928,7 @@ Page({ | ||
3349 | }; | 2928 | }; |
3350 | }) | 2929 | }) |
3351 | }, | 2930 | }, |
3352 | - | ||
3353 | - | ||
3354 | - | ||
3355 | - | ||
3356 | 2931 | ||
3357 | - | ||
3358 | - | ||
3359 | viewFlash(e) { | 2932 | viewFlash(e) { |
3360 | let prom_type = e.currentTarget.dataset.promtype; | 2933 | let prom_type = e.currentTarget.dataset.promtype; |
3361 | let prom_id = e.currentTarget.dataset.promid; | 2934 | let prom_id = e.currentTarget.dataset.promid; |
@@ -3366,9 +2939,7 @@ Page({ | @@ -3366,9 +2939,7 @@ Page({ | ||
3366 | } | 2939 | } |
3367 | getApp().goto(url); | 2940 | getApp().goto(url); |
3368 | }, | 2941 | }, |
3369 | - | ||
3370 | - | ||
3371 | - | 2942 | + |
3372 | //获取更多秒杀 | 2943 | //获取更多秒杀 |
3373 | get_more_flash: async function (func) { | 2944 | get_more_flash: async function (func) { |
3374 | var f_more = false; | 2945 | var f_more = false; |
@@ -3787,8 +3358,712 @@ Page({ | @@ -3787,8 +3358,712 @@ Page({ | ||
3787 | } | 3358 | } |
3788 | }, | 3359 | }, |
3789 | 3360 | ||
3361 | + clickShare() { | ||
3362 | + if (!getApp().globalData.user_id) { | ||
3363 | + getApp().goto("/packageE/pages/togoin/togoin"); | ||
3364 | + return false; | ||
3365 | + } | ||
3366 | + this.setData({ share_hidden: true, }); | ||
3367 | + }, | ||
3790 | 3368 | ||
3791 | - | 3369 | + send() { |
3370 | + this.setData({ share_hidden: false, }); | ||
3371 | + }, | ||
3372 | + | ||
3373 | + cancel() { | ||
3374 | + this.setData({ | ||
3375 | + share_hidden: false, | ||
3376 | + }); | ||
3377 | + }, | ||
3378 | + | ||
3379 | + saveImageFn(){ | ||
3380 | + if(this.data.share_b_img){ | ||
3381 | + this.saveImageToPhotosAlbum() | ||
3382 | + }else{ | ||
3383 | + this.saveImageToPhotosAlbumDef() | ||
3384 | + } | ||
3385 | + }, | ||
3386 | + | ||
3387 | + | ||
3388 | + //--定义的保存图片方法,分享团--- | ||
3389 | + saveImageToPhotosAlbum: function () { | ||
3390 | + //--先判断会员状态-- | ||
3391 | + var user_info = getApp().globalData.userInfo; | ||
3392 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
3393 | + //getApp().my_warnning("请先登录",0,this); | ||
3394 | + wx.navigateTo({ url: '/packageE/pages/togoin/togoin', }) | ||
3395 | + return false; | ||
3396 | + } | ||
3397 | + | ||
3398 | + if (this.data.share_hidden) { | ||
3399 | + this.setData({ | ||
3400 | + share_hidden: false, | ||
3401 | + }); | ||
3402 | + }; | ||
3403 | + | ||
3404 | + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 | ||
3405 | + var type = 8; | ||
3406 | + wx.showLoading({ | ||
3407 | + title: '生成中...', | ||
3408 | + }) | ||
3409 | + var that = this, | ||
3410 | + th = that; | ||
3411 | + //设置画板显示,才能开始绘图 | ||
3412 | + that.setData({ | ||
3413 | + canvasHidden: false | ||
3414 | + }) | ||
3415 | + | ||
3416 | + var app = getApp(); | ||
3417 | + var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | ||
3418 | + var path2 = that.data.data.original_img; | ||
3419 | + | ||
3420 | + var scene = th.data.gid + "_"+th.data.presellList.id; | ||
3421 | + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; | ||
3422 | + if (user_id > 0) { | ||
3423 | + scene += "_" + user_id; | ||
3424 | + } | ||
3425 | + //-- 如果不是会员分享过来的要分享给别人 -- | ||
3426 | + if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) { | ||
3427 | + //固定房间是第3个字符 | ||
3428 | + if (!user_id) scene += "_0"; | ||
3429 | + scene += "_" + getApp().globalData.room_id; | ||
3430 | + } | ||
3431 | + | ||
3432 | + | ||
3433 | + ///二微码 | ||
3434 | + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
3435 | + os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/presell/cardInfo/goodsInfo"; | ||
3436 | + | ||
3437 | + | ||
3438 | + console.log(path3); | ||
3439 | + | ||
3440 | + //读取文件成功则OK-- | ||
3441 | + wx.getImageInfo({ | ||
3442 | + src: path3, | ||
3443 | + success: function (res) { | ||
3444 | + //回调写法 | ||
3445 | + th.get_head_temp(th.get_goods_temp, function () { | ||
3446 | + var vpath = res.path; | ||
3447 | + var context = wx.createCanvasContext('share'); | ||
3448 | + //先画背景 | ||
3449 | + var pg_path = "../../../../images/share/share_bg.png"; | ||
3450 | + | ||
3451 | + //-- 如果有自定义海报的时候,判断背景的图片 -- | ||
3452 | + if (th.data.share_b_img) { | ||
3453 | + pg_path = th.data.share_b_img; | ||
3454 | + } | ||
3455 | + context.drawImage(pg_path, 0, 0, 554 * unit, 899 * unit); | ||
3456 | + | ||
3457 | + //-- 是自定义海报的情况下 -- | ||
3458 | + if (th.data.poster && parseInt(th.data.poster.style) == 2) { | ||
3459 | + //在线上分享人的情况下 | ||
3460 | + if (parseInt(th.data.poster.show_headpic)) { | ||
3461 | + //获取坐标 | ||
3462 | + var x = parseFloat(th.data.poster.head_x) * 2; | ||
3463 | + var y = parseFloat(th.data.poster.head_y) * 2; | ||
3464 | + var x1 = (x + 90) * unit; | ||
3465 | + var y1 = (y + 50) * unit; | ||
3466 | + //--昵称--- | ||
3467 | + context.setFontSize(24 * unit) | ||
3468 | + context.setFillStyle("black") | ||
3469 | + context.fillText(app.globalData.userInfo.nickname, x1, y1); | ||
3470 | + var width = 24 * app.globalData.userInfo.nickname.length * unit + 4 * unit; | ||
3471 | + //强烈推荐 改许程 | ||
3472 | + var tj_path = "../../../../images/share/q_tj.png"; | ||
3473 | + context.drawImage(tj_path, x1 + width, y1 - 22 * unit, 85 * unit, 30 * unit); | ||
3474 | + context.setFontSize(16 * unit) | ||
3475 | + context.setLineJoin('round'); //交点设置成圆角 | ||
3476 | + context.setFillStyle("white") | ||
3477 | + context.fillText('强烈推荐', x1 + width + 8 * unit, y1 - 1 * unit); | ||
3478 | + | ||
3479 | + //context.setFillStyle("black") | ||
3480 | + //context.setFontSize(24 * unit) | ||
3481 | + //context.fillText(getApp().globalData.config.store_name, 40 * unit, 130 * unit); | ||
3482 | + } | ||
3483 | + } else { | ||
3484 | + //--昵称--- | ||
3485 | + context.setFontSize(24 * unit) | ||
3486 | + context.setFillStyle("black") | ||
3487 | + context.fillText(app.globalData.userInfo.nickname, 152 * unit, 76 * unit); | ||
3488 | + var width = 24 * app.globalData.userInfo.nickname.length * unit + 2 * unit; | ||
3489 | + //强烈推荐 改许程 | ||
3490 | + var tj_path = "../../../../images/share/q_tj.png"; | ||
3491 | + context.drawImage(tj_path, 152 * unit + width, 54 * unit, 85 * unit, 30 * unit); | ||
3492 | + context.setFontSize(16 * unit); | ||
3493 | + context.setLineJoin('round'); //交点设置成圆角 | ||
3494 | + context.setFillStyle("white"); | ||
3495 | + context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); | ||
3496 | + } | ||
3497 | + | ||
3498 | + var share_title = th.data.presellForm.share_title; | ||
3499 | + share_title=share_title ? share_title : th.data.data.goods_name; | ||
3500 | + | ||
3501 | + //---产品名称--- | ||
3502 | + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | ||
3503 | + | ||
3504 | + context.setFillStyle("black"); | ||
3505 | + context.setFontSize(21.3 * unit) | ||
3506 | + th.draw_Text(context, share_title, | ||
3507 | + 80 * unit, 160 * unit, 200 * unit, 279 * unit, unit); | ||
3508 | + | ||
3509 | + //------产品的价格------- | ||
3510 | + context.setFontSize(22 * unit) | ||
3511 | + context.setFillStyle("red") | ||
3512 | + | ||
3513 | + | ||
3514 | + var pri0 = th.data.presellList.presell_money; | ||
3515 | + // if (th.data.prom_act) | ||
3516 | + // pri0 = th.data.prom_act.price; | ||
3517 | + pri0 = parseFloat(pri0).toFixed(2); | ||
3518 | + var wd1 = th.data.screenWidth - ut.measureText(pri0, 31 * unit) - 25; | ||
3519 | + context.fillText("¥", wd1 - 15, 160 * unit); | ||
3520 | + context.setFontSize(22 * unit) | ||
3521 | + context.fillText(pri0, wd1, 165 * unit); | ||
3522 | + | ||
3523 | + //---市场价划掉--- | ||
3524 | + // context.setFillStyle("red") | ||
3525 | + // context.setFontSize(22 * unit) | ||
3526 | + // pri0 = "¥" + th.data.data.market_price.toFixed(2); | ||
3527 | + // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | ||
3528 | + | ||
3529 | + | ||
3530 | + if(th.data.presellForm.presell_type==1){ | ||
3531 | + // context.setStrokeStyle('gray'); | ||
3532 | + // context.fillText(pri0, wd2, 213 * unit); | ||
3533 | + // context.setLineWidth(1 * unit); | ||
3534 | + // context.moveTo(wd2 - 5, 206 * unit); | ||
3535 | + // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit); | ||
3536 | + // context.stroke(); | ||
3537 | + | ||
3538 | + //-- 零售价的优化 -- | ||
3539 | + var wp= th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50; | ||
3540 | + var hp= 180 * unit | ||
3541 | + th.draw_pos_price(context,wp,hp,th.data.data.show_price,unit); | ||
3542 | + | ||
3543 | + }else{ | ||
3544 | + var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50; | ||
3545 | + context.fillText('定金', wd2, 190 * unit); | ||
3546 | + } | ||
3547 | + | ||
3548 | + | ||
3549 | + //console.log(th.data.share_goods_img); | ||
3550 | + //let share_goods_img=th.data.presellForm.share_img; | ||
3551 | + //share_goods_img?share_goods_img:th.data.data.share_goods_img; | ||
3552 | + //---中间大图--- | ||
3553 | + context.drawImage(th.data.share_goods_img, 70 * unit, 210 * unit, 408 * unit, 408 * unit); | ||
3554 | + //---自定义海报 产品质量保证 | ||
3555 | + if(th.data.poster.show_quality==1 ){ | ||
3556 | + var g_path = "/images/share/s_gou.png"; | ||
3557 | + context.drawImage(g_path, 56 * unit, 630 * unit, 22 * unit, 22 * unit); | ||
3558 | + context.setFillStyle("red") | ||
3559 | + context.setFontSize(18 * unit) | ||
3560 | + context.fillText("正品保证", 84 * unit, 650 * unit); | ||
3561 | + | ||
3562 | + context.drawImage(g_path, 218 * unit, 630 * unit, 22 * unit, 22 * unit); | ||
3563 | + context.setFillStyle("red") | ||
3564 | + context.setFontSize(18 * unit) | ||
3565 | + context.fillText("纯实体店", 246 * unit, 650 * unit); | ||
3566 | + | ||
3567 | + context.drawImage(g_path, 388 * unit, 630 * unit, 22 * unit, 22 * unit); | ||
3568 | + context.setFillStyle("red") | ||
3569 | + context.setFontSize(18 * unit) | ||
3570 | + context.fillText("官方验证", 420 * unit, 650 * unit); | ||
3571 | + | ||
3572 | + } | ||
3573 | + | ||
3574 | + //---画线--- | ||
3575 | + // context.setLineWidth(1 * unit) | ||
3576 | + // context.moveTo(32 * unit, 662 * unit) | ||
3577 | + // context.lineTo(520 * unit, 662 * unit) | ||
3578 | + // context.stroke(); | ||
3579 | + | ||
3580 | + //---文字--- | ||
3581 | + context.setFillStyle("black") | ||
3582 | + // context.setFontSize(22 * unit) | ||
3583 | + context.setFontSize(24 * unit) | ||
3584 | + context.fillText(th.data.sto_sele_name_1, 40 * unit, 700 * unit); | ||
3585 | + context.setFillStyle("red") | ||
3586 | + context.setFontSize(20 * unit) | ||
3587 | + var presell_price = `预售价:${th.data.presellList.presell_price}` | ||
3588 | + context.fillText(presell_price, 40 * unit, 750 * unit); | ||
3589 | + context.setFillStyle("black") | ||
3590 | + context.setFontSize(22 * unit) | ||
3591 | + context.fillText("特惠好物,限时预售", 40 * unit, 800 * unit); | ||
3592 | + context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 840 * unit); | ||
3593 | + | ||
3594 | + //---二维吗图--- | ||
3595 | + //-- 自定义海报 -- | ||
3596 | + if (th.data.poster) { | ||
3597 | + var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | ||
3598 | + var erm_y = parseFloat(th.data.poster.ewm_y) * 2; | ||
3599 | + context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); | ||
3600 | + } else { | ||
3601 | + //---二维吗图--- | ||
3602 | + context.drawImage(vpath, 390 * unit, 746 * unit, 130 * unit, 116 * unit); | ||
3603 | + } | ||
3604 | + | ||
3605 | + //--- 如果是自定义海报的时候 --- | ||
3606 | + if (th.data.poster && parseInt(th.data.poster.style) == 2) { | ||
3607 | + | ||
3608 | + //如果显示会员信息的话 | ||
3609 | + if (parseInt(th.data.poster.show_headpic)) { | ||
3610 | + //获取坐标 | ||
3611 | + var x = parseFloat(th.data.poster.head_x) * 2; | ||
3612 | + var y = parseFloat(th.data.poster.head_y) * 2; | ||
3613 | + //---绘制圆形要放在最后---- | ||
3614 | + context.save(); | ||
3615 | + context.beginPath(); | ||
3616 | + var h_x = x * unit; | ||
3617 | + var h_y = y * unit; | ||
3618 | + var h_r = 40 * unit; | ||
3619 | + var cx = h_x + h_r; | ||
3620 | + var cy = h_y + h_r; | ||
3621 | + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | ||
3622 | + context.closePath(); | ||
3623 | + context.fill(); | ||
3624 | + context.clip(); | ||
3625 | + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | ||
3626 | + context.restore(); | ||
3627 | + } | ||
3628 | + | ||
3629 | + } else { | ||
3630 | + //---绘制圆形要放在最后---- | ||
3631 | + context.save(); | ||
3632 | + context.beginPath(); | ||
3633 | + var h_x = 60 * unit; | ||
3634 | + var h_y = 24 * unit; | ||
3635 | + var h_r = 40 * unit; | ||
3636 | + var cx = h_x + h_r; | ||
3637 | + var cy = h_y + h_r; | ||
3638 | + context.arc(cx, cy, h_r, 0, Math.PI * 2, false); | ||
3639 | + context.closePath(); | ||
3640 | + context.fill(); | ||
3641 | + context.clip(); | ||
3642 | + context.drawImage(th.data.share_head, h_x, h_y, h_r * 2, h_r * 2); | ||
3643 | + context.restore(); | ||
3644 | + } | ||
3645 | + | ||
3646 | + | ||
3647 | + if(th.data.poster.show_time==1){ | ||
3648 | + var act_time=''; | ||
3649 | + act_time="截止时间:"+ ut.formatTime(th.data.presellForm.end_time); | ||
3650 | + context.setFillStyle("red") | ||
3651 | + getApp().draw_Text(context, act_time,38 * unit, 880 * unit, 200 * unit, 340 * unit, unit); | ||
3652 | + } | ||
3653 | + | ||
3654 | + //把画板内容绘制成图片,并回调 画板图片路径 | ||
3655 | + context.draw(false, function () { | ||
3656 | + setTimeout(function () { | ||
3657 | + wx.canvasToTempFilePath({ | ||
3658 | + x: 0, | ||
3659 | + y: 0, | ||
3660 | + width: 750, | ||
3661 | + height: 1217, | ||
3662 | + destWidth: 1.2 * 750 * 750 / that.data.screenWidth, | ||
3663 | + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth, | ||
3664 | + canvasId: 'share', | ||
3665 | + success: function (res) { | ||
3666 | + | ||
3667 | + that.setData({ | ||
3668 | + shareImgPath: res.tempFilePath, | ||
3669 | + canvasHidden: true | ||
3670 | + }) | ||
3671 | + | ||
3672 | + if (!res.tempFilePath) { | ||
3673 | + wx.showModal({ | ||
3674 | + title: '提示', | ||
3675 | + content: '图片绘制中,请稍后重试', | ||
3676 | + showCancel: false | ||
3677 | + }) | ||
3678 | + return false; | ||
3679 | + } | ||
3680 | + | ||
3681 | + // wx.previewImage({ | ||
3682 | + // //将图片预览出来 | ||
3683 | + // urls: [that.data.shareImgPath] | ||
3684 | + // }); | ||
3685 | + that.setData({ | ||
3686 | + showPoster: true, | ||
3687 | + }); | ||
3688 | + wx.hideLoading(); | ||
3689 | + } | ||
3690 | + }) | ||
3691 | + }, 500) | ||
3692 | + | ||
3693 | + }); | ||
3694 | + }); | ||
3695 | + }, | ||
3696 | + fail: function (res) { | ||
3697 | + console.log(res); | ||
3698 | + wx.hideLoading(); | ||
3699 | + | ||
3700 | + } | ||
3701 | + }); | ||
3702 | + }, | ||
3703 | + //--定义的保存图片方法,分享团--- | ||
3704 | + saveImageToPhotosAlbumDef: function () { | ||
3705 | + //--先判断会员状态-- | ||
3706 | + var user_info = getApp().globalData.userInfo; | ||
3707 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | ||
3708 | + //getApp().my_warnning("请先登录",0,this); | ||
3709 | + wx.navigateTo({url: '/packageE/pages/togoin/togoin',}) | ||
3710 | + return false; | ||
3711 | + } | ||
3712 | + | ||
3713 | + if (this.data.share_hidden) { | ||
3714 | + this.setData({share_hidden: false,}); | ||
3715 | + }; | ||
3716 | + | ||
3717 | + //类型 0普通商品 1秒杀商品 2商家和会员团 3阶梯团 4阶梯团 | ||
3718 | + var type = this.data.prom_type; | ||
3719 | + console.log('商品类型-----'); | ||
3720 | + console.log(type); | ||
3721 | + // if (type == 2) type = -1; | ||
3722 | + if (type == 4) type = 0; | ||
3723 | + if (type == 8) type = 0; | ||
3724 | + if (type == 2) type = 0; | ||
3725 | + if (type == 6) type = 2; // 6拼团 2团购 | ||
3726 | + if (type == 10) type = -1; | ||
3727 | + | ||
3728 | + | ||
3729 | + if (this.data.prom_act && this.data.prom_act.kttype == 3) type = 3; | ||
3730 | + console.log('商品类型。。。。。'); | ||
3731 | + console.log(type); | ||
3732 | + wx.showLoading({title: '生成中...',}) | ||
3733 | + var that = this, th = that; | ||
3734 | + //设置画板显示,才能开始绘图 | ||
3735 | + that.setData({ | ||
3736 | + canvasHidden: false | ||
3737 | + }) | ||
3738 | + | ||
3739 | + var app = getApp(); | ||
3740 | + var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | ||
3741 | + var path2 = that.data.data.original_img; | ||
3742 | + | ||
3743 | + var scene = th.data.gid + "_"+th.data.presellList.id; | ||
3744 | + var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; | ||
3745 | + if (user_id > 0) { | ||
3746 | + scene += "_" + user_id; | ||
3747 | + } | ||
3748 | + //-- 如果不是会员分享过来的要分享给别人 -- | ||
3749 | + if (getApp().globalData.room_id && th.data.data.goods_id == getApp().globalData.room_goods_id && !getApp().globalData.room_user_share) { | ||
3750 | + //固定房间是第3个字符 | ||
3751 | + if (!user_id) scene += "_0"; | ||
3752 | + scene += "_" + getApp().globalData.room_id; | ||
3753 | + } | ||
3754 | + | ||
3755 | + ///二微码 | ||
3756 | + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + | ||
3757 | + os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/presell/cardInfo/goodsInfo"; | ||
3758 | + | ||
3759 | + console.log(path3); | ||
3760 | + | ||
3761 | + | ||
3762 | + // 读取文件成功则OK-- | ||
3763 | + wx.getImageInfo({ | ||
3764 | + src: path3, | ||
3765 | + success: function (res) { | ||
3766 | + // 回调写法 | ||
3767 | + th.get_head_temp(th.get_goods_temp, function () { | ||
3768 | + var vpath = res.path; | ||
3769 | + var context = wx.createCanvasContext('share'); | ||
3770 | + // 先画背景 | ||
3771 | + var pg_path = "../../../../images/share/share_bg.png"; | ||
3772 | + | ||
3773 | + th.drawPoster(context, unit, th.data.share_goods_img, vpath, type); | ||
3774 | + | ||
3775 | + | ||
3776 | + //把画板内容绘制成图片,并回调 画板图片路径 | ||
3777 | + context.draw(false, function () { | ||
3778 | + setTimeout(function () { | ||
3779 | + wx.canvasToTempFilePath({ | ||
3780 | + x: 0, | ||
3781 | + y: 0, | ||
3782 | + width: 750, | ||
3783 | + height: 1217, | ||
3784 | + destWidth: 1.2 * 750 * 750 / that.data.screenWidth, | ||
3785 | + destHeight: 1.2 * 1217 * 750 / that.data.screenWidth, | ||
3786 | + canvasId: 'share', | ||
3787 | + success: function (res) { | ||
3788 | + | ||
3789 | + that.setData({ | ||
3790 | + shareImgPath: res.tempFilePath, | ||
3791 | + canvasHidden: true | ||
3792 | + }) | ||
3793 | + | ||
3794 | + if (!res.tempFilePath) { | ||
3795 | + wx.showModal({ | ||
3796 | + title: '提示', | ||
3797 | + content: '图片绘制中,请稍后重试', | ||
3798 | + showCancel: false | ||
3799 | + }) | ||
3800 | + return false; | ||
3801 | + } | ||
3802 | + | ||
3803 | + that.setData({ | ||
3804 | + showPoster: true, | ||
3805 | + }); | ||
3806 | + wx.hideLoading(); | ||
3807 | + } | ||
3808 | + }) | ||
3809 | + }, 500) | ||
3810 | + | ||
3811 | + }); | ||
3812 | + }); | ||
3813 | + }, | ||
3814 | + fail: function (res) { | ||
3815 | + console.log(res); | ||
3816 | + wx.hideLoading(); | ||
3817 | + | ||
3818 | + } | ||
3819 | + }); | ||
3820 | + }, | ||
3821 | + | ||
3822 | + //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | ||
3823 | + draw_Text: function (ctx, str, leftWidth, initHeight, titleHeight, canvasWidth, unit) { | ||
3824 | + var lineWidth = 0; | ||
3825 | + var lastSubStrIndex = 0; //每次开始截取的字符串的索引 | ||
3826 | + var han = 0; | ||
3827 | + for (let i = 0; i < str.length; i++) { | ||
3828 | + if (han == 2) return; | ||
3829 | + //lineWidth += ctx.measureText(str[i]).width; | ||
3830 | + lineWidth += ut.measureText(str[i], 21.3 * unit); | ||
3831 | + if (lineWidth > canvasWidth) { | ||
3832 | + han++; | ||
3833 | + | ||
3834 | + if (han == 2) | ||
3835 | + ctx.fillText(str.substring(lastSubStrIndex, i) + '...', leftWidth, initHeight); //绘制截取部分 | ||
3836 | + else | ||
3837 | + ctx.fillText(str.substring(lastSubStrIndex, i), leftWidth, initHeight); | ||
3838 | + | ||
3839 | + initHeight += 22; //22为字体的高度 | ||
3840 | + lineWidth = 0; | ||
3841 | + lastSubStrIndex = i; | ||
3842 | + titleHeight += 20; | ||
3843 | + } | ||
3844 | + if (i == str.length - 1) { //绘制剩余部分 | ||
3845 | + ctx.fillText(str.substring(lastSubStrIndex, i + 1), leftWidth, initHeight); | ||
3846 | + } | ||
3847 | + } | ||
3848 | + }, | ||
3849 | + | ||
3850 | + drawPoster(context, unit, img, vpath, type) { | ||
3851 | + // 1.灰色背景 | ||
3852 | + context.setFillStyle('#f2f1f6'); | ||
3853 | + context.rect(0, 0, 554 * unit, 899 * unit); | ||
3854 | + context.fill(); | ||
3855 | + | ||
3856 | + // 2.商城名称 | ||
3857 | + let shopName = this.data.sto_sele_name_1; | ||
3858 | + context.setTextAlign('center'); | ||
3859 | + context.setFontSize(26 * unit); | ||
3860 | + context.setFillStyle('black'); | ||
3861 | + context.fillText(shopName, 277 * unit, 60 * unit); | ||
3862 | + | ||
3863 | + // 3.推荐来源 | ||
3864 | + let fromText = `来自${getApp().globalData.userInfo.nickname}的推荐`; | ||
3865 | + context.setTextAlign('center'); | ||
3866 | + context.setFontSize(22 * unit); | ||
3867 | + context.setFillStyle('#96959a'); | ||
3868 | + context.fillText(fromText, 277 * unit, 105 * unit); | ||
3869 | + | ||
3870 | + // 4.海报背景 | ||
3871 | + context.setFillStyle('white'); | ||
3872 | + context.fillRect(37 * unit, 157 * unit, 480 * unit, 673 * unit); | ||
3873 | + | ||
3874 | + // 5.商品图片 | ||
3875 | + // 图片的x坐标 | ||
3876 | + let bg_x = 37 * unit | ||
3877 | + // 图片的y坐标 | ||
3878 | + let bg_y = 157 * unit | ||
3879 | + // 图片宽度 | ||
3880 | + let bg_w = 480 * unit | ||
3881 | + // 图片高度 | ||
3882 | + let bg_h = 474 * unit | ||
3883 | + // 图片圆角 | ||
3884 | + let bg_r = 4 | ||
3885 | + // 绘制海报背景图片圆角 | ||
3886 | + context.save() | ||
3887 | + context.beginPath() | ||
3888 | + context.arc(bg_x + bg_r, bg_y + bg_r, bg_r, Math.PI, Math.PI * 1.5) | ||
3889 | + context.arc(bg_x + bg_w - bg_r, bg_y + bg_r, bg_r, Math.PI * 1.5, Math.PI * 2) | ||
3890 | + context.arc(bg_x + bg_w, bg_y + bg_h, bg_r, 0, Math.PI * 0.5) | ||
3891 | + context.arc(bg_x, bg_y + bg_h, 0, Math.PI * 0.5, Math.PI) | ||
3892 | + context.clip() | ||
3893 | + context.drawImage(img, bg_x, bg_y, bg_w, bg_h); | ||
3894 | + context.restore(); | ||
3895 | + | ||
3896 | + // 6.强烈推荐 | ||
3897 | + let src = ''; | ||
3898 | + context.beginPath(); | ||
3899 | + if (type == 0) { // 普通 | ||
3900 | + src = '../../../../images/share/q_tj.png'; | ||
3901 | + context.drawImage(src, 54 * unit, 648 * unit, 85 * unit, 30 * unit); | ||
3902 | + context.setFontSize(16 * unit) | ||
3903 | + context.setFillStyle("white") | ||
3904 | + context.setTextAlign('left'); | ||
3905 | + context.fillText('强烈推荐', 64 * unit, 668 * unit); | ||
3906 | + } | ||
3907 | + | ||
3908 | + | ||
3909 | + // 7.商品价格 | ||
3910 | + let price = this.data.data.shop_price; | ||
3911 | + if (this.data.card_field && this.data.data[this.data.card_field]) { | ||
3912 | + price = this.data.data[this.data.card_field]; | ||
3913 | + } | ||
3914 | + if (this.data.prom_act) price = this.data.prom_price; | ||
3915 | + price = parseFloat(price).toFixed(2); | ||
3916 | + context.setFontSize(32 * unit); | ||
3917 | + context.setFillStyle('#DE1117'); | ||
3918 | + | ||
3919 | + price = this.data.presellList.presell_price | ||
3920 | + context.fillText('¥' + price, 54 * unit, 735 * unit); | ||
3921 | + | ||
3922 | + | ||
3923 | + //-- 零售价的优化 -- | ||
3924 | + var wp= 62 * unit+ut.measureText('¥' + price, 32 * unit); | ||
3925 | + var hp=735 * unit | ||
3926 | + this.draw_pos_price(context,wp,hp,this.data.data.show_price,unit); | ||
3927 | + | ||
3928 | + | ||
3929 | + // 8.商品标题 | ||
3930 | + context.setFontSize(20 * unit); | ||
3931 | + context.setFillStyle('#898989'); | ||
3932 | + getApp().draw_Text(context, this.data.data.goods_name, 54 * unit, 800 * unit, 240 * unit, 280 * unit, unit, 1); | ||
3933 | + | ||
3934 | + // 9.小程序码 | ||
3935 | + context.drawImage(vpath, 375 * unit, 660 * unit, 120 * unit, 120 * unit); | ||
3936 | + context.setFontSize(16 * unit); | ||
3937 | + context.setFillStyle('#777'); | ||
3938 | + context.fillText('长按识别二维码', 378 * unit, 810 * unit); | ||
3939 | + | ||
3940 | + // 10.竖线 | ||
3941 | + context.beginPath(); | ||
3942 | + context.setFillStyle('#eee'); | ||
3943 | + context.rect(354 * unit, 670 * unit, 1 * unit, 130 * unit); | ||
3944 | + context.fill(); | ||
3945 | + }, | ||
3946 | + | ||
3947 | + //---市场价划掉--- | ||
3948 | + draw_pos_price(context,w,h,market_price,unit){ | ||
3949 | + | ||
3950 | + if(!this.data.sys_switch) return false; | ||
3951 | + if(!this.data.sys_switch.is_retail_price) return false; | ||
3952 | + | ||
3953 | + context.setFillStyle("gray") | ||
3954 | + context.setFontSize(22 * unit) | ||
3955 | + var pri0 = "¥" + market_price.toFixed(2); | ||
3956 | + context.fillText(pri0, w, h); | ||
3957 | + | ||
3958 | + var c_h=h-6; | ||
3959 | + context.setStrokeStyle('gray'); | ||
3960 | + context.setLineWidth(1 * unit); | ||
3961 | + context.moveTo(w - 5, c_h); | ||
3962 | + context.lineTo(w + ut.measureText(pri0, 22 * unit) + 5, c_h); | ||
3963 | + context.stroke(); | ||
3964 | + | ||
3965 | + }, | ||
3966 | + | ||
3967 | + | ||
3968 | + closePoster() { | ||
3969 | + this.setData({ | ||
3970 | + showPoster: false, | ||
3971 | + }); | ||
3972 | + }, | ||
3973 | + | ||
3974 | + // 保存图片到手机 | ||
3975 | + savePic() { | ||
3976 | + console.log('保存图片'); | ||
3977 | + var self = this; | ||
3978 | + // 获取用户的当前设置,返回值中有小程序已经向用户请求过的权限 | ||
3979 | + this.getSetting().then((res) => { | ||
3980 | + // 判断用户是否授权了保存到相册的权限,如果没有发起授权 | ||
3981 | + if (!res.authSetting['scope.writePhotosAlbum']) { | ||
3982 | + this.authorize().then(() => { | ||
3983 | + // 同意授权后保存下载文件 | ||
3984 | + this.saveImage(self.data.shareImgPath) | ||
3985 | + .then(() => { | ||
3986 | + self.setData({ | ||
3987 | + showPoster: false | ||
3988 | + }); | ||
3989 | + }); | ||
3990 | + }) | ||
3991 | + } else { | ||
3992 | + // 如果已经授权,保存下载文件 | ||
3993 | + this.saveImage(self.data.shareImgPath) | ||
3994 | + .then(() => { | ||
3995 | + self.setData({ | ||
3996 | + showPoster: false | ||
3997 | + }); | ||
3998 | + }); | ||
3999 | + } | ||
4000 | + | ||
4001 | + }) | ||
4002 | + }, | ||
4003 | + | ||
4004 | + // 发起首次授权请求 | ||
4005 | + authorize() { | ||
4006 | + // isFirst 用来记录是否为首次发起授权, | ||
4007 | + // 如果首次授权拒绝后,isFirst赋值为1 | ||
4008 | + let isFirst = wx.getStorageSync('isFirst') || 0; | ||
4009 | + return new Promise((resolve, reject) => { | ||
4010 | + wx.authorize({ | ||
4011 | + scope: 'scope.writePhotosAlbum', | ||
4012 | + // 同意授权 | ||
4013 | + success: () => { | ||
4014 | + resolve(); | ||
4015 | + }, | ||
4016 | + // 拒绝授权,这里是用户拒绝授权后的回调 | ||
4017 | + fail: res => { | ||
4018 | + if (isFirst === 0) { | ||
4019 | + wx.setStorageSync('isFirst', 1); | ||
4020 | + wx.showToast({ | ||
4021 | + title: '保存失败', | ||
4022 | + icon: 'none', | ||
4023 | + duration: 1000 | ||
4024 | + }) | ||
4025 | + } else { | ||
4026 | + this.showModal(); | ||
4027 | + } | ||
4028 | + console.log('拒绝授权'); | ||
4029 | + reject(); | ||
4030 | + } | ||
4031 | + }) | ||
4032 | + }) | ||
4033 | + }, | ||
4034 | + | ||
4035 | + | ||
4036 | + // 保存图片到系统相册 | ||
4037 | + saveImage(saveUrl) { | ||
4038 | + var self = this; | ||
4039 | + return new Promise((resolve, reject) => { | ||
4040 | + wx.saveImageToPhotosAlbum({ | ||
4041 | + filePath: saveUrl, | ||
4042 | + success: (res) => { | ||
4043 | + wx.showToast({ | ||
4044 | + title: '保存成功', | ||
4045 | + duration: 1000, | ||
4046 | + }); | ||
4047 | + self.setData({ | ||
4048 | + showPlaybill: 'true' | ||
4049 | + }); | ||
4050 | + resolve(); | ||
4051 | + }, | ||
4052 | + fail: () => { | ||
4053 | + wx.showToast({ | ||
4054 | + title: '保存失败', | ||
4055 | + duration: 1000, | ||
4056 | + }); | ||
4057 | + } | ||
4058 | + }) | ||
4059 | + }) | ||
4060 | + }, | ||
4061 | + | ||
4062 | + | ||
4063 | + | ||
4064 | + | ||
4065 | + | ||
4066 | + | ||
3792 | 4067 | ||
3793 | }); | 4068 | }); |
3794 | 4069 |
packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -1742,6 +1742,11 @@ Page({ | @@ -1742,6 +1742,11 @@ Page({ | ||
1742 | var th = this; | 1742 | var th = this; |
1743 | var price = th.data.pre_arr.presell_price; | 1743 | var price = th.data.pre_arr.presell_price; |
1744 | var img = th.data.data.original_img; | 1744 | var img = th.data.data.original_img; |
1745 | + //如果活动有设置分享图的时候 | ||
1746 | + if(this.data.presellForm.share_img){ | ||
1747 | + img = this.data.iurl+this.data.presellForm.share_img; | ||
1748 | + } | ||
1749 | + | ||
1745 | var title = th.data.presellForm.share_title; | 1750 | var title = th.data.presellForm.share_title; |
1746 | if (!title) title = th.data.prom_act.title; | 1751 | if (!title) title = th.data.prom_act.title; |
1747 | if (th.data.prom_type == 4) title = th.data.prom_act.name; | 1752 | if (th.data.prom_type == 4) title = th.data.prom_act.name; |
@@ -3240,7 +3245,7 @@ Page({ | @@ -3240,7 +3245,7 @@ Page({ | ||
3240 | var unit = that.data.screenWidth / 750 * 1.35; //基础单位, | 3245 | var unit = that.data.screenWidth / 750 * 1.35; //基础单位, |
3241 | var path2 = that.data.data.original_img; | 3246 | var path2 = that.data.data.original_img; |
3242 | 3247 | ||
3243 | - var scene = th.data.gid + "_"+th.data.presellList.id; | 3248 | + var scene = th.data.gid + "_"+th.data.presellList.id; |
3244 | var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; | 3249 | var user_id = getApp().globalData.user_id ? getApp().globalData.user_id : 0; |
3245 | if (user_id > 0) { | 3250 | if (user_id > 0) { |
3246 | scene += "_" + user_id; | 3251 | scene += "_" + user_id; |
@@ -3349,7 +3354,7 @@ Page({ | @@ -3349,7 +3354,7 @@ Page({ | ||
3349 | // pri0 = "¥" + th.data.data.market_price.toFixed(2); | 3354 | // pri0 = "¥" + th.data.data.market_price.toFixed(2); |
3350 | // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; | 3355 | // var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; |
3351 | 3356 | ||
3352 | - | 3357 | + |
3353 | if(th.data.presellForm.presell_type==1){ | 3358 | if(th.data.presellForm.presell_type==1){ |
3354 | // context.setStrokeStyle('gray'); | 3359 | // context.setStrokeStyle('gray'); |
3355 | // context.fillText(pri0, wd2, 213 * unit); | 3360 | // context.fillText(pri0, wd2, 213 * unit); |
@@ -3367,7 +3372,7 @@ Page({ | @@ -3367,7 +3372,7 @@ Page({ | ||
3367 | var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50; | 3372 | var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 50; |
3368 | context.fillText('定金', wd2, 190 * unit); | 3373 | context.fillText('定金', wd2, 190 * unit); |
3369 | } | 3374 | } |
3370 | - | 3375 | + |
3371 | 3376 | ||
3372 | //console.log(th.data.share_goods_img); | 3377 | //console.log(th.data.share_goods_img); |
3373 | //let share_goods_img=th.data.presellForm.share_img; | 3378 | //let share_goods_img=th.data.presellForm.share_img; |
@@ -3393,7 +3398,7 @@ Page({ | @@ -3393,7 +3398,7 @@ Page({ | ||
3393 | context.fillText("官方验证", 420 * unit, 650 * unit); | 3398 | context.fillText("官方验证", 420 * unit, 650 * unit); |
3394 | 3399 | ||
3395 | } | 3400 | } |
3396 | - | 3401 | + |
3397 | //---画线--- | 3402 | //---画线--- |
3398 | // context.setLineWidth(1 * unit) | 3403 | // context.setLineWidth(1 * unit) |
3399 | // context.moveTo(32 * unit, 662 * unit) | 3404 | // context.moveTo(32 * unit, 662 * unit) |
@@ -3407,14 +3412,14 @@ Page({ | @@ -3407,14 +3412,14 @@ Page({ | ||
3407 | context.fillText(th.data.sto_sele_name_1, 40 * unit, 700 * unit); | 3412 | context.fillText(th.data.sto_sele_name_1, 40 * unit, 700 * unit); |
3408 | context.setFillStyle("red") | 3413 | context.setFillStyle("red") |
3409 | context.setFontSize(20 * unit) | 3414 | context.setFontSize(20 * unit) |
3410 | - var presell_price = `预售价:${th.data.presellList.presell_price}` | 3415 | + var presell_price = `预售价:${th.data.presellList.presell_price}` |
3411 | context.fillText(presell_price, 40 * unit, 750 * unit); | 3416 | context.fillText(presell_price, 40 * unit, 750 * unit); |
3412 | context.setFillStyle("black") | 3417 | context.setFillStyle("black") |
3413 | context.setFontSize(22 * unit) | 3418 | context.setFontSize(22 * unit) |
3414 | context.fillText("特惠好物,限时预售", 40 * unit, 800 * unit); | 3419 | context.fillText("特惠好物,限时预售", 40 * unit, 800 * unit); |
3415 | context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 840 * unit); | 3420 | context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 840 * unit); |
3416 | 3421 | ||
3417 | - //---二维吗图--- | 3422 | + //---二维吗图--- |
3418 | //-- 自定义海报 -- | 3423 | //-- 自定义海报 -- |
3419 | if (th.data.poster) { | 3424 | if (th.data.poster) { |
3420 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; | 3425 | var erm_x = parseFloat(th.data.poster.ewm_x) * 2; |
@@ -3523,7 +3528,7 @@ Page({ | @@ -3523,7 +3528,7 @@ Page({ | ||
3523 | } | 3528 | } |
3524 | }); | 3529 | }); |
3525 | }, | 3530 | }, |
3526 | - //--定义的保存图片方法,分享团--- | 3531 | + //--定义的保存图片方法,分享团--- |
3527 | saveImageToPhotosAlbumDef: function () { | 3532 | saveImageToPhotosAlbumDef: function () { |
3528 | //--先判断会员状态-- | 3533 | //--先判断会员状态-- |
3529 | var user_info = getApp().globalData.userInfo; | 3534 | var user_info = getApp().globalData.userInfo; |
@@ -3867,6 +3872,7 @@ Page({ | @@ -3867,6 +3872,7 @@ Page({ | ||
3867 | }); | 3872 | }); |
3868 | } | 3873 | } |
3869 | }, | 3874 | }, |
3875 | + | ||
3870 | //--获取商品图片的本地缓存,回调写法-- | 3876 | //--获取商品图片的本地缓存,回调写法-- |
3871 | get_goods_temp: function (tt) { | 3877 | get_goods_temp: function (tt) { |
3872 | var ee = this; | 3878 | var ee = this; |
@@ -4635,6 +4641,11 @@ Page({ | @@ -4635,6 +4641,11 @@ Page({ | ||
4635 | url+="&groupchat_id="+getApp().globalData.groupchat_id | 4641 | url+="&groupchat_id="+getApp().globalData.groupchat_id |
4636 | } | 4642 | } |
4637 | let img = this.data.data.original_img; | 4643 | let img = this.data.data.original_img; |
4644 | + //如果活动有设置分享图的时候 | ||
4645 | + if(this.data.presellForm.share_img){ | ||
4646 | + img = this.data.iurl+this.data.presellForm.share_img; | ||
4647 | + } | ||
4648 | + | ||
4638 | return { | 4649 | return { |
4639 | title: this.data.data.goods_name + '-' + store_name, | 4650 | title: this.data.data.goods_name + '-' + store_name, |
4640 | query: 'first_leader='+user_id+url, | 4651 | query: 'first_leader='+user_id+url, |
packageD/pages/user/integral/integral.js
@@ -34,27 +34,60 @@ Page({ | @@ -34,27 +34,60 @@ Page({ | ||
34 | iurl: o.imghost, | 34 | iurl: o.imghost, |
35 | 35 | ||
36 | is_show_jfcz:0, | 36 | is_show_jfcz:0, |
37 | + tab:0, | ||
38 | + is_no_more_e:0, //充值使用 | ||
39 | + current_page_e:0, //充值使 | ||
40 | + is_loading:0, //避免重复request请求 | ||
41 | + is_loading_c:0 //避免重复request请求 | ||
37 | }, | 42 | }, |
38 | /** | 43 | /** |
39 | * 刷出积分劵 | 44 | * 刷出积分劵 |
40 | */ | 45 | */ |
41 | async exchange() { | 46 | async exchange() { |
42 | - var e = this, result; | 47 | + |
48 | + if (this.data.is_no_more_e) return; | ||
49 | + if (this.data.is_loading_c) return; | ||
50 | + this.data.current_page_e++; | ||
51 | + this.data.is_loading_c=1; | ||
52 | + | ||
53 | + var e = this, result=[]; | ||
43 | var user_id = getApp().globalData.user_id; | 54 | var user_id = getApp().globalData.user_id; |
44 | var store_id = os.stoid; | 55 | var store_id = os.stoid; |
45 | var get_data = { | 56 | var get_data = { |
46 | user_id: user_id, store_id: store_id, | 57 | user_id: user_id, store_id: store_id, |
47 | - pageSize: 10, page: e.data.current_page | 58 | + pageSize: 10, page: e.data.current_page_e |
48 | ///api/weshop/users/listExchangeCoupons | 59 | ///api/weshop/users/listExchangeCoupons |
49 | }; //api/index/yuck | 60 | }; //api/index/yuck |
61 | + | ||
62 | + wx.showLoading(); | ||
50 | await getApp().request.promiseGet("/api/weshop/users/listExchangeCoupons", { | 63 | await getApp().request.promiseGet("/api/weshop/users/listExchangeCoupons", { |
51 | data:get_data | 64 | data:get_data |
52 | }).then(res => { | 65 | }).then(res => { |
53 | - var msg = res.data; | ||
54 | - result = msg.data.pageData; | 66 | + |
67 | + wx.hideLoading(); | ||
68 | + e.data.is_loading_c=0; | ||
69 | + if(ut.ajax_ok(res)){ | ||
70 | + var msg = res.data; | ||
71 | + let result2 = msg.data.pageData; | ||
72 | + let arr=e.data.result; | ||
73 | + result = arr.concat(result2); | ||
74 | + | ||
75 | + //-- 显示没有更多的优化 -- | ||
76 | + if (msg.data.total <=10*e.data.current_page_e) { | ||
77 | + e.setData({ | ||
78 | + is_no_more_e: 1 | ||
79 | + }) | ||
80 | + } | ||
81 | + | ||
82 | + }else{ | ||
83 | + e.setData({ | ||
84 | + is_no_more_e: 1 | ||
85 | + }) | ||
86 | + } | ||
87 | + | ||
55 | }) | 88 | }) |
56 | e.setData({ | 89 | e.setData({ |
57 | - result: result | 90 | + result: result,is_get_c:1 |
58 | }) | 91 | }) |
59 | 92 | ||
60 | }, | 93 | }, |
@@ -63,36 +96,57 @@ Page({ | @@ -63,36 +96,57 @@ Page({ | ||
63 | */ | 96 | */ |
64 | async detaileds() { | 97 | async detaileds() { |
65 | if (this.data.is_no_more) return; | 98 | if (this.data.is_no_more) return; |
99 | + if (this.data.is_loading) return; | ||
66 | this.data.current_page++; | 100 | this.data.current_page++; |
101 | + this.data.is_loading=1; | ||
102 | + | ||
67 | var e = this, details; | 103 | var e = this, details; |
68 | var user_id = getApp().globalData.user_id; | 104 | var user_id = getApp().globalData.user_id; |
69 | var store_id = os.stoid; | 105 | var store_id = os.stoid; |
70 | var get_data = { | 106 | var get_data = { |
71 | user_id: user_id, store_id: store_id, | 107 | user_id: user_id, store_id: store_id, |
72 | - pageSize: 10, page: e.data.current_page | 108 | + pageSize: 15, page: e.data.current_page |
73 | }; | 109 | }; |
74 | var big_arr = this.data.details; | 110 | var big_arr = this.data.details; |
111 | + | ||
112 | + wx.showLoading(); | ||
113 | + | ||
75 | await getApp().request.promiseGet("/api/weshop/users/listPoints", { | 114 | await getApp().request.promiseGet("/api/weshop/users/listPoints", { |
76 | data: get_data | 115 | data: get_data |
77 | }).then(res => { | 116 | }).then(res => { |
78 | 117 | ||
79 | - var msg = res.data; | ||
80 | - if(!msg || !msg.data.pageData || msg.data.pageData.length == 0){ | ||
81 | - this.data.is_no_more = 1; | ||
82 | - getApp().showWarning("未找更多数据"); | ||
83 | - return false; | 118 | + wx.hideLoading(); |
119 | + e.data.is_loading=0; | ||
120 | + | ||
121 | + if(ut.ajax_ok(res)){ | ||
122 | + var msg = res.data; | ||
123 | + | ||
124 | + details = msg.data.pageData; | ||
125 | + details.forEach(function (val, ind) { | ||
126 | + big_arr.push(val); | ||
127 | + }) | ||
128 | + | ||
129 | + //-- 显示没有更多的优化 -- | ||
130 | + if (msg.data.total <=15*e.data.current_page) { | ||
131 | + e.setData({ | ||
132 | + is_no_more: 1 | ||
133 | + }) | ||
134 | + } | ||
135 | + }else{ | ||
136 | + e.setData({ | ||
137 | + is_no_more: 1 | ||
138 | + }) | ||
84 | } | 139 | } |
85 | 140 | ||
86 | - details = msg.data.pageData; | ||
87 | - details.forEach(function (val, ind) { | ||
88 | - big_arr.push(val); | ||
89 | - }) | ||
90 | - setTimeout(() => { | ||
91 | - this.setData({ | ||
92 | - details: big_arr | ||
93 | - }); | ||
94 | - }, 1500) | 141 | + |
142 | + | ||
95 | }) | 143 | }) |
144 | + | ||
145 | + | ||
146 | + this.setData({ | ||
147 | + details: big_arr,is_get_d:1 | ||
148 | + }); | ||
149 | + | ||
96 | var get_datas= { | 150 | var get_datas= { |
97 | user_id: user_id, store_id: store_id, | 151 | user_id: user_id, store_id: store_id, |
98 | }; | 152 | }; |
@@ -105,11 +159,18 @@ Page({ | @@ -105,11 +159,18 @@ Page({ | ||
105 | this.setData({number: integrals}) | 159 | this.setData({number: integrals}) |
106 | }) | 160 | }) |
107 | 161 | ||
162 | + | ||
163 | + | ||
108 | }, | 164 | }, |
109 | //---加载更多是靠这个函数---- | 165 | //---加载更多是靠这个函数---- |
110 | onReachBottom: function () { | 166 | onReachBottom: function () { |
111 | - console.log("加载跟多"); | ||
112 | - this.detaileds(); | 167 | + //0是积分明细 1是积分充值 |
168 | + if(this.data.currentTab==0){ | ||
169 | + this.detaileds(); | ||
170 | + }else{ | ||
171 | + this.exchange(); | ||
172 | + } | ||
173 | + | ||
113 | 174 | ||
114 | }, | 175 | }, |
115 | //积分弹框控制器 | 176 | //积分弹框控制器 |
@@ -180,14 +241,14 @@ Page({ | @@ -180,14 +241,14 @@ Page({ | ||
180 | console.log("积分明细", e.target.dataset.current); | 241 | console.log("积分明细", e.target.dataset.current); |
181 | var jfmx=true; | 242 | var jfmx=true; |
182 | var jfcz= false; | 243 | var jfcz= false; |
183 | - this.setData({ jfmx: jfmx, jfcz: jfcz, current_page: 0,details:[] }); | 244 | + this.setData({ jfmx: jfmx, jfcz: jfcz, current_page: 0,details:[],is_get_d:0,is_no_more:0 }); |
184 | this.detaileds(); | 245 | this.detaileds(); |
185 | }else{ | 246 | }else{ |
186 | if(this.data.is_show_jfcz) { | 247 | if(this.data.is_show_jfcz) { |
187 | console.log("积分充值", e.target.dataset.current); | 248 | console.log("积分充值", e.target.dataset.current); |
188 | var jfmx = false; | 249 | var jfmx = false; |
189 | var jfcz = true; | 250 | var jfcz = true; |
190 | - this.setData({jfmx: jfmx, jfcz: jfcz, current_page:1,result:[] }); | 251 | + this.setData({jfmx: jfmx, jfcz: jfcz, current_page_e:0,result:[],is_get_c:0,is_no_more_e:0}); |
191 | this.exchange(); | 252 | this.exchange(); |
192 | }else{ | 253 | }else{ |
193 | return false; | 254 | return false; |
@@ -211,19 +272,25 @@ Page({ | @@ -211,19 +272,25 @@ Page({ | ||
211 | //定义第一次进入 | 272 | //定义第一次进入 |
212 | this.data.fir_in=1; | 273 | this.data.fir_in=1; |
213 | 274 | ||
214 | - var th=this; | ||
215 | - getApp().request.get("/api/wx/weappSendlist/page", { | ||
216 | - data: { | ||
217 | - store_id: os.stoid, | ||
218 | - typeid: "1002" | ||
219 | - }, | ||
220 | - success: function(res) { | ||
221 | - if (res.data.code == 0 && res.data.data.pageData.length > 0) { | ||
222 | - var template_id = res.data.data.pageData[0].template_id; | ||
223 | - th.setData({template_id:template_id}); | ||
224 | - } | ||
225 | - } | ||
226 | - }); | 275 | + var th=this; |
276 | + getApp().request.get("/api/wx/weappSendlist/page", { | ||
277 | + data: { | ||
278 | + store_id: os.stoid, | ||
279 | + typeid: "1002" | ||
280 | + }, | ||
281 | + success: function(res) { | ||
282 | + if (res.data.code == 0 && res.data.data.pageData.length > 0) { | ||
283 | + var template_id = res.data.data.pageData[0].template_id; | ||
284 | + th.setData({template_id:template_id}); | ||
285 | + } | ||
286 | + } | ||
287 | + }); | ||
288 | + | ||
289 | + if(options.tab==1){ | ||
290 | + th.data.tab=1; | ||
291 | + } | ||
292 | + | ||
293 | + | ||
227 | 294 | ||
228 | 295 | ||
229 | }, | 296 | }, |
@@ -380,18 +447,31 @@ Page({ | @@ -380,18 +447,31 @@ Page({ | ||
380 | return false; | 447 | return false; |
381 | } | 448 | } |
382 | 449 | ||
383 | - this.exchange(); | ||
384 | - this.detaileds(); | ||
385 | wx.setNavigationBarTitle({ | 450 | wx.setNavigationBarTitle({ |
386 | title: "我的积分", | 451 | title: "我的积分", |
387 | }) | 452 | }) |
388 | 453 | ||
454 | + | ||
455 | + if(this.data.has_init) return false; | ||
456 | + this.data.has_init=1; | ||
457 | + | ||
458 | + this.detaileds(); | ||
459 | + | ||
389 | //要实时获取开关是显示 | 460 | //要实时获取开关是显示 |
390 | - var th=this; | ||
391 | - getApp().getConfig2(function(ee){ | 461 | + getApp().getConfig2(function(ee){ |
392 | var json_d = JSON.parse(ee.switch_list); | 462 | var json_d = JSON.parse(ee.switch_list); |
393 | th.setData({ is_show_jfcz: json_d.jfcz_switch }); | 463 | th.setData({ is_show_jfcz: json_d.jfcz_switch }); |
394 | - },1) | 464 | + //-- 如果有开启积分充值,就调用积分充值的界面 -- |
465 | + if(json_d.jfcz_switch && th.data.tab==1 ){ | ||
466 | + th.data.tab=0; | ||
467 | + var jfmx = false; | ||
468 | + var jfcz = true; | ||
469 | + th.setData({jfmx: jfmx, jfcz: jfcz, current_page_e:0,result:[],currentTab:1 }); | ||
470 | + th.exchange(); | ||
471 | + | ||
472 | + } | ||
473 | + | ||
474 | + },1) | ||
395 | 475 | ||
396 | }, | 476 | }, |
397 | 477 |
packageD/pages/user/integral/integral.json
packageD/pages/user/integral/integral.wxml
@@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
30 | </view> | 30 | </view> |
31 | 31 | ||
32 | </view> | 32 | </view> |
33 | - <view wx:if="{{details}}!=[]"> | 33 | + <view wx:if="{{details}}"> |
34 | <block wx:for="{{details}}" wx:for-index="idx" wx:for-item="details"> | 34 | <block wx:for="{{details}}" wx:for-index="idx" wx:for-item="details"> |
35 | <view class="data"> | 35 | <view class="data"> |
36 | <view class="left"> | 36 | <view class="left"> |
@@ -45,6 +45,11 @@ | @@ -45,6 +45,11 @@ | ||
45 | </block> | 45 | </block> |
46 | 46 | ||
47 | </view> | 47 | </view> |
48 | + | ||
49 | + <!-- 暂无数据 --> | ||
50 | + <nodata nodataContainer="t-c" wx:if="{{(is_get_d && details.length == 0)}}"></nodata> | ||
51 | + <view class="noMore" wx:if="{{is_no_more == 1 && details.length>0}}">—— 已经到底了 ——</view> | ||
52 | + | ||
48 | </view> | 53 | </view> |
49 | 54 | ||
50 | <!-- 充值 --> | 55 | <!-- 充值 --> |
@@ -63,6 +68,10 @@ | @@ -63,6 +68,10 @@ | ||
63 | </view> | 68 | </view> |
64 | </block> | 69 | </block> |
65 | 70 | ||
71 | + <!-- 暂无数据 --> | ||
72 | + <nodata nodataContainer="t-c" wx:if="{{is_get_c && result.length == 0}}"></nodata> | ||
73 | + <view class="noMore" wx:if="{{is_no_more_e == 1 && result.length>0}}">—— 已经到底了 ——</view> | ||
74 | + | ||
66 | 75 | ||
67 | <!-- 积分劵的弹框 --> | 76 | <!-- 积分劵的弹框 --> |
68 | <view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view> | 77 | <view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view> |
packageD/pages/user/integral/integral.wxss
@@ -466,4 +466,11 @@ line-height:85rpx; | @@ -466,4 +466,11 @@ line-height:85rpx; | ||
466 | .gd{ | 466 | .gd{ |
467 | color: #999999; | 467 | color: #999999; |
468 | font-size: 25rpx; | 468 | font-size: 25rpx; |
469 | -} | ||
470 | \ No newline at end of file | 469 | \ No newline at end of file |
470 | +} | ||
471 | + | ||
472 | + .noMore { | ||
473 | + padding: 20rpx; | ||
474 | + color: #bbb; | ||
475 | + text-align: center; | ||
476 | + font-size: 22rpx; | ||
477 | + } | ||
471 | \ No newline at end of file | 478 | \ No newline at end of file |
pages/cart/cart/cart.js
@@ -2443,7 +2443,35 @@ Page({ | @@ -2443,7 +2443,35 @@ Page({ | ||
2443 | all_num += item[c].goods_num; | 2443 | all_num += item[c].goods_num; |
2444 | 2444 | ||
2445 | if (item[c].prom_type == 7) { | 2445 | if (item[c].prom_type == 7) { |
2446 | - item[c].act = th.data.zuhe_map[item[c].prom_id]; | 2446 | + item[c].act = th.data.zuhe_map[item[c].prom_id]; |
2447 | + if(item[c].zh_b_num===undefined || item[c].zh_b_num===null ){ | ||
2448 | + var prom_goodsbuynum = 0; | ||
2449 | + //--要获得商品,该用户买了多少件,同步应用,用于限购的计算-- | ||
2450 | + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
2451 | + data: { | ||
2452 | + store_id: oo.stoid, | ||
2453 | + user_id: getApp().globalData.user_id, | ||
2454 | + goods_id: item[c].goods_id, | ||
2455 | + prom_type: item[c].prom_type, | ||
2456 | + prom_id: item[c].prom_id, | ||
2457 | + isnew:1 | ||
2458 | + }, | ||
2459 | + }).then(res => { | ||
2460 | + if(res.data.code==0 && res.data.data) | ||
2461 | + | ||
2462 | + if (res.data.data.promgoodsbuynum) { | ||
2463 | + promgoodsbuynum = res.data.data.promgoodsbuynum; | ||
2464 | + } | ||
2465 | + | ||
2466 | + }) | ||
2467 | + | ||
2468 | + var txt = "requestData[" + a + "].goods[" + c + "].zh_b_num"; | ||
2469 | + th.setData({ | ||
2470 | + [txt]: prom_goodsbuynum | ||
2471 | + }); | ||
2472 | + | ||
2473 | + | ||
2474 | + } | ||
2447 | } | 2475 | } |
2448 | if (item[c].prom_type == 10) { | 2476 | if (item[c].prom_type == 10) { |
2449 | item[c].act = th.data.ladder_map[item[c].prom_id]; | 2477 | item[c].act = th.data.ladder_map[item[c].prom_id]; |
pages/goods/goodsInfo/goodsInfo.js
@@ -1160,12 +1160,7 @@ Page({ | @@ -1160,12 +1160,7 @@ Page({ | ||
1160 | // } | 1160 | // } |
1161 | 1161 | ||
1162 | 1162 | ||
1163 | - //一件代发商品不去计算优惠 | ||
1164 | - //if (!ee.data.fir_goods.whsle_id && ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) { | ||
1165 | - if (!ee.data.fir_goods.whsle_id && ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) { | ||
1166 | - ee.check_is_youhui(ee.data.gid); | ||
1167 | - } | ||
1168 | - | 1163 | + |
1169 | t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); | 1164 | t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); |
1170 | 1165 | ||
1171 | var cur_price = t.data.data.shop_price; | 1166 | var cur_price = t.data.data.shop_price; |
@@ -1207,6 +1202,12 @@ Page({ | @@ -1207,6 +1202,12 @@ Page({ | ||
1207 | front_g: ut.deep_cp(t.data.data), | 1202 | front_g: ut.deep_cp(t.data.data), |
1208 | }); | 1203 | }); |
1209 | 1204 | ||
1205 | + //一件代发商品不去计算优惠 | ||
1206 | + //if (!ee.data.fir_goods.whsle_id && ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) { | ||
1207 | + if (!ee.data.fir_goods.whsle_id && ee.data.prom_type != 1 && ee.data.prom_type != 4 && ee.data.prom_type != 6 && ee.data.prom_type != 2) { | ||
1208 | + ee.check_is_youhui(ee.data.gid); | ||
1209 | + } | ||
1210 | + | ||
1210 | //获取统一条形码,普通商品和优惠促销的商品 | 1211 | //获取统一条形码,普通商品和优惠促销的商品 |
1211 | if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7 || ee.data.data.prom_type == 9 || ee.data.data.prom_type == 10) { | 1212 | if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7 || ee.data.data.prom_type == 9 || ee.data.data.prom_type == 10) { |
1212 | ee.get_sto(); | 1213 | ee.get_sto(); |
@@ -3474,7 +3475,9 @@ Page({ | @@ -3474,7 +3475,9 @@ Page({ | ||
3474 | break | 3475 | break |
3475 | } | 3476 | } |
3476 | } | 3477 | } |
3478 | + | ||
3477 | console.log(item, 2000); | 3479 | console.log(item, 2000); |
3480 | + | ||
3478 | var cur_price = item.shop_price; | 3481 | var cur_price = item.shop_price; |
3479 | if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) { | 3482 | if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) { |
3480 | var cfile = getApp().globalData.userInfo.card_field; | 3483 | var cfile = getApp().globalData.userInfo.card_field; |
pages/user/my_service/i_service.js
@@ -23,6 +23,7 @@ Page({ | @@ -23,6 +23,7 @@ Page({ | ||
23 | ismore: 0, //是否加载完毕 | 23 | ismore: 0, //是否加载完毕 |
24 | userinfo: null, | 24 | userinfo: null, |
25 | is_sub: 0, //是否重复提交预约 | 25 | is_sub: 0, //是否重复提交预约 |
26 | + | ||
26 | }, | 27 | }, |
27 | 28 | ||
28 | /** | 29 | /** |
@@ -39,6 +40,12 @@ Page({ | @@ -39,6 +40,12 @@ Page({ | ||
39 | }); | 40 | }); |
40 | var th = this; | 41 | var th = this; |
41 | th.query_service(); | 42 | th.query_service(); |
43 | + | ||
44 | + //顶部的高度 | ||
45 | + var h1=getApp().globalData.navBarHeight>0?getApp().globalData.navBarHeight:0; | ||
46 | + this.setData({navBarHeight:h1}) | ||
47 | + | ||
48 | + | ||
42 | }, | 49 | }, |
43 | /** | 50 | /** |
44 | * 生命周期函数--监听页面显示 | 51 | * 生命周期函数--监听页面显示 |
pages/user/my_service/i_service.wxml
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | 3 | ||
4 | <!-- 背景图片 --> | 4 | <!-- 背景图片 --> |
5 | <view catchtap="close"> | 5 | <view catchtap="close"> |
6 | - <image class="backimage" src="{{iurl}}/miniapp/images/yyservice/backimage.png" lazy-load="true"/> | 6 | + <image class="backimage" style="top:{{navBarHeight}}px" mode="widthFix" src="{{iurl}}/miniapp/images/yyservice/backimage.png" lazy-load="true"/> |
7 | <view class="flex jc_sb pd20"> | 7 | <view class="flex jc_sb pd20"> |
8 | <navigator class="fs26 white" url="/packageA/pages/service_record/service_record">服务记录</navigator> | 8 | <navigator class="fs26 white" url="/packageA/pages/service_record/service_record">服务记录</navigator> |
9 | <navigator class="fs26 white" url="/packageG/pages/user/my_service/hist_service">历史预约</navigator> | 9 | <navigator class="fs26 white" url="/packageG/pages/user/my_service/hist_service">历史预约</navigator> |
pages/user/order_detail/order_detail.js
@@ -844,6 +844,28 @@ Page({ | @@ -844,6 +844,28 @@ Page({ | ||
844 | } | 844 | } |
845 | } | 845 | } |
846 | 846 | ||
847 | + //阶梯促销获取取价规则 | ||
848 | + if(gg.prom_type==10){ | ||
849 | + var prom_ld=null; | ||
850 | + //-- 获取阶梯规则 -- | ||
851 | + var url1 = "/api/weshop/prom/ladderList/list"; | ||
852 | + var req_data = { | ||
853 | + store_id: os.stoid, | ||
854 | + form_id: gg.prom_id, | ||
855 | + } | ||
856 | + await getApp().request.promiseGet(url1, { | ||
857 | + data: req_data | ||
858 | + }).then(rs1 => { | ||
859 | + if (rs1.data.code == 0 && rs1.data.data && rs1.data.data.length ) { | ||
860 | + prom_ld = rs1.data.data[0]; | ||
861 | + } | ||
862 | + }) | ||
863 | + | ||
864 | + if(prom_ld){ | ||
865 | + gg.discount_field=prom_ld.discount_field; | ||
866 | + } | ||
867 | + } | ||
868 | + | ||
847 | if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9) | 869 | if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9) |
848 | && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) { | 870 | && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) { |
849 | var prom = null; | 871 | var prom = null; |
@@ -1122,7 +1144,7 @@ Page({ | @@ -1122,7 +1144,7 @@ Page({ | ||
1122 | if (!good.is_gift && !good.is_collocation && gg.prom_type != 9) { | 1144 | if (!good.is_gift && !good.is_collocation && gg.prom_type != 9) { |
1123 | 1145 | ||
1124 | //-- 优惠促销的时候控制取价规则 -- | 1146 | //-- 优惠促销的时候控制取价规则 -- |
1125 | - if(gg.prom_type!=3 || gg.discount_field==undefined || gg.discount_field==0 ) { | 1147 | + if((gg.prom_type!=3 && gg.prom_type!=10) || gg.discount_field==undefined || gg.discount_field==0 ) { |
1126 | if (card_field && gg[card_field] > 0) { | 1148 | if (card_field && gg[card_field] > 0) { |
1127 | if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0; | 1149 | if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0; |
1128 | if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | 1150 | if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 |
@@ -1132,7 +1154,7 @@ Page({ | @@ -1132,7 +1154,7 @@ Page({ | ||
1132 | if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | 1154 | if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 |
1133 | } | 1155 | } |
1134 | }else{ | 1156 | }else{ |
1135 | - if(good.prom_type==3){ | 1157 | + if(good.prom_type==3 && good.prom_type==10){ |
1136 | switch (gg.discount_field){ | 1158 | switch (gg.discount_field){ |
1137 | case 1: | 1159 | case 1: |
1138 | if (good.goods_price != gg.shop_price) isok = 0; | 1160 | if (good.goods_price != gg.shop_price) isok = 0; |
pages/user/order_list/order_list.js
@@ -1125,6 +1125,7 @@ Page({ | @@ -1125,6 +1125,7 @@ Page({ | ||
1125 | }) | 1125 | }) |
1126 | 1126 | ||
1127 | 1127 | ||
1128 | + //优惠促销获取取价规则 | ||
1128 | if(gg.prom_type==3){ | 1129 | if(gg.prom_type==3){ |
1129 | var prom_pc=null; | 1130 | var prom_pc=null; |
1130 | await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { | 1131 | await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { |
@@ -1136,6 +1137,27 @@ Page({ | @@ -1136,6 +1137,27 @@ Page({ | ||
1136 | } | 1137 | } |
1137 | } | 1138 | } |
1138 | 1139 | ||
1140 | + //阶梯促销获取取价规则 | ||
1141 | + if(gg.prom_type==10){ | ||
1142 | + var prom_ld=null; | ||
1143 | + //-- 获取阶梯规则 -- | ||
1144 | + var url1 = "/api/weshop/prom/ladderList/list"; | ||
1145 | + var req_data = { | ||
1146 | + store_id: os.stoid, | ||
1147 | + form_id: gg.prom_id, | ||
1148 | + } | ||
1149 | + await getApp().request.promiseGet(url1, { | ||
1150 | + data: req_data | ||
1151 | + }).then(rs1 => { | ||
1152 | + if (rs1.data.code == 0 && rs1.data.data && rs1.data.data.length ) { | ||
1153 | + prom_ld = rs1.data.data[0]; | ||
1154 | + } | ||
1155 | + }) | ||
1156 | + | ||
1157 | + if(prom_ld){ | ||
1158 | + gg.discount_field=prom_ld.discount_field; | ||
1159 | + } | ||
1160 | + } | ||
1139 | 1161 | ||
1140 | if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9) | 1162 | if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9) |
1141 | && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) { | 1163 | && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) { |
@@ -1417,7 +1439,7 @@ Page({ | @@ -1417,7 +1439,7 @@ Page({ | ||
1417 | 1439 | ||
1418 | 1440 | ||
1419 | //-- 优惠促销的时候控制取价规则 -- | 1441 | //-- 优惠促销的时候控制取价规则 -- |
1420 | - if(gg.prom_type!=3 || gg.discount_field==undefined || gg.discount_field==0 ){ | 1442 | + if( (gg.prom_type!=3 && gg.prom_type!=10 ) || gg.discount_field==undefined || gg.discount_field==0 ){ |
1421 | if (card_field && gg[card_field] > 0) { | 1443 | if (card_field && gg[card_field] > 0) { |
1422 | if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0; | 1444 | if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0; |
1423 | if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | 1445 | if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 |
@@ -1428,7 +1450,7 @@ Page({ | @@ -1428,7 +1450,7 @@ Page({ | ||
1428 | } | 1450 | } |
1429 | }else{ | 1451 | }else{ |
1430 | 1452 | ||
1431 | - if(good.prom_type==3){ | 1453 | + if(good.prom_type==3 || good.prom_type==10 ){ |
1432 | switch (gg.discount_field){ | 1454 | switch (gg.discount_field){ |
1433 | case 1: | 1455 | case 1: |
1434 | if (good.goods_price != gg.shop_price) isok = 0; | 1456 | if (good.goods_price != gg.shop_price) isok = 0; |