billHistory.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. billStatus:'',
  57. name: '全部'
  58. },
  59. {
  60. id: 2,
  61. billStatus:'UNSETTLE',
  62. name: '未付款'
  63. },
  64. {
  65. id: 3,
  66. billStatus:'SETTLED',
  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. this.pageNo = 1
  90. this.getList()
  91. },
  92. jumpPage(url) {
  93. uni.navigateTo({
  94. url
  95. });
  96. },
  97. getList() {
  98. let params = { targetSn: this.targetSn,billStatus:this.tabsList[this.current].billStatus, pageNo: this.pageNo, pageSize: this.pageSize };
  99. this.status = 'loading';
  100. queryPage(params).then(res => {
  101. if (res.status == 200) {
  102. if (this.pageNo > 1) {
  103. this.billList = this.billList.concat(res.data.list || []);
  104. } else {
  105. this.billList = res.data.list || [];
  106. }
  107. this.totalNum = res.data.count || 0;
  108. } else {
  109. this.billList = [];
  110. this.totalNum = 0;
  111. this.noDataText = res.message;
  112. }
  113. this.status = 'loadmore';
  114. });
  115. }
  116. },
  117. onReachBottom() {
  118. if (this.billList.length < this.totalNum) {
  119. this.pageNo += 1;
  120. this.getList();
  121. } else {
  122. this.status = 'nomore';
  123. }
  124. },
  125. onUnload() {
  126. uni.$off('chooseShelfOk');
  127. }
  128. };
  129. </script>
  130. <style lang="scss" scoped>
  131. .content {
  132. height: 100vh;
  133. width: 100%;
  134. .p-header {
  135. background-color: #fff;
  136. text-align: center;
  137. padding-bottom: 20rpx;
  138. }
  139. .p-content {
  140. flex-grow: 1;
  141. padding:20rpx 20rpx 0;
  142. overflow-y: scroll;
  143. .list {
  144. width: 100%;
  145. background: #ffffff;
  146. padding: 30rpx 20rpx;
  147. border-radius: 20rpx;
  148. box-sizing: border-box;
  149. margin-bottom: 20rpx;
  150. .list_t {
  151. margin-bottom: 20rpx;
  152. view {
  153. &:first-child {
  154. width: calc(100% - 200rpx);
  155. }
  156. &:last-child {
  157. color: $uni-color-warning;
  158. }
  159. }
  160. }
  161. .list_b {
  162. color: $uni-text-color-grey;
  163. font-size: $uni-font-size-sm;
  164. font-weight: 500;
  165. }
  166. }
  167. }
  168. }
  169. </style>