4
0
Fork 0

update readme.md

master
panliang 2022-09-09 16:01:51 +08:00
parent dd735a134a
commit bb3937cd4d
3 changed files with 97 additions and 60 deletions

100
README.md
View File

@ -22,9 +22,9 @@ Dcat-admin 商品管理
| image | varchar(191) | null | - | 分类图片 |
| description | varchar(191) | null | - | 描述 |
| parent_id | bigint | not null | 0 | 上级 id |
| level | int | not null | 1 | 层级 |
| sort | int | not null | 1 | 排序(asc) |
| is_enable | int | not null | 1 | 是否可用(0, 1) |
| level | integer | not null | 1 | 层级 |
| sort | integer | not null | 1 | 排序(asc) |
| is_enable | integer | not null | 1 | 是否可用(0, 1) |
| path | varchar(191) | not null | '-' | 所有上级 id(1-2-3-, -) |
| created_at | timestamp | null | - | 创建时间 |
| updated_at | timestamp | null | - | 更新时间 |
@ -78,5 +78,97 @@ Dcat-admin 商品管理
| column | type | nullable | default | comment |
| - | - | - | - | - |
| id | bigint | not null | - | 主键 |
| category_id | bigint | not null | - | 分类 |
| category_id | bigint | not null | - | 分类 id |
| merchant_id | bigint | not null | - | 商户 id |
| type_id | bigint | not null | - | 类别 id |
| brand_id | bigint | not null | - | 品牌 id |
| name | varchar(191) | not null | - | 商品名称 |
| description | varchar(191) | not null | - | 商品名称 |
| goods_sn | varchar(191) | null | - | 编号 |
| cover_image | varchar(191) | not null | - | 封面图 |
| images | json | null | - | 图片集 |
| content | json | null | - | 内容 |
| on_sale | integer | not null | 0 | 是否上架 |
| is_recommend | integer | not null | 0 | 是否推荐 |
| stock | integer | not null | 0 | 库存 |
| sold_count | integer | not null | 0 | 销量 |
| price | decimal(12, 2) | not null | 0 | 售价 |
| attr | json | null | - | 属性介绍 |
| spec | json | null | - | 规格加价(单选) |
| part | json | null | - | 配件加购(多选) |
| created_at | timestamp | null | - | 创建时间 |
| updated_at | timestamp | null | - | 更新时间 |
> goods.attr 存储格式
```json
[
{
"name": "主体",
"values": [
{"name": "入网型号", "value": "5G"},
{"name": "上市年份", "value": "2020"}
]
}
]
```
> goods.spec 存储格式
```json
[
{
"name": "颜色",
"values": [
{"name": "红色", "value": 0},
{"name": "白色", "value": 0},
{"name": "灰色", "value": 0}
]
},
{
"name": "内存",
"values": [
{"name": "128G", "value": 0},
{"name": "256G", "value": 1000},
{"name": "1TB", "value": 3000}
]
}
]
```
> goods.part 存储格式
```json
[
{
"name": "套餐",
"values": [
{"name": "套餐1", "value": 100},
{"name": "套餐2", "value": 200},
{"name": "套餐3", "value": 300}
]
}
]
```
### 商品SKU: goods_sku
| column | type | nullable | default | comment |
| - | - | - | - | - |
| id | bigint | not null | - | 主键 |
| sn | varchar(191) | null | - | 货号 |
| goods_id | bigint | not null | - | 关联商品 |
| name | varchar(191) | not null | - | 名称 |
| on_sale | integer | not null | 0 | 是否上架 |
| stock | integer | not null | 0 | 库存 |
| sold_count | integer | not null | 0 | 销量 |
| spec | json | null | - | 规格 |
> goods.spec
```json
[
{"name": "颜色", "value": "白色"}
{"name": "内存", "value": "128G"}
]
```

View File

