From ffa753707b7ca0eac257b4d2e019b30858293fad Mon Sep 17 00:00:00 2001 From: jacy <18049821889@163.com> Date: Mon, 3 Aug 2026 20:17:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A5=97=E9=A4=90=E6=8A=98=E5=8F=A0?= =?UTF-8?q?=E3=80=81=E5=B0=8F=E7=A8=8B=E5=BA=8F=20staging=20API=E3=80=81?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8E=BB=E7=AD=9B=E9=80=89=E3=80=81=E4=BC=81?= =?UTF-8?q?=E5=BE=AE=E6=97=A5=E5=BF=97=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- .../components/AdminStorePackagesSection.tsx | 162 ++++++++------ .../src/components/StorePackagesForm.tsx | 198 ++++++++++-------- apps/h5-partner/src/styles.css | 28 +++ .../src/components/ShopPackagesForm.tsx | 173 +++++++++------ apps/h5-shop/src/styles.css | 24 +++ apps/mini-user/config/index.ts | 3 +- apps/mini-user/src/pages/home/index.tsx | 44 +--- packages/shared-types/src/wecom-bot.ts | 6 +- .../wecom/wecom-bot-actions.service.ts | 181 ++++++++++++++++ 9 files changed, 558 insertions(+), 261 deletions(-) diff --git a/apps/admin-web/src/components/AdminStorePackagesSection.tsx b/apps/admin-web/src/components/AdminStorePackagesSection.tsx index 0a01a41..dd1166a 100644 --- a/apps/admin-web/src/components/AdminStorePackagesSection.tsx +++ b/apps/admin-web/src/components/AdminStorePackagesSection.tsx @@ -1,5 +1,6 @@ import { useEffect, useState } from 'react'; import { Alert, Button, Form, Input, InputNumber, Space, Typography, message } from 'antd'; +import { DownOutlined, UpOutlined } from '@ant-design/icons'; import type { StorePackageItemDto } from '@dukang/shared-types'; import { STORE_PACKAGE_MAX_COUNT } from '@dukang/shared-types'; import { request } from '../lib/api'; @@ -12,6 +13,7 @@ function emptyRow(index = 0): PackageRow { export default function AdminStorePackagesSection({ storeId }: { storeId: string }) { const [items, setItems] = useState([emptyRow()]); + const [collapsed, setCollapsed] = useState>({}); const [loading, setLoading] = useState(true); const [saving, setSaving] = useState(false); @@ -40,6 +42,19 @@ export default function AdminStorePackagesSection({ storeId }: { storeId: string function removeAt(index: number) { setItems((prev) => prev.filter((_, i) => i !== index).map((item, i) => ({ ...item, sortOrder: i }))); + setCollapsed((prev) => { + const next: Record = {}; + Object.entries(prev).forEach(([k, v]) => { + const i = Number(k); + if (i < index) next[i] = v; + else if (i > index) next[i - 1] = v; + }); + return next; + }); + } + + function toggleCollapse(index: number) { + setCollapsed((prev) => ({ ...prev, [index]: !prev[index] })); } async function save() { @@ -100,74 +115,89 @@ export default function AdminStorePackagesSection({ storeId }: { storeId: string message={`总部直存立即生效,无需审核。同一门店最多 ${STORE_PACKAGE_MAX_COUNT} 条套餐。`} /> - {items.map((item, index) => ( -
- - - 套餐 {index + 1} - - {items.length > 1 ? ( - + {items.length > 1 ? ( + + ) : null} + + + {!isCollapsed ? ( + <> + + updateAt(index, { name: e.target.value })} + /> + + + + updateAt(index, { price: v != null ? String(v) : '' })} + /> + + + + updateAt(index, { dishes: e.target.value })} + /> + + + + updateAt(index, { usableTime: e.target.value })} + /> + + + + updateAt(index, { otherNotes: e.target.value })} + /> + + ) : null} - - - - updateAt(index, { name: e.target.value })} - /> - - - - updateAt(index, { price: v != null ? String(v) : '' })} - /> - - - - updateAt(index, { dishes: e.target.value })} - /> - - - - updateAt(index, { usableTime: e.target.value })} - /> - - - - updateAt(index, { otherNotes: e.target.value })} - /> - -
- ))} + + ); + })} {items.length < STORE_PACKAGE_MAX_COUNT ? ( + {!disabled && list.length > 1 ? ( + + ) : null} + + + {!isCollapsed ? ( + <> +
+ +
+ restaurant + updateAt(index, { name: e.target.value })} + /> +
+
+ +
+ +
+ payments + updateAt(index, { price: e.target.value })} + /> +
+
+ +
+ +