<template>
|
<TableLayout :permissions="['business:ywcustomerrechargerecord:query']">
|
<el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
|
<el-form-item label="客户名称" prop="customerName">
|
<el-input v-model="searchForm.customerName" placeholder="客户名称" clearable @keypress.enter.native="search"/>
|
</el-form-item>
|
<el-form-item label="业务类型" prop="type">
|
<el-select v-model="searchForm.type" clearable placeholder="全部" style="min-width: 120px">
|
<el-option label="电表" :value="0"/>
|
<el-option label="空调" :value="1"/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="充值状态" prop="status">
|
<el-select v-model="searchForm.status" clearable placeholder="全部" style="min-width: 120px">
|
<el-option label="充值中" :value="0"/>
|
<el-option label="充值成功" :value="1"/>
|
<el-option label="充值失败" :value="2"/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="提交时间">
|
<el-date-picker
|
v-model="searchForm.dateRange"
|
type="datetimerange"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
start-placeholder="开始"
|
end-placeholder="结束"
|
style="width: 360px"
|
/>
|
</el-form-item>
|
<section>
|
<el-button type="primary" icon="el-icon-search" @click="search">查询</el-button>
|
<el-button icon="el-icon-refresh" @click="reset">重置</el-button>
|
</section>
|
</el-form>
|
<template v-slot:table-wrap>
|
<ul class="toolbar">
|
<li>
|
<el-button @click="exportExcel" :loading="isWorking.export" v-permissions="['business:ywcustomerrechargerecord:exportExcel']">导出</el-button>
|
</li>
|
</ul>
|
<el-table v-loading="isWorking.search" :data="tableData.list" stripe>
|
<el-table-column prop="customerName" label="客户名称" min-width="130" align="center" show-overflow-tooltip/>
|
<el-table-column label="业务类型" min-width="90" align="center">
|
<template slot-scope="{ row }">{{ row.type === 1 ? '空调' : '电表' }}</template>
|
</el-table-column>
|
<el-table-column prop="deviceInfo" label="设备信息" min-width="180" align="center" show-overflow-tooltip/>
|
<el-table-column prop="money" label="充值金额(元)" min-width="110" align="center"/>
|
<el-table-column prop="banlance" label="充值前余额" min-width="110" align="center"/>
|
<el-table-column prop="balanceAfter" label="充值后余额" min-width="110" align="center"/>
|
<el-table-column label="状态" min-width="100" align="center">
|
<template slot-scope="{ row }">
|
<span v-if="row.status === 0" class="orange">充值中</span>
|
<span v-else-if="row.status === 1" class="green">充值成功</span>
|
<span v-else-if="row.status === 2" class="red">充值失败</span>
|
<span v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="oprId" label="任务ID" min-width="180" align="center" show-overflow-tooltip/>
|
<el-table-column prop="remark" label="备注" min-width="120" align="center" show-overflow-tooltip/>
|
<el-table-column prop="statusInfo" label="状态说明" min-width="140" align="center" show-overflow-tooltip/>
|
<el-table-column prop="createDate" label="提交时间" min-width="160" align="center"/>
|
<el-table-column prop="statusTime" label="状态更新时间" min-width="160" align="center"/>
|
<el-table-column label="操作" min-width="160" align="center" fixed="right">
|
<template slot-scope="{ row }">
|
<el-button v-if="row.status === 2" type="text" v-permissions="['business:ywcustomerrechargerecord:retry']" @click="handleRetry(row)">再次提交</el-button>
|
<el-button v-if="row.status === 0" type="text" v-permissions="['business:ywcustomerrechargerecord:syncStatus']" @click="handleSync(row)">手动同步</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"/>
|
</template>
|
</TableLayout>
|
</template>
|
|
<script>
|
import BaseTable from '@/components/base/BaseTable'
|
import TableLayout from '@/layouts/TableLayout'
|
import Pagination from '@/components/common/Pagination'
|
import * as api from '@/api/business/ywcustomerrecharge'
|
|
export default {
|
name: 'YwCustomerRechargeRecord',
|
extends: BaseTable,
|
components: { TableLayout, Pagination },
|
data () {
|
return {
|
searchForm: {
|
customerName: '',
|
type: null,
|
status: null,
|
dateRange: null
|
}
|
}
|
},
|
created () {
|
this.search()
|
},
|
methods: {
|
handlePageChange (pageIndex) {
|
this.tableData.pagination.pageIndex = pageIndex || this.tableData.pagination.pageIndex
|
this.loadList()
|
},
|
loadList () {
|
this.isWorking.search = true
|
api.rechargeRecordPage({
|
page: this.tableData.pagination.pageIndex,
|
capacity: this.tableData.pagination.pageSize,
|
model: this.buildSearchModel()
|
}).then(data => {
|
this.tableData.list = data.records
|
this.tableData.pagination.total = data.total
|
}).catch(() => {}).finally(() => { this.isWorking.search = false })
|
},
|
search () {
|
this.tableData.pagination.pageIndex = 1
|
this.loadList()
|
},
|
buildSearchModel () {
|
const model = {}
|
if (this.searchForm.customerName) model.customerName = this.searchForm.customerName
|
if (this.searchForm.type !== '' && this.searchForm.type !== null) model.type = this.searchForm.type
|
if (this.searchForm.status !== '' && this.searchForm.status !== null) model.status = this.searchForm.status
|
if (this.searchForm.dateRange && this.searchForm.dateRange.length === 2) {
|
model.createTimeBegin = this.searchForm.dateRange[0]
|
model.createTimeEnd = this.searchForm.dateRange[1]
|
}
|
return model
|
},
|
reset () {
|
this.searchForm = { customerName: '', type: null, status: null, dateRange: null }
|
this.search()
|
},
|
exportExcel () {
|
this.$dialog.exportConfirm('确认导出吗?')
|
.then(() => {
|
this.isWorking.export = true
|
api.exportRechargeRecord({ page: 1, capacity: 1000000, model: this.buildSearchModel() })
|
.then(response => { this.download(response) })
|
.catch(e => this.$tip.apiFailed(e))
|
.finally(() => { this.isWorking.export = false })
|
})
|
.catch(() => {})
|
},
|
handleRetry (row) {
|
this.$dialog.actionConfirm('确认再次提交该充值吗?', '操作确认')
|
.then(() => api.retryRecharge(row.id))
|
.then(msg => {
|
this.$tip.success(msg || '已提交')
|
this.loadList()
|
})
|
.catch(e => { if (e !== 'cancel') this.$tip.apiFailed(e) })
|
},
|
handleSync (row) {
|
api.syncRechargeStatus(row.id)
|
.then(msg => {
|
this.$tip.success(msg || '同步完成')
|
this.loadList()
|
})
|
.catch(e => this.$tip.apiFailed(e))
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
.green { color: #67c23a; }
|
.red { color: #f56c6c; }
|
.orange { color: #e6a23c; }
|
</style>
|