registerDoctor.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. <template>
  2. <view class="content">
  3. <view class="content">
  4. <view class="inner">
  5. <view class="bg">
  6. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/74645f3b57bc45b08b35e2449fdf90c7.jpg"></image>
  7. <view v-if="form.doctorType==1" class="title">医生注册</view>
  8. <view v-if="form.doctorType==1" class="desc">请填写医生资料</view>
  9. <view v-if="form.doctorType==2" class="title">药师注册</view>
  10. <view v-if="form.doctorType==2" class="desc">请填写药师资料</view>
  11. </view>
  12. <view class="my-form" >
  13. <u-form :rules="rules" :model="form" ref="uForm" labelPosition="left" errorType="toast">
  14. <u-form-item labelWidth="180rpx" borderBottom label="真实姓名" prop="doctorName">
  15. <u-input border="none" placeholder="请输入真实姓名" v-model="form.doctorName" />
  16. </u-form-item>
  17. <u-form-item labelWidth="180rpx" borderBottom label="身份证号" prop="idCard">
  18. <u-input border="none" placeholder="请输入身份证号" v-model="form.idCard" />
  19. </u-form-item>
  20. <u-form-item labelWidth="180rpx" borderBottom label="性别" prop="sex">
  21. <u-radio-group
  22. placement="row"
  23. v-model="form.sex"
  24. >
  25. <u-radio
  26. activeColor="#2583EB"
  27. :customStyle="{marginRight: '8px'}"
  28. key="1"
  29. label="男"
  30. name="1"
  31. >
  32. </u-radio>
  33. <u-radio
  34. activeColor="#2583EB"
  35. key="2"
  36. label="女"
  37. name="2"
  38. >
  39. </u-radio>
  40. </u-radio-group>
  41. </u-form-item>
  42. <u-form-item labelWidth="180rpx" prop="cityIds" @click="cityShow=true" borderBottom label="所在城市">
  43. <u-input
  44. v-model="form.cityName"
  45. disabled
  46. disabledColor="#ffffff"
  47. placeholder="请选择所在城市"
  48. border="none"
  49. ></u-input>
  50. <template #right>
  51. <u-icon
  52. name="arrow-right"
  53. ></u-icon>
  54. </template>
  55. </u-form-item>
  56. <template v-if="form.doctorType==1">
  57. <!-- <u-form-item labelWidth="180rpx" prop="hospitalId" @click="hospitalShow=true" borderBottom label="就职医院">
  58. <u-input
  59. v-model="form.hospitalName"
  60. disabled
  61. disabledColor="#ffffff"
  62. placeholder="请选择医院"
  63. border="none"
  64. ></u-input>
  65. <template #right>
  66. <u-icon
  67. name="arrow-right"
  68. ></u-icon>
  69. </template>
  70. </u-form-item> -->
  71. <u-form-item labelWidth="180rpx" prop="deptId" @click="deptShow=true" borderBottom label="所属科室">
  72. <u-input
  73. v-model="form.deptName"
  74. disabled
  75. disabledColor="#ffffff"
  76. placeholder="请选择科室"
  77. border="none"
  78. ></u-input>
  79. <template #right>
  80. <u-icon
  81. name="arrow-right"
  82. ></u-icon>
  83. </template>
  84. </u-form-item>
  85. </template>
  86. <u-form-item labelWidth="180rpx" prop="position" @click="positionShow=true" borderBottom label="职称">
  87. <u-input
  88. v-model="form.position"
  89. disabled
  90. disabledColor="#ffffff"
  91. placeholder="请选择职称"
  92. border="none"
  93. ></u-input>
  94. <template #right>
  95. <u-icon
  96. name="arrow-right"
  97. ></u-icon>
  98. </template>
  99. </u-form-item>
  100. <u-form-item labelWidth="180rpx" prop="position" @click="storeShow=true" borderBottom label="药店">
  101. <u-input
  102. v-model="form.storeName"
  103. disabled
  104. disabledColor="#ffffff"
  105. placeholder="请选择药店"
  106. border="none"
  107. ></u-input>
  108. <template #right>
  109. <u-icon
  110. name="arrow-right"
  111. ></u-icon>
  112. </template>
  113. </u-form-item>
  114. <template v-if="form.doctorType==1">
  115. <u-form-item labelWidth="180rpx" borderBottom label="擅长领域" prop="">
  116. <u--textarea v-model="form.speciality" placeholder="请输入擅长领域" count ></u--textarea>
  117. </u-form-item>
  118. <u-form-item labelWidth="180rpx" borderBottom label="个人简介" prop="introduction">
  119. <u--textarea v-model="form.introduction" placeholder="请输入个人简介" count ></u--textarea>
  120. </u-form-item>
  121. </template>
  122. <u-form-item labelWidth="180rpx" borderBottom :label="`${typeName}照片`" prop="avatar">
  123. <u-upload
  124. :fileList="fileList1"
  125. @afterRead="afterRead"
  126. @delete="deletePic"
  127. name="1"
  128. multiple
  129. :maxCount="1"
  130. >
  131. </u-upload>
  132. </u-form-item>
  133. <u-form-item labelWidth="180rpx" borderBottom label="身份证照片(正反面)" prop="idCardFrontUrl">
  134. <u-upload
  135. :fileList="fileList2"
  136. @afterRead="afterRead"
  137. @delete="deletePic"
  138. name="2"
  139. multiple
  140. :maxCount="2"
  141. >
  142. </u-upload>
  143. </u-form-item>
  144. <template v-if="form.doctorType==1">
  145. <u-form-item labelWidth="180rpx" borderBottom label="资质证编号" prop="certificateCode">
  146. <u-input border="none" placeholder="请输入资质证编号" v-model="form.certificateCode" />
  147. </u-form-item>
  148. <u-form-item labelWidth="180rpx" borderBottom label="资质证书" prop="certificateImages">
  149. <u-upload
  150. :fileList="fileList3"
  151. @afterRead="afterRead"
  152. @delete="deletePic"
  153. name="3"
  154. :maxCount="3"
  155. ></u-upload>
  156. </u-form-item>
  157. </template>
  158. <u-form-item labelWidth="180rpx" borderBottom label="执业证编号" prop="practiseCode">
  159. <u-input border="none" placeholder="请输入执业证编号" v-model="form.practiseCode" />
  160. </u-form-item>
  161. <u-form-item labelWidth="180rpx" borderBottom label="执业证书" prop="certificateImages">
  162. <u-upload
  163. :fileList="fileList4"
  164. @afterRead="afterRead"
  165. @delete="deletePic"
  166. name="4"
  167. :maxCount="3"
  168. ></u-upload>
  169. <view style="color: red;" v-if="form.doctorType==2">第一张证照上传注册证</view>
  170. </u-form-item>
  171. <u-form-item labelWidth="180rpx" borderBottom label="联系电话" prop="mobile">
  172. <u-input border="none" placeholder="请输入联系电话" v-model="form.mobile" />
  173. </u-form-item>
  174. <u-form-item labelWidth="180rpx" borderBottom label="登录帐号" prop="account">
  175. <u-input border="none" placeholder="请输入登录帐号" v-model="form.account" />
  176. </u-form-item>
  177. <u-form-item labelWidth="180rpx" label="登录密码" prop="password">
  178. <u-input border="none" type="password" placeholder="请输入登录密码" v-model="form.password" />
  179. </u-form-item>
  180. </u-form>
  181. </view>
  182. <view class="agree">
  183. <u-checkbox-group
  184. v-model="checked"
  185. placement="column"
  186. >
  187. <u-checkbox
  188. activeColor="#2583EB"
  189. :customStyle="{marginRight: '8px'}"
  190. :key="1"
  191. label="同意"
  192. :name="1"
  193. >
  194. </u-checkbox>
  195. </u-checkbox-group>
  196. <text class="text" v-show="form.doctorType==1" @click="openContent('doctorRegister')" >{{`《${typeName}注册协议》`}}</text>
  197. <text class="text" v-show="form.doctorType==1" @click="openContent('doctorFiling')" >{{`《${typeName}多机构备案协议》`}}</text>
  198. <text class="text" v-show="form.doctorType==2" @click="openContent('pharmacistRegister')" >{{`《${typeName}注册协议》`}}</text>
  199. </view>
  200. <u-picker ref="cityPicker" @cancel="cityShow = false" keyName="n" @confirm="citySelect" @change="cityChangeHandler" :show="cityShow" :columns="citys"></u-picker>
  201. <u-picker ref="deptPicker" @cancel="deptShow = false" keyName="deptName" @confirm="deptSelect" :show="deptShow" :columns="depts"></u-picker>
  202. <u-picker @cancel="hospitalShow = false" keyName="hospitalName" @confirm="hospitalSelect" :show="hospitalShow" :columns="hospitals"></u-picker>
  203. <u-picker ref="positionPicker" @cancel="positionShow = false" keyName="dictLabel" @confirm="positionSelect" :show="positionShow" :columns="positions"></u-picker>
  204. <u-picker ref="storePicker" @cancel="storeShow = false" keyName="storeName" @confirm="storeSelect" :show="storeShow" :columns="stores"></u-picker>
  205. </view>
  206. <view class="btn-box">
  207. <view class="sub-btn" @click="submit()">提交</view>
  208. </view>
  209. </view>
  210. </view>
  211. </template>
  212. <script>
  213. import {getDictByKey,getHospitalList,getDepartmentList,sendSmsCode,uploadOSS,getCitys} from '@/api/common.js'
  214. import {registerDoctor} from '@/api/user.js'
  215. import { getStoreList } from '@/api/store.js'
  216. export default {
  217. data() {
  218. return {
  219. cityIndex1:0,
  220. cityIndex2:0,
  221. allCitys:[],
  222. citys:[[],[],[]],
  223. cityShow:false,
  224. depts:[[]],
  225. deptShow:false,
  226. hospitals:[[]],
  227. hospitalShow:false,
  228. positions:[[]],
  229. positionShow:false,
  230. fileList1:[],
  231. fileList2:[],
  232. fileList3:[],
  233. fileList4:[],
  234. checked:0,
  235. form:{
  236. sex:"1",
  237. introduction: '',
  238. speciality:''
  239. },
  240. rules: {
  241. doctorName: [
  242. {
  243. required: true,
  244. message: '请输入真实姓名',
  245. }
  246. ],
  247. idCard: [
  248. {
  249. required: true,
  250. message: '请输入身份证号',
  251. // 可以单个或者同时写两个触发验证方式
  252. trigger: ['change','blur'],
  253. }
  254. ],
  255. position: [
  256. {
  257. required: true,
  258. message: '请选择职务',
  259. }
  260. ],
  261. cityIds: [
  262. {
  263. required: true,
  264. message: '请选择所在城市',
  265. }
  266. ],
  267. account: [
  268. {
  269. required: true,
  270. message: '请输入帐号',
  271. }
  272. ],
  273. password: [
  274. {
  275. required: true,
  276. message: '请输入密码',
  277. }
  278. ],
  279. mobile: [
  280. {
  281. required: true,
  282. message: '请输入手机号',
  283. // 可以单个或者同时写两个触发验证方式
  284. trigger: ['change','blur'],
  285. }
  286. ],
  287. practiseCode : [
  288. {
  289. required: true,
  290. message: '请输入执业证编号',
  291. trigger: ['change','blur'],
  292. }
  293. ]
  294. },
  295. typeName: '',
  296. storeShow: false,
  297. stores: [[]]
  298. }
  299. },
  300. onLoad(options) {
  301. this.form.doctorType=options.type;
  302. this.typeName= options.type==1 ? '医生':options.type==2 ? '药师' : ''
  303. uni.setNavigationBarTitle({
  304. title: options.type==1 ? '医生注册':options.type==2 ? '药师注册' : ''
  305. })
  306. this.getCitys()
  307. this.getHospitalList();
  308. this.getDepartmentList();
  309. this.getStoreList()
  310. if(options.type==1) {
  311. }
  312. this.getDictByKey();
  313. },
  314. onShow() {
  315. },
  316. onReady() {
  317. this.$refs.uForm.setRules(this.rules);
  318. },
  319. methods: {
  320. hospitalSelect(e){
  321. this.form.hospitalId=this.hospitals[0][e.indexs[0]].hospitalId;
  322. this.form.hospitalName=this.hospitals[0][e.indexs[0]].hospitalName;
  323. this.hospitalShow=false;
  324. },
  325. deptSelect(e){
  326. console.log(e)
  327. this.form.deptId=this.depts[0][e.indexs[0]].deptId;
  328. this.form.deptName=this.depts[0][e.indexs[0]].deptName;
  329. this.deptShow=false;
  330. },
  331. positionSelect(e){
  332. console.log(e)
  333. this.form.position=this.positions[0][e.indexs[0]].dictLabel;
  334. this.positionShow=false;
  335. },
  336. storeSelect(e){
  337. this.form.storeName=this.stores[0][e.indexs[0]].storeName;
  338. this.form.storeId=this.stores[0][e.indexs[0]].storeId;
  339. this.storeShow=false;
  340. },
  341. getDictByKey(key){
  342. var data={key:this.form.doctorType==2?"sys_pharmacist_position":"sys_doc_position"}
  343. getDictByKey(data).then(
  344. res => {
  345. if(res.code==200){
  346. this.positions[0]=res.data;
  347. }
  348. },
  349. err => {
  350. }
  351. );
  352. },
  353. openContent(type){
  354. uni.navigateTo({
  355. url:"/pages_user/agreement?type="+type
  356. })
  357. },
  358. cityChangeHandler(e) {
  359. const {
  360. columnIndex,
  361. index,
  362. // 微信小程序无法将picker实例传出来,只能通过ref操作
  363. picker = this.$refs.cityPicker
  364. } = e
  365. if(columnIndex==0){
  366. this.cityIndex1=index
  367. console.log(this.cityIndex1)
  368. //获取第二列数据
  369. var citys1 = this.allCitys[this.cityIndex1].c;
  370. console.log(citys1)
  371. picker.setColumnValues(1,citys1)
  372. this.cityIndex2=0
  373. var citys2 = this.allCitys[this.cityIndex1].c[this.cityIndex2].c;
  374. picker.setColumnValues(2,citys2)
  375. }
  376. if(columnIndex==1){
  377. this.cityIndex2=index
  378. //获取第三列数据
  379. var citys = this.allCitys[this.cityIndex1].c[this.cityIndex2].c;
  380. console.log(citys)
  381. picker.setColumnValues(2,citys)
  382. }
  383. },
  384. citySelect(e){
  385. console.log(e)
  386. this.form.cityName=e.value[0].n+">"+e.value[1].n+">"+e.value[2].n
  387. this.form.cityIds=e.value[0].v+","+e.value[1].v+","+e.value[2].v;
  388. this.cityShow=false;
  389. },
  390. getCitys(){
  391. var that=this;
  392. var data={}
  393. getCitys(data).then(
  394. res => {
  395. if(res.code==200){
  396. that.allCitys=res.data;
  397. that.citys=[[],[],[]];
  398. that.citys[0]=that.allCitys;
  399. that.citys[1]=that.allCitys[0].c;
  400. that.citys[2]=that.allCitys[0].c[0].c;
  401. console.log(that.citys)
  402. }
  403. },
  404. err => {
  405. }
  406. );
  407. },
  408. getHospitalList(){
  409. var that=this;
  410. var data={}
  411. getHospitalList(data).then(
  412. res => {
  413. if(res.code==200){
  414. that.hospitals[0]=res.data;
  415. console.log(111)
  416. console.log(that.hospitals)
  417. }
  418. },
  419. err => {
  420. }
  421. );
  422. },
  423. getDepartmentList(){
  424. var that=this;
  425. var data={}
  426. getDepartmentList(data).then(
  427. res => {
  428. if(res.code==200){
  429. that.depts[0]=res.data;
  430. }
  431. },
  432. err => {
  433. }
  434. );
  435. },
  436. getStoreList(){
  437. var that=this;
  438. var data={}
  439. getStoreList(data).then(
  440. res => {
  441. if(res.code==200){
  442. that.stores[0]=res.data;
  443. }
  444. },
  445. err => {
  446. }
  447. );
  448. },
  449. deletePic(event) {
  450. this[`fileList${event.name}`].splice(event.index, 1)
  451. },
  452. async afterRead(event) {
  453. // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
  454. let lists = [].concat(event.file)
  455. let fileListLen = this[`fileList${event.name}`].length
  456. lists.map((item) => {
  457. this[`fileList${event.name}`].push({
  458. ...item,
  459. status: 'uploading',
  460. message: '上传中'
  461. })
  462. })
  463. for (let i = 0; i < lists.length; i++) {
  464. const result = await this.uploadFilePromise(lists[i].url)
  465. let item = this[`fileList${event.name}`][fileListLen]
  466. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  467. status: 'success',
  468. message: '',
  469. url: result
  470. }))
  471. fileListLen++
  472. }
  473. },
  474. uploadFilePromise(url) {
  475. return new Promise((resolve, reject) => {
  476. let a = uni.uploadFile({
  477. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS',
  478. filePath: url,
  479. name: 'file',
  480. formData: {
  481. user: 'test'
  482. },
  483. success: (res) => {
  484. setTimeout(() => {
  485. // console.log(JSON.parse(res.data).url)
  486. resolve(JSON.parse(res.data).url)
  487. }, 1000)
  488. }
  489. });
  490. })
  491. },
  492. register(){
  493. registerDoctor(this.form).then(
  494. res => {
  495. console.log(res)
  496. if(res.code==200){
  497. uni.showToast({
  498. icon:'none',
  499. title:res.msg,
  500. });
  501. setTimeout(function() {
  502. uni.navigateBack({
  503. delta: 1
  504. })
  505. }, 2000);
  506. }else{
  507. uni.showToast({
  508. icon:'none',
  509. title: res.msg,
  510. });
  511. }
  512. },
  513. rej => {
  514. console.log(rej)
  515. }
  516. );
  517. },
  518. submit(){
  519. var that=this;
  520. if(this.fileList1.length>0){
  521. this.form.avatar=this.fileList1[0].url
  522. }
  523. if(this.fileList2.length>0){
  524. var images=[]
  525. that.fileList2.forEach(function(item) {
  526. images.push(item.url)
  527. });
  528. if(images.length!=2){
  529. uni.showToast({
  530. icon:'none',
  531. title:"请上传身份证照片(正反面)",
  532. });
  533. return
  534. }
  535. console.log(that.fileList2,"images==",images)
  536. this.form.idCardFrontUrl=images[0];
  537. this.form.idCardBackUrl=images[1];
  538. }
  539. if(!this.form.idCardFrontUrl || !this.form.idCardBackUrl) {
  540. uni.showToast({
  541. icon:'none',
  542. title:"请上传身份证照片(正反面)",
  543. });
  544. return
  545. }
  546. if(this.fileList3.length>0){
  547. var images=[]
  548. that.fileList3.forEach(function(item) {
  549. images.push(item.url)
  550. });
  551. this.form.certificateImages=images.toString();
  552. }
  553. if(this.fileList4.length>0){
  554. var images=[]
  555. that.fileList4.forEach(function(item) {
  556. images.push(item.url)
  557. });
  558. this.form.practiseImages=images.toString();
  559. } else {
  560. uni.showToast({
  561. icon:'none',
  562. title:"请上传职业证书",
  563. });
  564. return
  565. }
  566. if(this.checked!=1){
  567. uni.showToast({
  568. icon:'none',
  569. title:"请同意协议",
  570. });
  571. return
  572. }
  573. console.log(this.form)
  574. // deptId: [
  575. // {
  576. // required: true,
  577. // message: '请选择部门'
  578. // }
  579. // ],
  580. // hospitalId: [
  581. // {
  582. // required: true,
  583. // message: '请选择医院'
  584. // }
  585. // ],
  586. this.$refs.uForm.validate().then(res => {
  587. if(that.form.doctorType == 1&& !that.form.deptId) {
  588. uni.showToast({
  589. title: '请选择科室',
  590. icon: 'none'
  591. })
  592. return
  593. }
  594. if(that.form.doctorType == 1&&!that.form.speciality) {
  595. uni.showToast({
  596. title: '请输入擅长领域',
  597. icon: 'none'
  598. })
  599. return
  600. }
  601. if(!that.form.storeId) {
  602. uni.showToast({
  603. title: '请选择药店',
  604. icon: 'none'
  605. })
  606. return
  607. }
  608. that.register()
  609. }).catch(errors => {
  610. console.log(errors)
  611. })
  612. },
  613. }
  614. }
  615. </script>
  616. <style scoped lang="scss">
  617. .content{
  618. display: flex;
  619. flex-direction: column;
  620. justify-content: flex-start;
  621. .inner{
  622. padding: 20upx 20rpx 120rpx;
  623. .bg{
  624. width: 100%;
  625. height: 300rpx;
  626. position: relative;
  627. display: flex;
  628. flex-direction: column;
  629. justify-content: center;
  630. align-items: flex-start;
  631. image{
  632. position: absolute;
  633. border-radius: 30rpx 30rpx 0rpx 0rpx;
  634. width: 100%;
  635. height: 100%;
  636. }
  637. .title{
  638. z-index: 999;
  639. padding: 0rpx 30rpx;
  640. font-size: 40upx;
  641. font-family: PingFang SC;
  642. font-weight: bold;
  643. color: #FFFFFF;
  644. }
  645. .desc{
  646. z-index: 999;
  647. padding: 0rpx 30rpx;
  648. margin-top: 20rpx;
  649. font-size: 28upx;
  650. opacity: 0.5;
  651. font-family: PingFang SC;
  652. color: #FFFFFF;
  653. }
  654. }
  655. .my-form{
  656. z-index: 1;
  657. background-color: #FFFFFF;
  658. padding: 0 30upx;
  659. input{
  660. text-align: right;
  661. }
  662. }
  663. }
  664. .agree{
  665. padding: 10rpx 20rpx;
  666. display: flex;
  667. align-items: center;
  668. justify-content: flex-start;
  669. .label{
  670. font-size: 24rpx;
  671. }
  672. .text{
  673. margin-left: 10rpx;
  674. color: royalblue;
  675. font-size: 24rpx;
  676. }
  677. }
  678. .btn-box{
  679. z-index: 9999;
  680. width: 100%;
  681. position: fixed;
  682. bottom: 0;
  683. height: 120upx;
  684. padding: 0 30upx;
  685. display: flex;
  686. align-items: center;
  687. justify-content: center;
  688. background: #FFFFFF;
  689. .sub-btn{
  690. width: 100%;
  691. height: 88upx;
  692. line-height: 88upx;
  693. text-align: center;
  694. font-size: 30upx;
  695. font-family: PingFang SC;
  696. font-weight: bold;
  697. color: #FFFFFF;
  698. background: #2583EB;
  699. border-radius: 44upx;
  700. }
  701. }
  702. }
  703. </style>