From 2d502e6bb1137300fa9e1b7170381c6337325a92 Mon Sep 17 00:00:00 2001 From: dzq Date: Fri, 18 Apr 2025 15:55:25 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=95=86=E5=93=81):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=95=86=E5=93=81=E6=A0=BC=E5=AD=90ID=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=E5=A4=9A=E6=A0=BC=E5=AD=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在商品相关的接口、类型定义和组件中添加了`cellId`字段,以便更好地管理商品在不同格子中的分布和订单提交时的数据完整性。 --- src/common/apis/shop/index.ts | 2 +- src/common/apis/shop/type.ts | 4 +++- src/pages/product/components/checkout.vue | 3 ++- src/pinia/stores/product.ts | 4 +++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/common/apis/shop/index.ts b/src/common/apis/shop/index.ts index 0f00c3f..65254ff 100644 --- a/src/common/apis/shop/index.ts +++ b/src/common/apis/shop/index.ts @@ -4,7 +4,7 @@ import { GetOpenIdRequestParams } from './type' -/** 获取当前登录用户详情 */ +/** 获取商品列表 */ export function getShopGoodsApi() { return request({ url: "shop/goods", diff --git a/src/common/apis/shop/type.ts b/src/common/apis/shop/type.ts index d810719..a5a0133 100644 --- a/src/common/apis/shop/type.ts +++ b/src/common/apis/shop/type.ts @@ -6,7 +6,8 @@ export type Goods = { stock: number, status: number, coverImg: string, - goodsDetail: string + goodsDetail: string, + cellId: number } export type category = { @@ -36,6 +37,7 @@ export interface SubmitOrderRequestData { goodsList: Array<{ goodsId: number quantity: number + cellId: number }> } diff --git a/src/pages/product/components/checkout.vue b/src/pages/product/components/checkout.vue index 90e1ed9..afcf693 100644 --- a/src/pages/product/components/checkout.vue +++ b/src/pages/product/components/checkout.vue @@ -97,7 +97,8 @@ async function handleSubmit() { corpid: wxStore.corpid, goodsList: cartItems.value.map(item => ({ goodsId: item.product.id, - quantity: item.quantity + quantity: item.quantity, + cellId: item.product.cellId, })), paymentType: selectedPayment.value, mobile: tel.value, diff --git a/src/pinia/stores/product.ts b/src/pinia/stores/product.ts index 8762628..0310069 100644 --- a/src/pinia/stores/product.ts +++ b/src/pinia/stores/product.ts @@ -9,6 +9,7 @@ export interface Product { description: string // 商品描述 image: string // 商品图片URL label: number // 商品标签 + cellId: number // 商品所在的格子ID } export const useProductStore = defineStore("product", () => { @@ -34,7 +35,8 @@ export const useProductStore = defineStore("product", () => { stock: g.stock, description: g.goodsDetail || "暂无描述", image: g.coverImg, - label: g.categoryId + label: g.categoryId, + cellId: g.cellId })) } catch (error) { console.error("获取商品数据失败:", error)