MrShi
2024-11-26 b2ea9a84701e62c84c6cd497ec9b5b66c85b8834
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<template>
  <div class="main_app">
    <QueryForm v-model="filters" :query-form-config="queryFormConfig" @handleQuery="getList(1)" @clear="clear" />
    <div class="df_sb mt20">
      <div class="tabs">
        <div class="tab" :class="{ active: activeTabs == 0 }" @click="tabsClick(0)">收款账单</div>
        <div class="tab" :class="{ active: activeTabs == 1 }" @click="tabsClick(1)">付款账单</div>
      </div>
      <div class="btns">
        <el-button type="primary" @click="$refs.EditRef.open('创建收款账单')" icon="el-icon-plus"
          v-permissions="['business:ywpatrolline:create']">新建</el-button>
        <el-button @click="handleDetail" v-permissions="['business:ywpatrolline:create']">导出</el-button>
      </div>
    </div>
    <el-table v-loading="loading" :data="list" stripe>
      <el-table-column prop="" label="客户名称" min-width="100" show-overflow-tooltip />
      <el-table-column prop="code" label="楼宇名称" min-width="100" show-overflow-tooltip />
      <el-table-column prop="name" label="房间号" min-width="100" show-overflow-tooltip />
      <el-table-column prop="stautsName" label="合同编号" min-width="100" show-overflow-tooltip />
      <el-table-column prop="remark" label="结清状态" min-width="100" show-overflow-tooltip />
      <el-table-column prop="createTime" label="账单金额" min-width="100" show-overflow-tooltip />
      <el-table-column prop="createTime" label="应收金额" min-width="100" show-overflow-tooltip />
      <el-table-column prop="createTime" label="实收金额" min-width="100" show-overflow-tooltip />
      <el-table-column prop="createTime" label="需收金额" min-width="100" show-overflow-tooltip />
      <el-table-column prop="createTime" label="费用类型" min-width="100" show-overflow-tooltip />
      <el-table-column prop="createTime" label="是否逾期" min-width="100" show-overflow-tooltip />
      <el-table-column prop="createTime" label="计费周期" min-width="100" show-overflow-tooltip />
      <el-table-column prop="createTime" label="应收日期" min-width="100" show-overflow-tooltip />
      <el-table-column prop="createTime" label="账单来源" min-width="100" show-overflow-tooltip />
      <el-table-column prop="statusName" label="合同状态" min-width="100" fixed="right" show-overflow-tooltip />
      <el-table-column label="操作" min-width="120" fixed="right">
        <template slot-scope="{row}">
          <el-button type="text" @click="handleDetail(row)" icon="el-icon-edit" v-permissions="['business:category:update']">查看详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="mt20">
      <Pagination @size-change="handleSizeChange" @current-change="getList" :pagination="pagination" />
    </div>
    <Edit ref="EditRef" @success="getList" />
    <Detail ref="DetailRef" @success="getList" />
  </div>
</template>
 
<script>
import Pagination from '@/components/common/Pagination'
import QueryForm from '@/components/common/QueryForm'
import Edit from './components/bullEdit.vue'
import Detail from './components/bullDetail.vue'
import { fetchList } from '@/api/bill'
export default {
  components: {
    Pagination,
    QueryForm,
    Edit,
    Detail
  },
  data() {
    return {
      loading: false,
      pagination: {
        pageSize: 10,
        page: 1,
        total: 0
      },
      activeTabs: 0,
      filters: {},
      list: [],
      total: 0,
      statusMap: [
        { value: 0, label: '待收款' },
        { value: 1, label: '已结算' },
        { value: 2, label: '部分结清' },
        { value: 3, label: '待退款' },
        { value: 4, label: '待付款' },
      ],
      queryFormConfig: {
        formItems: [
          {
            filed: 'name',
            type: 'input',
            label: '客户名称',
          },
          {
            filed: 'status',
            type: 'select',
            label: '账单状态',
            options: [
              { value: '0', label: '开启' },
              { value: '1', label: '关闭' },
            ]
          },
          {
            filed: 'status',
            type: 'select',
            label: '结清状态',
            options: this.statusMap
          },
          {
            filed: 'selDate',
            type: 'daterange',
            label: '应收/付日期'
          },
        ],
        online: true
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList (page) {
      const { pagination, filters } = this
      this.loading = true
      fetchList({
        model: {
          ...filters
        },
        capacity: pagination.pageSize,
        page: page || pagination.page
      }).then(res => {
        console.log(res)
        this.loading = false
        this.list = res.records || []
        this.list.forEach(item => {
          item.statusName = item.status === 1 ? '损坏' : item.status === 2 ? '报废' : '正常'
        })
        this.pagination.total = res.total || 0
      }, () => {
        this.loading = false
      })
    },
    tabsClick(val) {
      this.activeTabs = val
    },
    handleDetail(row) {
      this.$refs.DetailRef.open()
    },
    clear() {
      this.filters = {}
      this.pagination.pageSize = 10
      this.pagination.page = 1
      this.getList()
    },
    handleSizeChange(capacity) {
      this.pagination.pageSize = capacity
      this.getList()
    }
  }
}
</script>
 
<style lang="scss" scoped>
@import '@/assets/style/variables.scss';
 
.tabs {
  display: flex;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
 
  .tab {
    height: 58px;
    line-height: 58px;
    font-size: 16px;
    color: #666666;
    margin: 0 30px;
    cursor: pointer;
  }
 
  .active {
    font-weight: 500;
    color: $primary-color;
    border-bottom: 2px solid $primary-color;
  }
}
</style>