doc.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <view v-for="(item,index) in docs" :key="index" class="item" @click="showDetail(item)">
  5. <view class="user-info">
  6. <view class="user-top">
  7. <view class="user-left">
  8. <image :src="maleurl" class="w112 h112"></image>
  9. <view class="ml32">
  10. <view class="name">{{item.userName}}</view>
  11. <view class="age-box" :style="{'background-color':item.sex==1?'#EBF8FF':'#FCF0E7'}">
  12. <u-icon :color="item.sex==1?'#008FD3':'#FF5030'" :name="item.sex==1?'man':'woman'"></u-icon>
  13. <view class="age">{{utils.getAge(item.birthday)}}岁</view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="user-phone">{{utils.parsePhone(item.phone)}}</view>
  18. </view>
  19. <view class="user-bottom">
  20. <view class="btn" @click="navgetTo('/pages_health/buyOrder?type=add')">购买信息</view>
  21. <view class="btn" @click="navgetTo('/pages_health/addUser?type=add')">基本信息</view>
  22. <view class="btn" @click="navgetTo('/pages_health/addDoc?type=add')">健康档案</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view v-if="docs.length == 0" class="no-data-box" @click="getMyDocList()">
  27. <image src="../../static/images/no_data.png" mode="aspectFit"></image>
  28. <view class="empty-title">暂无数据</view>
  29. </view>
  30. </view>
  31. <view class="btn-box">
  32. <view class="sub-btn" @click="addDoc">
  33. <image src="/static/images/health/nav_add_icon24.png" class="w48 h48"></image>
  34. <text>创建用户信息</text>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import {getMyDocList,delDoc} from '@/api/doc.js'
  41. export default {
  42. data() {
  43. return {
  44. famaleurl:"/static/images/health/female_profile.png",
  45. maleurl:"/static/images/health/my_heads.png",
  46. docs:[
  47. {userName:'西航宇',sex:1,birthday:'1990-01-01',phone:'16666666666'},
  48. {userName:'蓝西',sex:2,birthday:'1990-06-01',phone:'1888888888'},
  49. {userName:'西航宇',sex:1,birthday:'1993-01-01',phone:'16666666666'},
  50. {userName:'蓝西',sex:2,birthday:'1994-06-01',phone:'1888888888'},
  51. {userName:'蓝西',sex:2,birthday:'1994-06-01',phone:'1888888888'}
  52. ],
  53. }
  54. },
  55. onLoad() {
  56. // this.getMyDocList()
  57. // uni.$on('refreshDoc', () => {
  58. // this.getMyDocList()
  59. // })
  60. },
  61. methods: {
  62. navgetTo(url){
  63. uni.navigateTo({
  64. url: url
  65. })
  66. },
  67. showDetail(item){
  68. uni.navigateTo({
  69. url: './docDetail?docId='+item.docId
  70. })
  71. },
  72. editDoc(item){
  73. uni.navigateTo({
  74. url: './addDoc?type=edit&docId='+item.docId
  75. })
  76. },
  77. delDoc(item){
  78. uni.showModal({
  79. title:"提示",
  80. content:"确认删除吗?",
  81. showCancel:true,
  82. cancelText:'取消',
  83. confirmText:'确定',
  84. success:res=>{
  85. if(res.confirm){
  86. // 用户点击确定
  87. var data={docId:item.docId}
  88. delDoc(data).then(
  89. res => {
  90. if(res.code==200){
  91. uni.showToast({
  92. icon:'success',
  93. title: "操作成功",
  94. });
  95. this.getMyDocList()
  96. }else{
  97. uni.showToast({
  98. icon:'none',
  99. title: "请求失败",
  100. });
  101. }
  102. },
  103. rej => {}
  104. );
  105. }else{
  106. // 否则点击了取消
  107. }
  108. }
  109. })
  110. },
  111. getMyDocList(){
  112. uni.showLoading({
  113. title:"正在加载中"
  114. })
  115. getMyDocList().then(
  116. res => {
  117. uni.hideLoading()
  118. if(res.code==200){
  119. this.docs=res.data;
  120. }else{
  121. uni.showToast({
  122. icon:'none',
  123. title: "请求失败",
  124. });
  125. }
  126. },
  127. rej => {}
  128. );
  129. },
  130. addDoc() {
  131. uni.navigateTo({
  132. url: '/pages_health/addUser?type=add'
  133. })
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="scss">
  139. page{
  140. height: 100%;
  141. }
  142. .content{
  143. height: 100%;
  144. display: flex;
  145. flex-direction: column;
  146. justify-content: space-between;
  147. .inner{
  148. flex: 1;
  149. padding: 20upx 20upx 160upx;
  150. .item{
  151. background: #FFFFFF;
  152. border-radius: 20upx;
  153. margin-bottom: 20upx;
  154. // padding: 40upx 30upx;
  155. padding: 32rpx;
  156. &:last-child{
  157. margin-bottom: 0;
  158. }
  159. .user-info{
  160. .user-top{
  161. display: flex;
  162. align-items: flex-start;
  163. justify-content: space-between;
  164. border-bottom: 1px solid #ECECEC;
  165. padding-bottom: 40rpx;
  166. .user-left{
  167. display: flex;
  168. align-items: center;
  169. justify-content: flex-start;
  170. .name{
  171. font-family: PingFang SC;
  172. font-weight: 500;
  173. font-size: 36rpx;
  174. color: #222426;
  175. text-align: left;
  176. }
  177. .age-box{
  178. display: flex;
  179. align-items: center;
  180. justify-content: center;
  181. border-radius: 24rpx 24rpx 24rpx 24rpx;
  182. margin-top: 16rpx;
  183. width: 114rpx;
  184. height: 40rpx;
  185. .age{
  186. font-weight: 400;
  187. font-size: 22rpx;
  188. color: #626468;
  189. line-height: 22rpx;
  190. text-align: left;
  191. }
  192. }
  193. }
  194. .user-phone{
  195. font-family: PingFang SC;
  196. font-weight: 500;
  197. font-size: 28rpx;
  198. color: #222426;
  199. text-align: right;
  200. }
  201. }
  202. .user-bottom{
  203. display: flex;
  204. align-items: center;
  205. justify-content: flex-end;
  206. padding-top: 20rpx;
  207. .btn{
  208. width: 176rpx;
  209. height: 60rpx;
  210. border-radius: 30rpx 30rpx 30rpx 30rpx;
  211. border: 1rpx solid #B2B2B2;
  212. font-size: 24rpx;
  213. color: #222426;
  214. line-height: 60rpx;
  215. text-align: center;
  216. margin-left:16rpx ;
  217. &:last-child{
  218. border: 1rpx solid #008FD3;
  219. color: #008FD3;
  220. }
  221. }
  222. }
  223. .gray-tag{
  224. height: 46upx;
  225. line-height: 46upx;
  226. padding: 0 16upx;
  227. font-size: 24upx;
  228. font-family: PingFang SC;
  229. font-weight: 500;
  230. color: #333333;
  231. background: #F7F7F7;
  232. border-radius: 8upx;
  233. margin-right: 10upx;
  234. }
  235. .blue-tag{
  236. height: 46upx;
  237. line-height: 46upx;
  238. padding: 0 16upx;
  239. font-size: 24upx;
  240. font-family: PingFang SC;
  241. font-weight: bold;
  242. color: #4BC9B1;
  243. background: #E2F6F2;
  244. border-radius: 8upx;
  245. }
  246. }
  247. .stage-box{
  248. white-space: nowrap;
  249. overflow: hidden;
  250. text-overflow: ellipsis;
  251. margin-top: 34upx;
  252. .stage{
  253. font-size: 26upx;
  254. font-family: PingFang SC;
  255. font-weight: 500;
  256. color: #111111;
  257. line-height: 1;
  258. }
  259. .stage-text{
  260. font-size: 26upx;
  261. font-family: PingFang SC;
  262. font-weight: 500;
  263. color: #666666;
  264. line-height: 1;
  265. }
  266. }
  267. .progress-box{
  268. margin-top: 18upx;
  269. }
  270. .period{
  271. font-size: 28upx;
  272. font-family: PingFang SC;
  273. font-weight: 500;
  274. color: #999999;
  275. line-height: 1;
  276. margin-top: 40upx;
  277. }
  278. }
  279. }
  280. .btn-box{
  281. z-index: 9999;
  282. width: 100%;
  283. padding: 30upx;
  284. position: fixed;
  285. bottom: 0;
  286. left: 0;
  287. box-sizing: border-box;
  288. // background: #FFFFFF;
  289. .sub-btn{
  290. width: 100%;
  291. height: 88upx;
  292. line-height: 88upx;
  293. text-align: center;
  294. font-size: 30upx;
  295. font-family: PingFang SC;
  296. font-weight: bold;
  297. color: #FFFFFF;
  298. background: #008FD3;
  299. border-radius: 44upx;
  300. display: flex;
  301. align-items: center;
  302. justify-content: center;
  303. image{
  304. margin-right: 16rpx;
  305. }
  306. }
  307. }
  308. }
  309. </style>