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

752 lines
16 KiB
Vue
Raw Normal View History

2023-10-13 15:34:14 +08:00
<template>
<view class="app">
<view class="content">
<view class="text_title">
<text>家庭医生想要你授权信息</text>
</view>
<view class="text_con">
<view class="text_con_pic">
<image src="../../static/pagesB/shflt.png" mode=""></image>
</view>
<view class="text_con_right">
信息仅用于授权您的资料将被严格保密
</view>
</view>
<view class="contentbottom">
2023-10-17 16:20:03 +08:00
<u-form :model="form" ref="uForm">
<u-form-item prop="cardNo" :border-bottom="false">
<view class="name">
身份证号
<u-input v-model="form.cardNo" placeholder="请输入身份证号" />
<view class="idScan">
<!-- <u-icon slot="right" name="arrow-right"></u-icon> -->
<image style="width: 28rpx;height: 28rpx;" src="../../static/pagesB/sweep.png" mode="">
</image>
</view>
</view>
</u-form-item>
<u-form-item prop="patientName" :border-bottom="false">
<view class="name">
姓名
<u-input v-model="form.patientName" placeholder="请输入姓名" />
</view>
</u-form-item>
<u-form-item prop="sex" :border-bottom="false">
<view class="name">
性别
<view class="sex">
<u-radio-group v-model="form.sexname" size='30'>
<u-radio @change='changeGender' v-for="(item, index) in sexlist" :key="index"
:name="item.name" active-color="#26A888" :disabled="item.disabled">
{{item.name}}
</u-radio>
</u-radio-group>
</view>
</view>
</u-form-item>
<u-form-item prop="nation" :border-bottom="false">
<view class="name">
民族
<view class="select" @click="showNation = true;">
<text v-if="!nation">请选择民族</text>
<!-- <text v-if="!householdRelationship">请选择与户主关系</text> -->
<text v-else class="testitem">{{nation}}</text>
<image src="../../static/huijiantou.png" mode=""></image>
</view>
</view>
</u-form-item>
<u-form-item prop="birthDate" :border-bottom="false">
<view class="name">
出生日期
<view class="select" @tap='timeshow=true'>
<text v-if="form.birthDate==''">请选择出生日期</text>
<text v-else class="testitem">{{form.birthDate}}</text>
<image src="../../static/huijiantou.png" mode=""></image>
</view>
</view>
<!-- <view class="name">
出生日期
<view class="select">
<text v-if="!form.birthDate">请选择出生日期</text>
<text v-else class="testitem">{{form.birthDate}}</text>
<image src="../../static/huijiantou.png" mode=""></image>
</view>
</view> -->
</u-form-item>
<u-form-item prop="householdRelationship" :border-bottom="false">
<view class="name">
与户主的关系
<view class="select" @click="showRelationshipWithHouseholder = true;">
<text v-if="!householdRelationship">请选择与户主关系</text>
<text v-else class="testitem">{{householdRelationship}}</text>
</view>
</view>
</u-form-item>
<u-form-item prop="" :border-bottom="false">
<view class="name">
户主身份证号
<u-input v-model="form.householdCardNo" placeholder="请输入身份证号" />
</view>
</u-form-item>
<u-form-item prop="address" :border-bottom="false">
<view class="name">
居住地址
<u-input v-model="form.address" placeholder="请输入居住地址" />
</view>
</u-form-item>
<u-form-item prop="phone" :border-bottom="false">
<view class="name">
手机号
<u-input v-model="form.phone" placeholder="请输入手机号" />
</view>
</u-form-item>
</u-form>
2023-10-13 15:34:14 +08:00
</view>
2023-10-17 16:20:03 +08:00
<u-toast ref="uToast" />
2023-10-13 15:34:14 +08:00
2023-10-17 16:20:03 +08:00
<view class="nextpage" @tap="register">
2023-10-13 15:34:14 +08:00
添加
</view>
2023-10-17 16:20:03 +08:00
<!-- 民族 -->
<u-select v-model="showNation" :list="actions" @confirm="nationSelect"></u-select>
<!-- 与户主关系 -->
<u-select v-model="showRelationshipWithHouseholder" :list="relationship" @confirm="relationshipSelect"></u-select>
<!-- 出生日期 -->
<u-picker mode="time" v-model="timeshow" :params="params" @confirm='timechange' @canel='timeshow=false'>
</u-picker>
2023-10-13 15:34:14 +08:00
</view>
</view>
</view>
</template>
<script>
2023-10-17 16:20:03 +08:00
import {
registerdata
} from '@/api/pages/register/register.js'
2023-10-13 15:34:14 +08:00
// import {
// bindFamilyUser,
// getDictByType
// } from '@/service/api/api.js'
// import QQMapWX from '@/utils/qqMap/qqmap-wx-jssdk.js';
export default {
data() {
return {
sexlist: [{
name: '男',
disabled: false
},
{
name: '女',
disabled: false
}
],
2023-10-17 16:20:03 +08:00
timeshow: false, //出生日期
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
2023-10-13 15:34:14 +08:00
mode: '',
newTime: '',
barTitle: '添加成员',
showBirthday: false,
showNation: false,
showRelationshipWithHouseholder: false,
// isShow: false,
loading: false,
// value1: '',
//校验性别 flag
ifSex: '',
form: {
2023-10-17 16:20:03 +08:00
cardNo: '',
patientName: '',
sexname: '',
nation: '',
2023-10-13 15:34:14 +08:00
address: '',
phone: '',
2023-10-17 16:20:03 +08:00
birthDate: '',
householdRelationship: '',
2023-10-13 15:34:14 +08:00
},
2023-10-17 16:20:03 +08:00
householdRelationship:'',
userinfo:{},
nation:'',
2023-10-13 15:34:14 +08:00
actions: [{
value: '1',
label: '汉族'
2023-10-17 16:20:03 +08:00
2023-10-13 15:34:14 +08:00
},
{
value: '2',
label: '少数名族'
}
],
2023-10-17 16:20:03 +08:00
relationship: [{
value: '1',
label: '户主本人'
},
{
value: '2',
label: '配偶'
},
{
value: '3',
label: '子女'
}, {
value: '4',
label: '(外)孙子女'
}, {
value: '5',
label: '父母'
}, {
value: '6',
label: '(外)祖父母'
}, {
value: '7',
label: '兄弟姐妹'
}, {
value: '8',
label: '儿媳'
}, {
value: '9',
label: '女婿'
}, {
value: '10',
label: '孙子女'
}, {
value: '11',
label: '侄子女'
}, {
value: '12',
label: '曾孙子女'
}, , {
value: '13',
label: '祖父母'
}, , {
value: '99',
label: '其他'
},
],
2023-10-13 15:34:14 +08:00
radiolist: [{
name: '男',
disabled: false
},
{
name: '女',
disabled: false
}
],
rules: {
2023-10-17 16:20:03 +08:00
cardNo: [{
2023-10-13 15:34:14 +08:00
//必填
required: true,
message: '请输入身份证号',
trigger: ['change', 'blur'],
}, {
// 自定义验证函数,见上说明
validator: (rule, value, callback) => {
// 上面有说返回true表示校验通过返回false表示不通过
// uni.$u.test.mobile()就是返回true或者false的
return uni.$u.test.idCard(value);
},
message: '请输入正确的身份证号',
// 触发器可以同时用blur和change
trigger: ['change', 'blur'],
}],
2023-10-17 16:20:03 +08:00
patientName: [{
2023-10-13 15:34:14 +08:00
required: true,
message: '请输入姓名',
trigger: ['change', 'blur']
}],
2023-10-17 16:20:03 +08:00
sex: [{
2023-10-13 15:34:14 +08:00
min: 1,
required: true,
message: '请选择性别',
trigger: ['change']
}],
nation: [{
min: 1,
required: true,
message: '请选择民族',
trigger: ['blur', 'change']
}],
2023-10-17 16:20:03 +08:00
birthDate: [{
2023-10-13 15:34:14 +08:00
min: 1,
required: true,
message: '请选择出生日期',
trigger: ['blur', 'change']
}],
2023-10-17 16:20:03 +08:00
householdRelationship: [{
min: 1,
required: true,
message: '请选择与户主关系',
trigger: ['blur', 'change']
}],
2023-10-13 15:34:14 +08:00
address: [{
required: true,
message: '请输入居住地址',
trigger: ['change', 'blur']
}],
phone: [{
// type: 'number',
// len: 13,
required: true,
message: '请输入正确手机号',
trigger: ['change', 'blur']
}, {
// 自定义验证函数,见上说明
validator: (rule, value, callback) => {
// 上面有说返回true表示校验通过返回false表示不通过
// uni.$u.test.mobile()就是返回true或者false的
return uni.$u.test.mobile(value);
},
message: '手机号码不正确',
// 触发器可以同时用blur和change
trigger: ['change', 'blur'],
}]
},
columns: [
['山东省'],
['德州市', '东营市', '济南市']
],
columnData: [
['德州市', '东营市', '济南市']
],
gxcolumn: [],
dictList: [],
address: uni.getStorageSync('location'),
addInfo: {
longitude: '', //经度
latitude: '', //纬度
},
}
},
2023-10-17 16:20:03 +08:00
2023-10-13 15:34:14 +08:00
onLoad(options) {
2023-10-17 16:20:03 +08:00
this.form.openid = uni.getStorageSync('openid')
2023-10-13 15:34:14 +08:00
},
onShow() {
if (this.address != uni.getStorageSync('location')) {
uni.navigateBack({
delta: 1
})
}
},
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
onReady() {
2023-10-17 16:20:03 +08:00
this.$refs.uForm.setRules(this.rules);
2023-10-13 15:34:14 +08:00
},
beforeDestroy() {
wx.exitMiniProgram({
success(e) {
console.log(e)
}
})
},
methods: {
2023-10-17 16:20:03 +08:00
//选择出生日期
timechange(e) {
this.form.birthDate = e.year + '-' + e.month + '-' + e.day
},
// 添加
2023-10-13 15:34:14 +08:00
register() {
const _this = this
2023-10-17 16:20:03 +08:00
_this.userinfo = uni.getStorageSync('userinfo');
_this.form.openid = uni.getStorageSync('openid');
2023-11-09 10:04:35 +08:00
_this.form.cityCode= uni.getStorageSync('region');
2023-10-17 16:20:03 +08:00
console.log(_this.form, '000')
if (_this.form.sexname == '男') {
_this.form.sex = 'MALE';
} else if (_this.form.sexname == '女') {
_this.form.sex = 'FEMALE';
}
if (_this.form.sex == "") {
_this.$refs.uToast.show({
title: '请选择性别',
type: 'error'
})
}
_this.$refs.uForm.validate(valid => {
if (valid) {
registerdata(_this.form).then(res => {
if (res.code == 500) {
_this.$refs.uToast.show({
title: res.data.msg,
type: 'error'
2023-10-13 15:34:14 +08:00
})
2023-10-17 16:20:03 +08:00
}else{
_this.$refs.uToast.show({
title: '添加成功',
type: 'success'
})
uni.navigateBack({
delta: 1
})
// this.back()
2023-10-13 15:34:14 +08:00
}
})
2023-10-17 16:20:03 +08:00
2023-10-13 15:34:14 +08:00
}
2023-10-17 16:20:03 +08:00
});
2023-10-13 15:34:14 +08:00
},
back() {
uni.navigateBack({
delta: 1
})
},
changeGender(e) {
if (e == '男') {
2023-10-17 16:20:03 +08:00
this.form.sex = 'MALE';
} else if (e == '女') {
this.form.sex = 'FEMALE';
2023-10-13 15:34:14 +08:00
}
2023-10-17 16:20:03 +08:00
2023-10-13 15:34:14 +08:00
},
2023-10-17 16:20:03 +08:00
// 民族
2023-10-13 15:34:14 +08:00
nationSelect(e) {
2023-10-17 16:20:03 +08:00
this.form.nation = e[0].value
this.nation = e[0].label
2023-10-13 15:34:14 +08:00
},
2023-10-17 16:20:03 +08:00
// 与户主关系
relationshipSelect(e) {
this.form.householdRelationship = e[0].value
this.householdRelationship = e[0].label
2023-10-13 15:34:14 +08:00
},
}
}
</script>
<style lang="scss">
.app {
height: 100vh;
background-color: #F7F5F5;
padding: 30rpx 0 0 0;
.content {
width: 95%;
height: 100%;
overflow: scroll;
background: #FFFFFF;
box-shadow: 0rpx 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 5rpx;
2023-10-17 17:26:09 +08:00
margin: 0 auto;
2023-10-13 15:34:14 +08:00
position: relative;
2023-10-17 16:20:03 +08:00
2023-10-13 15:34:14 +08:00
::v-deep .u-input {
width: 630rpx;
height: 63rpx;
background: #F6F6F6;
color: #8E8E8E;
// border: 1rpx solid red;
// margin: 12rpx auto;
2023-10-17 16:20:03 +08:00
border: none !important;
2023-10-13 15:34:14 +08:00
border-radius: 5rpx;
2023-10-17 16:20:03 +08:00
2023-10-13 15:34:14 +08:00
.u-input__input {
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #000000 !important;
padding-left: 20rpx;
2023-10-17 16:20:03 +08:00
2023-10-13 15:34:14 +08:00
}
2023-10-17 16:20:03 +08:00
}
.u-form-item{
padding: 0 0 !important;
2023-10-13 15:34:14 +08:00
}
.text_title {
// width: 358rpx;
height: 29rpx;
font-size: 30rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #333333;
line-height: 42rpx;
margin: 40rpx 30rpx 0 7%;
}
.text_con {
display: flex;
// align-items: center;
// justify-content: center;
2023-10-17 17:26:09 +08:00
//
width: 47%;
2023-10-13 15:34:14 +08:00
margin: 23rpx 30rpx 0 55rpx;
color: rgb(23, 20, 22);
border-radius: 16rpx;
background: #E9F6F3;
border-radius: 2rpx;
.text_con_pic {
2023-10-17 16:20:03 +08:00
margin-right: 10rpx;
margin-left: 9rpx;
2023-10-13 15:34:14 +08:00
image {
width: 14rpx;
height: 18rpx;
}
}
.text_con_right {
// width: 251rpx;
// height: 15rpx;
font-size: 14rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #333333;
line-height: 42rpx;
}
}
.nextpage {
width: 496rpx;
height: 61rpx;
background: #26A888;
border-radius: 5rpx;
line-height: 61rpx;
color: white;
text-align: center;
position: relative;
left: 50%;
transform: translateX(-50%);
2023-10-17 17:26:09 +08:00
margin-top: 100rpx;
bottom: 27rpx;
2023-10-13 15:34:14 +08:00
}
.contentbottom {
position: relative;
top: 2%;
}
.name {
padding: 10rpx 30rpx 0 7%;
font-size: 30rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #333333;
line-height: 38rpx;
::v-deep .input-placeholder {
color: #8E8E8E !important;
font-size: 20rpx;
font-family: Source Han Sans CN;
font-weight: 400;
padding-left: 20rpx;
}
.idScan {
position: absolute;
2023-10-17 16:20:03 +08:00
top: 75rpx;
2023-10-13 15:34:14 +08:00
right: 60rpx;
2023-10-17 16:20:03 +08:00
// transform: translate(0%, -40%);
2023-10-13 15:34:14 +08:00
}
.sex {
width: 630rpx;
height: 63rpx;
background: #F6F6F6;
margin: 12rpx 0 12rpx 0;
border: none;
border-radius: 5rpx;
}
::v-deep .u-radio {
margin-top: 8rpx !important;
margin-left: 20rpx !important;
}
::v-deep .u-input {
width: 636rpx;
height: 63rpx;
background: #F6F6F6;
margin: 12rpx auto;
border: none;
border-radius: 5rpx;
}
// ::v-deep.uni-input-placeholder {
// color: #8E8E8E !important;
// font-size: 20rpx !important;
// }
2023-10-17 16:20:03 +08:00
2023-10-13 15:34:14 +08:00
::v-deep.input-placeholder {
color: #8E8E8E !important;
font-size: 20rpx;
font-family: Source Han Sans CN;
font-weight: 400;
}
2023-10-17 16:20:03 +08:00
2023-10-13 15:34:14 +08:00
::v-deep.uni-input-placeholder {
color: #8E8E8E !important;
font-size: 20rpx;
}
::v-deep .u-input__input.data-v-fdbb9fe6 {
font-size: 26rpx !important;
}
// ::v-deep.input-placeholder {
// color: #8E8E8E !important;
// font-size: 20rpx !important;
// }
2023-10-17 16:20:03 +08:00
::v-deep .uni-input-input {
2023-10-13 15:34:14 +08:00
padding-left: 20rpx !important;
2023-10-17 16:20:03 +08:00
2023-10-13 15:34:14 +08:00
}
.select {
width: 636rpx;
height: 63rpx;
background: #F6F6F6;
margin: 12rpx auto;
border-radius: 5rpx;
display: flex;
position: relative;
2023-10-17 16:20:03 +08:00
.testitem {
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #000000;
}
2023-10-13 15:34:14 +08:00
text {
padding-left: 20rpx;
line-height: 63rpx;
font-size: 20rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #8E8E8E;
}
image {
width: 9rpx;
height: 17rpx;
position: absolute;
right: 40rpx;
top: 50%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
}
}
.numberone {
width: 90rpx;
height: 90rpx;
position: absolute;
top: 6%;
left: 15%;
background: #26A888;
border-radius: 50%;
color: #fff;
line-height: 90rpx;
text-align: center;
font-size: 50rpx;
font-family: Source Han Sans CN;
font-weight: bold;
.information {
width: 160rpx;
margin: 11px 4px 4px -10px;
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #26A888;
line-height: 38rpx;
}
}
.number {
.numbertwo:hover {
background-color: #26A888;
color: #fff;
}
.information:hover {
color: #26A888;
}
}
// ::v-deep .uni-input-input {
// left: 20rpx;
// }
.number {
width: 180rpx;
height: 150rpx;
position: absolute;
top: 6%;
left: 65%;
.numbertwo {
width: 90rpx;
height: 90rpx;
left: 50%;
transform: translateX(50%);
background: #F0F1F6;
border-radius: 50%;
line-height: 90rpx;
text-align: center;
font-size: 50rpx;
font-family: Source Han Sans CN;
font-weight: bold;
// border: 1rpx solid #A6C8C0;
color: #A6C8C0;
}
.information {
padding-top: 20rpx;
font-size: 26rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #8E8E8E;
line-height: 38rpx;
text-align: center;
}
}
.item {
position: absolute;
width: 202rpx;
height: 1rpx;
top: 10%;
left: 34%;
background: linear-gradient(-90deg, #E6E6E6, #26A888);
}
}
}
</style>