108 lines
2.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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,
stickyProps: {
offsetTop: app.globalData.height*2 + 20,
zIndex: 99
},
prescription_status: 0,
chufang_list_0: [],
chufang_list_1: [],
chufang_list_2: [],
current_page: 0,
total: 0,
per_page: 0,
last_page: 0,
},
onShow(){
this.getList();
},
onTabsChange(e) {
// console.log(e);
let list_name = "chufang_list_" + e.detail.value;
//console.log(list_name)
this.setData({
prescription_status: e.detail.value,
current_page: 0,
last_page: 0,
[list_name]: []
})
this.getList()
},
onTabsClick(event) {
console.log(`Click tab, tab-panel value is ${event.detail.value}.`);
},
onStickyScroll(event) {
// console.log(event.detail);
},
onPullDownRefresh(){
console.log('===下拉动作===');
this.setData({
current_page: 0,
})
this.getList();
},
onReachBottom() {
console.log('===触底了!!===');
if(this.data.current_page < this.data.last_page){//最后一页时停止分页
this.getList()
}
},
getList(){
//获取处方列表
let params = {};
params.pharmacist_audit_status = this.data.prescription_status;//处方审核状态0:审核中 2:审核驳回)
params.page = this.data.current_page + 1;
api.getDoctorPrescription(params).then(response => {
//console.log(response);
if(response.data.total > 0){
let list_name = "chufang_list_" + this.data.prescription_status;
//console.log(list_name);
let apprise_list = this.data[list_name];
this.setData({
[list_name]: apprise_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);})
},
go(e){
let url = e.currentTarget.dataset.url;
//console.log(url);
app.go(url);
},
handlegetLastInquiry(patient_id,doctor_id,order_inquiry_id){
api.getLastInquiry({
patient_id:patient_id,
doctor_id:doctor_id
}).then(data=>{
let result=data.data;
let url='';
if(result){
url = "/Pages/yishi/chat/index?order_inquiry_id="+result+"&from=prescription";
}else{
url = "/Pages/yishi/chat/index?order_inquiry_id="+order_inquiry_id+"&from=prescription";
}
app.go(url);
})
},
gochat(e){
let {order_inquiry_id,patient_id,doctor_id} = e.currentTarget.dataset;
this.handlegetLastInquiry(patient_id,doctor_id,order_inquiry_id);
}
})