billHistory.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view class="content flex flex_column">
  3. <view>
  4. <view class="p-header" @click="jumpPage('/pages/sales/chooseShelf?customerSn=' + (targetSn ? targetSn : ''))">
  5. <text>{{ curCustomerName || '全部客户' }}</text>
  6. <u-icon name="arrow-right"></u-icon>
  7. </view>
  8. <u-tabs :list="tabsList" :is-scroll="false" :current="current" @change="change"></u-tabs>
  9. </view>
  10. <view class="p-content">
  11. <view v-if="billList && billList.length > 0">
  12. <view class="list" @click="jumpPage('/pages/sales/billHistoryDetail?billId=' + item.verifySn)" v-for="(item, i) in billList" :key="i">
  13. <view class="list_t u-flex u-row-between">
  14. <view class="u-line-1">{{ item.customer.customerName }}</view>
  15. <view>¥{{ toThousands(item.settleAmount || 0, 2) }}</view>
  16. </view>
  17. <view class="list_b u-flex u-row-between">
  18. <view>{{ item.createDate }}</view>
  19. <u-tag size="mini" :text="item.billStatus == 'UNSETTLE'?'未付款':'已结清'" :type="item.billStatus == 'UNSETTLE'?'info':'success'" />
  20. </view>
  21. </view>
  22. </view>
  23. <view v-if="billList && billList.length == 0">
  24. <u-empty
  25. v-if="status != 'loading'"
  26. :src="`/static/${$config('themePath')}/def_no_data@3x.png`"
  27. icon-size="180"
  28. :text="noDataText"
  29. mode="list"
  30. :margin-top="50"
  31. ></u-empty>
  32. </view>
  33. <view style="padding: 20upx;" v-else><u-loadmore :status="status" v-if="status == 'loading'" /></view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import { queryPage } from '@/api/verify.js';
  39. import { toThousands } from '@/libs/tools.js';
  40. export default {
  41. data() {
  42. return {
  43. toThousands,
  44. wordColor: this.$config('infoColor'),
  45. curCustomerName: '',
  46. pageNo: 1,
  47. pageSize: 10,
  48. totalNum: 0,
  49. status: 'loadmore',
  50. noDataText: '暂无数据',
  51. billList: [],
  52. targetSn: undefined,
  53. tabsList: [
  54. {
  55. id: 1,
  56. name: '全部'
  57. },
  58. {
  59. id: 2,
  60. name: '未付款'
  61. },
  62. {
  63. id: 3,
  64. name: '已结清'
  65. }
  66. ],
  67. current: 0
  68. };
  69. },
  70. onLoad() {
  71. uni.$on('chooseShelfOk', data => {
  72. this.pageNo = 1;
  73. this.targetSn = data.customerSn ? data.customerSn : undefined;
  74. this.curCustomerName = data.customerName;
  75. this.getList();
  76. });
  77. },
  78. onReady() {
  79. setTimeout(() => {
  80. this.getList();
  81. }, 500);
  82. },
  83. methods: {
  84. change(index) {
  85. this.current = index;
  86. },
  87. jumpPage(url) {
  88. uni.navigateTo({
  89. url
  90. });
  91. },
  92. getList() {
  93. let params = { targetSn: this.targetSn, pageNo: this.pageNo, pageSize: this.pageSize };
  94. this.status = 'loading';
  95. queryPage(params).then(res => {
  96. if (res.status == 200) {
  97. if (this.pageNo > 1) {
  98. this.billList = this.billList.concat(res.data.list || []);
  99. } else {
  100. this.billList = res.data.list || [];
  101. }
  102. this.totalNum = res.data.count || 0;
  103. } else {
  104. this.billList = [];
  105. this.totalNum = 0;
  106. this.noDataText = res.message;
  107. }
  108. this.status = 'loadmore';
  109. });
  110. }
  111. },
  112. onReachBottom() {
  113. if (this.billList.length < this.totalNum) {
  114. this.pageNo += 1;
  115. this.getList();
  116. } else {
  117. this.status = 'nomore';
  118. }
  119. },
  120. onUnload() {
  121. uni.$off('chooseShelfOk');
  122. }
  123. };
  124. </script>
  125. <style lang="scss" scoped>
  126. .content {
  127. height: 100vh;
  128. width: 100%;
  129. .p-header {
  130. background-color: #fff;
  131. text-align: center;
  132. padding-bottom: 20rpx;
  133. }
  134. .p-content {
  135. flex-grow: 1;
  136. padding:20rpx 20rpx 0;
  137. overflow-y: scroll;
  138. .list {
  139. width: 100%;
  140. background: #ffffff;
  141. padding: 30rpx 20rpx;
  142. border-radius: 20rpx;
  143. box-sizing: border-box;
  144. margin-bottom: 20rpx;
  145. .list_t {
  146. margin-bottom: 20rpx;
  147. view {
  148. &:first-child {
  149. width: calc(100% - 200rpx);
  150. }
  151. &:last-child {
  152. color: $uni-color-warning;
  153. }
  154. }
  155. }
  156. .list_b {
  157. color: $uni-text-color-grey;
  158. font-size: $uni-font-size-sm;
  159. font-weight: 500;
  160. }
  161. }
  162. }
  163. }
  164. </style>