优化
This commit is contained in:
+50
-14
@@ -20,21 +20,27 @@ Page({
|
||||
data_list_1: [],
|
||||
data_list_2: [],
|
||||
data_list_3: [],
|
||||
current_page: 0,
|
||||
total: 0,
|
||||
per_page: 0,
|
||||
last_page: 0,
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
console.log(this.data.height)
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
onShow() {
|
||||
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
|
||||
this.getTabBar().setData({
|
||||
active: 0, //数字是当前页面在tabbar的索引,如我的查询页索引是2,因此这边为2,同理首页就为0,审批页面为1
|
||||
})
|
||||
}
|
||||
|
||||
this.getPharmacistPrescription(this.data.active);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onLoad: function () {
|
||||
|
||||
api.getPharmacistIndex().then(response => {
|
||||
this.setData({
|
||||
pharmacist: response.data.pharmacist,
|
||||
@@ -44,11 +50,11 @@ Page({
|
||||
console.error(errors);
|
||||
})
|
||||
|
||||
this.getPharmacistPrescription();
|
||||
|
||||
},
|
||||
getPharmacistPrescription(){
|
||||
getPharmacistPrescription(active){
|
||||
let params = {};
|
||||
let active = this.data.active;
|
||||
let page = this.data.current_page + 1;
|
||||
let pharmacist_audit_status = 0;
|
||||
let platform_audit_status = 1;
|
||||
|
||||
@@ -70,21 +76,51 @@ Page({
|
||||
}
|
||||
params.pharmacist_audit_status = pharmacist_audit_status;
|
||||
params.platform_audit_status = platform_audit_status;
|
||||
params.page = page;
|
||||
let data_name = "data_list_"+active;
|
||||
let list = this.data[data_name];
|
||||
api.getPharmacistPrescription(params).then(response => {
|
||||
this.setData({
|
||||
[data_name]: response.data.data
|
||||
[data_name]: 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);
|
||||
})
|
||||
},
|
||||
onHide(){
|
||||
this.setData({
|
||||
current_page: 0,
|
||||
total: 0,
|
||||
per_page: 0,
|
||||
last_page: 0,
|
||||
data_list_0: [],
|
||||
data_list_1: [],
|
||||
data_list_2: [],
|
||||
data_list_3: [],
|
||||
})
|
||||
},
|
||||
onChange(e){
|
||||
console.log(e)
|
||||
let data_name = "data_list_"+e.detail.index;
|
||||
this.setData({
|
||||
active: e.detail.index
|
||||
active: e.detail.index,
|
||||
current_page: 0,
|
||||
total: 0,
|
||||
per_page: 0,
|
||||
last_page: 0,
|
||||
[data_name]: []
|
||||
})
|
||||
this.getPharmacistPrescription();
|
||||
this.getPharmacistPrescription(e.detail.index);
|
||||
},
|
||||
onReachBottom() {
|
||||
console.log('===触底了!!===');
|
||||
if(this.data.current_page < this.data.last_page){//最后一页时停止分页
|
||||
this.getPharmacistPrescription(this.data.active)
|
||||
}
|
||||
},
|
||||
go(e){
|
||||
let url = e.currentTarget.dataset.url;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"van-tabs": "@vant/weapp/tabs/index",
|
||||
"t-avatar": "tdesign-miniprogram/avatar/avatar",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-empty": "@vant/weapp/empty/index"
|
||||
"van-empty": "@vant/weapp/empty/index",
|
||||
"van-divider": "@vant/weapp/divider/index"
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="main content">
|
||||
<van-tabs active="{{ active }}" color="{{ active_color }}" bind:change="onChange">
|
||||
<van-tabs color="{{ active_color }}" bind:change="onChange">
|
||||
<van-tab title="待审核处方">
|
||||
<view class="item_list" wx:if="{{data_list_0.length>0}}">
|
||||
<view class="item" wx:for="{{data_list_0}}">
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<view class="item_txt">
|
||||
<view class="pre_content">开方时间:{{item.created_at}}</view>
|
||||
<view class="end_content" bindtap="go" data-url="/Pages/yaoshi/medicalrecord/medicalrecord?order_inquiry_id={{item.order_inquiry_id }}&order_prescription_id={{item.order_prescription_id}}">
|
||||
<view class="end_content" bindtap="go" data-url="/Pages/yaoshi/medicalrecord/medicalrecord?order_inquiry_id={{item.order_inquiry_id }}&order_prescription_id={{item.order_prescription_id}}&from=1">
|
||||
<van-button type="primary" color="#ec871e" size="small">查看病例</van-button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -40,6 +40,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-divider contentPosition="center" wx:if="{{data_list_0.length > 0 && current_page == last_page}}">到底了~</van-divider>
|
||||
</view>
|
||||
<van-empty description="暂无数据" wx:if="{{data_list_0.length == 0}}" />
|
||||
</van-tab>
|
||||
@@ -65,6 +66,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-divider contentPosition="center" wx:if="{{data_list_1.length > 0 && current_page == last_page}}">到底了~</van-divider>
|
||||
</view>
|
||||
<van-empty description="暂无数据" wx:if="{{data_list_1.length == 0}}" />
|
||||
</van-tab>
|
||||
@@ -89,7 +91,14 @@
|
||||
<!-- <van-button type="primary" color="linear-gradient(to bottom, #5EA8D5, #63CFEA)" size="small">去审方</van-button> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="item_txt">
|
||||
<view class="pre_content">驳回时间:{{item.pharmacist_verify_time}}</view>
|
||||
</view>
|
||||
<view class="item_txt">
|
||||
<view class="pre_content">驳回理由:{{item.pharmacist_fail_reason}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-divider contentPosition="center" wx:if="{{data_list_2.length > 0 && current_page == last_page}}">到底了~</van-divider>
|
||||
</view>
|
||||
<van-empty description="暂无数据" wx:if="{{data_list_2.length == 0}}" />
|
||||
</van-tab>
|
||||
@@ -115,6 +124,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<van-divider contentPosition="center" wx:if="{{data_list_3.length > 0 && current_page == last_page}}">到底了~</van-divider>
|
||||
</view>
|
||||
<van-empty description="暂无数据" wx:if="{{data_list_3.length == 0}}" />
|
||||
</van-tab>
|
||||
|
||||
Reference in New Issue
Block a user