2024-04-22 13:35:54 +08:00

79 lines
1.8 KiB
JavaScript

import { API } from '../../../../utils/network/api'
const api = new API()
const app = getApp()
Page({
data: {
active:1,
tabList:[{
id:1,
name:'问诊订单'
},{
id:2,
name:'服务包订单'
}],
navbarData: {
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
title: '收益明细 ', //导航栏 中间的标题
},
height: app.globalData.height,
list: [],
date: "",
current_page: 0,
total: 0,
per_page: 0,
last_page: 0
},
onReachBottom() {
console.log('===触底了!!===');
if(this.data.current_page < this.data.last_page){//最后一页时停止分页
this.getDoctorAccountInfo()
}
},
onLoad(option){
let date = option.date;
console.log(date);
this.setData({
date: date
})
},
onHide(){
this.setData({
list: [],
date: "",
current_page: 0,
total: 0,
per_page: 0,
last_page: 0
})
},
onShow(){
this.getDoctorAccountInfo();
},
switchTab(e){
let {id}=e.currentTarget.dataset;
this.setData({
active:id,
})
},
getDoctorAccountInfo(){
let list = this.data.list
let params = {};
params.page = this.data.current_page + 1;
params.date = this.data.date;
//1:问诊订单 2:药品订单 3:检测订单 4:随访包订单 5:健康包订单)
params.per_page=10;
api.getDoctorAccountInfo(params).then(response => {
console.log(response);
this.setData({
list: list.concat(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);})
}
})