15061959991 1adf627c0d feat: 财务系统二次开发 - 营销账户账单功能
- 基础环境:Docker 部署配置,源码挂载实时同步
- 修复:super_admin 权限补全、登录重定向循环
- 开发:店铺营销账户账单 - 抖音账户(15字段汇总账单)
- 开发:店铺营销账户账单 - 淘系支付宝账户(8字段流水账单)
- 开发:店铺营销账户账单 - 拼多多账户(7字段流水账单)
- 业务页面导航集成:config/business_navigation.php + Business\Pages 控制器
- 各平台独立表结构和视图,互不影响
2026-07-21 18:43:52 +08:00

74 lines
1.9 KiB
PHP

<?php
namespace App\View\Components\Form\Group;
use App\Abstracts\View\Components\Form;
use App\Models\Banking\Account as Model;
class Account extends Form
{
public $type = 'account';
public $path;
public $accounts;
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|string
*/
public function render()
{
if (empty($this->name)) {
$this->name = 'account_id';
}
$this->path = route('modals.accounts.create');
if (empty($this->accounts) && ! empty($this->options)) {
$this->accounts = $this->options;
} else if (empty($this->accounts)) {
$this->accounts = $this->getAccounts();
}
$model = $this->getParentData('model');
$account_id = old('account.id', old('account_id', null));
if (! empty($account_id)) {
$this->selected = $account_id;
if (! $this->accounts->has($account_id)) {
$account = Model::with('currency')->find($account_id);
$this->accounts->push($account);
}
}
if (! empty($model) && ! empty($model->{$this->name})) {
$this->selected = $model->{$this->name};
$selected_account = $model->account;
}
if (! empty($selected_account) && ! $this->accounts->contains('id', $selected_account->id)) {
$this->accounts->push($selected_account);
}
if ($this->selected === null) {
$this->selected = setting('default.account');
}
// Share accounts with all views
view()->share('accounts', $this->accounts);
return view('components.form.group.account');
}
protected function getAccounts()
{
return Model::with('currency')->enabled()->orderBy('name')->get();
}
}