import { queryAmountLog } from "../../../../services/api/account/index" import { accountid } from "../../../../services/utils" import { hideLoading, showLoading } from "../../../../utils/message/index" import { formatDateString } from "../../../../utils/util" Page({ /** * 页面的初始数据 */ data: { /// 底部安全区域 safeBottom: getApp().globalData.safeBottom, /// 是否空数据 isEmpty: true, /// 数据信息 datas: [], /// 列头 titles: ['时间', '操作类型', '金额'] }, /** * 返回上层视图 */ backToParent() { /// 返回上层视图 wx.navigateBack() }, /** * 历史资金流水 */ goToHisAmountLog() { wx.navigateTo({ url: '/mMine/pages/funds/his/index' }) }, /** * 查询当前资金流水信息 */ queryAmountLog(){ /// showLoading showLoading(()=>{ /// 发送查询请求 queryAmountLog({ data: { accountID: accountid().toString() }, success: (res) => { /// 加载失败 if (res.code != 200) { hideLoading(()=>{}, '请求失败,原因:'+res.msg) return } hideLoading(()=>{ /// 数据信息 this.setData({ datas: res.data.map(obj => { var item = obj obj.createtime = formatDateString(obj.createtime, 'HH:MM:SS') return item }), isEmpty: res.data.length === 0 }) }) }, fail: (emsg) => { hideLoading(()=>{}, emsg) }, complete: () => { /// 结束下拉刷新 wx.stopPullDownRefresh() } }) }) }, /** * 生命周期函数--监听页面加载 */ onLoad() { /// 查询当前资金流水信息 this.queryAmountLog() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { /// 查询当前资金流水信息 this.queryAmountLog() }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })