优化
This commit is contained in:
@@ -9,22 +9,70 @@ Page({
|
||||
title: '问诊订单', //导航栏 中间的标题
|
||||
},
|
||||
height: app.globalData.height,
|
||||
result: ['a'],
|
||||
page: 1,
|
||||
result: [],
|
||||
order_list:[],
|
||||
current_page: 0,
|
||||
total: 0,
|
||||
per_page: 10,
|
||||
order_list: [],
|
||||
total: 0
|
||||
last_page: 0,
|
||||
allchecked: false,
|
||||
select_order_length: 0,
|
||||
select_order_amount: 0,
|
||||
select_order_inquiry_id: []
|
||||
},
|
||||
|
||||
onChange(event) {
|
||||
console.log("onChange: ",event)
|
||||
this.setData({
|
||||
result: event.detail,
|
||||
});
|
||||
this.resetSelectOrder();
|
||||
this.setData({
|
||||
allchecked: this.data.result.length == this.data.order_list.length
|
||||
})
|
||||
},
|
||||
onLoad(){
|
||||
onAllChange(event) {
|
||||
console.log("onAllChange: ",event)
|
||||
this.setData({
|
||||
allchecked: event.detail
|
||||
})
|
||||
if(event.detail == true){
|
||||
this.data.order_list.forEach((item,index) => {
|
||||
this.data.result.push(""+index);
|
||||
})
|
||||
this.setData({
|
||||
result: this.data.result
|
||||
})
|
||||
}
|
||||
if(event.detail == false){
|
||||
this.setData({
|
||||
result: []
|
||||
})
|
||||
}
|
||||
this.resetSelectOrder();
|
||||
},
|
||||
resetSelectOrder(e){
|
||||
let result = this.data.result;
|
||||
let select_order_amount = 0;
|
||||
let select_order_inquiry_id = [];
|
||||
result.forEach(item => {
|
||||
select_order_amount = Number(select_order_amount) + Number(this.data.order_list[item].payment_amount_total);
|
||||
select_order_inquiry_id.push(this.data.order_list[item].order_inquiry_id);
|
||||
})
|
||||
this.setData({
|
||||
select_order_length: result.length,
|
||||
select_order_amount: select_order_amount,
|
||||
select_order_inquiry_id: select_order_inquiry_id
|
||||
})
|
||||
},
|
||||
selectOrder(e){
|
||||
const { index } = e.currentTarget.dataset;
|
||||
const checkbox = this.selectComponent(`.checkboxes-${index}`);
|
||||
checkbox.toggle();
|
||||
},
|
||||
getDoctorWithdrawalOrder(){
|
||||
//可提现问诊订单列表
|
||||
let params = {};
|
||||
params.page = this.data.page;
|
||||
params.page = this.data.current_page + 1;
|
||||
params.per_page = this.data.per_page;
|
||||
api.getDoctorWithdrawalOrder(params).then(response => {
|
||||
console.log(response);
|
||||
@@ -37,6 +85,27 @@ Page({
|
||||
})
|
||||
}
|
||||
}).catch(errors => {console.error(errors);})
|
||||
|
||||
},
|
||||
onShow(){
|
||||
this.getDoctorWithdrawalOrder();
|
||||
this.resetSelectOrder();
|
||||
},
|
||||
onReachBottom() {
|
||||
console.log('===触底了!!===');
|
||||
if(this.data.current_page < this.data.last_page){//最后一页时停止分页
|
||||
this.getDoctorWithdrawalOrder()
|
||||
}
|
||||
},
|
||||
confirmOrder(){
|
||||
const select_order_inquiry_id = this.data.select_order_inquiry_id;
|
||||
console.log(select_order_inquiry_id);
|
||||
wx.showToast({
|
||||
title: '缺少接口',
|
||||
icon: "error",
|
||||
duration: 1500
|
||||
})
|
||||
setTimeout(() => {
|
||||
wx.navigateBack();
|
||||
}, 2000);
|
||||
}
|
||||
})
|
||||
@@ -6,5 +6,6 @@
|
||||
"van-checkbox-group": "@vant/weapp/checkbox-group/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-empty": "@vant/weapp/empty/index"
|
||||
}
|
||||
},
|
||||
"onReachBottomDistance": 100
|
||||
}
|
||||
@@ -1,35 +1,18 @@
|
||||
<!-- 问诊订单 -->
|
||||
<te-nav-bar navbar-data='{{navbarData}}' ></te-nav-bar>
|
||||
<view class="container" style="height: calc(100vh - 96rpx - {{height}}px);">
|
||||
<view class="container">
|
||||
<van-checkbox-group value="{{ result }}" bind:change="onChange">
|
||||
<view class="order_list">
|
||||
<!-- <view class="order_item">
|
||||
<view class="order_item" wx:for="{{order_list}}">
|
||||
<view class="order_item_checkbox">
|
||||
<van-checkbox name="a"></van-checkbox>
|
||||
<van-checkbox name="{{index}}" class="checkboxes-{{index}}" checked-color="#3CC7C0"></van-checkbox>
|
||||
</view>
|
||||
<view class="order_item_content">
|
||||
<view class="order_item_content_top">快速问诊</view>
|
||||
<view class="order_item_content_data">
|
||||
<view class="order_id">订单编号:<text style="font-size: 30rpx;color: #666666;">2131231xxxx</text></view>
|
||||
<view class="order_id">就诊患者:<text style="font-size: 30rpx;color: #666666;">张三三(女,25岁)</text></view>
|
||||
<view class="order_id">接诊时间:<text style="font-size: 30rpx;color: #666666;">2022-12-30 11:23:23</text></view>
|
||||
<view class="order_id">结束时间:<text style="font-size: 30rpx;color: #666666;">2022-12-12 11:23:23</text></view>
|
||||
<view class="order_id">订单金额:<text style="font-size: 30rpx;color: #666666;">¥1212.00元</text></view>
|
||||
<view class="order_id">预计收入:<text style="font-size: 30rpx;color: #666666;">¥112.00元</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="order_item" wx:for="{{order_list}}" wx:for-index="idx">
|
||||
<view class="order_item_checkbox">
|
||||
<van-checkbox name="a{{idx}}"></van-checkbox>
|
||||
</view>
|
||||
<view class="order_item_content">
|
||||
<view class="order_item_content" data-index="{{index}}" bindtap="selectOrder">
|
||||
<!-- (1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药) -->
|
||||
<view class="order_item_content_top">{{item.inquiry_type}}</view>
|
||||
<view class="order_item_content_top">{{item.inquiry_type==1?'专家问诊':item.inquiry_type==2?'快速问诊':item.inquiry_type==3?'公益问诊':item.inquiry_type==4?'问诊购药':'未知'}}</view>
|
||||
<view class="order_item_content_data">
|
||||
<view class="order_id">订单编号:<text style="font-size: 30rpx;color: #666666;">{{item.inquiry_no }}</text></view>
|
||||
<view class="order_id">就诊患者:<text style="font-size: 30rpx;color: #666666;">{{item.patient_name}}({{item.patient_sex}},{{item.patient_age}}岁)</text></view>
|
||||
<view class="order_id">订单编号:<text style="font-size: 30rpx;color: #666666;">{{item.order_inquiry_id }}</text></view>
|
||||
<view class="order_id">就诊患者:<text style="font-size: 30rpx;color: #666666;">{{item.patient_name}}({{item.patient_sex==1?'男':'女'}},{{item.patient_age}}岁)</text></view>
|
||||
<view class="order_id">接诊时间:<text style="font-size: 30rpx;color: #666666;">{{item.reception_time}}</text></view>
|
||||
<view class="order_id">结束时间:<text style="font-size: 30rpx;color: #666666;">{{item.finish_time}}</text></view>
|
||||
<view class="order_id">订单金额:<text style="font-size: 30rpx;color: #666666;">¥{{item.amount_total}}元</text></view>
|
||||
@@ -37,19 +20,21 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<van-empty description="暂无数据" wx:if="{{order_list.length == 0}}" />
|
||||
|
||||
</view>
|
||||
</van-checkbox-group>
|
||||
<van-empty description="暂无数据" wx:if="{{order_list.length == 0}}" />
|
||||
|
||||
<view class="bottom">
|
||||
<view class="bottom_checkbox">
|
||||
<van-checkbox value="{{ checked }}" bind:change="onChange">全选</van-checkbox>
|
||||
<van-checkbox value="{{ allchecked }}" checked-color="#3CC7C0" bind:change="onAllChange">全{{allchecked?'不':''}}选</van-checkbox>
|
||||
</view>
|
||||
<view class="bottom_content">共10个订单,金额: <text style="color: red;font-size: 30rpx;">¥302元 </text> </view>
|
||||
<view class="bottom_content">共{{select_order_length}}个订单,金额: <text style="color: red;font-size: 30rpx;">¥{{select_order_amount}}元 </text> </view>
|
||||
<view class="bottom_btn">
|
||||
<van-button block color="linear-gradient(310deg, #FF931A 0%, #FF931A 0%, #FCB75D 100%);">
|
||||
<van-button
|
||||
bind:click="confirmOrder"
|
||||
disabled="{{result.length == 0}}"
|
||||
block
|
||||
color="{{result.length == 0?'#999':'linear-gradient(310deg, #FF931A 0%, #FF931A 0%, #FCB75D 100%)'}};">
|
||||
确定
|
||||
</van-button>
|
||||
</view>
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
.container{
|
||||
page{
|
||||
background-color: #F4F4F4;
|
||||
}
|
||||
.container{
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
.order_list{
|
||||
display: flex;
|
||||
width: 92vw;
|
||||
margin: 0 auto;
|
||||
flex-direction: column;
|
||||
padding-bottom: 180rpx;
|
||||
}
|
||||
.order_item{
|
||||
display: flex;
|
||||
@@ -50,16 +52,18 @@
|
||||
bottom: 0;
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
background-color: #fff;
|
||||
background-color: rgb(255, 255, 255);
|
||||
align-items: center;
|
||||
z-index: 99;
|
||||
padding-bottom: 50rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
.bottom_checkbox{
|
||||
flex: 2;
|
||||
flex: 2.2;
|
||||
font-size: 30rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
justify-content: left;
|
||||
padding-left: 4vw;
|
||||
}
|
||||
.bottom_content{
|
||||
flex: 6;
|
||||
@@ -71,7 +75,6 @@
|
||||
flex: 2;
|
||||
justify-content: flex-end;
|
||||
font-size: 34rpx;
|
||||
background-color: limegreen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user