selSupplier.vue 3.3 KB

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