动手之前要先确定自己的商品数据结构,下面是我的商品数据结构
dataInfo: {
attr: [
{
attr_name: "码数",
attr_value: [{attr: "40"}, {attr: "50"}],
attr_values: ["40", "50"],
},
{
attr_name: "颜色",
attr_value: [{attr: "红色"}, {attr: "蓝色"}],
attr_values: ["红色", "蓝色"],
},
],
sku: [
{
sku: "40,红色",
stock: 100,
price: "4038.08"
},
{
sku: "50,红色",
stock: 100,
price: "4038.08"
},
{
sku: "40,蓝色",
stock: 10