NurseStationApp/pages/information/information.vue

295 lines
7.9 KiB
Vue
Raw Normal View History

2022-10-17 11:21:23 +08:00
<template>
<view class="app">
<view class="" style="background-color: #F4F5F7;height: 20rpx;width:100%">
</view>
<view class="userinfo info">
<view class="item">
<span>姓名:</span>
2022-11-11 17:23:23 +08:00
<u-input :clearable='false' v-model="query.patientName" type="text" placeholder='' maxlength='5' />
2022-10-17 11:21:23 +08:00
</view>
2022-11-14 12:31:02 +08:00
<!-- <view class="item">
2022-10-17 11:21:23 +08:00
<span>电话:</span>
2022-11-11 17:23:23 +08:00
<u-input :clearable='false' v-model="query.phone" maxlength='11' type="text" placeholder='' />
2022-11-14 12:31:02 +08:00
</view> -->
2022-10-17 11:21:23 +08:00
<view class="item">
<span>身份证号:</span>
2022-11-11 17:23:23 +08:00
<u-input :clearable='false' v-model="query.cardNo" type="text" placeholder='' maxlength='18' />
2022-10-17 11:21:23 +08:00
</view>
2023-01-10 10:35:17 +08:00
<view class="item" @tap='showPicker'>
2022-10-17 11:21:23 +08:00
<span>所属区域:</span>
2022-11-14 11:24:55 +08:00
<view class="address">{{address}}</view>
2022-10-17 11:21:23 +08:00
</view>
<view class="item">
<span>详细地址:</span>
2022-11-11 17:23:23 +08:00
<u-input :clearable='false' v-model="query.address" maxlength='40' type="text"
placeholder='小区、单元、门牌号' />
2022-10-17 11:21:23 +08:00
</view>
<view class="item" @tap='getAddress()'>
<span>所在位置:</span>
2022-11-14 11:24:55 +08:00
<view class="address" style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
2022-11-15 15:36:29 +08:00
{{chooseLocation}}
</view>
2022-10-17 11:21:23 +08:00
</view>
</view>
2023-01-10 10:35:17 +08:00
<view class="">
<m-city style='z-index: 10076;' :provinceData="list" headTitle="地区选择" ref="cityPicker"
@funcValue="getpickerParentValue" pickerSize="4">
</m-city>
</view>
2022-10-17 11:21:23 +08:00
<view class="info">
<view class="service">
<view class="title">
所属服务
</view>
<view class="Multiplechoice">
2022-10-18 08:54:14 +08:00
<view :class="query.nurseTypeIdList.find(e => e == item.id)?'choices':'choice'"
v-for="(item,index) in getNurseTypelist" :key="item.id" @tap="addnurseType(item)">
{{item.nurseTypeName}}
2022-10-17 11:21:23 +08:00
</view>
2022-11-03 17:26:15 +08:00
<view @tap="godisease(item)"
:class="query.nurseTypeIdList.find(e => e == item.id)?'choices':'choice'"
2022-10-18 08:54:14 +08:00
v-for="(item,index) in medicalcarelist" :key="item.id">
2022-10-17 11:21:23 +08:00
{{item.nurseTypeName}}
</view>
</view>
</view>
</view>
2022-12-01 17:03:02 +08:00
<view class="radio-content">
<view class="radio-right" @tap="changeRadio">
<view class="radio" :class="radio == 2 ? 'radio-default':''">
<view :class="radio == 2 ? 'radio-active':''"></view>
</view>
</view>
<view class="agreement">我已阅读并同意<text @tap='maskshow=true'
style="color: #000000;border-bottom: 1rpx solid #000000;">用户协议</text>
</view>
</view>
<view class="btn" @tap='informationinfo'>
提交
</view>
<!-- //用户协议 -->
<u-mask :show="maskshow" class='mask' @click='maskshow=false'>
<view class="Agreement">
<view class="title">
用户协议与隐私政策
</view>
<scroll-view scroll-y="true" class="scroll-Y" style="">
<contenttext></contenttext>
</scroll-view>
<view class="cancel" @tap='maskshow=false'>
取消
</view>
<view class="determine" @tap='tapradio'>
确定并同意
</view>
</view>
</u-mask>
2022-10-18 08:54:14 +08:00
<u-toast ref="uToast" />
2022-10-17 11:21:23 +08:00
</view>
</template>
<script>
import {
getRegionAndStreetInfo,
2022-10-18 08:54:14 +08:00
getNurseType,
information
2022-10-17 11:21:23 +08:00
} from '@/api/information/index.js'
2023-01-10 10:35:17 +08:00
import {
getSubordinateRegions,
} from '@/api/modifyAddress/modifyAddress.js';
2022-12-01 17:03:02 +08:00
import contenttext from './text.vue'
2023-01-10 10:35:17 +08:00
import gkcity from "../m-city/m-city.vue";
2022-10-17 11:21:23 +08:00
export default {
2022-12-01 17:03:02 +08:00
components: {
2023-01-10 10:35:17 +08:00
contenttext,
"m-city": gkcity
2022-12-01 17:03:02 +08:00
},
2022-10-17 11:21:23 +08:00
data() {
return {
2022-12-01 17:03:02 +08:00
radio: 1,
2022-11-14 11:24:55 +08:00
timer: null,
2022-10-17 11:21:23 +08:00
arealist: [], //区街道list
areashow: false, //经纬度开关
getNurseTypelist: [], //护理类型数组
2022-10-18 08:54:14 +08:00
medicalcarelist: [], //医疗护理数组
address: '', //页面所属区域
2022-12-01 17:03:02 +08:00
maskshow: false, //用户协议
2022-11-03 17:26:15 +08:00
chooseLocation: '',
2022-10-17 11:21:23 +08:00
query: { //信息请求数组
patientName: "",
cardNo: "",
phone: "",
address: "",
areaCode: "",
nurseTypeIdList: [],
diseaseInfoList: [],
2022-10-31 09:04:45 +08:00
patientId: '',
2023-01-10 10:35:17 +08:00
},
addresslength: null,
list: [{
id: "",
localName: "请选择",
children: [],
}, ],
2022-10-17 11:21:23 +08:00
};
},
methods: {
2022-10-18 08:54:14 +08:00
//提交信息
informationinfo() {
2022-11-15 15:36:29 +08:00
let that = this
2023-01-13 13:55:31 +08:00
if (this.addresslength) {
if (this.addresslength.length > 2) {
try {
const value = uni.getStorageSync('phone');
if (value) {
that.query.phone = value
information(that.query).then(res => {
if (res.code == 200) {
that.$refs.uToast.show({
title: '完善信息成功',
type: 'success',
duration: '1500'
})
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
uni.navigateBack({
delta: 1
})
}, 1500)
} else if (res.code == 500) {
that.$refs.uToast.show({
title: res.msg,
type: 'error',
2023-01-10 10:35:17 +08:00
})
2023-01-13 13:55:31 +08:00
}
})
}
} catch (e) {}
} else {
that.$refs.uToast.show({
title: '所属区域应选择所在的区或街道,请重新选择!',
type: 'error'
})
}
2023-01-10 10:35:17 +08:00
} else {
that.$refs.uToast.show({
2023-01-13 13:55:31 +08:00
title: '所属区域应选择所在的区或街道,请重新选择!',
2023-01-10 10:35:17 +08:00
type: 'error'
})
}
2023-01-13 13:55:31 +08:00
2022-10-17 11:21:23 +08:00
},
//获取所在位置
getAddress() {
2022-11-03 17:26:15 +08:00
var that = this;
2022-10-17 11:21:23 +08:00
uni.chooseLocation({
success: function(res) {
2022-11-15 15:36:29 +08:00
that.query.locationName = res.name
2022-11-11 14:19:07 +08:00
that.chooseLocation = res.name
that.query.homeLongitude = res.longitude;
that.query.homeLatitude = res.latitude;
2022-10-17 11:21:23 +08:00
}
});
},
//护理类型请求
getNurseTypeInfo() {
getNurseType().then(res => {
2022-10-18 08:54:14 +08:00
this.medicalcarelist = res.data.filter(e => e.nurseTypeName == '医疗护理')
this.getNurseTypelist = res.data.filter(e => e.nurseTypeName != '医疗护理')
2022-10-17 11:21:23 +08:00
})
},
//区街道
areaInfo() {
2023-01-10 10:35:17 +08:00
getSubordinateRegions().then(res => {
this.list = res.data;
2022-10-17 11:21:23 +08:00
})
},
2023-01-10 10:35:17 +08:00
// 三级地址联动回调
getpickerParentValue(e) {
this.addresslength = e
if (e.length == 4) {
2023-01-13 13:55:31 +08:00
this.address = e[0].localName + e[1].localName + e[2].localName + e[3]
2023-01-10 10:35:17 +08:00
.localName
this.query.areaCode = e[3].id
} else if (e.length == 3) {
2023-01-13 13:55:31 +08:00
this.address = e[0].localName + e[1].localName + e[2].localName
2023-01-10 10:35:17 +08:00
this.query.areaCode = e[2].id
} else if (e.length == 2) {
2023-01-13 13:55:31 +08:00
this.address = e[0].localName + e[1].localName
2023-01-10 10:35:17 +08:00
this.query.areaCode = e[1].id
} else if (e.length == 1) {
this.address = e[0].localName
this.query.areaCode = e[0].id
2023-01-13 13:55:31 +08:00
} else {
this.address = ''
this.query.areaCode = ''
2023-01-10 10:35:17 +08:00
}
},
// 显示三级地址联动
showPicker() {
this.areashow = true
this.$refs.cityPicker.show();
},
2022-10-18 08:54:14 +08:00
//点击所需服务
addnurseType(item) {
if (this.query.nurseTypeIdList.findIndex(e => e == item.id) == -1) {
this.query.nurseTypeIdList.push(item.id)
} else {
this.query.nurseTypeIdList = this.query.nurseTypeIdList.filter(e => e != item.id)
}
},
2022-10-31 09:04:45 +08:00
godisease(item) {
2022-10-17 11:21:23 +08:00
uni.navigateTo({
2022-10-18 08:54:14 +08:00
url: `/pages/disease/disease?diseaseInfoList=${JSON.stringify(this.query.diseaseInfoList)}`
2022-10-17 11:21:23 +08:00
})
},
2022-12-01 17:03:02 +08:00
changeRadio() {
if (this.radio == 1) {
this.radio = 2;
} else {
this.radio = 1;
}
},
tapradio() {
this.radio = 2;
this.maskshow = false;
},
2022-10-17 11:21:23 +08:00
},
2022-10-18 08:54:14 +08:00
//进入界面加载
onLoad() {
2022-10-31 09:04:45 +08:00
let that = this
2022-11-09 16:38:05 +08:00
try {
const value = uni.getStorageSync('patientId');
if (value) {
that.query.patientId = value
2022-10-31 09:04:45 +08:00
}
2023-01-13 13:55:31 +08:00
} catch (e) {}
2022-10-18 08:54:14 +08:00
this.areaInfo()
this.getNurseTypeInfo();
},
//带参返回
onShow() {
let that = this
uni.$on('disease', function(data) {
that.query.diseaseInfoList = JSON.parse(data.disease)
if (that.query.diseaseInfoList.length > 0) {
that.medicalcarelist.forEach(e => {
if (that.query.nurseTypeIdList.findIndex(el => el == e.id) == -1) {
that.query.nurseTypeIdList.push(e.id)
2022-10-31 09:04:45 +08:00
} else {}
})
} else {
that.medicalcarelist.forEach(e => {
that.query.nurseTypeIdList = that.query.nurseTypeIdList.filter(el => el != e.id)
2022-10-18 08:54:14 +08:00
})
}
})
}
2022-10-17 11:21:23 +08:00
}
</script>
<style lang="scss">
2022-10-24 14:42:03 +08:00
@import './information.scss';
2022-10-17 11:21:23 +08:00
</style>