优化
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
import { API } from './../../../utils/network/api'
|
||||
import Toast from 'tdesign-miniprogram/toast/index';
|
||||
let api = new API()
|
||||
const app = getApp()
|
||||
Page({
|
||||
|
||||
data: {
|
||||
navbarData: {
|
||||
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
||||
title: '价格设置', //导航栏 中间的标题
|
||||
},
|
||||
inquiry_type: 1,
|
||||
inquiry_mode: 1,
|
||||
info:{
|
||||
is_open: false,
|
||||
inquiry_price: 0,
|
||||
work_num_day: 0
|
||||
},
|
||||
myprice: "",
|
||||
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,
|
||||
note: response.data.info.is_open == 1? this.data.open_note : this.data.close_note
|
||||
})
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
onStepperChange(event) {
|
||||
console.log(event.detail);
|
||||
this.setData({
|
||||
"info.work_num_day": event.detail
|
||||
});
|
||||
},
|
||||
onPriceChange(e){
|
||||
console.log(e.detail);
|
||||
let price = e.detail.value;
|
||||
this.setData({
|
||||
"info.inquiry_price": price
|
||||
})
|
||||
|
||||
},
|
||||
myToast(message){
|
||||
Toast({
|
||||
context: this,
|
||||
selector: '#t-toast',
|
||||
message: message,
|
||||
theme: 'error',
|
||||
direction: 'column',
|
||||
});
|
||||
},
|
||||
checkPrice(price){
|
||||
let value = Number(price);
|
||||
let min = Number(this.data.config.min_inquiry_price);
|
||||
let max = Number(this.data.config.max_inquiry_price);
|
||||
if(value < min){
|
||||
value = min;
|
||||
let message = '价格不能低于' + min + '元';
|
||||
this.myToast(message);
|
||||
return false;
|
||||
}else if(value >= min && value <=max ){
|
||||
return true;
|
||||
}else{
|
||||
value = max;
|
||||
let message = '价格不能高于' + max + '元';
|
||||
this.myToast(message);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
async updateConfig(){
|
||||
let check = this.checkPrice(this.data.info.inquiry_price);
|
||||
console.log("checkcheckcheck:", check);
|
||||
if(!check){
|
||||
return;
|
||||
}
|
||||
//修改医生问诊配置
|
||||
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;
|
||||
const result = await api.putDoctorInquiryConfig(params).then(response => {
|
||||
console.log(response);
|
||||
this.myToast("修改成功");
|
||||
return true;
|
||||
}).then(res => {
|
||||
setTimeout(() => {
|
||||
wx.navigateBack();
|
||||
|
||||
}, 1000);
|
||||
}).catch(errors => {
|
||||
console.error(errors);
|
||||
return false;
|
||||
})
|
||||
|
||||
console.log("updateConfig result result: ", result);
|
||||
return result;
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"te-nav-bar": "/commpents/te_navbar",
|
||||
"van-stepper": "@vant/weapp/stepper/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"t-toast": "tdesign-miniprogram/toast/toast"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<te-nav-bar navbar-data='{{navbarData}}' ></te-nav-bar>
|
||||
<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 }}" min="1" max="{{config.max_work_num_day}}" integer bind:change="onStepperChange" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="price_steup_box_bottom">
|
||||
<view class="price_steup_box_bottom_title">问诊单价(元)</view>
|
||||
<view class="price_steup_box_bottom_num">
|
||||
<input class="weui-input" bindblur="onPriceChange" type="digit" value="{{ info.inquiry_price }}" placeholder="请输入问诊单价" />
|
||||
<text class="price">元</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="bottom">
|
||||
<text class="bottom_txt">
|
||||
提示:服务开通后,患者可以向您购买图文问诊进行问诊,接诊后需要与患者进行图文沟通
|
||||
1、问诊价格每日仅限调整1次,每自然月仅限调整5次
|
||||
2、单价修改后立即生效,不影响当日已生成的问诊订单
|
||||
3、接诊后,患者可与您在{{config.duration/60}}小时内进行{{config.times_number}}个回合沟通
|
||||
4、如有参加公益问诊活动,患者问诊订单价格以参加的公益问诊单价为准
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="go">
|
||||
<van-button bind:click="updateConfig" color="#3CC7C0" custom-style="border-radius: 20rpx;font-size:30rpx;" type="primary" block>确定</van-button>
|
||||
</view>
|
||||
|
||||
<t-toast id="t-toast" />
|
||||
@@ -0,0 +1,88 @@
|
||||
page{
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
.checked_box{
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.price_title{
|
||||
width: 90vw;
|
||||
margin: 20rpx auto 0 auto;
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 20rpx;
|
||||
/* font-family: "AlibabaPuHuiTi-2-55-Regular"; */
|
||||
color: #333333;
|
||||
}
|
||||
.price_steup_box{
|
||||
display: flex;
|
||||
width: 90vw;
|
||||
height: 180rpx;
|
||||
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;
|
||||
margin: 20rpx 20rpx 20rpx 30rpx;
|
||||
align-items: center;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
.price_steup_box_bottom{
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 0rpx 20rpx 0rpx 30rpx;
|
||||
align-items: center;
|
||||
}
|
||||
.price_steup_box_top_title, .price_steup_box_bottom_title{
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
}
|
||||
.price_steup_box_bottom_num{
|
||||
flex: 1.5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
.weui-input{
|
||||
color: red;
|
||||
display: inline-block;
|
||||
text-align: right;
|
||||
}
|
||||
.price{
|
||||
text-align: center;
|
||||
flex: 1;
|
||||
}
|
||||
Reference in New Issue
Block a user