selCustomer.vue 3.2 KB

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