diff --git a/app/Admin/Forms/GoodsNewCopyForm.php b/app/Admin/Forms/GoodsNewCopyForm.php deleted file mode 100644 index 6fda924..0000000 --- a/app/Admin/Forms/GoodsNewCopyForm.php +++ /dev/null @@ -1,108 +0,0 @@ -get(); - $markets = StoreModel::whereIn('id',$storeIds)->pluck('market_id','id'); - foreach($storeIds as $key =>$value){ - $storeId = $value; - $model = new GoodsModel(); - - $model->store_id = $storeId; - $model->market_id = $markets[$storeId]; - $model->category_id = $goods->category_id; - - $model->name = $goods->name; - $model->cover_img = $goods->cover_img; - $model->goods_unit = $goods->goods_unit; - - $model->tags = $goods->tags; - $model->spec = $goods->spec; - $model->details_imgs = $goods->details_imgs; - $model->content = $goods->content; - $model->details = $goods->details; - - $model->price = $goods->price; - $model->original_price = $goods->original_price; - $model->vip_price = $goods->vip_price; - - $model->start_num = $goods->start_num; - $model->restrict_num = $goods->restrict_num; - $model->is_infinite = $goods->is_infinite; - $model->inventory = $goods->inventory; - - $model->on_sale = $goods->on_sale; - $model->sort = $goods->sort; - $model->remark = $goods->remark; - - if($model->save() && !empty($goodsBanners)){ - $goodsId = $model->getKey(); - $banners = []; - foreach($goodsBanners as $kb => $vb){ - $banners[] = [ - 'goods_id' => $goodsId, - 'type' => $vb->type, - 'path' => $vb->path, - 'sort' => $vb->sort, - 'created_at' => time(), - 'updated_at' => time(), - ]; - GoodsBannerModel::insert($banners); - } - }else{ - return $this->error('修改失败'); - }; - } - - return $this->error('修改成功'); - } - - /** - * Build a form here. - */ - public function form() - { - $id = $this->getKey(); - $goods = GoodsModel::select('name')->find($id); - $this->hidden('goods_id')->value($id); - $name = empty($goods->name)?'':$goods->name; - $this->display('name')->value($name); - $stores = StoreModel::getStoreArray(); - $this->multipleSelect('store_ids','选择店铺')->required()->options($stores)->help('选择店铺,将当前商品复制到所选店铺。注意选择重复店铺问题!!!'); - } - - /** - * The data of the form. - * - * @return array - */ - public function default() - { - return []; - } - -} diff --git a/app/Admin/Forms/GoodsNewImageForm.php b/app/Admin/Forms/GoodsNewImageForm.php deleted file mode 100644 index f418ff0..0000000 --- a/app/Admin/Forms/GoodsNewImageForm.php +++ /dev/null @@ -1,73 +0,0 @@ - 0 && !empty($coverImg)){ - $data = ['cover_img' => $coverImg]; - GoodsModel::where('id',$goodsId)->update($data); - } - if($goodsId > 0 && !empty($bannerImg)){ - $banner = GoodsBannerModel::where('goods_id',$goodsId)->first(); - if(empty($banner)){ - $banner = new GoodsBanners(); - $banner->goods_id = $goodsId; - $banner->type = 1; - $banner->created_at = time(); - } - $banner->path = $bannerImg; - $banner->updated_at = time(); - $banner->save(); - } - - return $this->error('修改成功'); - } - - /** - * Build a form here. - */ - public function form() - { - $id = $this->getKey(); - $goods = GoodsModel::select('name')->find($id); - $goodName = empty($goods->name)?'':$goods->name; - $this->hidden('goods_id')->value($id); - $this->display('name','商品名称')->value($goodName); - $this->image('cover_img','封面图')->url('ops/files'); - $this->image('img_banner','轮播图')->url('ops/files'); - } - - /** - * The data of the form. - * - * @return array - */ - public function default() - { - return []; - } - -} diff --git a/app/Admin/Forms/v3/GoodsActivitySetting.php b/app/Admin/Forms/v3/GoodsActivitySetting.php new file mode 100644 index 0000000..38895a7 --- /dev/null +++ b/app/Admin/Forms/v3/GoodsActivitySetting.php @@ -0,0 +1,52 @@ +error('修改成功'); + } + + /** + * Build a form here. + */ + public function form() + { + $id = $this->getKey(); + + $this->display('activity_type_limit_nums','同一活动类型商品单笔订单可购买商品种数'); + $this->number('flash_sale','秒杀')->value()->default(); + $this->image('group_buy','团购')->value()->default(); + $this->image('new_product','新品')->value()->default(); + } + + /** + * The data of the form. + * + * @return array + */ + public function default() + { + return []; + } + +}