list.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="list">
  3. <view @click="add" class="adBbtn">
  4. <view class="label">+添加出游人</view>
  5. </view>
  6. <view v-for="item in userList" @click="check(item)" class="user-card">
  7. <view class="user-info">
  8. <view class="user-name">
  9. <view class="icon">
  10. <image class="img" src="/static/user-edit.png" mode="aspectFit" />
  11. </view>
  12. <view class="name">
  13. {{ item.userName }}
  14. </view>
  15. </view>
  16. <view class="id-number">
  17. <text class="label">身份证</text>{{ item.idCard }}
  18. </view>
  19. </view>
  20. <view class="check">
  21. <image v-if="!item.check" class="check-img" src="/static/check.png"></image>
  22. <image v-else class="check-img" src="/static/eglass-check.png"></image>
  23. </view>
  24. </view>
  25. <view class="btn-box">
  26. <view class="total-price">
  27. <view class="label">
  28. 已选择:{{ userList.filter(e => e.check).length }}人
  29. </view>
  30. </view>
  31. <button class="btn" type="default" :loading="loading" @click="submit">确认</button>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import { getAllTravelers } from "@/api/study";
  37. export default {
  38. data() {
  39. return {
  40. userList: [],
  41. };
  42. },
  43. methods: {
  44. add() {
  45. uni.navigateTo({
  46. url: '/study/tourList/add'
  47. });
  48. },
  49. check(user) {
  50. if (user.check) {
  51. user.check = false
  52. } else {
  53. user.check = true
  54. }
  55. },
  56. submit() {
  57. const selected = this.userList.filter(e => e.check)
  58. if (selected.length === 0) {
  59. uni.showToast({
  60. title: '请选择出游人',
  61. icon: 'none'
  62. })
  63. return
  64. }
  65. uni.$emit('updateData', selected)
  66. uni.navigateBack()
  67. }
  68. },
  69. onShow() {
  70. getAllTravelers().then(({ content }) => {
  71. this.userList = content.map(e => {
  72. return {
  73. ...e,
  74. check: false
  75. }
  76. })
  77. })
  78. },
  79. };
  80. </script>
  81. <style lang="scss" scoped>
  82. .list {
  83. background: #F9F9F9;
  84. min-height: 100vh;
  85. padding: 20rpx;
  86. .adBbtn {
  87. display: flex;
  88. justify-content: center;
  89. align-items: center;
  90. background-color: #FFFFFF;
  91. .label {
  92. color: #3B83FF;
  93. font-size: 28rpx;
  94. font-weight: Bold;
  95. padding: 24rpx 0;
  96. }
  97. margin: 0 0 20rpx 0;
  98. }
  99. .user-card {
  100. padding: 24rpx;
  101. background-color: #FFFFFF;
  102. border-radius: 16rpx;
  103. display: flex;
  104. justify-content: space-between;
  105. align-items: center;
  106. margin-bottom: 20rpx;
  107. .user-info {
  108. .user-name {
  109. display: flex;
  110. align-items: center;
  111. margin-bottom: 20rpx;
  112. .icon {
  113. width: 36rpx;
  114. height: 36rpx;
  115. margin-right: 8rpx;
  116. .img {
  117. width: 100%;
  118. height: 100%;
  119. }
  120. }
  121. .name {
  122. font-size: 28rpx;
  123. color: #222222;
  124. font-weight: bold;
  125. }
  126. }
  127. .id-number {
  128. padding-left: 44rpx;
  129. font-size: 24rpx;
  130. color: #222222;
  131. .label {
  132. margin-right: 20rpx;
  133. }
  134. }
  135. }
  136. .check {
  137. width: 40rpx;
  138. height: 40rpx;
  139. .check-img {
  140. width: 100%;
  141. height: 100%;
  142. }
  143. }
  144. }
  145. .btn-box {
  146. position: fixed;
  147. bottom: 0%;
  148. left: 0%;
  149. width: 100%;
  150. display: flex;
  151. align-items: center;
  152. justify-content: space-between;
  153. box-sizing: border-box;
  154. padding: 10rpx 30rpx env(safe-area-inset-bottom);
  155. border-top: 1rpx solid #EEEEEE;
  156. .total-price {
  157. .label {
  158. color: #AAAAAA;
  159. font-size: 28rpx;
  160. }
  161. }
  162. .btn {
  163. width: 280rpx;
  164. height: 80rpx;
  165. line-height: 80rpx;
  166. text-align: center;
  167. background: #3B83FF;
  168. box-shadow: inset 0rpx 6rpx 12rpx 2rpx rgba(255, 255, 255, 0.16);
  169. border-radius: 46rpx 46rpx 46rpx 46rpx;
  170. font-weight: 800;
  171. color: #FFFFFF;
  172. font-size: 28rpx;
  173. margin: 0;
  174. }
  175. }
  176. }
  177. </style>