6
0
Fork 0

添加后台优惠券管理

release
vine_liutk 2021-12-07 17:45:46 +08:00
parent e668ec9826
commit 791b9a3268
22 changed files with 674 additions and 13 deletions

View File

@ -0,0 +1,152 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Renderable\CouponRangeTable;
use App\Admin\Repositories\Coupon;
use App\Models\Coupon as CouponModel;
use App\Models\CouponRange;
use Dcat\Admin\Admin;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Show;
class CouponController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new Coupon(), function (Grid $grid) {
$grid->column('id')->sortable();
$grid->column('name');
$grid->column('type')->using([
1 =>'抵扣券',
2 =>'折扣券',
])->label();
$grid->column('value')->display(function ($value) {
if ($this->type == 1) {
return $value.'元';
} elseif ($this->type == 2) {
return $value.'折';
}
})->label();
$grid->column('threshold')->append('元');
$grid->column('limit');
$grid->column('sent');
$grid->column('use_day')->append('天');
$grid->column('use_start_at');
$grid->column('use_end_at');
$grid->column('created_at')->sortable();
/** 操作 **/
//新增
if (Admin::user()->can('dcat.admin.coupons.create')) {
$grid->disableCreateButton(false);
$grid->enableDialogCreate();
$grid->setDialogFormDimensions('40%', '70%');
}
//修改
$grid->showQuickEditButton(Admin::user()->can('dcat.admin.coupons.edit'));
//删除以及自定义操作
$grid->actions(function (Grid\Displayers\Actions $actions) {
$actions->disableDelete(Admin::user()->cannot('dcat.admin.coupons.destroy'));
if (Admin::user()->can('dcat.admin.coupons.range_list')) {
$actions->append('<a href="'.admin_route('coupons.range_list', ['coupon'=>$actions->row]).'"><i class="fa fa-eye"></i> 使用范围</a>');
}
});
/** 查询 **/
$grid->filter(function (Grid\Filter $filter) {
$filter->panel();
$filter->liek('name')->width(3);
});
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new Coupon(), function (Show $show) {
$show->field('id');
$show->field('name');
$show->field('type');
$show->field('value');
$show->field('threshold');
$show->field('limit');
$show->field('sent');
$show->field('use_day');
$show->field('use_start_at');
$show->field('use_end_at');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new Coupon(), function (Form $form) {
$form->display('id');
$form->text('name')->required();
$form->radio('type')
->when(1, function (Form $form) {
$form->currency('value1')->symbol('¥')->help('例100.00表示优惠100元。')->value($form->model()->value);
})
->when(2, function (Form $form) {
$form->currency('value2')->symbol('%')->help('例0.95表示95折。')->value($form->model()->value);
})
->options([
1 =>'抵扣券',
2 =>'折扣券',
])->default(1);
$form->currency('threshold')->symbol('¥')->default(0);
$form->number('limit')->default(0);
$form->number('use_day')->default(0)->help('单位:天;指领取后几天内有效。');
$form->datetimeRange('use_start_at', 'use_end_at', '使用时间')->help('设置时间后,期限字段失效。');
$form->hidden('value');
$form->saving(function (Form $form) {
$value = 'value'.$form->type;
$form->value = $form->$value;
$form->deleteInput('value1');
$form->deleteInput('value2');
});
$form->display('created_at');
$form->display('updated_at');
});
}
/**
* 使用范围列表
*
* @param Content $content
* @param CouponModel $coupon
* @return void
*/
public function rangeList(Content $content, CouponModel $coupon)
{
$builder = CouponRange::where('coupon_id', $coupon->id);
return $content->header(__('coupon.labels.coupons'))
->description($coupon->name)
->body(CouponRangeTable::grid($coupon->id));
}
}

View File

