contract.vue 5.4 KB

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