guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 1 | <template> |
| 2 | <view class="addPatient"> |
| 3 | <view class="addPatient-items"> |
| 4 | <u-field v-model="name" label="姓名" placeholder="请输入姓名" required></u-field> |
| 5 | <u-field v-model="sex" label="性别" :placeholder="sexVal" required disabled @click="openPicker"></u-field> |
| 6 | <u-field v-model="cardno" label="证件号" placeholder="请输入身份证号" required></u-field> |
| 7 | <u-field v-model="mobile" label="联系电话" placeholder="请输入联系电话"></u-field> |
| 8 | </view> |
| 9 | <u-picker mode="selector" v-model="show" :default-selector="[0]" :range="list" @confirm="confirm"></u-picker> |
| 10 | <u-button @click="add_patient" :custom-style="addBtn">添加就诊人</u-button> |
| 11 | </view> |
| 12 | </template> |
| 13 | |
| 14 | <script> |
| 15 | export default { |
| 16 | data() { |
| 17 | return { |
| 18 | name: '', |
| 19 | sex: '', |
| 20 | cardno: '', |
| 21 | mobile: '', |
| 22 | list:['男','女'], |
| 23 | sexVal: '请选择性别', |
| 24 | show:false, |
| 25 | addBtn: { |
| 26 | backgroundColor: ' #2FA8E1', |
| 27 | padding: '50rpx 0', |
| 28 | color: '#FFFFFF', |
| 29 | width: ' 600rpx', |
| 30 | fontSize: '30rpx', |
| 31 | border: '1px solid #2FA8E1', |
| 32 | marginTop:'50rpx' |
| 33 | }, |
| 34 | } |
| 35 | }, |
| 36 | methods: { |
| 37 | openPicker(){ |
| 38 | this.show = !this.show |
| 39 | }, |
| 40 | confirm(e){ |
| 41 | let index = e[0] |
| 42 | this.sexVal = this.list[index] |
| 43 | this.sex = index + 1 |
| 44 | }, |
| 45 | add_patient(){ |
| 46 | let that = this |
| 47 | let {name,sex,cardno,mobile} = that |
| 48 | if(name == '' || sex == '' || cardno == '' || mobile == ''){ |
| 49 | uni.showModal({ |
| 50 | title:'提示', |
| 51 | content:'请填写就诊人信息', |
| 52 | showCancel:false |
| 53 | }) |
| 54 | return false |
| 55 | } |
| 56 | let params = { |
| 57 | name,sex,cardno,mobile, |
| 58 | hospitalcode:'' |
| 59 | } |
guangchao.xu | 50e4238 | 2021-01-04 17:53:47 +0800 | [diff] [blame] | 60 | that.$u.post('/medicalapi/medicalcard/add',params).then(res=>{ |
guangchao.xu | 070005a | 2020-12-07 09:56:40 +0800 | [diff] [blame] | 61 | console.log(res.data) |
| 62 | }) |
| 63 | } |
| 64 | }, |
| 65 | onLoad() { |
| 66 | |
| 67 | } |
| 68 | } |
| 69 | </script> |
| 70 | |
| 71 | <style lang="scss" scoped> |
| 72 | .addPatient { |
| 73 | font-family: "PingFang-SC-Medium"; |
| 74 | &-items { |
| 75 | background-color: #FFFFFF; |
| 76 | margin-top: 30rpx; |
| 77 | } |
| 78 | } |
| 79 | </style> |