billHistory.vue 3.8 KB

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