From 1db5607cb8fa55178bcb346e1b1ac83c1507df32 Mon Sep 17 00:00:00 2001 From: zhx Date: Thu, 21 May 2026 15:44:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BC=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/components/gift-batch-drawer.vue | 25 ++++++++++++ .../operate/components/gift-form-modal.vue | 29 ++++++++++++++ apps/src/views/operate/constants.ts | 6 +++ apps/src/views/operate/gift-config.vue | 40 ++++++++++++++++++- 4 files changed, 99 insertions(+), 1 deletion(-) diff --git a/apps/src/views/operate/components/gift-batch-drawer.vue b/apps/src/views/operate/components/gift-batch-drawer.vue index aee960f..23438ed 100644 --- a/apps/src/views/operate/components/gift-batch-drawer.vue +++ b/apps/src/views/operate/components/gift-batch-drawer.vue @@ -22,6 +22,7 @@ import { regionConfigTable } from '#/api/legacy/system'; import { normalizeResourceCode } from '#/views/_shared/resource-code'; import { + CP_RELATION_TYPE_OPTIONS, GIFT_CONFIG_TAB_OPTIONS, GIFT_SPECIAL_OPTIONS, } from '../constants'; @@ -78,6 +79,7 @@ const emit = defineEmits<{ const DEFAULT_GIFT_SPECIAL_LIST = ['MUSIC', 'ANIMATION']; const batchForm = reactive({ + cpRelationType: 'CP', giftTab: 'ORDINARY', regionList: [] as Array, specialList: [...DEFAULT_GIFT_SPECIAL_LIST], @@ -103,6 +105,10 @@ const giftTabOptions = GIFT_CONFIG_TAB_OPTIONS.map((item) => ({ label: item.name, value: item.value as any, })); +const cpRelationTypeOptions = CP_RELATION_TYPE_OPTIONS.map((item) => ({ + label: item.name, + value: item.value as any, +})); const defaultSpecialText = computed(() => GIFT_SPECIAL_OPTIONS.filter((item) => DEFAULT_GIFT_SPECIAL_LIST.includes(item.value), @@ -184,10 +190,20 @@ const rowSelection = computed(() => ({ }, })); +watch( + () => batchForm.giftTab, + (giftTab) => { + if (giftTab === 'CP' && !batchForm.cpRelationType) { + batchForm.cpRelationType = 'CP'; + } + }, +); + function resetBatch() { batchForm.sysOrigin = String(props.initialSysOrigin || props.sysOriginOptions[0]?.value || 'LIKEI'); batchForm.giftTab = 'ORDINARY'; + batchForm.cpRelationType = 'CP'; batchForm.regionList = []; batchForm.specialList = [...DEFAULT_GIFT_SPECIAL_LIST]; rows.value = []; @@ -672,6 +688,7 @@ function customRow(record: Record) { function buildPayload(row: BatchGiftRow) { return { account: '', + cpRelationType: batchForm.giftTab === 'CP' ? batchForm.cpRelationType : '', explanationGift: false, expiredTime: '', giftCandy: Number(row.giftCandy || 0), @@ -763,6 +780,14 @@ async function submitBatch() { :options="giftTabOptions" /> +
+ CP礼物类型 + , sort: '', specialList: [] as string[], @@ -95,6 +97,10 @@ const giftTabOptions = GIFT_CONFIG_TAB_OPTIONS.map((item) => ({ label: item.name, value: item.value as any, })); +const cpRelationTypeOptions = CP_RELATION_TYPE_OPTIONS.map((item) => ({ + label: item.name, + value: item.value as any, +})); const chargeTypeOptions = [ { label: '金币', value: 'GOLD' }, { label: '钻石', value: 'DIAMOND' }, @@ -164,6 +170,7 @@ watch( ...props.row, explanationGift: Boolean(props.row.explanationGift), expiredTime: normalizeTimestampValue(props.row.expiredTime), + cpRelationType: props.row.cpRelationType || 'CP', regionList: normalizeMultiValue(props.row.regions || props.row.regionList), specialList: normalizeMultiValue(props.row.special || props.row.specialList), sysOrigin: props.row.sysOrigin || props.sysOrigin, @@ -186,6 +193,15 @@ watch( }, ); +watch( + () => form.giftTab, + (giftTab) => { + if (giftTab === 'CP' && !form.cpRelationType) { + form.cpRelationType = 'CP'; + } + }, +); + function toggleAllRegions() { if (form.regionList.length === regions.value.length) { form.regionList = []; @@ -273,6 +289,10 @@ async function handleSubmit() { message.warning('请输入归属人账号'); return; } + if (form.giftTab === 'CP' && !form.cpRelationType) { + message.warning('请选择CP礼物类型'); + return; + } if (isLuckyOrMagic.value && !form.standardId) { message.warning('幸运/魔法礼物必须选择规格'); return; @@ -294,6 +314,7 @@ async function handleSubmit() { try { const payload = { ...form, + cpRelationType: form.giftTab === 'CP' ? form.cpRelationType : '', giftCandy: form.type === 'FREE' ? '' : form.giftCandy, giftIntegral: form.type === 'FREE' ? '' : form.giftIntegral, }; @@ -456,6 +477,14 @@ async function handleSubmit() { placeholder="请选择幸运规格" /> + +