TabMine.js
4.5 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
// components/tabMine/TabMine.js
import api from '~/pages/tabMine/api'
const app = getApp()
import constantData from '../../pages/constant/data'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/mine/'
Component({
/**
* 组件的属性列表
*/
properties: {
navBarHeight: {
type: Number,
value: 0
},
// 是否显示工资绩效
showCollege: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
IMG_URL,
isYqdSuper: '',
selectedSceneName: '',
userInfo: {},
staffBankFlag: false,
isForbidden: false,
},
lifetimes: {
ready() {
let userInfo = wx.$util.getUserInfo()
this.setData({
isForbidden: !(userInfo?.isSuper || userInfo?.loginRole == 3 || userInfo.loginRole == 5),
isYqdSuper: app.globalData.isYqdSuper,
selectedSceneName: constantData?.sceneList?.filter(val => val.sceneType == userInfo?.sceneType)[0]?.sceneName,
selectedSceneDesc: constantData?.sceneList?.filter(val => val.sceneType == userInfo?.sceneType)[0]?.sceneDesc,
userInfo
})
if (userInfo.createdDate) {
let date = userInfo.createdDate + ''
date = date.replace(/-/g, '/').split(' ')[0] // 日期格式处理
this.setData({
['userInfo.createdTime']: date
})
}
this.getStaffBankList()
this.getVersionInfo()
}
},
/**
* 组件的方法列表
*/
methods: {
/**跳转至银行卡 */
toAddBankAccount(e) {
const {
score,
user
} = this.data
this.setData({
showAccountModal: false
}, () => {
wx.$router.go('integration.detail', {
score
})
})
},
async getStaffBankList() {
let userInfo = wx.$util.getUserInfo(),
res = await api.getStaffBankList({
uuid: userInfo.uuid
})
console.log(res)
if (res.data && res.data.length) {
this.data.staffBankFlag = true
const [staffBankInfo] = res.data
if (staffBankInfo.state == 2 && !this.staffBankInfo) {
this.staffBankInfo = staffBankInfo
this.setData({
showAccountErrorModal: true
})
}
}
},
//我的积分
toPoint() {
console.log(999)
//判断是否添加银行卡
if (!this.data.staffBankFlag) {
this.setData({
showAccountModal: true
})
return
}
// 新的积分兑换页面
wx.$router.go('integration.index')
},
toCloseModal(e) {
const {
name
} = e.currentTarget.dataset
this.setData({
[name]: false
});
},
//收款账户
jumpAccount() {
const {
score,
user
} = wx.$router.getPageInstance()
wx.$router.go('integration.list', {
score,
user
})
},
// 跳转到工资绩效
jump(e) {
let { url } = e.currentTarget.dataset
const baseUrl = 'https://img01.glsx.com.cn/weapp/resource/saas/scrm/html/'
const path = `${baseUrl}${url}.html`
wx.navigateTo({
url: `/pages/webView/webView?url=${encodeURIComponent(path)}`
})
},
// 跳转到商学院
goCollegeScene() {
wx.$router.go('packageEquity.collegeScene')
console.log('跳转到工资绩效')
},
// 获取版本信息
async getVersionInfo() {
const versionData = await getApp().getVersionInfo()
this.setData({
versionData
})
},
// 更新日志
goVersionPage() {
wx.$router.go('pages.log')
},
// 切换场景
changeScene() {
wx.$util.pointRecord(31)
wx.$router.go('pages.changeScene')
},
// 切换账号
changeAccount() {
wx.$router.reLaunch('pages.accountItems')
},
// 退出登录
logout() {
let _this = this
wx.showModal({
title: '温馨提示',
content: '是否退出当前账号?',
confirmColor: '#347BFF',
success(res) {
if (res.confirm) {
_this.setData({
flag: true
})
wx.showLoading()
api.logout().then(_res_ => {
let { code, message } = _res_
if (code == 0) {
app.login(false)
} else {
_this.setData({
flag: false
})
wx.showToast(message)
}
})
}
}
})
}
}
})