selStaff.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="selSupplier">
  3. <view class="search-view">
  4. <view class="input-view">
  5. <input type="text" @confirm="search" confirm-type="search" placeholder-class="input-pl" placeholder="员工姓名" v-model="keyword" />
  6. <u-icon class="add-icon" name="search" size="40" color="#666666" @click="search"></u-icon>
  7. </view>
  8. </view>
  9. <view class="customer-ul">
  10. <view class="customer-li" v-for="(item, index) in staff_list" :key="index" @click="changeSupplier(item)">
  11. <view class="customer-name clearfix">
  12. <text class="float_left">{{ item.staffName }}</text>
  13. <text class="float_right">{{ item.departmentName }}</text>
  14. </view>
  15. <view class="other">
  16. <view class="concat clearfix">
  17. <text class="float_left">{{ item.roleName }}</text>
  18. <view class="float_right" v-if="item.mobile">
  19. <u-icon name="phone-fill" size="26"></u-icon>
  20. <text class="phone-text">{{ item.mobile }}</text>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <u-loadmore :status="load_status" />
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. keyword: '',
  34. load_status: 'nomore',
  35. page: 1,
  36. pageSize: 10,
  37. total: 0,
  38. staff_list: []
  39. };
  40. },
  41. onLoad(options) {
  42. if(options.departmentId){
  43. this.departmentId = options.departmentId
  44. }
  45. this.getAllStaff();
  46. },
  47. onPullDownRefresh() {
  48. this.getAllStaff();
  49. },
  50. // 上拉加载
  51. onReachBottom() {
  52. if (this.total / this.pageSize > this.page) {
  53. this.page += 1;
  54. this.getAllStaff();
  55. }
  56. },
  57. methods: {
  58. changeSupplier(item) {
  59. // 选择返回上一页
  60. this._prePage().staffData = item;
  61. uni.navigateBack();
  62. },
  63. search() {
  64. this.page = 1;
  65. this.getAllStaff();
  66. },
  67. getAllStaff() {
  68. this.loading_status = 'loading';
  69. this.$u.api
  70. .getAllStaff({
  71. page: this.page,
  72. pageSize: this.pageSize,
  73. departmentId:this.departmentId,
  74. keyword:this.keyword
  75. })
  76. .then(res => {
  77. uni.stopPullDownRefresh();
  78. if (this.page === 1) {
  79. this.staff_list = res.data;
  80. } else {
  81. this.staff_list = this.staff_list.concat(res.data);
  82. }
  83. this.total = res.pageTotal;
  84. this.load_status = this.$utils.loadStatus(this.page,this.pageSize,this.total);
  85. }).catch(err => {
  86. uni.stopPullDownRefresh();
  87. });;
  88. }
  89. }
  90. };
  91. </script>
  92. <style lang="scss" scoped>
  93. .search-view {
  94. position: fixed;
  95. z-index: 99;
  96. top: 0;
  97. left: 0;
  98. width: 100%;
  99. background-color: #ffffff;
  100. border-bottom: 1px solid #f5f5f5;
  101. padding: 20rpx 0;
  102. .input-view {
  103. padding: 0 24rpx;
  104. input {
  105. height: 60rpx;
  106. line-height: 60rpx;
  107. padding: 0 24rpx;
  108. display: inline-block;
  109. width: 580rpx;
  110. border: 1px solid #f5f5f5;
  111. vertical-align: middle;
  112. border-radius: 8rpx;
  113. background-color: #f7f8fa;
  114. }
  115. .add-icon {
  116. margin-left: 14rpx;
  117. display: inline-block;
  118. vertical-align: middle;
  119. }
  120. }
  121. }
  122. .customer-ul {
  123. padding-top: 90rpx;
  124. padding-bottom: 20rpx;
  125. .customer-li {
  126. width: 702rpx;
  127. margin: 0 auto;
  128. background-color: #ffffff;
  129. border-radius: 10rpx;
  130. margin-top: 20rpx;
  131. .customer-name {
  132. padding: 0 20rpx;
  133. line-height: 80rpx;
  134. border-bottom: 1px solid #f5f5f5;
  135. }
  136. .other {
  137. font-size: 24rpx;
  138. padding: 10rpx 20rpx;
  139. line-height: 50rpx;
  140. .concat {
  141. .float_right {
  142. color: $uni-color-primary;
  143. .phone-text {
  144. margin-left: 10rpx;
  145. }
  146. }
  147. }
  148. }
  149. }
  150. }
  151. </style>