moneyDetail.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="out-box">
  3. <view class="time-search">
  4. <view class="time-li">
  5. <picker mode="date" @change="bindDateStartChange">
  6. <text class="date-li">{{ start_time ? $u.timeFormat(start_time, 'yyyy-mm-dd') : '开始日期' }}</text>
  7. </picker>
  8. </view>
  9. <view class="icon"><u-icon name="arrow-right" size="36"></u-icon></view>
  10. <view class="time-li">
  11. <picker mode="date" @change="bindDateendChange">
  12. <text class="date-li">{{ end_time ? $u.timeFormat(end_time, 'yyyy-mm-dd') : '结束日期' }}</text>
  13. </picker>
  14. </view>
  15. </view>
  16. <view class="list-view">
  17. <view class="start-time clearfix">
  18. <view class="float_left">期初余额</view>
  19. <view class="float_right">{{ $utils.formattedNumber(openingBalance) }}</view>
  20. </view>
  21. <view class="th-view">
  22. <view class="th-li">应收</view>
  23. <view class="th-li">实收</view>
  24. <view class="th-li">应收余额</view>
  25. </view>
  26. <view class="td-view" v-for="(item, index) in money_list" :key="index">
  27. <view class="td-li">{{ $utils.formattedNumber(item.receivableAmount) }}</view>
  28. <view class="td-li">{{ $utils.formattedNumber(item.actualReceivableAmount) }}</view>
  29. <view class="td-li">{{ $utils.formattedNumber(item.receivableBalance) }}</view>
  30. </view>
  31. <u-loadmore :status="load_status" @loadmore="loadmore" :load-text="loadText" />
  32. </view>
  33. <view class="start-time end-time clearfix">
  34. <view class="float_left">期末余额</view>
  35. <view class="float_right">{{ $utils.formattedNumber(endingBalance) }}</view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. props: {
  42. customerId: {
  43. type: [Number, String],
  44. default: ''
  45. }
  46. },
  47. data() {
  48. return {
  49. loadText: {
  50. loadmore: '点击加载更多',
  51. loading: '努力加载中',
  52. nomore: '没有更多了'
  53. },
  54. load_status: 'nomore',
  55. start_time: '',
  56. end_time: '',
  57. page: 1,
  58. pageSize: 10,
  59. money_list: [],
  60. total: 0,
  61. openingBalance: 0,
  62. endingBalance: 0
  63. };
  64. },
  65. created() {
  66. this.start_time = this.$utils.timeByTimestamp(this.$utils.funDate(-30) + ' 00:00:00');
  67. this.end_time = parseInt(new Date().getTime() / 1000);
  68. this.getAllCustomerBalanceDetail();
  69. },
  70. methods: {
  71. loadmore() {
  72. if (this.total / this.pageSize > this.page) {
  73. this.page += 1;
  74. this.getAllCustomerBalanceDetail();
  75. }
  76. },
  77. getAllCustomerBalanceDetail() {
  78. this.load_status = 'loading';
  79. this.$u.api
  80. .getAllCustomerBalanceDetail({
  81. customerId: this.customerId,
  82. end: this.end_time,
  83. page: this.page,
  84. pageSize: this.pageSize,
  85. start: this.start_time
  86. })
  87. .then(res => {
  88. if (this.page === 1) {
  89. this.money_list = res.data;
  90. } else {
  91. this.money_list = this.money_list.concat(res.data);
  92. }
  93. //期初余额
  94. this.openingBalance = res.openingBalance;
  95. //期末余额
  96. this.endingBalance = res.endingBalance;
  97. this.total = res.pageTotal;
  98. this.load_status = this.$utils.loadStatus(this.page, this.pageSize, this.total);
  99. });
  100. },
  101. bindDateStartChange(obj) {
  102. this.start_time = this.$utils.timeByTimestamp(obj.detail.value + ' 00:00:00');
  103. this.page = 1;
  104. this.getAllCustomerBalanceDetail();
  105. },
  106. bindDateendChange(obj) {
  107. this.end_time = this.$utils.timeByTimestamp(obj.detail.value + ' 23:59:59');
  108. this.page = 1;
  109. this.getAllCustomerBalanceDetail();
  110. }
  111. }
  112. };
  113. </script>
  114. <style lang="scss" scoped>
  115. .out-box{
  116. width: 710rpx;
  117. margin: 24rpx auto;
  118. }
  119. .time-search {
  120. line-height: 80rpx;
  121. border-bottom: 1px solid #f5f5f5;
  122. .time-li {
  123. display: inline-block;
  124. width: 334rpx;
  125. text-align: center;
  126. font-weight: bold;
  127. }
  128. .icon {
  129. display: inline-block;
  130. }
  131. }
  132. .start-time {
  133. line-height: 80rpx;
  134. font-weight: bold;
  135. border-bottom: 1px solid #f5f5f5;
  136. .float_right {
  137. color: $uni-color-error;
  138. }
  139. }
  140. .list-view {
  141. .th-view {
  142. display: flex;
  143. line-height: 80rpx;
  144. border-bottom: 1px solid #f5f5f5;
  145. .th-li {
  146. color: #999999;
  147. flex: 3;
  148. text-align: center;
  149. }
  150. }
  151. .td-view {
  152. display: flex;
  153. line-height: 80rpx;
  154. border-bottom: 1px solid #f5f5f5;
  155. .td-li {
  156. text-align: center;
  157. color: $uni-color-primary;
  158. flex: 3;
  159. font-weight: bold;
  160. }
  161. }
  162. }
  163. </style>