Commit c0cd24d656b1e8ab2fe29792443b83ee47afb223
1 parent
94d229ba
1. 等级卡升降级的功能
2. 提示框的修改
Showing
9 changed files
with
191 additions
and
30 deletions
components/diy_seckill/diy_seckill.js
components/my_confirm/my_confirm.js
| ... | ... | @@ -29,10 +29,13 @@ Component({ |
| 29 | 29 | }) |
| 30 | 30 | }, |
| 31 | 31 | go_sure: function() { |
| 32 | - this.data.success(); | |
| 32 | + this.setData({ yu_e_show: 0}) | |
| 33 | + if(this.data.success) this.data.success(); | |
| 34 | + | |
| 33 | 35 | }, |
| 34 | 36 | go_cancle: function() { |
| 35 | - this.data.cancle(); | |
| 37 | + this.setData({ yu_e_show: 0}) | |
| 38 | + if(this.data.cancle) this.data.cancle(); | |
| 36 | 39 | }, |
| 37 | 40 | close_yu_e: function() { |
| 38 | 41 | this.setData({ | ... | ... |
components/my_confirm/my_confirm.wxml
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | <view> |
| 5 | 5 | <view class="xc-qr-frame"> |
| 6 | 6 | <view class="shut" bindtap="close_yu_e">ⅹ</view> |
| 7 | - <view class="fs32 xc-black3 flex jc-center ai-center" style="width:100%;height:220rpx;">{{title}}</view> | |
| 7 | + <view class="fs32 xc-black3 flex jc-center ai-center" style="padding: 10rpx 20rpx;min-height:220rpx;"><text>{{title}}</text></view> | |
| 8 | 8 | <view class="flex jc-center ai_center" style="width: 100%;height: 75rpx;"> |
| 9 | 9 | <view bindtap="go_sure" class="fs30 white flex jc-center ai-center ck_btn color color" style="margin-right: 20rpx;">{{s_text}}</view> |
| 10 | 10 | <view bindtap='go_cancle' class="fs30 xc-ash flex jc-center ai-center ck_btn"style="background:#ececea;">{{c_text}}</view> | ... | ... |
components/my_confirm/my_confirm.wxss
pages/user/cardinfo/cardinfo.js
| ... | ... | @@ -42,7 +42,8 @@ Page({ |
| 42 | 42 | expiryDate:"",//卡到期时间 |
| 43 | 43 | is_guoqi:0, //卡是不是过期 |
| 44 | 44 | IsStopBuy:0, //卡是否停用 |
| 45 | - yu_e_show:0,//装入余额的弹窗 | |
| 45 | + yu_e_show:0,//装入余额的弹窗 | |
| 46 | + is_show_change_pop:0, | |
| 46 | 47 | }, |
| 47 | 48 | |
| 48 | 49 | /** |
| ... | ... | @@ -70,23 +71,37 @@ Page({ |
| 70 | 71 | |
| 71 | 72 | //----------------------------获取最大的卡类----------------------- |
| 72 | 73 | getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + o.stoid, { |
| 73 | - | |
| 74 | 74 | }).then(res => { |
| 75 | 75 | var plusCard = res.data.data; |
| 76 | 76 | var big_cards = null,big_card=null; |
| 77 | - console.log(plusCard, "数据什么的", res); | |
| 77 | + if(!plusCard) return false; | |
| 78 | + | |
| 79 | + var new_card_arr=[]; | |
| 78 | 80 | for (var i = 0; i < plusCard.length; i++) { |
| 79 | 81 | if (plusCard[i].CardImg == "") plusCard[i].CardImg = th.data.url + "/miniapp/images/plus/bg" + (i + 1) + ".jpg?v=1"; |
| 80 | - big_cards = Math.max(plusCard[i].CardFee) | |
| 81 | - if (plusCard[i].CardFee == big_cards) { | |
| 82 | - big_card = plusCard[i] | |
| 82 | + //big_cards = Math.max(plusCard[i].CardFee) | |
| 83 | + //if (plusCard[i].CardFee == big_cards) { | |
| 84 | + // big_card = plusCard[i] | |
| 85 | + //} | |
| 86 | + if(!plusCard[i].IsStopBuy) { | |
| 87 | + new_card_arr.push(plusCard[i]); | |
| 83 | 88 | } |
| 84 | 89 | } |
| 85 | - | |
| 86 | - console.log(big_cards, "是什么东西", big_card); | |
| 90 | + | |
| 91 | + //对比函数 | |
| 92 | + var compare = function (obj1, obj2) { | |
| 93 | + var val1 = obj1.CardFee;var val2 = obj2.CardFee; | |
| 94 | + if (val1 > val2) { | |
| 95 | + return -1; | |
| 96 | + }else if (val1 < val2) { | |
| 97 | + return 1; | |
| 98 | + }else{ return 0; } | |
| 99 | + } | |
| 100 | + new_card_arr.sort(compare); | |
| 101 | + big_card= new_card_arr[0]; | |
| 87 | 102 | ee.setData({ |
| 88 | - is_plusCard: plusCard, | |
| 89 | - big_card: big_card | |
| 103 | + is_plusCard: new_card_arr, | |
| 104 | + big_card: big_card, | |
| 90 | 105 | }) |
| 91 | 106 | |
| 92 | 107 | //缓存分享卡的图片 |
| ... | ... | @@ -101,7 +116,6 @@ Page({ |
| 101 | 116 | |
| 102 | 117 | }) |
| 103 | 118 | |
| 104 | - | |
| 105 | 119 | //获取用户设备信息,屏幕宽度 |
| 106 | 120 | wx.getSystemInfo({ |
| 107 | 121 | success: res => { |
| ... | ... | @@ -138,12 +152,46 @@ Page({ |
| 138 | 152 | end = Date.parse(end) / 1000; |
| 139 | 153 | var is_guoqi=0; |
| 140 | 154 | if(end<now) is_guoqi=1; |
| 141 | - | |
| 142 | - | |
| 155 | + var cur_card=res.data.data[0]; | |
| 156 | + | |
| 143 | 157 | ee.setData({cardid: GradeCardID, |
| 144 | - expiryDate: expiryDate,is_guoqi:is_guoqi, | |
| 158 | + expiryDate: expiryDate,is_guoqi:is_guoqi, | |
| 145 | 159 | }); |
| 146 | 160 | |
| 161 | + //一秒后获取是升级还是变更卡的列表,因为是异步的关系 | |
| 162 | + setTimeout(function () { | |
| 163 | + if(ee.data.is_plusCard){ | |
| 164 | + var new_buy_list=[]; | |
| 165 | + //如果是过期,就有变更的列表 | |
| 166 | + if(is_guoqi){ | |
| 167 | + //--开始组装变更列表-- | |
| 168 | + for(var ii in ee.data.is_plusCard){ | |
| 169 | + var item=ee.data.is_plusCard[ii]; | |
| 170 | + if(item.CardId!=GradeCardID && !item.IsStopBuy){ | |
| 171 | + new_buy_list.push(item); | |
| 172 | + } | |
| 173 | + } | |
| 174 | + }else{ | |
| 175 | + //如果是没过期,就看是不是最高级版的卡 | |
| 176 | + if(GradeCardID!=ee.data.big_card.CardId){ | |
| 177 | + //--开始组装升级列表-- | |
| 178 | + for(var jj in ee.data.is_plusCard){ | |
| 179 | + var item=ee.data.is_plusCard[jj]; | |
| 180 | + //升级要那些价格比当前卡贵的卡 | |
| 181 | + if(item.CardId!=GradeCardID && !item.IsStopBuy && parseFloat(item.CardFee)>parseFloat(cur_card.CardFee)){ | |
| 182 | + new_buy_list.push(item); | |
| 183 | + } | |
| 184 | + } | |
| 185 | + } | |
| 186 | + } | |
| 187 | + | |
| 188 | + if(new_buy_list.length>0){ | |
| 189 | + th.setData({buy_list:new_buy_list}); | |
| 190 | + } | |
| 191 | + } | |
| 192 | + | |
| 193 | + },1800) | |
| 194 | + | |
| 147 | 195 | |
| 148 | 196 | }) |
| 149 | 197 | //-----------会员分佣------------------- |
| ... | ... | @@ -155,7 +203,6 @@ Page({ |
| 155 | 203 | }else{ |
| 156 | 204 | ee.setData({ free: 0 }); |
| 157 | 205 | } |
| 158 | - | |
| 159 | 206 | }) |
| 160 | 207 | //-----------会员的卡类------------------- |
| 161 | 208 | await getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/get?storeId=" + os.stoid + "&CardId=" + ee.data.cardid, { |
| ... | ... | @@ -164,12 +211,10 @@ Page({ |
| 164 | 211 | if (user_card.CardImg==""){ |
| 165 | 212 | var index =parseInt(user_card.CorrPrice.replace("Price","")); |
| 166 | 213 | user_card.CardImg = th.data.url + "/miniapp/images/plus/bg" + index + ".jpg?v=1"; |
| 167 | - | |
| 168 | 214 | } |
| 169 | 215 | if (user_card.IsStopBuy==true){ |
| 170 | 216 | this.setData({IsStopBuy:1}) |
| 171 | 217 | } |
| 172 | - | |
| 173 | 218 | |
| 174 | 219 | console.log(user_card,"会员的卡类"); |
| 175 | 220 | ee.setData({user_card: user_card}); |
| ... | ... | @@ -736,9 +781,9 @@ Page({ |
| 736 | 781 | return false; |
| 737 | 782 | } |
| 738 | 783 | |
| 739 | - | |
| 740 | 784 | end_time=ut.format(end_time,'yyyy-MM-dd'); |
| 741 | 785 | var errmsg=""; |
| 786 | + | |
| 742 | 787 | //--商家是不是有等级卡功能,开通的人数是不是够用,开通是时间是不是到期-- |
| 743 | 788 | await getApp().request.promiseGet("/api/weshop/plus/plus/card/register", |
| 744 | 789 | { data: { storeId: os.stoid,isRenewal:1,endData: end_time,userId:getApp().globalData.user_id} }).then(res => { |
| ... | ... | @@ -746,7 +791,10 @@ Page({ |
| 746 | 791 | else errmsg=res.data.msg; |
| 747 | 792 | }) |
| 748 | 793 | |
| 749 | - if (is_card == 0){ getApp().my_warnning(errmsg?errmsg:"请联系商家升级plus功能", 0, th);} | |
| 794 | + if (is_card == 0){ | |
| 795 | + getApp().my_warnning(errmsg?errmsg:"请联系商家升级plus功能", 0, th); | |
| 796 | + return false; | |
| 797 | + } | |
| 750 | 798 | |
| 751 | 799 | var item = th.data.user_card; |
| 752 | 800 | var req = {}; |
| ... | ... | @@ -764,6 +812,64 @@ Page({ |
| 764 | 812 | //--支付成功,跳转到等级卡续费页面-- |
| 765 | 813 | success:function () { |
| 766 | 814 | getApp().my_warnning("支付成功",0,this); |
| 815 | + this.init(); | |
| 767 | 816 | }, |
| 817 | + | |
| 818 | + | |
| 819 | + //------计算俩种卡的------ | |
| 820 | + change_card:async function (e) { | |
| 821 | + var th = this,card_id =e.currentTarget.dataset.cid ,end_time=0; | |
| 822 | + await getApp().request.promiseGet("/store/storemoduleendtime/page?store_id="+os.stoid+"&type=3", | |
| 823 | + {1:1}).then(res => { | |
| 824 | + if (res.data.code == 0) { | |
| 825 | + end_time=res.data.data.pageData[0].end_time; | |
| 826 | + } | |
| 827 | + }) | |
| 828 | + var now=ut.gettimestamp(); | |
| 829 | + if(end_time<now){ | |
| 830 | + getApp().my_warnning("请联系商家升级plus功能", 0, th); | |
| 831 | + return false; | |
| 832 | + } | |
| 833 | + | |
| 834 | + th.data.s_card_id=card_id; | |
| 835 | + var days=e.currentTarget.dataset.days; | |
| 836 | + now=now+days*24*3600; | |
| 837 | + var time=ut.formar_no_full(now); | |
| 838 | + th.setData({is_show_change_pop:0}); | |
| 839 | + var my_con = this.selectComponent("#my_con"); //组件的id | |
| 840 | + | |
| 841 | + //如果是变更卡,就是显示提示喝到期时间 | |
| 842 | + if(th.data.is_guoqi){ | |
| 843 | + my_con.open(" \n 温馨提示:与原等级不符,是否变更!\n\n 有效时间:"+time+"\n\n", "是", "否", th.sure_pay, null) | |
| 844 | + }else{ | |
| 845 | + //如果是升级的话 | |
| 846 | + await getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/updatePrice/get", | |
| 847 | + {data:{storeId: os.stoid,userId:getApp().globalData.user_id,OldCardId:th.data.user_card.CardId,NewCardId:card_id}}).then(res => { | |
| 848 | + if (res.data.code == 0) { | |
| 849 | + my_con.open("\n 温馨提示,高于当前等级,是否立即升级!\n\n 升级价格:¥"+ res.data.data.payMoney.toFixed(2)+" \n 有效时间:"+time+"\n\n", "是", "否", th.sure_pay, null) | |
| 850 | + } | |
| 851 | + }) | |
| 852 | + } | |
| 853 | + | |
| 854 | + }, | |
| 855 | + | |
| 856 | + sure_pay:function () { | |
| 857 | + var th=this; | |
| 858 | + var req = {}; | |
| 859 | + req.cardId = th.data.s_card_id; | |
| 860 | + req.rechargeType = 5; | |
| 861 | + //如果不是你导购,也不是等级会员分享 | |
| 862 | + req.storeId = os.stoid; | |
| 863 | + req.oldCardId=th.data.user_card.CardId; | |
| 864 | + req.userId = getApp().globalData.user_id; | |
| 865 | + t_pay.pay(req, th.success, function () { | |
| 866 | + getApp().my_warnning("支付失败", 0, th); | |
| 867 | + }); | |
| 868 | + }, | |
| 869 | + //显示弹出框 | |
| 870 | + show_change:function () { this.setData({is_show_change_pop:1}); } | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 768 | 874 | |
| 769 | 875 | }) |
| 770 | 876 | \ No newline at end of file | ... | ... |
pages/user/cardinfo/cardinfo.json
| ... | ... | @@ -2,8 +2,9 @@ |
| 2 | 2 | "usingComponents": { |
| 3 | 3 | "pop_txt": "/components/userqy_pop_up/userqy_pop_up", |
| 4 | 4 | "goods_recommend": "/components/goods_list/goods_list", |
| 5 | - "warn": "/components/long_warn/long_warn", | |
| 6 | - "nav_box": "/components/nav_box_card/nav_box" | |
| 5 | + "warn": "/components/long_warn/long_warn", | |
| 6 | + "nav_box": "/components/nav_box_card/nav_box", | |
| 7 | + "my_confirm": "/components/my_confirm/my_confirm" | |
| 7 | 8 | }, |
| 8 | 9 | "navigationBarTitleText": "plus会员" |
| 9 | 10 | } |
| 10 | 11 | \ No newline at end of file | ... | ... |
pages/user/cardinfo/cardinfo.wxml
| ... | ... | @@ -17,8 +17,20 @@ |
| 17 | 17 | <view wx:if="{{!is_guoqi}}" class="fs22 h22" style="margin-top:15rpx">会员将在{{filters.replace_time2(expiryDate)}}到期</view> |
| 18 | 18 | <view wx:else class="fs22 h22" style="margin-top:15rpx">会员已在{{filters.replace_time2(expiryDate)}}过期</view> |
| 19 | 19 | </view> |
| 20 | - <view bindtap="xufei" class="renew fs28" style="background:{{user_card.CardColor}}">立即续费 | |
| 21 | - </view> | |
| 20 | + | |
| 21 | + <view> | |
| 22 | + <view bindtap="xufei" class="renew fs28" style="background:{{user_card.CardColor}}">立即续费</view> | |
| 23 | + <!-- 判断是不是过期,显示变更按钮,但是要看是不是多件 --> | |
| 24 | + <block wx:if="{{is_guoqi}}"> | |
| 25 | + <view wx:if="{{buy_list.length>0}}" bindtap="show_change" class="renew fs28" style="background:{{user_card.CardColor}}">卡类变更</view> | |
| 26 | + </block> | |
| 27 | + <block wx:else> | |
| 28 | + <!-- 要判断是不是最高级的卡 --> | |
| 29 | + <view wx:if="{{cardid!=big_card.CardId}}" bindtap="show_change" class="renew fs28" style="background:{{user_card.CardColor}}">卡类升级</view> | |
| 30 | + </block> | |
| 31 | + </view> | |
| 32 | + | |
| 33 | + | |
| 22 | 34 | </view> |
| 23 | 35 | |
| 24 | 36 | <view class="flex-vertical-between xs fs28"> |
| ... | ... | @@ -147,4 +159,28 @@ |
| 147 | 159 | <!-- 画布 --> |
| 148 | 160 | <canvas canvas-id='myCanvas' style="width:750rpx;height:1260rpx;"wx:if='{{!canvasHidden}}'></canvas> |
| 149 | 161 | |
| 150 | -<warn id="warn"></warn> | |
| 151 | 162 | \ No newline at end of file |
| 163 | +<warn id="warn"></warn> | |
| 164 | +<my_confirm id="my_con"></my_confirm> | |
| 165 | + | |
| 166 | +<!-- 购买更换,升级 --> | |
| 167 | +<view class="card_change_pop" wx:if="{{is_show_change_pop==1}}"> | |
| 168 | + <view class="cover-layer" bindtap="close_card_change_pop"></view> | |
| 169 | + <view class="content flex jc-center ai-center"> | |
| 170 | + <view class="card_list"> | |
| 171 | + <image class="hg" src="{{url}}/miniapp/images/plus/plustopimg.png"></image> | |
| 172 | + <view class="list"> | |
| 173 | + <view class="item flex ai-center jc_sb" wx:for="{{buy_list}}"> | |
| 174 | + <view class="flex ai-center"><image class="hg_img" src="{{url}}/miniapp/images/vip_hg0.png"></image> | |
| 175 | + <text class="ellipsis-1 card_name">{{item.CardName}}</text></view> | |
| 176 | + <view class="price_show flex ai-center"> | |
| 177 | + <view style="width: 100%; line-height: 24rpx" data-days="{{item.ExpiryDate}}" bindtap="change_card" data-cid="{{item.CardId}}"> | |
| 178 | + <view style="text-align: right" class="fs26">¥<text class="pri fs40">{{item.CardFee}}</text></view> | |
| 179 | + <view style="text-align: center" class="fs30" wx:if="{{is_guoqi}}">立即变更</view> | |
| 180 | + <view style="text-align: center" class="fs30" wx:else>立即升级</view> | |
| 181 | + </view> | |
| 182 | + </view> | |
| 183 | + </view> | |
| 184 | + </view> | |
| 185 | + </view> | |
| 186 | + </view> | |
| 187 | +</view> | |
| 152 | 188 | \ No newline at end of file | ... | ... |
pages/user/cardinfo/cardinfo.wxss
| ... | ... | @@ -225,4 +225,17 @@ align-items:center; |
| 225 | 225 | |
| 226 | 226 | width: 100%; |
| 227 | 227 | height: 320rpx; |
| 228 | -} | |
| 229 | 228 | \ No newline at end of file |
| 229 | +} | |
| 230 | + | |
| 231 | +.content{ position: fixed; top: 0;left:0; width: 100%; height: 100%; z-index: 12; } | |
| 232 | +.content .card_list{ width: 700rpx; margin: 0 auto; background-color: #ffe88b; border-radius: 15rpx} | |
| 233 | +.content .card_list .hg{ width: 100%;height: 156rpx} | |
| 234 | + | |
| 235 | +.content .card_list .list{ max-height: 700rpx; padding: 0 25rpx; margin-bottom: 20rpx; overflow-y: auto} | |
| 236 | +.content .card_list .item{ margin-bottom: 10rpx; background: #fff; height: 150rpx; border-radius: 10rpx} | |
| 237 | +.content .card_list .item .hg_img{ width: 70rpx; height: 60rpx; margin-left: 40rpx; margin-right: 20rpx } | |
| 238 | +.content .card_list .item .price_show{ width: 200rpx; height: 110rpx; background: #ffd430; | |
| 239 | + border-top-left-radius: 55rpx; border-bottom-left-radius:55rpx; } | |
| 240 | + .content .card_list .list .card_name{ max-width: 230rpx} | |
| 241 | + | |
| 242 | + .price_show .thr{color: #999; text-decoration:line-through } | |
| 230 | 243 | \ No newline at end of file | ... | ... |