1
0

index.vue 1.8 KB

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