diff --git a/app/Admin/Controllers/v3/GoodsController.php b/app/Admin/Controllers/v3/GoodsController.php index 0cdf73a..7945f81 100644 --- a/app/Admin/Controllers/v3/GoodsController.php +++ b/app/Admin/Controllers/v3/GoodsController.php @@ -92,8 +92,28 @@ class GoodsController extends AdminController $show->width(6)->tags->as(function ($value){ return $value; }); - // $show->width(6)->spec; - // $show->details_imgs; + $show->width(6)->spec->as(function ($value){ + $text = ''; + foreach ($value as $v){ + $text .= '【'.$v['spec_key'] .':'.$v['spec_value'].'】 '; + } + return $text; + }); + $goodsModel = new GoodsModel(); + $show->html(function () use($goodsModel){ + if(empty($this->details_imgs)){ + return ''; + }else{ + // 还需要优化 + $value = $this->details_imgs; + $text = ''; + foreach ($value as $v){ + $img = $goodsModel->imageUrl($v); + $text .= ""; + } + return $text; + } + }); // $show->created_at; // $show->updated_at; diff --git a/app/Admin/Controllers/v3/StoreController.php b/app/Admin/Controllers/v3/StoreController.php index 00b4d84..507bc84 100644 --- a/app/Admin/Controllers/v3/StoreController.php +++ b/app/Admin/Controllers/v3/StoreController.php @@ -67,44 +67,55 @@ class StoreController extends AdminController return Show::make($id, new Store(), function (Show $show) { $show->row(function (Show\Row $show) { - + $show->width(6)->id; + $show->width(6)->mm_user_id->as(function ($mmUserId){ + $item = MminfoModel::getMmInfo($mmUserId,'name'); + return empty($item) ? '' : $item->name; + }); + $show->width(6)->market_id->as(function ($marketId){ + $item = MarketModel::getMarketInfo($marketId,'name'); + return empty($item) ? '' : $item->name; + }); + $show->width(6)->category_id->as(function ($categoryId){ + $item = CategoryModel::getCategoryInfo($categoryId,'title'); + return empty($item) ? '' : $item->title; + }); + $show->width(6)->name; + $show->width(6)->logo->image(); + $show->width(6)->user_id->as(function ($userId){ + $item = UserModel::getUserInfo($userId,'nick_name'); + return empty($item) ? '' : $item->nick_name; + }); + $show->width(6)->admin_id->as(function ($userId){ + $item = UserModel::getUserInfo($userId,'nick_name'); + return empty($item) ? '' : $item->nick_name; + }); + $show->width(6)->business_license->image(); + $show->width(6)->zm_img->image(); + $show->width(6)->fm_img->image(); + $show->width(6)->tel; + $show->width(6)->link_name; + $show->width(6)->link_tel; + $show->width(6)->time; + $show->width(6)->time2; + $show->width(6)->time3; + $show->width(6)->time4; }); $show->row(function (Show\Row $show) { - + $show->width(6)->announcement; + $show->width(6)->address; + $show->width(6)->coordinates; + + $show->width(6)->is_rest_text; + $show->width(6)->is_open_text; + $show->width(6)->sort; + // $show->width(6)->environment; + $show->width(6)->expire_time; + $show->width(6)->loudspeaker_imei; }); - $show->id; - $show->mm_user_id; - $show->market_id; - $show->name; - $show->address; - - $show->tel; - $show->announcement; - $show->is_rest; - $show->logo; - $show->details; - $show->coordinates; - $show->business_license; - $show->store_type_id; - $show->is_open; - $show->sort; - $show->user_id; - $show->environment; - $show->expire_time; - $show->zm_img; - $show->fm_img; - $show->link_name; - $show->link_tel; - $show->admin_id; - $show->loudspeaker_imei; - - $show->time; - $show->time2; - $show->time3; - $show->time4; - - $show->created_at; - $show->updated_at; + + // $show->created_at; + // $show->updated_at; }); } @@ -152,12 +163,12 @@ class StoreController extends AdminController })->default(1); $form->text('address'); }); - $form->column(6, function (Form $form) { + $form->column(6, function (Form $form) use($userList){ $form->image('business_license')->required(); $form->image('zm_img')->required(); $form->image('fm_img')->required(); - $form->text('admin_id')->required();/*需要优化 一个用户只能绑定一家店铺*/ - $form->text('user_id')->required();/*需要优化 一个用户只能绑定一家店铺*/ + $form->select('admin_id')->options($userList)->required();/*需要优化 一个用户只能绑定一家店铺*/ + $form->select('user_id')->options($userList)->required();/*需要优化 一个用户只能绑定一家店铺*/ $form->timeRange('time1','time2','营业时间段一')->required(); $form->timeRange('time3','time4','营业时间段二'); }); diff --git a/app/Models/v3/Store.php b/app/Models/v3/Store.php index abac462..ea2e9f2 100644 --- a/app/Models/v3/Store.php +++ b/app/Models/v3/Store.php @@ -16,14 +16,30 @@ class Store extends Model protected $appends = [ 'logo_url', + 'is_rest_text', + 'is_open_text' ]; + public static $_isRest= ['否','是']; + public static $_isOpen = ['关闭','开启']; + public function getLogoUrlAttribute($value) { $value = $value ? $value : $this->logo; return $this->imageUrl($value); } - + + public function getIsRestTextAttribute($value) + { + $value = $value ? $value : $this->is_rest; + return isset(self::$_onRest[$value]) ? self::$_onRest[$value] : ''; + } + public function getIsOpenTextAttribute($value) + { + $value = $value ? $value : $this->is_iopen; + return isset(self::$_isOpen[$value]) ? self::$_isOpen[$value] : ''; + } + /** * 获取商家环境图片 * @param $value $this->environment diff --git a/resources/lang/zh-CN/store.php b/resources/lang/zh-CN/store.php index 06158de..1b47620 100644 --- a/resources/lang/zh-CN/store.php +++ b/resources/lang/zh-CN/store.php @@ -16,6 +16,7 @@ return [ 'tel' => '电话(座机)', 'announcement' => '公告', 'is_rest' => '是否休息', + 'is_rest_text' => '是否休息', 'logo' => 'logo', 'logo_url' => 'logo', 'introduction' => '商家简介', @@ -24,6 +25,7 @@ return [ 'category_id' => '店铺所属分类', 'category_name' => '店铺分类', 'is_open' => '开启门店', + 'is_open_text' => '开启门店', 'sort' => '排序', 'user_id' => '提现用户', 'environment' => '商家环境',