DocRegister.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <template>
  2. <view class="content">
  3. <view class="content_box">
  4. <view class="row b-b">
  5. <text class="tit">姓名</text>
  6. <input class="input" type="text" v-model="name" placeholder="请输入姓名" placeholder-class="placeholder" />
  7. </view>
  8. <view class="row b-b" @tap="handleTap1('picker2')">
  9. <text class="tit">性别</text>
  10. <input class="input" type="text" @focus='outFocus' v-model="gender" placeholder="请选择性别"
  11. placeholder-class="placeholder" />
  12. </view>
  13. <lb-picker ref="picker2" mode="selector" :list="genderList" @change="handleChange1"
  14. @confirm="handleConfirm1" @cancel="handleCancel1" @touchmove.prevent>
  15. </lb-picker>
  16. <!-- <view class="row b-b">
  17. <text class="tit">身份证号</text>
  18. <input class="input" type="text" v-model="id_card" placeholder="请输入身份证号" placeholder-class="placeholder" />
  19. </view> -->
  20. <view class="row b-b">
  21. <text class="tit">联系方式</text>
  22. <input class="input" type="number" v-model="mobile" placeholder="请输入联系方式"
  23. placeholder-class="placeholder" />
  24. </view>
  25. <view class="row b-b" @tap="showPicker('region')">
  26. <text class="tit">省市区</text>
  27. <input class="input" @focus='outFocus' v-model="addr" placeholder="请选择省市区"></input>
  28. </view>
  29. <w-picker mode="region" @touchmove.prevent :value="defaultRegion" default-type="value"
  30. @confirm="onConfirm($event,'region')" @cancel="handleCancel" ref="region"></w-picker>
  31. </view>
  32. <view class="content_box">
  33. <view class="row b-b" @tap="Toshow">
  34. <text class="tit">医院名称</text>
  35. <input class="input" type="text" @focus='outFocus' v-model="hospital" placeholder="请选择医院名称"
  36. placeholder-class="placeholder" />
  37. </view>
  38. <zhilin-picker v-model="show" :title="title" :data="list" :initSelected="initSelected" :showSearch="true"
  39. @change="onChange" @searchInput='onSearchInput' @confirm="onConfirm1" />
  40. <view class="row b-b" @tap="handleTap2('picker3')">
  41. <text class="tit">职称</text>
  42. <input class="input" type="text" @focus='outFocus' v-model="doctor_level" placeholder="请选择职称"
  43. placeholder-class="placeholder" />
  44. </view>
  45. <lb-picker ref="picker3" mode="selector" :list="levelList" @change="handleChange2" @touchmove.prevent
  46. @confirm="handleConfirm2" @cancel="handleCancel">
  47. </lb-picker>
  48. <view class="row b-b" @tap="handleTap1('picker4')">
  49. <text class="tit">专业</text>
  50. <input class="input" type="text" @focus='outFocus' v-model="zyname" placeholder="请选择专业"
  51. placeholder-class="placeholder" />
  52. </view>
  53. <lb-picker ref="picker4" mode="selector" :list="zyList" @change="handleChange4" @confirm="handleConfirm4"
  54. @cancel="handleCancel4" @touchmove.prevent>
  55. </lb-picker>
  56. </view>
  57. <view class="check_box flex_item">
  58. <view>
  59. <radio style="transform: scale(0.75)" @click="Getcheckbox" color="#6786FB" :checked="checked" />
  60. </view>
  61. <view class="">我已阅读并同意<text @click="TOprivacy">《预约平台用户协议》</text></view>
  62. </view>
  63. <view class="check_box flex_item" style="font-size: 26rpx;">
  64. <view class="">注册完成后,务必关注公众号<text style="color:#6786FB ;">【共享预约平台】</text>,否则无法接收到消息推送!</view>
  65. </view>
  66. <view class="add-btn" @click="confirm">下一步</view>
  67. </view>
  68. </template>
  69. <script>
  70. import {
  71. mapState,
  72. mapMutations
  73. } from 'vuex';
  74. import uniList from '@/components/uni-list/uni-list.vue';
  75. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  76. import wPicker from "@/components/w-picker/w-picker.vue"
  77. import zhilinPicker from "@/components/zhilin-picker/zhilin-picker.vue"
  78. import LbPicker from '@/components/lb-picker/index.vue'
  79. import {
  80. upload,
  81. getHospitalList,
  82. setDoctor
  83. } from '@/api/index.js';
  84. import {
  85. getUserInfo
  86. } from '@/api/login.js';
  87. import {
  88. getDocterTypeList
  89. } from '@/api/doctor.js'
  90. export default {
  91. components: {
  92. uniList,
  93. uniListItem,
  94. wPicker,
  95. LbPicker,
  96. zhilinPicker
  97. },
  98. data() {
  99. return {
  100. loading: false,
  101. region: '',
  102. defaultRegion: [],
  103. defaultRegion1: [],
  104. options: [],
  105. checked: false,
  106. name: '', //姓名
  107. gender: '', //性别
  108. gender_id: '', //性别id
  109. genderList: [{
  110. id: 1,
  111. name: '男'
  112. }, {
  113. id: 2,
  114. name: '女'
  115. },
  116. {
  117. id: 0,
  118. name: '其他'
  119. }
  120. ],
  121. zyList: [],
  122. zyListR: [],
  123. zyname: '',
  124. zyid: 0,
  125. id_card: '', //身份证
  126. mobile: '', //联系方式
  127. addr: '', //省市区
  128. code: '', //省市区行政编码
  129. province: '',
  130. province_id: '',
  131. city: '',
  132. city_id: '',
  133. district: '',
  134. district_id: '',
  135. searchVal: '', //搜索医院
  136. list: [], //医院列表
  137. show: false,
  138. initSelected: [],
  139. title: '选择医院',
  140. hospital: '', //医院
  141. hospital_id: '', //医院id
  142. // 1医师2主治医师3副主任医师4主任医师
  143. levelList: [{
  144. id: 1,
  145. name: '初级'
  146. }, {
  147. id: 2,
  148. name: '中级'
  149. }, {
  150. id: 3,
  151. name: '副高级'
  152. }, {
  153. id: 4,
  154. name: '正高级'
  155. }],
  156. doctor_level: '', //职称
  157. level_id: '', ////职称id
  158. utype: '',
  159. };
  160. },
  161. onLoad(option) {
  162. this.ListDate();
  163. this.getDocterTypeList()
  164. let ysinfo = uni.getStorageSync('ysinfo') || ''
  165. console.log(ysinfo,'ysinfo6++++')
  166. if (ysinfo) {
  167. this.name = ysinfo.name
  168. this.mobile = ysinfo.mobile
  169. this.province = ysinfo.province
  170. this.province_id = ysinfo.province_id
  171. this.city = ysinfo.city
  172. this.city_id = ysinfo.city_id
  173. this.district = ysinfo.district
  174. this.district_id = ysinfo.district_id
  175. this.hospital_id = ysinfo.hospital_id
  176. this.hospital = ysinfo.hospital
  177. this.gender = ysinfo.gender
  178. this.gender_id = ysinfo.gender_id,
  179. this.doctor_level = ysinfo.doctor_level
  180. this.level_id = ysinfo.level_id
  181. this.zyname = ysinfo.zyname
  182. this.zyid = ysinfo.zyid
  183. this.addr = ysinfo.addr
  184. }
  185. },
  186. watch: {
  187. // list(newValue, oldValue) {
  188. // if (newValue != oldValue) {
  189. // this.hospital = ''
  190. // }
  191. // },
  192. searchVal() {
  193. this.ListDate();
  194. },
  195. },
  196. methods: {
  197. ...mapMutations(['setUserInfo']),
  198. getDocterTypeList() {
  199. getDocterTypeList().then(res => {
  200. console.log(res)
  201. this.zyListR = res.data.data
  202. this.zyList = res.data.data.map(item => {
  203. return item.text
  204. })
  205. console.log(this.zyList, 'this.zyList')
  206. })
  207. },
  208. handleChange4() {
  209. },
  210. handleCancel4(item) {
  211. // console.log(item,'ddd')
  212. },
  213. handleConfirm4(item) {
  214. this.zyname = item.value
  215. this.zyid = this.zyListR[item.index].id
  216. console.log(this.zyname, this.zyid)
  217. },
  218. outFocus(e) {
  219. console.log(event.target)
  220. event.target.blur()
  221. },
  222. //省市区弹窗
  223. showPicker(type) {
  224. this.$refs[type].show();
  225. },
  226. TOprivacy() {
  227. uni.navigateTo({
  228. url: '/pages/public/uagreement'
  229. })
  230. },
  231. //取消弹窗
  232. handleCancel() {
  233. },
  234. //省市区选择确定
  235. onConfirm(res, type) {
  236. let obj = this;
  237. obj.result = res;
  238. obj.addr = res.result;
  239. if (res.name) {
  240. obj.province = res.name[0];
  241. obj.city = res.name[1];
  242. obj.district = res.name[2];
  243. } else {
  244. obj.province = '北京市';
  245. obj.city = '北京市';
  246. obj.district = '东城区';
  247. }
  248. obj.province_id = res.value[0];
  249. obj.city_id = res.value[1];
  250. obj.district_id = res.value[2];
  251. obj.hospital = ''; //重置医院
  252. obj.ListDate();
  253. },
  254. /*医院*/
  255. Toshow() {
  256. this.show = true;
  257. },
  258. onChange(val) {
  259. let obj = this;
  260. console.log(val, 'onChange')
  261. let arr = val.split(',');
  262. obj.hospital = arr[1];
  263. obj.hospital_id = arr[0];
  264. obj.city = arr[2];
  265. obj.city_id = arr[3];
  266. obj.district = arr[4];
  267. obj.district_id = arr[5];
  268. obj.province = arr[6];
  269. obj.province_id = arr[7];
  270. obj.addr = obj.province + obj.city + obj.district;
  271. console.log(obj.hospital, obj.hospital_id)
  272. console.log(obj.city, obj.city_id)
  273. console.log(obj.district, obj.district_id)
  274. console.log(obj.province, obj.province_id)
  275. },
  276. onConfirm1(val) {},
  277. onSearchInput(val) {
  278. this.searchVal = val;
  279. },
  280. //加载医院列表
  281. ListDate() {
  282. let obj = this;
  283. let data = '';
  284. console.log(obj.searchVal)
  285. if (!obj.searchVal) {
  286. data = {
  287. keyword: '',
  288. province_id: obj.province_id,
  289. city_id: obj.city_id,
  290. district_id: obj.district_id,
  291. sort: 'id desc',
  292. page: 1,
  293. limit: 1500,
  294. }
  295. } else {
  296. data = {
  297. keyword: obj.searchVal,
  298. sort: 'id desc',
  299. page: 1,
  300. limit: 1500,
  301. }
  302. }
  303. getHospitalList(data).then(e => {
  304. obj.list = e.data.list;
  305. }).catch((e) => {
  306. console.log(e)
  307. });
  308. },
  309. //阅读并同意
  310. Getcheckbox() {
  311. let obj = this;
  312. obj.checked = !obj.checked;
  313. },
  314. //提交
  315. confirm() {
  316. let obj = this;
  317. if (obj.loading) {
  318. return
  319. }
  320. if (obj.name == '') {
  321. this.$api.msg('请填写姓名!');
  322. return;
  323. }
  324. if (obj.gender_id == '') {
  325. this.$api.msg('请选择姓别!');
  326. return;
  327. }
  328. if (obj.mobile == '') {
  329. this.$api.msg('请输入联系方式!');
  330. return;
  331. }
  332. if (obj.hospital_id == '') {
  333. this.$api.msg('请选择医院!');
  334. return;
  335. }
  336. if (obj.level_id == '') {
  337. this.$api.msg('请选择职称!');
  338. return;
  339. }
  340. if (obj.zyid == '') {
  341. this.$api.msg('请选择专业!');
  342. return;
  343. }
  344. if (obj.checked == false) {
  345. this.$api.msg('阅读并同意医生《入驻协议》');
  346. return;
  347. }
  348. obj.loading = true
  349. setDoctor({
  350. name: obj.name,
  351. mobile: obj.mobile,
  352. province: obj.province,
  353. province_id: obj.province_id,
  354. city: obj.city,
  355. city_id: obj.city_id,
  356. district: obj.district,
  357. district_id: obj.district_id,
  358. hospital: obj.hospital_id,
  359. gender: obj.gender_id,
  360. // id_card:obj.id_card,
  361. doctor_level: obj.level_id,
  362. type: obj.zyid
  363. }).then(function(e) {
  364. obj.loading = false
  365. //注册医生完成后更新用户信息
  366. obj.userInfo();
  367. uni.navigateTo({
  368. url: '/pages/public/DocRegisterIndex'
  369. })
  370. uni.setStorageSync('ysinfo', {
  371. name: obj.name,
  372. mobile: obj.mobile,
  373. province: obj.province,
  374. province_id: obj.province_id,
  375. city: obj.city,
  376. city_id: obj.city_id,
  377. district: obj.district,
  378. district_id: obj.district_id,
  379. hospital: obj.hospital,
  380. hospital_id: obj.hospital_id,
  381. gender_id: obj.gender_id,
  382. gender: obj.gender,
  383. doctor_level: obj.doctor_level,
  384. level_id: obj.level_id,
  385. zyid: obj.zyid,
  386. zyname: obj.zyname,
  387. addr : obj.province + obj.city + obj.district
  388. })
  389. }).catch(e => {
  390. obj.loading = false
  391. console.log(e)
  392. });
  393. },
  394. //选择身份后更新用户信息
  395. userInfo() {
  396. let obj = this;
  397. getUserInfo({})
  398. .then(function(e) {
  399. uni.setStorageSync('userInfo', e.data);
  400. })
  401. .catch(function(e) {
  402. console.log(e);
  403. });
  404. },
  405. //性别选择
  406. handleTap1(name) {
  407. this.$refs[name].show()
  408. },
  409. //性别选择
  410. handleChange1(item) {},
  411. //性别选择
  412. handleConfirm1(item) {
  413. let obj = this;
  414. obj.gender = item.item.name;
  415. obj.gender_id = item.item.id;
  416. },
  417. //职称选择
  418. handleTap2(name) {
  419. this.$refs[name].show()
  420. },
  421. //职称选择
  422. handleChange2(item) {},
  423. //
  424. handleChange3(item) {
  425. console.log(item)
  426. },
  427. //职称选择
  428. handleConfirm2(item) {
  429. let obj = this;
  430. obj.doctor_level = item.item.name;
  431. obj.level_id = item.item.id;
  432. console.log(obj.doctor_level, obj.level_id)
  433. },
  434. }
  435. };
  436. </script>
  437. <style lang="scss">
  438. page {
  439. background: $page-color-base;
  440. min-height: 100%;
  441. }
  442. .content_box {
  443. background-color: #ffffff;
  444. padding: 0rpx 25rpx;
  445. width: 92%;
  446. margin: 25rpx auto;
  447. border-radius: 15rpx;
  448. .examine_list {
  449. width: 100%;
  450. border-bottom: 2rpx solid #f0f0f0;
  451. .textarea-box {
  452. width: 95%;
  453. margin: 25rpx auto;
  454. .textarea {
  455. width: 100%;
  456. font-size: 28rpx;
  457. min-height: 150rpx;
  458. }
  459. }
  460. }
  461. }
  462. .row {
  463. display: flex;
  464. align-items: center;
  465. // position: relative;
  466. padding: 0 30rpx;
  467. height: 110rpx;
  468. background: #fff;
  469. border-bottom: 1rpx solid #f8f6f6;
  470. .tit {
  471. flex-shrink: 0;
  472. width: 180rpx;
  473. font-size: 30rpx;
  474. color: $font-color-dark;
  475. }
  476. .input {
  477. flex: 1;
  478. font-size: 30rpx;
  479. color: $font-color-dark;
  480. }
  481. .iconlocation {
  482. font-size: 36rpx;
  483. color: $font-color-light;
  484. }
  485. }
  486. .examine_name {
  487. color: #171717;
  488. font-size: 28rpx;
  489. padding: 25rpx 25rpx;
  490. }
  491. .examine_img {
  492. width: 100%;
  493. text-align: center;
  494. padding-bottom: 25rpx;
  495. .image {
  496. width: 150rpx;
  497. height: 150rpx;
  498. }
  499. .image1 {
  500. min-width: 150rpx;
  501. max-width: 100%;
  502. min-height: 150rpx;
  503. }
  504. }
  505. .add-img-box {
  506. width: 100%;
  507. flex-direction: row;
  508. flex-wrap: wrap;
  509. margin-top: 50rpx;
  510. }
  511. .add-img-item {
  512. border-radius: 24rpx;
  513. position: relative;
  514. margin-bottom: 25rpx;
  515. .add-img {
  516. min-width: 150rpx;
  517. max-width: 100%;
  518. min-height: 150rpx;
  519. }
  520. }
  521. .add-img-del {
  522. position: absolute;
  523. width: 40rpx;
  524. height: 40rpx;
  525. right: 20rpx;
  526. // bottom: 155rpx;
  527. //background-color: rgba(238, 0, 0, 1);
  528. border-radius: 20rpx;
  529. }
  530. .default-row {
  531. margin-top: 16rpx;
  532. .tit {
  533. flex: 1;
  534. }
  535. switch {
  536. transform: translateX(16rpx) scale(0.9);
  537. }
  538. }
  539. .add-btn {
  540. position: fixed;
  541. bottom: 0rpx;
  542. width: 100%;
  543. height: 100rpx;
  544. font-size: $font-lg;
  545. color: #fff;
  546. background-color: #6786FB;
  547. line-height: 100rpx;
  548. text-align: center;
  549. }
  550. .img_box {
  551. padding: 35rpx 35rpx;
  552. width: 250rpx;
  553. height: 250rpx;
  554. }
  555. .img_box image {
  556. width: 100%;
  557. height: 100%;
  558. }
  559. .alert-box {
  560. background-color: #ffffff;
  561. }
  562. .b-b:after {
  563. position: relative !important;
  564. }
  565. .check_box {
  566. padding: 25rpx 25rpx;
  567. font-size: 28rpx;
  568. text {
  569. color: #6786FB;
  570. }
  571. }
  572. </style>