selAccount.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view>
  3. <view class="customer-ul">
  4. <view class="customer-li" v-for="(item, index) in account_list" :key="index" @click="changeSupplier(item)">
  5. <view class="customer-name">{{ item.name }}</view>
  6. <view class="accountNumber">{{ item.accountNumber }}</view>
  7. </view>
  8. </view>
  9. <u-loadmore :status="load_status" />
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. data() {
  15. return {
  16. keyword: '',
  17. load_status: 'nomore',
  18. page: 1,
  19. pageSize: 10,
  20. total: 0,
  21. account_list: [],
  22. shopId: ''
  23. };
  24. },
  25. onLoad(options) {
  26. if (options.shopId) {
  27. this.shopId = options.shopId;
  28. }
  29. this.getAllAccount();
  30. },
  31. onPullDownRefresh() {
  32. this.getAllAccount();
  33. },
  34. // 上拉加载
  35. onReachBottom() {
  36. if (this.total / this.pageSize > this.page) {
  37. this.page += 1;
  38. this.getAllAccount();
  39. }
  40. },
  41. methods: {
  42. changeSupplier(item) {
  43. // 选择返回上一页
  44. this._prePage().AccountData = item;
  45. uni.navigateBack();
  46. },
  47. search() {
  48. this.page = 1;
  49. this.getAllAccount();
  50. },
  51. getAllAccount() {
  52. this.loading_status = 'loading';
  53. this.$u.api
  54. .getAllAccount({
  55. page: this.page,
  56. pageSize: this.pageSize,
  57. enableStatus: 5,
  58. shopId: this.shopId
  59. })
  60. .then(res => {
  61. uni.stopPullDownRefresh();
  62. if (this.page === 1) {
  63. this.account_list = res.data;
  64. } else {
  65. this.account_list = this.account_list.concat(res.data);
  66. }
  67. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  68. this.total = res.pageTotal;
  69. })
  70. .catch(err => {
  71. uni.stopPullDownRefresh();
  72. });
  73. }
  74. }
  75. };
  76. </script>
  77. <style lang="scss" scoped>
  78. .customer-ul {
  79. padding-bottom: 20rpx;
  80. .customer-li {
  81. border-bottom: 1px solid #eeeeee;
  82. background-color: #ffffff;
  83. border-radius: 10rpx;
  84. padding: 20rpx;
  85. &:last-child {
  86. border-bottom: 0 none;
  87. }
  88. .customer-name {
  89. padding-bottom: 10rpx;
  90. }
  91. .accountNumber {
  92. font-size: 24rpx;
  93. color: #999999;
  94. }
  95. }
  96. }
  97. </style>