contract.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view>
  3. <mescroll-body top="30" bottom="40" @init="mescrollInit" @down="downCallback" @up="upCallback" :option="{}">
  4. <view class="common-list">
  5. <view class="common-item" v-for="(item,index) in list" :key="item.id">
  6. <view class="title">{{item.code}}</view>
  7. <view class="date">{{item.startDate}}-{{item.endDate}}</view>
  8. <view>
  9. <view class="space" v-for="(node,index) in item.roomMap" :key="index">{{node}}</view>
  10. </view>
  11. <view class="other">
  12. <view class="item">
  13. <view class="label">关联租客</view>
  14. <view class="value">{{item.tenantType === 1 ? item.merchantName: item.clientName}}</view>
  15. </view>
  16. </view>
  17. <view class="state">
  18. <view class="create">
  19. <uni-icons class="inherit-icons" type="staff-filled" color="#08979c" size="18"></uni-icons>
  20. <text class="name hui-ellipsis">{{item.operatorName || '-'}}</text>
  21. </view>
  22. <view class="tag">
  23. <div class="status-tag info" v-if="!item.status">待发送</div>
  24. <div class="status-tag warning" v-else-if="item.status === 1">待确认</div>
  25. <div class="status-tag success" v-else-if="item.status === 2">已生效</div>
  26. </view>
  27. </view>
  28. <view class="icon">
  29. <uni-icons custom-prefix="iconfont" :type="menu.iconClass" color="#08979c" size="30">
  30. </uni-icons>
  31. </view>
  32. </view>
  33. </view>
  34. </mescroll-body>
  35. </view>
  36. </template>
  37. <script>
  38. import {
  39. getContractListByPage
  40. } from '@/request/api/contract.js'
  41. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  42. export default {
  43. mixins: [MescrollMixin], // 使用mixin
  44. data() {
  45. return {
  46. list: [],
  47. type: '',
  48. menu: {}
  49. }
  50. },
  51. onLoad(body) {
  52. this.type = parseInt(body.type);
  53. this.menu = this.title();
  54. uni.setNavigationBarTitle({
  55. title: this.menu.title
  56. });
  57. uni.$on('reloadOrder', () => {
  58. this.mescroll.resetUpScroll(false);
  59. })
  60. },
  61. methods: {
  62. title() {
  63. let str = {
  64. title: '',
  65. iconClass: 'icon-hetongguanli'
  66. };
  67. switch (this.type) {
  68. case 1:
  69. str = {
  70. title: '合同列表',
  71. iconClass: 'icon-hetongguanli'
  72. };
  73. break;
  74. case 2:
  75. str = {
  76. title: '公司合同',
  77. iconClass: 'icon-anli'
  78. };
  79. break;
  80. case 3:
  81. str = {
  82. title: '个人合同',
  83. iconClass: 'icon-gerenhetongchaxun'
  84. };
  85. break;
  86. default:
  87. break;
  88. }
  89. return str;
  90. },
  91. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  92. upCallback(page) {
  93. getContractListByPage({
  94. currPage: page.num,
  95. pageSize: 10,
  96. organizationId: this.$store.getters.organization.id,
  97. projectId: this.$store.getters.project.id
  98. }).then(res => {
  99. if (res.code === 200) {
  100. this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
  101. if (page.num == 1) this.list = []; //如果是第一页需手动制空列表
  102. let data = res.data.dataList;
  103. this.list = this.list.concat(data); //追加新数据
  104. } else {
  105. this.mescroll.endErr();
  106. }
  107. }).catch(() => {
  108. //联网失败, 结束加载
  109. this.mescroll.endErr();
  110. })
  111. },
  112. }
  113. }
  114. </script>
  115. <style>
  116. </style>