fix: update some files
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m44s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m44s
This commit is contained in:
@@ -143,17 +143,17 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { h } from 'vue'
|
||||
import { computed, h } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { RefundService, ShopService, OrderService } from '@/api/modules'
|
||||
import { ElMessage, ElTag, ElButton } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox, ElTag, ElButton } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import type {
|
||||
Refund,
|
||||
RefundQueryParams,
|
||||
import {
|
||||
RefundStatus,
|
||||
ResubmitRefundRequest,
|
||||
RefundAttachment
|
||||
type Refund,
|
||||
type RefundQueryParams,
|
||||
type ResubmitRefundRequest,
|
||||
type RefundAttachment
|
||||
} from '@/types/api'
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
@@ -183,10 +183,23 @@
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const { hasAuth } = useAuth()
|
||||
const isRestrictedCustomerRole = computed(() => [3, 4].includes(Number(userStore.info.user_type)))
|
||||
const hiddenInternalColumnProps = new Set([
|
||||
'approval_provider',
|
||||
'submitter_name',
|
||||
'current_approver_summary',
|
||||
'processing_status_name',
|
||||
'refund_reason',
|
||||
'reject_reason',
|
||||
'remark'
|
||||
])
|
||||
const shouldShowInternalColumn = (prop?: string) =>
|
||||
!isRestrictedCustomerRole.value || !hiddenInternalColumnProps.has(prop || '')
|
||||
|
||||
const loading = ref(false)
|
||||
const resubmitLoading = ref(false)
|
||||
const resubmitVoucherUploading = ref(false)
|
||||
const triggerApprovalLoading = ref(false)
|
||||
const tableRef = ref()
|
||||
const resubmitUploadRef = ref<InstanceType<typeof VoucherUpload>>()
|
||||
const createDialogVisible = ref(false)
|
||||
@@ -303,7 +316,7 @@
|
||||
{ label: '创建时间', prop: 'created_at' },
|
||||
{ label: '审批时间', prop: 'processed_at' },
|
||||
{ label: '更新时间', prop: 'updated_at' }
|
||||
]
|
||||
].filter(({ prop }) => shouldShowInternalColumn(prop))
|
||||
|
||||
const resubmitFormRef = ref<FormInstance>()
|
||||
|
||||
@@ -344,175 +357,177 @@
|
||||
}
|
||||
|
||||
// 动态列配置
|
||||
const { columnChecks, columns } = useCheckedColumns(() => [
|
||||
{
|
||||
prop: 'refund_no',
|
||||
label: '退款单号',
|
||||
minWidth: 210,
|
||||
formatter: (row: Refund) => {
|
||||
return h(
|
||||
'span',
|
||||
{
|
||||
style: 'color: var(--el-color-primary); cursor: pointer; text-decoration: underline;',
|
||||
onClick: (e: MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
handleNameClick(row)
|
||||
}
|
||||
},
|
||||
row.refund_no
|
||||
)
|
||||
const { columnChecks, columns } = useCheckedColumns(() =>
|
||||
[
|
||||
{
|
||||
prop: 'refund_no',
|
||||
label: '退款单号',
|
||||
minWidth: 210,
|
||||
formatter: (row: Refund) => {
|
||||
return h(
|
||||
'span',
|
||||
{
|
||||
style: 'color: var(--el-color-primary); cursor: pointer; text-decoration: underline;',
|
||||
onClick: (e: MouseEvent) => {
|
||||
e.stopPropagation()
|
||||
handleNameClick(row)
|
||||
}
|
||||
},
|
||||
row.refund_no
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'shop_name',
|
||||
label: '店铺名称',
|
||||
width: 160
|
||||
},
|
||||
{
|
||||
prop: 'order_no',
|
||||
label: '订单号',
|
||||
width: 180,
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'asset_identifier',
|
||||
label: '资产标识符',
|
||||
width: 200,
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'asset_type',
|
||||
label: '资产类型',
|
||||
width: 100,
|
||||
formatter: (row: Refund) =>
|
||||
row.asset_type === 'device'
|
||||
? '设备'
|
||||
: row.asset_type === 'card'
|
||||
? '单卡'
|
||||
: row.asset_type === 'iot_card'
|
||||
? 'IoT卡'
|
||||
: row.asset_type || '-'
|
||||
},
|
||||
{
|
||||
prop: 'requested_refund_amount',
|
||||
label: '申请退款金额',
|
||||
width: 150,
|
||||
formatter: (row: Refund) => formatCurrency(row.requested_refund_amount)
|
||||
},
|
||||
{
|
||||
prop: 'approved_refund_amount',
|
||||
label: '实际退款金额',
|
||||
width: 150,
|
||||
formatter: (row: Refund) => formatCurrency(row.approved_refund_amount)
|
||||
},
|
||||
{
|
||||
prop: 'actual_received_amount',
|
||||
label: '实收金额',
|
||||
width: 120,
|
||||
formatter: (row: Refund) => formatCurrency(row.actual_received_amount)
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: Refund) => {
|
||||
return h(ElTag, { type: getStatusType(row.status) }, () => row.status_name || '-')
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'approval_provider',
|
||||
label: '审批渠道',
|
||||
width: 110,
|
||||
formatter: (row: Refund) => {
|
||||
if (row.approval_provider === 'wecom' || row.approval_source === 'wecom') return '企微'
|
||||
if (row.approval_source === 'legacy') return '历史审批'
|
||||
return row.approval_provider || row.approval_source || '-'
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'submitter_name',
|
||||
label: '提交人',
|
||||
width: 120,
|
||||
showOverflowTooltip: true,
|
||||
formatter: (row: Refund) => row.submitter_name || '-'
|
||||
},
|
||||
{
|
||||
prop: 'approval_status',
|
||||
label: '审批状态',
|
||||
width: 120,
|
||||
formatter: (row: Refund) => row.approval_status_name || '-'
|
||||
},
|
||||
{
|
||||
prop: 'current_approver_summary',
|
||||
label: '当前审批人摘要',
|
||||
minWidth: 180,
|
||||
showOverflowTooltip: true,
|
||||
formatter: (row: Refund) => getCurrentApproverSummaryText(row)
|
||||
},
|
||||
{
|
||||
prop: 'processing_status_name',
|
||||
label: '业务处理状态',
|
||||
width: 140,
|
||||
showOverflowTooltip: true,
|
||||
formatter: (row: Refund) => getProcessingStatusText(row)
|
||||
},
|
||||
{
|
||||
prop: 'refund_reason',
|
||||
label: '退款原因',
|
||||
minWidth: 200,
|
||||
formatter: (row: Refund) => row.refund_reason || '-'
|
||||
},
|
||||
{
|
||||
prop: 'reject_reason',
|
||||
label: '拒绝原因',
|
||||
minWidth: 200,
|
||||
formatter: (row: Refund) => row.reject_reason || '-'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '审批备注',
|
||||
minWidth: 200,
|
||||
formatter: (row: Refund) => row.remark || '-'
|
||||
},
|
||||
{
|
||||
prop: 'asset_reset',
|
||||
label: '资产重置',
|
||||
width: 100,
|
||||
formatter: (row: Refund) => {
|
||||
return h(ElTag, { type: row.asset_reset ? 'success' : 'info' }, () =>
|
||||
row.asset_reset ? '是' : '否'
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'commission_deducted',
|
||||
label: '佣金扣除',
|
||||
width: 100,
|
||||
formatter: (row: Refund) => {
|
||||
return h(ElTag, { type: row.commission_deducted ? 'success' : 'info' }, () =>
|
||||
row.commission_deducted ? '是' : '否'
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '创建时间',
|
||||
width: 180,
|
||||
formatter: (row: Refund) => formatDateTime(row.created_at)
|
||||
},
|
||||
{
|
||||
prop: 'processed_at',
|
||||
label: '审批时间',
|
||||
width: 180,
|
||||
formatter: (row: Refund) => (row.processed_at ? formatDateTime(row.processed_at) : '-')
|
||||
},
|
||||
{
|
||||
prop: 'updated_at',
|
||||
label: '更新时间',
|
||||
width: 180,
|
||||
formatter: (row: Refund) => formatDateTime(row.updated_at)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'shop_name',
|
||||
label: '店铺名称',
|
||||
width: 160
|
||||
},
|
||||
{
|
||||
prop: 'order_no',
|
||||
label: '订单号',
|
||||
width: 180,
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'asset_identifier',
|
||||
label: '资产标识符',
|
||||
width: 200,
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'asset_type',
|
||||
label: '资产类型',
|
||||
width: 100,
|
||||
formatter: (row: Refund) =>
|
||||
row.asset_type === 'device'
|
||||
? '设备'
|
||||
: row.asset_type === 'card'
|
||||
? '单卡'
|
||||
: row.asset_type === 'iot_card'
|
||||
? 'IoT卡'
|
||||
: row.asset_type || '-'
|
||||
},
|
||||
{
|
||||
prop: 'requested_refund_amount',
|
||||
label: '申请退款金额',
|
||||
width: 150,
|
||||
formatter: (row: Refund) => formatCurrency(row.requested_refund_amount)
|
||||
},
|
||||
{
|
||||
prop: 'approved_refund_amount',
|
||||
label: '实际退款金额',
|
||||
width: 150,
|
||||
formatter: (row: Refund) => formatCurrency(row.approved_refund_amount)
|
||||
},
|
||||
{
|
||||
prop: 'actual_received_amount',
|
||||
label: '实收金额',
|
||||
width: 120,
|
||||
formatter: (row: Refund) => formatCurrency(row.actual_received_amount)
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
width: 100,
|
||||
formatter: (row: Refund) => {
|
||||
return h(ElTag, { type: getStatusType(row.status) }, () => row.status_name || '-')
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'approval_provider',
|
||||
label: '审批渠道',
|
||||
width: 110,
|
||||
formatter: (row: Refund) => {
|
||||
if (row.approval_provider === 'wecom' || row.approval_source === 'wecom') return '企微'
|
||||
if (row.approval_source === 'legacy') return '历史审批'
|
||||
return row.approval_provider || row.approval_source || '-'
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'submitter_name',
|
||||
label: '提交人',
|
||||
width: 120,
|
||||
showOverflowTooltip: true,
|
||||
formatter: (row: Refund) => row.submitter_name || '-'
|
||||
},
|
||||
{
|
||||
prop: 'approval_status',
|
||||
label: '审批状态',
|
||||
width: 120,
|
||||
formatter: (row: Refund) => row.approval_status_name || '-'
|
||||
},
|
||||
{
|
||||
prop: 'current_approver_summary',
|
||||
label: '当前审批人摘要',
|
||||
minWidth: 180,
|
||||
showOverflowTooltip: true,
|
||||
formatter: (row: Refund) => getCurrentApproverSummaryText(row)
|
||||
},
|
||||
{
|
||||
prop: 'processing_status_name',
|
||||
label: '业务处理状态',
|
||||
width: 140,
|
||||
showOverflowTooltip: true,
|
||||
formatter: (row: Refund) => getProcessingStatusText(row)
|
||||
},
|
||||
{
|
||||
prop: 'refund_reason',
|
||||
label: '退款原因',
|
||||
minWidth: 200,
|
||||
formatter: (row: Refund) => row.refund_reason || '-'
|
||||
},
|
||||
{
|
||||
prop: 'reject_reason',
|
||||
label: '拒绝原因',
|
||||
minWidth: 200,
|
||||
formatter: (row: Refund) => row.reject_reason || '-'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '审批备注',
|
||||
minWidth: 200,
|
||||
formatter: (row: Refund) => row.remark || '-'
|
||||
},
|
||||
{
|
||||
prop: 'asset_reset',
|
||||
label: '资产重置',
|
||||
width: 100,
|
||||
formatter: (row: Refund) => {
|
||||
return h(ElTag, { type: row.asset_reset ? 'success' : 'info' }, () =>
|
||||
row.asset_reset ? '是' : '否'
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'commission_deducted',
|
||||
label: '佣金扣除',
|
||||
width: 100,
|
||||
formatter: (row: Refund) => {
|
||||
return h(ElTag, { type: row.commission_deducted ? 'success' : 'info' }, () =>
|
||||
row.commission_deducted ? '是' : '否'
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'created_at',
|
||||
label: '创建时间',
|
||||
width: 180,
|
||||
formatter: (row: Refund) => formatDateTime(row.created_at)
|
||||
},
|
||||
{
|
||||
prop: 'processed_at',
|
||||
label: '审批时间',
|
||||
width: 180,
|
||||
formatter: (row: Refund) => (row.processed_at ? formatDateTime(row.processed_at) : '-')
|
||||
},
|
||||
{
|
||||
prop: 'updated_at',
|
||||
label: '更新时间',
|
||||
width: 180,
|
||||
formatter: (row: Refund) => formatDateTime(row.updated_at)
|
||||
}
|
||||
])
|
||||
].filter(({ prop }) => shouldShowInternalColumn(prop))
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
getTableData()
|
||||
@@ -735,6 +750,42 @@
|
||||
)
|
||||
}
|
||||
|
||||
const canTriggerApproval = (row: Refund) => {
|
||||
const approvalStatusEmpty = row.approval_status === undefined || row.approval_status === null
|
||||
return row.status === RefundStatus.PENDING && approvalStatusEmpty
|
||||
}
|
||||
|
||||
// 补发历史退款审批
|
||||
const handleTriggerApproval = (row: Refund) => {
|
||||
if (triggerApprovalLoading.value) return
|
||||
|
||||
ElMessageBox.confirm(`确定要为退款单号 ${row.refund_no} 补发企微审批吗?`, '补发审批', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(async () => {
|
||||
triggerApprovalLoading.value = true
|
||||
try {
|
||||
const res = await RefundService.triggerApproval(row.id)
|
||||
if (res.code !== 0) {
|
||||
ElMessage.error(res.msg || '补发审批失败')
|
||||
return
|
||||
}
|
||||
ElMessage.success('补发审批成功')
|
||||
await getTableData()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
ElMessage.error('补发审批失败')
|
||||
} finally {
|
||||
triggerApprovalLoading.value = false
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 用户取消
|
||||
})
|
||||
}
|
||||
|
||||
// 获取操作按钮
|
||||
const getActions = (row: Refund) => {
|
||||
const actions: any[] = []
|
||||
@@ -743,6 +794,15 @@
|
||||
[1, 2].includes(userStore.getUserInfo.user_type || 0) &&
|
||||
hasAuth(AUDIT_PERMISSIONS.refundEntry)
|
||||
) {
|
||||
const voucherKeys = getRefundAttachmentKeys(row)
|
||||
if (voucherKeys.length && hasAuth('refund:view_voucher')) {
|
||||
actions.push({
|
||||
label: '退款凭证',
|
||||
handler: () => handleViewRefundVoucher(row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
const auditTarget = resolveAuditResourceTarget({
|
||||
userType: userStore.getUserInfo.user_type,
|
||||
resourceType: 'refund',
|
||||
@@ -754,6 +814,7 @@
|
||||
handler: () => openAuditInvestigation(auditTarget),
|
||||
type: 'primary'
|
||||
})
|
||||
|
||||
if (hasAuth(AUDIT_PERMISSIONS.refundFinanceEntry)) {
|
||||
const financeTarget = resolveFinanceAuditTarget('refund_id', row.id)
|
||||
if (financeTarget)
|
||||
@@ -775,7 +836,18 @@
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
const voucherKeys = getRefundAttachmentKeys(row)
|
||||
|
||||
if (
|
||||
[1, 2].includes(userStore.getUserInfo.user_type || 0) &&
|
||||
canTriggerApproval(row) &&
|
||||
hasAuth('refund:trigger_approval')
|
||||
) {
|
||||
actions.push({
|
||||
label: '补发审批',
|
||||
handler: () => handleTriggerApproval(row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
if (canResubmit(row) && hasAuth('refund:resubmit')) {
|
||||
actions.push({
|
||||
@@ -785,14 +857,6 @@
|
||||
})
|
||||
}
|
||||
|
||||
if (voucherKeys.length && hasAuth('refund:view_voucher')) {
|
||||
actions.push({
|
||||
label: '查看退款凭证',
|
||||
handler: () => handleViewRefundVoucher(row),
|
||||
type: 'primary'
|
||||
})
|
||||
}
|
||||
|
||||
return actions
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user