patient.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <view class="content">
  3. <view class="inner">
  4. <view v-for="(item,index) in patient" :key="index" class="peop-item" @click="pickPatient(item)">
  5. <view :class="item.isAuth?'auth':'noauth'">{{item.isAuth?'已实名':'未实名'}}</view>
  6. <view class="info">
  7. <view class="name">{{item.patientName}}</view>
  8. <view class="detail">
  9. <text class="text" v-if="item.gender==1">男</text>
  10. <text class="text" v-if="item.gender==2">女</text>
  11. <text class="text">{{utils.getAge(item.birthday)}}岁</text>
  12. <text class="text">{{utils.parseIdCard(item.idCard)}}</text>
  13. </view>
  14. </view>
  15. <view class="operat-box">
  16. <image src="../../static/images/del1.png" mode="" @click="delPatient(item)" ></image>
  17. <image src="../../static/images/edit.png" mode="" @click="editPatient(item)"></image>
  18. </view>
  19. </view>
  20. <view v-if="patient.length == 0" class="no-data-box" @click="getPatientList()">
  21. <image src="../../static/images/no_data.png" mode="aspectFit"></image>
  22. <view class="empty-title">暂无数据</view>
  23. </view>
  24. </view>
  25. <view class="btn-box">
  26. <view class="sub-btn" @click="addPatient">创建档案</view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {getPatientList,delPatient} from '@/api/patient'
  32. export default {
  33. data() {
  34. return {
  35. patient:[],
  36. isFromTest:false
  37. }
  38. },
  39. onLoad(option) {
  40. this.isFromTest=option.isFromTest;
  41. this.getPatientList();
  42. uni.$on('refreshPatient', () => {
  43. this.getPatientList()
  44. });
  45. },
  46. methods: {
  47. editPatient(item){
  48. uni.navigateTo({
  49. url: './addPatient?type=edit&patientId='+item.patientId
  50. })
  51. },
  52. delPatient(item){
  53. uni.showModal({
  54. title:"提示",
  55. content:"确认删除吗?",
  56. showCancel:true,
  57. cancelText:'取消',
  58. confirmText:'确定',
  59. success:res=>{
  60. if(res.confirm){
  61. // 用户点击确定
  62. var data={patientId:item.patientId}
  63. delPatient(data).then(
  64. res => {
  65. if(res.code==200){
  66. uni.showToast({
  67. icon:'success',
  68. title: "操作成功",
  69. });
  70. this.getPatientList()
  71. }else{
  72. uni.showToast({
  73. icon:'none',
  74. title: "请求失败",
  75. });
  76. }
  77. },
  78. rej => {}
  79. );
  80. }else{
  81. // 否则点击了取消
  82. }
  83. }
  84. })
  85. },
  86. getPatientList(){
  87. uni.showLoading({
  88. title:"正在加载中"
  89. })
  90. getPatientList().then(
  91. res => {
  92. uni.hideLoading()
  93. if(res.code==200){
  94. this.patient=res.data;
  95. }else{
  96. uni.showToast({
  97. icon:'none',
  98. title: "请求失败",
  99. });
  100. }
  101. },
  102. rej => {}
  103. );
  104. },
  105. addPatient() {
  106. uni.navigateTo({
  107. url: './addPatient?type=add'
  108. })
  109. },
  110. pickPatient(item){
  111. if(this.isFromTest){
  112. uni.$emit('refreshOrderPatient',item);
  113. uni.navigateBack({delta: 1 });
  114. }
  115. }
  116. }
  117. }
  118. </script>
  119. <style lang="scss">
  120. page{
  121. height: 100%;
  122. }
  123. .content{
  124. height: 100%;
  125. display: flex;
  126. flex-direction: column;
  127. justify-content: space-between;
  128. .inner{
  129. flex: 1;
  130. padding: 20upx 20upx 160upx;
  131. .peop-item{
  132. box-sizing: border-box;
  133. height: 184upx;
  134. background: #FFFFFF;
  135. border-radius: 16upx;
  136. padding: 50upx 40upx 50upx 30upx;
  137. display: flex;
  138. align-items: center;
  139. justify-content: space-between;
  140. margin-bottom: 20upx;
  141. position: relative;
  142. .auth{
  143. position: absolute;
  144. right: 0;
  145. top: 0;
  146. width: 90rpx;
  147. height: 36rpx;
  148. line-height: 36rpx;
  149. color: #fff;
  150. font-size: 24rpx;
  151. background-color: green;
  152. border-radius: 8upx;
  153. text-align: center;
  154. }
  155. .noauth{
  156. position: absolute;
  157. right: 0;
  158. top: 0;
  159. width: 90rpx;
  160. height: 36rpx;
  161. line-height: 36rpx;
  162. color: #fff;
  163. font-size: 24rpx;
  164. background-color: #ff0000;
  165. border-radius: 8upx;
  166. text-align: center;
  167. }
  168. .info{
  169. .name{
  170. font-size: 30upx;
  171. font-family: PingFang SC;
  172. font-weight: bold;
  173. color: #111111;
  174. line-height: 1;
  175. }
  176. .detail{
  177. display: flex;
  178. align-items: center;
  179. margin-top: 30upx;
  180. .text{
  181. font-size: 26upx;
  182. font-family: PingFang SC;
  183. font-weight: 500;
  184. color: #999999;
  185. line-height: 1;
  186. margin-right: 30upx;
  187. &:last-child{
  188. margin-right: 0;
  189. }
  190. }
  191. }
  192. }
  193. .operat-box{
  194. display: flex;
  195. align-items: center;
  196. image{
  197. width: 30upx;
  198. height: 30upx;
  199. margin-left: 38upx;
  200. &:first-child{
  201. margin-left: 0;
  202. }
  203. }
  204. }
  205. }
  206. }
  207. .btn-box{
  208. z-index: 9999;
  209. width: 100%;
  210. padding: 30upx;
  211. position: fixed;
  212. bottom: 0;
  213. left: 0;
  214. box-sizing: border-box;
  215. background: #FFFFFF;
  216. .sub-btn{
  217. width: 100%;
  218. height: 88upx;
  219. line-height: 88upx;
  220. text-align: center;
  221. font-size: 30upx;
  222. font-family: PingFang SC;
  223. font-weight: bold;
  224. color: #FFFFFF;
  225. background: #018C39;
  226. border-radius: 44upx;
  227. }
  228. }
  229. }
  230. </style>