recipient.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <!-- 选择接收人 -->
  3. <view>
  4. <u-navbar title="选择接收人" autoBack placeholder></u-navbar>
  5. <u-sticky :offset-top="navbarHeight()">
  6. <view class="card_search_head">
  7. <u-search v-model="cylinderNumber" shape="square" :showAction="false" placeholder="请输入用户名称"
  8. borderColor="#e4e7ed" bgColor="#fff" @change="quickSearch"></u-search>
  9. </view>
  10. </u-sticky>
  11. <view class="card_recipient" v-if="userData.length > 0">
  12. <view class="card_user_item frame" v-for="(item,index) in userData" :key="index"
  13. @click="selectRecipient(item)">
  14. <u-icon name="account" size="28"></u-icon>
  15. <view class="title_user">{{item.provUser.name}}</view>
  16. </view>
  17. </view>
  18. <view style="margin-top: 30%;" v-else>
  19. <u-empty mode="list" text="暂无用户"></u-empty>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. shopID: '',
  28. shopName: '',
  29. flowId: '',
  30. flowName: '',
  31. cylinderNumber: '',
  32. userData: [],
  33. Pagination: {
  34. PageIndex: 1,
  35. PageSize: 20,
  36. Total: 0,
  37. },
  38. loadingMore: true,
  39. }
  40. },
  41. onReachBottom() {
  42. if (!this.loadingMore) {
  43. this.getList()
  44. }
  45. },
  46. onLoad(value) {
  47. this.shopID = value.shopID
  48. this.shopName = value.shopName
  49. this.flowId = value.flowId
  50. this.flowName = value.flowName
  51. this.getList()
  52. },
  53. methods: {
  54. getList() {
  55. this.loadingMore = true
  56. this.$api.get('/api/sys-user/opt-type', {
  57. optType: this.flowId,
  58. storeId: this.shopID,
  59. name: this.cylinderNumber,
  60. page: this.Pagination.PageIndex,
  61. pageSize: this.Pagination.PageSize,
  62. }).then(res => {
  63. if (res.code == 200) {
  64. this.Pagination.Total = res.data.count
  65. const data = res.data.list
  66. if (this.loadingMore == true && data) {
  67. this.userData = this.userData.concat(data);
  68. }
  69. if (data.length < this.Pagination.PageSize) {
  70. this.loadingMore = true
  71. } else {
  72. this.loadingMore = false
  73. this.Pagination.PageIndex++
  74. }
  75. }
  76. })
  77. },
  78. quickSearch() {
  79. this.Pagination.PageIndex = 1
  80. this.loadingMore = true
  81. this.userData = []
  82. this.getList()
  83. },
  84. // 选择接收人
  85. selectRecipient(value) {
  86. let arr = {
  87. name: value.provUser.name,
  88. userId: value.id,
  89. shopID: this.shopID,
  90. shopName: this.shopName,
  91. flowId: this.flowId,
  92. flowName: this.flowName,
  93. }
  94. uni.setStorageSync('returnData', JSON.stringify(arr));
  95. uni.navigateBack({
  96. delta: 3
  97. });
  98. },
  99. navbarHeight() {
  100. let systemInfo = uni.getSystemInfoSync();
  101. let topHeight = 0
  102. // #ifdef APP-PLUS
  103. topHeight = 47 + systemInfo.statusBarHeight;
  104. // #endif
  105. // #ifdef MP
  106. let height = systemInfo.platform == 'ios' ? 47 : 48;
  107. topHeight = height + systemInfo.statusBarHeight
  108. // #endif
  109. /* 最后一步将px转为rpx */
  110. return topHeight * (375 / systemInfo.windowWidth)
  111. },
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. .card_recipient {
  117. display: flex;
  118. flex-direction: column;
  119. }
  120. .card_user_item {
  121. display: flex;
  122. align-items: center;
  123. padding: 30rpx;
  124. }
  125. .title_user {
  126. margin-left: 10rpx;
  127. font-size: 30rpx;
  128. }
  129. </style>