order.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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('/pages/orderDetail/orderDetail?orderId='+item.id)">
  7. <view class="title">{{item.name}}</view>
  8. <view class="date">{{item.date}}</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" v-if="type === 3">
  14. <view class="label">合同编码</view>
  15. <view class="value">{{item.contractCode}}</view>
  16. </view>
  17. <view class="item" v-if="type !== 3">
  18. <view class="label">关联租客</view>
  19. <view class="value">{{item.tenantType === 1 ? item.merchantName: item.clientName}}</view>
  20. </view>
  21. <view class="item" v-if="type !== 3">
  22. <view class="label">服务方式</view>
  23. <view class="value">
  24. {{type === 1?$field.findTypeName('serviceWorkWay',item.workWay):$field.findTypeName('clearWorkWay',item.workWay)}}
  25. </view>
  26. </view>
  27. </view>
  28. <view class="state">
  29. <view class="create">
  30. <uni-icons class="inherit-icons" type="staff-filled" color="#08979c" size="18"></uni-icons>
  31. <text class="name hui-ellipsis">{{item.followUpPersonName || '-'}}</text>
  32. </view>
  33. <view class="tag">
  34. <view class="status-tag info" v-if="!item.status">待提交</view>
  35. <view class="status-tag primary" v-else-if="item.status === 1">待处理</view>
  36. <view class="status-tag warning" v-else-if="item.status === 2">处理中</view>
  37. <view class="status-tag success" v-else>已处理</view>
  38. </view>
  39. </view>
  40. <view class="icon">
  41. <uni-icons custom-prefix="iconfont" :type="menu.iconClass" color="#08979c" size="30">
  42. </uni-icons>
  43. </view>
  44. </view>
  45. </view>
  46. </mescroll-body>
  47. </view>
  48. </template>
  49. <script>
  50. import {
  51. getOrderPageListByQuery
  52. } from '@/request/api/order.js'
  53. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  54. export default {
  55. mixins: [MescrollMixin], // 使用mixin
  56. data() {
  57. return {
  58. list: [],
  59. type: '',
  60. menu: {},
  61. contractId: ''
  62. }
  63. },
  64. onLoad(body) {
  65. this.type = parseInt(body.type);
  66. this.menu = this.title();
  67. this.contractId = body.contractId;
  68. uni.setNavigationBarTitle({
  69. title: this.menu.title
  70. });
  71. uni.$on('reloadOrder', () => {
  72. this.mescroll.resetUpScroll(false);
  73. })
  74. },
  75. methods: {
  76. title() {
  77. let str = {
  78. title: '',
  79. iconClass: 'icon-weixiugongdan'
  80. };
  81. switch (this.type) {
  82. case 1:
  83. str = {
  84. title: '维修工单',
  85. iconClass: 'icon-weixiugongdan'
  86. };
  87. break;
  88. case 2:
  89. str = {
  90. title: '保洁工单',
  91. iconClass: 'icon-jinribaojie'
  92. };
  93. break;
  94. case 3:
  95. str = {
  96. title: '运维工单',
  97. iconClass: 'icon-yunwei-jiancebaogao'
  98. };
  99. break;
  100. default:
  101. break;
  102. }
  103. return str;
  104. },
  105. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  106. upCallback(page) {
  107. let postData = {
  108. currPage: page.num,
  109. pageSize: 10,
  110. organizationId: this.$store.getters.organization.id,
  111. projectId: this.$store.getters.project.id,
  112. type: this.type
  113. }
  114. if (this.contractId) postData['contractId'] = this.contractId;
  115. getOrderPageListByQuery(postData).then(res => {
  116. if (res.code === 200) {
  117. this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
  118. if (page.num == 1) this.list = []; //如果是第一页需手动制空列表
  119. let data = res.data.dataList;
  120. this.list = this.list.concat(data); //追加新数据
  121. } else {
  122. this.mescroll.endErr();
  123. }
  124. }).catch(() => {
  125. //联网失败, 结束加载
  126. this.mescroll.endErr();
  127. })
  128. },
  129. }
  130. }
  131. </script>
  132. <style>
  133. </style>