diff --git a/app.json b/app.json index 190518b..efe2e48 100644 --- a/app.json +++ b/app.json @@ -68,8 +68,11 @@ "pages/user/user_spsy/user_spsy", "pages/user/user_fw/user_fw", "pages/user/user_coupon/user_coupon", - "pages/user/grow_value/grow_value" + "pages/user/grow_value/grow_value", + "pages/user/plus/plus", + "pages/user/cardinfo/cardinfo" + ], "window": { "backgroundTextStyle": "light", diff --git a/pages/getphone/getphone.js b/pages/getphone/getphone.js index bd9b15e..6896cac 100644 --- a/pages/getphone/getphone.js +++ b/pages/getphone/getphone.js @@ -4,6 +4,13 @@ Page({ store:null, imghots: os.imghost, }, + + onLoad: function (options) { + //--判断是否有接受到邀请人的ID-- + if(options.first_leader){ + this.setData({first_leader:options.first_leader}); + } + }, onShow:function(){ var th=this,app = getApp(); var sessionKey = getApp().globalData.sessionKey; @@ -16,11 +23,8 @@ Page({ wx.navigateTo({ url: '/pages/togoin/togoin', }) return false; } - var user_info=getApp().globalData.userInfo; - console.log("getphone"); - console.log(user_info); if(user_info!=null && user_info.mobile!=undefined && user_info.mobile!="" && user_info.mobile!=null){ wx.navigateBack({ @@ -72,6 +76,11 @@ Page({ iv: e.iv, store_id: getApp().globalData.setting.stoid, }; + //--如果有邀请人的时候-- + if(th.data.first_leader){ + dd.first_leader=th.data.first_leader; + } + console.log(dd); app.request.get("/api/weshop/users/thirdLogin", { data: dd, diff --git a/pages/user/cardinfo/cardinfo.js b/pages/user/cardinfo/cardinfo.js new file mode 100644 index 0000000..0f064b5 --- /dev/null +++ b/pages/user/cardinfo/cardinfo.js @@ -0,0 +1,764 @@ +var e = function (e) { + return e && e.__esModule ? e : { + default: e + }; +}(require("../../../utils/LoadMore.js")), + 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(); +var regeneratorRuntime = require('../../../utils/runtime.js'); +var api = require('../../../api/api.js'); +//wx.downloadFile把线上地址设为本地地址 +Page({ + + /** + * 页面的初始数据 + */ + data: { + images: [o.imghost + "/miniapp/images/plus/card_one.jpg", o.imghost + "/miniapp/images/plus/card_two.jpg", o.imghost + "/miniapp/images/plus/card_three.jpg"], + + url: o.imghost, + screenWidth: 0, + screenheight: 0, + canvasHidden:1, + shareImgPath: null, + is_plusCard: "",//卡的列表 + imagePath: "", + user: null,//会员的数据 + is_card: 0,//用于判断是否是续费页和购买页面 0不是puls会员 + content: "",//等级卡规则 + is_card_rule: "",//等级卡规则判断用 + big_card: null,//最大的卡 + divide_into:"",//分佣 + is_loading:"",//判断分享只执行一次 + bas_ming:"",//分享的卡的图片 + head_pic:"",//会员头像 + img_money:"",//缓存VIP的图片 + img_Ancrown:"",//会员权益 + img_Identification:"",//缓存标识的图片 + img_square:"",//缓存方块的图片 + privilege_o:"",//卡的勋章图 + cardid: "",//会员卡的id + user_card: null,//会员买的卡 + free:null,//分佣的数据 + + + }, + // 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}); + // } + // }); + // }, + + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + var that = this; + + //同步初始化 + that.init(); + + //获取最大的卡类 + // 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(); + // } + // } + // }); + + + //获取用户设备信息,屏幕宽度 + wx.getSystemInfo({ + success: res => { + that.setData({ + screenWidth: res.screenWidth + }) + } + }) + + // this.saveImageToPhotosAlbum(); + // this.puls_user(); + + + }, + + +//------------程序初始化入口 同步------------- + async init() { + var ee = this, th = ee; + + //-------------会员卡的获取------------- + await getApp().request.promiseGet("/api/weshop/plus/vip/mem/list", + { + data: { + storeId: os.stoid, + userId: getApp().globalData.user_id, + }, + }).then(res => { + + var GradeCardID = res.data.data[0].GradeCardID + console.log(GradeCardID, "卡的id", res.data.data[0]); + ee.setData({cardid: GradeCardID}); + + }) + //-----------会员分佣------------------- + await getApp().request.promiseGet("/api/weshop/plus/vip/mem/freeze/money?userId=" + getApp().globalData.user_id + "&storeId=" + os.stoid, { + }).then(res => { + console.log("分佣的数据", res.data.data); + if (res.data.code==0){ + ee.setData({ free:res.data.data}); + }else{ + ee.setData({ free: 0 }); + } + + }) + //-----------会员的卡类------------------- + await getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/get?storeId=" + os.stoid + "&CardId=" + ee.data.cardid, { + }).then(res => { + var user_card= res.data.data; + 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,{ + + }).then(res => { + var user = res.data.data; + var url = ee.data.url; + console.log("是什么东西", url); + 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"; + console.log("图片转换",img_money); + var big_card = ee.data.big_card; + ee.setData({ + user: user, + img_money: img_money, + img_Ancrown: img_Ancrown , + img_Identification: img_Identification, + img_square, img_square , + 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, + success: function (res) { + //回调写法 + var user_head= res.path; + ee.setData({ head_pic: user_head }); + } + }) + }) + //--------------------缓存vip价格的图片--------------- + wx.getImageInfo({ + src:ee.data.img_money, + success: function (res) { + //回调写法 + var img_money = res.path; + ee.setData({ img_money: img_money}); + } + }) + //--------------------缓存权益的图片--------------- + wx.getImageInfo({ + src: ee.data.img_Ancrown, + success: function (res) { + //回调写法 + var img_Ancrown = res.path; + ee.setData({ img_Ancrown: img_Ancrown }); + } + }) + //--------------------缓存标识的图片--------------- + wx.getImageInfo({ + src: ee.data.img_Identification, + success: function (res) { + //回调写法 + var img_Identification = res.path; + ee.setData({ img_Identification: img_Identification }); + } + }) + + //--------------------卡的勋章--------------- + wx.getImageInfo({ + src: ee.data.privilege_o, + success: function (res) { + //回调写法 + var privilege_o = res.path; + ee.setData({ privilege_o: privilege_o }); + } + }) + + + //--------------------方块图--------------- + wx.getImageInfo({ + src: ee.data.img_square, + success: function (res) { + //回调写法 + var img_square = res.path; + 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({ + canvasHidden: false + }) + this.saveImageToPhotosAlbum(); + }, + + + + // //获取最大的卡类 + // 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 + // }) + // }) + + // }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + saveImageToPhotosAlbum: function () { + if (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: '生成中...', + }) + + 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; + console.log("user的会员资料", user); + console.log("最大的卡", big_card); + console.log("会员头像", card_ming); + console.log("缓存vip的价格", img_money); + console.log(" 会员标识", img_Ancrown); + console.log("/勋章图片", privilege_o); + var app = getApp(); + var unit = th.data.screenWidth / 750 * 1.35; + var scene = getApp().globalData.user_id; + console.log("二维码主键",scene); + ///二微码 + var vpath=""; + var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/plus/plus"; + wx.getImageInfo({ + src: path3, + success: function (res) { + //回调写法 + th.get_head_temp(th.get_goods_temp, function () { + 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; + ctx.save(); + // 开始绘制 + ctx.beginPath(); + // 因为边缘描边存在锯齿,最好指定使用 transparent 填充 + // 这里是使用 fill 还是 stroke都可以,二选一即可 + ctx.setFillStyle('rgb(237,188,150)') + // ctx.setStrokeStyle('transparent') + // 左上角 + ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5) + + // border-top + ctx.moveTo(x + r, y) + ctx.lineTo(x + w - r, y) + ctx.lineTo(x + w, y + r) + // 右上角 + ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2) + + // border-right + ctx.lineTo(x + w, y + h - r) + ctx.lineTo(x + w - r, y + h) + // 右下角 + ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5) + + // border-bottom + ctx.lineTo(x + r, y + h) + ctx.lineTo(x, y + h - r) + // 左下角 + ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI) + + // border-left + ctx.lineTo(x, y + r) + ctx.lineTo(x + r, y) + + // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应 + ctx.fill() + + 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(user_head, h_x, h_y, h_r * 2, h_r * 2); + ctx.restore(); + + var x = 345 * unit, + y = 190 * unit, + w = 105 * unit, + h = 30 * unit, + r = 14 * unit; + ctx.save(); + // 开始绘制 + ctx.beginPath(); + // 因为边缘描边存在锯齿,最好指定使用 transparent 填充 + // 这里是使用 fill 还是 stroke都可以,二选一即可 + ctx.setFillStyle('rgb(237,188,150)') + // ctx.setStrokeStyle('transparent') + // 左上角 + ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5) + + // border-top + ctx.moveTo(x + r, y) + ctx.lineTo(x + w - r, y) + ctx.lineTo(x + w, y + r) + // 右上角 + ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2) + + // border-right + ctx.lineTo(x + w, y + h - r) + ctx.lineTo(x + w - r, y + h) + // 右下角 + ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5) + + // border-bottom + ctx.lineTo(x + r, y + h) + ctx.lineTo(x, y + h - r) + // 左下角 + ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI) + + // border-left + ctx.lineTo(x, y + r) + ctx.lineTo(x + r, y) + + // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应 + ctx.fill() + + ctx.setFontSize(18 * unit); + ctx.setFillStyle("#000"); + ctx.fillText("立即开通", 362 * unit, 212 * unit); + + //绘制图片 + ctx.draw(false, + 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("sssssssssssssssssssssssss" + 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 + }) + } + + } + + })) + + + }, + //--获取商品图片的本地缓存,回调写法-- + get_goods_temp: function (tt) { + var ee = this; + if (ee.data.share_goods_img) { + tt(); + return false; + } + //获取商品是分享图信息 + wx.getImageInfo({ + src: ee.data.data.original_img, + success: function (res) { + //res.path是网络图片的本地地址 + ee.data.share_goods_img = res.path; + tt(); + }, + fail: function (res) { + ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 + tt(); + } + }); + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + var goods_list = this.selectComponent("#goods_list"); //组件的id + goods_list.get_list(); + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + var goods_list = this.selectComponent("#goods_list"); //组件的id + goods_list.get_list(); + this.setData({ + j: true + }) + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + //开通会员 + Opening: function () { + this.setData({ + j: true + }) + }, + //返回会员页面 + OpeningClose: function () { + this.setData({ + j: false + }) + } + +}) \ No newline at end of file diff --git a/pages/user/cardinfo/cardinfo.json b/pages/user/cardinfo/cardinfo.json new file mode 100644 index 0000000..d748815 --- /dev/null +++ b/pages/user/cardinfo/cardinfo.json @@ -0,0 +1,7 @@ + { + "usingComponents": { + "pop_txt": "/components/userqy_pop_up/userqy_pop_up", + "goods_recommend": "/components/goods_list/goods_list" + }, + "navigationBarTitleText": "会员续费" +} \ No newline at end of file diff --git a/pages/user/cardinfo/cardinfo.wxml b/pages/user/cardinfo/cardinfo.wxml new file mode 100644 index 0000000..e51c42d --- /dev/null +++ b/pages/user/cardinfo/cardinfo.wxml @@ -0,0 +1,131 @@ + + + + + + + + + + + + {{user_card.CardName}} + 会员将在{{user_card.ExpiryDate}}到期 + + 立即续费 + + + + + + + + + 正在享受{{user_card.CardName}}会员特权 + + + + 邀请新朋友 + + + + + + + + + 已邀请 + {{free==0?"0":free.RefereeNumber}}人 + 可提现 + {{free==0?"0":free.RefereeMoney}}元 + + + + + 明细 + + 立即提现 + + + + + + + + + + + + + + + + + 开通PLUSI会员尊享礼遇 + + PLUSI会员尊享礼遇 + + + + + + PLUSI会员可享以下特权 + + 解锁新权益 精彩享不停 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 好物推荐 + + + + + + + + + + + + GOOD HOT THING + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/user/cardinfo/cardinfo.wxss b/pages/user/cardinfo/cardinfo.wxss new file mode 100644 index 0000000..4c5b03d --- /dev/null +++ b/pages/user/cardinfo/cardinfo.wxss @@ -0,0 +1,150 @@ + @import "../../../utils/wxParse/wxParse.wxss"; + .Member_bk { + position:relative; + z-index: 0; + width: 100%; + height: 100%; +} +.MemberPlus { + width: 618rpx; + height: 290rpx; + border-radius: 18rpx; + box-shadow: 0rpx 0rpx 10rpx #888; + margin: 0rpx 35rpx; + color: #ffa786; + padding: 0rpx 31rpx; + padding-top: 60rpx; + background-size: 100%; +} +.renew { + width: 190rpx; + height: 50rpx; + border-radius: 18rpx; + background-color: rgb(237, 189, 150); + text-align: center; + line-height: 50rpx; + color: #000; + margin-top: 7rpx; + +} +.xs { + margin-top: 130rpx; +} +.MemberPlus .privilege { + width: 30rpx; + height: 30rpx; + margin-right: 7rpx; +} +.MemberPlus .share { + width: 30rpx; + height: 30rpx; + margin-left: 7rpx; +} +.Invitation { + padding: 0rpx 31rpx; + box-shadow: 0rpx 0rpx 10rpx #888; + height: 95rpx; + background-color: rgb(255, 255, 255); + z-index: 6; + position: relative; + margin-top: -15rpx; +} +.Invitation .Invitation_count, .Invitation_my { + color: rgb(237, 189, 153); +} +.Invitation .Detailed { + color: rgb(237, 189, 150); + text-decoration: underline; +} +.Invitation .Invitation_Cash { + width: 150rpx; + height: 45rpx; + line-height: 45rpx; + text-align: center; + border-radius: 25rpx; + margin-left: 30rpx; + background-color: rgb(237, 189, 150); + color: rgb(255, 255, 255); +} +.swiper, .Courtesy, .title { + position: relative; + z-index: 3; +} +.Courtesy_title { + color: rgb(173, 137, 79); + font-weight: bold; + margin-bottom: 10rpx; + letter-spacing: 2rpx; +} +.Courtesy_image { + width: 50rpx; + height: 25rpx; + margin-top: 8rpx; +} +.Courtesy_can { + margin: 0rpx 7rpx; + color: rgb(94, 93, 91); + font-weight: bold; +} + + +/* 热门好物 */ + +.title .China { + width: 100%; + margin-top: 60rpx; + margin-bottom: 10rpx; + line-height: 0rpx; +} + +.title .China .line view { + width: 2rpx; +} + +.title .China .line { + height: 40rpx; + color: rgb(51, 51, 51); +} + +.title .China .line view { + border-left: 3rpx solid #000; + margin-left: 5rpx; +} + +.title .China .line .one { + height: 23rpx; +} + +.title .China .line .two { + height: 15rpx; +} + +.title .China .line .three { + height: 18rpx; +} + +.title .China .Recommend { + margin: 0rpx 20rpx; + font-size: 28rpx; + line-height: 39rpx; + font-weight: bold; +} + +.title .english .silk { + width: 214rpx; + height: 2rpx; + background-color: #000; +} + +.title .english .esh { + margin: 0rpx 15rpx; +} +.Member { + width: 30rpx; + height: 30rpx; + margin-right: 5rpx; + background-size: 100% 100%; +position: relative; +left: -40rpx; + +} \ No newline at end of file diff --git a/pages/user/deposit/prepaid/prepaid.wxml b/pages/user/deposit/prepaid/prepaid.wxml index e5157ac..7672e75 100644 --- a/pages/user/deposit/prepaid/prepaid.wxml +++ b/pages/user/deposit/prepaid/prepaid.wxml @@ -10,8 +10,8 @@ 备注: {{perpaid.ItemName}} - 立即充值 + 立即充值 diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 5e32622..6d28ef2 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -12,25 +12,26 @@ Page({ * 页面的初始数据 */ data: { - length:150, - iurl: s.imghost, - defaultAvatar:s.imghost+"/miniapp/images/no-head.jpg", - userInfo:null, - toji:null, //统计相关 - txmon:0, - byquan: 0, - yuer: 0, - - currentPage:1, - recommend_list:[], - tc_hide: true, - sw_index:0, - qy_list:null, - gradeId:null, - is_init:0, - - cz_val:0, - full_cz_val:0, + length:150, + iurl: s.imghost, + defaultAvatar:s.imghost+"/miniapp/images/no-head.jpg", + userInfo:null, + toji:null, //统计相关 + txmon:0, + byquan: 0, + yuer: 0, + + currentPage:1, + recommend_list:[], + tc_hide: true, + sw_index:0, + qy_list:null, + gradeId:null, + is_init:0, + + cz_val:0, + full_cz_val:0, + is_dengji:0, //是不是等级 }, /** @@ -186,16 +187,24 @@ Page({ /*-- 获取 --*/ th.requestRecommend(); + + /*-------系统是否开通等级卡,会员是等级卡-----*/ + getApp().getConfig2(function (e) { + var t_swi=e.switch_list; + if(t_swi) t_swi=JSON.parse(t_swi) + if(parseInt(t_swi.rank_switch)==2){ + var userInfo=th.data.userInfo; + if(userInfo.card_field!=null && userInfo.card_field!=undefined && userInfo.card_field!="" ){ + th.setData({is_dengji:1}) + }else{ + th.setData({is_dengji:2}) + } + } + }) + } }); - /*-------系统是否开通等级卡,会员是等级卡-----*/ - getApp().getConfig2(function (e) { - var t_swi=e.switch_list; - if(t_swi) t_swi=JSON.parse(t_swi) - if(t_swi.rank_switch==2){ - } - }) }, //判断会员是后有改服务项目 diff --git a/pages/user/index/index.wxml b/pages/user/index/index.wxml index 77ee902..5e83b50 100644 --- a/pages/user/index/index.wxml +++ b/pages/user/index/index.wxml @@ -63,11 +63,11 @@ - + - 加入会员 - 预计可省345元 + 加入plus会员 + 预计可省3031元 立即开通 @@ -180,9 +180,9 @@ 联系客服 - + - 等级会员 + plus会员 diff --git a/pages/user/index/index.wxss b/pages/user/index/index.wxss index 15ef3d5..8f09d15 100644 --- a/pages/user/index/index.wxss +++ b/pages/user/index/index.wxss @@ -156,7 +156,7 @@ height: 84rpx; .xc-add-member .xc-icon{ width: 30rpx; height: 30rpx; - margin-left:50rpx; + margin-left:40rpx; } .xc-add-member .member{ @@ -172,7 +172,7 @@ height: 84rpx; .xc-add-member .xc-opening-button{ width: 120rpx; - margin-left:180rpx; + margin-left:140rpx; } .xc-opening{ diff --git a/pages/user/plus/plus.js b/pages/user/plus/plus.js index e1f9c6e..5fcf679 100644 --- a/pages/user/plus/plus.js +++ b/pages/user/plus/plus.js @@ -1,382 +1,291 @@ -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, + o = t.globalData.setting, os = o, i = require("../../../utils/util.js"), ut = i, s = require("../../../utils/common.js"), - n = new e.default(); -var regeneratorRuntime = require('../../../utils/runtime.js'); -var api = require('../../../api/api.js'); -//wx.downloadFile把线上地址设为本地地址 -Page({ + w = require("../../../utils/wxParse/wxParse.js"),t_pay = require("../../../utils/pay2.js"); + var regeneratorRuntime = require('../../../utils/runtime.js'); +Page({ /** * 页面的初始数据 */ data: { - images: [o.imghost + "/miniapp/images/plus/card_one.jpg", o.imghost + "/miniapp/images/plus/card_two.jpg", o.imghost + "/miniapp/images/plus/card_three.jpg"], currentId: 0, url: o.imghost, - j: false, screenWidth: 0, screenheight: 0, canvasHidden: true, shareImgPath: null, - plusCard: "", - imagePath: "" + is_plusCard: "",//卡的列表 + imagePath: "", + is_pulscardname: "",//plus会员的名字 + is_card: 0,//用于判断是否是续费页和购买页面 0不是puls会员 + content: "",//等级卡规则 + is_card_rule: "",//等级卡规则判断用 + is_show: 0, //页面要加载完才能显示 + open_yq: 0, //显示打开邀请码的弹窗 + by_index:null, //购买卡的下班 + + isyaoqingma:0, //是否邀请码 + is_salesman:0, //是否营业员 + inp_recommon: null, //输入的邀请码 + inp_serviceman: null, //输入的营业员 + is_fengxiang: 0, //是不是分享过来的 + def_recommon: null, //分享人的手机号 + def_serviceman: null, //分享人的营业员 + fir_leader:0, + }, - swiperChange: function(e) { + swiperChange: function (e) { var currentId = e.detail.current; this.setData({ currentId: currentId }) - }, /** * 生命周期函数--监听页面加载 */ - onLoad: function(options) { - var that = this; + onLoad: function (options) { + var that = this; + var store_id=getApp().globalData.setting.stoid; //获取用户设备信息,屏幕宽度 wx.getSystemInfo({ success: res => { - that.setData({ - screenWidth: res.screenWidth - }) + that.setData({screenWidth: res.screenWidth}) } }) - this.getPlusCardType(); - this.saveImageToPhotosAlbum(); - }, - //获取卡类 - getPlusCardType: function(e) { - var storid = o.stoid; - var th = this; - getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => { - th.setData({ - plusCard: res.data.data - }) - }) - - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - saveImageToPhotosAlbum: function() { - wx.showLoading({ - title: '生成中...', - }) - var th = this; - var unit = th.data.screenWidth / 750 * 1.35; - const ctx = wx.createCanvasContext('myCanvas'); - //设置画板显示,才能开始绘图 - th.setData({ - - canvasHidden: false - }) - 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("钱巧玲", 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; - ctx.save(); - // 开始绘制 - ctx.beginPath(); - // 因为边缘描边存在锯齿,最好指定使用 transparent 填充 - // 这里是使用 fill 还是 stroke都可以,二选一即可 - ctx.setFillStyle('rgb(237,188,150)') - // ctx.setStrokeStyle('transparent') - // 左上角 - ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5) - - // border-top - ctx.moveTo(x + r, y) - ctx.lineTo(x + w - r, y) - ctx.lineTo(x + w, y + r) - // 右上角 - ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2) - - // border-right - ctx.lineTo(x + w, y + h - r) - ctx.lineTo(x + w - r, y + h) - // 右下角 - ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5) - - // border-bottom - ctx.lineTo(x + r, y + h) - ctx.lineTo(x, y + h - r) - // 左下角 - ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI) - - // border-left - ctx.lineTo(x, y + r) - ctx.lineTo(x + r, y) - - // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应 - ctx.fill() - - ctx.clip(); //画了圆 再剪切 原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内 - ctx.drawImage("../../../images/plus/share/one.jpg", 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(237,188,150)"); - ctx.fillText("PLUSI会员", 80 * unit, 215 * unit); - ctx.setFontSize(18 * unit); - ctx.setFillStyle("rgb(237,188,150)"); - ctx.fillText("开通会员年卡仅199元", 80 * unit, 240 * unit); - - ctx.drawImage("../../../images/plus/share/privilege_o.png", 80 * unit, 343 * unit, 20 * unit, 20 * unit); - - ctx.setFontSize(14 * unit); - ctx.setFillStyle("rgb(237,188,150)"); - 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("../../../images/plus/share/square.png", 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("../../../images/plus/share/square.png", 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("../../../images/plus/share/Ancrown.png", 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("../../../images/plus/share/square.png", 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("../../../images/plus/share/Identification.png", 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("../../../images/plus/share/square.png", 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("../../../images/plus/share/money.png", 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("../../../images/userinfo/user_head.jpg", 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("../../../images/userinfo/user_head.jpg", h_x, h_y, h_r * 2, h_r * 2); - ctx.restore(); - - var x = 345 * unit, - y = 190 * unit, - w = 105 * unit, - h = 30 * unit, - r = 14 * unit; - ctx.save(); - // 开始绘制 - ctx.beginPath(); - // 因为边缘描边存在锯齿,最好指定使用 transparent 填充 - // 这里是使用 fill 还是 stroke都可以,二选一即可 - ctx.setFillStyle('rgb(237,188,150)') - // ctx.setStrokeStyle('transparent') - // 左上角 - ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5) - - // border-top - ctx.moveTo(x + r, y) - ctx.lineTo(x + w - r, y) - ctx.lineTo(x + w, y + r) - // 右上角 - ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2) - - // border-right - ctx.lineTo(x + w, y + h - r) - ctx.lineTo(x + w - r, y + h) - // 右下角 - ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5) - - // border-bottom - ctx.lineTo(x + r, y + h) - ctx.lineTo(x, y + h - r) - // 左下角 - ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI) - - // border-left - ctx.lineTo(x, y + r) - ctx.lineTo(x + r, y) - - // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应 - ctx.fill() - // ctx.stroke() - ctx.closePath() - // 剪切 - ctx.clip(); - - ctx.setFontSize(18 * unit); - ctx.setFillStyle("#000"); - ctx.fillText("立即开通", 362 * unit, 212 * unit); - - //绘制图片 - ctx.draw(false, - 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) { - console.log("sssssssssssssssssssssssss" + 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 - }) + var fir_leader = options.scene; + that.setData({fir_leader:fir_leader}) + if (fir_leader != null && fir_leader != undefined && fir_leader != "") { + var r_url="/api/weshop/plus/vip/mem/list?storeId=" + store_id + "&userId=" + fir_leader + getApp().request.get(r_url, { + success: function (res) { + var is_ok = 1; + if (res.data.code == -1) { + getApp().my_warnning("未找到分享会员", 0, that); + is_ok = 0; + that.back_user(); + } + var user_information = res.data.data[0]; + if (user_information['GradeCardID'] == null || user_information['GradeCardID'] == "" || user_information['GradeCardID'] == undefined) { + getApp().my_warnning("分享会员不是plus会员", 0, that); + is_ok = 0; + that.back_user(); + } + //--获取当前的时间-- + var now = ut.gettimestamp(); + if (user_information['ExpiryDate']) { + var str = user_information['ExpiryDate'].replace(/-/g, '/'); + var end = new Date(str); + end = Date.parse(end) / 1000; + if (end < now) { + getApp().my_warnning("分享plus会员已经过期", 0, that); + is_ok = 0; + that.back_user(); + } + } else { + getApp().my_warnning("分享plus会员已经过期", 0, that); + is_ok = 0; + that.back_user(); + } + if (is_ok == 1) { + that.setData({def_recommon: user_information.MobileTel, def_serviceman: user_information.StaffNo,is_fengxiang:1}) + //--先判断会员状态-- + var user_info=getApp().globalData.userInfo; + if(user_info==null || user_info.mobile==undefined || user_info.mobile=="" || user_info.mobile==null){ + wx.navigateTo({ url: '/pages/getphone/getphone?first_leader='+fir_leader, }) + return false; + } + } } - wx.hideLoading(); - } + }); + } - })) + //-----------商家配置信息----- 等级卡规则,是否又开邀请码,营业员------------ + getApp().request.get("/api/weshop/storeconfig/get/" + store_id, { + success: function (res) { + var is_cardrule = res.data.data.cardrules; + var switch_list= res.data.data.switch_list; + var swi_arr=JSON.parse(switch_list); + w.wxParse("content", "html", is_cardrule, that, 6); + that.setData({ + is_card_rule: is_cardrule, + isyaoqingma:parseInt(swi_arr.isyaoqingma), + is_salesman:parseInt(swi_arr.is_staffno) + }); + } + }); }, + /** * 生命周期函数--监听页面显示 */ - onShow: function() { - var goods_list = this.selectComponent("#goods_list"); //组件的id - goods_list.get_list(); + onShow: function () { + this.getPlusCardType(); }, /** * 生命周期函数--监听页面隐藏 */ - onHide: function() { + onHide: function () { }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - /** * 页面上拉触底事件的处理函数 */ - onReachBottom: function() { + onReachBottom: function () { var goods_list = this.selectComponent("#goods_list"); //组件的id goods_list.get_list(); - this.setData({ - j: true - }) }, - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() { + //--- 获取卡类列表 --- + 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; + } + }); + //---给数组添加立省多少钱--- + for (i = 0; i < plusCard.length; i++) { + for (var j = 0; j < new_arr.length; j++) { + if (i == new_arr[j].index) { + plusCard[i].free = arr[j]; + break; + } + } + } + th.setData({ + is_plusCard: plusCard, is_show: 1 + }) + var goods_list = th.selectComponent("#goods_list"); //组件的id + goods_list.get_list(); + }) }, - //开通会员 - Opening: function() { - this.setData({ - j: true + + //--开通会员---接受前端index,弹起窗口--- + Opening: function (e) { + var th = this; + th.data.by_index = e.currentTarget.dataset.ind; + + if (th.data.is_fengxiang) { + th.buy_card(); + } else { + //--如果后台都没有勾邀请码,营业员,立即购买-- + if (!th.data.isyaoqingma && !th.data.is_salesman) {th.buy_card(); return false;} + th.setData({open_yq: 1}) + } + }, + + //--立即购买卡-- + buy_card: async function () { + var th = this; + var is_card = 0; + //--商家是不是有等级卡功能,开通的人数是不是够用,开通是时间是不是到期-- + await getApp().request.promiseGet("/api/weshop/plus/plus/card/register", + {data: {storeId: os.stoid}}).then(res => { + if (res.data.code == 0) is_card = 1; }) + if (is_card == 0) getApp().my_warnning("请联系商家升级plus功能", 0, th); + var item = th.data.is_plusCard[th.data.by_index]; + var req = {}; + req.cardId = item.CardId; + req.rechargeType = 3; + //如果不是你导购,也不是等级会员分享 + if (th.data.is_fengxiang == 1) { + if (th.data.def_recommon) req.recommon = th.data.def_recommon + if (th.data.def_serviceman) req.serviceman = th.data.def_serviceman + } else { + //---后台要求要输入邀请码--- + if (th.data.isyaoqingma) { + if (!th.data.inp_recommon) { + getApp().my_warnning("请输入邀请码", 0, th); + return false; + } + req.recommon = th.data.inp_recommon + } + //--后台要求要输入营业员-- + if (th.data.is_salesman) { + if (!th.data.inp_serviceman) { + getApp().my_warnning("请输入营业员", 0, th); + return false; + } + req.serviceman = th.data.inp_serviceman + } + } + req.storeId = os.stoid; + req.userId = getApp().globalData.user_id; + //--如果有邀请码,和营业员的情况下-- + if(req.recommon || req.serviceman ) { + var req_data = {storeId: os.stoid, userId: req.userId}; + if(req.recommon) req_data.inviteCode=req.recommon; + if(req.serviceman) req_data.staffNo=req.serviceman; + getApp().request.get("/api/weshop/plus/vip/mem/referee/code/check", { + data:req_data, + success:function(res){ + if(res.data.code==0) { + t_pay.pay(req, th.success, function () { + getApp().my_warnning("支付失败", 0, th); + }); + }else{ + getApp().my_warnning("支付失败", 0, th); + } + } + }) + }else{ + t_pay.pay(req, th.success, function () { + getApp().my_warnning("支付失败", 0, th); + }); + } }, //返回会员页面 OpeningClose: function() { - this.setData({ - j: false - }) + this.setData({open_yq:0}); + }, + + //返回会员中心 + back_user:function () { + setTimeout(function () { + wx.reLaunch({url:"/pages/user/index/index"}); + },1000) + }, + //--支付成功,跳转到等级卡续费页面-- + success:function () { + var th=this; + getApp().my_warnning("支付成功", 0, th); + setTimeout(function () { + var u_url = "/pages/user/cardinfo/cardinfo"; + wx.reLaunch({url: u_url}) + },1500) + }, + + //--绑定邀请码的输入-- + b_input:function (e) { + var value=e.detail.value; + var name=e.currentTarget.dataset.name; + var ob={}; + ob[name]=value + this.setData(ob); } }) \ No newline at end of file diff --git a/pages/user/plus/plus.json b/pages/user/plus/plus.json index e763cd5..23e6f91 100644 --- a/pages/user/plus/plus.json +++ b/pages/user/plus/plus.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": "我的会员" + "navigationBarTitleText": "购买plus会员" } \ No newline at end of file diff --git a/pages/user/plus/plus.wxml b/pages/user/plus/plus.wxml index 468cf4b..4a24bee 100644 --- a/pages/user/plus/plus.wxml +++ b/pages/user/plus/plus.wxml @@ -1,8 +1,9 @@ + + - @@ -10,89 +11,32 @@ - - - + - {{item.CardName}} - 开通会员年卡仅199元 + 开通会员年卡仅{{item.CardFee}}元 - 立即开通 + 立即开通 - - - 根据大家购买数据,您成为超级会员预计可省¥2899元 + + + + 根据大家购买数据,您成为超级会员预计可省¥{{item.free}}元 - - - - - - - - - - - - PLUSI会员 - 开通会员年卡仅199元 - - 立即续费 - - - - - - - - - 正在享受PLUSI会员特权 - - - - 邀请新朋友 - - - - - - - - - - - - 已邀请 - 3人 - 可提现 - 66元 - - - - - 明细 - - 立即提现 - - - - - @@ -123,24 +67,10 @@ - - - - 1、 - 可以领取880元黑卡专享礼包 - - - - - - 2、 - 可以领取880元黑卡专享礼包 - - - - 3、 - 可以领取880元黑卡专享礼包 - + + + + @@ -152,9 +82,7 @@ - - - + 好物推荐 @@ -181,61 +109,48 @@ + - + - - + + 请完善下面信息 - - + + - + - - - + + - + - - + + 确认购买 - + - - - - - - - --> \ No newline at end of file diff --git a/pages/user/plus/plus.wxss b/pages/user/plus/plus.wxss index c2500a2..1d9c580 100644 --- a/pages/user/plus/plus.wxss +++ b/pages/user/plus/plus.wxss @@ -1,3 +1,4 @@ +@import "../../../utils/wxParse/wxParse.wxss"; page { width: 100%; height: 100%; @@ -161,6 +162,10 @@ swiper { width: 30rpx; height: 30rpx; margin-right: 5rpx; + background-size: 100% 100%; +position: relative; +left: -40rpx; + } .Membership .Opening { @@ -171,6 +176,7 @@ swiper { line-height: 45rpx; text-align: center; margin-top: 2rpx; + color: #666 } .Invitation { @@ -262,11 +268,10 @@ swiper { right: 0; bottom: 0; z-index: 11; - background: rgba(0, 0, 0, 0.4); + background: rgba(0, 0, 0, 0.6); width: 100%; height: 100%; } - .ddd { border-radius: 20rpx; } @@ -340,6 +345,7 @@ swiper { border-radius: 25rpx; color: rgb(255, 255, 255); margin: 55rpx 0rpx; + background-position: center;background-repeat: no-repeat;background-size: cover } .purchaseClose { @@ -350,6 +356,7 @@ swiper { } input { + overflow: visible; width: 360rpx; } diff --git a/utils/pay2.js b/utils/pay2.js new file mode 100644 index 0000000..a99a44c --- /dev/null +++ b/utils/pay2.js @@ -0,0 +1,40 @@ +var t = getApp(), n = t.request; + +module.exports = { + url: "/api/weshop/plus/create/plus/order", + pay: function(dd, succ,fail) { + var i = this; + n.post(this.url, { + data: dd, + success: function(t) { + if(t.data.code==0){ + i.weixinPay(t.data.data, succ,fail); + }else{ + "function" == typeof fail && fail(); + } + return false; + }, + fail: function() { + "function" == typeof fail && fail(); + }, + failStatus: function() { + "function" == typeof fail && fail(); + } + }); + }, + weixinPay: function(n, succ,fail) { + wx.requestPayment({ + timeStamp: String(n.timeStamp), + nonceStr: n.nonceStr, + package: n.packageValue, + signType: n.signType, + paySign: n.paySign, + success: function(n) { + "function" == typeof succ && succ(); + }, + fail: function(n) { + "function" == typeof fail && fail(); + } + }); + } +}; \ No newline at end of file