MrShi
2024-11-29 642ae007fd098f5596d44d79148318ac7914e568
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
<template>
  <div class="main_app">
    <QueryForm v-model="filters" :query-form-config="queryFormConfig" @handleQuery="getList(1)" @clear="clear" />
    <div class="mt20">
      <el-button @click="handleEdit()" v-permissions="['business:ywpatrolline:create']">导出</el-button>
    </div>
    <el-table v-loading="loading" :data="list" stripe>
      <el-table-column prop="customerName" label="客户名称" min-width="100" show-overflow-tooltip />
      <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}">
          <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="billCode" 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.revenueType === 0">收入</span>
          <span v-if="row.revenueType === 1">支出</span>
        </template>
      </el-table-column>
      <el-table-column prop="actReceivableFee" 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.payType === 0">现金</span>
          <span v-if="row.payType === 1">网银转账</span>
          <span v-if="row.payType === 2">POS机</span>
          <span v-if="row.payType === 3">支付宝</span>
          <span v-if="row.payType === 4">微信</span>
          <span v-if="row.payType === 5">转账支票</span>
          <span v-if="row.payType === 6">其他</span>
        </template>
      </el-table-column>
      <el-table-column prop="payDateEnd" label="入账日期" show-overflow-tooltip />
      <el-table-column prop="createDate" label="创建日期" show-overflow-tooltip />
      <el-table-column prop="realname" label="创建人" show-overflow-tooltip />
      <el-table-column label="状态" min-width="100" fixed="right" show-overflow-tooltip>
        <template slot-scope="{row}">
          <el-tag type="success" v-if="row.status === 0">开启</el-tag>
          <el-tag type="info" v-if="row.status === 1">关闭</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作" min-width="190" fixed="right">
        <template slot-scope="{row}">
          <el-button type="text">查看详情</el-button>
          <el-button type="text" @click="closeDW(row.id)" v-if="row.status !== 1">关闭流水</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="mt20">
      <Pagination @size-change="handleSizeChange" @current-change="getList" :pagination="pagination" />
    </div>
    <Edit v-if="showEdit" ref="EditRef" @success="getList" @close="showEdit = false" />
  </div>
</template>
 
<script>
import Pagination from '@/components/common/Pagination'
import QueryForm from '@/components/common/QueryForm'
import Edit from './components/paymentsEdit.vue'
import { fetchList, close } from '@/api/ywContractRevenue'
export default {
  components: {
    Pagination,
    QueryForm,
    Edit
  },
  data() {
    return {
      loading: false,
      showEdit: false,
      pagination: {
        pageSize: 10,
        page: 1,
        total: 0
      },
      filters: {},
      list: [],
      total: 0,
      queryFormConfig: {
        formItems: [
          {
            filed: 'customerName',
            type: 'input',
            label: '客户名称'
          },
          {
            filed: 'revenueType',
            type: 'select',
            label: '收支类型',
            options: [
              { value: 0, label: '收入' },
              { value: 1, label: '支出' }
            ]
          },
          {
            filed: 'payType',
            type: 'select',
            label: '收款方式',
            options: [
              { value: 0, label: '现金' },
              { value: 1, label: '网银转账' },
              { value: 2, label: 'POS机' },
              { value: 3, label: '支付宝' },
              { value: 4, label: '微信' },
              { value: 5, label: '转账支票' },
              { value: 6, label: '其他' }
            ]
          },
          {
            filed: 'payDate',
            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 => {
        this.loading = false
        this.list = res.records || []
        this.pagination.total = res.total || 0
      }, () => {
        this.loading = false
      })
    },
    closeDW (id) {
      this.$confirm('确认关闭此流水吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        close(id)
          .then(res => {
            this.getList()
          })
      }).catch(() => {
      
      });
    },
    handleEdit(row) {
      this.showEdit = true
      this.$nextTick(() => {
        this.$refs.EditRef.isShowModal = true
        if (row && row.id) {
          this.$refs.EditRef.getDetail(row.id)
        }
      })
 
    },
    handleDel(row) {
      let message = `确认删除该记录吗?`
      this.$dialog.deleteConfirm(message)
        .then(() => {
          this.isWorking.delete = true
          deleteById(row.id)
            .then(() => {
              this.$tip.apiSuccess('删除成功')
              this.getList()
            })
        })
        .catch(() => { })
    },
    clear() {
      this.filters = {}
      this.pagination.pageSize = 10
      this.pagination.page = 1
      this.getList()
    },
    handleSizeChange(capacity) {
      this.pagination.pageSize = capacity
    }
  }
}
</script>
 
<style></style>