customerList.vue 3.4 KB

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