| <template> |
| <view class="addPatient"> |
| <view class="addPatient-items"> |
| <u-field v-model="name" label="姓名" placeholder="请输入姓名" required></u-field> |
| <u-field v-model="sex" label="性别" :placeholder="sexVal" required disabled @click="openPicker"></u-field> |
| <u-field v-model="cardno" label="证件号" placeholder="请输入身份证号" required></u-field> |
| <u-field v-model="mobile" label="联系电话" placeholder="请输入联系电话"></u-field> |
| </view> |
| <u-picker mode="selector" v-model="show" :default-selector="[0]" :range="list" @confirm="confirm"></u-picker> |
| <u-button @click="add_patient" :custom-style="addBtn">添加就诊人</u-button> |
| </view> |
| </template> |
| |
| <script> |
| export default { |
| data() { |
| return { |
| name: '', |
| sex: '', |
| cardno: '', |
| mobile: '', |
| list:['男','女'], |
| sexVal: '请选择性别', |
| show:false, |
| addBtn: { |
| backgroundColor: ' #2FA8E1', |
| padding: '50rpx 0', |
| color: '#FFFFFF', |
| width: ' 600rpx', |
| fontSize: '30rpx', |
| border: '1px solid #2FA8E1', |
| marginTop:'50rpx' |
| }, |
| } |
| }, |
| methods: { |
| openPicker(){ |
| this.show = !this.show |
| }, |
| confirm(e){ |
| let index = e[0] |
| this.sexVal = this.list[index] |
| this.sex = index + 1 |
| }, |
| add_patient(){ |
| let that = this |
| let {name,sex,cardno,mobile} = that |
| if(name == '' || sex == '' || cardno == '' || mobile == ''){ |
| uni.showModal({ |
| title:'提示', |
| content:'请填写就诊人信息', |
| showCancel:false |
| }) |
| return false |
| } |
| let params = { |
| name,sex,cardno,mobile, |
| hospitalcode:'' |
| } |
| that.$u.post('/medicalapi/medicalcard/add',params).then(res=>{ |
| console.log(res.data) |
| }) |
| } |
| }, |
| onLoad() { |
| |
| } |
| } |
| </script> |
| |
| <style lang="scss" scoped> |
| .addPatient { |
| font-family: "PingFang-SC-Medium"; |
| &-items { |
| background-color: #FFFFFF; |
| margin-top: 30rpx; |
| } |
| } |
| </style> |