billHistory.vue 4.1 KB

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