249 lines
6.4 KiB
Vue
249 lines
6.4 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<!-- PDF导出组件 -->
|
|
<settlement-pdf
|
|
v-if="currentSettlementId"
|
|
ref="settlementPdf"
|
|
:settlement-order-id="currentSettlementId"
|
|
v-show="false"
|
|
/>
|
|
<!-- 查询及操作区域 -->
|
|
<div class="head-container">
|
|
<div class="filter-container">
|
|
<el-input
|
|
v-model="query.batchNo"
|
|
placeholder="请输入结算单批次号"
|
|
class="filter-item"
|
|
style="width: 200px;"
|
|
clearable
|
|
/>
|
|
<el-button type="primary" class="filter-item" @click="handleSearch">
|
|
<i class="el-icon-search" style="color: white;" />
|
|
查询
|
|
</el-button>
|
|
<el-button type="primary" class="filter-item" @click="handleGenerate">
|
|
生成结算单
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 表格 -->
|
|
<el-table
|
|
ref="table"
|
|
v-loading="loading"
|
|
:data="tableData"
|
|
style="width: 100%"
|
|
@selection-change="handleSelectionChange"
|
|
>
|
|
<el-table-column prop="batchNo" label="订单批次号" align="center" />
|
|
<el-table-column prop="settlementTimeScope" label="结算时间" width="180" align="center" />
|
|
<el-table-column prop="operator" label="制单人" align="center" />
|
|
<el-table-column prop="updateTime" label="导出时间" width="180" align="center" />
|
|
<el-table-column prop="settlementStatus" label="结算状态" align="center">
|
|
<template slot-scope="scope">
|
|
<span :class="getSettlementStatusClass(scope.row.rawSettlementStatus, true)">
|
|
{{ getSettlementStatusText(scope.row.rawSettlementStatus, true) }}
|
|
</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="200" align="center">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
type="text"
|
|
size="small"
|
|
@click="handleDetail(scope.row)"
|
|
>
|
|
查看详情
|
|
</el-button>
|
|
<el-button
|
|
type="text"
|
|
size="small"
|
|
@click="handlePrint(scope.row)"
|
|
>
|
|
打印结算单
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<!-- 分页 -->
|
|
<div class="pagination-container">
|
|
<el-pagination
|
|
:current-page.sync="page.current"
|
|
:page-sizes="[10, 20, 50, 100]"
|
|
:page-size="page.size"
|
|
:total="page.total"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
@size-change="handleSizeChange"
|
|
@current-change="handleCurrentChange"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { getSettleOrderList } from '@/api/order'
|
|
import { getUserNameValue } from '@/api/dropdown'
|
|
import SettlementPdf from './orderDetail/settlementPdf.vue'
|
|
import { getSettlementStatusText, getSettlementStatusClass } from "@/utils/orderStatus";
|
|
|
|
export default {
|
|
components: {
|
|
SettlementPdf
|
|
},
|
|
name: 'settlementOrder',
|
|
data() {
|
|
return {
|
|
loading: false,
|
|
query: {
|
|
batchNo: ''
|
|
},
|
|
page: {
|
|
current: 1,
|
|
size: 10,
|
|
total: 2
|
|
},
|
|
currentSettlementId: null,
|
|
tableData: [
|
|
{
|
|
attractionId: 2,
|
|
batchNo: "JS_2025072600008",
|
|
createBy: "admin",
|
|
createTime: "2025-07-26 14:42:38",
|
|
operatorId: 1,
|
|
settlementStatus: 2,
|
|
settlementTimeScope: "2025-07-19 17:00:00~2025-07-19 17:00:00",
|
|
updateBy: "admin",
|
|
updateTime: "2025-07-26 14:42:38"
|
|
},
|
|
],
|
|
selection: []
|
|
}
|
|
},
|
|
created() {
|
|
this.fetchData()
|
|
},
|
|
methods: {
|
|
getSettlementStatusText,
|
|
getSettlementStatusClass,
|
|
async fetchData() {
|
|
this.loading = true
|
|
try {
|
|
const response = await getSettleOrderList(this.query)
|
|
const operatorList = await getUserNameValue(0);
|
|
|
|
const operatorMap = new Map();
|
|
operatorList.forEach(item => {
|
|
operatorMap.set(item.key, item.value);
|
|
});
|
|
response.records = response.records.map(record => ({
|
|
...record,
|
|
rawSettlementStatus: record.settlementStatus,
|
|
operator: record.operatorId ? (operatorMap.get(record.operatorId) || '未知') : '未知',
|
|
}))
|
|
this.tableData = response.records || []
|
|
this.page.total = Number(response.total) || 0
|
|
} catch (error) {
|
|
console.error('获取结算单列表失败:', error)
|
|
} finally {
|
|
this.loading = false
|
|
}
|
|
},
|
|
getSettlementStatus(status) {
|
|
return getSettlementStatusText(status, true);
|
|
},
|
|
handleSearch() {
|
|
this.page.current = 1
|
|
this.fetchData()
|
|
},
|
|
handleSelectionChange(val) {
|
|
this.selection = val
|
|
},
|
|
handleSizeChange(val) {
|
|
this.page.size = val
|
|
this.fetchData()
|
|
},
|
|
handleCurrentChange(val) {
|
|
this.page.current = val
|
|
this.fetchData()
|
|
},
|
|
handleDetail(row) {
|
|
this.$router.push({
|
|
path: '/order/orderDetail',
|
|
query: { orderId: row.id.toString() }
|
|
})
|
|
},
|
|
async handlePrint(row) {
|
|
if (row.id) {
|
|
this.currentSettlementId = row.id.toString()
|
|
try {
|
|
await this.$nextTick()
|
|
await this.$refs.settlementPdf.generatePDF()
|
|
} catch (error) {
|
|
console.error('Error generating PDF:', error)
|
|
this.$message.error('导出PDF失败')
|
|
}
|
|
} else {
|
|
this.$message.warning('没有结算单ID')
|
|
}
|
|
},
|
|
handleGenerate() {
|
|
this.$router.push('/order/generateOrder')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.app-container {
|
|
padding: 20px;
|
|
}
|
|
|
|
.filter-container {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
|
|
.filter-item {
|
|
margin-right: 10px;
|
|
}
|
|
}
|
|
|
|
// .pagination-container {
|
|
// position: fixed;
|
|
// bottom: 0;
|
|
// right: 0;
|
|
// left: 200px;
|
|
// height: 150px;
|
|
// background: white;
|
|
// padding: 10px;
|
|
// text-align: left;
|
|
// box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.08);
|
|
// }
|
|
// .el-pagination {
|
|
// padding: 2px 25px;
|
|
// }
|
|
|
|
.status-default { color: #909399; }
|
|
.status-pending { color: #909399; }
|
|
.status-processing { color: #409EFF; }
|
|
.status-success { color: #67c23a; }
|
|
.status-warning { color: #e6a23c; }
|
|
.status-danger { color: #f56c6c; }
|
|
|
|
.el-table {
|
|
margin-bottom: 70px;
|
|
margin-top: 20px;
|
|
::v-deep .el-table__body-wrapper {
|
|
overflow-x: auto;
|
|
}
|
|
}
|
|
|
|
.el-button--text {
|
|
color: #409EFF;
|
|
&:hover {
|
|
color: #66b1ff;
|
|
}
|
|
}
|
|
</style>
|