@ -0,0 +1,111 @@
<?php
namespace App\Admin\Controllers;
use App\Admin\Renderable\CouponRangeTable;
use App\Admin\Renderable\ProductSkuSimpleTable;
use App\Admin\Repositories\CouponRange;
use App\Models\Coupon;
use App\Models\ProductCategory;
use App\Models\ProductSku;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController;
use Dcat\Admin\Show;
use Illuminate\Support\Facades\Request;
class CouponRangeController extends AdminController
{
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return CouponRangeTable::grid();
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new CouponRange(), function (Show $show) {
$show->field('id');
$show->field('coupon_id');
$show->field('type');
$show->field('ranges');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new CouponRange(), function (Form $form) {
$couponId = Request::get('coupon_id', 0);
$form->display('id');
if ($couponId) {
$form->select('coupon_id_show', __('coupon-range.fields.coupon_id'))->options(Coupon::all()->pluck('name', 'id'))->value($couponId)->disable();
$form->hidden('coupon_id')->value($couponId);
} else {
$form->select('coupon_id')->options(Coupon::all()->pluck('name', 'id'))->required();
}
$form->radio('type')
->when(1, function (Form $form) {
$form->tree('ranges1')
->nodes(ProductCategory::get()->toArray()) // 设置所有节点
->setTitleColumn('name')
->customFormat(function ($v) {
if ($this->model()->type == 1) {
$v = $this->model()->ranges;
} else {
$v = [];
}
return $v;
})->expand(false);
})
->when(2, function (Form $form) {
$form->multipleSelectTable('ranges2')
->from(ProductSkuSimpleTable::make())
->model(ProductSku::class, 'id', 'name')
->customFormat(function ($v) {
if ($this->model()->type == 2) {
$v = $this->model()->ranges;
} else {
$v = [];
}
return $v;
});
})
->options([
1=>'商品分类',
2=>'SKU商品',
])->default(1);
$form->hidden('ranges');
$form->ignore(['coupon_id_show']);
$form->saving(function (Form $form) {
$ranges = 'ranges'.$form->type;
$form->ranges = $form->$ranges;
$form->deleteInput('ranges1');
$form->deleteInput('ranges2');
});
$form->display('created_at');
$form->display('updated_at');
});
}
}

View File

