const Http = require('../../utils/HttpBasics.js') const config = require('../../config/config.js') const util = require('../../utils/util.js') Page({ /** * 页面的初始数据 */ data: { id:"", list:[], statusList:[ { value: 1, name: '发起审批' }, { value:2, name:'审批通过' }, { value: 3, name: '审批驳回' }, ] }, /** * 查询历史审批 */ lookHistory(){ let getDAta={ couponId:this.data.id } Http.get({ url: config.api.lookHistory, data: getDAta }).then(res=>{ const { code ,data}=res // console.log(code,data) if(code==200){ data.list.map(res=>{ let tmep = res.createDate res.createDate = util.formatTime(res.createDate, 'yyyy-MM-dddd'), res.createDateH = util.formatTime(tmep, 'yyyy-MM-dddd hh:mm:ss').split(" ")[1], res.statusName = this.setStatus(res.status).name }) console.log(data.list) this.setData({ list: data.list }) } }) }, /** * 操作状态 */ setStatus(id){ let value = id return this.data.statusList.filter(res=>res.value==value)[0] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { if (options.id){ this.setData({ id: options.id }) } this.lookHistory() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })