From 8257301dd24db1e4cadc42358edf665dbdd818db Mon Sep 17 00:00:00 2001 From: aaron <> Date: Wed, 26 Feb 2025 20:42:59 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/BasicLayout.vue | 8 + src/router/index.js | 5 + src/views/coupon/ActivityList.vue | 45 +++- src/views/system/ConfigList.vue | 373 ++++++++++++++++++++++++++++++ 4 files changed, 430 insertions(+), 1 deletion(-) create mode 100644 src/views/system/ConfigList.vue diff --git a/src/layouts/BasicLayout.vue b/src/layouts/BasicLayout.vue index 051dc54..afc7fe7 100644 --- a/src/layouts/BasicLayout.vue +++ b/src/layouts/BasicLayout.vue @@ -106,6 +106,9 @@ 日志查询 + + 系统配置 + @@ -325,6 +328,11 @@ export default defineComponent({ key: 'system-logs', title: '日志查询', path: '/system/logs' + }, + { + key: 'system-config', + title: '系统配置', + path: '/system/config' } ] }, diff --git a/src/router/index.js b/src/router/index.js index 5e4e279..fed9c09 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -94,6 +94,11 @@ const routes = [ path: 'logs', component: () => import('@/views/system/LogList.vue'), meta: { title: '日志查询' } + }, + { + path: 'config', + component: () => import('@/views/system/ConfigList.vue'), + meta: { title: '系统配置' } } ] }, diff --git a/src/views/coupon/ActivityList.vue b/src/views/coupon/ActivityList.vue index 1268a12..58581e8 100644 --- a/src/views/coupon/ActivityList.vue +++ b/src/views/coupon/ActivityList.vue @@ -144,6 +144,19 @@ + + + + { + return text || '不限' + } + }, { title: '已领取次数', dataIndex: 'receive_count', @@ -352,6 +375,7 @@ export default defineComponent({ end_time: null, daily_start_time: null, daily_end_time: null, + total_limit: undefined, daily_limit: 1, coupon_config: {}, is_active: true @@ -400,6 +424,7 @@ export default defineComponent({ end_time: null, daily_start_time: null, daily_end_time: null, + total_limit: undefined, daily_limit: 1, coupon_config: {}, is_active: true @@ -417,6 +442,14 @@ export default defineComponent({ // 获取优惠券模板列表 await fetchCouponTemplates() + // 过滤掉数量为0的优惠券配置 + const couponConfig = {} + Object.entries(record.coupon_config || {}).forEach(([key, value]) => { + if (value && value > 0) { + couponConfig[key] = value + } + }) + // 设置表单数据 formState.value = { name: record.name, @@ -425,8 +458,9 @@ export default defineComponent({ end_time: dayjs(record.end_time), daily_start_time: dayjs(record.daily_start_time, 'HH:mm:ss'), daily_end_time: dayjs(record.daily_end_time, 'HH:mm:ss'), + total_limit: record.total_limit, daily_limit: record.daily_limit, - coupon_config: record.coupon_config || {}, + coupon_config: couponConfig, is_active: record.is_active } @@ -442,8 +476,17 @@ export default defineComponent({ formRef.value.validate().then(async () => { try { submitting.value = true + // 处理优惠券配置,过滤掉未设置数量的优惠券 + const couponConfig = {} + Object.entries(formState.value.coupon_config).forEach(([key, value]) => { + if (value && value > 0) { + couponConfig[key] = value + } + }) + const params = { ...formState.value, + coupon_config: couponConfig, start_time: dayjs(formState.value.start_time).format('YYYY-MM-DD HH:mm:ss'), end_time: dayjs(formState.value.end_time).format('YYYY-MM-DD HH:mm:ss'), daily_start_time: dayjs(formState.value.daily_start_time).format('HH:mm:ss'), diff --git a/src/views/system/ConfigList.vue b/src/views/system/ConfigList.vue new file mode 100644 index 0000000..157e35f --- /dev/null +++ b/src/views/system/ConfigList.vue @@ -0,0 +1,373 @@ + + + + + \ No newline at end of file