分包医生
This commit is contained in:
@@ -0,0 +1,219 @@
|
||||
import { API } from '../../../../utils/network/api'
|
||||
import Toast from '@vant/weapp/toast/toast';
|
||||
import { requestSubscribeMessage } from '../../../../utils/requestSubscribeUtil';
|
||||
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"
|
||||
]
|
||||
},
|
||||
sub_visible: false,
|
||||
},
|
||||
|
||||
onLoad(){
|
||||
|
||||
},
|
||||
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
|
||||
})
|
||||
},
|
||||
changeON(){
|
||||
let is_open = this.data.info.is_open
|
||||
console.log("changeON:", is_open)
|
||||
let detail = false
|
||||
if(is_open == 0){
|
||||
detail = true
|
||||
}else{
|
||||
detail = false
|
||||
}
|
||||
this.doChange(detail)
|
||||
},
|
||||
onChange({ detail }) {
|
||||
console.log("onChange: ", detail);
|
||||
this.doChange(detail)
|
||||
},
|
||||
doChange(detail){
|
||||
let is_open = 0;
|
||||
if(detail){
|
||||
wx.vibrateShort({
|
||||
"type": "heavy"
|
||||
})
|
||||
is_open = 1;
|
||||
}else{
|
||||
is_open = 0
|
||||
}
|
||||
//修改开关
|
||||
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){
|
||||
let tmplIds = ['G1RIs0RYqsTQ2CuPQWalIMyb6_deuEEbJfajfhGvNzc']
|
||||
let sub_promise = requestSubscribeMessage(tmplIds)
|
||||
sub_promise.then(res => {
|
||||
console.log("订阅成功")
|
||||
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
let errCode = err.errCode
|
||||
if(errCode == 20004){
|
||||
this.setData({
|
||||
sub_visible: true,
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}).then(()=>{
|
||||
if(detail){
|
||||
this.setData({ note: this.data.open_note });
|
||||
}else{
|
||||
this.setData({ note: this.data.close_note });
|
||||
}
|
||||
this.setData({ "info.is_open": is_open });
|
||||
}).catch(errors => {console.error(errors);})
|
||||
|
||||
},
|
||||
subcancelDialog(){
|
||||
this.setData({
|
||||
sub_visible: false
|
||||
})
|
||||
},
|
||||
subconfirmDialog(){
|
||||
this.setData({
|
||||
sub_visible: false
|
||||
})
|
||||
wx.openSetting({
|
||||
success (res) {
|
||||
console.log(res.authSetting)
|
||||
}
|
||||
})
|
||||
},
|
||||
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("修改成功");
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
onStepperChange(event) {
|
||||
console.log(event.detail);
|
||||
this.setData({
|
||||
"info.work_num_day": event.detail
|
||||
});
|
||||
this.putDoctorInquiryConfig()
|
||||
},
|
||||
|
||||
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]
|
||||
});
|
||||
|
||||
this.putDoctorInquiryConfig()
|
||||
},
|
||||
|
||||
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,15 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"te-nav-bar": "../../../../commpents/te_navbar/index",
|
||||
"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-switch": "@vant/weapp/switch/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"van-toast": "@vant/weapp/toast/index",
|
||||
"t-dialog": "tdesign-miniprogram/dialog/dialog"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<te-nav-bar navbar-data='{{navbarData}}' ></te-nav-bar>
|
||||
<view class="container">
|
||||
<view class="switch_box">
|
||||
<view class="switch_box_top">
|
||||
<view class="switch_box_item" bindtap="changeON">
|
||||
<view class="switch_box_item_name">接诊开关</view>
|
||||
<view class="switch_box_item_btn">
|
||||
<van-switch
|
||||
active-color="#3CC7C0"
|
||||
inactive-color="#E7E7E7"
|
||||
size="40rpx"
|
||||
checked="{{ info.is_open==1 }}"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="switch_box_note">{{ note }}</view>
|
||||
</view>
|
||||
<view class="help">
|
||||
<van-cell size="large" url="/user/pages/yishi/manual_detail/index?manual_id=4" custom-style="font-size:32rpx;" title="图文问诊操作手册" is-link border="{{false}}" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="checked_box">
|
||||
<view class="price_title">价格设置</view>
|
||||
<view class="price_steup_box">
|
||||
<van-cell size="large" custom-style="font-size:32rpx;border-radius: 20rpx;"
|
||||
title="每日接诊数量" is-link
|
||||
border="{{true}}"
|
||||
url="/user/pages/yishi/yizhensetupprice/index"
|
||||
>
|
||||
<view class="num">
|
||||
{{ info.work_num_day }}
|
||||
</view>
|
||||
</van-cell>
|
||||
<view class="price_steup_box_bottom">
|
||||
<van-cell size="large" custom-style="font-size:32rpx;border-radius: 20rpx;"
|
||||
title="问诊单价" is-link
|
||||
border="{{false}}"
|
||||
url="/user/pages/yishi/yizhensetupprice/index"
|
||||
>
|
||||
<view>
|
||||
<text class="price">{{ amountText }}</text>
|
||||
<text style="color: #000;"> 元</text>
|
||||
</view>
|
||||
|
||||
</van-cell>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bottom">
|
||||
<text class="bottom_txt">
|
||||
提示:服务开启后,您将参与到平台爱心公益问诊活动中
|
||||
1、从平台统一设定的多种公益问诊价格中选择您的公益问诊价格
|
||||
2、接诊后,患者可与您在<text style="color:#3CC7C0">{{config.duration/60}}小时内进行{{config.times_number}}回合沟通</text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="go">
|
||||
<van-button disabled="{{!info.is_open || info.is_open==0}}" color="#3CC7C0" bind:click="go" data-url="/Pages/yishi/wenzhen_v2/wenzhen" 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" />
|
||||
|
||||
<t-dialog
|
||||
visible="{{ sub_visible }}"
|
||||
title="温馨提示"
|
||||
content="您已关闭订阅消息通知,请点击“确认”按钮在设置中打开订阅通知。"
|
||||
>
|
||||
<view slot="cancel-btn" class="dialog dialog_cancel_btn" bindtap="subcancelDialog">
|
||||
取消
|
||||
</view>
|
||||
<view slot="confirm-btn" class="dialog dialog_confirm_btn" bindtap="subconfirmDialog">
|
||||
确定
|
||||
</view>
|
||||
</t-dialog>
|
||||
</view>
|
||||
@@ -0,0 +1,138 @@
|
||||
page{
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
.container{
|
||||
width: 100vw;
|
||||
}
|
||||
.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: 16px;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
.num{
|
||||
color: #000;
|
||||
}
|
||||
.price{
|
||||
color: red;
|
||||
}
|
||||
.dialog{
|
||||
width: 50%;
|
||||
text-align: center;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
.dialog_cancel_btn{
|
||||
border-top: 1px solid #E9E9E9;
|
||||
border-right: 1px solid #E9E9E9;
|
||||
}
|
||||
.dialog_confirm_btn{
|
||||
border-top: 1px solid #E9E9E9;
|
||||
color: #3CC7C0;
|
||||
}
|
||||
Reference in New Issue
Block a user