优化
This commit is contained in:
@@ -54,6 +54,8 @@ Page({
|
||||
onChange({ detail }) {
|
||||
console.log("onChange: ", detail);
|
||||
|
||||
|
||||
|
||||
if(detail){
|
||||
let inquiry_price = this.data.info.inquiry_price;
|
||||
let check = this.checkPrice(inquiry_price);
|
||||
@@ -71,35 +73,63 @@ Page({
|
||||
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("修改成功");
|
||||
wx.switchTab({
|
||||
url: "/Pages/yishi/wenzhen_v2/wenzhen"
|
||||
})
|
||||
}).catch(errors => {console.error(errors);})
|
||||
// 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("修改成功");
|
||||
// wx.switchTab({
|
||||
// url: "/Pages/yishi/wenzhen_v2/wenzhen"
|
||||
// })
|
||||
// }).catch(errors => {console.error(errors);})
|
||||
|
||||
wx.switchTab({
|
||||
url: "/Pages/yishi/wenzhen_v2/wenzhen"
|
||||
})
|
||||
|
||||
},
|
||||
onStepperChange(event) {
|
||||
console.log(event.detail);
|
||||
this.setData({
|
||||
"info.work_num_day": event.detail
|
||||
});
|
||||
|
||||
this.updateConfig();
|
||||
|
||||
},
|
||||
onPriceChange(e){
|
||||
console.log(e.detail);
|
||||
this.checkPrice(e.detail.value)
|
||||
this.setData({
|
||||
"info.inquiry_price": e.detail.value
|
||||
let price = e.detail.value;
|
||||
let check = this.checkPrice(price);
|
||||
if(!check){
|
||||
price = this.data.info.inquiry_price
|
||||
return
|
||||
}
|
||||
let result = this.updateConfig(price);
|
||||
console.log("result result result:", result);
|
||||
result.then((res)=>{
|
||||
console.log(res)
|
||||
if(!res) price = this.data.info.inquiry_price
|
||||
this.setData({
|
||||
"info.inquiry_price": price
|
||||
})
|
||||
})
|
||||
},
|
||||
myToast(message){
|
||||
@@ -107,7 +137,7 @@ Page({
|
||||
context: this,
|
||||
selector: '#t-toast',
|
||||
message: message,
|
||||
theme: 'warning',
|
||||
theme: 'success',
|
||||
direction: 'column',
|
||||
});
|
||||
},
|
||||
@@ -128,5 +158,24 @@ Page({
|
||||
this.myToast(message);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
async updateConfig(price){
|
||||
//修改医生问诊配置
|
||||
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 = 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;
|
||||
}).catch(errors => {
|
||||
console.error(errors);
|
||||
return false;
|
||||
})
|
||||
|
||||
console.log("updateConfig result result: ", result);
|
||||
return result;
|
||||
}
|
||||
})
|
||||
@@ -26,13 +26,13 @@
|
||||
<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" />
|
||||
<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" bindinput="onPriceChange" type="digit" value="{{ info.inquiry_price }}" placeholder="请输入问诊单价" />
|
||||
<input class="weui-input" bindblur="onPriceChange" type="digit" value="{{ info.inquiry_price }}" placeholder="请输入问诊单价" />
|
||||
<text class="price">元</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user