index.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import { queryAmountLog } from "../../../../services/api/account/index"
  2. import { accountid } from "../../../../services/utils"
  3. import { hideLoading, showLoading } from "../../../../utils/message/index"
  4. import { formatDateString } from "../../../../utils/util"
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. /// 底部安全区域
  11. safeBottom: getApp().globalData.safeBottom,
  12. /// 是否空数据
  13. isEmpty: true,
  14. /// 数据信息
  15. datas: <GuangZuan.AmountLog[]>[],
  16. /// 列头
  17. titles: ['时间', '操作类型', '金额']
  18. },
  19. /**
  20. * 返回上层视图
  21. */
  22. backToParent() {
  23. /// 返回上层视图
  24. wx.navigateBack()
  25. },
  26. /**
  27. * 历史资金流水
  28. */
  29. goToHisAmountLog() {
  30. wx.navigateTo({
  31. url: '/mMine/pages/funds/his/index'
  32. })
  33. },
  34. /**
  35. * 查询当前资金流水信息
  36. */
  37. queryAmountLog(){
  38. /// showLoading
  39. showLoading(()=>{
  40. /// 发送查询请求
  41. queryAmountLog({
  42. data: {
  43. accountID: accountid().toString()
  44. },
  45. success: (res) => {
  46. /// 加载失败
  47. if (res.code != 200) {
  48. hideLoading(()=>{}, '请求失败,原因:'+res.msg)
  49. return
  50. }
  51. hideLoading(()=>{
  52. /// 数据信息
  53. this.setData({
  54. datas: res.data.map(obj => {
  55. var item = obj
  56. obj.createtime = formatDateString(obj.createtime, 'HH:MM:SS')
  57. return item
  58. }),
  59. isEmpty: res.data.length === 0
  60. })
  61. })
  62. },
  63. fail: (emsg) => {
  64. hideLoading(()=>{}, emsg)
  65. },
  66. complete: () => {
  67. /// 结束下拉刷新
  68. wx.stopPullDownRefresh()
  69. }
  70. })
  71. })
  72. },
  73. /**
  74. * 生命周期函数--监听页面加载
  75. */
  76. onLoad() {
  77. /// 查询当前资金流水信息
  78. this.queryAmountLog()
  79. },
  80. /**
  81. * 生命周期函数--监听页面初次渲染完成
  82. */
  83. onReady() {
  84. },
  85. /**
  86. * 生命周期函数--监听页面显示
  87. */
  88. onShow() {
  89. },
  90. /**
  91. * 生命周期函数--监听页面隐藏
  92. */
  93. onHide() {
  94. },
  95. /**
  96. * 生命周期函数--监听页面卸载
  97. */
  98. onUnload() {
  99. },
  100. /**
  101. * 页面相关事件处理函数--监听用户下拉动作
  102. */
  103. onPullDownRefresh() {
  104. /// 查询当前资金流水信息
  105. this.queryAmountLog()
  106. },
  107. /**
  108. * 页面上拉触底事件的处理函数
  109. */
  110. onReachBottom() {
  111. },
  112. /**
  113. * 用户点击右上角分享
  114. */
  115. onShareAppMessage() {
  116. }
  117. })