Blame view

src/components/simplify/simplifyShopsHireLog.vue 3.04 KB
0a41b92e   wuxw   开发完成业务受理页面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
  <template>
    <div>
      <el-table :data="simplifyShopsHireLogInfo.owners" style="margin-top:10px" border>
        <el-table-column prop="name" :label="$t('simplifyShopsHireLog.ownerName')" align="center"></el-table-column>
        <el-table-column prop="link" :label="$t('simplifyShopsHireLog.ownerPhone')" align="center"></el-table-column>
        <el-table-column prop="startTime" :label="$t('simplifyShopsHireLog.startTime')" align="center"></el-table-column>
        <el-table-column prop="endTime" :label="$t('simplifyShopsHireLog.endTime')" align="center"></el-table-column>
        <el-table-column prop="createTime" :label="$t('simplifyShopsHireLog.createTime')" align="center"></el-table-column>
        <el-table-column :label="$t('simplifyShopsHireLog.operation')" align="center">
          <template slot-scope="scope">
            <el-button size="mini" @click="_openShopsOwnerFee(scope.row)">{{$t('simplifyShopsHireLog.viewFee')}}</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-size="pageSize"
        layout="total, prev, pager, next"
        :total="total"
        class="pagination"
      ></el-pagination>
    </div>
  </template>
  
  <script>
  import { queryShopsHireLog } from '@/api/simplify/simplifyShopsHireLogApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'SimplifyShopsHireLog',
    data() {
      return {
        simplifyShopsHireLogInfo: {
          owners: [],
          ownerId: '',
          roomId: ''
        },
        currentPage: 1,
        pageSize: 10,
        total: 0,
        communityId: ''
      }
    },
    created() {
      this.communityId = getCommunityId()
      this.$on('switch', this.handleSwitch)
      this.$on('listMachineTranslate', this.listShopsHireLog)
    },
    methods: {
      handleSwitch(params) {
        if (!params.roomId) return
        this.clearSimplifyShopsHireLogInfo()
        Object.assign(this.simplifyShopsHireLogInfo, params)
        this.listShopsHireLog()
      },
      async listShopsHireLog() {
        try {
          const params = {
            page: this.currentPage,
            row: this.pageSize,
            communityId: this.communityId,
            roomId: this.simplifyShopsHireLogInfo.roomId
          }
          const res = await queryShopsHireLog(params)
          this.simplifyShopsHireLogInfo.owners = res.data
          this.total = res.data.total
        } catch (error) {
          console.error('Failed to load shops hire log:', error)
        }
      },
      _openShopsOwnerFee(owner) {
        this.$router.push({
          path: '/pages/property/listRoomFee',
          query: {
            roomId: owner.roomId,
            ownerId: owner.ownerId,
            hireOwnerFee: 1
          }
        })
      },
      clearSimplifyShopsHireLogInfo() {
        this.simplifyShopsHireLogInfo = {
          owners: [],
          ownerId: '',
          roomId: ''
        }
      },
      handleCurrentChange(val) {
        this.currentPage = val
        this.listShopsHireLog()
      }
    }
  }
  </script>
  
  <style scoped>
  .pagination {
    margin-top: 15px;
    text-align: right;
  }
  </style>