From 5ddd79d11694d4e0b206d312c1fb2768c8d09256 Mon Sep 17 00:00:00 2001 From: zhx Date: Sun, 17 May 2026 01:04:07 +0800 Subject: [PATCH] feat: toggle manager gift permission --- apps/src/views/props/resource-config.vue | 34 ++++++++++++++++++------ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/apps/src/views/props/resource-config.vue b/apps/src/views/props/resource-config.vue index 35c5b3e..3df2e86 100644 --- a/apps/src/views/props/resource-config.vue +++ b/apps/src/views/props/resource-config.vue @@ -21,7 +21,6 @@ import { Space, Switch, Table, - Tag, Tooltip, } from 'antdv-next'; @@ -92,7 +91,7 @@ const columns = [ { dataIndex: 'del', key: 'del', title: '上/下架', width: 120 }, { dataIndex: 'amount', key: 'amount', title: '底价', width: 100 }, { dataIndex: 'storeShelfStatus', key: 'storeShelfStatus', title: '是否上架道具商店', width: 160 }, - { dataIndex: 'adminFree', key: 'adminFree', title: 'Admin Free', width: 120 }, + { dataIndex: 'adminFree', key: 'adminFree', title: '经理赠送权限', width: 140 }, { dataIndex: 'actions', key: 'actions', title: '操作', width: 180 }, ]; @@ -157,10 +156,13 @@ function cancelAmountEdit() { amountDraft.value = null; } -function buildPropsSourceUpdatePayload(record: Record, amount: number) { +function buildPropsSourceUpdatePayload( + record: Record, + overrides: Record = {}, +) { return { adminFree: Boolean(record.adminFree), - amount, + amount: Number(record.amount ?? 0), code: record.code, cover: record.cover, expand: record.expand, @@ -169,6 +171,7 @@ function buildPropsSourceUpdatePayload(record: Record, amount: numb sourceUrl: record.sourceUrl, sysOrigin: record.sysOrigin, type: record.type, + ...overrides, }; } @@ -189,7 +192,7 @@ async function handleAmountConfirm(record: Record) { amountSavingId.value = getRecordId(record); record.amount = amount; try { - await updatePropsSource(buildPropsSourceUpdatePayload(record, amount)); + await updatePropsSource(buildPropsSourceUpdatePayload(record, { amount })); message.success('底价已更新'); cancelAmountEdit(); } catch (error) { @@ -200,6 +203,18 @@ async function handleAmountConfirm(record: Record) { } } +async function handleAdminFreeChange(record: Record, checked: boolean) { + const previous = record.adminFree; + record.adminFree = checked; + try { + await updatePropsSource(buildPropsSourceUpdatePayload(record, { adminFree: checked })); + message.success('经理赠送权限已更新'); + } catch (error) { + record.adminFree = previous; + throw error; + } +} + function getStoreCommodity(record: Record) { return record.storeCommodity || null; } @@ -365,9 +380,12 @@ loadData(true);