Commit 48eec898 authored by wuxiaoli's avatar wuxiaoli

商品编号

parent 6fc57b2f
...@@ -19,7 +19,7 @@ class Goods extends BaseModel { ...@@ -19,7 +19,7 @@ class Goods extends BaseModel {
protected $table = 'goods'; protected $table = 'goods';
protected $fillable = [ protected $fillable = [
'title', 'user_id', 'brand_id', 'description', 'tags', 'goods_type','cover', 'images', 'price', 'original_price', 'title', 'user_id', 'brand_id', 'description', 'tags', 'goods_type','cover', 'images', 'price', 'original_price',
'service_amount', 'master_amount', 'partner_amount', 'is_partner', 'operate', 'content', 'status' 'service_amount', 'master_amount', 'partner_amount', 'is_partner', 'operate', 'content', 'status','goods_sn'
]; ];
// protected $hidden = ['deleted_at']; // protected $hidden = ['deleted_at'];
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
namespace Modules\Goods\Services; namespace Modules\Goods\Services;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Modules\Goods\Models\Goods; use Modules\Goods\Models\Goods;
use App\Support\Tree; use App\Support\Tree;
...@@ -118,6 +119,7 @@ class GoodsService { ...@@ -118,6 +119,7 @@ class GoodsService {
foreach ($goods->setFilterFields($request->all()) as $key => $value) { foreach ($goods->setFilterFields($request->all()) as $key => $value) {
$goods->$key = $value; $goods->$key = $value;
} }
$goods->goods_sn = date('YmdHis') ;
$goods->save(); $goods->save();
//更新栏目 //更新栏目
......
...@@ -46,6 +46,7 @@ return new class extends Migration ...@@ -46,6 +46,7 @@ return new class extends Migration
$table->tinyInteger('status')->default(1)->comment('状态 1上架 0下架'); $table->tinyInteger('status')->default(1)->comment('状态 1上架 0下架');
$table->timestamp('created_at')->nullable()->comment('创建时间'); $table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间'); $table->timestamp('updated_at')->nullable()->comment('更新时间');
$table->string('goods_sn')->nullable()->comment('商品编号');
$table->engine = 'InnoDB'; $table->engine = 'InnoDB';
$table->charset = 'utf8mb4'; $table->charset = 'utf8mb4';
......
...@@ -60,6 +60,7 @@ export default{ ...@@ -60,6 +60,7 @@ export default{
apiObj: this.$API.goods.lists.list, apiObj: this.$API.goods.lists.list,
column: [ column: [
{prop: 'id', label: 'ID', width: 80}, {prop: 'id', label: 'ID', width: 80},
{prop: 'goods_sn', label: '商品编号'},
{prop: 'title', label: '商品名称'}, {prop: 'title', label: '商品名称'},
{prop: 'cover', label: '封面图', width: 120}, {prop: 'cover', label: '封面图', width: 120},
{prop: 'price', label: '售价', width: 120}, {prop: 'price', label: '售价', width: 120},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment