feat(商品): 添加商品格子ID字段以支持多格子管理

在商品相关的接口、类型定义和组件中添加了`cellId`字段,以便更好地管理商品在不同格子中的分布和订单提交时的数据完整性。
This commit is contained in:
dzq 2025-04-18 15:55:25 +08:00
parent 877f3fb954
commit 2d502e6bb1
4 changed files with 9 additions and 4 deletions

View File

@ -4,7 +4,7 @@ import { GetOpenIdRequestParams } from './type'
/** 获取当前登录用户详情 */
/** 获取商品列表 */
export function getShopGoodsApi() {
return request<ShopGoodsResponseData>({
url: "shop/goods",

View File

@ -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
}>
}

View File

@ -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,

View File

@ -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)