customerList.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize });
  79. this.status = 'loading';
  80. queryCustomerPage(params).then(res => {
  81. if (res.status == 200) {
  82. if (this.pageNo > 1) {
  83. this.listData = this.listData.concat(res.data.list || []);
  84. } else {
  85. this.listData = res.data.list || [];
  86. }
  87. this.totalNum = res.data.count || 0;
  88. } else {
  89. this.listData = [];
  90. this.totalNum = 0;
  91. this.noDataText = res.message;
  92. }
  93. this.status = 'loadmore';
  94. });
  95. },
  96. // scroll-view到底部加载更多
  97. onreachBottom() {
  98. if (this.listData.length < this.totalNum) {
  99. this.pageNo += 1;
  100. this.getList();
  101. }
  102. },
  103. getDetail(data) {
  104. if(uni.getStorageSync('curTab')){
  105. uni.$emit('customerInfo',data.customer);
  106. uni.navigateBack();
  107. }else{
  108. uni.navigateTo({
  109. url: '/pages/sales/bill?data=' + JSON.stringify(data.customer)
  110. })
  111. }
  112. }
  113. }
  114. };
  115. </script>
  116. <style lang="scss" scoped>
  117. .sales-list-component {
  118. .sales-list-con {
  119. .customer-list {
  120. padding: 20rpx;
  121. border-bottom: 1rpx solid #f8f8f8;
  122. }
  123. .customer-b {
  124. margin-top: 10rpx;
  125. color: #666;
  126. font-size: 26rpx;
  127. .customer-box {
  128. width: 46%;
  129. text {
  130. &:last-child {
  131. color: $uni-color-warning;
  132. }
  133. }
  134. }
  135. }
  136. }
  137. }
  138. </style>