新增产品信息
<p>[TOC]</p>
<h5>简要描述</h5>
<ul>
<li>新增产品信息接口</li>
</ul>
<h4><strong>接口描述</strong></h4>
<p>创建新产品信息,包含产品基础信息、价格、描述、轮播图、SKU 列表及 SKU 编码等。</p>
<h5>请求URL</h5>
<pre><code>http://localhost:48082/admin-api/erp/product/create</code></pre>
<h5>请求方式</h5>
<ul>
<li>POST </li>
</ul>
<hr />
<h3><strong>请求参数说明</strong></h3>
<h4><strong>请求数据结构</strong></h4>
<pre><code class="language-json">{
&quot;categoryId&quot;: 89,
&quot;categoryName&quot;: null,
&quot;prodCode&quot;: &quot;Round-Chandelier&quot;,
&quot;barCode&quot;: &quot;12345678&quot;,
&quot;name&quot;: &quot;大光明豪华吊灯&quot;,
&quot;introductionType&quot;: 10,
&quot;introductionUrl&quot;: &quot;http://.../image.png&quot;,
&quot;sliderPicUrls&quot;: [ &quot;http://.../image1.png&quot;, &quot;http://.../image2.png&quot; ],
&quot;purchasePrice&quot;: 199.00,
&quot;salePrice&quot;: 199.00,
&quot;minPrice&quot;: 199.00,
&quot;description&quot;: &quot;&lt;p&gt;产品描述 HTML&lt;/p&gt;&quot;,
&quot;sort&quot;: 5,
&quot;status&quot;: 1,
&quot;remark&quot;: null,
&quot;skuList&quot;: [ ... ]
}</code></pre>
<h4><strong>字段说明</strong></h4>
<h5>1. 根字段</h5>
<table>
<thead>
<tr>
<th>字段名</th>
<th>必填</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>categoryId</td>
<td>是</td>
<td>整数</td>
<td>分类 ID</td>
</tr>
<tr>
<td>categoryName</td>
<td>否</td>
<td>字符串</td>
<td>分类名称(通常无需填写,由系统关联)</td>
</tr>
<tr>
<td>prodCode</td>
<td>是</td>
<td>字符串</td>
<td>产品编码(唯一标识)</td>
</tr>
<tr>
<td>barCode</td>
<td>是</td>
<td>字符串</td>
<td>商品条形码</td>
</tr>
<tr>
<td>name</td>
<td>是</td>
<td>字符串</td>
<td>产品名称</td>
</tr>
<tr>
<td>introductionType</td>
<td>是</td>
<td>整数</td>
<td>介绍类型(示例为 <code>10</code>,需确认含义)</td>
</tr>
<tr>
<td>introductionUrl</td>
<td>是</td>
<td>字符串</td>
<td>主图 URL</td>
</tr>
<tr>
<td>sliderPicUrls</td>
<td>是</td>
<td>字符串数组</td>
<td>轮播图 URL 列表</td>
</tr>
<tr>
<td>purchasePrice</td>
<td>是</td>
<td>数值</td>
<td>采购价(保留 2 位小数)</td>
</tr>
<tr>
<td>salePrice</td>
<td>是</td>
<td>数值</td>
<td>销售价</td>
</tr>
<tr>
<td>minPrice</td>
<td>是</td>
<td>数值</td>
<td>最低价</td>
</tr>
<tr>
<td>description</td>
<td>是</td>
<td>字符串</td>
<td>产品描述(HTML 格式)</td>
</tr>
<tr>
<td>sort</td>
<td>否</td>
<td>整数</td>
<td>排序值(数值越大越靠前)</td>
</tr>
<tr>
<td>status</td>
<td>是</td>
<td>整数</td>
<td>状态(<code>1</code> 启用,<code>0</code> 停用)</td>
</tr>
<tr>
<td>remark</td>
<td>否</td>
<td>字符串</td>
<td>备注</td>
</tr>
<tr>
<td>skuList</td>
<td>是</td>
<td>SKU 对象数组</td>
<td>SKU 列表(结构见下文)</td>
</tr>
</tbody>
</table>
<hr />
<h5>2. <code>skuList</code> 数组(SKU 列表)</h5>
<table>
<thead>
<tr>
<th>字段名</th>
<th>必填</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>properties</td>
<td>是</td>
<td>属性对象数组</td>
<td>SKU 属性组合(如尺寸、颜色)</td>
</tr>
<tr>
<td>name</td>
<td>是</td>
<td>字符串</td>
<td>SKU 名称(示例与产品名相同)</td>
</tr>
<tr>
<td>price</td>
<td>是</td>
<td>数值</td>
<td>SKU 价格</td>
</tr>
<tr>
<td>marketPrice</td>
<td>是</td>
<td>数值</td>
<td>市场价</td>
</tr>
<tr>
<td>costPrice</td>
<td>是</td>
<td>数值</td>
<td>成本价</td>
</tr>
<tr>
<td>barCode</td>
<td>是</td>
<td>字符串</td>
<td>SKU 条形码(可为空字符串)</td>
</tr>
<tr>
<td>picUrl</td>
<td>是</td>
<td>字符串</td>
<td>SKU 图片 URL</td>
</tr>
<tr>
<td>sort</td>
<td>是</td>
<td>整数</td>
<td>SKU 排序值</td>
</tr>
<tr>
<td>skuCodeList</td>
<td>是</td>
<td>SKU编码对象数组</td>
<td>SKU 编码列表(与门店关联)</td>
</tr>
</tbody>
</table>
<h6>2.1 <code>properties</code> 数组(属性组合)</h6>
<table>
<thead>
<tr>
<th>字段名</th>
<th>必填</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>propertyId</td>
<td>是</td>
<td>整数</td>
<td>属性项 ID(如尺寸 ID)</td>
</tr>
<tr>
<td>propertyName</td>
<td>是</td>
<td>字符串</td>
<td>属性项名称(如“尺寸”)</td>
</tr>
<tr>
<td>valueId</td>
<td>是</td>
<td>整数</td>
<td>属性值 ID(如“72''” ID)</td>
</tr>
<tr>
<td>valueName</td>
<td>是</td>
<td>字符串</td>
<td>属性值名称</td>
</tr>
</tbody>
</table>
<h6>2.2 <code>skuCodeList</code> 数组(SKU 编码列表)</h6>
<table>
<thead>
<tr>
<th>字段名</th>
<th>必填</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>productSkuCode</td>
<td>是</td>
<td>字符串</td>
<td>SKU 编码(需唯一)</td>
</tr>
<tr>
<td>storeId</td>
<td>是</td>
<td>字符串</td>
<td>门店 ID</td>
</tr>
</tbody>
</table>
<hr />
<h3><strong>请求示例</strong></h3>
<pre><code class="language-json">{
&quot;categoryId&quot;: 89,
&quot;prodCode&quot;: &quot;Round-Chandelier&quot;,
&quot;barCode&quot;: &quot;12345678&quot;,
&quot;name&quot;: &quot;大光明豪华吊灯&quot;,
&quot;introductionType&quot;: 10,
&quot;introductionUrl&quot;: &quot;http://.../image.png&quot;,
&quot;sliderPicUrls&quot;: [
&quot;http://.../image1.png&quot;,
&quot;http://.../image2.png&quot;
],
&quot;purchasePrice&quot;: 199.00,
&quot;salePrice&quot;: 199.00,
&quot;minPrice&quot;: 199.00,
&quot;description&quot;: &quot;&lt;p&gt;产品描述 HTML&lt;/p&gt;&quot;,
&quot;sort&quot;: 5,
&quot;status&quot;: 1,
&quot;skuList&quot;: [
{
&quot;properties&quot;: [
{
&quot;propertyId&quot;: 2,
&quot;propertyName&quot;: &quot;尺寸&quot;,
&quot;valueId&quot;: 1,
&quot;valueName&quot;: &quot;72&#039;&#039;&quot;
},
{
&quot;propertyId&quot;: 3,
&quot;propertyName&quot;: &quot;颜色&quot;,
&quot;valueId&quot;: 3,
&quot;valueName&quot;: &quot;漆面抛光黄铜&quot;
}
],
&quot;name&quot;: &quot;大光明豪华吊灯&quot;,
&quot;price&quot;: 199.00,
&quot;marketPrice&quot;: 199.00,
&quot;costPrice&quot;: 199.00,
&quot;barCode&quot;: &quot;&quot;,
&quot;picUrl&quot;: &quot;http://.../image.png&quot;,
&quot;sort&quot;: 1,
&quot;skuCodeList&quot;: [
{
&quot;productSkuCode&quot;: &quot;SKUCODE-10-1-001&quot;,
&quot;storeId&quot;: &quot;1&quot;
}
]
}
]
}</code></pre>
<hr />
<h3><strong>响应参数说明</strong></h3>
<h4><strong>响应数据结构</strong></h4>
<pre><code class="language-json">{
&quot;code&quot;: 0,
&quot;data&quot;: { ... },
&quot;msg&quot;: &quot;&quot;
}</code></pre>
<h5>字段说明</h5>
<table>
<thead>
<tr>
<th>字段名</th>
<th>类型</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>code</td>
<td>整数</td>
<td>状态码(0 成功,其他为错误码)</td>
</tr>
<tr>
<td>data</td>
<td>对象</td>
<td>新增产品完整信息(包含生成的 ID 等)</td>
</tr>
<tr>
<td>msg</td>
<td>字符串</td>
<td>错误信息(成功时为空)</td>
</tr>
</tbody>
</table>
<hr />
<h3><strong>注意事项</strong></h3>
<ol>
<li><strong>必填字段</strong>:标注为“必填”的字段必须提供,否则接口可能返回错误。</li>
<li><strong>SKU 唯一性</strong>:<code>productSkuCode</code> 需全局唯一,避免重复。</li>
<li><strong>属性关联</strong>:<code>properties</code> 中的 <code>propertyId</code> 和 <code>valueId</code> 需与属性项、属性值接口中的数据一致。</li>
<li><strong>价格精度</strong>:价格字段建议保留 2 位小数(示例中精度不一致需确认业务规则)。</li>
<li><strong>图片 URL</strong>:确保 <code>introductionUrl</code> 和 <code>picUrl</code> 是有效的可访问地址。</li>
<li><strong>空值处理</strong>:<code>categoryName</code>、<code>remark</code> 等字段可传 <code>null</code> 或空字符串。</li>
</ol>