import { API } from './../../../utils/network/api' const util = require('./../../../utils/util') let api = new API() const app = getApp() Page({ data: { navbarData: { showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示 title: '我的账户', //导航栏 中间的标题 }, height: app.globalData.height, dateVisible: false, dateText: "", dateValue: ['2023','3'], dialog_visible:false, select_date: "", balance_account: "", amount_total_month: "", doctor_today_inquiry_total:'', doctor_day_completed_amount_total:'', withdrawal_amount_month: "", static_host: api.getStaticHost(), bill: [], years: [], seasons: [ { label: '1月', value: '1' }, { label: '2月', value: '2' }, { label: '3月', value: '3' }, { label: '4月', value: '4' }, { label: '5月', value: '5' }, { label: '6月', value: '6' }, { label: '7月', value: '7' }, { label: '8月', value: '8' }, { label: '9月', value: '9' }, { label: '10月', value: '10' }, { label: '11月', value: '11' }, { label: '12月', value: '12' }, ] }, onLoad(){ let now_year = (new Date()).Format("yyyy"); let begin_year = 2023; let years = []; for(let i=begin_year;i<=now_year;i++){ years.push({label: i+"年", value: i+""}) } this.setData({ years: years }) }, onShow(){ let now_date = new Date(); let now_datearr = util.getDateArr(now_date); console.log(now_datearr); let year = now_datearr[0]; let month = now_datearr[1]; let mmdateValue = [''+year+'',''+month+'']; this.setData({ dateValue: mmdateValue, dateText: year+"年" }) let date = this.data.dateValue.join("-"); this.getDoctorCenterAccount(date); }, onColumnChange(e) { console.log('picker onColumnChange:', e); }, confirmDialog(){ this.setData({ dialog_visible:false }) }, showDialog(){ this.setData({ dialog_visible:true }) }, onPickerChange(e) { const { key } = e.currentTarget.dataset; const { value } = e.detail; console.log('picker onPickerChange:', e.detail); this.setData({ [`${key}Visible`]: false, [`${key}Value`]: value, [`${key}Text`]: value[0]+"年", }); let date = value.join("-"); this.getDoctorCenterAccount(date); }, onPickerCancel(e) { const { key } = e.currentTarget.dataset; console.log(e, '取消'); console.log('picker1 onPickerCancel:'); this.setData({ [`${key}Visible`]: false, }); }, onSeasonPicker() { this.setData({ dateVisible: true }); }, showPop(){ this.setData({ dateVisible: true }); }, getDoctorCenterAccount(date){ //获取医生我的账户数据 api.getDoctorCenterAccount({date:date}).then(response => { console.log(response); this.setData({ balance_account: response.data.balance_account, amount_total_month: response.data.amount_total_month, doctor_today_inquiry_total:response.data.doctor_today_inquiry_total, doctor_day_completed_amount_total:response.data.doctor_today_inquiry_total, withdrawal_amount_month: response.data.withdrawal_amount_month, bill: response.data.bill, }) }).catch(errors => {console.error(errors);}) }, goTixian(){ app.go('/Pages/yishi/cash/index') }, goDetail(e){ let url = e.currentTarget.dataset.url; let md = e.currentTarget.dataset.md; let date = this.data.dateValue[0]+"-"+md; console.log(date); app.go(url+"?date="+date); }, go(e){ let url = e.currentTarget.dataset.url; app.go(url); }, })