debtChange.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view class="app-content">
  3. <block v-if="!$util.isEmpty(list.data)">
  4. <t-table :headerBackgroundColor="'#F0F2F6'">
  5. <t-tr header>
  6. <t-th>日期</t-th>
  7. <t-th><view style="width:230upx;">事项</view></t-th>
  8. <t-th>变动</t-th>
  9. <t-th>剩余待结</t-th>
  10. </t-tr>
  11. <view v-for="(item, index) in list.data" :key="index" @click="goDetail(item)">
  12. <t-tr>
  13. <t-td align="center" color="info"><view >{{ item.addTime.substr(5,11) }}</view></t-td>
  14. <t-td align="center" color="info"><view style="width:230upx;">{{ item.event }}</view></t-td>
  15. <t-td align="center" color="info"><view >{{ item.amount }}</view></t-td>
  16. <t-td align="center" color="info"><view >{{ parseFloat(item.balance) }}</view></t-td>
  17. </t-tr>
  18. </view>
  19. </t-table>
  20. </block>
  21. <block v-else>
  22. <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
  23. </block>
  24. </view>
  25. </template>
  26. <script>
  27. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  28. import { debtChangeList } from '@/api/ghs'
  29. import list from '@/mixins/list'
  30. export default {
  31. name: "debtChange",
  32. components: {
  33. AppWrapperEmpty
  34. },
  35. mixins:[list],
  36. data() {
  37. return {
  38. };
  39. },
  40. methods: {
  41. async init(){
  42. const res = await debtChangeList({ page:this.list.page,ghsId:this.option.ghsId })
  43. if (this.$util.isEmpty(res.data.list)){
  44. this.completes(res)
  45. return
  46. }
  47. let currentList = res.data.list
  48. currentList.forEach(function(item,index,array){
  49. array[index].amount = item.io == 0 ? '-'+parseFloat(item.amount) : '+'+parseFloat(item.amount)
  50. });
  51. res.data.list = currentList
  52. this.completes(res)
  53. },
  54. goDetail(item){
  55. }
  56. },
  57. async onPullDownRefresh() {
  58. this.resetList();
  59. await this.init()
  60. uni.stopPullDownRefresh();
  61. },
  62. async onReachBottom() {
  63. if (!this.list.finished) {
  64. await this.init()
  65. uni.stopPullDownRefresh();;
  66. } else {
  67. uni.stopPullDownRefresh();
  68. }
  69. },
  70. };
  71. </script>
  72. <style lang="scss" scoped></style>