import { API } from './../../../utils/network/api' const api = new API() const app = getApp() Page({ data: { navbarData: { showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示 title: '提现记录', //导航栏 中间的标题 }, height: app.globalData.height, record_list: [], current_page: 0, total: 0, per_page: 0, last_page: 0, dateVisible: false, select_date: '', years: [], static_host: api.getStaticHost() }, onLoad(){ let now_year = (new Date()).Format("yyyy"); let begin_year = 2022; let years = []; for(let i=begin_year;i<=now_year;i++){ years.push({label: i+"年", value: i+""}) } this.setData({ years: years, select_date: now_year+"" }) }, onShow(){ let year = this.data.select_date; year = Number(year); this.getDoctorWithdrawalRecord(year); }, getDoctorWithdrawalRecord(year){ this.setData({ record_list: [] }) //获取提现数据 api.getDoctorWithdrawalRecord({year: year}).then(response => { console.log(response); if(response.data.total > 0){ this.setData({ record_list: response.data.data, current_page: response.data.current_page, total: response.data.total, per_page: response.data.per_page, last_page: response.data.last_page, }) } }).catch(errors => { console.error(errors); }) }, onDatePicker() { this.setData({ dateVisible: true }); }, onPickerChange(e) { const { key } = e.currentTarget.dataset; const { value } = e.detail; console.log('picker change:', e.detail); this.setData({ select_date: value }) let year = this.data.select_date; year = Number(year); this.getDoctorWithdrawalRecord(year); }, onColumnChange(e) { const { key } = e.currentTarget.dataset; const { value } = e.detail; console.log('Column change:', e.detail); }, onPickerCancel(e) { const { key } = e.currentTarget.dataset; const { value } = e.detail; console.log('picker Cancel:', e.detail); } })