Browse Source

修复活动商品复制bug

master
weigang 5 years ago
parent
commit
c899f7ed47
  1. 11
      app/Admin/Forms/v3/GoodsActivityCopyForm.php

11
app/Admin/Forms/v3/GoodsActivityCopyForm.php

@ -44,7 +44,7 @@ class GoodsActivityCopyForm extends Form implements LazyRenderable
$goodsBanners = GoodsBannerModel::where('goods_id',$goodsId)->get(); $goodsBanners = GoodsBannerModel::where('goods_id',$goodsId)->get();
$markets = StoreModel::whereIn('id',$storeIds)->pluck('market_id','id'); $markets = StoreModel::whereIn('id',$storeIds)->pluck('market_id','id');
foreach($storeIds as $key =>$storeId){ foreach($storeIds as $key =>$storeId){
$marketId = $markets[$storeId]??0; $marketId = $markets[$storeId]??0;
$model = new GoodsModel(); $model = new GoodsModel();
@ -55,9 +55,10 @@ class GoodsActivityCopyForm extends Form implements LazyRenderable
$model->type = $type; $model->type = $type;
$model->inventory = $inventory; $model->inventory = $inventory;
$model->goods_id = 0;
$model->store_id = $storeId; $model->store_id = $storeId;
$model->market_id = $marketId; $model->market_id = $marketId;
$model->market_ids = json_encode(["$marketId"]);
$model->market_ids = ["$marketId"];
$model->category_id = $goods->category_id; $model->category_id = $goods->category_id;
$model->name = $goods->name; $model->name = $goods->name;
@ -109,7 +110,7 @@ class GoodsActivityCopyForm extends Form implements LazyRenderable
{ {
$id = $this->payload['id'] ?? 0; $id = $this->payload['id'] ?? 0;
$name = $this->payload['name'] ?? ''; $name = $this->payload['name'] ?? '';
$this->hidden('id')->value($id); $this->hidden('id')->value($id);
$this->display('name')->value($name)->help('复制的活动商品默认下架状态,请核对信息后手动上架!'); $this->display('name')->value($name)->help('复制的活动商品默认下架状态,请核对信息后手动上架!');
$stores = StoreModel::getStoreArray(); $stores = StoreModel::getStoreArray();
@ -118,8 +119,8 @@ class GoodsActivityCopyForm extends Form implements LazyRenderable
$this->datetime('expire_time','活动结束时间')->required()->format('YYYY-MM-DD HH:mm:ss')->rules('after:now',['after'=>'活动结束时间必须大于当前时间!']); $this->datetime('expire_time','活动结束时间')->required()->format('YYYY-MM-DD HH:mm:ss')->rules('after:now',['after'=>'活动结束时间必须大于当前时间!']);
$this->number('time_limit_days','限制的天数')->default(1)->help('A时间段内限购'); $this->number('time_limit_days','限制的天数')->default(1)->help('A时间段内限购');
$this->number('time_limit_num','限制购买数量')->default(1)->help('A时间段内限购的数量'); $this->number('time_limit_num','限制购买数量')->default(1)->help('A时间段内限购的数量');
$this->switch('can_use_coupon','可同时使用优惠券')->default(0);
$this->select('type','活动类型')->options(GoodsModel::$_TYPE)->default('flash_sale');
$this->switch('can_use_coupon','可同时使用优惠券')->default(0);
$this->select('type','活动类型')->options(GoodsModel::$_TYPE)->default('flash_sale');
} }
/** /**

Loading…
Cancel
Save