123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <template>
- <view>
- <mescroll-body top="30" bottom="40" @init="mescrollInit" @down="downCallback" @up="upCallback" :option="{}">
- <view class="common-list">
- <view class="common-item" v-for="(item,index) in list" :key="item.id">
- <view class="title">{{item.code}}</view>
- <view class="date">{{item.startDate}}-{{item.endDate}}</view>
- <view>
- <view class="space" v-for="(node,index) in item.roomMap" :key="index">{{node}}</view>
- </view>
- <view class="other">
- <view class="item" v-if="type === 1">
- <view class="label">关联租客</view>
- <view class="value">{{item.tenantType === 1 ? item.merchantName: item.clientName}}</view>
- </view>
- <view class="item" v-else>
- <view class="label">房东信息</view>
- <view class="value">{{item.organizationName}}</view>
- </view>
- </view>
- <view class="state">
- <view class="create">
- <uni-icons class="inherit-icons" type="staff-filled" color="#08979c" size="18"></uni-icons>
- <text class="name hui-ellipsis">{{item.operatorName || '-'}}</text>
- </view>
- <view class="tag">
- <div class="status-tag info" v-if="!item.status">待发送</div>
- <div class="status-tag warning" v-else-if="item.status === 1">待确认</div>
- <div class="status-tag success" v-else-if="item.status === 2">已生效</div>
- </view>
- </view>
- <view class="icon">
- <uni-icons custom-prefix="iconfont" :type="menu.iconClass" color="#08979c" size="30">
- </uni-icons>
- </view>
- </view>
- </view>
- </mescroll-body>
- </view>
- </template>
- <script>
- import {
- getContractListByPage
- } from '@/request/api/contract.js'
- import {
- bindProjectDetail
- } from '@/request/api/organization.js'
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin], // 使用mixin
- data() {
- return {
- list: [],
- type: '',
- menu: {},
- clientId: '',
- merchantId: ''
- }
- },
- onLoad(body) {
- this.type = parseInt(body.type);
- this.menu = this.title();
- uni.setNavigationBarTitle({
- title: this.menu.title
- });
- uni.$on('reloadOrder', () => {
- this.mescroll.resetUpScroll(false);
- })
- },
- methods: {
- title() {
- let str = {
- title: '',
- iconClass: 'icon-hetongguanli'
- };
- switch (this.type) {
- case 1:
- str = {
- title: '合同列表',
- iconClass: 'icon-hetongguanli'
- };
- break;
- case 2:
- str = {
- title: '公司合同',
- iconClass: 'icon-anli'
- };
- break;
- case 3:
- str = {
- title: '个人合同',
- iconClass: 'icon-gerenhetongchaxun'
- };
- break;
- default:
- break;
- }
- return str;
- },
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
- upCallback(page) {
- let postData = {
- currPage: page.num,
- pageSize: 10,
- projectId: this.$store.getters.project.id
- }
- if (this.type === 1) {
- postData['organizationId'] = this.$store.getters.organization.id;
- this.getContractList(postData);
- } else if (this.type === 2) {
- postData['statusList'] = [1, 2, 3, 4, 5];
- if (this.merchantId) {
- postData['merchantId'] = this.merchantId;
- this.getContractList(postData);
- return;
- }
- bindProjectDetail({
- bindOrganizationId: this.$store.getters.organization.id,
- projectId: this.$store.getters.project.id,
- identityId: 4
- }).then(res => {
- if (res.code === 200) {
- if (res.data.length == 0) return this.mescroll.endBySize(0, 0);
- this.merchantId = res.data[0].merchantId;
- postData['merchantId'] = this.merchantId;
- this.getContractList(postData);
- } else {
- this.mescroll.endErr();
- }
- }).catch(() => {
- //联网失败, 结束加载
- this.mescroll.endErr();
- })
- } else if (this.type === 3) {
- postData['statusList'] = [1, 2, 3, 4, 5];
- if (this.clientId) {
- postData['clientId'] = this.clientId;
- this.getContractList(postData);
- return;
- }
- bindProjectDetail({
- userId: this.$store.getters.user.userId,
- projectId: this.$store.getters.project.id,
- identityId: 1
- }).then(res => {
- if (res.code === 200) {
- if (res.data.length == 0) return this.mescroll.endBySize(0, 0);
- this.clientId = res.data[0].clientId;
- postData['clientId'] = this.clientId;
- this.getContractList(postData);
- } else {
- this.mescroll.endErr();
- }
- }).catch(() => {
- //联网失败, 结束加载
- this.mescroll.endErr();
- })
- }
- },
- getContractList(postData) {
- getContractListByPage(postData).then(res => {
- if (res.code === 200) {
- this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
- if (postData.currPage == 1) this.list = []; //如果是第一页需手动制空列表
- let data = res.data.dataList;
- this.list = this.list.concat(data); //追加新数据
- } else {
- this.mescroll.endErr();
- }
- }).catch(() => {
- //联网失败, 结束加载
- this.mescroll.endErr();
- })
- }
- }
- }
- </script>
- <style>
- </style>
|