From 5132c286adae5ae79755c59bf41e6f6a086b76d2 Mon Sep 17 00:00:00 2001 From: 170-carry Date: Mon, 27 Apr 2026 12:31:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=80=E8=AF=B7=E5=92=8C=E7=A4=BC=E7=89=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/src/api/legacy/gift.ts | 4 + apps/src/views/operate/gift-config.vue | 140 ++++-- .../views/resident-activity/invite-config.vue | 465 +++++++++++++----- 3 files changed, 458 insertions(+), 151 deletions(-) diff --git a/apps/src/api/legacy/gift.ts b/apps/src/api/legacy/gift.ts index b04c8ab..d6d85fc 100644 --- a/apps/src/api/legacy/gift.ts +++ b/apps/src/api/legacy/gift.ts @@ -44,6 +44,10 @@ export async function switchDelStatus( return requestClient.get(`/sys/gift/config/switch/${id}/${status}`); } +export async function addAllGiftRegion(data: Record) { + return requestClient.post('/sys/gift/config/regions/add-all', data); +} + export async function countGiftAmount(params: Record) { return requestClient.get('/running-water-log/total-count', { params, diff --git a/apps/src/views/operate/gift-config.vue b/apps/src/views/operate/gift-config.vue index b8accc2..3c71236 100644 --- a/apps/src/views/operate/gift-config.vue +++ b/apps/src/views/operate/gift-config.vue @@ -5,6 +5,25 @@ import { Page } from '@vben/common-ui'; import { useAccessStore } from '@vben/stores'; import { + Button, + Card, + DatePicker, + Image, + Input, + message, + Modal, + Pagination, + Select, + Space, + Switch, + Table, + TabPane, + Tabs, + Tag, +} from 'antdv-next'; + +import { + addAllGiftRegion, getPairCpGiveGiftId, giftTable, listGiftBySysOrigin, @@ -22,28 +41,8 @@ import AccountInput from '#/components/account-input.vue'; import { copyText } from '#/views/operate/shared'; import { formatDate, getAllowedSysOrigins } from '#/views/system/shared'; -import { - Button, - Card, - DatePicker, - Image, - Input, - Modal, - Pagination, - Select, - Space, - Switch, - Table, - Tabs, - TabPane, - Tag, - message, -} from 'antdv-next'; - -import { - GIFT_CONFIG_TAB_OPTIONS, -} from './constants'; import GiftFormModal from './components/gift-form-modal.vue'; +import { GIFT_CONFIG_TAB_OPTIONS } from './constants'; defineOptions({ name: 'OperateGiftConfig' }); @@ -88,7 +87,12 @@ const settingQuery = reactive({ }); const giftFormOpen = ref(false); -const activeGiftRow = ref | null>(null); +const activeGiftRow = ref>(null); +const addRegionOpen = ref(false); +const addRegionSaving = ref(false); +const addRegionForm = reactive({ + regionId: '', +}); const weekStarLoading = ref(false); const weekStarList = ref>>([]); @@ -141,6 +145,13 @@ const settingColumns = [ { dataIndex: 'actions', key: 'actions', title: '操作', width: 180 }, ]; +const regionOptions = computed(() => + regions.value.map((item) => ({ + label: String(item.regionName || item.name || item.id || '-'), + value: item.id as any, + })), +); + const weekStarColumns = [ { dataIndex: 'id', key: 'id', title: '编号', width: 120 }, { dataIndex: 'sysOrigin', key: 'sysOrigin', title: '归属系统', width: 120 }, @@ -262,6 +273,37 @@ function openGiftEdit(row: Record) { giftFormOpen.value = true; } +async function openAddRegionModal() { + if (!settingQuery.sysOrigin) { + message.warning('请先选择平台'); + return; + } + if (regions.value.length <= 0) { + await loadRegions(settingQuery.sysOrigin); + } + addRegionForm.regionId = ''; + addRegionOpen.value = true; +} + +async function handleAddRegionSubmit() { + if (!settingQuery.sysOrigin || !addRegionForm.regionId) { + message.warning('请选择要追加的区域'); + return; + } + addRegionSaving.value = true; + try { + await addAllGiftRegion({ + regionId: addRegionForm.regionId, + sysOrigin: settingQuery.sysOrigin, + }); + message.success('追加成功'); + addRegionOpen.value = false; + await loadSetting(true); + } finally { + addRegionSaving.value = false; + } +} + async function openWeekStarModal() { weekStarForm.sysOrigin = weekStarQuery.sysOrigin; weekStarForm.giftOne = ''; @@ -328,7 +370,7 @@ async function handleCpSave() {