Commit c7a4224daa691f0780c75779e171af763dc4499f

Authored by yvan.ni
1 parent 3f3bc4b2

等级卡购买~~

images/share/mackground.png 0 → 100644

10.4 KB

pages/user/Detailed/Detailed.js
... ... @@ -19,19 +19,93 @@ Page({
19 19 isDetailed: 0,
20 20 total: 0,
21 21 ismore: 0,//数据是否加载完毕
  22 + screenWidth:0,
  23 +
  24 + head_pic:"",//会员头像
  25 + img_money:"",//缓存VIP的图片
  26 + img_Ancrown:"",//会员权益
  27 + img_Identification:"",//缓存标识的图片
  28 + img_square:"",//缓存方块的图片
  29 + privilege_o:"",//卡的勋章图
  30 + bas_ming:"", //卡的图片
  31 + big_card:null, //最大卡的信息
  32 +
  33 + imagePath:"", //分享的生成图片
  34 +
  35 + canvasHidden:true,
22 36 },
23 37  
24 38 /**
25 39 * 生命周期函数--监听页面加载
26 40 */
27 41 onLoad: function(options) {
28   - var img_money = url + "/miniapp/images/plus/share/money.png";
29   - var img_Ancrown = url + "/miniapp/images/plus/share/Ancrown.png";
30   - var img_Identification = url + "/miniapp/images/plus/share/Identification.png";
31   - var img_square = url + "/miniapp/images/plus/share/square.png";
32   - var privilege_o = url + "/miniapp/images/plus/share/privilege_o.png";
  42 + var ee=this;
  43 + var img_money = this.data.url + "/miniapp/images/plus/share/money.png";
  44 + var img_Ancrown = this.data.url + "/miniapp/images/plus/share/Ancrown.png";
  45 + var img_Identification = this.data.url + "/miniapp/images/plus/share/Identification.png";
  46 + var img_square = this.data.url + "/miniapp/images/plus/share/square.png";
  47 + var privilege_o = this.data.url + "/miniapp/images/plus/share/privilege_o.png";
  48 + var user=getApp().globalData.userInfo;
  49 + //--获取用户设备信息,屏幕宽度--
  50 + wx.getSystemInfo({
  51 + success: res => {
  52 + ee.data.screenWidth=res.screenWidth;
  53 + }
  54 + })
  55 +
  56 + //--------------------缓存vip价格的图片---------------
  57 + wx.getImageInfo({
  58 + src:img_money,
  59 + success: function (res) {
  60 + //回调写法
  61 + var img_money = res.path;
  62 + ee.setData({ img_money: img_money});
  63 + }
  64 + })
  65 + //--------------------缓存权益的图片---------------
  66 + wx.getImageInfo({
  67 + src: img_Ancrown,
  68 + success: function (res) {
  69 + //回调写法
  70 + var img_Ancrown = res.path;
  71 + ee.setData({ img_Ancrown: img_Ancrown });
  72 + }
  73 + })
  74 + //--------------------缓存标识的图片---------------
  75 + wx.getImageInfo({
  76 + src: img_Identification,
  77 + success: function (res) {
  78 + //回调写法
  79 + var img_Identification = res.path;
  80 + ee.setData({ img_Identification: img_Identification });
  81 + }
  82 + })
  83 +
  84 + //--------------------卡的勋章---------------
  85 + wx.getImageInfo({
  86 + src: privilege_o,
  87 + success: function (res) {
  88 + //回调写法
  89 + var privilege_o = res.path;
  90 + ee.setData({ privilege_o: privilege_o });
  91 + }
  92 + })
  93 +
  94 + //--------------------方块图---------------
  95 + wx.getImageInfo({
  96 + src: img_square,
  97 + success: function (res) {
  98 + //回调写法
  99 + var img_square = res.path;
  100 + ee.setData({ img_square: img_square});
  101 + }
  102 + })
  103 +
  104 + //-----------获取最大值的卡--------------
  105 + ee.getPlusCardType();
33 106  
34 107 },
  108 +
35 109 selectDetailed: function() {
36 110 var th = this, e = th;
37 111 getApp().request.promiseGet("/api/weshop/plus/vip/mem/referee/page", {
... ... @@ -49,10 +123,8 @@ Page({
49 123 var arr1 = th.data.arrayDetailed;//获取明细数组
50 124 var arr2 = res.data.data.pageData;//获取当前查询数据
51 125 var arr3 = [...arr1, ...arr2];//把当前查询数组拼接到原本数组后面
52   -
53 126 var ismore = 0;
54 127 if (arr3.length == res.data.data.total) ismore = 1 //数据已加载完判断
55   -
56 128 th.setData({
57 129 arrayDetailed: arr3,
58 130 total: res.data.data.total,
... ... @@ -60,9 +132,8 @@ Page({
60 132 isDetailed: 1
61 133 })
62 134 }
63   - }),
64   - wx.stopPullDownRefresh();
65   -
  135 + })
  136 +
66 137 },
67 138 /**
68 139 * 生命周期函数--监听页面初次渲染完成
... ... @@ -93,237 +164,275 @@ Page({
93 164  
94 165 saveImageToPhotosAlbum: function () {
95 166 if (this.data.imagePath != "") {
96   - wx.previewImage({
97   - urls: [this.data.imagePath],
98   - })
  167 + wx.previewImage({ urls: [this.data.imagePath], })
99 168 return;
100 169 }
101   - // if(this.data.is_loading) return false ;
102   - this.data.is_loading=1;
103   -
104   - wx.showLoading({
105   - title: '生成中...',
106   - })
107   -
108   - this.setData({
109   - canvasHidden: false
110   - })
  170 +
  171 + this.data.is_loading=1;
  172 + wx.showLoading({ title: '生成中...',})
111 173  
112 174 var th = this;
  175 +
113 176 //设置画板显示,才能开始绘图
114 177 var card_ming=th.data.bas_ming;//卡的图片
115   - var user = th.data.user;//会员资料;
116 178 var big_card= th.data.big_card;//获取最大的卡
117 179 var user_head = th.data.head_pic;//会员头像
118 180 var img_money = th.data.img_money;//缓存vip的价格
119 181 var img_Ancrown = th.data.img_Ancrown;//会员权益的图片
120 182 var img_Identification = th.data.img_Identification;//会员标识
121 183 var privilege_o = th.data.privilege_o;//勋章图片
122   - var img_square=th.data.img_square;
123   -
  184 + var img_square=th.data.img_square;
124 185 var app = getApp();
  186 + var user=app.globalData.userInfo;
125 187 var unit = th.data.screenWidth / 750 * 1.35;
126 188 var scene = getApp().globalData.user_id;
127   - console.log("用户头像", th.data.head_pic);
128   - ///二微码
129 189  
  190 + //---二微码---
130 191 var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
131 192 os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/index/index";
132   - wx.getImageInfo({
  193 +
  194 + wx.getImageInfo({
133 195 src: path3,
134   - success: function (res) {
135   - //回调写法
136   - th.get_head_temp(th.get_goods_temp, function () {
137   - var vpath=res.path;
138   -
139   - console.log("生成二维码", path3);
140   - //开启画布
141   - const ctx = wx.createCanvasContext('myCanvas');
142   -
143   - //先画背景
144   - ctx.drawImage("../../../images/plus/share/mackground.png", 0, 0, 554 * unit, 930 * unit);
145   - ctx.setFontSize(26 * unit);
146   - ctx.setFillStyle("rgb(0,0,0)");
147   - ctx.fillText(user.nickname, 155 * unit, 75 * unit, 200 * unit);
148   -
149   - var tj_path = "../../../images/userinfo/q_tj.png";
150   - ctx.drawImage(tj_path, 385 * unit, 45 * unit, 90 * unit, 30 * unit);
151   - ctx.setFontSize(18 * unit);
152   - ctx.setFillStyle("rgb(255,255,255)");
153   - ctx.fillText("强烈推荐", 394 * unit, 65 * unit);
154   -
155   - ctx.setStrokeStyle("rgb(255,255,255)");
156   - ctx.setLineDash([5 * unit, 5 * unit], 5 * unit);
157   - ctx.beginPath();
158   - ctx.moveTo(0, 125 * unit);
159   - ctx.lineTo(554 * unit, 125 * unit);
160   - ctx.stroke();
161   -
162   - var x = 55 * unit, y = 165 * unit,w = 444 * unit, h = 220 * unit,r = 14 * unit;
163   - ut.draw_randon_rect(ctx,x,y,r,w,h);
164   - ctx.clip(); //画了圆 再剪切 原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内
165   - ctx.drawImage(card_ming, x, y, 444 * unit, 220 * unit); // 推进去图片
166   - ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
167   -
168   - ctx.beginPath();
169   - // 卡图片
170   - // ctx.drawImage("../../../images/plus/share/one.jpg", 55 * unit, 165 * unit, 444 * unit, 220 * unit,);
171   - ctx.setFontSize(26 * unit);
172   - ctx.setFillStyle('rgb(218,194,169)');
173   - ctx.fillText(big_card.CardName, 80 * unit, 215 * unit);
174   - ctx.setFontSize(18 * unit);
175   - ctx.setFillStyle('rgb(218,194,169)');
176   - ctx.fillText("开通会员年卡仅" + big_card.CardFee+"元", 80 * unit, 240 * unit);
177   -
178   - ctx.drawImage(privilege_o, 80 * unit, 343 * unit, 20 * unit, 20 * unit);
179   -
180   - ctx.setFontSize(14 * unit);
181   - ctx.setFillStyle('rgb(218,194,169)');
182   - ctx.fillText("根据大家购买数据,您成为超级会员预计可省¥3031元", 105 * unit, 360 * unit);
183   -
184   - ctx.rect(70 * unit, 425 * unit, 182 * unit, 1 * unit);
185   - ctx.setFillStyle('rgb(218,194,169)');
186   - ctx.fill();
187   -
188   - ctx.drawImage(img_square, 267 * unit, 420 * unit, 13 * unit, 13 * unit);
189   -
190   - ctx.beginPath();
191   - ctx.rect(295 * unit, 425 * unit, 182 * unit, 1 * unit);
192   - ctx.setFillStyle('rgb(218,194,169)');
193   - ctx.fill();
194   -
195   - ctx.drawImage(img_square, 80 * unit, 470 * unit, 10 * unit, 10 * unit);
196   - ctx.setFontSize(24 * unit);
197   - ctx.setFillStyle("rgb(198,165,126)");
198   - ctx.fillText("超级VIP权益", 100 * unit, 475 * unit);
199   -
200   - ctx.setFontSize(20 * unit);
201   - ctx.setFillStyle("rgb(198,165,126)");
202   - ctx.fillText("超级会员专属权益", 100 * unit, 505 * unit);
203   - ctx.drawImage(img_Ancrown, 355 * unit, 440 * unit, 65 * unit, 65 * unit);
204   -
205   - ctx.rect(85 * unit, 530 * unit, 375 * unit, 1 * unit)
206   - ctx.setFillStyle('rgb(218,194,169)')
207   - ctx.fill();
208   -
209   - ctx.drawImage(img_square, 80 * unit, 575 * unit, 10 * unit, 10 * unit);
210   - ctx.setFontSize(24 * unit);
211   - ctx.setFillStyle("rgb(198,165,126)");
212   - ctx.fillText("超级VIP标识", 100 * unit, 580 * unit);
213   -
214   - ctx.setFontSize(20 * unit);
215   - ctx.setFillStyle("rgb(198,165,126)");
216   - ctx.fillText("彰显尊贵身份的象征", 100 * unit, 610 * unit);
217   - ctx.drawImage(img_Identification, 355 * unit, 548 * unit, 65 * unit, 65 * unit);
218   -
219   - ctx.rect(85 * unit, 635 * unit, 375 * unit, 1 * unit);
220   - ctx.setFillStyle('rgb(218,194,169)');
221   - ctx.fill();
222   -
223   - ctx.drawImage(img_square, 80 * unit, 695 * unit, 10 * unit, 10 * unit);
224   - ctx.setFontSize(24 * unit);
225   - ctx.setFillStyle("rgb(198,165,126)");
226   - ctx.fillText("超级VIP价格", 100 * unit, 695 * unit);
227   -
228   - ctx.setFontSize(20 * unit);
229   - ctx.setFillStyle("rgb(198,165,126)");
230   - ctx.fillText("享受专属会员超低价", 100 * unit, 725 * unit);
231   - ctx.drawImage(img_money, 355 * unit, 660 * unit, 65 * unit, 65 * unit);
232   -
233   - ctx.rect(85 * unit, 750 * unit, 375 * unit, 1 * unit)
234   - ctx.setFillStyle('rgb(218,194,169)')
235   - ctx.fill();
236   -
237   - ctx.drawImage(vpath, 100 * unit, 780 * unit, 110 * unit, 110 * unit);
238   -
239   - ctx.setFontSize(20 * unit);
240   - ctx.setFillStyle("#000");
241   - ctx.fillText("解锁新权益 精彩享不停", 230 * unit, 825 * unit);
242   -
243   - ctx.setFontSize(20 * unit);
244   - ctx.setFillStyle("#000");
245   - ctx.fillText("长按识别二维码,立即开通!", 230 * unit, 865 * unit);
246   -
247   - //---绘制圆形要放在最后----
248   - ctx.save();
249   - ctx.beginPath();
250   - var h_x = 60 * unit;
251   - var h_y = 24 * unit;
252   - var h_r = 40 * unit;
253   - var cx = h_x + h_r;
254   - var cy = h_y + h_r;
255   - ctx.arc(cx, cy, h_r, 0, Math.PI * 2, false);
256   - ctx.closePath();
257   - ctx.fill();
258   - ctx.clip();
259   - ctx.drawImage(th.data.head_pic, h_x, h_y, h_r * 2, h_r * 2);
260   - ctx.restore();
261   -
262   - x = 345 * unit,
263   - y = 190 * unit,
264   - w = 105 * unit,
265   - h = 30 * unit,
266   - r = 14 * unit;
267   - ut.draw_randon_rect(ctx,x,y,r,w,h);
268   - ctx.setFontSize(18 * unit);
269   - ctx.setFillStyle("#000");
270   - ctx.fillText("立即开通", 362 * unit, 212 * unit);
271   -
272   -
273   -
274   - //绘制图片
275   - ctx.draw(false,
276   -
277   - function(){
278   -
279   - setTimeout(function(){
280   - wx.canvasToTempFilePath({
281   - x: 0,
282   - y: 0,
283   - width: 750,
284   - height: 930,
285   - destWidth: 1.2 * 750 * 750 / th.data.screenWidth,
286   - destHeight: 1.2 * 1217 * 750 / th.data.screenWidth,
287   - canvasId: 'myCanvas',
288   - success: function (res) {
289   - wx.hideLoading();//关闭生成中的方法
290   - th.data.is_loading = 0;
291   - console.log("生成的海报");
292   - console.log(res.tempFilePath);
293   - var tempFilePath = res.tempFilePath;
294   - th.setData({
295   - imagePath: tempFilePath,
296   - maskHidden: false,
297   - canvasHidden: true
298   - });
299   - wx.previewImage({
300   - urls: [res.tempFilePath],
301   - })
302   - if (!res.tempFilePath) {
303   - wx.showModal({
304   - title: '提示',
305   - content: '图片绘制中,请稍后重试',
306   - showCancel: false
307   - })
308   - }
309   -
310   - }
311   -
312   - })
313   - },500)
314   -
315   -
316   - }
317   - )
318   -
  196 + success: function (res) {
  197 + th.get_head_temp(function(){
  198 + var vpath=res.path;
  199 + th.setData({ canvasHidden: false })
  200 + //开启画布
  201 + const ctx = wx.createCanvasContext('myCanvas');
  202 + //先画背景
  203 + ctx.drawImage("../../../images/share/mackground.png", 0, 0, 554 * unit, 930 * unit);
  204 + ctx.setFontSize(26 * unit);
  205 + ctx.setFillStyle("rgb(0,0,0)");
  206 + ctx.fillText(user.nickname, 155 * unit, 75 * unit, 200 * unit);
  207 +
  208 + var tj_path = "../../../images/share/q_tj.png";
  209 + ctx.drawImage(tj_path, 385 * unit, 45 * unit, 90 * unit, 30 * unit);
  210 + ctx.setFontSize(18 * unit);
  211 + ctx.setFillStyle("rgb(255,255,255)");
  212 + ctx.fillText("强烈推荐", 394 * unit, 65 * unit);
  213 +
  214 + ctx.setStrokeStyle("rgb(255,255,255)");
  215 + ctx.setLineDash([5 * unit, 5 * unit], 5 * unit);
  216 + ctx.beginPath();
  217 + ctx.moveTo(0, 125 * unit);
  218 + ctx.lineTo(554 * unit, 125 * unit);
  219 + ctx.stroke();
  220 +
  221 + var x = 55 * unit, y = 165 * unit,w = 444 * unit, h = 220 * unit,r = 14 * unit;
  222 + ut.draw_randon_rect(ctx,x,y,r,w,h);
  223 + ctx.clip(); //一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内
  224 + ctx.drawImage(card_ming, x, y, 444 * unit, 220 * unit); // 推进去图片
  225 + ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
  226 +
  227 + ctx.beginPath();
  228 + // 卡图片
  229 + // ctx.drawImage("../../../images/plus/share/one.jpg", 55 * unit, 165 * unit, 444 * unit, 220 * unit,);
  230 + ctx.setFontSize(26 * unit);
  231 + ctx.setFillStyle('rgb(218,194,169)');
  232 + ctx.fillText(big_card.CardName, 80 * unit, 215 * unit);
  233 + ctx.setFontSize(18 * unit);
  234 + ctx.setFillStyle('rgb(218,194,169)');
  235 + ctx.fillText("开通会员年卡仅" + big_card.CardFee+"元", 80 * unit, 240 * unit);
  236 +
  237 + ctx.drawImage(privilege_o, 80 * unit, 343 * unit, 20 * unit, 20 * unit);
  238 +
  239 + ctx.setFontSize(14 * unit);
  240 + ctx.setFillStyle('rgb(218,194,169)');
  241 + ctx.fillText("根据大家购买数据,您成为超级会员预计可省¥3031元", 105 * unit, 360 * unit);
  242 +
  243 + ctx.rect(70 * unit, 425 * unit, 182 * unit, 1 * unit);
  244 + ctx.setFillStyle('rgb(218,194,169)');
  245 + ctx.fill();
  246 +
  247 + ctx.drawImage(img_square, 267 * unit, 420 * unit, 13 * unit, 13 * unit);
  248 +
  249 + ctx.beginPath();
  250 + ctx.rect(295 * unit, 425 * unit, 182 * unit, 1 * unit);
  251 + ctx.setFillStyle('rgb(218,194,169)');
  252 + ctx.fill();
  253 +
  254 + ctx.drawImage(img_square, 80 * unit, 470 * unit, 10 * unit, 10 * unit);
  255 + ctx.setFontSize(24 * unit);
  256 + ctx.setFillStyle("rgb(198,165,126)");
  257 + ctx.fillText("超级VIP权益", 100 * unit, 475 * unit);
  258 +
  259 + ctx.setFontSize(20 * unit);
  260 + ctx.setFillStyle("rgb(198,165,126)");
  261 + ctx.fillText("超级会员专属权益", 100 * unit, 505 * unit);
  262 + ctx.drawImage(img_Ancrown, 355 * unit, 440 * unit, 65 * unit, 65 * unit);
  263 +
  264 + ctx.rect(85 * unit, 530 * unit, 375 * unit, 1 * unit)
  265 + ctx.setFillStyle('rgb(218,194,169)')
  266 + ctx.fill();
  267 +
  268 + ctx.drawImage(img_square, 80 * unit, 575 * unit, 10 * unit, 10 * unit);
  269 + ctx.setFontSize(24 * unit);
  270 + ctx.setFillStyle("rgb(198,165,126)");
  271 + ctx.fillText("超级VIP标识", 100 * unit, 580 * unit);
  272 +
  273 + ctx.setFontSize(20 * unit);
  274 + ctx.setFillStyle("rgb(198,165,126)");
  275 + ctx.fillText("彰显尊贵身份的象征", 100 * unit, 610 * unit);
  276 + ctx.drawImage(img_Identification, 355 * unit, 548 * unit, 65 * unit, 65 * unit);
  277 +
  278 + ctx.rect(85 * unit, 635 * unit, 375 * unit, 1 * unit);
  279 + ctx.setFillStyle('rgb(218,194,169)');
  280 + ctx.fill();
  281 +
  282 + ctx.drawImage(img_square, 80 * unit, 695 * unit, 10 * unit, 10 * unit);
  283 + ctx.setFontSize(24 * unit);
  284 + ctx.setFillStyle("rgb(198,165,126)");
  285 + ctx.fillText("超级VIP价格", 100 * unit, 695 * unit);
  286 +
  287 + ctx.setFontSize(20 * unit);
  288 + ctx.setFillStyle("rgb(198,165,126)");
  289 + ctx.fillText("享受专属会员超低价", 100 * unit, 725 * unit);
  290 + ctx.drawImage(img_money, 355 * unit, 660 * unit, 65 * unit, 65 * unit);
  291 +
  292 + ctx.rect(85 * unit, 750 * unit, 375 * unit, 1 * unit)
  293 + ctx.setFillStyle('rgb(218,194,169)')
  294 + ctx.fill();
  295 +
  296 + ctx.drawImage(vpath, 100 * unit, 780 * unit, 110 * unit, 110 * unit);
  297 +
  298 + ctx.setFontSize(20 * unit);
  299 + ctx.setFillStyle("#000");
  300 + ctx.fillText("解锁新权益 精彩享不停", 230 * unit, 825 * unit);
  301 +
  302 + ctx.setFontSize(20 * unit);
  303 + ctx.setFillStyle("#000");
  304 + ctx.fillText("长按识别二维码,立即开通!", 230 * unit, 865 * unit);
  305 +
  306 + //---绘制圆形要放在最后,头像----
  307 + ctx.save();
  308 + ctx.beginPath();
  309 + var h_x = 60 * unit;
  310 + var h_y = 24 * unit;
  311 + var h_r = 40 * unit;
  312 + var cx = h_x + h_r;
  313 + var cy = h_y + h_r;
  314 + ctx.arc(cx, cy, h_r, 0, Math.PI * 2, false);
  315 + ctx.closePath();
  316 + ctx.fill();
  317 + ctx.clip();
  318 + ctx.drawImage(th.data.head_pic, h_x, h_y, h_r * 2, h_r * 2);
  319 + ctx.restore();
  320 +
  321 + x = 345 * unit, y = 190 * unit,
  322 + w = 105 * unit, h = 30 * unit,
  323 + r = 14 * unit;
  324 + ut.draw_randon_rect(ctx,x,y,r,w,h);
  325 + ctx.setFontSize(18 * unit);
  326 + ctx.setFillStyle("#000");
  327 + ctx.fillText("立即开通", 362 * unit, 212 * unit);
  328 +
  329 + //--绘制图片---
  330 + ctx.draw(false,
  331 + function(){
  332 + setTimeout(function(){
  333 + wx.canvasToTempFilePath({
  334 + x: 0,
  335 + y: 0,
  336 + width: 750,
  337 + height: 930,
  338 + destWidth: 1.2 * 750 * 750 / th.data.screenWidth,
  339 + destHeight: 1.2 * 1217 * 750 / th.data.screenWidth,
  340 + canvasId: 'myCanvas',
  341 + success: function (res) {
  342 + wx.hideLoading();//关闭生成中的方法
  343 + th.data.is_loading = 0;
  344 + console.log("生成的海报");
  345 + console.log(res.tempFilePath);
  346 + var tempFilePath = res.tempFilePath;
  347 + th.setData({
  348 + imagePath: tempFilePath,
  349 + maskHidden: false,
  350 + canvasHidden: true
  351 + });
  352 + wx.previewImage({
  353 + urls: [res.tempFilePath],
  354 + })
  355 + if (!res.tempFilePath) {
  356 + wx.showModal({
  357 + title: '提示',
  358 + content: '图片绘制中,请稍后重试',
  359 + showCancel: false
  360 + })
  361 + }
  362 +
  363 + }
  364 +
  365 + })
  366 + },300)
  367 + })
  368 + })
  369 +
  370 +
  371 +
319 372  
320   - })
321 373 }
  374 +
322 375 })
323 376  
324 377 },
325 378  
  379 + //--获取头像的本地缓存,回调写法--
  380 + get_head_temp: function (tt) {
  381 + var ee = this;
  382 + if (ee.data.head_pic) {
  383 + tt();return false;
  384 + }
  385 + //---获取分享图片的本地地址,头像和商品图片----
  386 + var path2 = getApp().globalData.userInfo.head_pic;
  387 + if (path2 == "") {
  388 + ee.data.head_pic = "../../../images/share/hui_hear_pic.png";tt();
  389 + } else {
  390 + path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
  391 + wx.getImageInfo({
  392 + src: path2,
  393 + success: function (res) {
  394 + //res.path是网络图片的本地地址
  395 + ee.data.head_pic= res.path;tt();
  396 + },
  397 + fail: function (res) {
  398 + ee.data.head_pic= "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
  399 + tt();
  400 + }
  401 + });
  402 + }
  403 + },
326 404  
  405 + //--- 获取卡类列表 ---
  406 + getPlusCardType: function (e) {
  407 + var storid = o.stoid;
  408 + var th = this;
  409 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
  410 + var plusCard = res.data.data;
  411 + var arr = [1219, 2089, 3031];
  412 + var new_arr = new Array();
  413 + for (var i = 0; i < plusCard.length; i++) {
  414 + //plusCard[i].free=arr[i];
  415 + var item = {"fee": plusCard[i].CardFee, 'index': i}
  416 + new_arr.push(item);
  417 + }
  418 + //根據距離遠近排序,越近在前面,升序
  419 + new_arr.sort(function (a, b) {
  420 + if (a.fee < b.fee) { return -1; } else if (a.fee == b.fee) { return 0; } else { return 1;}
  421 + });
  422 +
  423 + var max_card=plusCard[new_arr[new_arr.length-1].index];
  424 + th.setData({big_card:max_card})
  425 +
  426 + //缓存分享卡的图片
  427 + wx.getImageInfo({
  428 + src: max_card.CardImg,
  429 + success: function (res) {
  430 + var bas_ming = res.path; th.setData({ bas_ming: bas_ming});
  431 + }
  432 + })
  433 +
  434 + })
  435 + },
327 436  
328 437  
329 438  
... ...
pages/user/Detailed/Detailed.wxml
... ... @@ -40,9 +40,13 @@
40 40 </view>
41 41 <view class="flex-level fs30 xc-ash">暂无邀请明细</view>
42 42 <view class="flex-level">
43   - <navigator url="/pages/user/plus/plus?shareid=1" bindtap="goto">
  43 + <navigator bindtap="saveImageToPhotosAlbum">
44 44 <view class="flex-center fs30 white">去邀请</view>
45 45 </navigator>
46 46 </view>
47 47 </view>
  48 +<warn id="warn"></warn>
  49 +
  50 + <!-- 画布 -->
  51 +<canvas canvas-id='myCanvas' style="width:750rpx;height:1260rpx; position: absolute; top:1260rpx " wx:if='{{!canvasHidden}}'></canvas>
48 52 <warn id="warn"></warn>
49 53 \ No newline at end of file
... ...
pages/user/cardinfo/cardinfo.js
1   -var e = function (e) {
2   - return e && e.__esModule ? e : {
3   - default: e
4   - };
5   -}(require("../../../utils/LoadMore.js")),
6   - t = getApp(),
  1 +var t = getApp(),
7 2 a = t.request,
8 3 o = t.globalData.setting,
9 4 os = o,
10 5 i = require("../../../utils/util.js"),
11 6 ut = i,
12   - s = require("../../../utils/common.js"),
13   - w = require("../../../utils/wxParse/wxParse.js"),
14   - n = new e.default();
  7 + s = require("../../../utils/common.js"),t_pay = require("../../../utils/pay2.js"),
  8 + w = require("../../../utils/wxParse/wxParse.js");
15 9 var regeneratorRuntime = require('../../../utils/runtime.js');
16   -var api = require('../../../api/api.js');
17 10 //wx.downloadFile把线上地址设为本地地址
18 11 Page({
19 12  
... ... @@ -48,37 +41,9 @@ Page({
48 41 user_card: null,//会员买的卡
49 42 free:null,//分佣的数据
50 43 expiryDate:"",//卡到期时间
51   -
52   -
53   - },
54   - // uers_card:function () {
55   - // getApp().request.get("/api/weshop/plus/vip/mem/bership/get" + os.stoid+, {
56   - // success: function (res) {
57   - // var is_cardrule = res.data.data.cardrules;
58   - // w.wxParse("content", "html", is_cardrule, that, 6);
59   - // that.setData({
60   - // is_card_rule: is_cardrule
61   - // });
62   - // }
63   - // });
64   - // },
65   -
66   - // 邀请的人及分成
67   - // divide_into:function(){
68   - // var th=this;
69   - // getApp().request.get("/api/weshop/plus/vip/mem/freeze/money", {
70   - // data:{
71   - // userId: getApp().globalData.user_id,
72   - // storeId: os.stoid,
73 44  
74   - // },success: function (res) {
75   -
76   - // var divide_into=res.data.data;
77   - // console.log("邀请的人及分成5555555",res.data);
78   - // th.setData({ divide_into: divide_into});
79   - // }
80   - // });
81   - // },
  45 + },
  46 +
82 47  
83 48  
84 49  
... ... @@ -86,66 +51,50 @@ Page({
86 51 * 生命周期函数--监听页面加载
87 52 */
88 53 onLoad: function (options) {
89   - var that = this;
90   -
91   - //同步初始化
92   - that.init();
  54 + var that = this,ee=this;
93 55  
94   - //获取最大的卡类
95   - // that.getPlusCardType();
96   -
97   - //商家配置信息 是等级卡的说明
98   - // getApp().request.get("/api/weshop/storeconfig/get/"+ os.stoid, {
99   - // success: function (res) {
100   - // var is_cardrule = res.data.data.cardrules;
101   - // w.wxParse("content", "html", is_cardrule, that, 6);
102   - // that.setData({
103   - // is_card_rule: is_cardrule
104   - // });
105   - // }
106   - // });
107   - //会员信息
108   - // getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, {
109   -
110   - // success: function (res) {
111   - // //把网络图片缓存到本地
112   - // var user = res.data.data;
113   - // var url = that.data.url;
114   - // console.log("是什么东西", user);
115   - // var img_money = url + "/images/userinfo/money.jpg";
116   - // var img_Ancrown = url + "/images/userinfo/Ancrown.jpg";
117   - // var img_Identification = url + "/images/userinfo/Identification.jpg";
118   - // var img_square = url + "/images/userinfo/square.jpg";
119   - // console.log(user.head_pic, img_money, img_Ancrown, img_Identification, img_square);
120   - // var big_card = that.data.big_card;
121   - // console.log(big_card,"ssssssss");
122   - // wx.getImageInfo({
123   - // src: big_card.CardImg,
124   - // success: function (res) {
125   - // //回调写法
126   - // var bas_ming = res.path;
127   - // that.setData({ bas_ming: bas_ming});
128   - // }
129   - // })
130   - // wx.getImageInfo({
131   - // src: user.CardImg,
132   - // success: function (res) {
133   - // //回调写法
134   - // var bas_ming = res.path;
135   - // that.setData({ bas_ming: bas_ming });
136   - // }
137   - // })
138   -
139   -
140   - // console.log("会员数据",user);
141   - // that.setData({user: user});
142   - // var big_card= that.big_card;
143   - // if (user != null && user != "" && user != undefined && big_card != null && user != "" && user != undefined){
144   - // //画图
145   - // that.saveImageToPhotosAlbum();
146   - // }
147   - // }
148   - // });
  56 + //-----------等级卡说明-------------------
  57 + getApp().request.promiseGet("/api/weshop/storeconfig/get/" + os.stoid, {
  58 + }).then(res => {
  59 + var is_cardrule = res.data.data.cardrules;
  60 + w.wxParse("content", "html", is_cardrule, ee, 6);
  61 + ee.setData({
  62 + is_card_rule: is_cardrule
  63 + });
  64 + })
  65 +
  66 + //----------------------------获取最大的卡类-----------------------
  67 + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + o.stoid, {
  68 +
  69 + }).then(res => {
  70 + var plusCard = res.data.data;
  71 + var big_card = null;
  72 + var big_cards = null;
  73 + console.log(plusCard, "数据什么的", res);
  74 + for (var i = 0; i < plusCard.length; i++) {
  75 + big_cards = Math.max(plusCard[i].CardFee)
  76 + if (plusCard[i].CardFee == big_cards) {
  77 + big_card = plusCard[i]
  78 + }
  79 + }
  80 + console.log(big_cards, "是什么东西", big_card);
  81 +
  82 + ee.setData({
  83 + is_plusCard: plusCard,
  84 + big_card: big_card
  85 + })
  86 +
  87 + //缓存分享卡的图片
  88 + wx.getImageInfo({
  89 + src: big_card.CardImg,
  90 + success: function (res) {
  91 + //回调写法
  92 + var bas_ming = res.path;
  93 + ee.setData({ bas_ming: bas_ming });
  94 + }
  95 + })
  96 +
  97 + })
149 98  
150 99  
151 100 //获取用户设备信息,屏幕宽度
... ... @@ -156,10 +105,9 @@ Page({
156 105 })
157 106 }
158 107 })
  108 + var goods_list = this.selectComponent("#goods_list"); //组件的id
  109 + goods_list.get_list();
