zoujiandong 5eff9ea26b 3.23
2024-03-23 16:46:52 +08:00

484 lines
13 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 'tdesign-miniprogram/toast/index';
let api = new API()
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
navbarData: {
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
title: '服务设置', //导航栏 中间的标题
},
inquiry_type:1,
inquiry_mode:6,
show:false,
content_message:'',
process_message:'',
showCycle:false,
customRounds:null,
columnsRound:false,
showProcess:false,
showCustom:false,
showSave:false,
showDraft:false,
showPreview:false,
contentradio:'',
processradio:'',
columnsCycle:[],
columnsRound:[50,100,200,'不限次','自定义'],
autosize:{minHeight: 80},
cycle:'',
config_service_id:'',
rounds:null,
static_host: api.getStaticHost()
},
onChangeContent(event){
this.setData({
contentradio: event.detail,
});
},
onChangeProcess(event){
this.setData({
processradio: event.detail,
});
},
openDialog(e){
let {id}=e.currentTarget.dataset;
if(id==1){
this.setData({
show:true,
})
}else{
this.setData({
showProcess:true,
})
}
},
goBack(){
let {cycle,rounds,content_message,process_message,config_service_id}=this.data;
if((cycle || rounds || content_message || process_message || rounds==0) && !config_service_id){
this.setData({
showSave:true
})
}else{
wx.navigateBack()
}
},
onClickHide(){
this.setData({
show:false
});
if(this.data.contentradio==1){
this.setData({
content_message:'1、服务包含肝脏病理切片解读需患者邮寄肝脏切片\n'+
'2、针对病例切片多学科会诊包含临床、影像、肝脏病理等学科\n'+
'3、给出分析报告与治疗方案\n'+
'4、服务周期大概7~15天期间可以不限次医生自己定义沟通病情。'
})
}else{
this.setData({
content_message:'1、概述服务所包含内容,如报告解读(可包含超声报告、CT报告、肝脏病理报告及其他常规报告)或者病情解析;\n2、详细描述服务所包含的具体服务或者形\n3、请给出服务周期\n4、描述该项所提供服务的特点。'
})
}
},
closeCustom(){
console.log(this.data.customRounds);
if(!this.data.customRounds && this.data.customRounds!==0){
wx.showToast({
title: '请输入回合数',
icon:'none'
})
return false
};
if(!(this.data.customRounds>=1 && this.data.customRounds<=300) ){
wx.showToast({
title: '回合数需要在1~300之间',
icon:'none'
})
return false
}
this.setData({
showCustom:false,
rounds:this.data.customRounds
})
},
openPreview(){
let {process_message,content_message,cycle,rounds}=this.data;
if(content_message.length<10){
wx.showToast({
title: '服务内容不少于10个字符',
icon:'none'
})
return false
};
if(process_message.length<10){
wx.showToast({
title: '服务流程不少于10个字符',
icon:'none'
})
return false
};
if(!cycle){
wx.showToast({
title: '请设置服务周期',
icon:'none'
})
return false
}
if(!rounds && rounds!=0){
wx.showToast({
title: '请设置服务回合数',
icon:'none'
})
return false
}
wx.setStorageSync('config_message', {
content_message,
process_message,
rounds,
cycle
})
this.setData({
showPreview:true
})
},
changeCustomIpt(event){
let {value}= event.detail;
console.log(value);
this.setData({
customRounds:value
})
},
onClickHideshowProcess(){
this.setData({
showProcess:false
})
if(this.data.processradio==1){
this.setData({
process_message:'1、医生与患者线上沟通确定肝脏病理切片解读事项\n'+
'2、患者按要求线下邮寄切片并线上提醒医生已寄出\n'+
'3、医生线下收到切片后阅片解读或组织多学科会诊\n'+
'4、医生线上给出分析报告和治疗方案。'
})
}else{
this.setData({
process_message:'1、针对本项目服务医生与患者各自需要所作事情\n'+
'2、所做事情用1、2、3点按照时间顺序进行详细描述。'
})
}
},
openCycle(){
this.setData({
showCycle:true
})
},
onCancelCycle(){
this.setData({
showCycle:false
})
},
onConfirmCycle(event){
const { value} = event.detail;
this.setData({
showCycle:false ,
cycle: value
});
},
openRound(){
this.setData({
showRound:true
})
},
onCancelRound(){
this.setData({
showRound:false
})
},
onConfirmRound(event){
const { value} = event.detail;
if(value=='自定义'){
this.setData({
showCustom:true,
showRound:false
})
}else{
this.setData({
showRound:false,
rounds:value
})
}
},
savecancelDialog(){
this.setData({
showSave:false
})
},
// getConfig(){
// let {inquiry_type,inquiry_mode}=this.data;
// api.getServiceConfig({
// inquiry_type,
// inquiry_mode
// }).then(response => {
// let result=response.data;
// if(result){
// this.setData({
// 'config_setting.service_content':result.service_content,
// 'config_setting.service_process':result.service_process,
// 'config_setting.service_period':result.service_period,
// 'config_setting.service_rounds':result.service_rounds,
// 'config_setting.config_service_id':result.config_service_id
// })
// }
// }).catch(errors => {console.error(errors);})
// },
saveconfirmDialog(){
let {cycle,rounds,content_message,process_message}=this.data;
wx.setStorageSync('service_setting',{
cycle,
rounds,
content_message,
process_message
})
this.setData({
showSave:false
});
wx.navigateBack();
},
draftcancelDialog(){
this.setData({
showDraft:false
})
//this.getConfig();
},
draftconfirmDialog(){
const service_setting=wx.getStorageSync('service_setting');
this.setData({
cycle:service_setting.cycle,
rounds:service_setting.rounds,
content_message:service_setting.content_message,
process_message:service_setting.process_message,
showDraft:false
})
},
previewcancelDialog(){
this.setData({
showPreview:false
})
},
previewconfirmDialog(){
this.setData({
showPreview:false
})
let doctor_id=wx.getStorageSync('client_user_id_2')
app.go("/user/pages/yishi/expertDetail/expertDetail?doctor_id="+doctor_id)
},
onChangeText(event){
let {id}=event.currentTarget.dataset;
console.log(id);
this.setData({
[id]:event.detail
})
},
save(){
let {config_service_id}=this.data;
if(config_service_id){
this.putConfig();
}else{
this.postConfig();
}
},
validate(){
let {process_message,content_message,cycle,rounds}=this.data;
let content_msg1='1、服务包含肝脏病理切片解读需患者邮寄肝脏切片\n'+'2、针对病例切片多学科会诊包含临床、影像、肝脏病理等学科\n'+'3、给出分析报告与治疗方案\n'+'4、服务周期大概7~15天期间可以不限次医生自己定义沟通病情。';
let content_msg2='1、概述服务所包含内容,如报告解读(可包含超声报告、CT报告、肝脏病理报告及其他常规报告)或者病情解析;\n2、详细描述服务所包含的具体服务或者形\n3、请给出服务周期\n4、描述该项所提供服务的特点。' ;
let process_msg1='1、医生与患者线上沟通确定肝脏病理切片解读事项\n'+'2、患者按要求线下邮寄切片并线上提醒医生已寄出\n'+
'3、医生线下收到切片后阅片解读或组织多学科会诊\n'+
'4、医生线上给出分析报告和治疗方案。'
let process_msg2='1、针对本项目服务医生与患者各自需要所作事情\n'+ '2、所做事情用1、2、3点按照时间顺序进行详细描述。'
if(content_message.length<10){
wx.showToast({
title: '服务内容不少于10个字符',
icon:'none'
})
return false
};
if(content_message==content_msg1 || content_message==content_msg2){
wx.showToast({
title: '不能照搬模板,请对服务内容进行修改',
icon:'none'
})
return false
}
if(process_message.length<10){
wx.showToast({
title: '服务流程不少于10个字符',
icon:'none'
})
return false
}
if(process_message==process_msg1 || process_message==process_msg2){
wx.showToast({
title: '不能照搬模板,请对服务流程进行修改',
icon:'none'
})
return false
}
if(!cycle){
wx.showToast({
title: '请设置服务周期',
icon:'none'
})
return false
}
if(!rounds && rounds!=0){
wx.showToast({
title: '请设置服务回合数',
icon:'none'
})
return false
}
return true
},
postConfig(){//新增
let {process_message,content_message,cycle,rounds}=this.data;
if(this.validate()){
api.postServiceConfig({
service_content:content_message,
service_process:process_message,
service_period:cycle,
service_rounds:rounds=='不限次'?0:rounds
}).then(response => {
if(response.code==200){
wx.showToast({
title: '新增成功',
icon:'none'
})
wx.navigateBack();
wx.setStorageSync('service_setting','')
}
}).catch(errors => {console.error(errors);})
}
},
putConfig(){ //修改
let {config_service_id,process_message,content_message,cycle,rounds}=this.data;
if(this.validate()){
api.putServiceConfig({
service_content:content_message,
service_process:process_message,
service_period:cycle,
service_rounds:rounds=='不限次'?0:rounds
},config_service_id).then(response => {
console.log(response)
if(response.code==200){
wx.showToast({
title: '修改成功',
icon:'none'
})
wx.navigateBack();
}
}).catch(errors => {console.error(errors);})
}
},
getConfig(){
api.getServiceConfig({
inquiry_type:1,
inquiry_mode:6
}).then(response => {
let result=response.data;
if(result){
this.setData({
'content_message':result.service_content,
'process_message':result.service_process,
'cycle':result.service_period,
'rounds':result.service_rounds
})
}
}).catch(errors => {console.error(errors);})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const service_setting=wx.getStorageSync('service_setting');
console.log(service_setting)
let arr=[];
for (let i =2; i < 31; i++) {
arr.push(i)
}
this.setData({
columnsCycle:arr
})
if(options.config_service_id){
this.setData({
config_service_id:options.config_service_id
})
this.getConfig();
}else{
if(service_setting){
this.setData({
showDraft:true
})
}
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})