支持提号完成后财务调整
This commit is contained in:
@@ -4,6 +4,7 @@ import type { ApiResponse, PaginatedResult } from '@/shared/types/types'
|
||||
export type PickupAccountSource = 'internal' | 'external_platform_managed'
|
||||
export type PickupSettlementMode = 'owner_wallet' | 'platform_managed'
|
||||
export type PickupOfflineSettlementStatus = 'none' | 'pending' | 'settled'
|
||||
export type PickupFinancialAdjustmentStatus = 'settled' | 'pending' | 'recovery_pending'
|
||||
export type AvailableListingSourceType = '' | 'external' | 'internal'
|
||||
|
||||
export interface AdminPickup {
|
||||
@@ -27,10 +28,14 @@ export interface AdminPickup {
|
||||
owner_price_cent: number
|
||||
website_profit_cent: number
|
||||
profit_amount_cent: number
|
||||
profit_adjustment_cent: number
|
||||
effective_profit_amount_cent: number
|
||||
seller_ratio: number
|
||||
buyer_ratio: number
|
||||
account_snapshot?: Record<string, unknown>
|
||||
settle_amount_cent: number
|
||||
settle_adjustment_cent: number
|
||||
effective_settle_amount_cent: number
|
||||
status: string
|
||||
offline_settlement_status: PickupOfflineSettlementStatus
|
||||
offline_settlement_remark: string
|
||||
@@ -43,6 +48,21 @@ export interface AdminPickup {
|
||||
cancelled_at?: string
|
||||
}
|
||||
|
||||
export interface AdminPickupFinancialAdjustment {
|
||||
id: number
|
||||
pickup_id: number
|
||||
profit_delta_cent: number
|
||||
settle_delta_cent: number
|
||||
settlement_mode: PickupSettlementMode
|
||||
status: PickupFinancialAdjustmentStatus
|
||||
reason: string
|
||||
created_by: number
|
||||
settled_by?: number
|
||||
settled_at?: string
|
||||
settlement_remark: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface AvailableListing {
|
||||
id: number
|
||||
listing_no: string
|
||||
@@ -90,6 +110,16 @@ export interface AdminPickupOfflineSettlementRequest {
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface AdminPickupFinancialAdjustmentRequest {
|
||||
profit_amount_cent?: number
|
||||
settle_amount_cent?: number
|
||||
reason: string
|
||||
}
|
||||
|
||||
export interface AdminPickupFinancialAdjustmentSettlementRequest {
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface AdminPickupListQuery {
|
||||
page?: number
|
||||
page_size?: number
|
||||
@@ -177,6 +207,35 @@ export async function updateAdminPickupProfit(id: number, req: AdminPickupProfit
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function createAdminPickupFinancialAdjustment(
|
||||
id: number,
|
||||
req: AdminPickupFinancialAdjustmentRequest
|
||||
) {
|
||||
const { data } = await apiClient.post<ApiResponse<AdminPickup>>(
|
||||
`/admin/pickups/${id}/financial-adjustments`,
|
||||
req
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function fetchAdminPickupFinancialAdjustments(id: string | number) {
|
||||
const { data } = await apiClient.get<ApiResponse<AdminPickupFinancialAdjustment[]>>(
|
||||
`/admin/pickups/${id}/financial-adjustments`
|
||||
)
|
||||
return Array.isArray(data.data) ? data.data : []
|
||||
}
|
||||
|
||||
export async function settleAdminPickupFinancialAdjustment(
|
||||
id: number,
|
||||
req: AdminPickupFinancialAdjustmentSettlementRequest = {}
|
||||
) {
|
||||
const { data } = await apiClient.post<ApiResponse<{ settled: boolean }>>(
|
||||
`/admin/pickup-financial-adjustments/${id}/settle`,
|
||||
req
|
||||
)
|
||||
return data.data
|
||||
}
|
||||
|
||||
export async function cancelAdminPickup(id: number, reason: string) {
|
||||
const { data } = await apiClient.post<ApiResponse<{ cancelled: boolean }>>(
|
||||
`/admin/pickups/${id}/cancel`,
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref } from 'vue'
|
||||
import { EditPen } from '@element-plus/icons-vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
import {
|
||||
fetchAdminPickup,
|
||||
fetchAdminPickupFinancialAdjustments,
|
||||
createAdminPickupFinancialAdjustment,
|
||||
settleAdminPickupFinancialAdjustment,
|
||||
updateAdminPickupProfit,
|
||||
type AdminPickup,
|
||||
type AdminPickupFinancialAdjustment,
|
||||
} from '@/features/admin/api/adminPickup'
|
||||
import { quantity, readNumber, readUnitPrice } from '@/features/orders/composables/useOrderSnapshot'
|
||||
import { adminPath } from '@/shared/utils/adminPath'
|
||||
@@ -33,14 +37,19 @@ interface SnapshotResource {
|
||||
const route = useRoute()
|
||||
const loading = ref(false)
|
||||
const pickup = ref<AdminPickup | null>(null)
|
||||
const financialAdjustments = ref<AdminPickupFinancialAdjustment[]>([])
|
||||
const profitDialogVisible = ref(false)
|
||||
const financialAdjustmentDialogVisible = ref(false)
|
||||
const profitSaving = ref(false)
|
||||
const financialAdjustmentSaving = ref(false)
|
||||
const profitForm = reactive({ profit_amount: 0, reason: '' })
|
||||
const financialAdjustmentForm = reactive({ profit_amount: 0, settle_amount: 0, reason: '' })
|
||||
|
||||
const listingCode = computed(() =>
|
||||
pickup.value ? formatListingNo(pickup.value.listing_no, pickup.value.listing_id) : '-'
|
||||
)
|
||||
const canEditProfit = computed(() => pickup.value?.status === 'picking_up')
|
||||
const canCreateFinancialAdjustment = computed(() => pickup.value?.status === 'completed')
|
||||
const snapshot = computed(() => normalizeRecord(pickup.value?.account_snapshot))
|
||||
const assetSummary = computed(() => normalizeRecord(snapshot.value?.asset_summary))
|
||||
const priceBreakdown = computed(() => normalizeRecord(assetSummary.value?.price_breakdown))
|
||||
@@ -74,15 +83,15 @@ const moneySplitRows = computed(() => {
|
||||
const ownerLossPriceCent =
|
||||
readBreakdownCent('consumable_price') ?? fallbackOwnerLossCent(ownerCoinBasePriceCent)
|
||||
const offlineTotalCent =
|
||||
row.settle_amount_cent > 0 ? row.settle_amount_cent + row.profit_amount_cent : null
|
||||
effectiveSettleCent(row) > 0 ? effectiveSettleCent(row) + effectiveProfitCent(row) : null
|
||||
const rows = [
|
||||
{ label: '网站售价', amountCent: row.listing_price_cent, tone: '' },
|
||||
{ label: '号主纯币价格', amountCent: ownerCoinBasePriceCent, tone: '' },
|
||||
{ label: '号主损耗', amountCent: ownerLossPriceCent, tone: '' },
|
||||
{ label: '号主价合计', amountCent: row.owner_price_cent, tone: 'subtotal' },
|
||||
{ label: '网站加价', amountCent: row.website_profit_cent, tone: '' },
|
||||
{ label: '线下利润', amountCent: row.profit_amount_cent, tone: 'profit' },
|
||||
{ label: '结算给号主', amountCent: row.settle_amount_cent, tone: '' },
|
||||
{ label: '线下利润', amountCent: effectiveProfitCent(row), tone: 'profit' },
|
||||
{ label: '结算给号主', amountCent: effectiveSettleCent(row), tone: '' },
|
||||
]
|
||||
if (offlineTotalCent !== null) {
|
||||
rows.push({ label: '线下成交合计', amountCent: offlineTotalCent, tone: 'total' })
|
||||
@@ -108,12 +117,70 @@ onMounted(loadPickup)
|
||||
async function loadPickup() {
|
||||
loading.value = true
|
||||
try {
|
||||
pickup.value = await fetchAdminPickup(String(route.params.id))
|
||||
const [item, adjustments] = await Promise.all([
|
||||
fetchAdminPickup(String(route.params.id)),
|
||||
fetchAdminPickupFinancialAdjustments(String(route.params.id)),
|
||||
])
|
||||
pickup.value = item
|
||||
financialAdjustments.value = adjustments
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function openFinancialAdjustmentDialog() {
|
||||
if (!pickup.value) return
|
||||
financialAdjustmentForm.profit_amount = centToYuan(effectiveProfitCent(pickup.value))
|
||||
financialAdjustmentForm.settle_amount = centToYuan(effectiveSettleCent(pickup.value))
|
||||
financialAdjustmentForm.reason = ''
|
||||
financialAdjustmentDialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handleFinancialAdjustment() {
|
||||
if (!pickup.value) return
|
||||
if (!financialAdjustmentForm.reason.trim()) {
|
||||
ElMessage.warning('请输入调整原因')
|
||||
return
|
||||
}
|
||||
if (financialAdjustmentForm.profit_amount < 0 || financialAdjustmentForm.settle_amount < 0) {
|
||||
ElMessage.warning('金额不能小于 0')
|
||||
return
|
||||
}
|
||||
financialAdjustmentSaving.value = true
|
||||
try {
|
||||
pickup.value = await createAdminPickupFinancialAdjustment(pickup.value.id, {
|
||||
profit_amount_cent: yuanToCent(financialAdjustmentForm.profit_amount),
|
||||
settle_amount_cent: yuanToCent(financialAdjustmentForm.settle_amount),
|
||||
reason: financialAdjustmentForm.reason.trim(),
|
||||
})
|
||||
financialAdjustments.value = await fetchAdminPickupFinancialAdjustments(pickup.value.id)
|
||||
financialAdjustmentDialogVisible.value = false
|
||||
ElMessage.success('财务调整已创建')
|
||||
} catch (e: unknown) {
|
||||
ElMessage.error(errorMessage(e) || '调整失败')
|
||||
} finally {
|
||||
financialAdjustmentSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSettleFinancialAdjustment(item: AdminPickupFinancialAdjustment) {
|
||||
const action = item.status === 'recovery_pending' ? '已追回' : '已线下打款'
|
||||
try {
|
||||
const { value } = await ElMessageBox.prompt(`确认该笔调整${action}?`, '确认调整处理', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
inputType: 'textarea',
|
||||
inputPlaceholder: '处理备注(可选)',
|
||||
inputValidator: input => input.length <= 255 || '备注不能超过 255 个字符',
|
||||
})
|
||||
await settleAdminPickupFinancialAdjustment(item.id, { remark: value })
|
||||
financialAdjustments.value = await fetchAdminPickupFinancialAdjustments(item.pickup_id)
|
||||
ElMessage.success('调整已确认')
|
||||
} catch {
|
||||
// 用户取消确认。
|
||||
}
|
||||
}
|
||||
|
||||
function openProfitDialog() {
|
||||
if (!pickup.value) return
|
||||
profitForm.profit_amount = centToYuan(pickup.value.profit_amount_cent)
|
||||
@@ -168,6 +235,34 @@ function offlineSettlementLabel(row: AdminPickup) {
|
||||
return '待完成提号'
|
||||
}
|
||||
|
||||
function effectiveProfitCent(row: AdminPickup) {
|
||||
return Number.isFinite(row.effective_profit_amount_cent)
|
||||
? row.effective_profit_amount_cent
|
||||
: row.profit_amount_cent
|
||||
}
|
||||
|
||||
function effectiveSettleCent(row: AdminPickup) {
|
||||
return Number.isFinite(row.effective_settle_amount_cent)
|
||||
? row.effective_settle_amount_cent
|
||||
: row.settle_amount_cent
|
||||
}
|
||||
|
||||
function financialAdjustmentStatusLabel(status: AdminPickupFinancialAdjustment['status']) {
|
||||
if (status === 'pending') return '待线下处理'
|
||||
if (status === 'recovery_pending') return '待追回'
|
||||
return '已处理'
|
||||
}
|
||||
|
||||
function financialAdjustmentStatusType(status: AdminPickupFinancialAdjustment['status']) {
|
||||
if (status === 'pending' || status === 'recovery_pending') return 'warning'
|
||||
return 'success'
|
||||
}
|
||||
|
||||
function formatSignedCent(value: number) {
|
||||
const amount = formatCentWithSymbol(Math.abs(value))
|
||||
return value > 0 ? `+${amount}` : value < 0 ? `-${amount}` : amount
|
||||
}
|
||||
|
||||
function ratioText(value: number) {
|
||||
const ratio = Number(value || 0)
|
||||
if (ratio <= 0) return '-'
|
||||
@@ -261,6 +356,15 @@ function readSnapshotResources(summary: Record<string, unknown> | null): Snapsho
|
||||
>
|
||||
修改利润
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canCreateFinancialAdjustment"
|
||||
type="primary"
|
||||
plain
|
||||
:icon="EditPen"
|
||||
@click="openFinancialAdjustmentDialog"
|
||||
>
|
||||
财务调整
|
||||
</el-button>
|
||||
<RouterLink :to="adminPath('pickup')">
|
||||
<el-button>返回列表</el-button>
|
||||
</RouterLink>
|
||||
@@ -275,12 +379,12 @@ function readSnapshotResources(summary: Record<string, unknown> | null): Snapsho
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>线下利润</span>
|
||||
<strong>{{ formatCentWithSymbol(pickup.profit_amount_cent) }}</strong>
|
||||
<strong>{{ formatCentWithSymbol(effectiveProfitCent(pickup)) }}</strong>
|
||||
<small>财务统计使用该金额</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>结算金额</span>
|
||||
<strong>{{ formatCentWithSymbol(pickup.settle_amount_cent) }}</strong>
|
||||
<strong>{{ formatCentWithSymbol(effectiveSettleCent(pickup)) }}</strong>
|
||||
<small>{{ pickup.completed_at ? formatDateTime(pickup.completed_at) : '待结算' }}</small>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
@@ -363,6 +467,52 @@ function readSnapshotResources(summary: Record<string, unknown> | null): Snapsho
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section
|
||||
v-if="financialAdjustments.length"
|
||||
class="dashboard-panel detail-panel pickup-wide-panel"
|
||||
>
|
||||
<div class="panel-heading">
|
||||
<h2>财务调整记录</h2>
|
||||
<span class="panel-subtitle">原始完成金额不变,调整按创建日计入财务</span>
|
||||
</div>
|
||||
<el-table :data="financialAdjustments" size="small" class="adjustment-table">
|
||||
<el-table-column label="利润调整" width="130">
|
||||
<template #default="{ row }">{{ formatSignedCent(row.profit_delta_cent) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="打款调整" width="130">
|
||||
<template #default="{ row }">{{ formatSignedCent(row.settle_delta_cent) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理状态" width="130">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="financialAdjustmentStatusType(row.status)" effect="light" size="small">
|
||||
{{ financialAdjustmentStatusLabel(row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="reason" label="调整原因" min-width="180" />
|
||||
<el-table-column label="创建时间" width="170">
|
||||
<template #default="{ row }">{{ formatDateTime(row.created_at) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-if="
|
||||
row.status === 'recovery_pending' ||
|
||||
(row.status === 'pending' && pickup?.offline_settlement_status !== 'pending')
|
||||
"
|
||||
size="small"
|
||||
type="primary"
|
||||
plain
|
||||
@click="handleSettleFinancialAdjustment(row)"
|
||||
>
|
||||
{{ row.status === 'recovery_pending' ? '确认追回' : '确认打款' }}
|
||||
</el-button>
|
||||
<span v-else class="text-muted">{{ formatDateTime(row.settled_at, '-') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</section>
|
||||
|
||||
<section class="dashboard-panel detail-panel">
|
||||
<div class="panel-heading">
|
||||
<h2>资金拆分</h2>
|
||||
@@ -475,6 +625,58 @@ function readSnapshotResources(summary: Record<string, unknown> | null): Snapsho
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="financialAdjustmentDialogVisible" title="完成后财务调整" width="500px">
|
||||
<el-form label-width="130px">
|
||||
<el-form-item label="目标利润(元)">
|
||||
<el-input-number
|
||||
v-model="financialAdjustmentForm.profit_amount"
|
||||
:min="0"
|
||||
:step="1"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="目标打款金额(元)">
|
||||
<el-input-number
|
||||
v-model="financialAdjustmentForm.settle_amount"
|
||||
:min="0"
|
||||
:step="1"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<div class="form-hint">
|
||||
{{
|
||||
pickup?.settlement_mode === 'platform_managed'
|
||||
? '会生成待线下补款或待追回记录'
|
||||
: '增加金额立即补入钱包,减少金额生成待追回记录'
|
||||
}}
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="调整原因" required>
|
||||
<el-input
|
||||
v-model="financialAdjustmentForm.reason"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
maxlength="255"
|
||||
show-word-limit
|
||||
placeholder="请输入调整原因"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="financialAdjustmentDialogVisible = false">取消</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="financialAdjustmentSaving"
|
||||
@click="handleFinancialAdjustment"
|
||||
>
|
||||
确认调整
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -498,6 +700,17 @@ function readSnapshotResources(summary: Record<string, unknown> | null): Snapsho
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.form-hint {
|
||||
margin-top: 4px;
|
||||
color: #64748b;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.adjustment-table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.pickup-detail-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
cancelAdminPickup,
|
||||
confirmAdminPickupOfflineSettlement,
|
||||
completeAdminPickup,
|
||||
createAdminPickupFinancialAdjustment,
|
||||
createAdminPickup,
|
||||
fetchAdminPickups,
|
||||
fetchAdminPickupShopOptions,
|
||||
@@ -36,9 +37,11 @@ const filters = reactive({
|
||||
const createDialogVisible = ref(false)
|
||||
const completeDialogVisible = ref(false)
|
||||
const profitDialogVisible = ref(false)
|
||||
const financialAdjustmentDialogVisible = ref(false)
|
||||
const activePickupId = ref(0)
|
||||
const activePickup = ref<AdminPickup | null>(null)
|
||||
const profitSaving = ref(false)
|
||||
const financialAdjustmentSaving = ref(false)
|
||||
|
||||
const createForm = reactive({
|
||||
listing_id: null as number | null,
|
||||
@@ -49,6 +52,7 @@ const createForm = reactive({
|
||||
})
|
||||
const completeForm = reactive({ settle_amount: 0, profit_amount: 0, complete_remark: '' })
|
||||
const profitForm = reactive({ profit_amount: 0, reason: '' })
|
||||
const financialAdjustmentForm = reactive({ profit_amount: 0, settle_amount: 0, reason: '' })
|
||||
|
||||
const listingOptions = ref<AvailableListing[]>([])
|
||||
const listingLoading = ref(false)
|
||||
@@ -196,7 +200,7 @@ function openCompleteDialog(row: AdminPickup) {
|
||||
async function handleConfirmOfflineSettlement(row: AdminPickup) {
|
||||
try {
|
||||
const { value } = await ElMessageBox.prompt(
|
||||
`确认已向卖家线下支付 ${formatCentWithSymbol(row.settle_amount_cent)}?`,
|
||||
`确认已向卖家线下支付 ${formatCentWithSymbol(effectiveSettleCent(row))}?`,
|
||||
'确认线下结算',
|
||||
{
|
||||
confirmButtonText: '确认已打款',
|
||||
@@ -228,6 +232,45 @@ function openProfitDialog(row: AdminPickup) {
|
||||
profitDialogVisible.value = true
|
||||
}
|
||||
|
||||
function openFinancialAdjustmentDialog(row: AdminPickup) {
|
||||
activePickupId.value = row.id
|
||||
activePickup.value = row
|
||||
financialAdjustmentForm.profit_amount = centToYuan(effectiveProfitCent(row))
|
||||
financialAdjustmentForm.settle_amount = centToYuan(effectiveSettleCent(row))
|
||||
financialAdjustmentForm.reason = ''
|
||||
financialAdjustmentDialogVisible.value = true
|
||||
}
|
||||
|
||||
async function handleFinancialAdjustment() {
|
||||
if (!financialAdjustmentForm.reason.trim()) {
|
||||
ElMessage.warning('请输入调整原因')
|
||||
return
|
||||
}
|
||||
if (financialAdjustmentForm.profit_amount < 0 || financialAdjustmentForm.settle_amount < 0) {
|
||||
ElMessage.warning('金额不能小于 0')
|
||||
return
|
||||
}
|
||||
financialAdjustmentSaving.value = true
|
||||
try {
|
||||
await createAdminPickupFinancialAdjustment(activePickupId.value, {
|
||||
profit_amount_cent: yuanToCent(financialAdjustmentForm.profit_amount),
|
||||
settle_amount_cent: yuanToCent(financialAdjustmentForm.settle_amount),
|
||||
reason: financialAdjustmentForm.reason.trim(),
|
||||
})
|
||||
ElMessage.success(
|
||||
activePickup.value?.settlement_mode === 'platform_managed'
|
||||
? '财务调整已创建,请确认线下补款或追回'
|
||||
: '财务调整已创建'
|
||||
)
|
||||
financialAdjustmentDialogVisible.value = false
|
||||
loadList()
|
||||
} catch (e: unknown) {
|
||||
ElMessage.error(errorMessage(e) || '调整失败')
|
||||
} finally {
|
||||
financialAdjustmentSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleComplete() {
|
||||
if (completeForm.settle_amount <= 0) {
|
||||
ElMessage.warning('请输入结算金额')
|
||||
@@ -329,6 +372,18 @@ function normalizeCent(value: number | undefined | null) {
|
||||
return Math.max(Math.round(cent), 0)
|
||||
}
|
||||
|
||||
function effectiveProfitCent(row: AdminPickup) {
|
||||
return Number.isFinite(row.effective_profit_amount_cent)
|
||||
? row.effective_profit_amount_cent
|
||||
: row.profit_amount_cent
|
||||
}
|
||||
|
||||
function effectiveSettleCent(row: AdminPickup) {
|
||||
return Number.isFinite(row.effective_settle_amount_cent)
|
||||
? row.effective_settle_amount_cent
|
||||
: row.settle_amount_cent
|
||||
}
|
||||
|
||||
function listingOwnerTotalCent(item: AvailableListing) {
|
||||
return normalizeCent(item.owner_total_price_cent || item.owner_price_cent)
|
||||
}
|
||||
@@ -454,13 +509,13 @@ function listingOptionLabel(item: AvailableListing) {
|
||||
<el-table-column label="结算金额" width="130">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.status === 'completed'">{{
|
||||
formatCentWithSymbol(row.settle_amount_cent)
|
||||
formatCentWithSymbol(effectiveSettleCent(row))
|
||||
}}</span>
|
||||
<span v-else class="text-muted">待结算</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="线下利润" width="120">
|
||||
<template #default="{ row }">{{ formatCentWithSymbol(row.profit_amount_cent) }}</template>
|
||||
<template #default="{ row }">{{ formatCentWithSymbol(effectiveProfitCent(row)) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="100">
|
||||
<template #default="{ row }">
|
||||
@@ -512,6 +567,15 @@ function listingOptionLabel(item: AvailableListing) {
|
||||
>
|
||||
确认线下结算
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'completed'"
|
||||
size="small"
|
||||
plain
|
||||
:icon="EditPen"
|
||||
@click="openFinancialAdjustmentDialog(row)"
|
||||
>
|
||||
财务调整
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'picking_up'"
|
||||
type="danger"
|
||||
@@ -747,6 +811,58 @@ function listingOptionLabel(item: AvailableListing) {
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="financialAdjustmentDialogVisible" title="完成后财务调整" width="500px">
|
||||
<el-form label-width="120px">
|
||||
<el-form-item label="目标利润(元)">
|
||||
<el-input-number
|
||||
v-model="financialAdjustmentForm.profit_amount"
|
||||
:min="0"
|
||||
:step="1"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="目标打款金额(元)">
|
||||
<el-input-number
|
||||
v-model="financialAdjustmentForm.settle_amount"
|
||||
:min="0"
|
||||
:step="1"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
style="width: 100%"
|
||||
/>
|
||||
<div class="form-hint">
|
||||
{{
|
||||
activePickup?.settlement_mode === 'platform_managed'
|
||||
? '代管账号会生成待线下补款或待追回记录'
|
||||
: '增加金额会立即补入号主钱包,减少金额会生成待追回记录'
|
||||
}}
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="调整原因" required>
|
||||
<el-input
|
||||
v-model="financialAdjustmentForm.reason"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
maxlength="255"
|
||||
show-word-limit
|
||||
placeholder="请输入调整原因"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="financialAdjustmentDialogVisible = false">取消</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="financialAdjustmentSaving"
|
||||
@click="handleFinancialAdjustment"
|
||||
>
|
||||
确认调整
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user