|
|
|
@ -132,20 +132,19 @@ class GoodsActivityController extends AdminController |
|
|
|
// 店铺
|
|
|
|
$storeList = StoreModel::getStoreArray(); |
|
|
|
//市场
|
|
|
|
// $marketList = MarketModel::getMarketArray();
|
|
|
|
$marketList = MarketModel::getMarketArray(); |
|
|
|
|
|
|
|
$form->column(6, function (Form $form) use($storeList,$categoryList ){ |
|
|
|
$form->column(6, function (Form $form) use($marketList,$storeList,$categoryList ){ |
|
|
|
$form->text('goods_id')->default(0)->help('输入正常商品id,用于关联商品。'); |
|
|
|
$form->hidden('market_id')->default(0); |
|
|
|
$form->multipleSelect('market_ids')->options($marketList)->help('不选则适用所有市场'); |
|
|
|
$form->select('category_id')->required()->options($categoryList)->load('goods_category_id', '/api/goods_category_list'); |
|
|
|
$form->select('goods_category_id'); |
|
|
|
$form->select('store_id')->required()->options($storeList); |
|
|
|
$form->text('name')->required()->maxLength(20); |
|
|
|
$form->image('cover_img')->required()->uniqueName(); |
|
|
|
$form->select('type')->options(GoodsActivityModel::$_type)->default('flash_sale'); |
|
|
|
$form->datetime('expire_time')->value($form->model()->expire_time_text); |
|
|
|
$form->number('time_limit_days'); |
|
|
|
|
|
|
|
$form->datetime('expire_time')->required()->format('YYYY-MM-DD HH:mm:ss')->help($form->model()->expire_time_text); |
|
|
|
}); |
|
|
|
$form->column(6, function (Form $form) { |
|
|
|
$form->currency('price')->required()->floatTwo()->symbol('¥'); |
|
|
|
@ -154,9 +153,10 @@ class GoodsActivityController extends AdminController |
|
|
|
$form->text('goods_unit')->help('如:斤,个,盒,500克,1000克,1500克等'); |
|
|
|
$form->radio('is_infinite')->options(['关闭','开启'])->default(1); |
|
|
|
$form->number('inventory')->required()->attribute('min', 1)->default(1); |
|
|
|
$form->number('restrict_num')->attribute('min', 0)->default(0)->help('0表示不限购'); |
|
|
|
$form->number('restrict_num')->attribute('min', 0)->default(0)->help('0表示不限购,单笔订单限购数量'); |
|
|
|
$form->number('start_num')->attribute('min', 1)->default(1); |
|
|
|
$form->number('time_limit_num'); |
|
|
|
$form->number('time_limit_days')->help('A时间段内限购'); |
|
|
|
$form->number('time_limit_num')->help('A时间段内限购的数量'); |
|
|
|
$form->switch('can_use_coupon'); |
|
|
|
}); |
|
|
|
$form->column(12, function (Form $form) { |
|
|
|
@ -191,11 +191,49 @@ class GoodsActivityController extends AdminController |
|
|
|
}); |
|
|
|
$form->saving(function (Form $form){ |
|
|
|
$storeId = $form->input('store_id'); |
|
|
|
$marketIds = $form->input('market_ids'); |
|
|
|
$tags = $form->input('tags'); |
|
|
|
$spec = $form->input('spec'); |
|
|
|
$detailsImgs = $form->input('details_imgs'); |
|
|
|
$goodsCategoryId = $form->input('goods_category_id'); |
|
|
|
if(!empty($storeId)){ |
|
|
|
// 商品所属市场,根据店铺查询市场
|
|
|
|
$info = StoreModel::getStoreInfo($storeId,'market_id'); |
|
|
|
$form->market_id = $info->market_id; |
|
|
|
} |
|
|
|
|
|
|
|
$marketIdsArr = []; |
|
|
|
if(!empty($marketIds)){ |
|
|
|
foreach($marketIds as $km => $marketId){ |
|
|
|
if(empty($marketId)){ |
|
|
|
unset($marketIds[$km]); |
|
|
|
continue; |
|
|
|
} |
|
|
|
$marketIdsArr[] = $marketId; |
|
|
|
} |
|
|
|
} |
|
|
|
$form->marketIds = json_encode($marketIdsArr); |
|
|
|
|
|
|
|
$tagsArr = []; |
|
|
|
if(!empty($tags)){ |
|
|
|
foreach($tags as $kt => $tag){ |
|
|
|
if(empty($tag)){ |
|
|
|
unset($tags[$kt]); |
|
|
|
continue; |
|
|
|
} |
|
|
|
$tagsArr[] = $tag; |
|
|
|
} |
|
|
|
}; |
|
|
|
$form->tags = json_encode($tagsArr); |
|
|
|
if($storeId && empty($spec)){ |
|
|
|
$form->spec = []; |
|
|
|
} |
|
|
|
if($storeId && empty($detailsImgs)){ |
|
|
|
$form->details_imgs = []; |
|
|
|
} |
|
|
|
if($storeId && empty($goodsCategoryId)){ |
|
|
|
$form->goods_category_id = 0; |
|
|
|
} |
|
|
|
}); |
|
|
|
$form->disableResetButton(); |
|
|
|
$form->disableViewCheck(); |
|
|
|
|