|
|
|
@ -4,6 +4,7 @@ namespace App\Admin\Controllers; |
|
|
|
|
|
|
|
use App\Admin\Repositories\ImsCjdcMarket; |
|
|
|
use App\Models\LanzuMmInfo; |
|
|
|
use App\Models\v3\Market; |
|
|
|
use Dcat\Admin\Admin; |
|
|
|
use Dcat\Admin\Form; |
|
|
|
use Dcat\Admin\Grid; |
|
|
|
@ -20,7 +21,7 @@ class ImsCjdcMarketController extends AdminController |
|
|
|
*/ |
|
|
|
protected function grid() |
|
|
|
{ |
|
|
|
return Grid::make(new ImsCjdcMarket(), function (Grid $grid) { |
|
|
|
return Grid::make(new Market(), function (Grid $grid) { |
|
|
|
$adu = Admin::user(); |
|
|
|
if ($adu->isRole('lanzu_mp')){ |
|
|
|
$mp = LanzuMpInfo::where('admin_user_id',$adu->id)->first(); |
|
|
|
@ -145,7 +146,7 @@ class ImsCjdcMarketController extends AdminController |
|
|
|
*/ |
|
|
|
protected function form() |
|
|
|
{ |
|
|
|
return Form::make(new ImsCjdcMarket(), function (Form $form) { |
|
|
|
return Form::make(new Market(), function (Form $form) { |
|
|
|
$form->display('id'); |
|
|
|
$form->text('name')->required(); |
|
|
|
$form->select('mp_id', '服务商')->options('/api/getMpInfo')->required(); |
|
|
|
@ -155,31 +156,23 @@ class ImsCjdcMarketController extends AdminController |
|
|
|
->required() |
|
|
|
->placeholder('输入 经纬度,如: 108.281552,22.83731') |
|
|
|
->help("通过网址 <a href='https://lbs.amap.com/console/show/picker' target='_blank'>https://lbs.amap.com/console/show/picker</a> 获取经纬度"); |
|
|
|
$form->text('poundage'); |
|
|
|
$form->text('dn_poundage'); |
|
|
|
$form->text('dm_poundage'); |
|
|
|
$form->text('yd_poundage'); |
|
|
|
$form->text('loudspeaker_imei')->value(0); |
|
|
|
$form->number('sort', '排序'); |
|
|
|
$form->switch('status', '状态'); |
|
|
|
$form->image('logo'); |
|
|
|
$form->image('logo')->required(); |
|
|
|
$form->multipleImage('imgs', '市场图片'); |
|
|
|
$form->textarea('introduce'); |
|
|
|
$form->textarea('remark'); |
|
|
|
$form->textarea('dishes_menu_intro')->value('菜谱简介'); |
|
|
|
$form->textarea('remark')->required(); |
|
|
|
$form->hidden('lng'); |
|
|
|
$form->hidden('lat'); |
|
|
|
|
|
|
|
$form->saving(function (Form $form){ |
|
|
|
if ($form->isCreating()){ |
|
|
|
$coordinates = explode(',',$form->coordinates); |
|
|
|
$form->coordinates = implode(',',[$coordinates[1],$coordinates[0]]); |
|
|
|
}else{ |
|
|
|
if ($form->coordinates&&$form->coordinates!=$form->model()->coordinates){ |
|
|
|
$coordinates = explode(',',$form->coordinates); |
|
|
|
$form->coordinates = implode(',',[$coordinates[1],$coordinates[0]]); |
|
|
|
} |
|
|
|
} |
|
|
|
$coordinates = explode(',',$form->coordinates); |
|
|
|
$form->lng = $coordinates[0]; |
|
|
|
$form->lat = $coordinates[1]; |
|
|
|
$form->deleteInput('coordinates'); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form->deleting(function (Form $form){ |
|
|
|
//删除市场前,校验该市场下是否存在市场经理
|
|
|
|
$mids = array_column($form->model()->toArray(), 'id'); |
|
|
|
|