@ -115,6 +115,15 @@ class ProductCategoryController extends AdminController
$form->switch('is_show');
$form->switch('is_recommend');
$form->number('sort')->default(0);
$form->saving(function (Form $form) {
//只能添加到三级分类
if ($form->parent_id) {
$result = ProductCategoryModel::withDepth()->find($form->parent_id);
if ($result->depth >= 2) {
return $form->response()->error('不能创建四级以及以下的分类');
}
}
});
$form->display('created_at');
$form->display('updated_at');
@ -123,7 +132,7 @@ class ProductCategoryController extends AdminController
public function destroy($id)
{
//如果有子分类或者分类下有文章则不允许删除
//如果有子分类或者分类下有商品则不允许删除
if (ProductCategoryModel::descendantsOf($id, ['id'])->count() > 0
|| ProductSpu::where('category_id', $id)->count() > 0) {
throw new BizException(__('product-category.options.deny_message'));

View File

@ -117,7 +117,7 @@ class ProductSkuController extends AdminController
public function destroy($id)
{
$sku = ProductSkuModel::findOrFail($id);
if ($sku->release_at || $sku->verify_state == 1) {//如果是上架中、或者审核中的,无法删除
if ($sku->release_at || $sku->verify_state == 1 || $sku->sales > 0) {//如果是上架中、审核中或者已售出的,无法删除
throw new BizException(__('product-sku.options.deny_message'));
}
return parent::destroy($id);

View File

@ -174,7 +174,7 @@ class ProductSpuController extends AdminController
*
* @return void
*/
public function list(Content $content, ProductSpuModel $spu)
public function skuList(Content $content, ProductSpuModel $spu)
{
return $content->header(__('product-spu.labels.ProductSpu'))
->description($spu->name)

View File

@ -0,0 +1,26 @@
<?php
namespace App\Admin\Renderable;
use App\Models\CouponRange;
use App\Models\ProductSku;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;
class CouponRangeSkuTable extends LazyRenderable
{
public function grid(): Grid
{
$rangeId = $this->payload['id'];
// dd($partId);
$couponRange = CouponRange::findOrFail($rangeId);
$builder = ProductSku::whereIn('id', explode(',', $couponRange->ranges));
return Grid::make($builder, function (Grid $grid) {
$grid->column('name', __('product-sku.fields.name'));
$grid->column('specs', __('product-sku.fields.specs'))->label();
$grid->quickSearch(['name']);
$grid->disableActions();
});
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Admin\Renderable;
use App\Admin\Repositories\CouponRange;
use App\Models\ProductCategory;
use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\Column;
class CouponRangeTable extends Grid
{
public static function grid(int $couponId = null)
{
$builder = CouponRange::with('coupon');
$grid = parent::make($builder, function (Grid $grid) {
$grid->setResource('coupon-ranges');
$grid->column('id')->sortable();
$grid->column('coupon.name');
$grid->column('type')->using([
1=>'商品分类',
2=>'SKU商品',
])->label();
$grid->column('ranges')
->if(function () {
return $this->type == 1;
})->then(function (Column $column) {
$column->showTreeInDialog(function (Grid\Displayers\DialogTree $tree) {
$tree->nodes(ProductCategory::get()->toArray());
$tree->setTitleColumn('name');
});
})
->else(function (Column $column) {
$column->display('查看')->modal(function ($modal) {
$modal->icon('feather icon-align-right');
$modal->title('SKU商品');
return CouponRangeSkuTable::make(['id'=>$this->id]);
});
});
$grid->column('created_at');
$grid->column('updated_at')->sortable();
/** 操作 **/
//新增
if (Admin::user()->can('dcat.admin.coupon_ranges.create')) {
$grid->disableCreateButton(false);
$grid->enableDialogCreate();
}
//修改
$grid->showQuickEditButton(Admin::user()->can('dcat.admin.coupon_ranges.edit'));
//删除以及自定义操作
$grid->actions(function (Grid\Displayers\Actions $actions) {
$actions->disableView();
$actions->disableEdit();
$actions->disableDelete(Admin::user()->cannot('dcat.admin.coupon_ranges.destroy'));
});
});
if ($couponId) {
$grid->model()->where('coupon_id', $couponId);
$grid->model()->setConstraints([
'coupon_id' => $couponId,
]);
}
return $grid;
}
}

View File

@ -10,14 +10,11 @@ class ProductSkuSimpleTable extends LazyRenderable
{
public function grid(): Grid
{
$partId = $this->part_id;
$builder = ProductSku::query();
// $builder->with('parts')->whereHas('parts', function ($query) use ($partId) {
// $query->where('id', $partId);
// });
return Grid::make($builder, function (Grid $grid) {
$grid->disableRowSelector(false);
$grid->column('name');
$grid->column('specs')->label();
$grid->quickSearch(['name']);
$grid->disableActions();
});

View File

@ -65,6 +65,7 @@ class ProductSkuTable extends Grid
$grid->model()->orderBy('created_at', 'desc');
$grid->model()->orderBy('release_at', 'desc');
$grid->actions(function (Grid\Displayers\Actions $actions) {
$actions->disableView();
if (is_null($actions->row->release_at) || $actions->row->verify_state == 1) {//未上架或者审核未通过
$actions->disableEdit(Admin::user()->cannot('dcat.admin.product_skus.edit'));
$actions->disableDelete(Admin::user()->cannot('dcat.admin.product_skus.destroy'));

View File

@ -0,0 +1,16 @@
<?php
namespace App\Admin\Repositories;
use App\Models\Coupon as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class Coupon extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Admin\Repositories;
use App\Models\CouponRange as Model;
use Dcat\Admin\Repositories\EloquentRepository;
class CouponRange extends EloquentRepository
{
/**
* Model.
*
* @var string
*/
protected $eloquentClass = Model::class;
}

View File

@ -48,12 +48,18 @@ Route::group([
])->names('product_buynotes');
$router->resource('product-spus', 'ProductSpuController')->names('product_spus');
$router->get('product-spus/{spu}/list', 'ProductSpuController@list')->name('product_spus.list');
$router->get('product-spus/{spu}/sku-list', 'ProductSpuController@skuList')->name('product_spus.sku_list');
$router->resource('product-skus', 'ProductSkuController')->only([
'index', 'edit', 'update', 'destroy',
])->names('product_skus');
$router->resource('coupons', 'CouponController')->names('coupons');
$router->get('coupons/{coupon}/range-list', 'CouponController@rangeList')->name('coupons.range_list');
$router->resource('coupon-ranges', 'CouponRangeController')->only([
'create', 'store', 'edit', 'update', 'destroy',
])->names('coupon_ranges');
$router->resource('product-sku-verifies', 'ProductSkuVerifyController')->only([
'index', 'edit', 'update', 'destroy',
])->names('product_sku_verifies');

View File

@ -0,0 +1,29 @@
<?php
namespace App\Models;
use App\Casts\Price;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Coupon extends Model
{
use HasFactory;
use HasDateTimeFormatter;
protected $casts = [
'value' => Price::class,
'threshold'=>Price::class,
];
/**
* 此优惠券的使用范围
*
* @return void
*/
public function ranges()
{
return $this->hasMany(CouponRange::class, 'coupon_id');
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class CouponRange extends Model
{
use HasFactory;
use HasDateTimeFormatter;
public function coupon()
{
return $this->belongsTo(Coupon::class, 'coupon_id');
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UserCoupon extends Model
{
use HasFactory;
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCouponsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('coupons', function (Blueprint $table) {
$table->id();
$table->string('name')->comment('优惠券名称');
$table->text('description')->nullable()->comment('优惠券说明');
$table->tinyInteger('type')->default(0)->unsigned()->comment('优惠券类型:1抵扣券2折扣券');
$table->unsignedInteger('value')->default(0)->comment('抵扣金额:分/折扣(100)');
$table->unsignedBigInteger('threshold')->default(0)->comment('使用门槛金额:分');
$table->unsignedInteger('limit')->default(0)->comment('限量');
$table->unsignedInteger('sent')->default(0)->comment('已送数量');
$table->unsignedInteger('use_day')->default(0)->comment('使用期限');
$table->timestamp('use_start_at')->nullable()->comment('使用开始时间');
$table->timestamp('use_end_at')->nullable()->comment('使用结束时间');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('coupons');
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCouponRangesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('coupon_ranges', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('coupon_id')->comment('优惠券ID');
$table->unsignedTinyInteger('type')->default(0)->comment('类型1商品分类,2sku商品');
$table->text('ranges')->comment('范围IDS');
$table->unsignedTinyInteger('status')->default(0)->comment('0未启用1启用');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('coupon_ranges');
}
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserCouponsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_coupons', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id')->comment('用户ID');
$table->unsignedBigInteger('coupon_id')->comment('优惠ID');
$table->string('coupon_name')->comment('优惠券名称');
$table->tinyInteger('coupon_type')->default(0)->unsigned()->comment('优惠券类型:1抵扣券2折扣券');
$table->unsignedInteger('coupon_value')->default(0)->comment('抵扣金额:分/折扣(100)');
$table->unsignedBigInteger('coupon_threshold')->default(0)->comment('使用门槛金额:分');
$table->timestamp('use_start_at')->comment('使用开始时间');
$table->timestamp('use_end_at')->comment('使用结束时间');
$table->unsignedTinyInteger('status')->default(0)->comment('状态0未使用1已使用');
$table->timestamps();
$table->index('user_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_coupons');
}
}

View File

@ -95,7 +95,7 @@ class AdminPermissionSeeder extends Seeder
'name' =>'主商品',
'curd'=> true,
'children'=>[
'list'=>['name'=>'子商品列表'],
'sku_list'=>['name'=>'子商品列表'],
'setting_specs'=>['name'=>'设置规格'],
'init_sku_by_specs'=>['name' =>'初始化SKU'],
'add_sku'=>['name' =>'添加子商品'],
@ -132,6 +132,17 @@ class AdminPermissionSeeder extends Seeder
'enable'=>['name' =>'启用'],
],
],
'coupons'=>[
'name' =>'优惠券管理',
'curd' => true,
'children'=>[
'range_list' =>'使用范围',
],
],
'coupon_ranges'=>[
'name' =>'优惠使用范围管理',
'curd' => ['create', 'store', 'edit', 'update', 'destroy'],
],
];
try {
DB::begintransaction();

View File

@ -59,6 +59,14 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection subtitle
* @property Grid\Column|Collection cover
* @property Grid\Column|Collection content
* @property Grid\Column|Collection coupon_id
* @property Grid\Column|Collection ranges
* @property Grid\Column|Collection threshold
* @property Grid\Column|Collection limit
* @property Grid\Column|Collection sent
* @property Grid\Column|Collection use_day
* @property Grid\Column|Collection use_start_at
* @property Grid\Column|Collection use_end_at
* @property Grid\Column|Collection uuid
* @property Grid\Column|Collection connection
* @property Grid\Column|Collection queue
@ -74,7 +82,6 @@ namespace Dcat\Admin {
* @property Grid\Column|Collection sku_id
* @property Grid\Column|Collection gift_sku_id
* @property Grid\Column|Collection num
* @property Grid\Column|Collection sent
* @property Grid\Column|Collection attrs
* @property Grid\Column|Collection specs
* @property Grid\Column|Collection part_id
@ -162,6 +169,14 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection subtitle(string $label = null)
* @method Grid\Column|Collection cover(string $label = null)
* @method Grid\Column|Collection content(string $label = null)
* @method Grid\Column|Collection coupon_id(string $label = null)
* @method Grid\Column|Collection ranges(string $label = null)
* @method Grid\Column|Collection threshold(string $label = null)
* @method Grid\Column|Collection limit(string $label = null)
* @method Grid\Column|Collection sent(string $label = null)
* @method Grid\Column|Collection use_day(string $label = null)
* @method Grid\Column|Collection use_start_at(string $label = null)
* @method Grid\Column|Collection use_end_at(string $label = null)
* @method Grid\Column|Collection uuid(string $label = null)
* @method Grid\Column|Collection connection(string $label = null)
* @method Grid\Column|Collection queue(string $label = null)
@ -177,7 +192,6 @@ namespace Dcat\Admin {
* @method Grid\Column|Collection sku_id(string $label = null)
* @method Grid\Column|Collection gift_sku_id(string $label = null)
* @method Grid\Column|Collection num(string $label = null)
* @method Grid\Column|Collection sent(string $label = null)
* @method Grid\Column|Collection attrs(string $label = null)
* @method Grid\Column|Collection specs(string $label = null)
* @method Grid\Column|Collection part_id(string $label = null)
@ -270,6 +284,14 @@ namespace Dcat\Admin {
* @property Show\Field|Collection subtitle
* @property Show\Field|Collection cover
* @property Show\Field|Collection content
* @property Show\Field|Collection coupon_id
* @property Show\Field|Collection ranges
* @property Show\Field|Collection threshold
* @property Show\Field|Collection limit
* @property Show\Field|Collection sent
* @property Show\Field|Collection use_day
* @property Show\Field|Collection use_start_at
* @property Show\Field|Collection use_end_at
* @property Show\Field|Collection uuid
* @property Show\Field|Collection connection
* @property Show\Field|Collection queue
@ -285,7 +307,6 @@ namespace Dcat\Admin {
* @property Show\Field|Collection sku_id
* @property Show\Field|Collection gift_sku_id
* @property Show\Field|Collection num
* @property Show\Field|Collection sent
* @property Show\Field|Collection attrs
* @property Show\Field|Collection specs
* @property Show\Field|Collection part_id
@ -373,6 +394,14 @@ namespace Dcat\Admin {
* @method Show\Field|Collection subtitle(string $label = null)
* @method Show\Field|Collection cover(string $label = null)
* @method Show\Field|Collection content(string $label = null)
* @method Show\Field|Collection coupon_id(string $label = null)
* @method Show\Field|Collection ranges(string $label = null)
* @method Show\Field|Collection threshold(string $label = null)
* @method Show\Field|Collection limit(string $label = null)
* @method Show\Field|Collection sent(string $label = null)
* @method Show\Field|Collection use_day(string $label = null)
* @method Show\Field|Collection use_start_at(string $label = null)
* @method Show\Field|Collection use_end_at(string $label = null)
* @method Show\Field|Collection uuid(string $label = null)
* @method Show\Field|Collection connection(string $label = null)
* @method Show\Field|Collection queue(string $label = null)
@ -388,7 +417,6 @@ namespace Dcat\Admin {
* @method Show\Field|Collection sku_id(string $label = null)
* @method Show\Field|Collection gift_sku_id(string $label = null)
* @method Show\Field|Collection num(string $label = null)
* @method Show\Field|Collection sent(string $label = null)
* @method Show\Field|Collection attrs(string $label = null)
* @method Show\Field|Collection specs(string $label = null)
* @method Show\Field|Collection part_id(string $label = null)

View File

@ -0,0 +1,17 @@
<?php
return [
'labels' => [
'CouponRange' => 'CouponRange',
'coupon-range' => 'CouponRange',
],
'fields' => [
'coupon_id' => '优惠券',
'type' => '类型',
'ranges' => '范围',
'ranges1'=>'选择分类',
'ranges2'=>'选择商品',
],
'options' => [
],
];

View File

@ -0,0 +1,27 @@
<?php
return [
'labels' => [
'Coupon' => '优惠券',
'coupons' => '优惠券',
],
'fields' => [
'coupon' => [
'name' => '优惠券',
],
'name' => '名称',
'type' => '券类型',
'value' => '力度',
'value1'=>'抵扣金额',
'value2'=>'折扣',
'threshold' => '使用门槛',
'limit' => '限量',
'sent' => '已发',
'use_day' => '期限',
'use_start_at' => '使用开始时间',
'use_end_at' => '使用结束时间',
'ranges'=>'范围',
],
'options' => [
],
];