MrShi
2025-02-06 b7f74340de27a3427d8afb8750724b788c8a780c
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<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: billType === 0 }" @click="tabsClick(0)">逾期收款账单</div>
                <div class="tab" :class="{ active: billType === 1 }" @click="tabsClick(1)">逾期付款账单</div>
            </div>
            <div class="btns">
                <el-button :disabled="ids.length === 0" @click="batchCall" v-if="billType === 0">批量催缴</el-button>
            </div>
        </div>
        <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange" stripe>
            <el-table-column
                type="selection"
                width="55">
            </el-table-column>
            <el-table-column prop="customerName" label="客户名称" min-width="100" show-overflow-tooltip />
            <el-table-column label="房间" min-width="170" show-overflow-tooltip>
                <template slot-scope="{row}">
                    <div style="display: flex; flex-direction: column;" v-if="row.roomPathName">
                        <span v-for="(item, index) in row.roomPathName.split(';')" :key="index">{{item}}</span>
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="contractCode" label="合同编号" min-width="100" show-overflow-tooltip />
            <el-table-column label="结清状态" min-width="100" show-overflow-tooltip>
                <template slot-scope="{row}">
                    <span v-if="row.payStatus === 0">待收款</span>
                    <span v-if="row.payStatus === 1">已结清</span>
                    <span v-if="row.payStatus === 2">部分结清</span>
                    <span v-if="row.payStatus === 3">待付款</span>
                    <span v-if="row.payStatus === 4">待退款</span>
                    <span v-if="row.payStatus === 5">已关闭</span>
                </template>
            </el-table-column>
            <el-table-column prop="totleFee" label="账单金额" min-width="100" show-overflow-tooltip />
            <el-table-column prop="receivableFee" :label="`应${billType === 0 ? '收' : '付'}金额`" min-width="100" show-overflow-tooltip />
            <el-table-column prop="actReceivableFee" :label="`实${billType === 0 ? '收' : '付'}金额`" min-width="100" show-overflow-tooltip />
            <el-table-column :label="`需收/付金额`" min-width="100" show-overflow-tooltip>
                <template slot-scope="{row}">
                    {{Math.abs(row.needReceivableFee)}}
                </template>
            </el-table-column>
            <el-table-column label="费用类型" min-width="100" show-overflow-tooltip>
                <template slot-scope="{row}">
                    <span v-if="row.costType === 0">租赁费</span>
                    <span v-if="row.costType === 1">物业费</span>
                    <span v-if="row.costType === 2">租赁押金</span>
                    <span v-if="row.costType === 3">物业押金</span>
                    <span v-if="row.costType === 4">水电费</span>
                    <span v-if="row.costType === 5">杂项费</span>
                    <span v-if="row.costType === 6">其它</span>
                    <span v-if="row.costType === 7">保证金</span>
                </template>
            </el-table-column>
            <el-table-column label="计费周期" min-width="200" show-overflow-tooltip>
                <template slot-scope="{row}">
                    {{ row.startDate }} ~ {{ row.endDate }}
                </template>
            </el-table-column>
            <el-table-column prop="planPayDate" :label="`应${billType === 0 ? '收' : '付'}日期`" min-width="100" show-overflow-tooltip />
            <el-table-column label="账单来源" min-width="100" show-overflow-tooltip>
                <template slot-scope="{row}">
                    <span v-if="row.type === 0">合同账单</span>
                    <span v-if="row.type === 1">自建账单</span>
                </template>
            </el-table-column>
            <el-table-column label="短信发送状态" min-width="100" fixed="right" show-overflow-tooltip>
                <template slot-scope="{row}">
                    <span v-if="row.isSendSms === 0">否</span>
                    <span v-if="row.isSendSms === 1">是</span>
                </template>
            </el-table-column>
            <el-table-column label="邮件发送状态" min-width="100" fixed="right" show-overflow-tooltip>
                <template slot-scope="{row}">
                    <span v-if="row.isSendEmail === 0">否</span>
                    <span v-if="row.isSendEmail === 1">是</span>
                </template>
            </el-table-column>
            <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" />
        <BullEditFu ref="BullEditFu" @success="getList" />
        <BatchCall ref="batchCall" @success="getList" />
    </div>
</template>
 
<script>
  import Pagination from '@/components/common/Pagination'
  import QueryForm from '@/components/common/QueryForm'
  import Edit from './components/bullEdit.vue'
  import BullEditFu from './components/bullEditFu.vue'
  import Detail from './components/bullDetail.vue'
  import BatchCall from './components/batchCall.vue'
  import { fetchList } from '@/api/ywContractBill'
  export default {
    components: {
      Pagination,
      QueryForm,
      Edit,
      Detail,
      BullEditFu,
      BatchCall
    },
    data () {
      return {
        loading: false,
        pagination: {
          pageSize: 10,
          page: 1,
          total: 0
        },
        ids: [],
        billType: 0,
        filters: {
          status: 0
        },
        list: [],
        total: 0,
        queryFormConfig: {
          formItems: [
            {
              filed: 'customerName',
              type: 'input',
              label: '客户名称'
            },
            {
              filed: 'payStatus',
              type: 'select',
              label: '结清状态',
              options: [
                { value: 0, label: '待收款' },
                { value: 1, label: '已结清' },
                { value: 2, label: '部分结清' },
                { value: 3, label: '待付款' },
                { value: 4, label: '待退款' }
              ]
            },
            {
              filed: 'selDate',
              type: 'daterange',
              label: '应收/付日期'
            }
          ]
        }
      }
    },
    created () {
      this.getList()
    },
    methods: {
      batchCall() {
        if (!this.ids) return this.$message.warning('请先选择账单')
        this.$refs.batchCall.open('批量催缴', this.ids)
      },
      handleSelectionChange(e) {
        this.ids = e.map(item => item.id)
      },
      addOpen () {
        if (this.billType === 0) {
          this.$refs.EditRef.open('创建收款账单')
        } else {
          this.$refs.BullEditFu.open('创建付款账单')
        }
      },
      getList (page) {
        const { pagination, filters } = this
        let form = JSON.parse(JSON.stringify(filters))
        if (form && form.selDate && form.selDate.length > 0) {
          form.planPayDateStart = form.payDate[0]
          form.planPayDateEnd = form.payDate[1]
        }
        this.loading = true
        fetchList({
          model: {
            ...filters,
            billType: this.billType
          },
          capacity: pagination.pageSize,
          page: page || pagination.page
        }).then(res => {
          this.loading = false
          this.list = res.records || []
          this.pagination.total = res.total || 0
        }, () => {
          this.loading = false
        })
      },
      tabsClick (val) {
        this.billType = val
        this.getList()
      },
      handleDetail (row) {
        this.$refs.DetailRef.open('账单详情', row.id)
      },
      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;
        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>