Commit 32d41c0b79ef3b9255049d61ece2426425c366ed
1 parent
f325aca9
会员中心自定义模板的优化
Showing
14 changed files
with
1207 additions
and
83 deletions
components/diy_user_info/diy_user_info.js
| 1 | +const rq = require("../../utils/request.js"); | |
| 2 | +const ut = require("../../utils/util.js"); | |
| 3 | +const {qrcode} = require("../../utils/index.js"); | |
| 1 | 4 | var s = getApp().globalData.setting; |
| 5 | +var r=s; | |
| 2 | 6 | Component({ |
| 3 | 7 | properties: { |
| 4 | 8 | object: { |
| 5 | 9 | type: Object, |
| 6 | 10 | value: null |
| 7 | 11 | }, |
| 8 | - is_temp:{ | |
| 9 | - type:Number, | |
| 10 | - value:0 | |
| 11 | - } | |
| 12 | + qy_data:{ | |
| 13 | + type: Object, | |
| 14 | + value: null | |
| 15 | + }, | |
| 16 | + pulscardname:{ | |
| 17 | + type:String, | |
| 18 | + value:"--" | |
| 19 | + }, | |
| 20 | + rfmName:{ | |
| 21 | + type:String, | |
| 22 | + value:"--" | |
| 23 | + }, | |
| 12 | 24 | // 这里定义了innerText属性,属性值可以在组件使用时指定 |
| 13 | 25 | }, |
| 14 | 26 | data: { |
| 15 | 27 | // 这里是一些组件内部数据 |
| 16 | 28 | iurl: s.imghost, |
| 17 | 29 | defaultAvatar: s.imghost + "/miniapp/images/no-head.jpg", |
| 18 | - userInfo:null | |
| 30 | + userInfo:null, | |
| 31 | + | |
| 32 | + sys_switch:null, | |
| 33 | + tc_hide:true, //会员卡的弹出层隐藏 | |
| 19 | 34 | }, |
| 20 | 35 | |
| 21 | 36 | ready: function() { |
| 22 | - if(this.properties.is_temp==1){ | |
| 37 | + var th=this; | |
| 38 | + | |
| 39 | + if(getApp().globalData.userInfo){ | |
| 40 | + this.setData({userInfo:getApp().globalData.userInfo}); | |
| 41 | + } | |
| 42 | + | |
| 43 | + /*-------系统是否开通等级卡,会员是等级卡-----*/ | |
| 44 | + getApp().getConfig2(function (e) { | |
| 45 | + var t_swi = e.switch_list; | |
| 46 | + if (t_swi) t_swi = JSON.parse(t_swi) | |
| 47 | + if (t_swi) { | |
| 48 | + th.setData({sys_switch: t_swi}); | |
| 49 | + } | |
| 50 | + }) | |
| 23 | 51 | |
| 24 | - }else{ | |
| 52 | + }, | |
| 25 | 53 | |
| 26 | - } | |
| 54 | + pageLifetimes: { | |
| 55 | + //要处理一下,游客登录后的界面的变化,主要还该是改变会员 | |
| 56 | + show: function () { | |
| 57 | + if(!this.data.userInfo && getApp().globalData.userInfo){ | |
| 58 | + this.setData({userInfo:getApp().globalData.userInfo}); | |
| 59 | + } | |
| 60 | + } | |
| 27 | 61 | }, |
| 28 | 62 | |
| 63 | + | |
| 29 | 64 | methods: { |
| 65 | + //登陆会员 | |
| 66 | + login_user(){ | |
| 67 | + getApp().goto('/packageE/pages/togoin/togoin'); | |
| 68 | + }, | |
| 69 | + //------卡片的显示和关闭-------- | |
| 70 | + show_tc: function () { | |
| 71 | + var that=this; | |
| 72 | + if (!this.data.userInfo) return false; | |
| 73 | + var getnowtime; | |
| 74 | + getApp().request.get("/api/weshop/users/getServerTime", { | |
| 75 | + success: function (res) { | |
| 76 | + if (res.data.code == 0) | |
| 77 | + { | |
| 78 | + getnowtime=res.data.data; | |
| 79 | + if (!getnowtime) | |
| 80 | + { | |
| 81 | + ut.m_toast("获取服务时间失败"); | |
| 82 | + return; | |
| 83 | + } | |
| 84 | + //base64_encode($user.mobile.'|'.date('Y-m-d H:i:s') | |
| 85 | + var val = that.data.userInfo.mobile + "|" +getnowtime+"|"+that.data.getusercode_vailtime; | |
| 86 | + val = "^" + ut.base64_encode(val); | |
| 87 | + | |
| 88 | + qrcode('qrcode', val, 480, 480, that); | |
| 89 | + that.setData({ | |
| 90 | + tc_hide: false, | |
| 91 | + }); | |
| 92 | + } | |
| 93 | + } | |
| 94 | + }) | |
| 95 | + }, | |
| 96 | + //隐藏会员卡 | |
| 97 | + hide_tc: function () { | |
| 98 | + this.setData({ | |
| 99 | + tc_hide: true, | |
| 100 | + }); | |
| 101 | + }, | |
| 102 | + | |
| 103 | + //--跳转到预存款页面-- | |
| 104 | + deposit: function () { | |
| 105 | + if (!this.data.userInfo) | |
| 106 | + { | |
| 107 | + this.login_user(); | |
| 108 | + return false; | |
| 109 | + } | |
| 110 | + wx.navigateTo({ | |
| 111 | + url: '/packageD/pages/user/deposit/deposit', | |
| 112 | + }) | |
| 113 | + }, | |
| 114 | + //--跳转到余额页面-- | |
| 115 | + balance: function () { | |
| 116 | + if (!this.data.userInfo) | |
| 117 | + { | |
| 118 | + this.login_user(); | |
| 119 | + return false; | |
| 120 | + }; | |
| 121 | + wx.navigateTo({ | |
| 122 | + url: '/packageD/pages/user/member/menber', | |
| 123 | + }) | |
| 124 | + }, | |
| 125 | + //--跳转到优惠券-- | |
| 126 | + coupon: function () { | |
| 127 | + var th = this; | |
| 128 | + if (!this.data.userInfo) | |
| 129 | + { | |
| 130 | + this.login_user(); | |
| 131 | + return false; | |
| 132 | + }; | |
| 133 | + // th.sendsm(); | |
| 134 | + wx.navigateTo({ | |
| 135 | + url: '/packageD/pages/user/coupons/coupons', | |
| 136 | + }) | |
| 137 | + }, | |
| 138 | + //--跳转到积分-- | |
| 139 | + integral: function () { | |
| 140 | + if (!this.data.userInfo) | |
| 141 | + { | |
| 142 | + this.login_user(); | |
| 143 | + return false; | |
| 144 | + } | |
| 145 | + wx.navigateTo({ | |
| 146 | + url: '/packageD/pages/user/integral/integral', | |
| 147 | + }) | |
| 148 | + }, | |
| 149 | + | |
| 150 | + jump: function () { | |
| 151 | + let isRfm = wx.getStorageSync('isRfm') | |
| 152 | + //升级为RFM就不跳转成长值详情 | |
| 153 | + if (!isRfm) { | |
| 154 | + getApp().goto("/packageE/pages/user/grow_value/grow_value") | |
| 155 | + } | |
| 156 | + }, | |
| 157 | + | |
| 158 | + //跳转到链接 | |
| 159 | + goto: function (e) { | |
| 160 | + console.log(e); | |
| 161 | + console.log('跳转'); | |
| 162 | + var url = e.currentTarget.dataset.url; | |
| 163 | + wx.navigateTo({ url: url }) | |
| 164 | + | |
| 165 | + }, | |
| 166 | + | |
| 30 | 167 | |
| 31 | 168 | } |
| 32 | 169 | }) |
| 33 | 170 | \ No newline at end of file | ... | ... |
components/diy_user_info/diy_user_info.wxml
| 1 | 1 | <view class="xc-user" > |
| 2 | 2 | <view class="xc-head rel"> |
| 3 | - | |
| 4 | - <block wx:if="{{object.bg_type==0}}"> | |
| 3 | + <block wx:if="{{object.bg_type==1}}"> | |
| 5 | 4 | <image class="xc-background" src="{{iurl}}{{ad_img?ad_img:'/miniapp/images/user_index_powder.jpg'}}"> |
| 6 | - <include src="style1.wxml"></include> | |
| 5 | + <block vw:if="{{object.style==0}}"> | |
| 6 | + <include src="style1.wxml"></include>s | |
| 7 | + </block> | |
| 8 | + | |
| 7 | 9 | </image> |
| 8 | 10 | </block> |
| 9 | - | |
| 10 | 11 | <block wx:else> |
| 11 | - <view class="xc-background" style="background-color:"> | |
| 12 | - | |
| 13 | - | |
| 12 | + <view class="xc-background" style="background-color:{{object.bg_color}}"> | |
| 13 | + <block vw:if="{{object.style==0}}"> | |
| 14 | + <include src="style1.wxml"></include> | |
| 15 | + </block> | |
| 14 | 16 | </view> |
| 15 | - | |
| 16 | - | |
| 17 | 17 | </block> |
| 18 | - | |
| 19 | - | |
| 20 | 18 | </view> |
| 21 | - | |
| 22 | 19 | </view> |
| 23 | 20 | |
| 24 | 21 | <block wx:if="{{is_no_plus}}"> |
| ... | ... | @@ -45,4 +42,30 @@ |
| 45 | 42 | </view> |
| 46 | 43 | </view> |
| 47 | 44 | </view> |
| 48 | -</block> | |
| 49 | 45 | \ No newline at end of file |
| 46 | +</block> | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | +<!--弹出层内容,其中的“我知道”中绑定让弹出层消失的函数:bindtap="hide"--> | |
| 51 | +<view class="tc_view" hidden='{{tc_hide}}' bindtap='hide_tc'> | |
| 52 | + <view class="modal-box" hidden="{{flag}}" bindtap="hide" catchtouchmove="true"></view> | |
| 53 | + <view class="modal-body" catchtouchmove="true"> | |
| 54 | + <view class="modal-content"> | |
| 55 | + <view class="flex"> | |
| 56 | + <image src="{{userInfo.head_pic?userInfo.head_pic:defaultAvatar}}" class="hd_img"></image> | |
| 57 | + <view class="ctent_txt"> | |
| 58 | + <view class='txt1'>{{userInfo.nickname}} | |
| 59 | + <image wx:if="{{userInfo.sex==2}}" class="arrow-right" style="width: 35rpx; height:35rpx; top: 5rpx" src="{{iurl}}/miniapp/images/user/wum.png"></image> | |
| 60 | + <image wx:else class="arrow-right fu" style="width: 35rpx; height:35rpx;top:5rpx" src="{{iurl}}/miniapp/images/user/man.png"></image> | |
| 61 | + </view> | |
| 62 | + <view wx:if="{{userInfo.address}}" class='txt2'>{{userInfo.address}}</view> | |
| 63 | + </view> | |
| 64 | + </view> | |
| 65 | + <view class="m_ta"> | |
| 66 | + <!--<image class='g_img' src='https://mshop.yolipai.net//index.php?m=Home&c=Index&a=qr_code&data={{userInfo.mobile}}'></image>--> | |
| 67 | + <canvas class="g_img" canvas-id="qrcode" /> | |
| 68 | + </view> | |
| 69 | + <view class="s_sao">前台收银扫此二维码,即可享受优惠!</view> | |
| 70 | + </view> | |
| 71 | + </view> | |
| 72 | +</view> | |
| 50 | 73 | \ No newline at end of file | ... | ... |
components/diy_user_info/diy_user_info.wxss
| ... | ... | @@ -37,7 +37,7 @@ |
| 37 | 37 | |
| 38 | 38 | /*-- 头部 --*/ |
| 39 | 39 | .xc-user .xc-head { |
| 40 | - height: 335rpx; | |
| 40 | + height: 370rpx; | |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | .xc-background { |
| ... | ... | @@ -122,3 +122,99 @@ |
| 122 | 122 | line-height: 46rpx; |
| 123 | 123 | margin-left: 10rpx; |
| 124 | 124 | } |
| 125 | + | |
| 126 | + | |
| 127 | +.xc-qrcode-frame { | |
| 128 | + /* border-radius: 10rpx; | |
| 129 | + border: 5rpx solid #fe9db5; | |
| 130 | + background: #fe9db5; | |
| 131 | + width: 70rpx; | |
| 132 | + height: 70rpx; */ | |
| 133 | + top: 70rpx; | |
| 134 | + right: 64rpx; | |
| 135 | +} | |
| 136 | + | |
| 137 | +.xc-qrcode { | |
| 138 | + border-radius: 10rpx; | |
| 139 | + border: 5rpx solid #fe9db5; | |
| 140 | + background: #fe9db5; | |
| 141 | + width: 70rpx; | |
| 142 | + height: 70rpx; | |
| 143 | +} | |
| 144 | + | |
| 145 | +/*---弹出层---*/ | |
| 146 | +.modal-box { | |
| 147 | + position: fixed; | |
| 148 | + width: 100%; | |
| 149 | + height: 100%; | |
| 150 | + top: 0px; | |
| 151 | + background: rgba(0, 0, 0, 0.4); | |
| 152 | + overflow: hidden; | |
| 153 | +} | |
| 154 | + | |
| 155 | +.modal-body { | |
| 156 | + position: fixed; | |
| 157 | + top: 0; | |
| 158 | + bottom: 0; | |
| 159 | + left: 0; | |
| 160 | + right: 0; | |
| 161 | + margin: auto; | |
| 162 | + z-index: 100; | |
| 163 | + background: #fff; | |
| 164 | + /* margin-left: 73rpx; */ | |
| 165 | + width: 600rpx; | |
| 166 | + height: 860rpx; | |
| 167 | + border-radius: 8px; | |
| 168 | + text-align: center; | |
| 169 | +} | |
| 170 | + | |
| 171 | +.modal-content { | |
| 172 | + width: 480rpx; | |
| 173 | + margin: 0 auto; | |
| 174 | + margin-top: 60rpx; | |
| 175 | + overflow: hidden; | |
| 176 | +} | |
| 177 | + | |
| 178 | +.modal-content .hd_img { | |
| 179 | + width: 170rpx; | |
| 180 | + height: 170rpx; | |
| 181 | + border-radius: 5px; | |
| 182 | +} | |
| 183 | + | |
| 184 | +.ctent_txt { | |
| 185 | + margin-left: 30rpx; | |
| 186 | + text-align: left; | |
| 187 | +} | |
| 188 | + | |
| 189 | +.txt1 { | |
| 190 | + font-size: 34rpx; | |
| 191 | + font-weight: bold; | |
| 192 | +} | |
| 193 | + | |
| 194 | +.txt2 { | |
| 195 | + font-size: 30rpx; | |
| 196 | + color: #999; | |
| 197 | + margin-top: 20rpx; | |
| 198 | +} | |
| 199 | + | |
| 200 | +.arrow-right { | |
| 201 | + width: 20rpx; | |
| 202 | + height: 40rpx; | |
| 203 | + position: relative; | |
| 204 | + top: 13rpx; | |
| 205 | + margin-left: 20rpx; | |
| 206 | +} | |
| 207 | + | |
| 208 | +.m_ta { | |
| 209 | + margin-top: 50rpx; | |
| 210 | +} | |
| 211 | + | |
| 212 | +.g_img { | |
| 213 | + width: 480rpx; | |
| 214 | + height: 480rpx; | |
| 215 | +} | |
| 216 | + | |
| 217 | +.s_sao { | |
| 218 | + font-size: 27rpx; | |
| 219 | + margin-top: 25rpx; | |
| 220 | +} | ... | ... |
components/diy_user_info/style1.wxml
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | <view style="position:relative;"> |
| 8 | 8 | <image class="xc-user-img circle" bindtap="go_info" src="{{userInfo.head_pic?userInfo.head_pic:defaultAvatar}}"></image> |
| 9 | - <block wx:if="{{pulscardname && sys_switch.rank_switch > 0 }}"> | |
| 9 | + <block wx:if="{{pulscardname && sys_switch.rank_switch > 0 && object.is_plus }}"> | |
| 10 | 10 | <view data-url="/pages/user/plus/plus" catchtap="goto" class="flex-center plusMax"> |
| 11 | 11 | <image class="fuls" src="{{iurl}}/miniapp/images/userinfo/userinfo/privilege_t.png"></image> |
| 12 | 12 | <view>{{pulscardname}}</view> |
| ... | ... | @@ -14,18 +14,19 @@ |
| 14 | 14 | </block> |
| 15 | 15 | </view> |
| 16 | 16 | |
| 17 | - <view class="xc-uesr-name"> | |
| 17 | + <view class="xc-uesr-name" style="color:{{object.word_color}}"> | |
| 18 | 18 | <view class="flex ai-center"> |
| 19 | 19 | <text class="ellipsis-1" style="max-width: 290rpx;display: inline-block">{{userInfo.nickname}}</text> |
| 20 | - <view class="hvip" wx:if='{{GradeName && is_init}}'> | |
| 21 | - <image class="vip-mem" src="{{iurl}}/miniapp/images/vip_hg0.png"></image>{{GradeName}} | |
| 20 | + | |
| 21 | + <view class="hvip" wx:if='{{qy_data && qy_data.GradeName && qy_data.is_init && object.is_qy}}'> | |
| 22 | + <image class="vip-mem" src="{{iurl}}/miniapp/images/vip_hg0.png"></image>{{qy_data.GradeName}} | |
| 22 | 23 | </view> |
| 23 | 24 | </view> |
| 24 | - <view class="flex fs24 xc-grow-ups" style="margin-left:8rpx;margin-top:6rpx" wx:if="{{is_init && gradeId}}" bindtap='jump'> | |
| 25 | - <block wx:if="{{cz_val<full_cz_val}}"> | |
| 25 | + <view class="flex fs24 xc-grow-ups" style="margin-left:8rpx;margin-top:6rpx" wx:if="{{qy_data && qy_data.is_init && qy_data.gradeId && object.is_cz}}" bindtap='jump'> | |
| 26 | + <block wx:if="{{qy_data.cz_val<qy_data.full_cz_val}}"> | |
| 26 | 27 | {{" "}} |
| 27 | 28 | <text class="grow-up-val" style="background:{{usertop_ad.bgcolor?usertop_ad.bgcolor:'#fe9db5'}};">{{rfmName}}</text> |
| 28 | - <view style='margin-left:5rpx; '>{{cz_val}} / {{need_money}}</view> | |
| 29 | + <view style='margin-left:5rpx; '>{{qy_data.cz_val}} / {{qy_data.need_money}}</view> | |
| 29 | 30 | </block> |
| 30 | 31 | <block wx:else> |
| 31 | 32 | {{" "}} |
| ... | ... | @@ -37,16 +38,16 @@ |
| 37 | 38 | </view> |
| 38 | 39 | |
| 39 | 40 | <!-- 会员没有登陆的情况 --> |
| 40 | - <view class="xc-user-left flex" wx:else bindtap="gobindtel"> | |
| 41 | - <image class="xc-user-img circle" src="{{userInfo.head_pic?userInfo.head_pic:defaultAvatar}}"></image> | |
| 42 | - <view class="xc-uesr-name">请点击注册</view> | |
| 41 | + <view class="xc-user-left flex" wx:else bindtap="login_user"> | |
| 42 | + <image class="xc-user-img circle" src="{{defaultAvatar}}"></image> | |
| 43 | + <view class="xc-uesr-name" style="color:{{object.word_color}}">请点击注册</view> | |
| 43 | 44 | </view> |
| 44 | 45 | </view> |
| 45 | 46 | |
| 46 | 47 | |
| 47 | -<view wx:if="{{userInfo}}" class="xc-qrcode-frame abs "> | |
| 48 | - <image bindtap='show_tc' class=" xc-qrcode " style="border: 5rpx solid {{usertop_ad.bgcolor?usertop_ad.bgcolor:'#fe9db5'}};background: {{usertop_ad.bgcolor?usertop_ad.bgcolor:'#fe9db5'}};" src="{{iurl}}/miniapp/images/qrcode1.png"></image> | |
| 49 | - <view style="font-size:12px;color: #fff;">会员卡</view> | |
| 48 | +<view wx:if="{{userInfo && object.is_user_card}}" class="xc-qrcode-frame abs "> | |
| 49 | + <image bindtap='show_tc' class=" xc-qrcode " style="border: 5rpx solid #fe9db5;background: #fe9db5;" src="{{iurl}}/miniapp/images/qrcode1.png"></image> | |
| 50 | + <view style="font-size:12px;color:{{object.word_color}}">会员卡</view> | |
| 50 | 51 | </view> |
| 51 | 52 | |
| 52 | 53 | <view class="flex-vertical abs xc-grow-frame rel" style="display: none"> |
| ... | ... | @@ -61,22 +62,32 @@ |
| 61 | 62 | |
| 62 | 63 | |
| 63 | 64 | <!-- 底部显示余额,储值卡,积分,优惠券等 --> |
| 64 | -<view class="flex-equality abs xc-assets"> | |
| 65 | - <view class="t-c typefont" bindtap='balance'>{{yuer?yuer:0}} | |
| 66 | - <view class='numfont'>余额</view> | |
| 67 | - </view> | |
| 68 | - <!-- 是否关闭 --> | |
| 69 | - <block wx:if="{{!is_close_chuzhi}}"> | |
| 70 | - <view class="t-c typefont" bindtap='deposit'>{{udata.Balance?udata.Balance:0}} | |
| 71 | - <view class='numfont'>储值款</view> | |
| 72 | - </view> | |
| 73 | - </block> | |
| 65 | +<view class="flex-equality abs xc-assets" style="color:{{object.word_color}}"> | |
| 74 | 66 | |
| 75 | - <view class="t-c typefont" bindtap='integral'>{{udata.Integral?udata.Integral:0}} | |
| 76 | - <view class='numfont'>积分</view> | |
| 77 | - </view> | |
| 67 | + <block wx:for="{{object.show_arr}}"> | |
| 68 | + <block wx:if="{{item.show}}"> | |
| 69 | + <block wx:if="{{item.type=='user_money'}}"> | |
| 70 | + <view class="t-c typefont" bindtap='balance'>{{yuer?yuer:0}} | |
| 71 | + <view class='numfont'>余额</view> | |
| 72 | + </view> | |
| 73 | + </block> | |
| 74 | + <block wx:if="{{item.type=='yc' && !is_close_chuzhi}}"> | |
| 75 | + <view class="t-c typefont" bindtap='deposit'>{{udata.Balance?udata.Balance:0}} | |
| 76 | + <view class='numfont'>储值款</view> | |
| 77 | + </view> | |
| 78 | + </block> | |
| 79 | + <block wx:if="{{item.type=='jf'}}"> | |
| 80 | + <view class="t-c typefont" bindtap='integral'>{{udata.Integral?udata.Integral:0}} | |
| 81 | + <view class='numfont'>积分</view> | |
| 82 | + </view> | |
| 83 | + </block> | |
| 84 | + <block wx:if="{{item.type=='quan'}}"> | |
| 85 | + <view class="t-c typefont" bindtap='coupon'>{{udata.CashCount+byquan?udata.CashCount+byquan:0}} | |
| 86 | + <view class='numfont'>优惠券</view> | |
| 87 | + </view> | |
| 88 | + </block> | |
| 89 | + </block> | |
| 78 | 90 | |
| 79 | - <view class="t-c typefont" bindtap='coupon'>{{udata.CashCount+byquan?udata.CashCount+byquan:0}} | |
| 80 | - <view class='numfont'>优惠券</view> | |
| 81 | - </view> | |
| 91 | + | |
| 92 | + </block> | |
| 82 | 93 | </view> |
| 83 | 94 | \ No newline at end of file | ... | ... |
components/diy_user_my_rights/diy_user_my_rights.js
| 1 | +var os = getApp().globalData.setting; | |
| 1 | 2 | Component({ |
| 2 | 3 | properties: { |
| 3 | 4 | object: { |
| 4 | 5 | type: Object, |
| 5 | 6 | value: null |
| 6 | 7 | }, |
| 7 | - // 这里定义了innerText属性,属性值可以在组件使用时指定 | |
| 8 | + qy_data:{ | |
| 9 | + type: Object, | |
| 10 | + value: null | |
| 11 | + }, | |
| 8 | 12 | |
| 9 | 13 | }, |
| 10 | 14 | data: { |
| 11 | - // 这里是一些组件内部数据 | |
| 12 | - someData: {} | |
| 15 | + iurl:os.imghost, | |
| 16 | + qy_list:[] | |
| 13 | 17 | }, |
| 14 | 18 | methods: { |
| 15 | 19 | // 这里是一个自定义方法 |
| 16 | 20 | customMethod() { } |
| 17 | - } | |
| 21 | + }, | |
| 22 | + observers: { | |
| 23 | + // 监听 num1 和 num2 数据的变化 | |
| 24 | + 'qy_data': function(obj){ | |
| 25 | + console.log(1111); | |
| 26 | + console.log(obj); | |
| 27 | + if(obj){ | |
| 28 | + //4个4个一组 | |
| 29 | + let arr = new Array(); | |
| 30 | + let ater=this.properties.object.show_num; | |
| 31 | + let arr_data= this.properties.qy_data.old_qy_list | |
| 32 | + for (let i = 0; i < arr_data.length; i += ater) { | |
| 33 | + arr.push(arr_data.slice(i, i + ater)); | |
| 34 | + } | |
| 35 | + this.setData({qy_list:arr}) | |
| 36 | + } | |
| 37 | + | |
| 38 | + } | |
| 39 | + }, | |
| 40 | + | |
| 18 | 41 | }) |
| 19 | 42 | \ No newline at end of file | ... | ... |
components/diy_user_my_rights/diy_user_my_rights.wxml
| 1 | -<view class='assist' style='height:{{object.height*2}}rpx;background-color:{{object.bgcolor}}'></view> | |
| 2 | 1 | \ No newline at end of file |
| 2 | +<!-- 我的权益 --> | |
| 3 | +<view class="xc-my-equity-frame" wx:if="{{qy_data && qy_data.is_init}}"> | |
| 4 | + <view class="xc-equity-title flex-level" bindtap="go_qy" wx:if="{{object.is_title}}"> | |
| 5 | + <view class="xc-title-frame flex-space-between"> | |
| 6 | + <view class="flex-vertical xc-title-content"> | |
| 7 | + <image class="xc-title-img" src="{{iurl}}/miniapp/images/medal.png"></image> | |
| 8 | + <view class="three-level-word">我的权益</view> | |
| 9 | + </view> | |
| 10 | + </view> | |
| 11 | + <view wx:if="{{qy_data.is_grad_get}}" class="three-level-word xc-more-frame flex-vertical"> | |
| 12 | + <view class="three-level-word xc-more">更多</view> | |
| 13 | + <view class="bg_right xc-more-click bcolor"></view> | |
| 14 | + </view> | |
| 15 | + <view wx:else class="three-level-word xc-more-frame flex-vertical" style="justify-content: flex-end"> | |
| 16 | + <image style="width: 40rpx; height: 40rpx; margin-right: 20rpx" src="{{iurl}}/miniapp/images/loader.gif"></image> | |
| 17 | + </view> | |
| 18 | + </view> | |
| 19 | + | |
| 20 | + <block wx:if="{{qy_data && qy_data.is_grad_get}}"> | |
| 21 | + <block wx:if="{{qy_data && qy_data.qy_list && qy_data.gradeId}}"> | |
| 22 | + <view class="xc-specific-more-frame flex-vertical" wx:if="{{qy_data.qy_list}}"> | |
| 23 | + | |
| 24 | + <view bindtap="click_pre"> | |
| 25 | + <view class="bg_left xc-left bcolor"></view> | |
| 26 | + </view> | |
| 27 | + | |
| 28 | + <swiper current="{{sw_index}}" style='width:82.7%; height:108rpx' bindchange='onSli' indicator-dots="{{false}}" autoplay="{{false}}"> | |
| 29 | + <swiper-item wx:for="{{qy_list}}" wx:for-item="aitem" wx:for-index="pidx"> | |
| 30 | + <view class="flex xc-middle"> | |
| 31 | + | |
| 32 | + <view class="xc-center-frame t-c" wx:for="{{aitem}}" data-img="{{item.PrivilegeImageUrl}}" data-no="{{item.PrivilegeType}}" | |
| 33 | + data-ind="{{index}}" data-find="{{pidx}}" bindtap="go_qy_url"> | |
| 34 | + <!-- <text>qy_list.privilegeICOUrl</text> --> | |
| 35 | + <image wx:if="{{object.is_icon}}" class="xc-center-img {{item.ishas==1?'':'img_gray'}}" src="{{item.PrivilegeICOUrl}}"></image> | |
| 36 | + <view class="four-level-word">{{item.PrivilegeName}}</view> | |
| 37 | + </view> | |
| 38 | + </view> | |
| 39 | + </swiper-item> | |
| 40 | + | |
| 41 | + </swiper> | |
| 42 | + | |
| 43 | + <view bindtap="click_next"> | |
| 44 | + <view class="bg_right xc-right bcolor mt"></view> | |
| 45 | + </view> | |
| 46 | + </view> | |
| 47 | + </block> | |
| 48 | + <view wx:else style="text-align: center"> | |
| 49 | + 未找到数据 | |
| 50 | + </view> | |
| 51 | + </block> | |
| 52 | +</view> | |
| 3 | 53 | \ No newline at end of file | ... | ... |
components/diy_user_my_rights/diy_user_my_rights.wxss
| 1 | -.assist{ | |
| 1 | +@import '../../app.wxss'; | |
| 2 | +/* 我的权益 */ | |
| 3 | +.xc-my-equity-frame { | |
| 2 | 4 | width: 100%; |
| 3 | - /*border:1px solid #00F;*/ | |
| 4 | -} | |
| 5 | 5 | \ No newline at end of file |
| 6 | + height: 248rpx; | |
| 7 | +} | |
| 8 | + | |
| 9 | +.xc-equity-title { | |
| 10 | + width: 100%; | |
| 11 | + height: 79rpx; | |
| 12 | + border-bottom: 1rpx solid #f2f2f2; | |
| 13 | +} | |
| 14 | + | |
| 15 | +.xc-title-frame { | |
| 16 | + width: 85%; | |
| 17 | + height: 100%; | |
| 18 | +} | |
| 19 | + | |
| 20 | +.xc-title-img { | |
| 21 | + width: 50rpx; | |
| 22 | + height: 50rpx; | |
| 23 | + margin-left: 20rpx;s | |
| 24 | +} | |
| 25 | + | |
| 26 | +.xc-title-content { | |
| 27 | + height: 100%; | |
| 28 | +} | |
| 29 | + | |
| 30 | +.xc-more { | |
| 31 | + color: #878787; | |
| 32 | +} | |
| 33 | + | |
| 34 | +.xc-more-frame { | |
| 35 | + width: 16.1%; | |
| 36 | + height: 100%; | |
| 37 | +} | |
| 38 | + | |
| 39 | + | |
| 40 | +.xc-more-click { | |
| 41 | + width: 15rpx; | |
| 42 | + height: 15rpx; | |
| 43 | + margin-left: 10rpx; | |
| 44 | + color: #898989; | |
| 45 | +} | |
| 46 | + | |
| 47 | +.bg_right.bcolor, | |
| 48 | +.bg_left.bcolor { | |
| 49 | + border-color: #333; | |
| 50 | +} | |
| 51 | + | |
| 52 | +.bg_right.mt { | |
| 53 | + margin-top: -9rpx; | |
| 54 | +} | |
| 55 | + | |
| 56 | +.bg_right.mt2 { | |
| 57 | + margin-top: -5rpx; | |
| 58 | +} | |
| 59 | + | |
| 60 | + | |
| 61 | +.xc-specific-more-frame { | |
| 62 | + width: 100%; | |
| 63 | + height: 169rpx; | |
| 64 | + padding-left: 43rpx; | |
| 65 | +} | |
| 66 | + | |
| 67 | +.xc-specific-more-frame .xc-left { | |
| 68 | + width: 20rpx; | |
| 69 | + height: 20rpx; | |
| 70 | +} | |
| 71 | + | |
| 72 | +.xc-specific-more-frame .xc-middle { | |
| 73 | + width: 100%; | |
| 74 | + margin-left: 2%; | |
| 75 | + height:100%; | |
| 76 | + align-items: center; | |
| 77 | +} | |
| 78 | +.xc-center-frame { | |
| 79 | + width: 20%; | |
| 80 | + margin-right: 5%; | |
| 81 | +} | |
| 82 | +.xc-center-img { | |
| 83 | + width: 60rpx; | |
| 84 | + height: 60rpx; | |
| 85 | +} | ... | ... |
components/diy_user_tools_services/diy_user_tools_services.js
| 1 | +const ut = require("../../utils/util.js"); | |
| 2 | +var os = getApp().globalData.setting; | |
| 1 | 3 | Component({ |
| 2 | 4 | properties: { |
| 3 | 5 | object: { |
| 4 | 6 | type: Object, |
| 5 | 7 | value: null |
| 6 | 8 | }, |
| 9 | + f_user_tool: { | |
| 10 | + type: Object, | |
| 11 | + value: null | |
| 12 | + }, | |
| 13 | + c_list: { | |
| 14 | + type: Object, | |
| 15 | + value: null | |
| 16 | + }, | |
| 7 | 17 | // 这里定义了innerText属性,属性值可以在组件使用时指定 |
| 18 | + //-- 是不是初始化了 -- | |
| 19 | + is_dengji:{ | |
| 20 | + type:Number, | |
| 21 | + value:0 | |
| 22 | + }, | |
| 8 | 23 | |
| 24 | + //-- 是不是有助力活动 -- | |
| 25 | + is_assistance:{ | |
| 26 | + type:Number, | |
| 27 | + value:0 | |
| 28 | + }, | |
| 9 | 29 | }, |
| 30 | + | |
| 10 | 31 | data: { |
| 11 | - // 这里是一些组件内部数据 | |
| 12 | - someData: {} | |
| 32 | + iurl:os.imghost, | |
| 33 | + sys_switch:null, | |
| 34 | + userInfo:null, | |
| 35 | + hiddenCS: true, | |
| 13 | 36 | }, |
| 37 | + | |
| 38 | + ready: function() { | |
| 39 | + | |
| 40 | + var th=this; | |
| 41 | + | |
| 42 | + if(getApp().globalData.userInfo){ | |
| 43 | + this.setData({userInfo:getApp().globalData.userInfo}); | |
| 44 | + } | |
| 45 | + | |
| 46 | + /*-------系统是否开通等级卡,会员是等级卡-----*/ | |
| 47 | + getApp().getConfig2(function (e) { | |
| 48 | + var t_swi = e.switch_list; | |
| 49 | + if (t_swi) t_swi = JSON.parse(t_swi) | |
| 50 | + if (t_swi) { | |
| 51 | + th.setData({sys_switch: t_swi}); | |
| 52 | + } | |
| 53 | + }) | |
| 54 | + | |
| 55 | + let img_host=this.data.iurl; | |
| 56 | + if(this.properties.f_user_tool){ | |
| 57 | + var f_user_tool=JSON.parse(JSON.stringify(this.properties.f_user_tool)); | |
| 58 | + var list=this.properties.object.list; | |
| 59 | + | |
| 60 | + if(list && list.length) { | |
| 61 | + //进行循环 | |
| 62 | + for (let iu = 0; iu < list.length; iu++) { | |
| 63 | + let fd = f_user_tool.find(function (e) { | |
| 64 | + return e.id == list[iu].id; | |
| 65 | + }) | |
| 66 | + if (fd) { | |
| 67 | + list[iu].icoimg = fd.icoimg; | |
| 68 | + list[iu].new_weappurl = fd.new_weappurl; | |
| 69 | + } else { | |
| 70 | + list.splice(iu, 1); | |
| 71 | + iu--; | |
| 72 | + } | |
| 73 | + } | |
| 74 | + }else{ | |
| 75 | + list=[]; | |
| 76 | + } | |
| 77 | + //-- 如果是有新的tool要添加进去 -- | |
| 78 | + for (let ig = 0; ig <f_user_tool.length ; ig++) { | |
| 79 | + let fd= list.find(function (e){ | |
| 80 | + return e.id==f_user_tool[ig].id; | |
| 81 | + }) | |
| 82 | + if(fd) continue; | |
| 83 | + let ob={ | |
| 84 | + show:true,id:fd.id,icoimg:fd.icoimg,name:item.name,new_weappurl:item.new_weappurl | |
| 85 | + } | |
| 86 | + list.push(ob); | |
| 87 | + } | |
| 88 | + | |
| 89 | + | |
| 90 | + this.setData({user_tool:list}) | |
| 91 | + } | |
| 92 | + }, | |
| 93 | + | |
| 14 | 94 | methods: { |
| 15 | - // 这里是一个自定义方法 | |
| 16 | - customMethod() { } | |
| 95 | + // 这里是一个自定义方法 | |
| 96 | + goto_nav: function (e) { | |
| 97 | + var th = this; | |
| 98 | + var url = e.currentTarget.dataset.url; | |
| 99 | + if (th.data.userInfo != null) { | |
| 100 | + console.log('跳转'); | |
| 101 | + getApp().goto(url); | |
| 102 | + } else { | |
| 103 | + wx.navigateTo({ | |
| 104 | + url: '/packageE/pages/togoin/togoin', | |
| 105 | + }) | |
| 106 | + } | |
| 107 | + }, | |
| 108 | + //跳转到链接 | |
| 109 | + goto: function (e) { | |
| 110 | + console.log(e); | |
| 111 | + console.log('跳转'); | |
| 112 | + var url = e.currentTarget.dataset.url; | |
| 113 | + wx.navigateTo({ url: url }) | |
| 114 | + // getApp().goto(url); | |
| 115 | + }, | |
| 116 | + //--跳转到权益页面-- | |
| 117 | + go_qy: function () { | |
| 118 | + if (!this.data.userInfo) return false; | |
| 119 | + var url = "/pages/user/userqy/userqy"; | |
| 120 | + getApp().goto(url); | |
| 121 | + }, | |
| 122 | + | |
| 123 | + openCS() { | |
| 124 | + let self=this; | |
| 125 | + // 判断会员状态 | |
| 126 | + let user_info = getApp().globalData.userInfo; | |
| 127 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == '' || user_info.mobile == null) { | |
| 128 | + wx.navigateTo({ | |
| 129 | + url: '/packageE/pages/togoin/togoin', | |
| 130 | + }) | |
| 131 | + return false; | |
| 132 | + }; | |
| 133 | + // csType/在线客服设置: | |
| 134 | + // 0关闭(如果有设置热线电话,则显示拨打热线电话)、 | |
| 135 | + // 1小程序客服、 | |
| 136 | + // 2企业微信客服 | |
| 137 | + if (this.data.sys_switch) { | |
| 138 | + let csType = this.data.sys_switch.weapp_customertype; | |
| 139 | + if (csType == 0) { | |
| 140 | + // 拨打电话号码 | |
| 141 | + this.contactService(); | |
| 142 | + } else { | |
| 143 | + this.getTel() | |
| 144 | + .then(() => { | |
| 145 | + self.setData({ | |
| 146 | + hiddenCS: false, | |
| 147 | + }); | |
| 148 | + }); | |
| 149 | + } | |
| 150 | + } | |
| 151 | + }, | |
| 152 | + | |
| 153 | + //---------联系客服------------ | |
| 154 | + contactService: function () { | |
| 155 | + getApp().com_call(this); | |
| 156 | + }, | |
| 157 | + | |
| 158 | + //关闭客服操作菜单 | |
| 159 | + closeCS() { | |
| 160 | + this.setData({ | |
| 161 | + hiddenCS: true, | |
| 162 | + }); | |
| 163 | + }, | |
| 164 | + | |
| 165 | + //添加卡包 | |
| 166 | + addcard: function () { | |
| 167 | + var res = this.data.add_card_data; | |
| 168 | + if (!res) return false; | |
| 169 | + | |
| 170 | + var arr = new Array(6) | |
| 171 | + arr[0] = res.code; | |
| 172 | + arr[1] = res.timestamp; | |
| 173 | + arr[2] = res.jsapiTicket; | |
| 174 | + arr[3] = res.openid; | |
| 175 | + arr[4] = res.cardid; | |
| 176 | + arr[5] = res.nonceStr; | |
| 177 | + var c = arr.sort(); | |
| 178 | + var newstr = ""; | |
| 179 | + for (var i = 0; i < c.length; i++) { | |
| 180 | + newstr += c[i]; | |
| 181 | + } | |
| 182 | + | |
| 183 | + var sh1 = ut.sha1(newstr); | |
| 184 | + wx.addCard({ | |
| 185 | + cardList: [ | |
| 186 | + { | |
| 187 | + cardId: res.cardid, | |
| 188 | + cardExt: '{"code": "' + res.code + '", "openid": "' + res.openid + '","timestamp": "' + res.timestamp + '","nonce_str":"' + res.nonceStr + '","outer_str":"web", "signature":"' + sh1 + '"}' | |
| 189 | + } | |
| 190 | + | |
| 191 | + ], | |
| 192 | + success: function (res) { }, | |
| 193 | + cancel: function (res) { } | |
| 194 | + }); | |
| 195 | + }, | |
| 196 | + | |
| 197 | + // 获取客服热线 | |
| 198 | + getTel() { | |
| 199 | + var self = this; | |
| 200 | + return new Promise((resolve, reject) => { | |
| 201 | + var s = getApp(); | |
| 202 | + s.getConfig(function (t) { | |
| 203 | + if (t.store_tel == undefined) { | |
| 204 | + getApp().request.get("/api/weshop/store/get/" + os.stoid, { | |
| 205 | + isShowLoading: 1, | |
| 206 | + data: {}, | |
| 207 | + success: function (rs) { | |
| 208 | + getApp().globalData.config = rs.data.data; | |
| 209 | + if (rs.data.data.store_tel == null && rs.data.data.store_tel == undefined) { | |
| 210 | + getApp().showWarning("商家未设置电话"); | |
| 211 | + return false; | |
| 212 | + } else { | |
| 213 | + self.setData({ | |
| 214 | + store_tel: rs.data.data.store_tel, | |
| 215 | + }); | |
| 216 | + // s.confirmBox("客服热线:" + rs.data.data.store_tel); | |
| 217 | + }; | |
| 218 | + | |
| 219 | + } | |
| 220 | + }) | |
| 221 | + } else { | |
| 222 | + self.setData({ | |
| 223 | + store_tel: t.store_tel, | |
| 224 | + }); | |
| 225 | + // s.confirmBox("客服热线:" + t.store_tel); | |
| 226 | + } | |
| 227 | + resolve(); | |
| 228 | + }); | |
| 229 | + }); | |
| 230 | + }, | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 17 | 234 | } |
| 18 | 235 | }) |
| 19 | 236 | \ No newline at end of file | ... | ... |
components/diy_user_tools_services/diy_user_tools_services.wxml
| 1 | -<view class='assist' style='height:{{object.height*2}}rpx;background-color:{{object.bgcolor}}'></view> | |
| 2 | 1 | \ No newline at end of file |
| 2 | +<wxs src="filter.wxs" module="util"></wxs> | |
| 3 | +<!-- 工具与服务 --> | |
| 4 | +<view class="xc-tool-service"> | |
| 5 | + <view class="xc-tool-service-title flex-vertical" wx:if="{{object.is_title}}"> | |
| 6 | + <image class="xc-tool-service-img" src="{{iurl}}/miniapp/images/gj.png"></image> | |
| 7 | + <view class="three-level-word xc-tool-service-word">工具与服务</view> | |
| 8 | + </view> | |
| 9 | + <view class="xc-project-frame" wx:if="{{user_tool}}"> | |
| 10 | + <!-- 跳转页面 --> | |
| 11 | + <view class="center_v" style="display: flex;flex-wrap: wrap;align-items: center;"> | |
| 12 | + <!-- 循环使用自定义菜单,显示和掩藏 --> | |
| 13 | + <block wx:for="{{user_tool}}"> | |
| 14 | + <!-- 判断自定义的判断显示--> | |
| 15 | + <block wx:if="{{item.show}}"> | |
| 16 | + <!-- 有链接地址的时候 --> | |
| 17 | + <block wx:if="{{item.new_weappurl}}"> | |
| 18 | + <block wx:if="{{item.name=='PLUS会员'}}"> | |
| 19 | + <view class="item t-c" data-url="{{item.new_weappurl}}" bindtap="goto" wx:if="{{is_dengji==1}}"> | |
| 20 | + <image wx:if="{{object.is_icon}}" class="xc-center-img " src="{{iurl+item.icoimg}}"></image> | |
| 21 | + <view class="fs26">PLUS会员</view> | |
| 22 | + </view> | |
| 23 | + </block> | |
| 24 | + <block wx:elif="{{item.name=='助力活动'}}"> | |
| 25 | + <view class="item t-c" data-url="/pages/user/assistance/assistance" bindtap="goto_nav" wx:if="{{is_assistance==1}}"> | |
| 26 | + <image wx:if="{{object.is_icon}}" class="xc-center-img" src="{{iurl}}/miniapp/images/friendhelp/icon-zl.png"></image> | |
| 27 | + <view class="four-level-word">助力活动</view> | |
| 28 | + </view> | |
| 29 | + </block> | |
| 30 | + <block wx:elif="{{item.name=='我的权益'}}"> | |
| 31 | + <view class="item t-c" bindtap="go_qy" wx:if="{{qy_list!=null && is_init && gradeId}}"> | |
| 32 | + <image wx:if="{{object.is_icon}}" class="xc-center-img" src="{{iurl+item.icoimg}}"></image> | |
| 33 | + <view class="fs26">我的权益</view> | |
| 34 | + </view> | |
| 35 | + </block> | |
| 36 | + <block wx:elif="{{item.name=='套盒商品'}}"> | |
| 37 | + <view class="item t-c" data-url="{{item.new_weappurl}}" bindtap="goto" wx:if="{{enableMeiye}}"> | |
| 38 | + <image wx:if="{{object.is_icon}}" class="xc-center-img" src="{{iurl+item.icoimg}}"></image> | |
| 39 | + <view class="fs26">套盒商品</view> | |
| 40 | + </view> | |
| 41 | + </block> | |
| 42 | + | |
| 43 | + <block wx:elif="{{item.name=='瘦身日记'}}"> | |
| 44 | + <view wx:if="{{has_rj>0}}" class="item t-c" data-url="{{item.new_weappurl}}" bindtap="goto_nav"> | |
| 45 | + <image wx:if="{{object.is_icon}}" class="xc-center-img" src="{{iurl+item.icoimg}}"></image> | |
| 46 | + <view class="fs26">{{item.name}}</view> | |
| 47 | + </view> | |
| 48 | + </block> | |
| 49 | + | |
| 50 | + <block wx:else> | |
| 51 | + <view class="item t-c" data-url="{{item.new_weappurl}}" bindtap="goto_nav"> | |
| 52 | + <image wx:if="{{object.is_icon}}" class="xc-center-img" src="{{iurl+item.icoimg}}"></image> | |
| 53 | + <view class="fs26">{{item.name}}</view> | |
| 54 | + </view> | |
| 55 | + </block> | |
| 56 | + </block> | |
| 57 | + <!-- 没有链接地址的时候 --> | |
| 58 | + <block wx:else> | |
| 59 | + <block wx:if="{{item.name=='联系客服'}}"> | |
| 60 | + | |
| 61 | + <view class="item t-c" bindtap="openCS"> | |
| 62 | + <image wx:if="{{object.is_icon}}" class="xc-center-img " src="{{iurl+item.icoimg}}"></image> | |
| 63 | + <view class="fs26">联系客服</view> | |
| 64 | + </view> | |
| 65 | + | |
| 66 | + </block> | |
| 67 | + <block wx:elif="{{item.name=='收入卡包'}}"> | |
| 68 | + <view class="item t-c" bindtap="addcard" wx:if="{{add_card_data}}"> | |
| 69 | + <image wx:if="{{object.is_icon}}" class="xc-center-img " src="{{iurl+item.icoimg}}"></image> | |
| 70 | + <view class="four-level-word">收入卡包</view> | |
| 71 | + </view> | |
| 72 | + </block> | |
| 73 | + </block> | |
| 74 | + </block> | |
| 75 | + </block> | |
| 76 | + </view> | |
| 77 | + </view> | |
| 78 | +</view> | |
| 79 | + | |
| 80 | +<include src="../../components/com_servicer/com_servicer.wxml"/> | |
| 3 | 81 | \ No newline at end of file | ... | ... |
components/diy_user_tools_services/diy_user_tools_services.wxss
| 1 | -.assist{ | |
| 1 | +@import '../../app.wxss'; | |
| 2 | +.xc-center-img { | |
| 3 | + width: 60rpx; | |
| 4 | + height: 60rpx; | |
| 5 | +} | |
| 6 | + | |
| 7 | +/* 工具与服务 */ | |
| 8 | +.xc-tool-service { | |
| 2 | 9 | width: 100%; |
| 3 | - /*border:1px solid #00F;*/ | |
| 10 | + border-bottom: 20rpx solid #f2f2f2; | |
| 11 | + padding-bottom: 30rpx; | |
| 12 | +} | |
| 13 | + | |
| 14 | +.xc-tool-service .xc-tool-service-title { | |
| 15 | + width: 100%; | |
| 16 | + height: 90rpx; | |
| 17 | + | |
| 18 | +} | |
| 19 | + | |
| 20 | + | |
| 21 | +.xc-tool-service-img { | |
| 22 | + width: 38rpx; | |
| 23 | + height: 38rpx; | |
| 24 | + margin-left: 30rpx; | |
| 25 | +} | |
| 26 | + | |
| 27 | +.xc-tool-service-word { | |
| 28 | + margin-left: 10rpx; | |
| 29 | +} | |
| 30 | + | |
| 31 | +.xc-project-frame { | |
| 32 | + width: 100%; | |
| 33 | +} | |
| 34 | + | |
| 35 | +.xc-project-frame .item { | |
| 36 | + width: 25%; | |
| 37 | + margin-top: 30rpx; | |
| 38 | + display: inline-block; | |
| 39 | + line-height: 40rpx; | |
| 40 | + margin-left: 0 !important; | |
| 41 | + margin-right: 0 !important; | |
| 4 | 42 | } |
| 5 | 43 | \ No newline at end of file | ... | ... |
packageG/pages/user_template/index.js
| ... | ... | @@ -5,24 +5,31 @@ var t = getApp(), |
| 5 | 5 | ut = require("../../../utils/util.js"), |
| 6 | 6 | com = require("../../../utils/common.js"); |
| 7 | 7 | var regeneratorRuntime = require('../../../utils/runtime.js'); |
| 8 | +const rq = require("../../../utils/request.js"); | |
| 8 | 9 | var appd = getApp().globalData; |
| 9 | 10 | |
| 10 | 11 | Page({ |
| 11 | 12 | data: { |
| 12 | 13 | url: os.imghost, |
| 13 | 14 | temp_id:0, |
| 14 | - goodsGroupArr:[] | |
| 15 | + goodsGroupArr:[], | |
| 16 | + pulscardname:'', | |
| 17 | + rfmName:'成长值', | |
| 18 | + | |
| 19 | + byquan: 0, | |
| 20 | + yuer: 0, | |
| 21 | + udata:{}, | |
| 22 | + | |
| 23 | + is_assistance: 0, //助力活动 | |
| 15 | 24 | }, |
| 16 | 25 | |
| 17 | 26 | onLoad: function(e) { |
| 18 | 27 | var th = this; |
| 19 | 28 | this.data.temp_id=e.scene; |
| 20 | - if(!this.data.temp_id) | |
| 21 | - this.data.temp_id=e.sence; | |
| 22 | 29 | if(!this.data.temp_id) wx.showModal({ title:"未读取到模板ID" ,}) |
| 23 | 30 | |
| 24 | - var first_leader = e.first_leader; | |
| 25 | - if (first_leader) { | |
| 31 | + var first_leader = e.first_leader; | |
| 32 | + if (first_leader) { | |
| 26 | 33 | //-- user_id代过来免登录 -- |
| 27 | 34 | getApp().globalData.first_leader = first_leader; |
| 28 | 35 | //调用接口判断是不是会员 |
| ... | ... | @@ -32,20 +39,239 @@ Page({ |
| 32 | 39 | getApp().globalData.guide_pick_id= res.data.data.pickup_id |
| 33 | 40 | } |
| 34 | 41 | }) |
| 35 | - } | |
| 42 | + } | |
| 36 | 43 | |
| 44 | + if(!getApp().globalData.userInfo) { | |
| 45 | + getApp().goto('/packageE/pages/togoin/togoin'); | |
| 46 | + } | |
| 37 | 47 | |
| 38 | - | |
| 39 | 48 | }, |
| 40 | 49 | |
| 41 | 50 | async onShow() { |
| 42 | 51 | getApp().check_can_share(); |
| 43 | - var th = this; | |
| 44 | - await this.init_load(); | |
| 45 | - //如果是自定义模板 | |
| 46 | - if (this.data.isTemplate) { | |
| 47 | - | |
| 48 | - } | |
| 52 | + var th = this; | |
| 53 | + | |
| 54 | + /*-------系统是否开通等级卡,会员是等级卡-----*/ | |
| 55 | + getApp().getConfig2(function (e) { | |
| 56 | + var t_swi = e.switch_list; | |
| 57 | + if (t_swi) t_swi = JSON.parse(t_swi) | |
| 58 | + if (t_swi) { | |
| 59 | + th.setData({sys_switch: t_swi}); | |
| 60 | + var user_tool = []; | |
| 61 | + if (t_swi.usertool) user_tool = JSON.parse(t_swi.usertool); | |
| 62 | + th.setData({c_list: user_tool}); | |
| 63 | + | |
| 64 | + if (parseInt(t_swi.rank_switch) == 2) { | |
| 65 | + var userInfo = th.data.userInfo; | |
| 66 | + if (userInfo && userInfo.card_field != null && userInfo.card_field != undefined && userInfo.card_field != "") { | |
| 67 | + var now = ut.gettimestamp(); | |
| 68 | + var str = userInfo.card_expiredate; | |
| 69 | + var end = new Date(str); | |
| 70 | + end = Date.parse(end) / 1000; | |
| 71 | + //---判断是不是有过期--- | |
| 72 | + if (now < end) { | |
| 73 | + th.setData({ | |
| 74 | + is_dengji: 1 | |
| 75 | + }) | |
| 76 | + } else { | |
| 77 | + th.setData({ | |
| 78 | + is_dengji: 3 | |
| 79 | + }) | |
| 80 | + } | |
| 81 | + } else { | |
| 82 | + th.setData({ | |
| 83 | + is_dengji: 2 | |
| 84 | + }) | |
| 85 | + } | |
| 86 | + } | |
| 87 | + } | |
| 88 | + }) | |
| 89 | + | |
| 90 | + //--初始化是否有打勾,-- | |
| 91 | + getApp().request.get("/api/weshop/users/grade/vip/init/get", { | |
| 92 | + data: { | |
| 93 | + storeId: os.stoid | |
| 94 | + }, | |
| 95 | + success: function (rs) { | |
| 96 | + if (rs.data.code == 0 && rs.data.data.isBool) { | |
| 97 | + th.setData({ is_init: 1 }); | |
| 98 | + /*-----获取会员权益列表-----*/ | |
| 99 | + rq.get("/api/weshop/users/grade/vipprivilegeinfo/page", { | |
| 100 | + isShowLoading: 0, | |
| 101 | + data: { | |
| 102 | + storeId: os.stoid, | |
| 103 | + pageSize: 100 | |
| 104 | + }, | |
| 105 | + success: async function (res) { | |
| 106 | + | |
| 107 | + //判断有没有值,没有值返回 | |
| 108 | + if (!ut.ajax_ok(res)) return false; | |
| 109 | + | |
| 110 | + var arr_data = res.data.data.pageData; | |
| 111 | + var gid = null, | |
| 112 | + g_qy_list = null, | |
| 113 | + cz_vals = 0, | |
| 114 | + need_money = 0, | |
| 115 | + backClass = null, | |
| 116 | + GradeName = ''; | |
| 117 | + | |
| 118 | + var app_d=getApp().globalData; | |
| 119 | + | |
| 120 | + //获取成长值 | |
| 121 | + await getApp().request.promiseGet("/api/weshop/users/grade/aftervipinfo/get", { | |
| 122 | + data: { | |
| 123 | + storeId: os.stoid, | |
| 124 | + userId: app_d.user_id | |
| 125 | + } | |
| 126 | + }).then(res => { | |
| 127 | + if (res.data.code == 0 && res.data.data) { | |
| 128 | + gid = res.data.data.GradeId; | |
| 129 | + var cz_val = res.data.data.GradeSum; | |
| 130 | + cz_vals = parseInt(cz_val); | |
| 131 | + GradeName = res.data.data.GradeName; | |
| 132 | + } | |
| 133 | + //th.setData({ cz_val: cz_vals, GradeName: res.data.data.GradeName, is_init: is_init, gradeId: gid}); | |
| 134 | + }) | |
| 135 | + var obj = { | |
| 136 | + cz_val: cz_vals, | |
| 137 | + GradeName: GradeName, | |
| 138 | + gradeId: gid, | |
| 139 | + is_grad_get: 1 | |
| 140 | + }; | |
| 141 | + | |
| 142 | + // 获取最大值 | |
| 143 | + await getApp().request.promiseGet("/api/weshop/users/grade/vipgradeinfo/page", { | |
| 144 | + data: { | |
| 145 | + storeId: os.stoid | |
| 146 | + } | |
| 147 | + }).then(res => { | |
| 148 | + if (res.data.data) | |
| 149 | + backClass = res.data.data.pageData; | |
| 150 | + if (backClass) { | |
| 151 | + var full_cz_val = backClass[backClass.length - 1].BuyGradeSum; | |
| 152 | + obj.full_cz_val = full_cz_val | |
| 153 | + } | |
| 154 | + }) | |
| 155 | + | |
| 156 | + //--会员权益中心页的修改-- | |
| 157 | + for (var i in backClass) { | |
| 158 | + var im = backClass[i]; | |
| 159 | + if (cz_vals < im.BuyGradeSum && need_money == 0) { | |
| 160 | + need_money = im.BuyGradeSum; | |
| 161 | + obj.need_money = need_money; | |
| 162 | + } | |
| 163 | + } | |
| 164 | + | |
| 165 | + //获取当前等级的特权 | |
| 166 | + await getApp().request.promiseGet("/api/weshop/users/grade/privilegeform/list/page", { | |
| 167 | + data: { | |
| 168 | + storeId: os.stoid, | |
| 169 | + GradeId: gid, | |
| 170 | + userId: app_d.user_id, | |
| 171 | + pageSize: 100 | |
| 172 | + } | |
| 173 | + }).then(res => { | |
| 174 | + if (res.data.data) | |
| 175 | + g_qy_list = res.data.data.pageData; | |
| 176 | + }); | |
| 177 | + | |
| 178 | + for (var i in arr_data) { | |
| 179 | + var item = arr_data[i]; | |
| 180 | + var FromId = th.check_is_has_qy(item, g_qy_list); | |
| 181 | + arr_data[i].ishas = 0; | |
| 182 | + if (FromId) { | |
| 183 | + arr_data[i].ishas = 1; | |
| 184 | + arr_data[i].FromId = FromId; | |
| 185 | + } | |
| 186 | + } | |
| 187 | + arr_data.sort(function (a, b) { | |
| 188 | + return b.ishas - a.ishas | |
| 189 | + }) | |
| 190 | + | |
| 191 | + //4个4个一组 | |
| 192 | + var arr = new Array(); | |
| 193 | + for (var i = 0; i < arr_data.length; i += 4) { | |
| 194 | + arr.push(arr_data.slice(i, i + 4)); | |
| 195 | + } | |
| 196 | + //th.setData({ qy_list: arr, need_money: need_money}); | |
| 197 | + obj.qy_list = arr; | |
| 198 | + obj.old_qy_list = arr_data; | |
| 199 | + th.setData(obj); | |
| 200 | + obj.is_init=1; | |
| 201 | + th.setData({qy_data:obj}) | |
| 202 | + } | |
| 203 | + }) | |
| 204 | + } | |
| 205 | + } | |
| 206 | + }) | |
| 207 | + this.puls_user(); | |
| 208 | + this.getVison(); | |
| 209 | + | |
| 210 | + //-----获取线下会员的预存款和优惠券的数量----- | |
| 211 | + getApp().request.get("/api/weshop/users/getinfo/" + os.stoid + "/" +getApp().globalData.user_id, { | |
| 212 | + isShowLoading: 0, | |
| 213 | + success: function (su) { | |
| 214 | + if (su.data.code == 0 && su.data.data) { | |
| 215 | + var data = su.data.data; | |
| 216 | + if (!data) data = {}; | |
| 217 | + data.cashcount = parseInt(data.cashcount); | |
| 218 | + th.setData({ | |
| 219 | + udata: data, | |
| 220 | + }); | |
| 221 | + } | |
| 222 | + | |
| 223 | + } | |
| 224 | + }) | |
| 225 | + | |
| 226 | + //-----获取会员提现金额----- | |
| 227 | + getApp().request.get("/api/weshop/withdrawals/summoney", { | |
| 228 | + isShowLoading: 0, | |
| 229 | + data: { | |
| 230 | + user_id: getApp().globalData.user_id, | |
| 231 | + store_id: os.stoid, | |
| 232 | + status: 0 | |
| 233 | + }, | |
| 234 | + success: function (su) { | |
| 235 | + if (su.data.code == 0) { | |
| 236 | + | |
| 237 | + let user=getApp().globalData.userInfo; | |
| 238 | + var yuer = parseFloat(user.user_money - user.frozen_money - su.data.data.summoney).toFixed(2); | |
| 239 | + th.setData({ | |
| 240 | + txmon: su.data.data.summoney, | |
| 241 | + yuer: yuer | |
| 242 | + }); | |
| 243 | + } | |
| 244 | + } | |
| 245 | + }) | |
| 246 | + | |
| 247 | + /*-----获取会员包邮券的数量-----*/ | |
| 248 | + getApp().request.get("/api/weshop/userfeemail/page", { | |
| 249 | + isShowLoading: 0, | |
| 250 | + data: { | |
| 251 | + user_id:getApp().globalData.user_id, | |
| 252 | + store_id: os.stoid, | |
| 253 | + pageSize: 1, | |
| 254 | + isuse: 0 | |
| 255 | + }, | |
| 256 | + success: function (su) { | |
| 257 | + if (su.data.code == 0) { | |
| 258 | + th.setData({ | |
| 259 | + byquan: parseInt(su.data.data.total) | |
| 260 | + }); | |
| 261 | + } | |
| 262 | + } | |
| 263 | + }); | |
| 264 | + | |
| 265 | + //判断一下是不是助力活动 | |
| 266 | + this.is_assistance(); | |
| 267 | + //获取工具 | |
| 268 | + await this.init_user_tool(); | |
| 269 | + | |
| 270 | + | |
| 271 | + //获取自定义模板 | |
| 272 | + await this.init_load(); | |
| 273 | + | |
| 274 | + | |
| 49 | 275 | }, |
| 50 | 276 | |
| 51 | 277 | //获取商品模块实例 |
| ... | ... | @@ -190,6 +416,144 @@ Page({ |
| 190 | 416 | this[item].automore() |
| 191 | 417 | }) |
| 192 | 418 | } |
| 419 | + | |
| 420 | + var e = getApp().globalData.userInfo; | |
| 421 | + if (e != undefined && e != null && e.mobile) { | |
| 422 | + var goods_list = this.selectComponent("#goods_recommend"); //组件的id | |
| 423 | + goods_list.init(); | |
| 424 | + setTimeout(function () { | |
| 425 | + goods_list.get_list(); | |
| 426 | + }, 300) | |
| 427 | + } | |
| 428 | + | |
| 429 | + }, | |
| 430 | + | |
| 431 | + //-----Plus会员获取----------- | |
| 432 | + puls_user: function() { | |
| 433 | + var th = this; | |
| 434 | + getApp().request.get("/api/weshop/plus/vip/mem/list", { | |
| 435 | + data: { | |
| 436 | + storeId: os.stoid, | |
| 437 | + userId: getApp().globalData.user_id, | |
| 438 | + }, | |
| 439 | + success: function(su) { | |
| 440 | + if (su.data.code == 0) { | |
| 441 | + var cardname = su.data.data[0].MemCardName; | |
| 442 | + th.setData({ | |
| 443 | + pulscardname: cardname | |
| 444 | + }); | |
| 445 | + } | |
| 446 | + } | |
| 447 | + }); | |
| 448 | + }, | |
| 449 | + | |
| 450 | + //判断会员是后有改服务项目 | |
| 451 | + check_is_has_qy: function (item, g_qy_list) { | |
| 452 | + if (!g_qy_list) return false; | |
| 453 | + | |
| 454 | + for (var i in g_qy_list) { | |
| 455 | + var iter = g_qy_list[i]; | |
| 456 | + if (iter.FormId == item.Id) return g_qy_list[i].FormId; | |
| 457 | + } | |
| 458 | + return false; | |
| 459 | + }, | |
| 460 | + | |
| 461 | + //获取会员权益等级是否升级 | |
| 462 | + getVison(){ | |
| 463 | + let isRfm = wx.getStorageSync('isRfm') | |
| 464 | + if (isRfm) { | |
| 465 | + this.setData({ | |
| 466 | + rfmName:'综合分' | |
| 467 | + }) | |
| 468 | + }else{ | |
| 469 | + rq.get(`/api/weshop/users/grade/vip/getSysPara?storeId=${os.stoid}&classInfo=IsUpRMF`, { | |
| 470 | + success: (res)=>{ | |
| 471 | + console.log('会员权益等级升级查询-------'); | |
| 472 | + console.log(res); | |
| 473 | + if (res.data.code == 0 && res.data.data && res.data.data.IsBool){ | |
| 474 | + this.setData({ | |
| 475 | + rfmName:'综合分' | |
| 476 | + }) | |
| 477 | + wx.setStorageSync('isRfm', true) | |
| 478 | + } | |
| 479 | + } | |
| 480 | + }) | |
| 481 | + } | |
| 482 | + }, | |
| 483 | + | |
| 484 | + | |
| 485 | + //-- 初始话按钮图标,服务与工具的优化 --- | |
| 486 | + init_user_tool: async function () { | |
| 487 | + var d_list = null; | |
| 488 | + //读取user_tool按钮图标 | |
| 489 | + await getApp().promiseGet("/api/weshop/userTool/page?pageSize=100&store_id=" + os.stoid, { | |
| 490 | + }).then(res => { | |
| 491 | + if (ut.ajax_ok(res)) { | |
| 492 | + d_list = res.data.data.pageData; | |
| 493 | + } | |
| 494 | + }) | |
| 495 | + | |
| 496 | + if (!d_list) return false; | |
| 497 | + //过滤掉分销关闭的 | |
| 498 | + let distribut_end_time = await getApp().user_tools_endTime(2);//过滤掉分销到期的 | |
| 499 | + await getApp().promiseGet("/api/weshop/storeDistribut/get/" + os.stoid, {}).then(rs => { | |
| 500 | + if (rs.data.code == 0 || !rs.data.data) { | |
| 501 | + var is_ok=1; | |
| 502 | + | |
| 503 | + if(!distribut_end_time){ | |
| 504 | + is_ok=0; | |
| 505 | + } | |
| 506 | + else if(!rs.data.data){ | |
| 507 | + is_ok=0; | |
| 508 | + }else{ | |
| 509 | + var dis=rs.data.data; | |
| 510 | + if(!dis || dis.switch == 0){ | |
| 511 | + is_ok=0; | |
| 512 | + } | |
| 513 | + } | |
| 514 | + | |
| 515 | + for (var i in d_list) { | |
| 516 | + if (d_list[i].name == '我的分销' && !is_ok) { | |
| 517 | + d_list.splice(i, 1); | |
| 518 | + } | |
| 519 | + } | |
| 520 | + } | |
| 521 | + }) | |
| 522 | + | |
| 523 | + //判断有没有开AI测肤 | |
| 524 | + await getApp().promiseGet("/api/weshop/wx/weappSkin/get/" + os.stoid, {}).then(rs => { | |
| 525 | + if (rs.data.code != 0 || !rs.data.data) { | |
| 526 | + for (var i in d_list) { | |
| 527 | + if (d_list[i].name == 'AI测肤') { | |
| 528 | + d_list.splice(i, 1); | |
| 529 | + } | |
| 530 | + } | |
| 531 | + } | |
| 532 | + }) | |
| 533 | + this.setData({ user_tool: d_list }); | |
| 534 | + }, | |
| 535 | + | |
| 536 | + // 判断助力活动是不是存在 | |
| 537 | + is_assistance: function () { | |
| 538 | + var th = this, r = Math.random() * 100; | |
| 539 | + getApp().promiseGet("/api/weshop/marketing/help/act/judge", { | |
| 540 | + data: { | |
| 541 | + storeId: os.stoid, | |
| 542 | + userId: getApp().globalData.user_id, | |
| 543 | + r: r, | |
| 544 | + } | |
| 545 | + }).then(res=>{ | |
| 546 | + var code = res.data.code; | |
| 547 | + if (code == 0) { | |
| 548 | + th.setData({ | |
| 549 | + is_assistance: 1 | |
| 550 | + }); | |
| 551 | + } else { | |
| 552 | + th.setData({ | |
| 553 | + is_assistance: 0 | |
| 554 | + }); | |
| 555 | + } | |
| 556 | + }) | |
| 193 | 557 | }, |
| 194 | 558 | |
| 195 | 559 | ... | ... |
packageG/pages/user_template/index.json
| ... | ... | @@ -7,7 +7,8 @@ |
| 7 | 7 | "diy_user_info":"/components/diy_user_info/diy_user_info", |
| 8 | 8 | "diy_user_order":"/components/diy_user_order/diy_user_order", |
| 9 | 9 | "diy_user_my_rights":"/components/diy_user_my_rights/diy_user_my_rights", |
| 10 | - "diy_user_tools_services":"/components/diy_user_tools_services/diy_user_tools_services" | |
| 10 | + "diy_user_tools_services":"/components/diy_user_tools_services/diy_user_tools_services", | |
| 11 | + "diy_user_my_rights": "/components/diy_user_my_rights/diy_user_my_rights" | |
| 11 | 12 | }, |
| 12 | 13 | "enablePullDownRefresh": false, |
| 13 | 14 | "onReachBottomDistance":300 | ... | ... |
packageG/pages/user_template/index.wxml
| ... | ... | @@ -11,7 +11,9 @@ |
| 11 | 11 | </block> |
| 12 | 12 | <!-- 会员信息 --> |
| 13 | 13 | <block wx:if="{{item.ename=='userinfo'}}"> |
| 14 | - <diy_user_info object="{{item.content}}"></diy_user_info> | |
| 14 | + <diy_user_info object="{{item.content}}" | |
| 15 | + byquan="{{byquan}}" yuer="{{yuer}}" udata="{{udata}}" | |
| 16 | + qy_data="{{qy_data}}" pulscardname="{{pulscardname}}" rfmName="{{rfmName}}" ></diy_user_info> | |
| 15 | 17 | </block> |
| 16 | 18 | <!-- 我的订单 --> |
| 17 | 19 | <block wx:if="{{item.ename=='order'}}"> |
| ... | ... | @@ -19,11 +21,12 @@ |
| 19 | 21 | </block> |
| 20 | 22 | <!-- 我的权益 --> |
| 21 | 23 | <block wx:if="{{item.ename=='my_rights'}}"> |
| 22 | - <diy_user_order object="{{item.content}}"></diy_user_order> | |
| 24 | + <diy_user_my_rights object="{{item.content}}" qy_data="{{qy_data}}" ></diy_user_my_rights> | |
| 23 | 25 | </block> |
| 24 | 26 | <!-- 工具与服务 --> |
| 25 | 27 | <block wx:if="{{item.ename=='tools_services'}}"> |
| 26 | - <diy_user_tools_services object="{{item.content}}"></diy_user_tools_services> | |
| 28 | + <diy_user_tools_services object="{{item.content}}" is_dengji="{{is_dengji}}" | |
| 29 | + f_user_tool="{{user_tool}}" c_list="{{c_list}}"></diy_user_tools_services> | |
| 27 | 30 | </block> |
| 28 | 31 | |
| 29 | 32 | </view> | ... | ... |
pages/user/index/index.js