balanceChange.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <view class="app-content">
  3. <block v-if="!$util.isEmpty(list.data)">
  4. <view class="balance-table">
  5. <view class="table-header table-row">
  6. <view class="table-cell cell-date">日期</view>
  7. <view class="table-cell cell-event">事项</view>
  8. <view class="table-cell cell-staff">操作</view>
  9. <view class="table-cell cell-amount">变动</view>
  10. <view class="table-cell cell-balance">余额</view>
  11. </view>
  12. <view v-for="(item, index) in list.data" :key="index" class="table-body">
  13. <view class="table-row table-row-data" @click="goDetail(item)">
  14. <view class="table-cell cell-date">{{ item.addTime.substr(5,11) }}</view>
  15. <view class="table-cell cell-event">{{ item.event }}</view>
  16. <view class="table-cell cell-staff">{{ item.staffName }}</view>
  17. <view class="table-cell cell-amount">{{ item.amount }}</view>
  18. <view class="table-cell cell-balance">{{ parseFloat(item.balance) }}</view>
  19. </view>
  20. <view class="table-row table-row-extra" v-if="Number(item.settleId)>0 || !$util.isEmpty(item.remark) || Number(item.refundOrderId)>0 || Number(item.shOrderId)>0">
  21. <view class="table-cell cell-extra" :colspan="5">
  22. <view v-if="Number(item.settleId)>0" @click.stop="goSettle(item)">结账单 {{item.settleNo}} {{item.settleAmount?parseFloat(item.settleAmount):0}}元</view>
  23. <view v-if="Number(item.settleAmount)>0 && Number(item.becomeBalance)>0">余额 {{item.becomeBalance}}元</view>
  24. <view v-if="Number(item.shOrderId)>0" @click.stop="goShPayOrder(item)">售后付款单{{ item.shOrderSn }}</view>
  25. <view v-if="Number(item.refundOrderId)>0" @click.stop="goRefundOrder(item)">订单 {{ item.refundOrderSn }}</view>
  26. <view v-if="!$util.isEmpty(item.remark)">{{ item.remark }}</view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </block>
  32. <block v-else>
  33. <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
  34. </block>
  35. </view>
  36. </template>
  37. <script>
  38. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  39. import { getBalanceChangeList } from '@/api/custom'
  40. import list from '@/mixins/list'
  41. export default {
  42. name: "balanceChange",
  43. components: {
  44. AppWrapperEmpty
  45. },
  46. mixins:[list],
  47. data() {
  48. return {
  49. };
  50. },
  51. methods: {
  52. goRefundOrder(item){
  53. this.$util.pageTo({ url: '/admin/order/detail?id='+item.refundOrderId})
  54. },
  55. goShPayOrder(item){
  56. this.$util.pageTo({ url: '/admin/order/detail?id='+item.shOrderId})
  57. },
  58. goSettle(item){
  59. this.$util.pageTo({url:'/admin/settle/detail?id='+item.settleId})
  60. },
  61. goDetail(item){
  62. if(item.capitalType == 0){
  63. //订单详情
  64. this.$util.pageTo({url: '/admin/order/detail?id='+item.relateId})
  65. }
  66. if(item.capitalType == 59){
  67. //售后单
  68. this.$util.pageTo({url: '/admin/order/refundDetail?id='+item.relateId})
  69. }
  70. },
  71. async init(){
  72. let id = this.option.id ? this.option.id : 0
  73. const res = await getBalanceChangeList({ page:this.list.page,customId:id })
  74. if (this.$util.isEmpty(res.data.list)){
  75. this.completes(res)
  76. return
  77. }
  78. let currentList = res.data.list
  79. currentList.forEach(function(item,index,array){
  80. array[index].amount = item.io == 0 ? '-'+parseFloat(item.amount) : '+'+parseFloat(item.amount)
  81. });
  82. res.data.list = currentList
  83. this.completes(res)
  84. }
  85. },
  86. async onPullDownRefresh() {
  87. this.resetList();
  88. await this.init()
  89. uni.stopPullDownRefresh();
  90. },
  91. async onReachBottom() {
  92. if (!this.list.finished) {
  93. await this.init()
  94. uni.stopPullDownRefresh();;
  95. } else {
  96. uni.stopPullDownRefresh();
  97. }
  98. }
  99. };
  100. </script>
  101. <style lang="scss" scoped>
  102. .balance-table {
  103. width: 100%;
  104. border-radius: 16upx;
  105. overflow: hidden;
  106. background: #fff;
  107. box-shadow: 0 4upx 24upx rgba(0,0,0,0.06);
  108. margin: 20upx 0;
  109. .table-row {
  110. display: flex;
  111. align-items: center;
  112. min-height: 72upx;
  113. border-bottom: 1px solid #f0f0f0;
  114. &.table-header {
  115. background: #f5f7fa;
  116. font-weight: bold;
  117. font-size: 30upx;
  118. color: #333;
  119. }
  120. &.table-row-data {
  121. font-size: 26upx;
  122. color: #222;
  123. transition: background 0.2s;
  124. cursor: pointer;
  125. &:hover {
  126. background: #f0f9ff;
  127. }
  128. }
  129. &.table-row-remark {
  130. background: #fafbfc;
  131. color: #989494;
  132. font-size: 24upx;
  133. .cell-remark {
  134. padding: 16upx 20upx;
  135. }
  136. }
  137. &.table-row-extra {
  138. background: #f8f8f8;
  139. color: #989494;
  140. font-size: 24upx;
  141. .cell-extra {
  142. padding: 16upx 20upx;
  143. display: flex;
  144. flex-direction: column;
  145. gap: 2upx;
  146. }
  147. }
  148. }
  149. .table-cell {
  150. flex: 1;
  151. padding: 18upx 8upx 18upx 8upx;
  152. &.cell-date {
  153. text-align: center;
  154. min-width: 100upx;
  155. flex: 1.2;
  156. }
  157. &.cell-staff {
  158. text-align: center;
  159. min-width: 60upx;
  160. flex: 0.8;
  161. }
  162. &.cell-event {
  163. text-align: left;
  164. min-width: 200upx;
  165. flex: 2.2;
  166. }
  167. &.cell-amount {
  168. text-align: right;
  169. min-width: 100upx;
  170. flex: 1;
  171. }
  172. &.cell-balance {
  173. text-align: right;
  174. min-width: 100upx;
  175. padding-right: 32upx;
  176. flex: 1;
  177. }
  178. }
  179. }
  180. </style>