haomingming 4f14aad6f3 优化
2023-04-11 18:41:46 +08:00

72 lines
1.9 KiB
JavaScript

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: '2023',
years: [
{ label: '2022年', value: '2022' },
{ label: '2023年', value: '2023' },
{ label: '2024年', value: '2024' },
],
},
onLoad(){
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);
}
})