customerList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view class="sales-list-component">
  3. <view v-if="listData && listData.length>0">
  4. <scroll-view class="sales-list-con" :style="{ height: scrollH + 'px' }" scroll-y @scrolltolower="onreachBottom">
  5. <view class="customer-list" v-for="(item,i) in listData" :key="i" @click="getDetail(item)">
  6. <view class="u-line-1">{{item.customer.customerName}}</view>
  7. <view class="customer-b u-flex">
  8. <view class="customer-box">
  9. <text>欠款:</text>
  10. <text>¥{{item.settleAmount || 0}}</text>
  11. </view>
  12. <view class="customer-box">收款方式:{{item.customer.settleStyleSnDictValue}}</view>
  13. </view>
  14. </view>
  15. </scroll-view>
  16. </view>
  17. <view v-else>
  18. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" :text="noDataText" mode="list" :margin-top="50"></u-empty>
  19. </view>
  20. <view style="padding-bottom: 20upx;" ><u-loadmore v-if="totalNum > listData.length || status == 'loading'" :status="status" /></view>
  21. </view>
  22. </template>
  23. <script>
  24. import { queryCustomerPage } from '@/api/verify.js';
  25. export default {
  26. props: {
  27. height: {
  28. // 滚动区域高度 upx
  29. type: [String, Number],
  30. default: 300
  31. },
  32. params: {
  33. // 列表查询条件
  34. type: Object,
  35. default: () => {
  36. return {};
  37. }
  38. }
  39. },
  40. data() {
  41. return {
  42. listData: [],
  43. pageNo: 1,
  44. pageSize: 10,
  45. totalNum: 0,
  46. status: 'loadmore',
  47. noDataText: '暂无数据',
  48. auditModal: false, // 审核弹框
  49. dataInfo: null,
  50. outModal: false, // 出库弹框
  51. delModal: false, // 删除/取消弹框
  52. delText: '确认要删除吗?',
  53. scrollH: 300
  54. };
  55. },
  56. watch: {
  57. height(a, b) {
  58. console.log(a, b);
  59. const sys = uni.getSystemInfoSync();
  60. console.log(sys);
  61. if (sys.platform == 'android') {
  62. this.scrollH = sys.windowHeight - a;
  63. } else {
  64. if (sys.safeArea.top) {
  65. this.scrollH = sys.windowHeight - a + sys.statusBarHeight - 34;
  66. } else {
  67. this.scrollH = sys.windowHeight - a - 14;
  68. }
  69. }
  70. }
  71. },
  72. methods: {
  73. refash() {
  74. this.listData = [];
  75. this.totalNum = 0;
  76. this.getList(1);
  77. },
  78. // 列表
  79. getList(pageNo) {
  80. const _this = this;
  81. if (pageNo) {
  82. this.pageNo = pageNo;
  83. }
  84. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize });
  85. this.status = 'loading';
  86. queryCustomerPage(params).then(res => {
  87. if (res.status == 200) {
  88. if (this.pageNo > 1) {
  89. this.listData = this.listData.concat(res.data.list || []);
  90. } else {
  91. this.listData = res.data.list || [];
  92. }
  93. this.totalNum = res.data.count || 0;
  94. } else {
  95. this.listData = [];
  96. this.totalNum = 0;
  97. this.noDataText = res.message;
  98. }
  99. this.status = 'loadmore';
  100. });
  101. },
  102. // scroll-view到底部加载更多
  103. onreachBottom() {
  104. if (this.listData.length < this.totalNum) {
  105. this.pageNo += 1;
  106. this.getList();
  107. }
  108. },
  109. getDetail(data) {
  110. uni.redirectTo({
  111. url:'/pages/sales/bill?data='+JSON.stringify(data.customer)
  112. })
  113. }
  114. }
  115. };
  116. </script>
  117. <style lang="scss" scoped>
  118. .sales-list-component {
  119. .sales-list-con {
  120. .customer-list {
  121. padding: 20rpx;
  122. border-bottom: 1rpx solid #f8f8f8;
  123. }
  124. .customer-b {
  125. margin-top: 10rpx;
  126. color: #666;
  127. font-size: 26rpx;
  128. .customer-box {
  129. width: 46%;
  130. text {
  131. &:last-child {
  132. color: $uni-color-warning;
  133. }
  134. }
  135. }
  136. }
  137. }
  138. }
  139. </style>