108 lines
2.7 KiB
JavaScript
108 lines
2.7 KiB
JavaScript
import { API } from './../../../utils/network/api'
|
||
const api = new API()
|
||
const app = getApp()
|
||
Page({
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
active: 0,
|
||
active_color: "rgb(116,162,250)",
|
||
navbarData: {
|
||
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
||
title: '药师端', //导航栏 中间的标题
|
||
},
|
||
// 此页面 页面内容距最顶部的距离
|
||
height: app.globalData.height,
|
||
pharmacist: {},
|
||
audit_number: 0,
|
||
data_list_0: [],
|
||
data_list_1: [],
|
||
data_list_2: [],
|
||
data_list_3: [],
|
||
},
|
||
|
||
onLoad() {
|
||
console.log(this.data.height)
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面显示
|
||
*/
|
||
onShow: function () {
|
||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||
this.getTabBar().setData({
|
||
active: 0, //数字是当前页面在tabbar的索引,如我的查询页索引是2,因此这边为2,同理首页就为0,审批页面为1
|
||
})
|
||
}
|
||
api.getPharmacistIndex().then(response => {
|
||
this.setData({
|
||
pharmacist: response.data.pharmacist,
|
||
audit_number: response.data.audit_number
|
||
})
|
||
}).catch(errors => {
|
||
console.error(errors);
|
||
})
|
||
|
||
this.getPharmacistPrescription();
|
||
},
|
||
getPharmacistPrescription(){
|
||
let params = {};
|
||
let active = this.data.active;
|
||
let pharmacist_audit_status = 0;
|
||
let platform_audit_status = 1;
|
||
|
||
if(active == 0){
|
||
pharmacist_audit_status = 0;
|
||
platform_audit_status = 0;
|
||
}
|
||
if(active == 1){
|
||
pharmacist_audit_status = 1;
|
||
platform_audit_status = 1;
|
||
}
|
||
if(active == 2){
|
||
pharmacist_audit_status = 2;
|
||
platform_audit_status = 0;
|
||
}
|
||
if(active == 3){
|
||
pharmacist_audit_status = 1;
|
||
platform_audit_status = 2;
|
||
}
|
||
params.pharmacist_audit_status = pharmacist_audit_status;
|
||
params.platform_audit_status = platform_audit_status;
|
||
let data_name = "data_list_"+active;
|
||
api.getPharmacistPrescription(params).then(response => {
|
||
this.setData({
|
||
[data_name]: response.data.data
|
||
})
|
||
}).catch(errors => {
|
||
console.error(errors);
|
||
})
|
||
},
|
||
onChange(e){
|
||
console.log(e)
|
||
this.setData({
|
||
active: e.detail.index
|
||
})
|
||
this.getPharmacistPrescription();
|
||
},
|
||
go(e){
|
||
let url = e.currentTarget.dataset.url;
|
||
app.go(url)
|
||
},
|
||
switchStatus(){
|
||
let is_online = this.data.pharmacist.is_online;
|
||
if(is_online == 0){
|
||
is_online = 1
|
||
}else if(is_online == 1){
|
||
is_online = 0
|
||
}
|
||
api.putPharmacistOnOff({is_online: is_online}).then(response => {
|
||
this.setData({
|
||
"pharmacist.is_online": is_online
|
||
})
|
||
}).catch(errors => {console.error(errors);})
|
||
}
|
||
|
||
|
||
}) |