addUser.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <view class="form-box">
  5. <text class="form-title">基本信息</text>
  6. <view class="form-item justify-between">
  7. <text class="label">头像</text>
  8. <view class="right">
  9. <image :src="maleurl" class="w90 h90"></image>
  10. <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
  11. <!-- <button class="wx-head" type="balanced" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  12. </button> -->
  13. </view>
  14. </view>
  15. <view class="form-item">
  16. <text class="label">性别</text>
  17. <view class="sex-box">
  18. <view :class="form.sex===1?'sex-item active':'sex-item'" @click="sexChange(1)" >
  19. <u-icon name="man" :color="form.sex===1?'#FF5030':'#898E91'" size="20"></u-icon>
  20. <text>男</text>
  21. </view>
  22. <view :class="form.sex===2?'sex-item active':'sex-item'" @click="sexChange(2)" >
  23. <u-icon name="woman" :color="form.sex===2?'#FF5030':'#898E91'" size="20"></u-icon>
  24. <text>女</text>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="form-item">
  29. <text class="label">出生年月</text>
  30. <picker class="birth-picker" mode="date" @change="bindDateChange">
  31. <view class="right-box">
  32. <view class="input-box">
  33. <input type="text" :value="form.birthday" placeholder="请选择出生年月" placeholder-class="form-input" disabled="disabled" />
  34. </view>
  35. <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
  36. </view>
  37. </picker>
  38. </view>
  39. <view class="form-item">
  40. <text class="label">手机号</text>
  41. <input maxlength="11" class="input-width" type="idcard" v-model="form.idCard" placeholder="请输入手机号" placeholder-class="form-input" />
  42. </view>
  43. <view class="form-item">
  44. <text class="label">身份证号</text>
  45. <input maxlength="18" class="input-width" type="idcard" v-model="form.idCard" placeholder="请如实填写身份证号" placeholder-class="form-input" />
  46. </view>
  47. <view class="form-item">
  48. <text class="label">退休前工作单位</text>
  49. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入工作单位"
  50. placeholder-class="form-input" />
  51. </view>
  52. <view class="form-item">
  53. <text class="label">可支配收入</text>
  54. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入支配收入"
  55. placeholder-class="form-input" />
  56. </view>
  57. <view class="form-item">
  58. <text class="label">实际消费</text>
  59. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入实际消费"
  60. placeholder-class="form-input" />
  61. </view>
  62. </view>
  63. <view class="form-box">
  64. <text class="form-title">家庭地址及居住情况</text>
  65. <view class="form-item">
  66. <text class="label">市区</text>
  67. <picker class="birth-picker" mode="region" @change="bindDateChange">
  68. <view class="right-box">
  69. <view class="input-box">
  70. <input type="text" :value="form.birthday" placeholder="请选择市区" placeholder-class="form-input" disabled="disabled" />
  71. </view>
  72. <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
  73. </view>
  74. </picker>
  75. </view>
  76. <view class="form-item">
  77. <text class="label">小区名称</text>
  78. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入小区名称"
  79. placeholder-class="form-input" />
  80. </view>
  81. <view class="form-item">
  82. <text class="label">门牌</text>
  83. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入门牌号"
  84. placeholder-class="form-input" />
  85. </view>
  86. <view class="form-item">
  87. <text class="label">面积</text>
  88. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入面积"
  89. placeholder-class="form-input" />
  90. </view>
  91. <view class="form-item">
  92. <text class="label">楼层</text>
  93. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入楼层"
  94. placeholder-class="form-input" />
  95. </view>
  96. </view>
  97. <view class="form-box">
  98. <text class="form-title">家庭情况</text>
  99. <view class="form-item">
  100. <text class="label">伴侣</text>
  101. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入伴侣姓名"
  102. placeholder-class="form-input" />
  103. </view>
  104. <view class="form-item">
  105. <text class="label">伴侣年龄</text>
  106. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入伴侣年龄"
  107. placeholder-class="form-input" />
  108. </view>
  109. <view class="form-item">
  110. <text class="label">子辈单位</text>
  111. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入子辈工作单位"
  112. placeholder-class="form-input" />
  113. </view>
  114. <view class="form-item">
  115. <text class="label">孙辈学校</text>
  116. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入所在学校"
  117. placeholder-class="form-input" />
  118. </view>
  119. </view>
  120. <view class="form-box">
  121. <text class="form-title">会员情况</text>
  122. <view class="form-item">
  123. <text class="label">是否是会员</text>
  124. <picker class="birth-picker" mode="selector" @change="bindDateChange" :range="array">
  125. <view class="right-box">
  126. <view class="input-box">
  127. <input type="text" :value="form.birthday" placeholder="请选择是否是会员" placeholder-class="form-input" disabled="disabled" />
  128. </view>
  129. <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
  130. </view>
  131. </picker>
  132. </view>
  133. <view class="form-item">
  134. <text class="label">会员分类</text>
  135. <picker class="birth-picker" mode="date" @change="bindDateChange">
  136. <view class="right-box">
  137. <view class="input-box">
  138. <input type="text" :value="form.birthday" placeholder="请选择会员分类" placeholder-class="form-input" disabled="disabled" />
  139. </view>
  140. <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
  141. </view>
  142. </picker>
  143. </view>
  144. <view class="form-item">
  145. <text class="label">加入时间</text>
  146. <picker class="birth-picker" mode="date" @change="bindDateChange">
  147. <view class="right-box">
  148. <view class="input-box">
  149. <input type="text" :value="form.birthday" placeholder="请选择加入时间" placeholder-class="form-input" disabled="disabled" />
  150. </view>
  151. <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
  152. </view>
  153. </picker>
  154. </view>
  155. <view class="form-item">
  156. <text class="label">到期时间</text>
  157. <picker class="birth-picker" mode="date" @change="bindDateChange">
  158. <view class="right-box">
  159. <view class="input-box">
  160. <input type="text" :value="form.birthday" placeholder="请选择到期时间" placeholder-class="form-input" disabled="disabled" />
  161. </view>
  162. <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
  163. </view>
  164. </picker>
  165. </view>
  166. <view class="form-item">
  167. <text class="label">管理月份</text>
  168. <picker class="birth-picker" mode="date" fields="month" @change="bindDateChange">
  169. <view class="right-box">
  170. <view class="input-box">
  171. <input type="text" :value="form.birthday" placeholder="请选择管理月份" placeholder-class="form-input" disabled="disabled" />
  172. </view>
  173. <image class="w48 h48" src="/static/images/health/right_arrow_right_icon24.png"></image>
  174. </view>
  175. </picker>
  176. </view>
  177. </view>
  178. <view class="form-box">
  179. <text class="form-title">特殊情况</text>
  180. <view class="form-item">
  181. <text class="label">职位</text>
  182. <input class="input-width" type="text" v-model="form.userName" placeholder="请输入职位"
  183. placeholder-class="form-input" />
  184. </view>
  185. <view class="form-item">
  186. <text class="label">癖好</text>
  187. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入癖好"
  188. placeholder-class="form-input" />
  189. </view>
  190. <view class="form-item">
  191. <text class="label">平日喜好</text>
  192. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入平日喜好"
  193. placeholder-class="form-input" />
  194. </view>
  195. <view class="form-item">
  196. <text class="label">信仰</text>
  197. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入信仰"
  198. placeholder-class="form-input" />
  199. </view>
  200. <view class="form-item">
  201. <text class="label">担忧</text>
  202. <input maxlength="10" class="input-width" type="text" v-model="form.userName" placeholder="请输入信仰"
  203. placeholder-class="form-input" />
  204. </view>
  205. </view>
  206. <view class="form-box">
  207. <text class="form-title">其他</text>
  208. <view class="form-item">
  209. <!-- <text class="label">备注</text> -->
  210. <textarea maxlength="200" class="form-textarea" v-model="form.remark" placeholder="请输入用户想解决的问题" />
  211. </view>
  212. <view class="form-item">
  213. <!-- <text class="label">备注</text> -->
  214. <textarea maxlength="200" class="form-textarea" v-model="form.remark" placeholder="请输入健康管理师对用户的建议" />
  215. </view>
  216. </view>
  217. </view>
  218. <view class="btn-box">
  219. <view class="sub-btn" @click="submit()">保存</view>
  220. </view>
  221. </view>
  222. </template>
  223. <script>
  224. import {
  225. getDocDetails,
  226. addDoc,
  227. editDoc
  228. } from '@/api/doc.js'
  229. export default {
  230. data() {
  231. return {
  232. type: null,
  233. patientId: null,
  234. famaleurl:"/static/images/health/female_profile.png",
  235. maleurl:"/static/images/health/my_heads.png",
  236. checked:1,
  237. array:['是','否'],
  238. tags: [{
  239. name: '心脏病',
  240. checked:true,
  241. id: 1
  242. },
  243. {
  244. name: '脑梗死',
  245. checked:false,
  246. id: 2
  247. },{
  248. name: '肾病',
  249. checked:false,
  250. id: 3
  251. },{
  252. name: '脂肪肝',
  253. checked:false,
  254. id: 4
  255. }],
  256. form: {
  257. userName: null,
  258. idCard: null,
  259. sex: null,
  260. birthday: null,
  261. remark: null,
  262. }
  263. };
  264. },
  265. onLoad(option) {
  266. this.type = option.type;
  267. console.log(this.type)
  268. if (this.type == 'edit') {
  269. this.docId = option.docId;
  270. // this.getDocDetails();
  271. }
  272. },
  273. methods: {
  274. sexChange(type) {
  275. this.form.sex = type
  276. },
  277. radioClick(item) {
  278. this.checked=item.id
  279. },
  280. getDocDetails() {
  281. var data = {
  282. docId: this.docId
  283. };
  284. getDocDetails(data).then(
  285. res => {
  286. if (res.code == 200) {
  287. this.form = res.data;
  288. } else {
  289. uni.showToast({
  290. title: res.msg,
  291. });
  292. }
  293. },
  294. rej => {}
  295. );
  296. },
  297. onChooseAvatar(e){
  298. let {
  299. avatarUrl
  300. } = e.detail;
  301. uni.uploadFile({
  302. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', //仅为示例,非真实的接口地址
  303. filePath: avatarUrl,
  304. name: 'file',
  305. formData: {
  306. 'user': 'test' // 上传附带参数
  307. },
  308. success: (uploadFileRes) => {
  309. this.user.avatar =JSON.parse(uploadFileRes.data).url
  310. }
  311. });
  312. },
  313. submit() {
  314. // if (this.form.userName == null) {
  315. // uni.showToast({
  316. // icon: 'none',
  317. // title: "姓名不能为空",
  318. // });
  319. // return;
  320. // }
  321. // if (this.form.idCard == null) {
  322. // uni.showToast({
  323. // icon: 'none',
  324. // title: "身份证号不能为空",
  325. // });
  326. // return;
  327. // }
  328. // if (this.form.sex == null) {
  329. // uni.showToast({
  330. // icon: 'none',
  331. // title: "性别不能为空",
  332. // });
  333. // return;
  334. // }
  335. // if (this.form.birthday == null) {
  336. // uni.showToast({
  337. // icon: 'none',
  338. // title: "出生年月不能为空",
  339. // });
  340. // return;
  341. // }
  342. // if (this.type == "add") {
  343. // this.addDoc()
  344. // } else if (this.type == "edit") {
  345. // this.editDoc()
  346. // }
  347. uni.navigateTo({
  348. url: '/pages_health/doc?type=edit&docId='
  349. })
  350. },
  351. editDoc() {
  352. editDoc(this.form).then(
  353. res => {
  354. if (res.code == 200) {
  355. uni.showToast({
  356. icon: 'success',
  357. title: "操作成功",
  358. });
  359. setTimeout(function() {
  360. uni.$emit('refreshDoc');
  361. uni.navigateBack({
  362. delta: 1
  363. })
  364. }, 500);
  365. } else {
  366. uni.showToast({
  367. icon: 'none',
  368. title: res.msg,
  369. });
  370. }
  371. },
  372. rej => {}
  373. );
  374. },
  375. addDoc() {
  376. addDoc(this.form).then(
  377. res => {
  378. if (res.code == 200) {
  379. uni.showToast({
  380. icon: 'success',
  381. title: "操作成功",
  382. });
  383. setTimeout(function() {
  384. uni.$emit('refreshDoc');
  385. uni.navigateBack({
  386. delta: 1
  387. })
  388. }, 500);
  389. } else {
  390. uni.showToast({
  391. icon: 'none',
  392. title: res.msg,
  393. });
  394. }
  395. },
  396. rej => {}
  397. );
  398. },
  399. // 出生日期选择
  400. bindDateChange: function(e) {
  401. this.form.birthday = e.target.value
  402. },
  403. }
  404. }
  405. </script>
  406. <style lang="scss">
  407. page {
  408. height: 100%;
  409. }
  410. .content {
  411. height: 100%;
  412. display: flex;
  413. flex-direction: column;
  414. justify-content: space-between;
  415. .inner {
  416. // height: calc(100% - 120upx);
  417. padding: 20upx;
  418. .form-box {
  419. padding: 0 30upx;
  420. background: #FFFFFF;
  421. border-radius: 16upx;
  422. margin-bottom: 20upx;
  423. .form-title {
  424. font-family: PingFang SC;
  425. font-weight: 600;
  426. font-size: 40rpx;
  427. color: #222426;
  428. text-align: left;
  429. padding: 30rpx 0;
  430. display: block;
  431. }
  432. .form-item {
  433. padding: 30upx 0;
  434. display: flex;
  435. align-items: flex-start;
  436. border-bottom: 1px solid #F1F1F1;
  437. &:last-child {
  438. border-bottom: none;
  439. }
  440. .label {
  441. width: 300upx;
  442. text-align: left;
  443. font-size: 32upx;
  444. line-height: 44upx;
  445. font-family: PingFang SC;
  446. font-weight: 500;
  447. color: #222222;
  448. flex-shrink: 0;
  449. }
  450. input {
  451. text-align: right;
  452. }
  453. .form-input {
  454. font-size: 30upx;
  455. font-family: PingFang SC;
  456. font-weight: 500;
  457. color: #999999;
  458. text-align: right;
  459. }
  460. .form-item-tag{
  461. margin-right: 16rpx;
  462. .tag{
  463. border-radius: 8rpx 8rpx 8rpx 8rpx;
  464. border: 2rpx solid #ECECEC;
  465. display: flex;
  466. align-items: center;
  467. padding: 24rpx;
  468. font-family: PingFang SC;
  469. font-weight: 400;
  470. font-size: 24rpx;
  471. &.active{
  472. background: #F0FAFF;
  473. border: 2rpx solid #008FD3;
  474. color: #008FD3;
  475. }
  476. }
  477. }
  478. .right{
  479. display: flex;
  480. align-items: center;
  481. }
  482. .sex-box{
  483. flex:1;
  484. display: flex;
  485. align-items: center;
  486. justify-content: flex-end;
  487. .sex-item{
  488. width: 146rpx;
  489. height: 64rpx;
  490. display: flex;
  491. align-items: center;
  492. justify-content: center;
  493. background: #F5F7FA;
  494. border-radius: 32rpx 32rpx 32rpx 32rpx;
  495. margin-left: 16rpx;
  496. .u-icon__icon{
  497. margin: 0;
  498. }
  499. text{
  500. // font-family: PingFang SC, PingFang SC;
  501. font-weight: 400;
  502. font-size: 28rpx;
  503. color: #898E91;
  504. margin-left: 12rpx;
  505. }
  506. &.active{
  507. background: #FCF0E7;
  508. text{
  509. color:#FF5030
  510. }
  511. }
  512. }
  513. }
  514. .form-textarea{
  515. font-size: 30upx;
  516. color: #999999;
  517. height: 100upx;
  518. padding: 4upx 0;
  519. }
  520. .birth-picker {
  521. flex: 1;
  522. display: flex;
  523. align-items: center;
  524. .right-box{
  525. width: 100%;
  526. display: flex;
  527. align-items: center;
  528. .input-box{
  529. // width: 470upx;
  530. }
  531. .arrow{
  532. width: 13upx;
  533. height: 23upx;
  534. margin-left: 20upx;
  535. }
  536. }
  537. }
  538. }
  539. }
  540. }
  541. .btn-box {
  542. height: 120upx;
  543. padding: 0 30upx;
  544. display: flex;
  545. align-items: center;
  546. justify-content: center;
  547. // position: fixed;
  548. // width: 90%;
  549. // bottom: 0;
  550. // left: 50%;
  551. // transform: translate(-50%,-50%);
  552. // background: #FFFFFF;
  553. .sub-btn {
  554. width: 100%;
  555. height: 88upx;
  556. line-height: 88upx;
  557. text-align: center;
  558. font-size: 32upx;
  559. font-family: PingFang SC;
  560. font-weight: bold;
  561. color: #FFFFFF;
  562. background: #008FD3 ;
  563. border-radius: 44upx;
  564. margin-bottom: 40upx;
  565. }
  566. }
  567. }
  568. </style>