From d0000fb391bf926e555fe8b7e76a1d06f9baae03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Mon, 11 Aug 2025 12:33:29 +0800 Subject: [PATCH 1/4] =?UTF-8?q?refactor(shopCoupon):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化表格展示,增加状态标签和操作按钮 - 重新设计编辑弹窗,分为多个步骤展示 - 添加数据验证和错误提示 -优化删除操作提示信息 -调整表格样式,增加分页功能 --- src/api/shop/shopCoupon/index.ts | 14 +- src/api/shop/shopCoupon/model/index.ts | 2 +- src/views/shop/shopAdmin/index.vue | 52 +- .../shopCoupon/components/shopCouponEdit.vue | 731 +++++++++++------- src/views/shop/shopCoupon/index.vue | 255 +++--- 5 files changed, 661 insertions(+), 393 deletions(-) diff --git a/src/api/shop/shopCoupon/index.ts b/src/api/shop/shopCoupon/index.ts index 197a686..ae1becc 100644 --- a/src/api/shop/shopCoupon/index.ts +++ b/src/api/shop/shopCoupon/index.ts @@ -41,7 +41,12 @@ export async function listShopCoupon(params?: ShopCouponParam) { export async function addShopCoupon(data: ShopCoupon) { const res = await request.post>( MODULES_API_URL + '/shop/shop-coupon', - data + data, + { + headers: { + 'Content-Type': 'application/json' + } + } ); if (res.data.code === 0) { return res.data.message; @@ -55,7 +60,12 @@ export async function addShopCoupon(data: ShopCoupon) { export async function updateShopCoupon(data: ShopCoupon) { const res = await request.put>( MODULES_API_URL + '/shop/shop-coupon', - data + data, + { + headers: { + 'Content-Type': 'application/json' + } + } ); if (res.data.code === 0) { return res.data.message; diff --git a/src/api/shop/shopCoupon/model/index.ts b/src/api/shop/shopCoupon/model/index.ts index 5c4f42b..80f849c 100644 --- a/src/api/shop/shopCoupon/model/index.ts +++ b/src/api/shop/shopCoupon/model/index.ts @@ -53,7 +53,7 @@ export interface ShopCoupon { // 每人限领数量(-1表示无限制) limitPerUser?: number; // 是否启用(0禁用 1启用) - enabled?: string; + enabled?: boolean; } /** diff --git a/src/views/shop/shopAdmin/index.vue b/src/views/shop/shopAdmin/index.vue index 482320b..bb9f204 100644 --- a/src/views/shop/shopAdmin/index.vue +++ b/src/views/shop/shopAdmin/index.vue @@ -18,6 +18,7 @@ row-key="userId" :columns="columns" :datasource="datasource" + class="sys-org-table" :scroll="{ x: 1300 }" :where="defaultWhere" :customRow="customRow" @@ -386,7 +387,7 @@ const resetPsw = (row: User) => { /* 修改用户状态 */ const updateIsAdmin = (row: User) => { - row.isAdmin = row.isAdmin ? 0 : 1; + row.isAdmin = !row.isAdmin; updateUser(row) .then((msg) => { message.success(msg); @@ -432,15 +433,48 @@ export default { }; - diff --git a/src/views/shop/shopCoupon/components/shopCouponEdit.vue b/src/views/shop/shopCoupon/components/shopCouponEdit.vue index 698f5a9..661ae56 100644 --- a/src/views/shop/shopCoupon/components/shopCouponEdit.vue +++ b/src/views/shop/shopCoupon/components/shopCouponEdit.vue @@ -1,12 +1,12 @@ diff --git a/src/views/shop/shopCoupon/index.vue b/src/views/shop/shopCoupon/index.vue index c915977..abf867d 100644 --- a/src/views/shop/shopCoupon/index.vue +++ b/src/views/shop/shopCoupon/index.vue @@ -3,12 +3,19 @@