selWerahouse.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="selSupplier">
  3. <view class="supplier-ul">
  4. <view class="supplier-li" v-for="(item, index) in werahouse_list" :key="index" @click="changeSupplier(item)">
  5. <view class="supplier-name">{{ item.warehouseName }}</view>
  6. <view class="other">
  7. <view class="concat clearfix">
  8. <text class="float_left">{{ item.contactName||'--' }}</text>
  9. <view class="float_right" v-if="item.contactMobile" @click.stop="callPhone(item.contactMobile)">
  10. <u-icon name="phone-fill" size="26"></u-icon>
  11. <text class="phone-text">{{ item.contactMobile }}</text>
  12. </view>
  13. </view>
  14. <view class="address">{{ item.area.provinceName }}-{{ item.area.cityName }}-{{ item.area.districtName }}-{{ item.area.contactAddress }}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <u-loadmore :status="load_status" />
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. keyword: '',
  26. load_status: 'nomore',
  27. page: 1,
  28. pageSize: 10,
  29. total: 0,
  30. werahouse_list: []
  31. };
  32. },
  33. onLoad() {
  34. this.getAllWarehouse();
  35. },
  36. onPullDownRefresh() {
  37. this.getAllWarehouse();
  38. },
  39. // 上拉加载
  40. onReachBottom() {
  41. if (this.total / this.pageSize > this.page) {
  42. this.page += 1;
  43. this.getAllWarehouse();
  44. }
  45. },
  46. methods: {
  47. changeSupplier(item) {
  48. // 选择供应商返回上一页
  49. this._prePage().werahouseData = item;
  50. uni.navigateBack();
  51. },
  52. search() {
  53. this.page = 1;
  54. this.getAllWarehouse();
  55. },
  56. getAllWarehouse() {
  57. this.loading_status = 'loading';
  58. this.$u.api
  59. .getAllWarehouse({
  60. page: this.page,
  61. pageSize: this.pageSize,
  62. keyword: this.keyword,
  63. enableStatus:5
  64. })
  65. .then(res => {
  66. uni.stopPullDownRefresh();
  67. this.total = res.pageTotal;
  68. if (this.page === 1) {
  69. this.werahouse_list = res.data;
  70. } else {
  71. this.werahouse_list = this.werahouse_list.concat(res.data);
  72. }
  73. this.load_status = this.$utils.loadStatus(this.page,this.pageSize,this.total);
  74. })
  75. .catch(err => {
  76. uni.stopPullDownRefresh();
  77. });
  78. }
  79. }
  80. };
  81. </script>
  82. <style lang="scss" scoped>
  83. .supplier-ul {
  84. padding-bottom: 20rpx;
  85. .supplier-li {
  86. width: 702rpx;
  87. margin: 0 auto;
  88. background-color: #ffffff;
  89. border-radius: 10rpx;
  90. margin-top: 20rpx;
  91. .supplier-name {
  92. padding: 0 20rpx;
  93. line-height: 80rpx;
  94. border-bottom: 1px solid #f5f5f5;
  95. }
  96. .other {
  97. font-size: 24rpx;
  98. padding: 10rpx 20rpx;
  99. line-height: 50rpx;
  100. .concat {
  101. .float_right {
  102. color: $uni-color-primary;
  103. .phone-text {
  104. margin-left: 10rpx;
  105. }
  106. }
  107. }
  108. }
  109. }
  110. }
  111. </style>