123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- // pages/person/person.js
- const app = getApp();
- const getReq = require('./../../config.js').getReq;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- userInfo: {
- nickName: '',
- avatarUrl: ''
- },
- bonus_rate: [],
- bonus_list_show: false,
- login_count: 1,
- addr_num: '',
- pre_pay_count: 0, // 待付款 10
- pre_send_count: 0, // 待发货 20
- pre_receive_count: 0, // 待收货 30
- evaluate_count: 0, // 已收货 40
- bonus_total: 0
-
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- const count = this.data.login_count;
- if (!app.globalData.userInfo && count <= 2) {
- this.setData({
- login_count: this.data.login_count + 1
- })
- wx.navigateTo({
- url: '/pages/login/login'
- });
- return;
- }
- if (!app.globalData.userInfo && count > 2) {
- this.setData({
- login_count: 1
- })
- wx.switchTab({
- url: '/pages/index/index'
- });
- return;
- }
-
- const userInfo = app.globalData.userInfo || null;
- const nickName = userInfo.nickName || '';
- const avatarUrl = userInfo.avatarUrl || '';
- let self = this
- getReq({
- act: 'cart',
- op: 'rate_money'
- }, function (res) {
- if (res.code == 200) {
- self.setData({
- userInfo: { nickName, avatarUrl },
- bonus_rate: res.datas.bonus_rate
- })
- }
- })
- getReq({
- act: 'member_info',
- op: 'get'
- }, function (res) {
- if (res.code == 200) {
- self.setData({
- addr_num: res.datas.sub_titles.addr_num
- })
- }
- })
- getReq({
- act: 'member_order',
- op: 'orderCountState'
- }, function (res) {
- if (res.code == 200) {
- self.setData({
- pre_pay_count: 0, // 待付款 10
- pre_send_count: 0, // 待发货 20
- pre_receive_count: 0, // 待收货 30
- evaluate_count: 0
- })
- let { order_count } = res.datas
- if(order_count.length) {
- let length = order_count.length
- for(let i = 0; i < length; i++) {
- let state_name = ''
- if(order_count[i]['order_state'] == 10) {
- state_name = 'pre_pay_count'
- }
- if(order_count[i]['order_state'] == 20) {
- state_name = 'pre_send_count'
- }
- if(order_count[i]['order_state'] == 30) {
- state_name = 'pre_receive_count'
- }
- if(order_count[i]['order_state'] == 40) {
- state_name = 'evaluate_count'
- }
- if(state_name) {
- self.setData({
- [state_name]: order_count[i]['count']
- })
- }
- }
- }
- }
- })
- getReq({
- act: 'member_bonus',
- op: 'predepositex'
- }, function (res) {
- if (res.code == 200) {
- let { bonus_total } = res.datas
- self.setData({
- bonus_total
- })
- }
- })
- },
- shareBonus() {
- wx.navigateTo({
- url: `/pages/shareBonus/shareBonus?type_sn=16711536579728954218`
- // url: `/pages/shareBonus/shareBonus?type_sn=21991536583136231606`
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- bonus_list() {
- this.setData({
- bonus_list_show: !this.data.bonus_list_show
- })
- },
- skip_help() {
- wx.navigateTo({
- url: '/pages/webView/webView?url=https://passport.lrlz.com/hfive/feed_back/question_answer.html'
- })
- },
- skip_bonus_rule() {
- wx.navigateTo({
- url: '/pages/webView/webView?url=https://passport.lrlz.com/hfive/panda_bonus_rule/index.html'
- })
- },
- skip_all_order() {
- wx.navigateTo({
- url: '/pages/order_tabs/orderTabs'
- })
- },
- refund() {
- wx.showToast({
- title: '客官!请在APP中完成退款申请',
- icon: 'none',
- duration: 2000
- })
- }
- })
|