index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="main">
  3. <view class="list">
  4. <view class="item" v-for="(item, index) in list" :key="index" @click="go('/pages/user/bind/detail?id=' + item.id)">
  5. <view class="title omit">
  6. <text>{{ item.patientName }}</text>
  7. <text class="check" v-if="item.relationship">{{item.relationship}}</text>
  8. <text class="check" v-if="item.state == 1">(当前就诊人)</text>
  9. </view>
  10. <view class="icon del" @click.stop="del(item)">&#xe641;</view>
  11. </view>
  12. <u-empty v-if="list.length == 0" text="请先绑定就诊人"></u-empty>
  13. </view>
  14. <view class="mfooter">
  15. <button class="btn" @click="go('/pages/user/bind/add')">
  16. <text class="icon">&#xe8d5;</text>
  17. <text>去绑定</text>
  18. </button>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. list: []
  27. };
  28. },
  29. onLoad(e) {
  30. this.getData();
  31. uni.$on('bind', (res) => {
  32. this.getData();
  33. });
  34. },
  35. methods: {
  36. getData() {
  37. this.http.request({
  38. url: '/app/user/bind/list',
  39. data: this.param,
  40. success: (res) => {
  41. this.list = res.data.data;
  42. }
  43. });
  44. },
  45. del(item) {
  46. uni.showModal({
  47. title: '提示',
  48. content: '确定移除当前就诊人?',
  49. success: (res) => {
  50. if (res.confirm) {
  51. this.http.request({
  52. url: '/app/user/bind/remove/' + item.id,
  53. success: (res) => {
  54. uni.showToast({ title: '移除成功' });
  55. this.list.splice(this.list.indexOf(item), 1);
  56. }
  57. });
  58. }
  59. }
  60. });
  61. },
  62. go(url) {
  63. uni.navigateTo({ url: url });
  64. }
  65. }
  66. };
  67. </script>
  68. <style lang="scss">
  69. .list {
  70. background-color: white;
  71. border-radius: 10px;
  72. .item {
  73. padding: 16px 12px 16px 12px;
  74. border-bottom: 1px solid $line;
  75. overflow: hidden;
  76. .title {
  77. font-size: 15px;
  78. font-weight: bold;
  79. .check {
  80. color: #737373;
  81. font-size: 13px;
  82. font-weight: normal;
  83. padding-left: 5px;
  84. }
  85. }
  86. .del {
  87. color: #f44336;
  88. float: right;
  89. margin-top: -20px;
  90. font-size: 20px;
  91. }
  92. }
  93. }
  94. </style>