门店佣金比例

main
Jing Li 2024-04-24 09:29:50 +08:00
parent bc27f3fa45
commit 302b6dd702
2 changed files with 34 additions and 26 deletions

View File

@ -30,42 +30,43 @@ class StoreController extends AdminController
->bulkActions([]) ->bulkActions([])
->filter($this->baseFilter()->body([ ->filter($this->baseFilter()->body([
amis()->GroupControl()->mode('horizontal')->body([ amis()->GroupControl()->mode('horizontal')->body([
amisMake()->TextControl()->name('title')->label(__('store.title'))->columnRatio(3)->clearable(), amis()->TextControl()->name('title')->label(__('store.title'))->columnRatio(3)->clearable(),
amisMake()->TreeSelectControl()->name('category_id')->label(__('store.category_id'))->columnRatio(3) amis()->TreeSelectControl()->name('category_id')->label(__('store.category_id'))->columnRatio(3)
->source(admin_url('api/keywords/tree-list?parent_key=store_category')) ->source(admin_url('api/keywords/tree-list?parent_key=store_category'))
->labelField('name') ->labelField('name')
->valueField('key') ->valueField('key')
->onlyLeaf(true) ->onlyLeaf(true)
->clearable(), ->clearable(),
amisMake()->SelectControl()->name('business_id')->label(__('store.business_id'))->columnRatio(3) amis()->SelectControl()->name('business_id')->label(__('store.business_id'))->columnRatio(3)
->source(admin_url('api/keywords/tree-list?parent_key=store_business')) ->source(admin_url('api/keywords/tree-list?parent_key=store_business'))
->labelField('name') ->labelField('name')
->valueField('key') ->valueField('key')
->clearable(), ->clearable(),
]), ]),
amisMake()->GroupControl()->mode('horizontal')->body([ amis()->GroupControl()->mode('horizontal')->body([
amisMake()->SelectControl()->name('level_id')->label(__('store.level_id'))->columnRatio(3) amis()->SelectControl()->name('level_id')->label(__('store.level_id'))->columnRatio(3)
->source(admin_url('api/keywords/tree-list?parent_key=store_level')) ->source(admin_url('api/keywords/tree-list?parent_key=store_level'))
->labelField('name') ->labelField('name')
->valueField('key') ->valueField('key')
->clearable(), ->clearable(),
// amisMake()->InputCityControl()->name('region')->label(__('store.region'))->columnRatio(3) // amis()->InputCityControl()->name('region')->label(__('store.region'))->columnRatio(3)
// ->allowDistrict(false) // ->allowDistrict(false)
// ->extractValue(false) // ->extractValue(false)
// ->clearable(), // ->clearable(),
amisMake()->SelectControl()->name('business_status')->label(__('store.business_status'))->options(BusinessStatus::options())->columnRatio(3)->clearable(), amis()->SelectControl()->name('business_status')->label(__('store.business_status'))->options(BusinessStatus::options())->columnRatio(3)->clearable(),
]), ]),
])) ]))
->columns([ ->columns([
amisMake()->TableColumn()->name('id')->label(__('store.id')), amis()->TableColumn()->name('id')->label(__('store.id')),
amisMake()->TableColumn()->name('title')->label(__('store.title')), amis()->TableColumn()->name('title')->label(__('store.title')),
amisMake()->TableColumn()->name('master.name')->label(__('store.master_id')), amis()->TableColumn()->name('master.name')->label(__('store.master_id')),
amisMake()->TableColumn()->name('category.name')->label(__('store.category_id')), amis()->TableColumn()->name('category.name')->label(__('store.category_id')),
amisMake()->TableColumn()->name('business.name')->label(__('store.business_id')), amis()->TableColumn()->name('business.name')->label(__('store.business_id')),
amisMake()->TableColumn()->name('level.name')->label(__('store.level_id')), amis()->TableColumn()->name('level.name')->label(__('store.level_id')),
amisMake()->TableColumn()->name('region')->label(__('store.region'))->set('type', 'tpl')->set('tpl', '${region.province}-${region.city}'), amis()->TableColumn()->name('profit_ratio')->label(__('store.profit_ratio'))->type('tpl')->set('tpl', '${profit_ratio}%'),
amisMake()->TableColumn()->name('business_status')->label(__('store.business_status'))->type('switch')->trueValue(BusinessStatus::Open)->falseValue(BusinessStatus::Close), amis()->TableColumn()->name('region')->label(__('store.region'))->set('type', 'tpl')->set('tpl', '${region.province}-${region.city}'),
amisMake()->TableColumn()->name('created_at')->label(__('store.created_at')), amis()->TableColumn()->name('business_status')->label(__('store.business_status'))->type('switch')->trueValue(BusinessStatus::Open)->falseValue(BusinessStatus::Close),
amis()->TableColumn()->name('created_at')->label(__('store.created_at')),
$this->rowActions([ $this->rowActions([
$this->rowShowButton()->visible($user->can('admin.store.stores.view')), $this->rowShowButton()->visible($user->can('admin.store.stores.view')),
$this->rowEditTypeButton('drawer', 'lg')->visible($user->can('admin.store.stores.update')), $this->rowEditTypeButton('drawer', 'lg')->visible($user->can('admin.store.stores.update')),
@ -79,40 +80,47 @@ class StoreController extends AdminController
public function form($edit): Form public function form($edit): Form
{ {
return $this->baseForm()->title('')->body([ return $this->baseForm()->title('')->body([
amisMake()->TextControl()->name('title')->label(__('store.title'))->required(), amis()->TextControl()->name('title')->label(__('store.title'))->required(),
amisMake()->SelectControl()->name('master_id')->label(__('store.master_id')) amis()->SelectControl()->name('master_id')->label(__('store.master_id'))
->source($edit ? admin_url('api/employees?_all=1&employee_status='.EmployeeStatus::Online->value) : admin_url('api/employees?_all=1&store_id=0&employee_status='.EmployeeStatus::Online->value)) ->source($edit ? admin_url('api/employees?_all=1&employee_status='.EmployeeStatus::Online->value) : admin_url('api/employees?_all=1&store_id=0&employee_status='.EmployeeStatus::Online->value))
->labelField('name') ->labelField('name')
->valueField('id') ->valueField('id')
->searchable() ->searchable()
->required(), ->required(),
amisMake()->TreeSelectControl()->name('category_id')->label(__('store.category_id')) amis()->TreeSelectControl()->name('category_id')->label(__('store.category_id'))
->source(admin_url('api/keywords/tree-list?parent_key=store_category')) ->source(admin_url('api/keywords/tree-list?parent_key=store_category'))
->labelField('name') ->labelField('name')
->valueField('key') ->valueField('key')
->onlyLeaf(true) ->onlyLeaf(true)
->required(), ->required(),
amisMake()->SelectControl()->name('business_id')->label(__('store.business_id')) amis()->SelectControl()->name('business_id')->label(__('store.business_id'))
->source(admin_url('api/keywords/tree-list?parent_key=store_business')) ->source(admin_url('api/keywords/tree-list?parent_key=store_business'))
->labelField('name') ->labelField('name')
->valueField('key') ->valueField('key')
->required(), ->required(),
amisMake()->SelectControl()->name('level_id')->label(__('store.level_id')) amis()->SelectControl()->name('level_id')->label(__('store.level_id'))
->source(admin_url('api/keywords/tree-list?parent_key=store_level')) ->source(admin_url('api/keywords/tree-list?parent_key=store_level'))
->labelField('name') ->labelField('name')
->valueField('key') ->valueField('key')
->required(), ->required(),
amisMake()->InputCityControl()->name('region')->label(__('store.region'))->allowDistrict(false)->extractValue(false)->required(), amis()->NumberControl()
amisMake()->LocationControl()->name('location')->label(__('store.location'))->ak(config('baidu.js_secret'))->autoSelectCurrentLoc(), ->name('profit_ratio')
->label(__('store.profit_ratio'))
->placeholder(__('store.profit_ratio'))
->precision(2)
->showSteps(false)
->required(),
amis()->InputCityControl()->name('region')->label(__('store.region'))->allowDistrict(false)->extractValue(false)->required(),
amis()->LocationControl()->name('location')->label(__('store.location'))->ak(config('baidu.js_secret'))->autoSelectCurrentLoc(),
]); ]);
} }
public function detail(): Form public function detail(): Form
{ {
$detail = amisMake()->Property()->items([ $detail = amis()->Property()->items([
['label' => __('store.title'), 'content' => '${title}'], ['label' => __('store.title'), 'content' => '${title}'],
['label' => __('store.master_id'), 'content' => '${master.name}'], ['label' => __('store.master_id'), 'content' => '${master.name}'],
['label' => __('store.business_status'), 'content' => amisMake()->Tag()->label('${business_status_text}')->color('${business_status_color}')], ['label' => __('store.business_status'), 'content' => amis()->Tag()->label('${business_status_text}')->color('${business_status_color}')],
['label' => __('store.category_id'), 'content' => '${category.name}'], ['label' => __('store.category_id'), 'content' => '${category.name}'],
['label' => __('store.business_id'), 'content' => '${business.name}'], ['label' => __('store.business_id'), 'content' => '${business.name}'],
['label' => __('store.level_id'), 'content' => '${level.name}'], ['label' => __('store.level_id'), 'content' => '${level.name}'],

View File

@ -98,7 +98,7 @@ class LedgerController extends Controller
throw new RuntimeException('上报数据已更新,不可重新上传'); throw new RuntimeException('上报数据已更新,不可重新上传');
} }
$ratio = bcdiv($user->store->profit_ratio, 100, 2); $ratio = bcdiv($user->store->profit_ratio, 100, 4);
// 计算预期佣金 // 计算预期佣金
$validated['expected_commission'] = bcmul($validated['sales'], $ratio, 2); $validated['expected_commission'] = bcmul($validated['sales'], $ratio, 2);