index.ts 4.1 KB

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