emoticon_xcx_back/src/views/business/payments/index.vue
2023-06-02 21:29:46 +08:00

172 lines
5.3 KiB
Vue

<!--
* @Descripttion: (支付订单/tb_payment)
* @version: (1.0)
* @Author: (admin)
* @Date: (2022-12-15)
* @LastEditors: (admin)
* @LastEditTime: (2022-12-15)
-->
<template>
<div class="app-container">
<el-row :gutter="24">
<!-- 搜索框 queryParams.需要搜索的字段 -->
<el-form :model="queryParams" label-position="left" style="margin:15px;" inline ref="queryForm" label-width="100px" v-show="showSearch"
@submit.prevent>
<el-form-item label="操作状态" prop="paymentStatus">
<el-select v-model="queryParams.paymentStatus" placeholder="请选择操作状态">
<el-option v-for="item in paymentStatusOptions" :key="item.dictValue" :label="item.dictLabel" :value="item.dictValue"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button icon="search" type="primary" @click="handleQuery">{{ $t('btn.search') }}</el-button>
<el-button icon="refresh" @click="resetQuery">{{ $t('btn.reset') }}</el-button>
</el-form-item>
</el-form>
</el-row>
<!-- 工具按钮 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="download" @click="handleExport" v-hasPermi="['business:payment:export']">
{{ $t('btn.export') }}
</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 表格渲染 prop="对应的字段"-->
<el-table v-loading="loading" :data="dataList" ref="tableRef" border highlight-current-row @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column prop="paymentStatus" label="操作状态" align="center">
<template #default="scope">
<dict-tag :options=" paymentStatusOptions" :value="scope.row.paymentStatus" />
</template>
</el-table-column>
<el-table-column prop="paymentMoney" label="核销后价格/操作金额" align="center" />
<el-table-column prop="paymentNumber" label="系统订单号" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="customerGuid" label="操作客户guid(外键)" align="center" :show-overflow-tooltip="true" />
<el-table-column prop="paymentBusinessGuid" label="业务订单guid(外键)" align="center" />
<el-table-column prop="paymentBuytype" label="购买类型(1| )" align="center">
<template #default="scope">
<dict-tag :options=" paymentBuytypeOptions" :value="scope.row.paymentBuytype" />
</template>
</el-table-column>
<el-table-column label="操作" width="350">
<template #default="scope">
<el-button size="small" icon="view" @click="handleDetail(scope.row)">查看</el-button>
</template>
</el-table-column>
</el-table>
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
@pagination="getList" />
</div>
<!-- 详情 -->
<DetailDialog v-model="DetailDialogVisible" :data="DetailDialogRow" :done="() => resetQuery()"></DetailDialog>
</template>
<script setup name="payment">
import { ElMessageBox } from 'element-plus'
import modal from '@/plugins/modal.js'
import { exportPayment, paymentList, delPayment } from '@/api/business/payments/payment.js'
import DetailDialog from "./components/DetailDialog.vue";
const DetailDialogVisible = ref(false);
const DetailDialogRow = ref({});
const { proxy } = getCurrentInstance()
// 选中categoryId数组数组
const ids = ref([])
// 非单选禁用
const single = ref(true)
// 非多个禁用
const multiple = ref(true)
// 显示搜索条件
const showSearch = ref(true)
// 数据列表
const dataList = ref([])
// 总记录数
const total = ref(0)
// 是否加载
const loading = ref(true)
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10
},
})
// 操作状态选项列表
const paymentStatusOptions = ref([
{ dictLabel: '', dictValue: '1' },
{ dictLabel: '', dictValue: '2' },
]);
// 购买类型(1| )选项列表
const paymentBuytypeOptions = ref([
{ dictLabel: '', dictValue: '1' },
{ dictLabel: '', dictValue: '2' },
]);
const { queryParams } = toRefs(data)
// 业务参数
// 查询数据
function getList() {
loading.value = true
paymentList(queryParams.value).then((res) => {
if (res.code == 200) {
loading.value = false
dataList.value = res.data.result
total.value = res.data.totalNum
}
})
}
// 多选框选中数据
function handleSelectionChange(selection) {
ids.value = selection.map((item) => item.PaymentId)
single.value = selection.length != 1
multiple.value = !selection.length
}
/** 重置查询操作 */
function resetQuery() {
proxy.resetForm('queryForm')
handleQuery()
}
/** 搜索按钮操作 */
function handleQuery() {
getList()
}
// 导出按钮操作
function handleExport() {
ElMessageBox.confirm('是否确认导出所有数据?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(function () {
return exportPayment(queryParams)
})
.then((response) => {
proxy.download(response.data.path)
})
}
// 详情
function handleDetail(row) {
DetailDialogVisible.value = true
DetailDialogRow.value = row
}
handleQuery()
</script>