支持自定义线下出款分类
This commit is contained in:
@@ -144,6 +144,7 @@ export interface FinanceDisbursementItem {
|
||||
operator_name: string
|
||||
remark: string
|
||||
category: string
|
||||
custom_category_name: string
|
||||
voucher_url: string
|
||||
voided_at?: string
|
||||
voided_by?: number
|
||||
@@ -153,6 +154,7 @@ export interface FinanceDisbursementItem {
|
||||
|
||||
export interface CreateManualDisbursementPayload {
|
||||
category: string
|
||||
custom_category_name?: string
|
||||
payee_name: string
|
||||
amount_cent: number
|
||||
paid_at: string
|
||||
@@ -164,6 +166,7 @@ export interface ManualDisbursement {
|
||||
id: number
|
||||
disbursement_no: string
|
||||
category: string
|
||||
custom_category_name: string
|
||||
payee_name: string
|
||||
amount_cent: number
|
||||
paid_at: string
|
||||
|
||||
@@ -42,10 +42,13 @@ const manualCategories = [
|
||||
{ value: 'seller_supplement', label: '卖家补款' },
|
||||
{ value: 'operating_expense', label: '运营支出' },
|
||||
{ value: 'channel_fee', label: '渠道费用' },
|
||||
{ value: 'duoduo_deposit_refund', label: '多多退押金' },
|
||||
{ value: 'other', label: '其他' },
|
||||
{ value: 'custom', label: '自定义分类' },
|
||||
]
|
||||
const createForm = reactive({
|
||||
category: '',
|
||||
custom_category_name: '',
|
||||
payee_name: '',
|
||||
amount_yuan: 0,
|
||||
paid_at: new Date(),
|
||||
@@ -130,6 +133,7 @@ function openCreate() {
|
||||
|
||||
function resetCreateForm() {
|
||||
createForm.category = ''
|
||||
createForm.custom_category_name = ''
|
||||
createForm.payee_name = ''
|
||||
createForm.amount_yuan = 0
|
||||
createForm.paid_at = new Date()
|
||||
@@ -169,10 +173,16 @@ async function submitManualDisbursement() {
|
||||
ElMessage.warning('请填写出款用途')
|
||||
return
|
||||
}
|
||||
if (createForm.category === 'custom' && !createForm.custom_category_name.trim()) {
|
||||
ElMessage.warning('请填写自定义分类名称')
|
||||
return
|
||||
}
|
||||
createSaving.value = true
|
||||
try {
|
||||
await createManualDisbursement({
|
||||
category: createForm.category,
|
||||
custom_category_name:
|
||||
createForm.category === 'custom' ? createForm.custom_category_name.trim() : undefined,
|
||||
payee_name: createForm.payee_name.trim(),
|
||||
amount_cent: amountCent,
|
||||
paid_at: createForm.paid_at.toISOString(),
|
||||
@@ -283,7 +293,8 @@ function itemStatusLabel(row: FinanceDisbursementItem) {
|
||||
return statusLabel(row.status)
|
||||
}
|
||||
|
||||
function categoryLabel(category: string) {
|
||||
function categoryLabel(category: string, customCategoryName = '') {
|
||||
if (category === 'custom' && customCategoryName) return customCategoryName
|
||||
return manualCategories.find(item => item.value === category)?.label || category || '-'
|
||||
}
|
||||
|
||||
@@ -429,7 +440,7 @@ function accountTypeLabel(type: string) {
|
||||
<small v-if="row.payee_phone">{{ row.payee_phone }}</small>
|
||||
<small v-else-if="row.source_type === 'withdrawal'">用户 ID {{ row.user_id }}</small>
|
||||
<small v-else-if="row.source_type === 'manual_offline'">
|
||||
{{ categoryLabel(row.category) }}
|
||||
{{ categoryLabel(row.category, row.custom_category_name) }}
|
||||
</small>
|
||||
<small v-else>联系方式未登记</small>
|
||||
<small v-if="row.uploader_name">上传:{{ row.uploader_name }}</small>
|
||||
@@ -445,7 +456,9 @@ function accountTypeLabel(type: string) {
|
||||
<small v-if="row.bank_name">{{ row.bank_name }}</small>
|
||||
</div>
|
||||
<div v-else-if="row.source_type === 'manual_offline'" class="stack-cell">
|
||||
<el-tag size="small" effect="plain">{{ categoryLabel(row.category) }}</el-tag>
|
||||
<el-tag size="small" effect="plain">
|
||||
{{ categoryLabel(row.category, row.custom_category_name) }}
|
||||
</el-tag>
|
||||
<small>{{ row.voucher_url ? '已上传付款凭证' : '未上传付款凭证' }}</small>
|
||||
</div>
|
||||
<span v-else class="muted-text">线下约定</span>
|
||||
@@ -545,6 +558,14 @@ function accountTypeLabel(type: string) {
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="createForm.category === 'custom'" label="自定义分类名称" required>
|
||||
<el-input
|
||||
v-model="createForm.custom_category_name"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="请输入分类名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="收款人" required>
|
||||
<el-input v-model="createForm.payee_name" maxlength="100" placeholder="姓名或单位名称" />
|
||||
</el-form-item>
|
||||
@@ -634,7 +655,7 @@ function accountTypeLabel(type: string) {
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="出款分类">
|
||||
{{ categoryLabel(selectedManual.category) }}
|
||||
{{ categoryLabel(selectedManual.category, selectedManual.custom_category_name) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="收款人">{{ selectedManual.payee_name }}</el-descriptions-item>
|
||||
<el-descriptions-item label="出款金额">
|
||||
|
||||
Reference in New Issue
Block a user