index.js
3.01 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
// pages/tab/mine/index.js
import commonApi from '~/api/module/common'
import {
ToolList
} from "~/constants/index";
Page({
/**
* 页面的初始数据
*/
data: {
navStyle: "background-color: transparent;",
scoreSummary: {
currentScore: '-', //当前积分
bankCardSize: '-',
totalGoodExchangeScore: '-', //累计兑换积分
totalRewardScore: '-', //累计收益积分
totalWithdrawalScore: '-', //累计提现积分
},
toolList: ToolList,
guideList: [{
key: 'currentScore',
leftIcon: 'logo'
}, {
key: 'bankCardSize',
text: '银行卡'
}
],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let userInfo = wx.p.storage.get('userInfo')
this.setData({
userInfo
})
this.searchScoreSummaryData()
// this.getMemberCardData();
},
searchScoreSummaryData() {
const {
phone,
channelSource
} = this.data.userInfo
wx.p.api.withdrawalApi.searchScoreSummary({
staffPhone:phone,
channelSource //1.阳光激励 2.续保用户 3.管理层
}).then(res => {
if (res.code == 0) {
this.setData({
scoreSummary: res.data
})
}
}).catch((err) => {
wx.p.wxApi.showToast(JSON.stringify(err))
})
},
go(e) {
console.log(e)
const thisPage = wx.p.router.getPageInstance()
let {
index
} = e.currentTarget.dataset
let arr = [
() => {
wx.p.router.go('/packageIndex/pages/integral/index/index')
},
() => {
wx.p.router.go('/packageIndex/pages/bankAccount/list/list')
}
]
arr[index]()
},
navbarReady(e) {
let {
height
} = e.detail;
this.setData({
navHeight: height
})
},
login() {
wx.p.router.go("/pages/Login/Login");
},
goSetUp() {
wx.p.router.go("/packageMine/pages/setting/index");
},
jump(e) {
const {
url
} = e.currentTarget.dataset;
wx.p.router.go(url);
},
async getOrderNumberList() {
const loginStatus = !wx.p.isLogin
if (loginStatus) return;
wx.p.api.mineApi.getOrderNumberList().then((res) => {
this.setData({
orderNumberList: [
res.unPayCount,
res.unShippedCount,
res.unReceivedCount,
res.unServiceCount,
],
});
});
},
// 切换门店
changeMerchant() {
// 获取门店接口 门店数量大于1跳转切换,否则不需切换
let {userInfo} = this.data
commonApi.getMerchantData({staffPhone: userInfo?.phone, channelSource: userInfo?.channelSource}).then(res => {
let {code, data, message} = res
if (code == 0) {
if (data?.length > 1) {
wx.p.router.go('/pages/chooseMerchant/index', {loginData: userInfo, merchantList: data})
}
} else {
wx.p.wxApi.showToast(message)
}
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// this.getOrderNumberList();
// this.toCheckMember();
},
});