Commit 72d65e45871dad51ee380b8252f05118f2eadf77

Authored by yvan.ni
1 parent a1806b79

等级卡购买,等级卡分享 的购买流程实现

pages/getphone/getphone.js
... ... @@ -4,6 +4,13 @@ Page({
4 4 store:null,
5 5 imghots: os.imghost,
6 6 },
  7 +
  8 + onLoad: function (options) {
  9 + //--判断是否有接受到邀请人的ID--
  10 + if(options.first_leader){
  11 + this.setData({first_leader:options.first_leader});
  12 + }
  13 + },
7 14 onShow:function(){
8 15 var th=this,app = getApp();
9 16 var sessionKey = getApp().globalData.sessionKey;
... ... @@ -16,11 +23,8 @@ Page({
16 23 wx.navigateTo({ url: '/pages/togoin/togoin', })
17 24 return false;
18 25 }
19   -
20 26 var user_info=getApp().globalData.userInfo;
21   -
22 27 console.log("getphone");
23   - console.log(user_info);
24 28  
25 29 if(user_info!=null && user_info.mobile!=undefined && user_info.mobile!="" && user_info.mobile!=null){
26 30 wx.navigateBack({
... ... @@ -72,6 +76,11 @@ Page({
72 76 iv: e.iv,
73 77 store_id: getApp().globalData.setting.stoid,
74 78 };
  79 + //--如果有邀请人的时候--
  80 + if(th.data.first_leader){
  81 + dd.first_leader=th.data.first_leader;
  82 + }
  83 +
75 84 console.log(dd);
76 85 app.request.get("/api/weshop/users/thirdLogin", {
77 86 data: dd,
... ...
pages/user/index/index.js
... ... @@ -12,25 +12,26 @@ Page({
12 12 * 页面的初始数据
13 13 */
14 14 data: {
15   - length:150,
16   - iurl: s.imghost,
17   - defaultAvatar:s.imghost+"/miniapp/images/no-head.jpg",
18   - userInfo:null,
19   - toji:null, //统计相关
20   - txmon:0,
21   - byquan: 0,
22   - yuer: 0,
23   -
24   - currentPage:1,
25   - recommend_list:[],
26   - tc_hide: true,
27   - sw_index:0,
28   - qy_list:null,
29   - gradeId:null,
30   - is_init:0,
31   -
32   - cz_val:0,
33   - full_cz_val:0,
  15 + length:150,
  16 + iurl: s.imghost,
  17 + defaultAvatar:s.imghost+"/miniapp/images/no-head.jpg",
  18 + userInfo:null,
  19 + toji:null, //统计相关
  20 + txmon:0,
  21 + byquan: 0,
  22 + yuer: 0,
  23 +
  24 + currentPage:1,
  25 + recommend_list:[],
  26 + tc_hide: true,
  27 + sw_index:0,
  28 + qy_list:null,
  29 + gradeId:null,
  30 + is_init:0,
  31 +
  32 + cz_val:0,
  33 + full_cz_val:0,
  34 + is_dengji:0, //是不是等级
34 35 },
35 36  
36 37 /**
... ... @@ -186,16 +187,24 @@ Page({
186 187  
187 188 /*-- 获取 --*/
188 189 th.requestRecommend();
  190 +
  191 + /*-------系统是否开通等级卡,会员是等级卡-----*/
  192 + getApp().getConfig2(function (e) {
  193 + var t_swi=e.switch_list;
  194 + if(t_swi) t_swi=JSON.parse(t_swi)
  195 + if(parseInt(t_swi.rank_switch)==2){
  196 + var userInfo=th.data.userInfo;
  197 + if(userInfo.card_field!=null && userInfo.card_field!=undefined && userInfo.card_field!="" ){
  198 + th.setData({is_dengji:1})
  199 + }else{
  200 + th.setData({is_dengji:2})
  201 + }
  202 + }
  203 + })
  204 +
189 205 }
190 206 });
191   - /*-------系统是否开通等级卡,会员是等级卡-----*/
192   - getApp().getConfig2(function (e) {
193   - var t_swi=e.switch_list;
194   - if(t_swi) t_swi=JSON.parse(t_swi)
195   - if(t_swi.rank_switch==2){
196 207  
197   - }
198   - })
199 208 },
200 209  
201 210 //判断会员是后有改服务项目
... ...
pages/user/index/index.wxml
... ... @@ -63,11 +63,11 @@
63 63 </image>
64 64  
65 65 </view>
66   - <view class="xc-add-member-frame flex-level rel addplus">
  66 + <view class="xc-add-member-frame flex-level rel addplus" wx:if="{{is_dengji==2}}">
67 67 <view class="xc-add-member flex-vertical four-level-word">
68 68 <image class="xc-icon" src="{{iurl}}/miniapp/images/user/user_vip.png"></image>
69   - <view class="member"> 加入会员</view>
70   - <view class="t-c xc-save-money"> 预计可省345元</view>
  69 + <view class="member"> 加入plus会员</view>
  70 + <view class="t-c xc-save-money"> 预计可省3031元</view>
71 71 <view class="xc-opening-button t-c" data-url="/pages/user/plus/plus" bindtap="goto">
72 72 <view class="xc-opening fs20">立即开通</view>
73 73 </view>
... ... @@ -180,9 +180,9 @@
180 180 <view class="fs26">联系客服</view>
181 181 </view>
182 182  
183   - <view class="item t-c" data-url="/pages/user/plus/plus" bindtap="goto">
  183 + <view class="item t-c" data-url="/pages/user/plus/plus?is_card=1" bindtap="goto" wx:if="{{is_dengji==1}}">
184 184 <image class="xc-center-img " src="{{iurl}}/miniapp/images/plus/privilege_o.png"></image>
185   - <view class="fs26">等级会员</view>
  185 + <view class="fs26">plus会员</view>
186 186 </view>
187 187  
188 188 <view class="item t-c" data-url="/pages/user/collect_list/collect_list" bindtap="goto">
... ...
pages/user/index/index.wxss
... ... @@ -156,7 +156,7 @@ height: 84rpx;
156 156 .xc-add-member .xc-icon{
157 157 width: 30rpx;
158 158 height: 30rpx;
159   - margin-left:50rpx;
  159 + margin-left:40rpx;
160 160  
161 161 }
162 162 .xc-add-member .member{
... ... @@ -172,7 +172,7 @@ height: 84rpx;
172 172  
173 173 .xc-add-member .xc-opening-button{
174 174 width: 120rpx;
175   - margin-left:180rpx;
  175 + margin-left:140rpx;
176 176 }
177 177  
178 178 .xc-opening{
... ...
pages/user/plus/plus.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 7 s = require("../../../utils/common.js"),
13   - w = require("../../../utils/wxParse/wxParse.js"),
14   - n = new e.default();
15   -var regeneratorRuntime = require('../../../utils/runtime.js');
16   -var api = require('../../../api/api.js');
17   -//wx.downloadFile把线上地址设为本地地址
18   -Page({
  8 + w = require("../../../utils/wxParse/wxParse.js"),t_pay = require("../../../utils/pay2.js");
  9 + var regeneratorRuntime = require('../../../utils/runtime.js');
19 10  
  11 +Page({
20 12 /**
21 13 * 页面的初始数据
22 14 */
23 15 data: {
24   - 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"],
25 16 currentId: 0,
26 17 url: o.imghost,
27 18 screenWidth: 0,
... ... @@ -31,422 +22,266 @@ Page({
31 22 is_plusCard: "",//卡的列表
32 23 imagePath: "",
33 24 is_pulscardname: "",//plus会员的名字
34   - is_card:0,//用于判断是否是续费页和购买页面 0不是puls会员
35   - content:"",//等级卡规则
  25 + is_card: 0,//用于判断是否是续费页和购买页面 0不是puls会员
  26 + content: "",//等级卡规则
36 27 is_card_rule: "",//等级卡规则判断用
  28 + is_show: 0, //页面要加载完才能显示
  29 + open_yq: 0, //显示打开邀请码的弹窗
  30 + by_index:null, //购买卡的下班
  31 +
  32 + isyaoqingma:0, //是否邀请码
  33 + is_salesman:0, //是否营业员
  34 + inp_recommon: null, //输入的邀请码
  35 + inp_serviceman: null, //输入的营业员
  36 + is_fengxiang: 0, //是不是分享过来的
  37 + def_recommon: null, //分享人的手机号
  38 + def_serviceman: null, //分享人的营业员
  39 + fir_leader:0,
  40 +
37 41 },
38   - swiperChange: function(e) {
  42 + swiperChange: function (e) {
39 43 var currentId = e.detail.current;
40 44 this.setData({
41 45 currentId: currentId
42 46 })
43   -
44 47 },
45 48 /**
46 49 * 生命周期函数--监听页面加载
47 50 */
48   - onLoad: function(options) {
49   - console.log(111);
50   - var that = this;
51   - getApp().request.get("/api/weshop/users/get/" + os.stoid + "/" + getApp().globalData.user_id, {
52   - success: function (res) {
53   - var user_information=res.data.data;
54   - console.log(res, "会员个人信息");
55   - //判断是是不是会员
56   - if (user_information == null || user_information == ""){
57   -
58   - }
59   - //判断是是不是plus会员
60   - if (user_information.card_field == null || user_information.card_fiel == "") {
61   - that.setData({ is_card:1});
62   -
63   - }
64   - if (user_information.card_expiredate == null || user_information.card_expiredate == ""){
65   -
66   - }
67   -
68   - }
69   - });
70   -
71   -
72   -
  51 + onLoad: function (options) {
  52 + var that = this;
  53 + var store_id=getApp().globalData.setting.stoid;
73 54 //获取用户设备信息,屏幕宽度
74 55 wx.getSystemInfo({
75 56 success: res => {
76   - that.setData({
77   - screenWidth: res.screenWidth
78   - })
  57 + that.setData({screenWidth: res.screenWidth})
79 58 }
80 59 })
81   - this.getPlusCardType();
82   - this.saveImageToPhotosAlbum();
83   - this.puls_user();
84   - //-----------商家配置信息----- 等级卡规则------------
85   -
86   - getApp().request.get("/api/weshop/storeconfig/get/"+ os.stoid, {
  60 + var fir_leader = options.scene;
  61 + that.setData({fir_leader:fir_leader})
  62 + if (fir_leader != null && fir_leader != undefined && fir_leader != "") {
  63 + var r_url="/api/weshop/plus/vip/mem/list?storeId=" + store_id + "&userId=" + fir_leader
  64 + getApp().request.get(r_url, {
  65 + success: function (res) {
  66 + var is_ok = 1;
  67 + if (res.data.code == -1) {
  68 + getApp().my_warnning("未找到分享会员", 0, that);
  69 + is_ok = 0;
  70 + that.back_user();
  71 + }
  72 + var user_information = res.data.data[0];
  73 + if (user_information['GradeCardID'] == null || user_information['GradeCardID'] == "" || user_information['GradeCardID'] == undefined) {
  74 + getApp().my_warnning("分享会员不是plus会员", 0, that);
  75 + is_ok = 0;
  76 + that.back_user();
  77 + }
  78 + //--获取当前的时间--
  79 + var now = ut.gettimestamp();
  80 + if (user_information['ExpiryDate']) {
  81 + var str = user_information['ExpiryDate'].replace(/-/g, '/');
  82 + var end = new Date(str);
  83 + end = Date.parse(end) / 1000;
  84 + if (end < now) {
  85 + getApp().my_warnning("分享plus会员已经过期", 0, that);
  86 + is_ok = 0;
  87 + that.back_user();
  88 + }
  89 + } else {
  90 + getApp().my_warnning("分享plus会员已经过期", 0, that);
  91 + is_ok = 0;
  92 + that.back_user();
  93 + }
  94 + if (is_ok == 1) {
  95 + that.setData({def_recommon: user_information.MobileTel, def_serviceman: user_information.StaffNo,is_fengxiang:1})
  96 + //--先判断会员状态--
  97 + var user_info=getApp().globalData.userInfo;
  98 + if(user_info==null || user_info.mobile==undefined || user_info.mobile=="" || user_info.mobile==null){
  99 + wx.navigateTo({ url: '/pages/getphone/getphone?first_leader='+fir_leader, })
  100 + return false;
  101 + }
  102 + }
  103 + }
  104 + });
  105 + }
  106 +
  107 + //-----------商家配置信息----- 等级卡规则,是否又开邀请码,营业员------------
  108 + getApp().request.get("/api/weshop/storeconfig/get/" + store_id, {
87 109 success: function (res) {
88   - var is_cardrule=res.data.data.cardrules;
  110 + var is_cardrule = res.data.data.cardrules;
  111 + var switch_list= res.data.data.switch_list;
  112 + var swi_arr=JSON.parse(switch_list);
  113 +
89 114 w.wxParse("content", "html", is_cardrule, that, 6);
90   -
91   - console.log("等级卡规则8888888888888", is_cardrule);
92 115 that.setData({
93   - is_card_rule: is_cardrule
  116 + is_card_rule: is_cardrule,
  117 + isyaoqingma:parseInt(swi_arr.isyaoqingma),
  118 + is_salesman:parseInt(swi_arr.is_staffno)
94 119 });
95 120 }
96 121 });
97 122 },
98 123  
99   - //-----Plus会员获取-----------
100   - puls_user: function () {
101   - var th = this;
102   - getApp().request.get("/api/weshop/plus/vip/mem/list", {
103   - data: {
104   - storeId: os.stoid,
105   - userId: getApp().globalData.user_id,
106   - },
107   - success: function (su) {
108   - if (su.data.code == 0) {
109   - var cardname = su.data.data[0].MemCardName;
110   - console.log("卡的名字", cardname);
111   - th.setData({ pulscardname: cardname });
112   - }
113   - }
114   - });
  124 + /**
  125 + * 生命周期函数--监听页面显示
  126 + */
  127 + onShow: function () {
  128 + this.getPlusCardType();
115 129 },
116 130  
  131 + /**
  132 + * 生命周期函数--监听页面隐藏
  133 + */
  134 + onHide: function () {
117 135  
  136 + },
  137 + /**
  138 + * 页面上拉触底事件的处理函数
  139 + */
  140 + onReachBottom: function () {
  141 + var goods_list = this.selectComponent("#goods_list"); //组件的id
  142 + goods_list.get_list();
  143 + },
118 144  
119   -
120   -
121   - //获取卡类
122   - getPlusCardType: function(e) {
  145 + //--- 获取卡类列表 ---
  146 + getPlusCardType: function (e) {
123 147 var storid = o.stoid;
124 148 var th = this;
125 149 getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
126 150 var plusCard = res.data.data;
127 151 var arr = [1219, 2089, 3031];
128   - for(var i = 0; i < plusCard.length;i++){
129   - plusCard[i].free=arr[i];
  152 + var new_arr = new Array();
  153 + for (var i = 0; i < plusCard.length; i++) {
  154 + //plusCard[i].free=arr[i];
  155 + var item = {"fee": plusCard[i].CardFee, 'index': i}
  156 + new_arr.push(item);
  157 + }
  158 + //根據距離遠近排序,越近在前面,升序
  159 + new_arr.sort(function (a, b) {
  160 + if (a.fee < b.fee) {
  161 + return -1;
  162 + } else if (a.fee == b.fee) {
  163 + return 0;
  164 + } else {
  165 + return 1;
  166 + }
  167 + });
  168 + //---给数组添加立省多少钱---
  169 + for (i = 0; i < plusCard.length; i++) {
  170 + for (var j = 0; j < new_arr.length; j++) {
  171 + if (i == new_arr[j].index) {
  172 + plusCard[i].free = arr[j];
  173 + break;
  174 + }
  175 + }
130 176 }
131   -
132 177 th.setData({
133   - is_plusCard: plusCard
  178 + is_plusCard: plusCard, is_show: 1
134 179 })
135   - })
  180 + var goods_list = th.selectComponent("#goods_list"); //组件的id
  181 + goods_list.get_list();
136 182  
137   - },
138   - /**
139   - * 生命周期函数--监听页面初次渲染完成
140   - */
141   - saveImageToPhotosAlbum: function() {
142   - wx.showLoading({
143   - title: '生成中...',
144 183 })
  184 + },
  185 +
  186 + //--开通会员---接受前端index,弹起窗口---
  187 + Opening: function (e) {
145 188 var th = this;
146   - var unit = th.data.screenWidth / 750 * 1.35;
147   - const ctx = wx.createCanvasContext('myCanvas');
148   - //设置画板显示,才能开始绘图
149   - th.setData({
  189 + th.data.by_index = e.currentTarget.dataset.ind;
  190 +
  191 + if (th.data.is_fengxiang) {
  192 + th.buy_card();
  193 + } else {
  194 + //--如果后台都没有勾邀请码,营业员,立即购买--
  195 + if (!th.data.isyaoqingma && !th.data.is_salesman) {th.buy_card(); return false;}
  196 + th.setData({open_yq: 1})
  197 + }
  198 + },
150 199  
151   - canvasHidden: false
  200 + //--立即购买卡--
  201 + buy_card: async function () {
  202 + var th = this;
  203 + var is_card = 0;
  204 + //--商家是不是有等级卡功能,开通的人数是不是够用,开通是时间是不是到期--
  205 + await getApp().request.promiseGet("/api/weshop/plus/plus/card/register",
  206 + {data: {storeId: os.stoid}}).then(res => {
  207 + if (res.data.code == 0) is_card = 1;
152 208 })
153   - ctx.drawImage("../../../images/plus/share/mackground.png", 0, 0, 554 * unit, 930 * unit);
154   - ctx.setFontSize(26 * unit);
155   - ctx.setFillStyle("rgb(0,0,0)");
156   - ctx.fillText("钱巧玲", 155 * unit, 75 * unit, 200 * unit);
157   -
158   - var tj_path = "../../../images/userinfo/q_tj.png";
159   - ctx.drawImage(tj_path, 385 * unit, 45 * unit, 90 * unit, 30 * unit);
160   - ctx.setFontSize(18 * unit);
161   - ctx.setFillStyle("rgb(255,255,255)");
162   - ctx.fillText("强烈推荐", 394 * unit, 65 * unit);
163   -
164   - ctx.setStrokeStyle("rgb(255,255,255)");
165   - ctx.setLineDash([5 * unit, 5 * unit], 5 * unit);
166   - ctx.beginPath();
167   - ctx.moveTo(0, 125 * unit);
168   - ctx.lineTo(554 * unit, 125 * unit);
169   - ctx.stroke();
170   -
171   - var x = 55 * unit,
172   - y = 165 * unit,
173   - w = 444 * unit,
174   - h = 220 * unit,
175   - r = 14 * unit;
176   - ctx.save();
177   - // 开始绘制
178   - ctx.beginPath();
179   - // 因为边缘描边存在锯齿,最好指定使用 transparent 填充
180   - // 这里是使用 fill 还是 stroke都可以,二选一即可
181   - ctx.setFillStyle('rgb(237,188,150)')
182   - // ctx.setStrokeStyle('transparent')
183   - // 左上角
184   - ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5)
185   -
186   - // border-top
187   - ctx.moveTo(x + r, y)
188   - ctx.lineTo(x + w - r, y)
189   - ctx.lineTo(x + w, y + r)
190   - // 右上角
191   - ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2)
192   -
193   - // border-right
194   - ctx.lineTo(x + w, y + h - r)
195   - ctx.lineTo(x + w - r, y + h)
196   - // 右下角
197   - ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5)
198   -
199   - // border-bottom
200   - ctx.lineTo(x + r, y + h)
201   - ctx.lineTo(x, y + h - r)
202   - // 左下角
203   - ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI)
204   -
205   - // border-left
206   - ctx.lineTo(x, y + r)
207   - ctx.lineTo(x + r, y)
208   -
209   - // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应
210   - ctx.fill()
211   -
212   - ctx.clip(); //画了圆 再剪切 原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内
213   - ctx.drawImage("../../../images/plus/share/one.jpg", x, y, 444 * unit, 220 * unit); // 推进去图片
214   - ctx.restore(); //恢复之前保存的绘图上下文 恢复之前保存的绘图上下午即状态 可以继续绘制
215   -
216   - ctx.beginPath();
217   - // 卡图片
218   - // ctx.drawImage("../../../images/plus/share/one.jpg", 55 * unit, 165 * unit, 444 * unit, 220 * unit,);
219   - ctx.setFontSize(26 * unit);
220   - ctx.setFillStyle("rgb(237,188,150)");
221   - ctx.fillText("PLUSI会员", 80 * unit, 215 * unit);
222   - ctx.setFontSize(18 * unit);
223   - ctx.setFillStyle("rgb(237,188,150)");
224   - ctx.fillText("开通会员年卡仅199元", 80 * unit, 240 * unit);
225   -
226   - ctx.drawImage("../../../images/plus/share/privilege_o.png", 80 * unit, 343 * unit, 20 * unit, 20 * unit);
227   -
228   - ctx.setFontSize(14 * unit);
229   - ctx.setFillStyle("rgb(237,188,150)");
230   - ctx.fillText("根据大家购买数据,您成为超级会员预计可省¥3031元", 105 * unit, 360 * unit);
231   -
232   - ctx.rect(70 * unit, 425 * unit, 182 * unit, 1 * unit);
233   - ctx.setFillStyle('rgb(218,194,169)');
234   - ctx.fill();
235   -
236   - ctx.drawImage("../../../images/plus/share/square.png", 267 * unit, 420 * unit, 13 * unit, 13 * unit);
237   -
238   - ctx.beginPath();
239   - ctx.rect(295 * unit, 425 * unit, 182 * unit, 1 * unit);
240   - ctx.setFillStyle('rgb(218,194,169)');
241   - ctx.fill();
242   -
243   - ctx.drawImage("../../../images/plus/share/square.png", 80 * unit, 470 * unit, 10 * unit, 10 * unit);
244   - ctx.setFontSize(24 * unit);
245   - ctx.setFillStyle("rgb(198,165,126)");
246   - ctx.fillText("超级VIP权益", 100 * unit, 475 * unit);
247   -
248   - ctx.setFontSize(20 * unit);
249   - ctx.setFillStyle("rgb(198,165,126)");
250   - ctx.fillText("超级会员专属权益", 100 * unit, 505 * unit);
251   - ctx.drawImage("../../../images/plus/share/Ancrown.png", 355 * unit, 440 * unit, 65 * unit, 65 * unit);
252   -
253   - ctx.rect(85 * unit, 530 * unit, 375 * unit, 1 * unit)
254   - ctx.setFillStyle('rgb(218,194,169)')
255   - ctx.fill();
256   -
257   - ctx.drawImage("../../../images/plus/share/square.png", 80 * unit, 575 * unit, 10 * unit, 10 * unit);
258   - ctx.setFontSize(24 * unit);
259   - ctx.setFillStyle("rgb(198,165,126)");
260   - ctx.fillText("超级VIP标识", 100 * unit, 580 * unit);
261   -
262   - ctx.setFontSize(20 * unit);
263   - ctx.setFillStyle("rgb(198,165,126)");
264   - ctx.fillText("彰显尊贵身份的象征", 100 * unit, 610 * unit);
265   - ctx.drawImage("../../../images/plus/share/Identification.png", 355 * unit, 548 * unit, 65 * unit, 65 * unit);
266   -
267   - ctx.rect(85 * unit, 635 * unit, 375 * unit, 1 * unit);
268   - ctx.setFillStyle('rgb(218,194,169)');
269   - ctx.fill();
270   -
271   - ctx.drawImage("../../../images/plus/share/square.png", 80 * unit, 695 * unit, 10 * unit, 10 * unit);
272   - ctx.setFontSize(24 * unit);
273   - ctx.setFillStyle("rgb(198,165,126)");
274   - ctx.fillText("超级VIP价格", 100 * unit, 695 * unit);
275   -
276   - ctx.setFontSize(20 * unit);
277   - ctx.setFillStyle("rgb(198,165,126)");
278   - ctx.fillText("享受专属会员超低价", 100 * unit, 725 * unit);
279   - ctx.drawImage("../../../images/plus/share/money.png", 355 * unit, 660 * unit, 65 * unit, 65 * unit);
280   -
281   - ctx.rect(85 * unit, 750 * unit, 375 * unit, 1 * unit)
282   - ctx.setFillStyle('rgb(218,194,169)')
283   - ctx.fill();
284   -
285   - ctx.drawImage("../../../images/userinfo/user_head.jpg", 100 * unit, 780 * unit, 110 * unit, 110 * unit);
286   -
287   - ctx.setFontSize(20 * unit);
288   - ctx.setFillStyle("#000");
289   - ctx.fillText("解锁新权益 精彩享不停", 230 * unit, 825 * unit);
290   -
291   - ctx.setFontSize(20 * unit);
292   - ctx.setFillStyle("#000");
293   - ctx.fillText("长按识别二维码,立即开通!", 230 * unit, 865 * unit);
294   -
295   - //---绘制圆形要放在最后----
296   - ctx.save();
297   - ctx.beginPath();
298   - var h_x = 60 * unit;
299   - var h_y = 24 * unit;
300   - var h_r = 40 * unit;
301   - var cx = h_x + h_r;
302   - var cy = h_y + h_r;
303   - ctx.arc(cx, cy, h_r, 0, Math.PI * 2, false);
304   - ctx.closePath();
305   - ctx.fill();
306   - ctx.clip();
307   - ctx.drawImage("../../../images/userinfo/user_head.jpg", h_x, h_y, h_r * 2, h_r * 2);
308   - ctx.restore();
309   -
310   - var x = 345 * unit,
311   - y = 190 * unit,
312   - w = 105 * unit,
313   - h = 30 * unit,
314   - r = 14 * unit;
315   - ctx.save();
316   - // 开始绘制
317   - ctx.beginPath();
318   - // 因为边缘描边存在锯齿,最好指定使用 transparent 填充
319   - // 这里是使用 fill 还是 stroke都可以,二选一即可
320   - ctx.setFillStyle('rgb(237,188,150)')
321   - // ctx.setStrokeStyle('transparent')
322   - // 左上角
323   - ctx.arc(x + r, y + r, r, Math.PI, Math.PI * 1.5)
324   -
325   - // border-top
326   - ctx.moveTo(x + r, y)
327   - ctx.lineTo(x + w - r, y)
328   - ctx.lineTo(x + w, y + r)
329   - // 右上角
330   - ctx.arc(x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2)
331   -
332   - // border-right
333   - ctx.lineTo(x + w, y + h - r)
334   - ctx.lineTo(x + w - r, y + h)
335   - // 右下角
336   - ctx.arc(x + w - r, y + h - r, r, 0, Math.PI * 0.5)
337   -
338   - // border-bottom
339   - ctx.lineTo(x + r, y + h)
340   - ctx.lineTo(x, y + h - r)
341   - // 左下角
342   - ctx.arc(x + r, y + h - r, r, Math.PI * 0.5, Math.PI)
343   -
344   - // border-left
345   - ctx.lineTo(x, y + r)
346   - ctx.lineTo(x + r, y)
347   -
348   - // 这里是使用 fill 还是 stroke都可以,二选一即可,但是需要与上面对应
349   - ctx.fill()
350   - // ctx.stroke()
351   - ctx.closePath()
352   - // 剪切
353   - ctx.clip();
354   -
355   - ctx.setFontSize(18 * unit);
356   - ctx.setFillStyle("#000");
357   - ctx.fillText("立即开通", 362 * unit, 212 * unit);
358   -
359   - //绘制图片
360   - ctx.draw(false,
361   - wx.canvasToTempFilePath({
362   - x: 0,
363   - y: 0,
364   - width: 750,
365   - height: 930,
366   - destWidth: 1.2 * 750 * 750 / th.data.screenWidth,
367   - destHeight: 1.2 * 1217 * 750 / th.data.screenWidth,
368   - canvasId: 'myCanvas',
369   - success: function(res) {
370   - console.log("sssssssssssssssssssssssss" + res.tempFilePath);
371   - var tempFilePath = res.tempFilePath;
372   - th.setData({
373   - imagePath: tempFilePath,
374   - maskHidden: false,
375   - canvasHidden: true
376   - });
377   - wx.previewImage({
378   - urls: [res.tempFilePath],
379   - })
380   - if (!res.tempFilePath) {
381   - wx.showModal({
382   - title: '提示',
383   - content: '图片绘制中,请稍后重试',
384   - showCancel: false
385   - })
  209 + if (is_card == 0) getApp().my_warnning("请联系商家升级plus功能", 0, th);
  210 + var item = th.data.is_plusCard[th.data.by_index];
  211 + var req = {};
  212 + req.cardId = item.CardId;
  213 + req.rechargeType = 3;
  214 + //如果不是你导购,也不是等级会员分享
  215 + if (th.data.is_fengxiang == 1) {
  216 + if (th.data.def_recommon) req.recommon = th.data.def_recommon
  217 + if (th.data.def_serviceman) req.serviceman = th.data.def_serviceman
  218 + } else {
  219 + //---后台要求要输入邀请码---
  220 + if (th.data.isyaoqingma) {
  221 + if (!th.data.inp_recommon) {
  222 + getApp().my_warnning("请输入邀请码", 0, th);
  223 + return false;
386 224 }
387   - wx.hideLoading();
388   - }
389   -
390   - }))
391   -
392   - },
393   - /**
394   - * 生命周期函数--监听页面显示
395   - */
396   - onShow: function() {
397   - var goods_list = this.selectComponent("#goods_list"); //组件的id
398   - goods_list.get_list();
399   - },
400   -
401   - /**
402   - * 生命周期函数--监听页面隐藏
403   - */
404   - onHide: function() {
405   -
  225 + req.recommon = th.data.inp_recommon
  226 + }
  227 + //--后台要求要输入营业员--
  228 + if (th.data.is_salesman) {
  229 + if (!th.data.inp_serviceman) {
  230 + getApp().my_warnning("请输入营业员", 0, th);
  231 + return false;
  232 + }
  233 + req.serviceman = th.data.inp_serviceman
  234 + }
  235 + }
  236 + req.storeId = os.stoid;
  237 + req.userId = getApp().globalData.user_id;
  238 + //--如果有邀请码,和营业员的情况下--
  239 + if(req.recommon || req.serviceman ) {
  240 + var req_data = {storeId: os.stoid, userId: req.userId};
  241 + if(req.recommon) req_data.inviteCode=req.recommon;
  242 + if(req.serviceman) req_data.staffNo=req.serviceman;
  243 + getApp().request.get("/api/weshop/plus/vip/mem/referee/code/check", {
  244 + data:req_data,
  245 + success:function(res){
  246 + if(res.data.code==0) {
  247 + t_pay.pay(req, th.success, function () {
  248 + getApp().my_warnning("支付失败", 0, th);
  249 + });
  250 + }else{
  251 + getApp().my_warnning("支付失败", 0, th);
  252 + }
  253 + }
  254 + })
  255 + }else{
  256 + t_pay.pay(req, th.success, function () {
  257 + getApp().my_warnning("支付失败", 0, th);
  258 + });
  259 + }
406 260 },
407   -
408   - /**
409   - * 生命周期函数--监听页面卸载
410   - */
411   - onUnload: function() {
412   -
  261 + //返回会员页面
  262 + OpeningClose: function() {
  263 + this.setData({open_yq:0});
413 264 },
414 265  
415   - /**
416   - * 页面相关事件处理函数--监听用户下拉动作
417   - */
418   - onPullDownRefresh: function() {
419   -
  266 + //返回会员中心
  267 + back_user:function () {
  268 + setTimeout(function () {
  269 + wx.reLaunch({url:"/pages/user/index/index"});
  270 + },1000)
420 271 },
421   -
422   - /**
423   - * 页面上拉触底事件的处理函数
424   - */
425   - onReachBottom: function() {
426   - var goods_list = this.selectComponent("#goods_list"); //组件的id
427   - goods_list.get_list();
428   - this.setData({
429   - j: true
430   - })
  272 + //--支付成功,跳转到等级卡续费页面--
  273 + success:function () {
  274 + var u_url="/pages/user/cardinfo/cardinfo";
  275 + wx.reLaunch({url:u_url})
431 276 },
432 277  
433   - /**
434   - * 用户点击右上角分享
435   - */
436   - onShareAppMessage: function() {
437   -
438   - },
439   - //开通会员
440   - Opening: function() {
441   - this.setData({
442   - j: true
443   - })
444   - },
445   - //返回会员页面
446   - OpeningClose: function() {
447   - this.setData({
448   - j: false
449   - })
  278 + //--绑定邀请码的输入--
  279 + b_input:function (e) {
  280 + var value=e.detail.value;
  281 + var name=e.currentTarget.dataset.name;
  282 + var ob={};
  283 + ob[name]=value
  284 + this.setData(ob);
450 285 }
451 286  
452 287 })
453 288 \ No newline at end of file
... ...
pages/user/plus/plus.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   - "navigationBarTitleText": "我的会员"
  7 + "navigationBarTitleText": "购买plus会员"
7 8 }
8 9 \ No newline at end of file
... ...
pages/user/plus/plus.wxml
  1 +<block wx:if="{{is_show && (fir_leader?is_fengxiang:1)}}">
1 2 <!-- 我的会员背景图片 -->
2 3 <import src="../../../utils/wxParse/wxParse.wxml"></import>
3 4 <view>
4 5 <image class="Member_bk" src="{{url}}/miniapp/images/plus/page_bk.png"></image>
5 6 </view>
6   -
7 7 <view class="plus">
8 8 <!-- 开通会员模块 -->
9 9 <view class="Opening_plus">
... ... @@ -11,20 +11,16 @@
11 11 <image src="{{url}}/miniapp/images/plus/card_bk.png"></image>
12 12 </view>
13 13 <view class="swiper">
14   - <block wx:if="{{!is_card}}">
15   -
16 14 <!-- 未开通会员swiper-item -->
17 15 <swiper current="{{currentId}}" current-item-id="{{currentId}}" next-margin="55rpx" previous-margin="55rpx" bindchange="swiperChange">
18   -
19 16 <swiper-item class="flex" item-id="{{index}}" data-item-id="{{index}}" wx:for="{{is_plusCard}}">
20 17 <view class="Membership {{currentId==index?'enlarge':''}}" style=" background-image: url({{item.CardImg}});color:{{item.CardColor}}">
21   -
22 18 <view class="flex-space-between Membership_go">
23 19 <view>
24 20 <view class="fs32">{{item.CardName}}</view>
25 21 <view class="fs24 Membership_remarks">开通会员年卡仅{{item.CardFee}}元</view>
26 22 </view>
27   - <view class="Opening fs24 xc-black"data-ind="{{index}}" style="background:{{item.CardColor}}" bindtap="Opening">立即开通
  23 + <view class="Opening fs24 xc-black" data-ind="{{index}}" style="background:{{item.CardColor}}" bindtap="Opening">立即开通
28 24 </view>
29 25  
30 26 </view>
... ... @@ -41,58 +37,6 @@
41 37 </view>
42 38 </swiper-item>
43 39 </swiper>
44   - </block>
45   - <block wx:else>
46   -
47   - <!-- 已开通 -->
48   - <view class="MemberPlus" style=" background-image: url({{url}}/miniapp/images/plus/card_one.jpg);">
49   -
50   - <view class="flex-space-between">
51   - <view>
52   - <view class="fs36" style="font-weight:bold">PLUSI会员</view>
53   - <view class="fs22">开通会员年卡仅199元</view>
54   - </view>
55   - <view class="renew fs28">立即续费
56   - </view>
57   -
58   - </view>
59   -
60   - <view class="flex-vertical-between xs fs24">
61   -
62   - <view class="flex">
63   - <image class="privilege" src="{{url}}/miniapp/images/plus/privilege_o.png"></image>
64   - <view>正在享受PLUSI会员特权
65   - </view>
66   - </view>
67   - <view class="flex-vertical" bindtap="saveImageToPhotosAlbum">
68   - <view>邀请新朋友</view>
69   - <image class="share" src="{{url}}/miniapp/images/plus/Forward.png"></image>
70   - </view>
71   - </view>
72   -
73   - </view>
74   -
75   -
76   - </block>
77   - <view wx:if="{{is_card}}" class="flex-vertical-between Invitation fs30">
78   -
79   - <view class="flex">
80   - 已邀请
81   - <view class="Invitation_count">3人</view>
82   - 可提现
83   - <view class="Invitation_my">66元</view>
84   - </view>
85   -
86   - <view class="flex">
87   - <view class="Detailed flex-center">
88   - <navigator url="/pages/user/Detailed/Detailed">明细</navigator>
89   - </view>
90   - <view class="Invitation_Cash">立即提现</view>
91   -
92   - </view>
93   -
94   - </view>
95   -
96 40 </view>
97 41  
98 42  
... ... @@ -124,12 +68,9 @@
124 68  
125 69 <!-- 会员权益内容 -->
126 70 <view class="Courtesy_comment " wx:if="{{is_card_rule!=null&&is_card_rule!=''}}">
127   -
128   -
129 71 <view class="wxParse">
130   - <template is="wxParse" data="{{wxParseData:content.nodes}}"></template>
  72 + <template is="wxParse" data="{{wxParseData:content.nodes}}"></template>
131 73 </view>
132   -
133 74 </view>
134 75 </view>
135 76  
... ... @@ -141,9 +82,7 @@
141 82 <!-- 中文名标题 -->
142 83 <view class="China flex-level">
143 84 <view class="line flex-vertical">
144   - <view class="one"></view>
145   - <view class="two"></view>
146   - <view class="three"></view>
  85 + <view class="one"></view><view class="two"></view><view class="three"></view>
147 86 </view>
148 87  
149 88 <view class="Recommend flex-level" bindtap="requestList">好物推荐</view>
... ... @@ -170,38 +109,39 @@
170 109 </view>
171 110  
172 111 </view>
  112 +</block>
173 113  
174 114 <!-- 开通会员弹窗 -->
175   -<view wx:if="{{false}}" class="Disgraceful flex-center">
  115 +<view wx:if="{{open_yq}}" class="Disgraceful flex-center">
176 116 <!-- 蒙尘 -->
177 117 <view bindtap="OpeningClose"></view>
178 118  
179 119 <!-- 弹框 -->
180 120 <view class="Member_purchase">
181   - <view class="rel purchase_Bk" style="background-image: url({{url}}/miniapp/images/plus/card_one.jpg);">
  121 + <view class="rel purchase_Bk" style="background-image: url({{url}}/miniapp/images/plus/purchase_Bk.png);">
182 122 <image class="abs write" src="{{url}}/miniapp/images/plus/write.png"></image>
183 123 </view>
184 124 <view class="fs26 inf_com">
185 125 <view class="fs36 flex-level perfect">请完善下面信息</view>
186 126 <view class="fillin">
187 127 <!-- 输入推荐人手机号 -->
188   - <view class="flex ai_and Enter_phone">
  128 + <view class="flex ai_and Enter_phone" wx:if="{{isyaoqingma}}" >
189 129 <image class="phone_image" src="{{url}}/miniapp/images/plus/Invitation_code.png"></image>
190 130 <view class="phone">
191   - <input placeholder="请输入邀请码(推荐人手机号)" type="number" maxlength="30" />
  131 + <input bindinput="b_input" data-name="inp_recommon" placeholder="请输入邀请码(推荐人手机号)" type="number" maxlength="20" />
192 132 </view>
193 133 </view>
194   -
195 134 <!-- 输入营业员 -->
196   - <view class="flex ai_and enter_SalesClerk">
  135 + <view class="flex ai_and enter_SalesClerk" wx:if="{{is_salesman}}">
197 136 <image class="SalesClerk_image" src="{{url}}/miniapp/images/plus/Sales_Clerk.png"></image>
198 137 <view class="SalesClerk">
199   - <input placeholder="请输入营业员" maxlength="30" />
  138 + <input bindinput="b_input" data-name="inp_serviceman" placeholder="请输入营业员" maxlength="30" />
200 139 </view>
201 140 </view>
202 141 <!-- 确认购买 -->
203   - <view class="flex-center">
204   - <view class="flex-center purchase" style="background-image:url({{url}}/miniapp/images/plus/card_one.jpg);">
  142 + <view class="flex-center" bindtap="buy_card">
  143 + <view class="flex-center purchase"
  144 + style="background-image:url({{url}}/miniapp/images/plus/purchase_Bk.png);">
205 145 确认购买
206 146 </view>
207 147 </view>
... ... @@ -213,9 +153,4 @@
213 153 </view>
214 154  
215 155 </view>
216   -
217   -<!-- 画布 -->
218   -
219   -<canvas canvas-id='myCanvas' style="width:750rpx;height:1330rpx;"></canvas>
220   -
221 156 <warn id="warn"></warn>
222 157 \ No newline at end of file
... ...
pages/user/plus/plus.wxss
... ... @@ -176,6 +176,7 @@ left: -40rpx;
176 176 line-height: 45rpx;
177 177 text-align: center;
178 178 margin-top: 2rpx;
  179 + color: #666
179 180 }
180 181  
181 182 .Invitation {
... ... @@ -267,11 +268,10 @@ left: -40rpx;
267 268 right: 0;
268 269 bottom: 0;
269 270 z-index: 11;
270   - background: rgba(0, 0, 0, 0.4);
  271 + background: rgba(0, 0, 0, 0.6);
271 272 width: 100%;
272 273 height: 100%;
273 274 }
274   -
275 275 .ddd {
276 276 border-radius: 20rpx;
277 277 }
... ... @@ -345,6 +345,7 @@ left: -40rpx;
345 345 border-radius: 25rpx;
346 346 color: rgb(255, 255, 255);
347 347 margin: 55rpx 0rpx;
  348 + background-position: center;background-repeat: no-repeat;background-size: cover
348 349 }
349 350  
350 351 .purchaseClose {
... ...
utils/pay2.js 0 → 100644
  1 +var t = getApp(), n = t.request;
  2 +
  3 +module.exports = {
  4 + url: "/api/weshop/plus/create/plus/order",
  5 + pay: function(dd, succ,fail) {
  6 + var i = this;
  7 + n.post(this.url, {
  8 + data: dd,
  9 + success: function(t) {
  10 + if(t.data.code==0){
  11 + i.weixinPay(t.data.data, succ,fail);
  12 + }else{
  13 + "function" == typeof fail && fail();
  14 + }
  15 + return false;
  16 + },
  17 + fail: function() {
  18 + "function" == typeof fail && fail();
  19 + },
  20 + failStatus: function() {
  21 + "function" == typeof fail && fail();
  22 + }
  23 + });
  24 + },
  25 + weixinPay: function(n, succ,fail) {
  26 + wx.requestPayment({
  27 + timeStamp: String(n.timeStamp),
  28 + nonceStr: n.nonceStr,
  29 + package: n.packageValue,
  30 + signType: n.signType,
  31 + paySign: n.paySign,
  32 + success: function(n) {
  33 + "function" == typeof succ && succ();
  34 + },
  35 + fail: function(n) {
  36 + "function" == typeof fail && fail();
  37 + }
  38 + });
  39 + }
  40 +};
0 41 \ No newline at end of file
... ...