PatRegister.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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="请选择性别" placeholder-class="placeholder" />
  11. </view>
  12. <lb-picker ref="picker2" mode="selector" :list="genderList" @change="handleChange1" @confirm="handleConfirm1" @cancel="handleCancel"></lb-picker>
  13. <view class="row b-b">
  14. <text class="tit">联系方式</text>
  15. <input class="input" type="text" v-model="mobile" placeholder="请输入联系方式" placeholder-class="placeholder" />
  16. </view>
  17. <view class="row b-b" @tap="showPicker('region')">
  18. <text class="tit">就诊地区</text>
  19. <input class="input" @focus='outFocus' v-model="addr" placeholder="请选择省市区"/>
  20. </view>
  21. <w-picker mode="region" :value="defaultRegion" default-type="value" @confirm="onConfirm($event,'region')" @cancel="handleCancel" ref="region" ></w-picker>
  22. <view class="row b-b" @tap="Toshow">
  23. <text class="tit">医院名称</text>
  24. <input class="input" type="text" @focus='outFocus' v-model="hospital" placeholder="咨询的医院可在个人中心进行修改" placeholder-class="placeholder" />
  25. </view>
  26. <zhilin-picker
  27. v-model="show"
  28. :title="title"
  29. :data="list"
  30. :initSelected="initSelected"
  31. :showSearch="true"
  32. @change="onChange"
  33. @searchInput='onSearchInput'
  34. @confirm="onConfirm1"
  35. />
  36. </view>
  37. <view class="check_box flex_item">
  38. <view><radio style="transform: scale(0.75)" @click="Getcheckbox" color="#6786FB" :checked="checked" /></view>
  39. <view class="">我已阅读并同意<text @click="TOprivacy">《预约平台用户协议》</text></view>
  40. </view>
  41. <view class="check_box flex_item" style="font-size: 26rpx;">
  42. <view class="">注册完成后,务必关注公众号<text style="color:#6786FB ;">【共享预约平台】</text>,否则无法接收到消息推送!</view>
  43. </view>
  44. <view class="add-btn" @click="confirm">提交申请</view>
  45. </view>
  46. </template>
  47. <script>
  48. import { mapState, mapMutations } from 'vuex';
  49. import uniList from '@/components/uni-list/uni-list.vue';
  50. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  51. import wPicker from "@/components/w-picker/w-picker.vue"
  52. import LbPicker from '@/components/lb-picker/index.vue';
  53. import zhilinPicker from "@/components/zhilin-picker/zhilin-picker.vue"
  54. import { upload, getHospitalList, setPatient } from '@/api/index.js';
  55. import { getUserInfo } from '@/api/login.js';
  56. export default {
  57. components: {
  58. uniList,
  59. uniListItem,
  60. wPicker,
  61. LbPicker,
  62. zhilinPicker
  63. },
  64. data() {
  65. return {
  66. checked:false,
  67. loading: false,
  68. region:'',
  69. defaultRegion:[],
  70. defaultRegion1:[],
  71. options:[],
  72. name: '', //姓名
  73. gender: '', //性别
  74. gender_id: '', //性别id
  75. genderList: [{
  76. id:1,
  77. name:'男'
  78. },{
  79. id:2,
  80. name:'女'
  81. },{
  82. id:0,
  83. name:'其他'
  84. }],
  85. mobile: '', //联系方式
  86. addr: '', //省市区
  87. code: '', //省市区行政编码
  88. province: '',
  89. province_id: '',
  90. city: '',
  91. city_id: '',
  92. district: '',
  93. district_id: '',
  94. searchVal:'',//搜索医院
  95. list: [],//医院列表
  96. show: false,
  97. initSelected: [],
  98. title: '选择医院',
  99. hospital: '', //医院
  100. hospital_id: '' //医院id
  101. };
  102. },
  103. onLoad() {
  104. this.ListDate();
  105. },
  106. watch:{
  107. list(newValue, oldValue) {
  108. if(newValue != oldValue){
  109. this.hospital = ''
  110. }
  111. },
  112. searchVal(){
  113. console.log(222)
  114. this.ListDate();
  115. },
  116. },
  117. methods: {
  118. ...mapMutations(['setUserInfo']),
  119. TOprivacy() {
  120. uni.navigateTo({
  121. url: '/pages/public/uagreement'
  122. })
  123. },
  124. //阅读并同意
  125. Getcheckbox() {
  126. let obj = this;
  127. obj.checked = !obj.checked;
  128. },
  129. //省市区弹窗
  130. showPicker(type){
  131. this.$refs[type].show();
  132. },
  133. //取消弹窗
  134. handleCancel(){
  135. },
  136. outFocus(e){
  137. event.target.blur()
  138. },
  139. // 省市区选择确定
  140. onConfirm(res,type){
  141. let obj = this;
  142. obj.result=res;
  143. obj.addr = res.result;
  144. if(res.name){
  145. obj.province = res.name[0];
  146. obj.city = res.name[1];
  147. obj.district = res.name[2];
  148. }else{
  149. obj.province = '北京市';
  150. obj.city = '北京市';
  151. obj.district = '东城区';
  152. }
  153. obj.province_id = res.value[0];
  154. obj.city_id = res.value[1];
  155. obj.district_id = res.value[2];
  156. obj.hospital = '';//重置医院
  157. obj.ListDate();
  158. },
  159. /*医院*/
  160. Toshow(){
  161. this.show = true;
  162. },
  163. onChange(val){
  164. let obj = this;
  165. console.log(val,'onChange')
  166. let arr = val.split(',');
  167. obj.hospital = arr[1];
  168. obj.hospital_id = arr[0];
  169. obj.city = arr[2];
  170. obj.city_id = arr[3];
  171. obj.district = arr[4];
  172. obj.district_id = arr[5];
  173. obj.province = arr[6];
  174. obj.province_id = arr[7];
  175. obj.addr = obj.province + obj.city + obj.district;
  176. console.log(obj.hospital,obj.hospital_id)
  177. console.log(obj.city,obj.city_id)
  178. console.log(obj.district,obj.district_id)
  179. console.log(obj.province,obj.province_id)
  180. },
  181. onSearchInput(val){
  182. this.searchVal = val;
  183. console.log(this.searchVal)
  184. },
  185. //机构列表
  186. ListDate() {
  187. let obj = this;
  188. let data = '';
  189. console.log(obj.searchVal)
  190. if(!obj.searchVal){
  191. data={
  192. keyword:'',
  193. province_id:obj.province_id,
  194. city_id:obj.city_id,
  195. district_id:obj.district_id,
  196. sort:'id desc',
  197. page:1,
  198. limit:1500,
  199. }
  200. }else{
  201. data={
  202. keyword:obj.searchVal,
  203. sort:'id desc',
  204. page:1,
  205. limit:1500,
  206. }
  207. }
  208. getHospitalList(data).then(e => {
  209. obj.list = e.data.list;
  210. }).catch((e) => {
  211. console.log(e)
  212. });
  213. },
  214. //性别选择
  215. handleTap1(name) {
  216. this.$refs[name].show();
  217. },
  218. //性别选择
  219. handleChange1(item) {},
  220. //性别选择
  221. handleConfirm1(item) {
  222. let obj = this;
  223. obj.gender = item.item.name;
  224. obj.gender_id = item.item.id;
  225. },
  226. //提交
  227. confirm() {
  228. let obj = this;
  229. if(obj.loading) {
  230. return
  231. }
  232. if(!obj.name){
  233. obj.$api.msg('请填写姓名!');
  234. return;
  235. }
  236. if(!obj.gender_id){
  237. obj.$api.msg('请选择姓别!');
  238. return;
  239. }
  240. if(!obj.mobile){
  241. obj.$api.msg('请输入联系方式!');
  242. return;
  243. }
  244. if(!obj.hospital_id){
  245. obj.$api.msg('请选择医院!');
  246. return;
  247. }
  248. if(obj.checked == false){
  249. this.$api.msg('阅读并同意《预约平台用户协议》');
  250. return;
  251. }
  252. setPatient({
  253. name: obj.name,
  254. mobile: obj.mobile,
  255. province: obj.province,
  256. province_id: obj.province_id,
  257. city: obj.city,
  258. city_id: obj.city_id,
  259. district: obj.district,
  260. district_id: obj.district_id,
  261. hospital: obj.hospital_id,
  262. gender: obj.gender_id
  263. })
  264. .then(function(e) {
  265. obj.loading = false
  266. obj.$api.msg(e.msg);
  267. //注册病人完成后更新用户信息
  268. obj.userInfo();
  269. setTimeout(function() {
  270. // uni.switchTab({
  271. // url: '/pages/index/home'
  272. // })
  273. //安卓手机
  274. // document.addEventListener(
  275. // "WeixinJSBridgeReady",
  276. // function() {
  277. // WeixinJSBridge.call("closeWindow");
  278. // },
  279. // false
  280. // );
  281. // //ios手机
  282. // WeixinJSBridge.call("closeWindow");
  283. uni.navigateTo({
  284. url: '/pages/public/erweima'
  285. })
  286. }, 2000);
  287. })
  288. .catch(e => {
  289. obj.loading = false
  290. console.log(e);
  291. });
  292. },
  293. //选择身份后更新用户信息
  294. userInfo() {
  295. getUserInfo({}).then(function(e) {
  296. uni.setStorageSync('userInfo', e.data);
  297. })
  298. .catch(function(e) {
  299. console.log(e);
  300. });
  301. }
  302. }
  303. };
  304. </script>
  305. <style lang="scss">
  306. page {
  307. background: $page-color-base;
  308. min-height: 100%;
  309. padding-top: 25rpx;
  310. }
  311. .content_box {
  312. background-color: #ffffff;
  313. width: 92%;
  314. border-radius: 15rpx;
  315. margin: 0rpx auto;
  316. .examine_list {
  317. width: 100%;
  318. border-bottom: 2rpx solid #f0f0f0;
  319. .textarea-box {
  320. width: 95%;
  321. margin: 25rpx auto;
  322. .textarea {
  323. width: 100%;
  324. font-size: 28rpx;
  325. min-height: 150rpx;
  326. }
  327. }
  328. }
  329. }
  330. .row {
  331. display: flex;
  332. align-items: center;
  333. // position: relative;
  334. padding: 0 30rpx;
  335. height: 110rpx;
  336. background: #fff;
  337. border-bottom: 1rpx solid #f8f6f6;
  338. .tit {
  339. flex-shrink: 0;
  340. width: 180rpx;
  341. font-size: 30rpx;
  342. color: $font-color-dark;
  343. }
  344. .input {
  345. flex: 1;
  346. font-size: 30rpx;
  347. color: $font-color-dark;
  348. }
  349. .iconlocation {
  350. font-size: 36rpx;
  351. color: $font-color-light;
  352. }
  353. }
  354. .examine_name {
  355. color: #171717;
  356. font-size: 28rpx;
  357. padding: 25rpx 25rpx;
  358. }
  359. .examine_img {
  360. width: 100%;
  361. text-align: center;
  362. padding-bottom: 25rpx;
  363. }
  364. .examine_img image {
  365. width: 200rpx;
  366. height: 200rpx;
  367. }
  368. .default-row {
  369. margin-top: 16rpx;
  370. .tit {
  371. flex: 1;
  372. }
  373. switch {
  374. transform: translateX(16rpx) scale(0.9);
  375. }
  376. }
  377. .add-btn {
  378. position: fixed;
  379. bottom: 0rpx;
  380. width: 100%;
  381. height: 100rpx;
  382. font-size: $font-lg;
  383. color: #fff;
  384. background-color: #6786fb;
  385. line-height: 100rpx;
  386. text-align: center;
  387. }
  388. .img_box {
  389. padding: 35rpx 35rpx;
  390. width: 250rpx;
  391. height: 250rpx;
  392. }
  393. .img_box image {
  394. width: 100%;
  395. height: 100%;
  396. }
  397. .alert-box {
  398. background-color: #ffffff;
  399. }
  400. .b-b:after {
  401. position: relative !important;
  402. }
  403. .check_box {
  404. padding: 25rpx 25rpx;
  405. font-size: 20rpx;
  406. padding-bottom: 150rpx;
  407. text {
  408. color: #6786fb;
  409. }
  410. }
  411. </style>