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() { export function getShopGoodsApi() {
return request<ShopGoodsResponseData>({ return request<ShopGoodsResponseData>({
url: "shop/goods", url: "shop/goods",

View File

@ -6,7 +6,8 @@ export type Goods = {
stock: number, stock: number,
status: number, status: number,
coverImg: string, coverImg: string,
goodsDetail: string goodsDetail: string,
cellId: number
} }
export type category = { export type category = {
@ -36,6 +37,7 @@ export interface SubmitOrderRequestData {
goodsList: Array<{ goodsList: Array<{
goodsId: number goodsId: number
quantity: number quantity: number
cellId: number
}> }>
} }

View File

@ -97,7 +97,8 @@ async function handleSubmit() {
corpid: wxStore.corpid, corpid: wxStore.corpid,
goodsList: cartItems.value.map(item => ({ goodsList: cartItems.value.map(item => ({
goodsId: item.product.id, goodsId: item.product.id,
quantity: item.quantity quantity: item.quantity,
cellId: item.product.cellId,
})), })),
paymentType: selectedPayment.value, paymentType: selectedPayment.value,
mobile: tel.value, mobile: tel.value,

View File

@ -9,6 +9,7 @@ export interface Product {
description: string // 商品描述 description: string // 商品描述
image: string // 商品图片URL image: string // 商品图片URL
label: number // 商品标签 label: number // 商品标签
cellId: number // 商品所在的格子ID
} }
export const useProductStore = defineStore("product", () => { export const useProductStore = defineStore("product", () => {
@ -34,7 +35,8 @@ export const useProductStore = defineStore("product", () => {
stock: g.stock, stock: g.stock,
description: g.goodsDetail || "暂无描述", description: g.goodsDetail || "暂无描述",
image: g.coverImg, image: g.coverImg,
label: g.categoryId label: g.categoryId,
cellId: g.cellId
})) }))
} catch (error) { } catch (error) {
console.error("获取商品数据失败:", error) console.error("获取商品数据失败:", error)