index.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import Dialog from '../../miniprogram_npm/@vant/weapp/dialog/dialog'
  2. import { accountid, loginid, loginQuery, taAccount } from '../../services/utils';
  3. import { hideLoading, showLoading } from '../../utils/message/index';
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. // 功能菜单项
  10. menulists: [{id: 1, title: '我的库存', img: 'mine-wdkc', path: '/mMine/pages/myinventorys/list/index'},
  11. {id: 2, title: "我的订单", img: 'mine-wddd', path: '/mMine/pages/myorders/list/index'},
  12. {id: 3, title: '我的履约', img: 'mine-wdly', path: '/mMine/pages/myperformance/list/index'},
  13. {id: 4, title: '我的出境', img: 'mine-cjjc', path: '/mHome/pages/inspection/list/index'},
  14. {id: 5, title: '我的保税', img: 'mine-bsfw', path: '/mHome/pages/bond/list/index'}],
  15. // 列表菜单项
  16. tablelists: [{id: 1, title: '签约账户', iconfont: 'mine-qyzh', path: '/mMine/pages/bank/index'},
  17. {id: 2, title: '收货地址', iconfont: 'mine-shdz', path: '/mMine/pages/address/list/index'},
  18. {id: 3, title: '发票信息', iconfont: 'mine-fpxx', path: '/mMine/pages/invoice/list/index'},
  19. {id: 4, title: '账户安全', iconfont: 'mine-mmxg', path: '/mMine/pages/modifypwd/index'},
  20. {id: 5, title: '关于我们', iconfont: 'mine-gywm', path: '/mMine/pages/about/about/index'}],
  21. /// 微信头像
  22. avatarUrl: "",
  23. /// 微信昵称
  24. nickName: loginQuery().userInfo.customername,
  25. /// 资金账户信息
  26. ta: <GuangZuan.TaAccount>({}),
  27. /// 登录账号
  28. loginid: loginid(),
  29. /// 是否脱敏显示
  30. isOpenEye: false
  31. },
  32. onEye() {
  33. this.setData({
  34. isOpenEye: !this.data.isOpenEye
  35. })
  36. },
  37. /**
  38. * 按钮点击响应事件
  39. */
  40. onButtonPressed(e: any) {
  41. switch (e.target.id) {
  42. case 'into-gold': /// 充值
  43. wx.navigateTo({ url: '/mMine/pages/inoutgold/index' })
  44. break;
  45. case 'out-gold': /// 提现
  46. wx.navigateTo({ url: '/mMine/pages/inoutgold/index' })
  47. break;
  48. default:
  49. break;
  50. }
  51. },
  52. /**
  53. * 进入系统设置
  54. */
  55. goToSettings() {
  56. wx.navigateTo({
  57. url: '/mMine/pages/settings/settings'
  58. })
  59. },
  60. /**
  61. * 生命周期函数--监听页面加载
  62. */
  63. onLoad() {
  64. /// 获取微信头像
  65. let url = wx.getStorageSync('avatarUrl')
  66. if (url) {
  67. this.setData({ avatarUrl: url })
  68. }
  69. this.setData({
  70. /// 设置账户信息
  71. ta: taAccount(accountid())
  72. })
  73. },
  74. /**
  75. * 系统登出响应
  76. */
  77. onLoginOut() {
  78. Dialog.confirm({
  79. title: '提示',
  80. message: '确定要退出系统吗?',
  81. }).then(() => {
  82. /// 清楚所有的缓存数据
  83. wx.clearStorage()
  84. /// loding....
  85. showLoading(()=>{
  86. /// 登出
  87. setTimeout(function () {
  88. hideLoading(()=>{
  89. // on confirm
  90. wx.reLaunch({ url: '/pages/login/index' })
  91. }, '登出成功', 'success')
  92. }, 3000)
  93. }, '登出中....')
  94. }).catch(() => {
  95. // on cancel
  96. });
  97. },
  98. /**
  99. * 生命周期函数--监听页面初次渲染完成
  100. */
  101. onReady() {
  102. },
  103. /**
  104. * 生命周期函数--监听页面显示
  105. */
  106. onShow() {
  107. this.getTabBar().init()
  108. },
  109. /**
  110. * 生命周期函数--监听页面隐藏
  111. */
  112. onHide() {
  113. },
  114. /**
  115. * 生命周期函数--监听页面卸载
  116. */
  117. onUnload() {
  118. },
  119. /**
  120. * 页面相关事件处理函数--监听用户下拉动作
  121. */
  122. onPullDownRefresh() {
  123. },
  124. /**
  125. * 页面上拉触底事件的处理函数
  126. */
  127. onReachBottom() {
  128. },
  129. /**
  130. * 用户点击右上角分享
  131. */
  132. onShareAppMessage() {
  133. }
  134. })