Compare commits
No commits in common. "7612792e0888782ee0f20155e767a01dfd0e73ec" and "a187d0e8fa565df029a82aeae70c4a0c3b00abdb" have entirely different histories.
7612792e08
...
a187d0e8fa
@ -52,8 +52,6 @@ export default {
|
|||||||
getInvoiceById: (params = {}) => request.get(`/transactions/receipts/${params.id}`, { params }),
|
getInvoiceById: (params = {}) => request.get(`/transactions/receipts/${params.id}`, { params }),
|
||||||
// 后端接口要求请求体包裹在 data 字段下
|
// 后端接口要求请求体包裹在 data 字段下
|
||||||
sendInvoice: (data = {}) => request.post('/transactions/send-email', { data }),
|
sendInvoice: (data = {}) => request.post('/transactions/send-email', { data }),
|
||||||
// 退款
|
|
||||||
refundInvoice: (data = {}) => request.post('/invoice/update-status', data),
|
|
||||||
// invoice headers
|
// invoice headers
|
||||||
getInvoiceHeaders: (params = {}) => request.get('/invoice/list', { params }),
|
getInvoiceHeaders: (params = {}) => request.get('/invoice/list', { params }),
|
||||||
// valuation (估值评估)
|
// valuation (估值评估)
|
||||||
|
|||||||
@ -172,16 +172,18 @@ const modalTitle = props.mode === 'invoice' ? '开票' : '查看发票'
|
|||||||
<div style="width: 100%">
|
<div style="width: 100%">
|
||||||
<NUpload
|
<NUpload
|
||||||
v-model:file-list="fileList"
|
v-model:file-list="fileList"
|
||||||
:max="3"
|
multiple
|
||||||
|
:max="2"
|
||||||
list-type="image-card"
|
list-type="image-card"
|
||||||
:action="uploadUrl"
|
:action="uploadUrl"
|
||||||
:headers="uploadHeaders"
|
:headers="uploadHeaders"
|
||||||
:before-upload="beforeUpload"
|
:before-upload="beforeUpload"
|
||||||
@finish="handleUploadFinish"
|
@finish="handleUploadFinish"
|
||||||
:disabled="mode === 'view'"
|
:disabled="mode === 'view'"
|
||||||
show-preview-button
|
|
||||||
show-download-button
|
|
||||||
>
|
>
|
||||||
|
<div class="upload-trigger">
|
||||||
|
<div class="upload-icon">+</div>
|
||||||
|
</div>
|
||||||
</NUpload>
|
</NUpload>
|
||||||
</div>
|
</div>
|
||||||
</NFormItem>
|
</NFormItem>
|
||||||
@ -221,4 +223,13 @@ const modalTitle = props.mode === 'invoice' ? '开票' : '查看发票'
|
|||||||
color: #d9d9d9;
|
color: #d9d9d9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.n-upload-file-list) {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.n-upload-trigger) {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { h, onMounted, ref, resolveDirective, withDirectives } from 'vue'
|
import { h, onMounted, ref, resolveDirective, withDirectives } from 'vue'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { NButton, NInput, NTag, NSelect, NDatePicker, useMessage, useDialog } from 'naive-ui'
|
import { NButton, NInput, NTag, NSelect, NDatePicker } from 'naive-ui'
|
||||||
|
|
||||||
import CommonPage from '@/components/page/CommonPage.vue'
|
import CommonPage from '@/components/page/CommonPage.vue'
|
||||||
import QueryBarItem from '@/components/query-bar/QueryBarItem.vue'
|
import QueryBarItem from '@/components/query-bar/QueryBarItem.vue'
|
||||||
@ -16,8 +16,6 @@ defineOptions({ name: '开票记录' })
|
|||||||
const $table = ref(null)
|
const $table = ref(null)
|
||||||
const queryItems = ref({})
|
const queryItems = ref({})
|
||||||
const vPermission = resolveDirective('permission')
|
const vPermission = resolveDirective('permission')
|
||||||
const $message = useMessage()
|
|
||||||
const dialog = useDialog()
|
|
||||||
|
|
||||||
// 开票/查看弹窗相关状态
|
// 开票/查看弹窗相关状态
|
||||||
const invoiceModalVisible = ref(false)
|
const invoiceModalVisible = ref(false)
|
||||||
@ -192,60 +190,23 @@ const columns = [
|
|||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
key: 'actions',
|
key: 'actions',
|
||||||
width: 150,
|
width: 80,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
render(row) {
|
render(row) {
|
||||||
const buttons = []
|
const editable = row.status === 'pending'
|
||||||
|
return withDirectives(
|
||||||
if (row.status === 'pending') {
|
h(
|
||||||
// 未开票:显示"开票"和"退款"按钮
|
NButton,
|
||||||
buttons.push(
|
{
|
||||||
withDirectives(
|
size: 'small',
|
||||||
h(
|
type: editable ? 'primary' : 'default',
|
||||||
NButton,
|
onClick: () => handleInvoice(row),
|
||||||
{
|
},
|
||||||
size: 'small',
|
{ default: () => '开票' }
|
||||||
type: 'primary',
|
),
|
||||||
onClick: () => handleInvoice(row),
|
[[vPermission, 'post/api/v1/transactions/send-email']]
|
||||||
},
|
)
|
||||||
{ default: () => '开票' }
|
|
||||||
),
|
|
||||||
[[vPermission, 'post/api/v1/transactions/send-email']]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
buttons.push(
|
|
||||||
withDirectives(
|
|
||||||
h(
|
|
||||||
NButton,
|
|
||||||
{
|
|
||||||
size: 'small',
|
|
||||||
type: 'warning',
|
|
||||||
onClick: () => handleRefund(row),
|
|
||||||
style: { marginLeft: '8px' },
|
|
||||||
},
|
|
||||||
{ default: () => '退款' }
|
|
||||||
),
|
|
||||||
[[vPermission, 'post/api/v1/invoice/update-status']]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else if (row.status === 'invoiced') {
|
|
||||||
// 已开票:显示"查看"按钮
|
|
||||||
buttons.push(
|
|
||||||
h(
|
|
||||||
NButton,
|
|
||||||
{
|
|
||||||
size: 'small',
|
|
||||||
type: 'default',
|
|
||||||
onClick: () => handleInvoice(row),
|
|
||||||
},
|
|
||||||
{ default: () => '查看' }
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// 已退款状态不显示任何按钮
|
|
||||||
|
|
||||||
return h('div', { style: 'display: flex; gap: 8px; justify-content: center;' }, buttons)
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -258,35 +219,7 @@ function handleInvoice(row) {
|
|||||||
invoiceModalVisible.value = true
|
invoiceModalVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退款处理
|
// 确认发送邮件
|
||||||
function handleRefund(row) {
|
|
||||||
dialog.warning({
|
|
||||||
title: '确认退款',
|
|
||||||
content: `确定要将此订单标记为已退款吗?`,
|
|
||||||
positiveText: '确定',
|
|
||||||
negativeText: '取消',
|
|
||||||
onPositiveClick: async () => {
|
|
||||||
try {
|
|
||||||
const invoiceId = row.invoice_id
|
|
||||||
if (!invoiceId) {
|
|
||||||
$message.error('无法获取发票ID')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
await api.refundInvoice({
|
|
||||||
id: invoiceId,
|
|
||||||
status: 'refunded',
|
|
||||||
})
|
|
||||||
$message.success('退款成功')
|
|
||||||
$table.value?.handleSearch()
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
$message.error(error?.message || '退款失败')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// 确认发送邮件
|
// 确认发送邮件
|
||||||
async function handleInvoiceConfirm(formData) {
|
async function handleInvoiceConfirm(formData) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -409,6 +409,22 @@ const handlePreview = (file) => {
|
|||||||
gap: 12px;
|
gap: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 缩略图上传组件样式 */
|
||||||
|
:deep(.n-upload) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.n-upload-file-list) {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.n-upload-file-card) {
|
||||||
|
aspect-ratio: 1;
|
||||||
|
border-radius: 6px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
/* 响应式调整 */
|
/* 响应式调整 */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user