diy_user_info.js
5.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
const rq = require("../../utils/request.js");
const ut = require("../../utils/util.js");
const {barcode,qrcode} = require("../../utils/index.js");
var s = getApp().globalData.setting;
var r=s;
Component({
properties: {
object: {
type: Object,
value: null
},
qy_data:{
type: Object,
value: null
},
pulscardname:{
type:String,
value:"--"
},
rfmName:{
type:String,
value:"--"
},
yuer:{
type:Number,
value:0
},
byquan:{
type:Number,
value:0
},
udata:{
type: Object,
value: null
},
},
data: {
// 这里是一些组件内部数据
iurl: s.imghost,
defaultAvatar: s.imghost + "/miniapp/images/no-head.jpg",
userInfo:null,
sys_switch:null,
tc_hide:true, //会员卡的弹出层隐藏
brcode:'',
showvipcode:false,
},
ready: function() {
var th=this;
if(getApp().globalData.userInfo){
this.setData({userInfo:getApp().globalData.userInfo});
}
/*-------系统是否开通等级卡,会员是等级卡-----*/
getApp().getConfig2(function (e) {
var t_swi = e.switch_list;
if (t_swi) t_swi = JSON.parse(t_swi)
if (t_swi) {
th.setData({sys_switch: t_swi});
}
var getuserqy_color=e.userqy_color;
if (getuserqy_color) getuserqy_color = JSON.parse(getuserqy_color)
if(getuserqy_color){
th.setData({userqy_color:getuserqy_color})
}
})
},
pageLifetimes: {
//要处理一下,游客登录后的界面的变化,主要还该是改变会员
show: function () {
if(!this.data.userInfo && getApp().globalData.userInfo){
this.setData({userInfo:getApp().globalData.userInfo});
}
}
},
methods: {
//登陆会员
login_user(){
getApp().goto('/packageE/pages/togoin/togoin');
},
//------卡片的显示和关闭--------
show_tc: function () {
var that=this;
if (!this.data.userInfo) return false;
var getnowtime;
getApp().request.get("/api/weshop/users/getServerTime", {
success: function (res) {
if (res.data.code == 0)
{
getnowtime=res.data.data;
if (!getnowtime)
{
ut.m_toast("获取服务时间失败");
return;
}
//base64_encode($user.mobile.'|'.date('Y-m-d H:i:s')
var val = that.data.userInfo.mobile + "|" +getnowtime+"|"+that.data.getusercode_vailtime;
val = "^" + ut.base64_encode(val);
qrcode('qrcode', val, 350, 350, that);
let userInfo = getApp().globalData.userInfo;
barcode('barcode', userInfo.userQrcode, 480,140,that);
that.setData({
tc_hide: false,
brcode:userInfo.userQrcode
});
}
}
})
},
showtext:function(){
this.setData({
showvipcode:true
})
},
//隐藏会员卡
hide_tc: function () {
this.setData({
tc_hide: true,
});
},
//--跳转到预存款页面--
deposit: function () {
if (!this.data.userInfo)
{
this.login_user();
return false;
}
wx.navigateTo({
url: '/packageD/pages/user/deposit/deposit',
})
},
//--跳转到余额页面--
balance: function () {
if (!this.data.userInfo)
{
this.login_user();
return false;
};
wx.navigateTo({
url: '/packageD/pages/user/member/menber',
})
},
//--跳转到优惠券--
coupon: function () {
var th = this;
if (!this.data.userInfo)
{
this.login_user();
return false;
};
// th.sendsm();
wx.navigateTo({
url: '/packageD/pages/user/coupons/coupons',
})
},
//--跳转到积分--
integral: function () {
if (!this.data.userInfo)
{
this.login_user();
return false;
}
wx.navigateTo({
url: '/packageD/pages/user/integral/integral',
})
},
jump: function () {
let isRfm = wx.getStorageSync('isRfm')
//升级为RFM就不跳转成长值详情
if (!isRfm) {
getApp().goto("/packageE/pages/user/grow_value/grow_value")
}
},
//跳转到链接
goto: function (e) {
console.log(e);
console.log('跳转');
var url = e.currentTarget.dataset.url;
wx.navigateTo({ url: url })
},
go_info:function (){
getApp().goto("/packageG/pages/user/userinfo/userinfo");
}
}
})