diff --git a/images/share/mackground.png b/images/share/mackground.png
new file mode 100644
index 0000000..6bcf62e
--- /dev/null
+++ b/images/share/mackground.png
diff --git a/pages/user/Detailed/Detailed.js b/pages/user/Detailed/Detailed.js
index a7caff0..45e9fc3 100644
--- a/pages/user/Detailed/Detailed.js
+++ b/pages/user/Detailed/Detailed.js
@@ -19,19 +19,93 @@ Page({
isDetailed: 0,
total: 0,
ismore: 0,//数据是否加载完毕
+ screenWidth:0,
+
+ head_pic:"",//会员头像
+ img_money:"",//缓存VIP的图片
+ img_Ancrown:"",//会员权益
+ img_Identification:"",//缓存标识的图片
+ img_square:"",//缓存方块的图片
+ privilege_o:"",//卡的勋章图
+ bas_ming:"", //卡的图片
+ big_card:null, //最大卡的信息
+
+ imagePath:"", //分享的生成图片
+
+ canvasHidden:true,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
- var img_money = url + "/miniapp/images/plus/share/money.png";
- var img_Ancrown = url + "/miniapp/images/plus/share/Ancrown.png";
- var img_Identification = url + "/miniapp/images/plus/share/Identification.png";
- var img_square = url + "/miniapp/images/plus/share/square.png";
- var privilege_o = url + "/miniapp/images/plus/share/privilege_o.png";
+ var ee=this;
+ var img_money = this.data.url + "/miniapp/images/plus/share/money.png";
+ var img_Ancrown = this.data.url + "/miniapp/images/plus/share/Ancrown.png";
+ var img_Identification = this.data.url + "/miniapp/images/plus/share/Identification.png";
+ var img_square = this.data.url + "/miniapp/images/plus/share/square.png";
+ var privilege_o = this.data.url + "/miniapp/images/plus/share/privilege_o.png";
+ var user=getApp().globalData.userInfo;
+ //--获取用户设备信息,屏幕宽度--
+ wx.getSystemInfo({
+ success: res => {
+ ee.data.screenWidth=res.screenWidth;
+ }
+ })
+
+ //--------------------缓存vip价格的图片---------------
+ wx.getImageInfo({
+ src:img_money,
+ success: function (res) {
+ //回调写法
+ var img_money = res.path;
+ ee.setData({ img_money: img_money});
+ }
+ })
+ //--------------------缓存权益的图片---------------
+ wx.getImageInfo({
+ src: img_Ancrown,
+ success: function (res) {
+ //回调写法
+ var img_Ancrown = res.path;
+ ee.setData({ img_Ancrown: img_Ancrown });
+ }
+ })
+ //--------------------缓存标识的图片---------------
+ wx.getImageInfo({
+ src: img_Identification,
+ success: function (res) {
+ //回调写法
+ var img_Identification = res.path;
+ ee.setData({ img_Identification: img_Identification });
+ }
+ })
+
+ //--------------------卡的勋章---------------
+ wx.getImageInfo({
+ src: privilege_o,
+ success: function (res) {
+ //回调写法
+ var privilege_o = res.path;
+ ee.setData({ privilege_o: privilege_o });
+ }
+ })
+
+ //--------------------方块图---------------
+ wx.getImageInfo({
+ src: img_square,
+ success: function (res) {
+ //回调写法
+ var img_square = res.path;
+ ee.setData({ img_square: img_square});
+ }
+ })
+
+ //-----------获取最大值的卡--------------
+ ee.getPlusCardType();
},
+
selectDetailed: function() {
var th = this, e = th;
getApp().request.promiseGet("/api/weshop/plus/vip/mem/referee/page", {
@@ -49,10 +123,8 @@ Page({
var arr1 = th.data.arrayDetailed;//获取明细数组
var arr2 = res.data.data.pageData;//获取当前查询数据
var arr3 = [...arr1, ...arr2];//把当前查询数组拼接到原本数组后面
-
var ismore = 0;
if (arr3.length == res.data.data.total) ismore = 1 //数据已加载完判断
-
th.setData({
arrayDetailed: arr3,
total: res.data.data.total,
@@ -60,9 +132,8 @@ Page({
isDetailed: 1
})
}
- }),
- wx.stopPullDownRefresh();
-
+ })
+
},
/**
* 生命周期函数--监听页面初次渲染完成
@@ -93,237 +164,275 @@ Page({
saveImageToPhotosAlbum: function () {
if (this.data.imagePath != "") {
- wx.previewImage({
- urls: [this.data.imagePath],
- })
+ wx.previewImage({ urls: [this.data.imagePath], })
return;
}
- // if(this.data.is_loading) return false ;
- this.data.is_loading=1;
-
- wx.showLoading({
- title: '生成中...',
- })
-
- this.setData({
- canvasHidden: false
- })
+
+ this.data.is_loading=1;
+ wx.showLoading({ title: '生成中...',})
var th = this;
+
//设置画板显示,才能开始绘图
var card_ming=th.data.bas_ming;//卡的图片
- var user = th.data.user;//会员资料;
var big_card= th.data.big_card;//获取最大的卡
var user_head = th.data.head_pic;//会员头像
var img_money = th.data.img_money;//缓存vip的价格
var img_Ancrown = th.data.img_Ancrown;//会员权益的图片
var img_Identification = th.data.img_Identification;//会员标识
var privilege_o = th.data.privilege_o;//勋章图片
- var img_square=th.data.img_square;
-
+ var img_square=th.data.img_square;
var app = getApp();
+ var user=app.globalData.userInfo;
var unit = th.data.screenWidth / 750 * 1.35;
var scene = getApp().globalData.user_id;
- console.log("用户头像", th.data.head_pic);
- ///二微码
+ //---二微码---
var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/index/index";
- wx.getImageInfo({
+
+ wx.getImageInfo({
src: path3,
- success: function (res) {
- //回调写法
- th.get_head_temp(th.get_goods_temp, function () {
- var vpath=res.path;
-
- console.log("生成二维码", path3);
- //开启画布
- const ctx = wx.createCanvasContext('myCanvas');
-
- //先画背景
- ctx.drawImage("../../../images/plus/share/mackground.png", 0, 0, 554 * unit, 930 * unit);
- ctx.setFontSize(26 * unit);
- ctx.setFillStyle("rgb(0,0,0)");
- ctx.fillText(user.nickname, 155 * unit, 75 * unit, 200 * unit);
-
- var tj_path = "../../../images/userinfo/q_tj.png";
- ctx.drawImage(tj_path, 385 * unit, 45 * unit, 90 * unit, 30 * unit);
- ctx.setFontSize(18 * unit);
- ctx.setFillStyle("rgb(255,255,255)");
- ctx.fillText("强烈推荐", 394 * unit, 65 * unit);
-
- ctx.setStrokeStyle("rgb(255,255,255)");
- ctx.setLineDash([5 * unit, 5 * unit], 5 * unit);
- ctx.beginPath();
- ctx.moveTo(0, 125 * unit);
- ctx.lineTo(554 * unit, 125 * unit);
- ctx.stroke();
-
- var x = 55 * unit, y = 165 * unit,w = 444 * unit, h = 220 * unit,r = 14 * unit;
- ut.draw_randon_rect(ctx,x,y,r,w,h);
- ctx.clip(); //画了圆 再剪切 原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内
- ctx.drawImage(card_ming, x, y, 444 * unit, 220 * unit); // 推进去图片
- ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
-
- ctx.beginPath();
- // 卡图片
- // ctx.drawImage("../../../images/plus/share/one.jpg", 55 * unit, 165 * unit, 444 * unit, 220 * unit,);
- ctx.setFontSize(26 * unit);
- ctx.setFillStyle('rgb(218,194,169)');
- ctx.fillText(big_card.CardName, 80 * unit, 215 * unit);
- ctx.setFontSize(18 * unit);
- ctx.setFillStyle('rgb(218,194,169)');
- ctx.fillText("开通会员年卡仅" + big_card.CardFee+"元", 80 * unit, 240 * unit);
-
- ctx.drawImage(privilege_o, 80 * unit, 343 * unit, 20 * unit, 20 * unit);
-
- ctx.setFontSize(14 * unit);
- ctx.setFillStyle('rgb(218,194,169)');
- ctx.fillText("根据大家购买数据,您成为超级会员预计可省¥3031元", 105 * unit, 360 * unit);
-
- ctx.rect(70 * unit, 425 * unit, 182 * unit, 1 * unit);
- ctx.setFillStyle('rgb(218,194,169)');
- ctx.fill();
-
- ctx.drawImage(img_square, 267 * unit, 420 * unit, 13 * unit, 13 * unit);
-
- ctx.beginPath();
- ctx.rect(295 * unit, 425 * unit, 182 * unit, 1 * unit);
- ctx.setFillStyle('rgb(218,194,169)');
- ctx.fill();
-
- ctx.drawImage(img_square, 80 * unit, 470 * unit, 10 * unit, 10 * unit);
- ctx.setFontSize(24 * unit);
- ctx.setFillStyle("rgb(198,165,126)");
- ctx.fillText("超级VIP权益", 100 * unit, 475 * unit);
-
- ctx.setFontSize(20 * unit);
- ctx.setFillStyle("rgb(198,165,126)");
- ctx.fillText("超级会员专属权益", 100 * unit, 505 * unit);
- ctx.drawImage(img_Ancrown, 355 * unit, 440 * unit, 65 * unit, 65 * unit);
-
- ctx.rect(85 * unit, 530 * unit, 375 * unit, 1 * unit)
- ctx.setFillStyle('rgb(218,194,169)')
- ctx.fill();
-
- ctx.drawImage(img_square, 80 * unit, 575 * unit, 10 * unit, 10 * unit);
- ctx.setFontSize(24 * unit);
- ctx.setFillStyle("rgb(198,165,126)");
- ctx.fillText("超级VIP标识", 100 * unit, 580 * unit);
-
- ctx.setFontSize(20 * unit);
- ctx.setFillStyle("rgb(198,165,126)");
- ctx.fillText("彰显尊贵身份的象征", 100 * unit, 610 * unit);
- ctx.drawImage(img_Identification, 355 * unit, 548 * unit, 65 * unit, 65 * unit);
-
- ctx.rect(85 * unit, 635 * unit, 375 * unit, 1 * unit);
- ctx.setFillStyle('rgb(218,194,169)');
- ctx.fill();
-
- ctx.drawImage(img_square, 80 * unit, 695 * unit, 10 * unit, 10 * unit);
- ctx.setFontSize(24 * unit);
- ctx.setFillStyle("rgb(198,165,126)");
- ctx.fillText("超级VIP价格", 100 * unit, 695 * unit);
-
- ctx.setFontSize(20 * unit);
- ctx.setFillStyle("rgb(198,165,126)");
- ctx.fillText("享受专属会员超低价", 100 * unit, 725 * unit);
- ctx.drawImage(img_money, 355 * unit, 660 * unit, 65 * unit, 65 * unit);
-
- ctx.rect(85 * unit, 750 * unit, 375 * unit, 1 * unit)
- ctx.setFillStyle('rgb(218,194,169)')
- ctx.fill();
-
- ctx.drawImage(vpath, 100 * unit, 780 * unit, 110 * unit, 110 * unit);
-
- ctx.setFontSize(20 * unit);
- ctx.setFillStyle("#000");
- ctx.fillText("解锁新权益 精彩享不停", 230 * unit, 825 * unit);
-
- ctx.setFontSize(20 * unit);
- ctx.setFillStyle("#000");
- ctx.fillText("长按识别二维码,立即开通!", 230 * unit, 865 * unit);
-
- //---绘制圆形要放在最后----
- ctx.save();
- ctx.beginPath();
- var h_x = 60 * unit;
- var h_y = 24 * unit;
- var h_r = 40 * unit;
- var cx = h_x + h_r;
- var cy = h_y + h_r;
- ctx.arc(cx, cy, h_r, 0, Math.PI * 2, false);
- ctx.closePath();
- ctx.fill();
- ctx.clip();
- ctx.drawImage(th.data.head_pic, h_x, h_y, h_r * 2, h_r * 2);
- ctx.restore();
-
- x = 345 * unit,
- y = 190 * unit,
- w = 105 * unit,
- h = 30 * unit,
- r = 14 * unit;
- ut.draw_randon_rect(ctx,x,y,r,w,h);
- ctx.setFontSize(18 * unit);
- ctx.setFillStyle("#000");
- ctx.fillText("立即开通", 362 * unit, 212 * unit);
-
-
-
- //绘制图片
- ctx.draw(false,
-
- function(){
-
- setTimeout(function(){
- wx.canvasToTempFilePath({
- x: 0,
- y: 0,
- width: 750,
- height: 930,
- destWidth: 1.2 * 750 * 750 / th.data.screenWidth,
- destHeight: 1.2 * 1217 * 750 / th.data.screenWidth,
- canvasId: 'myCanvas',
- success: function (res) {
- wx.hideLoading();//关闭生成中的方法
- th.data.is_loading = 0;
- console.log("生成的海报");
- console.log(res.tempFilePath);
- var tempFilePath = res.tempFilePath;
- th.setData({
- imagePath: tempFilePath,
- maskHidden: false,
- canvasHidden: true
- });
- wx.previewImage({
- urls: [res.tempFilePath],
- })
- if (!res.tempFilePath) {
- wx.showModal({
- title: '提示',
- content: '图片绘制中,请稍后重试',
- showCancel: false
- })
- }
-
- }
-
- })
- },500)
-
-
- }
- )
-
+ success: function (res) {
+ th.get_head_temp(function(){
+ var vpath=res.path;
+ th.setData({ canvasHidden: false })
+ //开启画布
+ const ctx = wx.createCanvasContext('myCanvas');
+ //先画背景
+ ctx.drawImage("../../../images/share/mackground.png", 0, 0, 554 * unit, 930 * unit);
+ ctx.setFontSize(26 * unit);
+ ctx.setFillStyle("rgb(0,0,0)");
+ ctx.fillText(user.nickname, 155 * unit, 75 * unit, 200 * unit);
+
+ var tj_path = "../../../images/share/q_tj.png";
+ ctx.drawImage(tj_path, 385 * unit, 45 * unit, 90 * unit, 30 * unit);
+ ctx.setFontSize(18 * unit);
+ ctx.setFillStyle("rgb(255,255,255)");
+ ctx.fillText("强烈推荐", 394 * unit, 65 * unit);
+
+ ctx.setStrokeStyle("rgb(255,255,255)");
+ ctx.setLineDash([5 * unit, 5 * unit], 5 * unit);
+ ctx.beginPath();
+ ctx.moveTo(0, 125 * unit);
+ ctx.lineTo(554 * unit, 125 * unit);
+ ctx.stroke();
+
+ var x = 55 * unit, y = 165 * unit,w = 444 * unit, h = 220 * unit,r = 14 * unit;
+ ut.draw_randon_rect(ctx,x,y,r,w,h);
+ ctx.clip(); //一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内
+ ctx.drawImage(card_ming, x, y, 444 * unit, 220 * unit); // 推进去图片
+ ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
+
+ ctx.beginPath();
+ // 卡图片
+ // ctx.drawImage("../../../images/plus/share/one.jpg", 55 * unit, 165 * unit, 444 * unit, 220 * unit,);
+ ctx.setFontSize(26 * unit);
+ ctx.setFillStyle('rgb(218,194,169)');
+ ctx.fillText(big_card.CardName, 80 * unit, 215 * unit);
+ ctx.setFontSize(18 * unit);
+ ctx.setFillStyle('rgb(218,194,169)');
+ ctx.fillText("开通会员年卡仅" + big_card.CardFee+"元", 80 * unit, 240 * unit);
+
+ ctx.drawImage(privilege_o, 80 * unit, 343 * unit, 20 * unit, 20 * unit);
+
+ ctx.setFontSize(14 * unit);
+ ctx.setFillStyle('rgb(218,194,169)');
+ ctx.fillText("根据大家购买数据,您成为超级会员预计可省¥3031元", 105 * unit, 360 * unit);
+
+ ctx.rect(70 * unit, 425 * unit, 182 * unit, 1 * unit);
+ ctx.setFillStyle('rgb(218,194,169)');
+ ctx.fill();
+
+ ctx.drawImage(img_square, 267 * unit, 420 * unit, 13 * unit, 13 * unit);
+
+ ctx.beginPath();
+ ctx.rect(295 * unit, 425 * unit, 182 * unit, 1 * unit);
+ ctx.setFillStyle('rgb(218,194,169)');
+ ctx.fill();
+
+ ctx.drawImage(img_square, 80 * unit, 470 * unit, 10 * unit, 10 * unit);
+ ctx.setFontSize(24 * unit);
+ ctx.setFillStyle("rgb(198,165,126)");
+ ctx.fillText("超级VIP权益", 100 * unit, 475 * unit);
+
+ ctx.setFontSize(20 * unit);
+ ctx.setFillStyle("rgb(198,165,126)");
+ ctx.fillText("超级会员专属权益", 100 * unit, 505 * unit);
+ ctx.drawImage(img_Ancrown, 355 * unit, 440 * unit, 65 * unit, 65 * unit);
+
+ ctx.rect(85 * unit, 530 * unit, 375 * unit, 1 * unit)
+ ctx.setFillStyle('rgb(218,194,169)')
+ ctx.fill();
+
+ ctx.drawImage(img_square, 80 * unit, 575 * unit, 10 * unit, 10 * unit);
+ ctx.setFontSize(24 * unit);
+ ctx.setFillStyle("rgb(198,165,126)");
+ ctx.fillText("超级VIP标识", 100 * unit, 580 * unit);
+
+ ctx.setFontSize(20 * unit);
+ ctx.setFillStyle("rgb(198,165,126)");
+ ctx.fillText("彰显尊贵身份的象征", 100 * unit, 610 * unit);
+ ctx.drawImage(img_Identification, 355 * unit, 548 * unit, 65 * unit, 65 * unit);
+
+ ctx.rect(85 * unit, 635 * unit, 375 * unit, 1 * unit);
+ ctx.setFillStyle('rgb(218,194,169)');
+ ctx.fill();
+
+ ctx.drawImage(img_square, 80 * unit, 695 * unit, 10 * unit, 10 * unit);
+ ctx.setFontSize(24 * unit);
+ ctx.setFillStyle("rgb(198,165,126)");
+ ctx.fillText("超级VIP价格", 100 * unit, 695 * unit);
+
+ ctx.setFontSize(20 * unit);
+ ctx.setFillStyle("rgb(198,165,126)");
+ ctx.fillText("享受专属会员超低价", 100 * unit, 725 * unit);
+ ctx.drawImage(img_money, 355 * unit, 660 * unit, 65 * unit, 65 * unit);
+
+ ctx.rect(85 * unit, 750 * unit, 375 * unit, 1 * unit)
+ ctx.setFillStyle('rgb(218,194,169)')
+ ctx.fill();
+
+ ctx.drawImage(vpath, 100 * unit, 780 * unit, 110 * unit, 110 * unit);
+
+ ctx.setFontSize(20 * unit);
+ ctx.setFillStyle("#000");
+ ctx.fillText("解锁新权益 精彩享不停", 230 * unit, 825 * unit);
+
+ ctx.setFontSize(20 * unit);
+ ctx.setFillStyle("#000");
+ ctx.fillText("长按识别二维码,立即开通!", 230 * unit, 865 * unit);
+
+ //---绘制圆形要放在最后,头像----
+ ctx.save();
+ ctx.beginPath();
+ var h_x = 60 * unit;
+ var h_y = 24 * unit;
+ var h_r = 40 * unit;
+ var cx = h_x + h_r;
+ var cy = h_y + h_r;
+ ctx.arc(cx, cy, h_r, 0, Math.PI * 2, false);
+ ctx.closePath();
+ ctx.fill();
+ ctx.clip();
+ ctx.drawImage(th.data.head_pic, h_x, h_y, h_r * 2, h_r * 2);
+ ctx.restore();
+
+ x = 345 * unit, y = 190 * unit,
+ w = 105 * unit, h = 30 * unit,
+ r = 14 * unit;
+ ut.draw_randon_rect(ctx,x,y,r,w,h);
+ ctx.setFontSize(18 * unit);
+ ctx.setFillStyle("#000");
+ ctx.fillText("立即开通", 362 * unit, 212 * unit);
+
+ //--绘制图片---
+ ctx.draw(false,
+ function(){
+ setTimeout(function(){
+ wx.canvasToTempFilePath({
+ x: 0,
+ y: 0,
+ width: 750,
+ height: 930,
+ destWidth: 1.2 * 750 * 750 / th.data.screenWidth,
+ destHeight: 1.2 * 1217 * 750 / th.data.screenWidth,
+ canvasId: 'myCanvas',
+ success: function (res) {
+ wx.hideLoading();//关闭生成中的方法
+ th.data.is_loading = 0;
+ console.log("生成的海报");
+ console.log(res.tempFilePath);
+ var tempFilePath = res.tempFilePath;
+ th.setData({
+ imagePath: tempFilePath,
+ maskHidden: false,
+ canvasHidden: true
+ });
+ wx.previewImage({
+ urls: [res.tempFilePath],
+ })
+ if (!res.tempFilePath) {
+ wx.showModal({
+ title: '提示',
+ content: '图片绘制中,请稍后重试',
+ showCancel: false
+ })
+ }
+
+ }
+
+ })
+ },300)
+ })
+ })
+
+
+
- })
}
+
})
},
+ //--获取头像的本地缓存,回调写法--
+ get_head_temp: function (tt) {
+ var ee = this;
+ if (ee.data.head_pic) {
+ tt();return false;
+ }
+ //---获取分享图片的本地地址,头像和商品图片----
+ var path2 = getApp().globalData.userInfo.head_pic;
+ if (path2 == "") {
+ ee.data.head_pic = "../../../images/share/hui_hear_pic.png";tt();
+ } else {
+ path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn");
+ wx.getImageInfo({
+ src: path2,
+ success: function (res) {
+ //res.path是网络图片的本地地址
+ ee.data.head_pic= res.path;tt();
+ },
+ fail: function (res) {
+ ee.data.head_pic= "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的
+ tt();
+ }
+ });
+ }
+ },
+ //--- 获取卡类列表 ---
+ getPlusCardType: function (e) {
+ var storid = o.stoid;
+ var th = this;
+ getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
+ var plusCard = res.data.data;
+ var arr = [1219, 2089, 3031];
+ var new_arr = new Array();
+ for (var i = 0; i < plusCard.length; i++) {
+ //plusCard[i].free=arr[i];
+ var item = {"fee": plusCard[i].CardFee, 'index': i}
+ new_arr.push(item);
+ }
+ //根據距離遠近排序,越近在前面,升序
+ new_arr.sort(function (a, b) {
+ if (a.fee < b.fee) { return -1; } else if (a.fee == b.fee) { return 0; } else { return 1;}
+ });
+
+ var max_card=plusCard[new_arr[new_arr.length-1].index];
+ th.setData({big_card:max_card})
+
+ //缓存分享卡的图片
+ wx.getImageInfo({
+ src: max_card.CardImg,
+ success: function (res) {
+ var bas_ming = res.path; th.setData({ bas_ming: bas_ming});
+ }
+ })
+
+ })
+ },
diff --git a/pages/user/Detailed/Detailed.wxml b/pages/user/Detailed/Detailed.wxml
index 53a1d39..de3143a 100644
--- a/pages/user/Detailed/Detailed.wxml
+++ b/pages/user/Detailed/Detailed.wxml
@@ -40,9 +40,13 @@
暂无邀请明细
-
+
去邀请
+
+
+
+
\ No newline at end of file
diff --git a/pages/user/cardinfo/cardinfo.js b/pages/user/cardinfo/cardinfo.js
index 68d2e73..c7df3e8 100644
--- a/pages/user/cardinfo/cardinfo.js
+++ b/pages/user/cardinfo/cardinfo.js
@@ -1,19 +1,12 @@
-var e = function (e) {
- return e && e.__esModule ? e : {
- default: e
- };
-}(require("../../../utils/LoadMore.js")),
- t = getApp(),
+var t = getApp(),
a = t.request,
o = t.globalData.setting,
os = o,
i = require("../../../utils/util.js"),
ut = i,
- s = require("../../../utils/common.js"),
- w = require("../../../utils/wxParse/wxParse.js"),
- n = new e.default();
+ s = require("../../../utils/common.js"),t_pay = require("../../../utils/pay2.js"),
+ w = require("../../../utils/wxParse/wxParse.js");
var regeneratorRuntime = require('../../../utils/runtime.js');
-var api = require('../../../api/api.js');
//wx.downloadFile把线上地址设为本地地址
Page({
@@ -48,37 +41,9 @@ Page({
user_card: null,//会员买的卡
free:null,//分佣的数据
expiryDate:"",//卡到期时间
-
-
- },
- // uers_card:function () {
- // getApp().request.get("/api/weshop/plus/vip/mem/bership/get" + os.stoid+, {
- // success: function (res) {
- // var is_cardrule = res.data.data.cardrules;
- // w.wxParse("content", "html", is_cardrule, that, 6);
- // that.setData({
- // is_card_rule: is_cardrule
- // });
- // }
- // });
- // },
-
- // 邀请的人及分成
- // divide_into:function(){
- // var th=this;
- // getApp().request.get("/api/weshop/plus/vip/mem/freeze/money", {
- // data:{
- // userId: getApp().globalData.user_id,
- // storeId: os.stoid,
- // },success: function (res) {
-
- // var divide_into=res.data.data;
- // console.log("邀请的人及分成5555555",res.data);
- // th.setData({ divide_into: divide_into});
- // }
- // });
- // },
+ },
+
@@ -86,66 +51,50 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
- var that = this;
-
- //同步初始化
- that.init();
+ var that = this,ee=this;
- //获取最大的卡类
- // that.getPlusCardType();
-
- //商家配置信息 是等级卡的说明
- // getApp().request.get("/api/weshop/storeconfig/get/"+ os.stoid, {
- // success: function (res) {
- // var is_cardrule = res.data.data.cardrules;
- // w.wxParse("content", "html", is_cardrule, that, 6);
- // that.setData({
- // is_card_rule: is_cardrule
- // });
- // }
- // });
- //会员信息
- // getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, {
-
- // success: function (res) {
- // //把网络图片缓存到本地
- // var user = res.data.data;
- // var url = that.data.url;
- // console.log("是什么东西", user);
- // var img_money = url + "/images/userinfo/money.jpg";
- // var img_Ancrown = url + "/images/userinfo/Ancrown.jpg";
- // var img_Identification = url + "/images/userinfo/Identification.jpg";
- // var img_square = url + "/images/userinfo/square.jpg";
- // console.log(user.head_pic, img_money, img_Ancrown, img_Identification, img_square);
- // var big_card = that.data.big_card;
- // console.log(big_card,"ssssssss");
- // wx.getImageInfo({
- // src: big_card.CardImg,
- // success: function (res) {
- // //回调写法
- // var bas_ming = res.path;
- // that.setData({ bas_ming: bas_ming});
- // }
- // })
- // wx.getImageInfo({
- // src: user.CardImg,
- // success: function (res) {
- // //回调写法
- // var bas_ming = res.path;
- // that.setData({ bas_ming: bas_ming });
- // }
- // })
-
-
- // console.log("会员数据",user);
- // that.setData({user: user});
- // var big_card= that.big_card;
- // if (user != null && user != "" && user != undefined && big_card != null && user != "" && user != undefined){
- // //画图
- // that.saveImageToPhotosAlbum();
- // }
- // }
- // });
+ //-----------等级卡说明-------------------
+ getApp().request.promiseGet("/api/weshop/storeconfig/get/" + os.stoid, {
+ }).then(res => {
+ var is_cardrule = res.data.data.cardrules;
+ w.wxParse("content", "html", is_cardrule, ee, 6);
+ ee.setData({
+ is_card_rule: is_cardrule
+ });
+ })
+
+ //----------------------------获取最大的卡类-----------------------
+ getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + o.stoid, {
+
+ }).then(res => {
+ var plusCard = res.data.data;
+ var big_card = null;
+ var big_cards = null;
+ console.log(plusCard, "数据什么的", res);
+ for (var i = 0; i < plusCard.length; i++) {
+ big_cards = Math.max(plusCard[i].CardFee)
+ if (plusCard[i].CardFee == big_cards) {
+ big_card = plusCard[i]
+ }
+ }
+ console.log(big_cards, "是什么东西", big_card);
+
+ ee.setData({
+ is_plusCard: plusCard,
+ big_card: big_card
+ })
+
+ //缓存分享卡的图片
+ wx.getImageInfo({
+ src: big_card.CardImg,
+ success: function (res) {
+ //回调写法
+ var bas_ming = res.path;
+ ee.setData({ bas_ming: bas_ming });
+ }
+ })
+
+ })
//获取用户设备信息,屏幕宽度
@@ -156,10 +105,9 @@ Page({
})
}
})
+ var goods_list = this.selectComponent("#goods_list"); //组件的id
+ goods_list.get_list();
- // this.saveImageToPhotosAlbum();
- // this.puls_user();
-
},
@@ -204,41 +152,8 @@ Page({
console.log(user_card,"会员的卡类");
ee.setData({user_card: user_card});
})
- //-----------等级卡说明-------------------
- await getApp().request.promiseGet("/api/weshop/storeconfig/get/"+ os.stoid, {
- }).then(res => {
- var is_cardrule = res.data.data.cardrules;
- w.wxParse("content", "html", is_cardrule, ee, 6);
- ee.setData({
- is_card_rule: is_cardrule
- });
-
- })
-//----------------------------获取最大的卡类-----------------------
- await getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + o.stoid, {
-
- }).then(res => {
- var plusCard = res.data.data;
- var big_card = null;
- var big_cards = null;
- console.log(plusCard, "数据什么的", res);
- for (var i = 0; i < plusCard.length; i++) {
- big_cards = Math.max(plusCard[i].CardFee)
- if (plusCard[i].CardFee == big_cards) {
- big_card = plusCard[i]
- }
- }
- console.log(big_cards, "是什么东西", big_card);
-
- ee.setData({
- is_plusCard: plusCard,
- big_card: big_card
- })
-
- })
-
-
-
+
+
//-----------------获取会员信息-------------------------------
await getApp().request.promiseGet("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id,{
@@ -263,15 +178,7 @@ Page({
privilege_o, privilege_o
});
- //缓存分享卡的图片
- wx.getImageInfo({
- src: big_card.CardImg,
- success: function (res) {
- //回调写法
- var bas_ming = res.path;
- ee.setData({ bas_ming: bas_ming});
- }
- })
+
//缓存会员头像的图片
wx.getImageInfo({
src: user.head_pic,
@@ -320,7 +227,6 @@ Page({
}
})
-
//--------------------方块图---------------
wx.getImageInfo({
src: ee.data.img_square,
@@ -330,31 +236,13 @@ Page({
ee.setData({ img_square: img_square});
}
})
- //初始分享图页面
- // ee.saveImageToPhotosAlbum();
+
},
- //-----Plus会员获取-----------
- // puls_user: function () {
- // var th = this;
- // getApp().request.get("/api/weshop/plus/vip/mem/list", {
- // data: {
- // storeId: os.stoid,
- // userId: getApp().globalData.user_id,
- // },
- // success: function (su) {
- // if (su.data.code == 0) {
- // var cardname = su.data.data[0].MemCardName;
- // console.log("卡的名字", cardname);
- // th.setData({ pulscardname: cardname });
- // }
- // }
- // });
- // },
-
-
- //打开分享图片
+
+
+ //-----打开分享图片----
Share_pictures: function () {
this.setData({
@@ -364,31 +252,6 @@ Page({
},
-
- // //获取最大的卡类
- // getPlusCardType: function (e) {
- // var storid = o.stoid;
- // var th = this;
- // getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
- // var plusCard = res.data.data;
- // var big_card=null;
- // var big_cards = null;
- // console.log(plusCard, "数据什么的", res);
- // for (var i = 0; i < plusCard.length; i++) {
- // big_cards= Math.max(plusCard[i].CardFee)
- // if (plusCard[i].CardFee ==big_cards){
- // big_card = plusCard[i]
- // }
- // }
- // console.log(big_cards, "是什么东西", big_card);
-
- // th.setData({
- // is_plusCard: plusCard,
- // big_card: big_card
- // })
- // })
-
- // },
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -441,15 +304,14 @@ Page({
//开启画布
const ctx = wx.createCanvasContext('myCanvas');
-
-
+
//先画背景
- ctx.drawImage("../../../images/plus/share/mackground.png", 0, 0, 554 * unit, 930 * unit);
+ ctx.drawImage("../../../images/share/mackground.png", 0, 0, 554 * unit, 930 * unit);
ctx.setFontSize(26 * unit);
ctx.setFillStyle("rgb(0,0,0)");
ctx.fillText(user.nickname, 155 * unit, 75 * unit, 200 * unit);
- var tj_path = "../../../images/userinfo/q_tj.png";
+ var tj_path = "../../../images/share/q_tj.png";
ctx.drawImage(tj_path, 385 * unit, 45 * unit, 90 * unit, 30 * unit);
ctx.setFontSize(18 * unit);
ctx.setFillStyle("rgb(255,255,255)");
@@ -651,9 +513,7 @@ Page({
//绘制图片
ctx.draw(false,
-
function(){
-
setTimeout(function(){
wx.canvasToTempFilePath({
x: 0,
@@ -684,15 +544,11 @@ Page({
showCancel: false
})
}
-
}
-
})
},500)
-
-
- }
- )
+
+ })
})
@@ -755,9 +611,10 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
+ //同步初始化
+ this.init();
+
- var goods_list = this.selectComponent("#goods_list"); //组件的id
- goods_list.get_list();
},
/**
@@ -792,23 +649,52 @@ Page({
})
},
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- },
- //开通会员
- Opening: function () {
- this.setData({
- j: true
- })
+
+
+ //--转到用户余额--
+ to_user_money:function(){
+ var th=this,free=th.data.free;
+ if(!th.data.free.RefereeMoney){
+ getApp().my_warnning("您没有转入余额",0,th); return false;
+ }
+
+ wx.showModal({
+ title: '提示',
+ content: '您确定要转入余额吗?',
+ success(res) {
+ if (res.confirm) {
+ getApp().request.get("/api/weshop/plus/withdrawal/referee/money",{
+ data:{storeId:os.stoid,userId:getApp().globalData.user_id},
+ success:function(res){
+ if(res.data.code==0){
+ getApp().my_warnning("转入成功",0,th);
+ free.RefereeMoney=0;
+ th.setData({free:free});
+ }else{
+ getApp().my_warnning(res.data.msg ,0,th);
+ }
+ }
+ })
+ }
+ }
+ })
},
- //返回会员页面
- OpeningClose: function () {
- this.setData({
- j: false
- })
+
+ //-----立即续费的功能------
+ xufei:function(){
+ var th = this;
+ var is_card = 0;
+ var item = th.data.user_card;
+ var req = {};
+ req.cardId = item.CardId;
+ req.rechargeType = 4;
+ //如果不是你导购,也不是等级会员分享
+ req.storeId = os.stoid;
+ req.userId = getApp().globalData.user_id;
+ t_pay.pay(req, th.success, function () {
+ getApp().my_warnning("支付失败", 0, th);
+ });
+
}
})
\ No newline at end of file
diff --git a/pages/user/cardinfo/cardinfo.json b/pages/user/cardinfo/cardinfo.json
index d748815..a9abbf8 100644
--- a/pages/user/cardinfo/cardinfo.json
+++ b/pages/user/cardinfo/cardinfo.json
@@ -1,7 +1,8 @@
{
"usingComponents": {
"pop_txt": "/components/userqy_pop_up/userqy_pop_up",
- "goods_recommend": "/components/goods_list/goods_list"
+ "goods_recommend": "/components/goods_list/goods_list",
+ "warn": "/components/long_warn/long_warn"
},
"navigationBarTitleText": "会员续费"
}
\ No newline at end of file
diff --git a/pages/user/cardinfo/cardinfo.wxml b/pages/user/cardinfo/cardinfo.wxml
index c02dddc..525e8ce 100644
--- a/pages/user/cardinfo/cardinfo.wxml
+++ b/pages/user/cardinfo/cardinfo.wxml
@@ -14,7 +14,7 @@
{{user_card.CardName}}
会员将在{{filters.replace_time2(expiryDate)}}到期
- 立即续费
+ 立即续费
@@ -22,7 +22,9 @@
-
+
+
正在享受{{user_card.CardName}}会员特权
@@ -46,7 +48,7 @@
明细
- 立即提现
+ 转到余额
diff --git a/pages/user/cardinfo/cardinfo.wxss b/pages/user/cardinfo/cardinfo.wxss
index 4c5b03d..c34f284 100644
--- a/pages/user/cardinfo/cardinfo.wxss
+++ b/pages/user/cardinfo/cardinfo.wxss
@@ -144,7 +144,6 @@
height: 30rpx;
margin-right: 5rpx;
background-size: 100% 100%;
-position: relative;
-left: -40rpx;
-
+ background-blend-mode: lighten;
+ transform: translateX(-280%);
}
\ No newline at end of file
diff --git a/utils/util.js b/utils/util.js
index cdc6743..7d9695c 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -388,5 +388,5 @@ module.exports = {
measureText: measureText,//画布需要的函数
check_mobile: check_mobile,//验证手机
get_rand_item:get_rand_item, //随机获取元素
-
+ draw_randon_rect:draw_randon_rect //画图画圆角矩形
};