data:{
rows:[],
page:1
}
onLoad(){
this.search()
}
onReachBottom(){
this.search(1)
},
search(more=0){
//more=1的时候是分页
var $this = this
API.post("common/moneylog", {
page:this.page
}).then((res) => {
if (res.code == 1) {
if(res.data.length>0){
$this.page = $this.page+1
}else if($this.page>1){
API.showToast("没有更多了")
}
if(more==1){
var rows=$this.rows
for(var i=0;i<res.data.length;i++){
rows.push(res.data[i])
}
$this.rows=rows
} else {
$this.rows = res.data
}
}
})
},
public function moneylog()
{
$page = $this->request->param('page');
$rows=[];
if ($this->request->isPost()) {
$rows = Moneylog::where(['meiye_user_id'=>$this->user['userid']])->page($page, 10)->order("id desc")->select();
}
$this->success('', $rows);
}