159 110  
160   - // this.saveImageToPhotosAlbum();
161   - // this.puls_user();
162   -
163 111  
164 112 },
165 113  
... ... @@ -204,41 +152,8 @@ Page({
204 152 console.log(user_card,"会员的卡类");
205 153 ee.setData({user_card: user_card});
206 154 })
207   - //-----------等级卡说明-------------------
208   - await getApp().request.promiseGet("/api/weshop/storeconfig/get/"+ os.stoid, {
209   - }).then(res => {
210   - var is_cardrule = res.data.data.cardrules;
211   - w.wxParse("content", "html", is_cardrule, ee, 6);
212   - ee.setData({
213   - is_card_rule: is_cardrule
214   - });
215   -
216   - })
217   -//----------------------------获取最大的卡类-----------------------
218   - await getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + o.stoid, {
219   -
220   - }).then(res => {
221   - var plusCard = res.data.data;
222   - var big_card = null;
223   - var big_cards = null;
224   - console.log(plusCard, "数据什么的", res);
225   - for (var i = 0; i < plusCard.length; i++) {
226   - big_cards = Math.max(plusCard[i].CardFee)
227   - if (plusCard[i].CardFee == big_cards) {
228   - big_card = plusCard[i]
229   - }
230   - }
231   - console.log(big_cards, "是什么东西", big_card);
232   -
233   - ee.setData({
234   - is_plusCard: plusCard,
235   - big_card: big_card
236   - })
237   -
238   - })
239   -
240   -
241   -
  155 +
  156 +
