2023-03-06 17:57:39 +08:00

103 lines
2.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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: "",
inquiry_type: 2,
inquiry_mode: 1,
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"
]
}
},
onLoad(){
this.setData({ note: this.data.open_note });
},
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,
})
}).catch(errors => {console.error(errors);})
},
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);
}).catch(errors => {console.error(errors);})
},
putDoctorInquiryConfig(){
wx.switchTab({
url: "/Pages/yishi/wenzhen/wenzhen"
})
},
onStepperChange(event) {
console.log(event.detail);
this.setData({
"info.work_num_day": event.detail
});
},
onPriceChange(e){
console.log(e.detail);
let value = e.detail.value;
let min = this.data.config.min_inquiry_price;
let max = this.data.config.max_inquiry_price;
if(value < min){
value = min;
Toast.fail('价格不能低于' + min + '元');
}else if(value >= min && value <=max ){
value = value;
}else{
value = max;
Toast.fail('价格不能高于' + max + '元');
}
this.setData({
"info.inquiry_price": value
})
}
})