From cb445624e67de1d441d0854a4276c1b04f271821 Mon Sep 17 00:00:00 2001 From: dzq Date: Mon, 3 Nov 2025 09:02:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E9=A1=B5=E9=9D=A2=E5=8F=8A=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实现订单结算页面,包括: 1. 新增结算页面路由配置 2. 创建结算组件处理普通商品和租用商品的结算逻辑 3. 添加租用机柜容器组件 4. 更新购物车跳转逻辑指向新结算页面 5. 添加产品图片占位SVG 6. 更新迁移文档说明 --- .claude/settings.local.json | 5 +- doc/迁移指令.md | 10 + src/pages.json | 7 + src/pages/index/checkout.vue | 495 ++++++++++++++++++ src/pages/index/components/cart.vue | 7 +- .../components/renting-cabinet-container.vue | 435 +++++++++++++++ src/pages/index/index.vue | 4 +- src/static/svg/product-image.svg | 6 + 8 files changed, 963 insertions(+), 6 deletions(-) create mode 100644 doc/迁移指令.md create mode 100644 src/pages/index/checkout.vue create mode 100644 src/pages/index/components/renting-cabinet-container.vue create mode 100644 src/static/svg/product-image.svg diff --git a/.claude/settings.local.json b/.claude/settings.local.json index b10ccf8..b67efe0 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -5,7 +5,10 @@ "Bash(mkdir -p 'E:\\code\\智柜宝\\wx\\src\\api\\shop')", "Bash(tree 'E:\\code\\智柜宝\\wx\\src\\api' -I 'foo|goods|layout|login|me|order|system|types' -L 2)", "Bash(mkdir -p 'E:\\code\\智柜宝\\wx\\src\\pages\\home')", - "Bash(mkdir -p 'E:\\code\\智柜宝\\wx\\src\\pages\\home\\components')" + "Bash(mkdir -p 'E:\\code\\智柜宝\\wx\\src\\pages\\home\\components')", + "Bash(cp 'E:\\code\\智柜宝\\wx\\doc\\thirdParty\\src\\pages\\product\\components\\checkout.vue' 'E:\\code\\智柜宝\\wx\\src\\pages\\index\\components\\checkout.vue')", + "Bash(cp 'E:\\code\\智柜宝\\wx\\doc\\thirdParty\\src\\pages\\product\\components\\RentingCabinetContainer.vue' 'E:\\code\\智柜宝\\wx\\src\\pages\\index\\components\\renting-cabinet-container.vue')", + "Bash(test -f 'E:\\code\\智柜宝\\wx\\src\\pages\\index\\components\\product-container.vue')" ], "deny": [], "ask": [] diff --git a/doc/迁移指令.md b/doc/迁移指令.md new file mode 100644 index 0000000..0ce4140 --- /dev/null +++ b/doc/迁移指令.md @@ -0,0 +1,10 @@ +@doc\thirdParty\ 文件夹下是旧H5项目的代码,现在已经将其api部分的代码移植到了本微信小程序项目。现在需要移植页面,改为 + 微信小程序uni-app的写法,第一步先移植首页 @doc\thirdParty\src\pages\product\ 内的页面和全部组件,小程序写法参考 + @src\pages\index\index.vue + + 。仅参考语法,api需要使用原ProductList.vue中已经移植到本项目的相应api,stores也需要使用移植后的pinia。生成的代码写到 + @src\pages\home\ 文件夹下 + +参考已迁移至本项目的代码 @src\pages\index\ 。将 @doc\thirdParty\src\pages\product\components\ + 下的另外两个component也迁移到本项目。注意thirdParty下的是H5项目,现在需要改为微信小程序uni-app。api需要使用原Product + List.vue中已经移植到本项目的相应api,stores也需要使用移植后的pinia。 \ No newline at end of file diff --git a/src/pages.json b/src/pages.json index 4cff0b3..7f38c4a 100644 --- a/src/pages.json +++ b/src/pages.json @@ -61,6 +61,13 @@ }, "excludeLoginPath": false }, + { + "path": "pages/index/checkout", + "type": "page", + "style": { + "navigationBarTitleText": "订单结算" + } + }, { "path": "pages/login/faceLogin", "type": "page", diff --git a/src/pages/index/checkout.vue b/src/pages/index/checkout.vue new file mode 100644 index 0000000..9acf8a8 --- /dev/null +++ b/src/pages/index/checkout.vue @@ -0,0 +1,495 @@ + + + + + diff --git a/src/pages/index/components/cart.vue b/src/pages/index/components/cart.vue index 451d1d4..0bc8444 100644 --- a/src/pages/index/components/cart.vue +++ b/src/pages/index/components/cart.vue @@ -68,9 +68,10 @@ function handleClearCartOrRentingCart() { // 结算方法 function handleCheckout() { - handleClose() - // emit事件由父组件处理 - // router.push("/product/checkout") + handleClose(); + uni.navigateTo({ + url: '/pages/index/checkout' + }); } diff --git a/src/pages/index/components/renting-cabinet-container.vue b/src/pages/index/components/renting-cabinet-container.vue new file mode 100644 index 0000000..f0f3e9a --- /dev/null +++ b/src/pages/index/components/renting-cabinet-container.vue @@ -0,0 +1,435 @@ + + + + + diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index b8aa167..cf11dc6 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -34,7 +34,7 @@ onMounted(async () => { if (res?.code === 0 && res?.data?.length > 0) { shopList.value = res.data; - shopList.value = [...shopList.value, ...res.data, ...res.data, ...res.data]; + // shopList.value = [...shopList.value, ...res.data, ...res.data, ...res.data]; } } catch (error) { console.error('获取店铺列表失败:', error) @@ -70,7 +70,7 @@ function backToShopList() { // 结算方法 function handleCheckout() { uni.navigateTo({ - url: '/pages/index/shopping-cart/index' + url: '/pages/index/checkout' }) } diff --git a/src/static/svg/product-image.svg b/src/static/svg/product-image.svg new file mode 100644 index 0000000..f12a898 --- /dev/null +++ b/src/static/svg/product-image.svg @@ -0,0 +1,6 @@ + + + 空闲 + \ No newline at end of file