customerList.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <template>
  2. <view class="sales-list-component">
  3. <scroll-view class="sales-list-con" :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. };
  51. },
  52. watch: {
  53. height(a, b) {
  54. const sys = uni.getSystemInfoSync();
  55. if (sys.platform == 'android') {
  56. this.scrollH = sys.windowHeight - a;
  57. } else {
  58. if (sys.safeArea.top) {
  59. this.scrollH = sys.windowHeight - a + sys.statusBarHeight - 34;
  60. } else {
  61. this.scrollH = sys.windowHeight - a - 14;
  62. }
  63. }
  64. }
  65. },
  66. methods: {
  67. refash() {
  68. this.listData = [];
  69. this.totalNum = 0;
  70. this.getList(1);
  71. },
  72. // 列表
  73. getList(pageNo) {
  74. const _this = this;
  75. if (pageNo) {
  76. this.pageNo = pageNo;
  77. }
  78. uni.pageScrollTo({
  79. scrollTop:0,
  80. duration:300
  81. })
  82. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize });
  83. this.status = 'loading';
  84. queryCustomerPage(params).then(res => {
  85. if (res.status == 200) {
  86. if (this.pageNo > 1) {
  87. this.listData = this.listData.concat(res.data.list || []);
  88. } else {
  89. this.listData = res.data.list || [];
  90. }
  91. this.totalNum = res.data.count || 0;
  92. } else {
  93. this.listData = [];
  94. this.totalNum = 0;
  95. this.noDataText = res.message;
  96. }
  97. this.status = 'loadmore';
  98. });
  99. },
  100. // scroll-view到底部加载更多
  101. onreachBottom() {
  102. if (this.listData.length < this.totalNum) {
  103. this.pageNo += 1;
  104. this.getList();
  105. }
  106. },
  107. getDetail(data) {
  108. if(uni.getStorageSync('curTab')){
  109. uni.$emit('customerInfo',data.customer);
  110. uni.navigateBack();
  111. }else{
  112. uni.navigateTo({
  113. url: '/pages/sales/bill?data=' + JSON.stringify(data.customer)
  114. })
  115. }
  116. }
  117. }
  118. };
  119. </script>
  120. <style lang="scss" scoped>
  121. .sales-list-component {
  122. .sales-list-con {
  123. .customer-list {
  124. padding: 20rpx;
  125. border-bottom: 1rpx solid #f8f8f8;
  126. }
  127. .customer-b {
  128. margin-top: 10rpx;
  129. color: #666;
  130. font-size: 26rpx;
  131. .customer-box {
  132. width: 46%;
  133. text {
  134. &:last-child {
  135. color: $uni-color-warning;
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
  142. </style>