xinelu-applet-ui/pagesB/screenorder/screenorder.vue

457 lines
11 KiB
Vue
Raw Normal View History

2023-10-08 16:16:18 +08:00
<template>
2023-10-10 14:01:25 +08:00
<view class="screenorder">
<view class="user_info">
<view class="basic">
2023-10-10 17:15:30 +08:00
<view class="name">{{userInfo.patientName}}</view>
2023-10-10 14:01:25 +08:00
<view style="margin-right: 30rpx; color: #333">年龄{{userInfo.age}}</view>
2023-10-10 17:15:30 +08:00
<view style="color: #333;">性别{{userInfo.sex}}</view>
2023-10-10 14:01:25 +08:00
</view>
2023-10-10 17:15:30 +08:00
<view class="illness" v-if="userInfo.diseaseList">
<view v-show="userInfo.diseaseList.includes(0)">
2023-10-10 14:01:25 +08:00
<span></span>
</view>
2023-10-10 17:15:30 +08:00
<view v-show="userInfo.diseaseList.includes(1)">
2023-10-10 14:01:25 +08:00
<span>高血压</span>
</view>
2023-10-10 17:15:30 +08:00
<view v-show="userInfo.diseaseList.includes(2) ">
2023-10-10 14:01:25 +08:00
<span>高血糖</span>
</view>
2023-10-10 17:15:30 +08:00
<view v-show="userInfo.diseaseList.includes(3)">
2023-10-10 14:01:25 +08:00
<span>高血脂</span>
</view>
2023-10-10 17:15:30 +08:00
</view>
2023-10-10 14:01:25 +08:00
</view>
<view class="line"></view>
<view class="title">
<!-- <view></view> -->
<text>基本信息</text>
</view>
<u-form labelPosition="left" :model="formData" :rules="rules" ref="form1">
<u-form-item label="预约机构" labelWidth="80">
<view class="uniDataSelectClass">
<uni-data-select v-model="formData.hospitalId" :localdata="DeptList" @change="changeDept"
:clear="false">
</uni-data-select>
</view>
</u-form-item>
<u-form-item label="预约项目" labelWidth="80">
<view class="uniDataSelectClass">
<uni-data-select v-model="formData.projectId" :localdata="ProList" @change="changePro"
:clear="false">
</uni-data-select>
</view>
</u-form-item>
<u-form-item label="预约时间" labelWidth="80">
<uni-datetime-picker v-model="datetimerange" type="datetimerange" rangeSeparator="至" />
</u-form-item>
</u-form>
<!-- <view style="display: flex;justify-content: center;margin-top: 80rpx;"><uni-data-checkbox multiple v-model="test" :localdata="test1"></uni-data-checkbox></view> -->
<view style="height: 180rpx;"></view>
<view class="btn">
2023-10-10 17:15:30 +08:00
<u-button type="success" text="提交预约信息" @click="process()">提交预约信息</u-button>
2023-10-10 14:01:25 +08:00
</view>
<u-action-sheet :show="showSex" :actions="actions" title="请选择性别" @close="showSex = false" @select="sexSelect">
</u-action-sheet>
2023-10-10 17:15:30 +08:00
<u-toast ref="uToast" />
2023-10-10 14:01:25 +08:00
</view>
2023-10-08 16:16:18 +08:00
</template>
<script>
2023-10-10 14:01:25 +08:00
import {
screenOrder,
getDeptList,
getProlist
} from '@/api/pagesB/screenOrder/index.js'
import {
getSex,
getBirthday,
getAgeFun
} from '@/api/conversion.js'
export default {
data() {
return {
showSex: false,
userInfo: {},
datetimerange: [Date.now(), this.todayEndTime()],
test: ['1'],
formData: {
2023-10-10 17:15:30 +08:00
patientName: '',
identity: '',
certType: '',
sex: '',
birthDate: '',
phone: '',
2023-10-10 14:01:25 +08:00
address: '',
disease: '',
height: '',
weight: '',
applyStartTime: '',
applyEndTime: '',
hospitalId: '',
hospitalName: '',
projectId: '',
projectName: ''
},
actions: [{
name: '男',
disabled: true
},
{
name: '女',
disabled: true
},
],
disease: [{
text: '高血压',
value: '1'
},
{
text: '高血糖',
value: '2'
},
{
text: '高血脂',
value: '3'
},
{
text: '无',
value: '0'
}
],
DeptList: [],
ProList: [],
test1: [{
text: '同意《用户服务协议》及《隐私政策》',
value: '1'
}],
rules: {
2023-10-10 17:15:30 +08:00
patientName: [{
2023-10-10 14:01:25 +08:00
required: true,
message: '请填写姓名',
trigger: ['blur', 'change']
}],
identity: [{
required: true,
message: '请填写身份证号',
trigger: ['blur']
}, {
validator: (rule, value, callback) => {
return uni.$u.test.idCard(value);
},
message: '请输入正确的身份证号',
trigger: ['blur'],
}],
phone: [{
required: true,
message: '请填写联系电话',
trigger: ['blur']
}, {
validator: (rule, value, callback) => {
return uni.$u.test.mobile(value);
},
message: '手机号码不正确',
trigger: ['blur'],
}],
address: [{
required: true,
message: '请填写家庭住址',
trigger: ['blur', 'change']
}],
height: [{
required: true,
message: '请填写身高',
trigger: ['blur', 'change']
}, {
validator: (rule, value, callback) => {
return uni.$u.test.number(value);
},
message: '身高格式为数字(小数)',
trigger: ['blur'],
}],
weight: [{
required: true,
message: '请填写体重',
trigger: ['blur', 'change']
}, {
validator: (rule, value, callback) => {
return uni.$u.test.number(value);
},
message: '体重格式为数字(小数)',
trigger: ['blur'],
}]
}
}
},
2023-10-10 17:15:30 +08:00
onReady() {
this.$refs.form1.setRules(this.rules);
},
2023-10-10 14:01:25 +08:00
onLoad(e) {
2023-10-13 15:41:07 +08:00
// console.log(e,'4')
2023-10-10 17:15:30 +08:00
if (e) {
2023-10-13 15:41:07 +08:00
this.userInfo = JSON.parse(e.userinfo)
2023-10-10 17:15:30 +08:00
this.formData.disease = this.userInfo.diseaseList.join(',')
if (this.userInfo.sex == 'MALE') {
this.userInfo.sex = '男'
} else {
this.userInfo.sex = '女'
}
this.userInfo.age = getAgeFun(this.userInfo.birthDate)
}
2023-10-10 14:01:25 +08:00
this.getDeptAndPro()
},
2023-10-10 17:15:30 +08:00
2023-10-10 14:01:25 +08:00
methods: {
getDeptAndPro() {
getDeptList().then(res => {
this.DeptList = res.data.map(item => {
return {
text: item.hospitalName,
value: item.id
}
})
})
getProlist({
projectType: 1,
status: 0
}).then(res => {
2023-10-10 17:15:30 +08:00
if (res.code == 200) {
this.ProList = res.data.map(item => {
return {
text: item.projectName,
value: item.projectId
}
})
}
2023-10-10 14:01:25 +08:00
})
},
changeDept(e) {
this.formData.hospitalName = this.DeptList.find(item => item.value == e).text
},
changePro(e) {
this.formData.projectName = this.ProList.find(item => item.value == e).text
},
todayEndTime() {
let todayYear = (new Date()).getFullYear();
let todayMonth = (new Date()).getMonth();
let todayDay = (new Date()).getDate();
let todayTime = (new Date(todayYear, todayMonth, todayDay, '23', '59', '59')).getTime();
return todayTime
},
changeDisease() {
2023-10-10 17:15:30 +08:00
if (this.formData.diseaseList.length != 0 && this.formData.diseaseList.find(item => item != '0')) {
this.diseaseList[3].disable = true
2023-10-10 14:01:25 +08:00
}
2023-10-10 17:15:30 +08:00
if (this.formData.diseaseList.length != 0 && this.formData.diseaseList.find(item => item == '0')) {
this.diseaseList[0].disable = true
this.diseaseList[1].disable = true
this.diseaseList[2].disable = true
this.formData.diseaseList = ['0']
this.diseaseList[3].disable = false
2023-10-10 14:01:25 +08:00
}
2023-10-10 17:15:30 +08:00
if (this.formData.diseaseList.length == 0) {
for (let item in this.diseaseList) {
this.diseaseList[item].disable = false
2023-10-10 14:01:25 +08:00
}
}
},
changeCheckbox(e) {
if (e.detail.value.length != 0 && e.detail.value.find(item => item != '0')) {
2023-10-10 17:15:30 +08:00
this.diseaseList[3].disable = true
2023-10-10 14:01:25 +08:00
}
if (e.detail.value.length != 0 && e.detail.value.find(item => item == '0')) {
2023-10-10 17:15:30 +08:00
this.diseaseList[0].disable = true
this.diseaseList[1].disable = true
this.diseaseList[2].disable = true
2023-10-10 14:01:25 +08:00
}
if (e.detail.value.length == 0) {
2023-10-10 17:15:30 +08:00
for (let item in this.diseaseList) {
this.diseaseList[item].disable = false
2023-10-10 14:01:25 +08:00
}
}
},
process() {
if (!this.formData.hospitalId) {
uni.showModal({
title: '提示',
content: '请选择预约机构',
})
return
}
if (!this.formData.projectId) {
uni.showModal({
title: '提示',
content: '请选择预约项目',
})
return
}
if (!this.datetimerange[0] || !this.datetimerange[1]) {
uni.showModal({
title: '提示',
content: '预约时间请填写完整!',
})
return
}
2023-10-13 15:17:41 +08:00
const value= uni.getStorageSync('userinfo');
this.formData.patientId =value.id
2023-10-10 17:15:30 +08:00
this.formData.identity = this.userInfo.cardNo
this.formData.diseaseList = this.userInfo.diseaseList
2023-10-10 14:01:25 +08:00
this.formData.applyStartTime = this.datetimerange[0]
this.formData.applyEndTime = this.datetimerange[1]
2023-10-10 17:15:30 +08:00
if (this.formData.sex == '男') {
this.formData.sex = 'MALE'
2023-10-10 14:01:25 +08:00
} else {
2023-10-10 17:15:30 +08:00
this.formData.sex = 'FEMALE'
2023-10-10 14:01:25 +08:00
}
screenOrder(this.formData).then(res => {
2023-10-10 17:15:30 +08:00
// this.formData.diseaseList = this.formData.diseaseList.slice(',')
if (this.formData.sex == 'MALE') {
this.formData.sex = '男'
2023-10-10 14:01:25 +08:00
} else {
2023-10-10 17:15:30 +08:00
this.formData.sex = '女'
2023-10-10 14:01:25 +08:00
}
if (res.code == 200) {
uni.showToast({
title: '预约成功',
duration: 1000
});
setTimeout(() => {
// uni.navigateTo({
2023-10-10 17:15:30 +08:00
// url: `../screensuccess/screensuccess?registerId=${res.data.data}`
// url: `/pageB/orderlist/orderlist?patientId=${this.formData.patientId}`
// url: '/pageB/orderlist/orderlist'/
2023-10-10 14:01:25 +08:00
// })
uni.navigateBack({
delta: 1
})
}, 1000)
2023-10-10 17:15:30 +08:00
} else if (res.code == 500) {
this.$refs.uToast.show({
title: res.msg,
type: 'error'
})
2023-10-10 14:01:25 +08:00
}
})
},
submit() {
2023-10-10 17:15:30 +08:00
let that = this
that.$refs.form1.validate(valid => {
// console.log(111)
if (valid) {
}
}).catch(errors => {
return
})
2023-10-10 14:01:25 +08:00
},
IdentityBlur(e) {
2023-10-10 17:15:30 +08:00
this.formData.sex = getSex(e)
this.formData.birthDate = getBirthday(e)
2023-10-10 14:01:25 +08:00
}
}
}
2023-10-08 16:16:18 +08:00
</script>
<style lang="scss">
2023-10-10 14:01:25 +08:00
// .uniDataSelectClass {
// .uni-select__selector {
// z-index: 99;
// }
// }
::v-deep.u-btn--success.data-v-3bf2dba7 {
color: #ffffff;
border-color: #4AC4AB;
background-color: #4AC4AB !important;
}
.user_info {
border: 1px solid #4AC4AB;
border-radius: 10rpx;
padding: 40rpx 30rpx;
background: #f6f6f6;
margin-top: 50rpx;
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
.basic {
display: flex;
align-items: center;
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
.name {
font-size: 42rpx;
margin-right: 30rpx;
font-weight: 900;
}
}
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
.illness {
display: flex;
margin-top: 25rpx;
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
view {
width: 60px;
font-size: 14px;
background-color: #4AC4AB;
text-align: center;
color: #fff;
padding: 8rpx 6rpx;
border-radius: 20px;
margin-right: 10px;
}
}
}
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
.line {
height: 2rpx;
border-bottom: 1px dashed #999;
margin: 40rpx -40rpx;
}
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
.title {
display: flex;
font-size: 34rpx;
margin-bottom: 20rpx;
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
// color: #555;
// background: #f6f6f6;
// margin: 0 -40rpx 0 -40rpx;
// padding: 20rpx 0;
view {
width: 10rpx;
background: #4AC4AB;
height: 40rpx;
margin: 0 15rpx 0 0;
}
}
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
.screenorder {
padding: 0 40rpx;
}
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
/deep/.u-button--primary.data-v-2bf0e569 {
background-color: #4AC4AB !important;
border-color: #4AC4AB !important;
}
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
.btn {
// display: flex;
// flex-direction: column;
// align-items: center;
position: fixed;
bottom: 50rpx;
width: 90%;
z-index: 2;
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
/deep/.u-button {
height: 90rpx !important;
}
}
2023-10-08 16:16:18 +08:00
2023-10-10 14:01:25 +08:00
/deep/.u-button__text {
font-size: 34rpx !important;
}
2023-10-10 17:15:30 +08:00
</style>