2023-12-12 10:58:58 +08:00

172 lines
3.2 KiB
JavaScript

// Pages/yishi/medince_list/index.js
import { API } from './../../../utils/network/api'
import debounce from "./../../../utils/debounce"
let api = new API()
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
navbarData: {
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
title: '患者病例', //导航栏 中间的标题
},
page:1,
family_id:'',
currentSick:null,
isLoding:false,
list:[],
isLock:false,
per_page:10,
keyword:'',
},
goDetail:debounce(function(event){
console.log(event)
let id=event.currentTarget.dataset.id;
app.go("/Pages/yishi/case/index?order_inquiry_id="+id);
}),
goDetailbefore:debounce(function(event){
let id=event.currentTarget.dataset.id;
app.go("/Pages/yishi/case/index?pathography_id="+id);
},600),
changeInput:debounce(function(event){
const { value }= event.detail;
this.setData({
isLock:false,
page:1,
list:[],
keyword:value
})
this.handleGetList();
},600),
goSearch(){
this.setData({
isLock:false,
list:[],
page:1
})
this.handleGetList();
},
confirmSearch(event){
const { value }= event.detail;
this.setData({
isLock:false,
list:[],
page:1,
keyword:value
})
this.handleGetList();
},
lower(){
console.log('===触底了!!===');
let {page,isLock}=this.data;
if(!isLock){
page++;
this.setData({
page:page
});
this.handleGetList();
}
},
/**
* 生命周期函数--监听页面加载
*/
handleGetCurrent(){
const {order_inquiry_id}=this.data;
api.getSimpleInquiry({
order_inquiry_id
}).then(data=>{
this.setData({
currentSick:data.data
})
console.log(data);
})
},
handleGetList(){
const {page,per_page,family_id,isLoding}=this.data;
if(isLoding)return false;
this.setData({
isLoding:true
})
api.getPathography({
page,
per_page,
family_id,
}).then(data=>{
this.setData({
isLoding:false
})
let result=data.data.data;
if(result.length==0){
this.setData({
isLock:true
});
return false;
}
this.setData({
list:this.data.list.concat(result)
});
}).catch(errors => {console.error(errors);})
},
onLoad(options) {
this.setData({
family_id:options.family_id,
order_inquiry_id:options.order_inquiry_id
})
this.handleGetCurrent();
this.handleGetList();
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})