优化
This commit is contained in:
@@ -0,0 +1,169 @@
|
||||
import { API } from './../../../utils/network/api'
|
||||
import Toast from '@vant/weapp/toast/toast';
|
||||
let api = new API()
|
||||
const app = getApp()
|
||||
Page({
|
||||
data: {
|
||||
navbarData: {
|
||||
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
||||
title: '设置价格', //导航栏 中间的标题
|
||||
},
|
||||
height: app.globalData.height,
|
||||
checked: true,
|
||||
open_note: "已开启,患者可以向您发起图文问诊",
|
||||
close_note: "已关闭,暂不接收义诊订单",
|
||||
note: "",
|
||||
amountText: "选择金额(元)",
|
||||
amountValue: "",
|
||||
inquiry_type: 3,
|
||||
inquiry_mode: 1,
|
||||
amounts: [],
|
||||
info:{
|
||||
is_open: false,
|
||||
inquiry_price: 0,
|
||||
work_num_day: 0
|
||||
},
|
||||
config:{
|
||||
"max_work_num_day": 30,
|
||||
"min_inquiry_price": 0,
|
||||
"max_inquiry_price": 0,
|
||||
"default_inquiry_price": 0,
|
||||
"times_number": 10,
|
||||
"duration": 1440,
|
||||
"system_inquiry_price": [
|
||||
"0",
|
||||
"5",
|
||||
"10"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
onShow(){
|
||||
let params = {};
|
||||
params.inquiry_type = this.data.inquiry_type;//接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
params.inquiry_mode = this.data.inquiry_mode;//接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
//获取医生我的账户数据
|
||||
api.getDoctorInquiryConfig(params).then(response => {
|
||||
console.log(response);
|
||||
this.setData({
|
||||
info: response.data.info,
|
||||
config: response.data.config,
|
||||
})
|
||||
this.formatAmounts();
|
||||
this.formatAmountValue();
|
||||
}).then(re =>{
|
||||
let is_open = this.data.info.is_open;
|
||||
let note = this.data.note;
|
||||
if(is_open == 1) note = this.data.open_note;
|
||||
if(is_open == 0) note = this.data.close_note;
|
||||
this.setData({
|
||||
note: note
|
||||
})
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
formatAmounts(){
|
||||
let list = this.data.config.system_inquiry_price.map(item => {
|
||||
let it = {};
|
||||
it.label = item+" 元";
|
||||
it.value = item;
|
||||
return it;
|
||||
});
|
||||
this.setData({
|
||||
amounts: list
|
||||
})
|
||||
},
|
||||
formatAmountValue(){
|
||||
let val = Math.trunc(this.data.info.inquiry_price);
|
||||
let valarr = [''+val+'']
|
||||
this.setData({
|
||||
amountValue: valarr,
|
||||
amountText: val+" 元"
|
||||
})
|
||||
},
|
||||
onChange({ detail }) {
|
||||
console.log("onChange: ", detail);
|
||||
if(detail){
|
||||
this.setData({ note: this.data.open_note });
|
||||
}else{
|
||||
this.setData({ note: this.data.close_note });
|
||||
}
|
||||
this.setData({ "info.is_open": detail });
|
||||
|
||||
//修改开关
|
||||
let params = {};
|
||||
params.inquiry_type = this.data.inquiry_type;//接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
params.inquiry_mode = this.data.inquiry_mode;//接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
params.is_open = detail?1:0;
|
||||
api.putDoctorInquiryOpen(params).then(response => {
|
||||
console.log(response);
|
||||
}).then(()=>{
|
||||
if(detail){
|
||||
wx.requestSubscribeMessage({
|
||||
tmplIds: ['G1RIs0RYqsTQ2CuPQWalIGVet9sd_d371YtDVhfBsFg'],
|
||||
success (res) {
|
||||
console.log(res);//同意授权
|
||||
}
|
||||
})
|
||||
}
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
|
||||
putDoctorInquiryConfig(){
|
||||
//修改医生问诊配置
|
||||
let params = {};
|
||||
params.inquiry_type = this.data.inquiry_type;//接诊类型(1:专家问诊 2:快速问诊 3:公益问诊 4:问诊购药)
|
||||
params.inquiry_mode = this.data.inquiry_mode;//接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
|
||||
params.inquiry_price = this.data.info.inquiry_price;
|
||||
params.work_num_day = this.data.info.work_num_day;
|
||||
api.putDoctorInquiryConfig(params).then(response => {
|
||||
console.log(response);
|
||||
Toast.success("修改成功");
|
||||
setTimeout(() => {
|
||||
wx.navigateBack();
|
||||
}, 1000);
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
onStepperChange(event) {
|
||||
console.log(event.detail);
|
||||
this.setData({
|
||||
"info.work_num_day": event.detail
|
||||
});
|
||||
},
|
||||
|
||||
onAmountPicker() {
|
||||
this.setData({ amountVisible: true });
|
||||
},
|
||||
|
||||
onColumnChange(e) {
|
||||
console.log('picker pick:', e);
|
||||
},
|
||||
|
||||
onPickerChange(e) {
|
||||
console.log(e);
|
||||
const { key } = e.currentTarget.dataset;
|
||||
const { value } = e.detail;
|
||||
console.log('picker change:', e.detail);
|
||||
this.setData({
|
||||
[`${key}Visible`]: false,
|
||||
[`${key}Value`]: value,
|
||||
[`${key}Text`]: value+' 元',
|
||||
"info.inquiry_price": value[0]
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
onPickerCancel(e) {
|
||||
const { key } = e.currentTarget.dataset;
|
||||
console.log(e, '取消');
|
||||
console.log('picker1 cancel:');
|
||||
this.setData({
|
||||
[`${key}Visible`]: false,
|
||||
});
|
||||
},
|
||||
go(e){
|
||||
let url = e.currentTarget.dataset.url;
|
||||
wx.switchTab({
|
||||
url: url
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"te-nav-bar": "/commpents/te_navbar",
|
||||
"t-picker": "tdesign-miniprogram/picker/picker",
|
||||
"t-picker-item": "tdesign-miniprogram/picker-item/picker-item",
|
||||
"van-cell": "@vant/weapp/cell/index",
|
||||
"van-cell-group": "@vant/weapp/cell-group/index",
|
||||
"van-stepper": "@vant/weapp/stepper/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-toast": "@vant/weapp/toast/index"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<te-nav-bar navbar-data='{{navbarData}}' ></te-nav-bar>
|
||||
<view class="container">
|
||||
<view class="checked_box">
|
||||
<view class="price_steup_box">
|
||||
<view class="price_steup_box_top">
|
||||
<view class="price_steup_box_top_title">每日接诊数量</view>
|
||||
<view class="price_steup_box_top_stepper">
|
||||
<van-stepper value="{{ info.work_num_day }}" max="{{config.max_work_num_day}}" integer bind:change="onStepperChange" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="price_steup_box_bottom">
|
||||
<van-cell size="large" custom-style="font-size:32rpx;border-radius: 20rpx;"
|
||||
title="问诊单价(元)" is-link
|
||||
border="{{false}}"
|
||||
value="{{ amountText }}"
|
||||
bindtap="onAmountPicker"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bottom">
|
||||
<text class="bottom_txt">
|
||||
提示:服务开通后,患者可以通过公益问诊找到您,增加您的接诊量。
|
||||
1、公益问诊价格为平台统一设定的几个,需要您自己选择单价;
|
||||
2、接诊后{{config.duration/60}}小时内和患者{{config.times_number}}个回合沟通。
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="go">
|
||||
<van-button color="#3CC7C0" bind:click="putDoctorInquiryConfig" custom-style="border-radius: 20rpx;font-size:30rpx;" type="primary" block>确定</van-button>
|
||||
</view>
|
||||
|
||||
<t-picker
|
||||
visible="{{amountVisible}}"
|
||||
value="{{amountValue}}"
|
||||
data-key="amount"
|
||||
title="选择金额"
|
||||
cancelBtn="取消"
|
||||
confirmBtn="确认"
|
||||
bindchange="onPickerChange"
|
||||
bindpick="onColumnChange"
|
||||
bindcancel="onPickerCancel"
|
||||
>
|
||||
<t-picker-item options="{{amounts}}"></t-picker-item>
|
||||
</t-picker>
|
||||
|
||||
<van-toast id="van-toast" />
|
||||
</view>
|
||||
@@ -0,0 +1,123 @@
|
||||
page{
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
.container{
|
||||
width: 100vw;
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
.switch_box{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 90vw;
|
||||
/* height: 500rpx; */
|
||||
border-radius: 20rpx;
|
||||
margin: 30rpx auto;
|
||||
background-color: rgb(255, 255, 255);
|
||||
}
|
||||
.switch_box_top{
|
||||
position: relative;
|
||||
display: flex;
|
||||
/* height: 300rpx; */
|
||||
flex-direction: column;
|
||||
padding: 30rpx 30rpx 20rpx 30rpx;
|
||||
}
|
||||
.switch_box_top::after{
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
content: ' ';
|
||||
pointer-events: none;
|
||||
right: 0;
|
||||
left: 32rpx;
|
||||
bottom: 0;
|
||||
border-bottom: 1px solid var(--td-cell-border-color, var(--td-gray-color-3, #e7e7e7));
|
||||
transform: scaleY(0.5);
|
||||
}
|
||||
.switch_box_item{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.switch_box_item_name{
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.switch_box_item_btn{
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
}
|
||||
.switch_box_note{
|
||||
color: #999999;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.help{
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.price_title{
|
||||
width: 90vw;
|
||||
margin: 0 auto;
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 20rpx;
|
||||
/* font-family: "AlibabaPuHuiTi-2-55-Regular"; */
|
||||
color: #333333;
|
||||
}
|
||||
.price_steup_box{
|
||||
display: flex;
|
||||
width: 90vw;
|
||||
margin: 0 auto;
|
||||
border-radius: 20rpx;
|
||||
flex-direction: column;
|
||||
background-color: rgb(255, 255, 255);
|
||||
}
|
||||
.price_steup_box_top{
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: var(--cell-vertical-padding,20rpx) var(--cell-horizontal-padding,32rpx);
|
||||
}
|
||||
|
||||
.price_steup_box_top_title, .price_steup_box_bottom_title{
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
}
|
||||
.price_steup_box_top::after{
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
content: ' ';
|
||||
pointer-events: none;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
border-bottom: 1px solid var(--td-cell-border-color, var(--td-gray-color-3, #e7e7e7));
|
||||
transform: scaleY(0.5);
|
||||
}
|
||||
.price_steup_box_top_stepper{
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
align-items: center;
|
||||
}
|
||||
.bottom{
|
||||
width: 90vw;
|
||||
margin: -20rpx auto;
|
||||
color: #999;
|
||||
letter-spacing: 2rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
|
||||
.go{
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: 100rpx;
|
||||
width: 90vw;
|
||||
}
|
||||
|
||||
.t-picker__confirm,.t-class-confirm{
|
||||
color: #49B9AD !important;
|
||||
}
|
||||
.van-cell__value{
|
||||
font-size: 32rpx !important;
|
||||
color: red !important;
|
||||
}
|
||||
Reference in New Issue
Block a user