This commit is contained in:
haomingming
2023-03-22 09:01:58 +08:00
parent 589c2cf823
commit cfa69efd15
71 changed files with 1300 additions and 588 deletions
+32 -10
View File
@@ -1,5 +1,5 @@
import { API } from './../../../utils/network/api'
import Toast from '@vant/weapp/toast/toast';
import Toast from 'tdesign-miniprogram/toast/index';
let api = new API()
const app = getApp()
Page({
@@ -19,6 +19,7 @@ Page({
inquiry_price: 0,
work_num_day: 0
},
myprice: "",
config:{
"max_work_num_day": 30,
"min_inquiry_price": 0,
@@ -34,7 +35,7 @@ Page({
}
},
onLoad(){
this.setData({ note: this.data.open_note });
},
onShow(){
let params = {};
@@ -46,12 +47,17 @@ Page({
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);})
},
onChange({ detail }) {
console.log("onChange: ", detail);
if(detail){
let inquiry_price = this.data.info.inquiry_price;
let check = this.checkPrice(inquiry_price);
if(!check) return;
this.setData({ note: this.data.open_note });
}else{
this.setData({ note: this.data.close_note });
@@ -61,7 +67,7 @@ Page({
//修改开关
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_mode = this.data.inquiry_mode;//接诊方式(1:图文 2:视频 3:语音 4:电话 5:会员)
params.is_open = detail?1:0;
api.putDoctorInquiryOpen(params).then(response => {
console.log(response);
@@ -91,20 +97,36 @@ Page({
},
onPriceChange(e){
console.log(e.detail);
let value = Number(e.detail.value);
this.checkPrice(e.detail.value)
this.setData({
"info.inquiry_price": e.detail.value
})
},
myToast(message){
Toast({
context: this,
selector: '#t-toast',
message: message,
theme: 'warning',
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;
Toast.fail('价格不能低于' + min + '元');
let message = '价格不能低于' + min + '元';
this.myToast(message);
return false;
}else if(value >= min && value <=max ){
value = value;
return true;
}else{
value = max;
Toast.fail('价格不能高于' + max + '元');
let message = '价格不能高于' + max + '元';
this.myToast(message);
return false;
}
this.setData({
"info.inquiry_price": value
})
}
})
+1 -1
View File
@@ -7,6 +7,6 @@
"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-toast": "tdesign-miniprogram/toast/toast"
}
}
+5 -5
View File
@@ -20,7 +20,7 @@
</view>
</view>
<view wx:if="{{ info.is_open==1 }}" class="checked_box">
<view class="checked_box">
<view class="price_title">价格设置</view>
<view class="price_steup_box">
<view class="price_steup_box_top">
@@ -32,7 +32,7 @@
<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="请输入问诊单价" />
<input class="weui-input" bindinput="onPriceChange" type="digit" value="{{ info.inquiry_price }}" placeholder="请输入问诊单价" />
<text class="price">元</text>
</view>
</view>
@@ -49,9 +49,9 @@
</text>
</view>
<view class="go" wx:if="{{ info.is_open==1 }}">
<van-button bind:click="putDoctorInquiryConfig" color="#3CC7C0" custom-style="border-radius: 20rpx;font-size:30rpx;" type="primary" block>去接诊</van-button>
<view class="go">
<van-button disabled="{{info.is_open!=1}}" bind:click="putDoctorInquiryConfig" color="#3CC7C0" custom-style="border-radius: 20rpx;font-size:30rpx;" type="primary" block>去接诊</van-button>
</view>
<van-toast id="van-toast" />
<t-toast id="t-toast" />
</view>
+1 -1
View File
@@ -52,7 +52,7 @@
}
.price_title{
width: 90vw;
margin: 0 auto;
margin: 20rpx auto 0 auto;
font-size: 32rpx;
margin-bottom: 20rpx;
font-family: "AlibabaPuHuiTi-2-55-Regular";