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)