selCustomerType.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view>
  3. <view class="customer-ul">
  4. <view class="customer-li" v-for="(item, index) in staff_list" :key="index" @click="changeSupplier(item)">
  5. <view class="customer-name clearfix">
  6. <text class="float_left">{{ item.name }}</text>
  7. <view class="float_right">
  8. <u-tag v-if="item.type === 1" size="mini" text="系统" mode="plain" type="primary" />
  9. <u-tag style="margin-left: 10rpx;" v-if="item.defaultStatus === 5" size="mini" text="默认" mode="plain" type="success" />
  10. </view>
  11. </view>
  12. </view>
  13. </view>
  14. <u-loadmore :status="load_status" />
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. keyword: '',
  22. load_status: 'nomore',
  23. page: 1,
  24. pageSize: 10,
  25. total: 0,
  26. staff_list: []
  27. };
  28. },
  29. onLoad() {
  30. this.getCustomerSourceList();
  31. },
  32. onPullDownRefresh() {
  33. this.getCustomerSourceList();
  34. },
  35. // 上拉加载
  36. onReachBottom() {
  37. if (this.total / this.pageSize > this.page) {
  38. this.page += 1;
  39. this.getCustomerSourceList();
  40. }
  41. },
  42. methods: {
  43. changeSupplier(item) {
  44. // 选择返回上一页
  45. this._prePage().customerTypeData = item;
  46. uni.navigateBack();
  47. },
  48. search() {
  49. this.page = 1;
  50. this.getCustomerSourceList();
  51. },
  52. getCustomerSourceList() {
  53. this.loading_status = 'loading';
  54. this.$u.api
  55. .getCustomerSourceList({
  56. page: this.page,
  57. pageSize: this.pageSize
  58. })
  59. .then(res => {
  60. uni.stopPullDownRefresh();
  61. if (this.page === 1) {
  62. this.staff_list = res.data;
  63. } else {
  64. this.staff_list = this.staff_list.concat(res.data);
  65. }
  66. this.total = res.pageTotal;
  67. this.load_status = this.$utils.loadStatus(this.page,this.pageSize,this.total);
  68. })
  69. .catch(err => {
  70. uni.stopPullDownRefresh();
  71. });
  72. }
  73. }
  74. };
  75. </script>
  76. <style lang="scss" scoped>
  77. .search-view {
  78. position: fixed;
  79. z-index: 99;
  80. top: 0;
  81. left: 0;
  82. width: 100%;
  83. background-color: #ffffff;
  84. border-bottom: 1px solid #f5f5f5;
  85. padding: 20rpx 0;
  86. .input-view {
  87. padding: 0 24rpx;
  88. input {
  89. height: 60rpx;
  90. line-height: 60rpx;
  91. padding: 0 24rpx;
  92. display: inline-block;
  93. width: 580rpx;
  94. border: 1px solid #f5f5f5;
  95. vertical-align: middle;
  96. border-radius: 8rpx;
  97. background-color: #f7f8fa;
  98. }
  99. .add-icon {
  100. margin-left: 14rpx;
  101. display: inline-block;
  102. vertical-align: middle;
  103. }
  104. }
  105. }
  106. .customer-ul {
  107. padding-bottom: 20rpx;
  108. .customer-li {
  109. border-bottom: 1px solid #eeeeee;
  110. background-color: #ffffff;
  111. border-radius: 10rpx;
  112. &:last-child{
  113. border-bottom: 0 none;
  114. }
  115. .customer-name {
  116. padding: 0 20rpx;
  117. line-height: 100rpx;
  118. }
  119. }
  120. }
  121. </style>