@ -60,7 +60,6 @@ class CreateGoodsTable extends Migration
$table->unsignedInteger('stock')->default(0)->comment('库存');
$table->unsignedInteger('sold_count')->default(0)->comment('销量');
$table->decimal('price', 12, 2)->comment('售价');
$table->decimal('vip_price', 12, 2)->comment('会员价');
$table->json('attr')->nullable()->comment('属性[{name, values: [{name, value}]}]');
$table->json('spec')->nullable()->comment('规格[{name, values: [{name, value}]}]');
$table->json('part')->nullable()->comment('配件[{name, values: [{name, value}]}]');
@ -70,48 +69,12 @@ class CreateGoodsTable extends Migration
$table->comment('商品');
});
Schema::create('goods_checks', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('goods_id')->comment('所属商品, 关联 goods.id');
$table->unsignedBigInteger('category_id')->comment('所属分类, 关联 goods_category.id');
$table->unsignedBigInteger('merchant_id')->nullable()->comment('商户ID');
$table->unsignedBigInteger('type_id')->nullable()->comment('所属类别');
$table->unsignedBigInteger('brand_id')->nullable()->comment('所属品牌');
$table->string('name')->comment('商品名称');
$table->string('goods_sn')->comment('编号');
$table->string('cover_image')->nullable()->comment('封面图');
$table->json('images')->nullable()->comment('图片集');
$table->string('description')->nullable()->comment('描述');
$table->json('content')->nullable()->comment('详细');
$table->unsignedInteger('on_sale')->default(0)->comment('是否上架');
$table->unsignedInteger('stock')->default(0)->comment('库存');
$table->unsignedInteger('sold_count')->default(0)->comment('销量');
$table->decimal('price', 12, 2)->comment('售价');
$table->decimal('vip_price', 12, 2)->comment('会员价');
$table->decimal('score_max_amount', 12, 2)->default(0)->comment('积分抵扣最大值');
$table->json('attr')->nullable()->comment('属性[{name, values: [{name, value}]}]');
$table->json('spec')->nullable()->comment('规格[{name, values: [{name, value}]}]');
$table->json('part')->nullable()->comment('配件[{name, values: [{name, value}]}]');
$table->unsignedInteger('check_status')->default(0)->comment('审核状态(0: 未提交, 1: 审核中, 2: 审核通过, 3: 审核不通过)');
$table->string('check_remarks')->nullable()->comment('审核备注');
$table->timestamp('check_at')->nullable()->comment('审核通过时间');
$table->unsignedBigInteger('check_user_id')->nullable()->comment('审核人');
$table->timestamps();
$table->comment('商品-上架审核');
});
Schema::create('goods_sku', function (Blueprint $table) {
$table->id();
$table->string('sn')->comment('货号');
$table->unsignedBigInteger('goods_id')->comment('所属商品, 关联 goods.id');
$table->string('name')->comment('名称');
$table->decimal('price', 12, 2)->comment('价格');
$table->decimal('vip_price', 12, 2)->comment('会员价');
$table->decimal('score_max_amount', 12, 2)->default(0)->comment('积分抵扣最大值');
$table->unsignedInteger('stock')->comment('库存');
$table->unsignedInteger('sold_count')->default(0)->comment('销量');
$table->json('spec')->nullable()->comment('规格[{name, value, price}]');
@ -128,7 +91,6 @@ class CreateGoodsTable extends Migration
public function down()
{
Schema::dropIfExists('goods_sku');
Schema::dropIfExists('goods_checks');
Schema::dropIfExists('goods');
Schema::dropIfExists('goods_category');
Schema::dropIfExists('goods_type');

View File

@ -49,26 +49,9 @@
{ "name": "套餐2", "value": 100 }
]
},
{
"table": "goods-sku.attr",
"name": "主体",
"values": [
{ "name": "入网型号", "value": "5G" },
{ "name": "上市年份", "value": "2020" }
]
},
{
"table": "goods-sku.spec",
"name": "颜色",
"value": "白色",
"price": 0
},
{
"table": "goods-sku.part",
"name": "颜色",
"values": [
{ "name": "套餐1", "price": 150 },
{ "name": "套餐2", "price": 100 }
]
"value": "白色"
}
]