242 157  
243 158 //-----------------获取会员信息-------------------------------
244 159 await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id,{
... ... @@ -263,15 +178,7 @@ Page({
263 178 privilege_o, privilege_o
264 179  
265 180 });
266   - //缓存分享卡的图片
267   - wx.getImageInfo({
268   - src: big_card.CardImg,
269   - success: function (res) {
270   - //回调写法
271   - var bas_ming = res.path;
272   - ee.setData({ bas_ming: bas_ming});
273   - }
274   - })
  181 +
275 182 //缓存会员头像的图片
276 183 wx.getImageInfo({
277 184 src: user.head_pic,
... ... @@ -320,7 +227,6 @@ Page({
320 227 }
321 228 })
322 229  
323   -
324 230 //--------------------方块图---------------
325 231 wx.getImageInfo({
326 232 src: ee.data.img_square,
... ... @@ -330,31 +236,13 @@ Page({
330 236 ee.setData({ img_square: img_square});
331 237 }
332 238 })
333   - //初始分享图页面
334   - // ee.saveImageToPhotosAlbum();
  239 +
335 240 },
336 241  
337   - //-----Plus会员获取-----------
338   - // puls_user: function () {
339 242  
340   - // var th = this;
341   - // getApp().request.get("/api/weshop/plus/vip/mem/list", {
342   - // data: {
343   - // storeId: os.stoid,
344   - // userId: getApp().globalData.user_id,
345   - // },
346   - // success: function (su) {
347   - // if (su.data.code == 0) {
348   - // var cardname = su.data.data[0].MemCardName;
349   - // console.log("卡的名字", cardname);
350   - // th.setData({ pulscardname: cardname });
351   - // }
352   - // }
353   - // });
354   - // },
355   -
356   -
357   - //打开分享图片
  243 +
  244 +
  245 + //-----打开分享图片----
358 246 Share_pictures: function () {
359 247  
360 248 this.setData({
... ... @@ -364,31 +252,6 @@ Page({
364 252 },
365 253  
366 254  
367   -
368   - // //获取最大的卡类
369   - // getPlusCardType: function (e) {
370   - // var storid = o.stoid;
371   - // var th = this;
372   - // getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
373   - // var plusCard = res.data.data;
374   - // var big_card=null;
375   - // var big_cards = null;
376   - // console.log(plusCard, "数据什么的", res);
377   - // for (var i = 0; i < plusCard.length; i++) {
378   - // big_cards= Math.max(plusCard[i].CardFee)
379   - // if (plusCard[i].CardFee ==big_cards){
380   - // big_card = plusCard[i]
381   - // }
382   - // }
383   - // console.log(big_cards, "是什么东西", big_card);
384   -
385   - // th.setData({
386   - // is_plusCard: plusCard,
387   - // big_card: big_card
388   - // })
389   - // })
390   -
391   - // },
392 255 /**
393 256 * 生命周期函数--监听页面初次渲染完成
394 257 */
... ... @@ -441,15 +304,14 @@ Page({
441 304 //开启画布
442 305 const ctx = wx.createCanvasContext('myCanvas');
443 306  
444   -
445   -
  307 +
446 308 //先画背景
447   - ctx.drawImage("../../../images/plus/share/mackground.png", 0, 0, 554 * unit, 930 * unit);
  309 + ctx.drawImage("../../../images/share/mackground.png", 0, 0, 554 * unit, 930 * unit);
448 310 ctx.setFontSize(26 * unit);
449 311 ctx.setFillStyle("rgb(0,0,0)");
450 312 ctx.fillText(user.nickname, 155 * unit, 75 * unit, 200 * unit);
451 313  
452   - var tj_path = "../../../images/userinfo/q_tj.png";
  314 + var tj_path = "../../../images/share/q_tj.png";
453 315 ctx.drawImage(tj_path, 385 * unit, 45 * unit, 90 * unit, 30 * unit);
454 316 ctx.setFontSize(18 * unit);
455 317 ctx.setFillStyle("rgb(255,255,255)");
... ... @@ -651,9 +513,7 @@ Page({
651 513  
652 514 //绘制图片
653 515 ctx.draw(false,
654   -
655 516 function(){
656   -
657 517 setTimeout(function(){
658 518 wx.canvasToTempFilePath({
659 519 x: 0,
... ... @@ -684,15 +544,11 @@ Page({
684 544 showCancel: false
685 545 })
686 546 }
687   -
688 547 }
689   -
690 548 })
691 549 },500)
692   -
693   -
694   - }
695   - )
  550 +
  551 + })
696 552  
697 553  
698 554 })
... ... @@ -755,9 +611,10 @@ Page({
755 611 * 生命周期函数--监听页面显示
756 612 */
757 613 onShow: function () {
  614 + //同步初始化
  615 + this.init();
  616 +
758 617  
759   - var goods_list = this.selectComponent("#goods_list"); //组件的id
760   - goods_list.get_list();
761 618 },
762 619  
763 620 /**
... ... @@ -792,23 +649,52 @@ Page({
792 649 })
793 650 },
794 651  
795   - /**
796   - * 用户点击右上角分享
797   - */
798   - onShareAppMessage: function () {
799   -
800   - },
801   - //开通会员
802   - Opening: function () {
803   - this.setData({
804   - j: true
805   - })
  652 +
  653 +
  654 + //--转到用户余额--
  655 + to_user_money:function(){
  656 + var th=this,free=th.data.free;
  657 + if(!th.data.free.RefereeMoney){
  658 + getApp().my_warnning("您没有转入余额",0,th); return false;
  659 + }
  660 +
  661 + wx.showModal({
  662 + title: '提示',
  663 + content: '您确定要转入余额吗?',
  664 + success(res) {
  665 + if (res.confirm) {
  666 + getApp().request.get("/api/weshop/plus/withdrawal/referee/money",{
  667 + data:{storeId:os.stoid,userId:getApp().globalData.user_id},
  668 + success:function(res){
  669 + if(res.data.code==0){
  670 + getApp().my_warnning("转入成功",0,th);
  671 + free.RefereeMoney=0;
  672 + th.setData({free:free});
  673 + }else{
  674 + getApp().my_warnning(res.data.msg ,0,th);
  675 + }
  676 + }
  677 + })
  678 + }
  679 + }
  680 + })
806 681 },
807   - //返回会员页面
808   - OpeningClose: function () {
809   - this.setData({
810   - j: false
811   - })
  682 +
  683 + //-----立即续费的功能------
  684 + xufei:function(){
  685 + var th = this;
  686 + var is_card = 0;
  687 + var item = th.data.user_card;
  688 + var req = {};
  689 + req.cardId = item.CardId;
  690 + req.rechargeType = 4;
  691 + //如果不是你导购,也不是等级会员分享
  692 + req.storeId = os.stoid;
  693 + req.userId = getApp().globalData.user_id;
  694 + t_pay.pay(req, th.success, function () {
  695 + getApp().my_warnning("支付失败", 0, th);
  696 + });
  697 +
812 698 }
813 699  
814 700 })
815 701 \ No newline at end of file
... ...
pages/user/cardinfo/cardinfo.json
1 1 {
2 2 "usingComponents": {
3 3 "pop_txt": "/components/userqy_pop_up/userqy_pop_up",
4   - "goods_recommend": "/components/goods_list/goods_list"
  4 + "goods_recommend": "/components/goods_list/goods_list",
  5 + "warn": "/components/long_warn/long_warn"
5 6 },
6 7 "navigationBarTitleText": "会员续费"
7 8 }
8 9 \ No newline at end of file
... ...
pages/user/cardinfo/cardinfo.wxml
... ... @@ -14,7 +14,7 @@
14 14 <view class="fs36" style="font-weight:bold">{{user_card.CardName}}</view>
15 15 <view class="fs22">会员将在{{filters.replace_time2(expiryDate)}}到期</view>
16 16 </view>
17   - <view class="renew fs28" style="background:{{user_card.CardColor}}">立即续费
  17 + <view bindtap="xufei" class="renew fs28" style="background:{{user_card.CardColor}}">立即续费
18 18 </view>
19 19  
20 20 </view>
... ... @@ -22,7 +22,9 @@
22 22 <view class="flex-vertical-between xs fs24">
23 23  
24 24 <view class="flex" style=" overflow:hidden">
25   - <view class="Member"style="background-image:url('{{url}}/miniapp/images/plus/privilege_o.png');filter:box-shadow( 40rpx 0rpx 0rpx {{user_card.CardColor}});"></view>
  25 + <view class="Member"
  26 + style="background-image:url('{{url}}/miniapp/images/plus/privilege_o.png'); filter: drop-shadow(40px 0 0 {{user_card.CardColor}});">
  27 + </view>
26 28 <view style="color:{{user_card.CardColor}}">正在享受{{user_card.CardName}}会员特权
27 29 </view>
28 30 </view>
... ... @@ -46,7 +48,7 @@
46 48 <view class="Detailed flex-center">
47 49 <navigator url="/pages/user/Detailed/Detailed">明细</navigator>
48 50 </view>
49   - <view class="Invitation_Cash">立即提现</view>
  51 + <view class="Invitation_Cash" bindtap="to_user_money">转到余额</view>
50 52  
51 53 </view>
52 54  
... ...
pages/user/cardinfo/cardinfo.wxss
... ... @@ -144,7 +144,6 @@
144 144 height: 30rpx;
145 145 margin-right: 5rpx;
146 146 background-size: 100% 100%;
147   -position: relative;
148   -left: -40rpx;
149   -
  147 + background-blend-mode: lighten;
  148 + transform: translateX(-280%);
150 149 }
151 150 \ No newline at end of file
... ...
utils/util.js
... ... @@ -388,5 +388,5 @@ module.exports = {
388 388 measureText: measureText,//画布需要的函数
389 389 check_mobile: check_mobile,//验证手机
390 390 get_rand_item:get_rand_item, //随机获取元素
391   -
  391 + draw_randon_rect:draw_randon_rect //画图画圆角矩形
392 392 };
... ...