|
@@ -49,7 +49,8 @@
|
|
placeholder="请选择服务开始时间" inputAlign="right" />
|
|
placeholder="请选择服务开始时间" inputAlign="right" />
|
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
|
<u-icon slot="right" name="arrow-right"></u-icon>
|
|
<u-datetime-picker :show="showTimePicker" v-model="form.expectedTime" mode="datetime"
|
|
<u-datetime-picker :show="showTimePicker" v-model="form.expectedTime" mode="datetime"
|
|
- @confirm=selectTime @cancel="showTimePicker = false"></u-datetime-picker>
|
|
|
|
|
|
+ @confirm=selectTime @cancel="showTimePicker = false"
|
|
|
|
+ :filter="timeFilter"></u-datetime-picker>
|
|
|
|
|
|
</u-form-item>
|
|
</u-form-item>
|
|
<u-form-item label="下单数量" prop="orderNum" required>
|
|
<u-form-item label="下单数量" prop="orderNum" required>
|
|
@@ -61,8 +62,16 @@
|
|
</view>
|
|
</view>
|
|
</u--form>
|
|
</u--form>
|
|
|
|
|
|
- <u-action-sheet :show="showDepartment" :actions="actions" title="请选择科室" description="必选项"
|
|
|
|
- @close="showDepartment = false" @select="departmentSelect">
|
|
|
|
|
|
+ <u-action-sheet :show="showDepartment" :actions="actions" title="请选择科室" @close="showDepartment = false"
|
|
|
|
+ @select="departmentSelect">
|
|
|
|
+ <!-- <view class="search-box">
|
|
|
|
+ <u-search
|
|
|
|
+ v-model="searchText"
|
|
|
|
+ placeholder="请输入搜索关键词"
|
|
|
|
+ :show-action="false"
|
|
|
|
+ @change="onSearch"
|
|
|
|
+ ></u-search>
|
|
|
|
+ </view> -->
|
|
</u-action-sheet>
|
|
</u-action-sheet>
|
|
|
|
|
|
</view>
|
|
</view>
|
|
@@ -70,7 +79,7 @@
|
|
<view class="agreement-box">
|
|
<view class="agreement-box">
|
|
<u-checkbox-group v-model="checked" @change="checkboxChange">
|
|
<u-checkbox-group v-model="checked" @change="checkboxChange">
|
|
<u-checkbox size="16" shape="square" labelSize="12" active-color="#4B91D1" label="我已阅读并同意" la
|
|
<u-checkbox size="16" shape="square" labelSize="12" active-color="#4B91D1" label="我已阅读并同意" la
|
|
- labelColor="#999999" name="true"></u-checkbox>
|
|
|
|
|
|
+ labelColor="#999999" name="true" :value="true"></u-checkbox>
|
|
</u-checkbox-group>
|
|
</u-checkbox-group>
|
|
<view class="agreement" @click="toPrivacy('service_protocol')">《服务协议》</view>
|
|
<view class="agreement" @click="toPrivacy('service_protocol')">《服务协议》</view>
|
|
</view>
|
|
</view>
|
|
@@ -81,7 +90,7 @@
|
|
<view class="submit-box flex-box-c-b">
|
|
<view class="submit-box flex-box-c-b">
|
|
<view class="price-box">
|
|
<view class="price-box">
|
|
<span class="txt">金额:</span>
|
|
<span class="txt">金额:</span>
|
|
- <span class="price">¥{{price}}</span>
|
|
|
|
|
|
+ <span class="price">¥{{(price * form.orderNum).toFixed(2)}}</span>
|
|
</view>
|
|
</view>
|
|
<view class="submit-btn" @click="submit">确认下单</view>
|
|
<view class="submit-btn" @click="submit">确认下单</view>
|
|
</view>
|
|
</view>
|
|
@@ -90,7 +99,7 @@
|
|
@open="open" :round="20">
|
|
@open="open" :round="20">
|
|
<view class="pop-box">
|
|
<view class="pop-box">
|
|
<view class="title-box">
|
|
<view class="title-box">
|
|
- 服务协议
|
|
|
|
|
|
+ 用户服务协议
|
|
</view>
|
|
</view>
|
|
<scroll-view class="scroll-content" scroll-y @scroll="handleScroll">
|
|
<scroll-view class="scroll-content" scroll-y @scroll="handleScroll">
|
|
<view v-html="agreementContent"></view>
|
|
<view v-html="agreementContent"></view>
|
|
@@ -135,10 +144,10 @@
|
|
patientId: '',
|
|
patientId: '',
|
|
serviceName: '',
|
|
serviceName: '',
|
|
serviceId: '',
|
|
serviceId: '',
|
|
- expectedTime: Number(new Date()),
|
|
|
|
|
|
+ expectedTime: null,
|
|
orderNum: 1
|
|
orderNum: 1
|
|
},
|
|
},
|
|
- price: '0.00',
|
|
|
|
|
|
+ price: 0,
|
|
// 表单验证规则
|
|
// 表单验证规则
|
|
rules: {
|
|
rules: {
|
|
department: [{
|
|
department: [{
|
|
@@ -168,7 +177,7 @@
|
|
}],
|
|
}],
|
|
expectedTimeFormat: [{
|
|
expectedTimeFormat: [{
|
|
required: true,
|
|
required: true,
|
|
- message: '请输入期望时间',
|
|
|
|
|
|
+ message: '请选择期望时间',
|
|
trigger: ['change', 'blur']
|
|
trigger: ['change', 'blur']
|
|
}],
|
|
}],
|
|
// orderNum: [{
|
|
// orderNum: [{
|
|
@@ -188,16 +197,46 @@
|
|
unitName: null,
|
|
unitName: null,
|
|
unitList: [],
|
|
unitList: [],
|
|
|
|
|
|
|
|
+ isLogin: false,
|
|
|
|
+
|
|
|
|
+
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
+ computed: {
|
|
|
|
+ // price() {
|
|
|
|
+ // let that = this;
|
|
|
|
+ // let price = 0;
|
|
|
|
+ // if (that.form.orderNum && that.unitName) {
|
|
|
|
+ // let unit = that.unitList.find(item => item.name == that.unitName);
|
|
|
|
+ // if (unit) {
|
|
|
|
+ // price = that.form.orderNum * unit.price;
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // return price.toFixed(2);
|
|
|
|
+ // }
|
|
|
|
+ },
|
|
|
|
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
|
|
+
|
|
let that = this;
|
|
let that = this;
|
|
|
|
+ let user = uni.getStorageSync('apiToken');
|
|
|
|
+
|
|
if (option.id) {
|
|
if (option.id) {
|
|
- this.getHospitalInfo(option.id)
|
|
|
|
|
|
+ that.form.hospitalId = option.id;
|
|
|
|
+ that.getHospitalInfo(option.id)
|
|
|
|
+ }
|
|
|
|
+ if (option.scene) {
|
|
|
|
+ let data = decodeURIComponent(option.scene);
|
|
|
|
+ //截取t=i&id=13 中id= 后面的值
|
|
|
|
+ let id = data.split('&')[1].split('=')[1];
|
|
|
|
+ console.log("id", id);
|
|
|
|
+ that.form.hospitalId = id;
|
|
|
|
+ this.getHospitalInfo(id)
|
|
}
|
|
}
|
|
this.getServiceUnit();
|
|
this.getServiceUnit();
|
|
- this.getDefaultInfo();
|
|
|
|
|
|
+ if (user) {
|
|
|
|
+ this.getDefaultInfo();
|
|
|
|
+ }
|
|
uni.$on('returnService', function(data) {
|
|
uni.$on('returnService', function(data) {
|
|
that.form.serviceName = data.name;
|
|
that.form.serviceName = data.name;
|
|
that.form.serviceId = data.id;
|
|
that.form.serviceId = data.id;
|
|
@@ -210,6 +249,26 @@
|
|
that.form.patientId = data.id;
|
|
that.form.patientId = data.id;
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ //处理期待时间,获取当前时间,判断分钟是否小于30,小于30设置我30,大于30设置为00没并且转换成时间戳格式
|
|
|
|
+ let d = new Date();
|
|
|
|
+ let hour = d.getHours();
|
|
|
|
+ let minute = d.getMinutes();
|
|
|
|
+ if (minute < 30) {
|
|
|
|
+ minute = '30';
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ minute = '00';
|
|
|
|
+ hour = hour + 1;
|
|
|
|
+ if (hour > 23) {
|
|
|
|
+ hour = 0;
|
|
|
|
+ d.setDate(d.getDate() + 1);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ let time = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + hour + ':' + minute;
|
|
|
|
+ that.form.expectedTime = time;
|
|
|
|
+ console.log(time);
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
@@ -227,6 +286,21 @@
|
|
},
|
|
},
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
+ timeFilter(mode, options) {
|
|
|
|
+ // console.log(mode);
|
|
|
|
+ let d = new Date()
|
|
|
|
+ // console.log(d.getFullYear());
|
|
|
|
+ if (mode === 'year') {
|
|
|
|
+ return options.filter((option) => option >= d.getFullYear())
|
|
|
|
+ }
|
|
|
|
+ if (mode === 'month') {
|
|
|
|
+ return options.filter((option) => option >= d.getMonth() + 1)
|
|
|
|
+ }
|
|
|
|
+ if (mode === 'minute') {
|
|
|
|
+ return options.filter((option) => option === '00' || option === '30');
|
|
|
|
+ }
|
|
|
|
+ return options;
|
|
|
|
+ },
|
|
//获取医院详情
|
|
//获取医院详情
|
|
getHospitalInfo(id) {
|
|
getHospitalInfo(id) {
|
|
let that = this;
|
|
let that = this;
|
|
@@ -245,8 +319,10 @@
|
|
getDefaultPatient().then(res => {
|
|
getDefaultPatient().then(res => {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
let data = res.data;
|
|
let data = res.data;
|
|
- that.form.patient = data.name+ '(' + data.mobile +')';
|
|
|
|
- that.form.patientId = data.id;
|
|
|
|
|
|
+ if (data) {
|
|
|
|
+ that.form.patient = data.name + '(' + data.mobile + ')';
|
|
|
|
+ that.form.patientId = data.id;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -254,14 +330,17 @@
|
|
//滚动协议
|
|
//滚动协议
|
|
handleScroll(e) {
|
|
handleScroll(e) {
|
|
//根据。agreement-content 的滚动条的进度,设置百分比
|
|
//根据。agreement-content 的滚动条的进度,设置百分比
|
|
- let scrollHeight = e.detail.scrollHeight;
|
|
|
|
- let scrollTop = e.detail.scrollTop;
|
|
|
|
- this.percentage = ((scrollTop / (scrollHeight - 400)) * 100).toFixed(0);
|
|
|
|
- if (this.percentage >= 100) {
|
|
|
|
- this.readed = true
|
|
|
|
- } else {
|
|
|
|
- this.readed = false
|
|
|
|
|
|
+ if (this.percentage < 100) {
|
|
|
|
+ let scrollHeight = e.detail.scrollHeight;
|
|
|
|
+ let scrollTop = e.detail.scrollTop;
|
|
|
|
+ this.percentage = ((scrollTop / (scrollHeight - 400)) * 100).toFixed(0);
|
|
|
|
+ if (this.percentage >= 100) {
|
|
|
|
+ this.readed = true
|
|
|
|
+ } else {
|
|
|
|
+ this.readed = false
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
},
|
|
},
|
|
getUnitTxt(value) {
|
|
getUnitTxt(value) {
|
|
let obj = this.unitList.find(item => item.code == value);;
|
|
let obj = this.unitList.find(item => item.code == value);;
|
|
@@ -295,7 +374,7 @@
|
|
// 提交表单
|
|
// 提交表单
|
|
submit() {
|
|
submit() {
|
|
let that = this;
|
|
let that = this;
|
|
- if (!that.checked) {
|
|
|
|
|
|
+ if (that.checked != 'true') {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: '请先阅读并同意服务协议',
|
|
title: '请先阅读并同意服务协议',
|
|
icon: 'none'
|
|
icon: 'none'
|
|
@@ -309,9 +388,18 @@
|
|
} else {
|
|
} else {
|
|
console.log('表单验证失败');
|
|
console.log('表单验证失败');
|
|
}
|
|
}
|
|
|
|
+ }).catch((errors) => {
|
|
|
|
+ console.log('表单验证失败', errors);
|
|
})
|
|
})
|
|
},
|
|
},
|
|
confirm() {
|
|
confirm() {
|
|
|
|
+ if (!this.readed) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '请先滑动阅读服务协议',
|
|
|
|
+ icon: 'none'
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
addOrder(this.form).then(res => {
|
|
addOrder(this.form).then(res => {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
@@ -335,7 +423,9 @@
|
|
//选择时间
|
|
//选择时间
|
|
selectTime(e) {
|
|
selectTime(e) {
|
|
this.form.expectedTime = e.value
|
|
this.form.expectedTime = e.value
|
|
|
|
+ console.log("this.form.expectedTime", this.form.expectedTime);
|
|
this.form.expectedTimeFormat = this.$utils.mFormatDate(e.value, 'yyyy-MM-dd HH:mm')
|
|
this.form.expectedTimeFormat = this.$utils.mFormatDate(e.value, 'yyyy-MM-dd HH:mm')
|
|
|
|
+ console.log("this.form.expectedTimeFormat", this.form.expectedTimeFormat);
|
|
this.showTimePicker = false
|
|
this.showTimePicker = false
|
|
},
|
|
},
|
|
//选择科室
|
|
//选择科室
|
|
@@ -353,11 +443,12 @@
|
|
//选择同意协议
|
|
//选择同意协议
|
|
checkboxChange(e) {
|
|
checkboxChange(e) {
|
|
console.log('当前值为: ' + e)
|
|
console.log('当前值为: ' + e)
|
|
- if (e) {
|
|
|
|
|
|
+ if (e == 'true') {
|
|
this.checked = true
|
|
this.checked = true
|
|
} else {
|
|
} else {
|
|
this.checked = false
|
|
this.checked = false
|
|
}
|
|
}
|
|
|
|
+ console.log('this.checked: ' + this.checked)
|
|
},
|
|
},
|
|
|
|
|
|
//去选择服务
|
|
//去选择服务
|
|
@@ -394,6 +485,7 @@
|
|
},
|
|
},
|
|
|
|
|
|
popClose() {
|
|
popClose() {
|
|
|
|
+ this.readed = false;
|
|
this.percentage = 0;
|
|
this.percentage = 0;
|
|
this.popShow = false;
|
|
this.popShow = false;
|
|
},
|
|
},
|