contract.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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" v-if="type === 1">
  13. <view class="label">关联租客</view>
  14. <view class="value">{{item.tenantType === 1 ? item.merchantName: item.clientName}}</view>
  15. </view>
  16. <view class="item" v-else>
  17. <view class="label">房东信息</view>
  18. <view class="value">{{item.organizationName}}</view>
  19. </view>
  20. </view>
  21. <view class="state">
  22. <view class="create">
  23. <uni-icons class="inherit-icons" type="staff-filled" color="#08979c" size="18"></uni-icons>
  24. <text class="name hui-ellipsis">{{item.operatorName || '-'}}</text>
  25. </view>
  26. <view class="tag">
  27. <div class="status-tag info" v-if="!item.status">待发送</div>
  28. <div class="status-tag warning" v-else-if="item.status === 1">待确认</div>
  29. <div class="status-tag success" v-else-if="item.status === 2">已生效</div>
  30. </view>
  31. </view>
  32. <view class="icon">
  33. <uni-icons custom-prefix="iconfont" :type="menu.iconClass" color="#08979c" size="30">
  34. </uni-icons>
  35. </view>
  36. </view>
  37. </view>
  38. </mescroll-body>
  39. </view>
  40. </template>
  41. <script>
  42. import {
  43. getContractListByPage
  44. } from '@/request/api/contract.js'
  45. import {
  46. bindProjectDetail
  47. } from '@/request/api/organization.js'
  48. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  49. export default {
  50. mixins: [MescrollMixin], // 使用mixin
  51. data() {
  52. return {
  53. list: [],
  54. type: '',
  55. menu: {},
  56. clientId: '',
  57. merchantId: ''
  58. }
  59. },
  60. onLoad(body) {
  61. this.type = parseInt(body.type);
  62. this.menu = this.title();
  63. uni.setNavigationBarTitle({
  64. title: this.menu.title
  65. });
  66. uni.$on('reloadOrder', () => {
  67. this.mescroll.resetUpScroll(false);
  68. })
  69. },
  70. methods: {
  71. title() {
  72. let str = {
  73. title: '',
  74. iconClass: 'icon-hetongguanli'
  75. };
  76. switch (this.type) {
  77. case 1:
  78. str = {
  79. title: '合同列表',
  80. iconClass: 'icon-hetongguanli'
  81. };
  82. break;
  83. case 2:
  84. str = {
  85. title: '公司合同',
  86. iconClass: 'icon-anli'
  87. };
  88. break;
  89. case 3:
  90. str = {
  91. title: '个人合同',
  92. iconClass: 'icon-gerenhetongchaxun'
  93. };
  94. break;
  95. default:
  96. break;
  97. }
  98. return str;
  99. },
  100. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  101. upCallback(page) {
  102. let postData = {
  103. currPage: page.num,
  104. pageSize: 10,
  105. projectId: this.$store.getters.project.id
  106. }
  107. if (this.type === 1) {
  108. postData['organizationId'] = this.$store.getters.organization.id;
  109. this.getContractList(postData);
  110. } else if (this.type === 2) {
  111. postData['statusList'] = [1, 2, 3, 4, 5];
  112. if (this.merchantId) {
  113. postData['merchantId'] = this.merchantId;
  114. this.getContractList(postData);
  115. return;
  116. }
  117. bindProjectDetail({
  118. bindOrganizationId: this.$store.getters.organization.id,
  119. projectId: this.$store.getters.project.id,
  120. identityId: 4
  121. }).then(res => {
  122. if (res.code === 200) {
  123. if (res.data.length == 0) return this.mescroll.endBySize(0, 0);
  124. this.merchantId = res.data[0].merchantId;
  125. postData['merchantId'] = this.merchantId;
  126. this.getContractList(postData);
  127. } else {
  128. this.mescroll.endErr();
  129. }
  130. }).catch(() => {
  131. //联网失败, 结束加载
  132. this.mescroll.endErr();
  133. })
  134. } else if (this.type === 3) {
  135. postData['statusList'] = [1, 2, 3, 4, 5];
  136. if (this.clientId) {
  137. postData['clientId'] = this.clientId;
  138. this.getContractList(postData);
  139. return;
  140. }
  141. bindProjectDetail({
  142. userId: this.$store.getters.user.userId,
  143. projectId: this.$store.getters.project.id,
  144. identityId: 1
  145. }).then(res => {
  146. if (res.code === 200) {
  147. if (res.data.length == 0) return this.mescroll.endBySize(0, 0);
  148. this.clientId = res.data[0].clientId;
  149. postData['clientId'] = this.clientId;
  150. this.getContractList(postData);
  151. } else {
  152. this.mescroll.endErr();
  153. }
  154. }).catch(() => {
  155. //联网失败, 结束加载
  156. this.mescroll.endErr();
  157. })
  158. }
  159. },
  160. getContractList(postData) {
  161. getContractListByPage(postData).then(res => {
  162. if (res.code === 200) {
  163. this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
  164. if (postData.currPage == 1) this.list = []; //如果是第一页需手动制空列表
  165. let data = res.data.dataList;
  166. this.list = this.list.concat(data); //追加新数据
  167. } else {
  168. this.mescroll.endErr();
  169. }
  170. }).catch(() => {
  171. //联网失败, 结束加载
  172. this.mescroll.endErr();
  173. })
  174. }
  175. }
  176. }
  177. </script>
  178. <style>
  179. </style>