等级图标
parent
ccafcc5801
commit
8dada477a4
|
|
@ -42,7 +42,7 @@ class DealerController extends AdminController
|
||||||
|
|
||||||
$lvlTexts = DealerLvl::texts();
|
$lvlTexts = DealerLvl::texts();
|
||||||
$grid->column('lvl')->display(function () {
|
$grid->column('lvl')->display(function () {
|
||||||
return $this->lvl_text;
|
return $this->lvl->text();
|
||||||
})->filter(Grid\Column\Filter\In::make($lvlTexts));
|
})->filter(Grid\Column\Filter\In::make($lvlTexts));
|
||||||
$grid->column('wallet.balance')->display(function ($value) {
|
$grid->column('wallet.balance')->display(function ($value) {
|
||||||
return $value ?? 0;
|
return $value ?? 0;
|
||||||
|
|
@ -111,7 +111,7 @@ class DealerController extends AdminController
|
||||||
// $show->field('id');
|
// $show->field('id');
|
||||||
$show->field('user.phone');
|
$show->field('user.phone');
|
||||||
$show->field('lvl')->as(function () {
|
$show->field('lvl')->as(function () {
|
||||||
return $this->lvl_text;
|
return $this->lvl->text();
|
||||||
});
|
});
|
||||||
$show->field('is_sale')->as(function ($val) {
|
$show->field('is_sale')->as(function ($val) {
|
||||||
return $val ? '是' : '否';
|
return $val ? '是' : '否';
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ class DealerEarningController extends AdminController
|
||||||
// $grid->column('earningable_id');
|
// $grid->column('earningable_id');
|
||||||
$grid->column('lvl')->display(function () {
|
$grid->column('lvl')->display(function () {
|
||||||
return $this->lvl->text();
|
return $this->lvl->text();
|
||||||
// return $this->lvl_text;
|
|
||||||
});
|
});
|
||||||
$grid->column('is_manager')->bool();
|
$grid->column('is_manager')->bool();
|
||||||
$grid->column('total_amount')->prepend('¥');
|
$grid->column('total_amount')->prepend('¥');
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,6 @@ HTML;
|
||||||
$grid->column('user.phone', '手机号');
|
$grid->column('user.phone', '手机号');
|
||||||
$grid->column('lvl', '等级')->display(function () {
|
$grid->column('lvl', '等级')->display(function () {
|
||||||
return $this->lvl->text();
|
return $this->lvl->text();
|
||||||
// return $this->lvl_text;
|
|
||||||
});
|
});
|
||||||
$grid->column('total_amount', '补贴金额');
|
$grid->column('total_amount', '补贴金额');
|
||||||
$grid->column('remark', '备注');
|
$grid->column('remark', '备注');
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class DealerFansResource extends JsonResource
|
||||||
return $this->dealer->team_sales_value;
|
return $this->dealer->team_sales_value;
|
||||||
}, 0),
|
}, 0),
|
||||||
'lvl_name' => (string) $this->whenLoaded('dealer', function () {
|
'lvl_name' => (string) $this->whenLoaded('dealer', function () {
|
||||||
return $this->dealer->lvl_text;
|
return $this->dealer->lvl->text();
|
||||||
}, '未知'),
|
}, '未知'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ class DealerResource extends JsonResource
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'lvl' => $this->lvl,
|
'lvl' => $this->lvl,
|
||||||
'lvl_name'=> $this->lvl_text,
|
'lvl_icon' => $this->lvl->icon(),
|
||||||
|
'lvl_name'=> $this->lvl->text(),
|
||||||
'is_sale' => $this->is_sale,
|
'is_sale' => $this->is_sale,
|
||||||
'guanli_values'=> bcdiv($this->calculate_total_amount, '1', 2), //预计管理津贴
|
'guanli_values'=> bcdiv($this->calculate_total_amount, '1', 2), //预计管理津贴
|
||||||
'team_sales_value' => $this->team_sales_value, // 团队业绩
|
'team_sales_value' => $this->team_sales_value, // 团队业绩
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ class UserInfoResource extends JsonResource
|
||||||
'points' => (int) $this->points,
|
'points' => (int) $this->points,
|
||||||
'quota_v2' => $this->quota_v2,
|
'quota_v2' => $this->quota_v2,
|
||||||
'quota_v1' => $this->quota_v1,
|
'quota_v1' => $this->quota_v1,
|
||||||
|
'agent_level_icon' => $this->agent_level_icon,
|
||||||
'agent_level_name' => $this->agent_level_name,
|
'agent_level_name' => $this->agent_level_name,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,18 @@ enum DealerLvl: int {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function icon()
|
||||||
|
{
|
||||||
|
return match ($this) {
|
||||||
|
static::Secondary => 'https://cdn.zichunsheng.cn/statics/icons/dealer_lvl_5.png',
|
||||||
|
static::Top => 'https://cdn.zichunsheng.cn/statics/icons/dealer_lvl_6.png',
|
||||||
|
default => '',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
@ -35,8 +47,8 @@ enum DealerLvl: int {
|
||||||
static::Gold => '金牌经销商',
|
static::Gold => '金牌经销商',
|
||||||
static::Special => '特邀经销商',
|
static::Special => '特邀经销商',
|
||||||
static::Contracted => '签约经销商',
|
static::Contracted => '签约经销商',
|
||||||
static::Secondary => '二级经销商',
|
static::Secondary => '签约经销商II',
|
||||||
static::Top => '一级经销商',
|
static::Top => '签约经销商I',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,8 +62,8 @@ enum DealerLvl: int {
|
||||||
static::Gold->value => '金牌经销商',
|
static::Gold->value => '金牌经销商',
|
||||||
static::Special->value => '特邀经销商',
|
static::Special->value => '特邀经销商',
|
||||||
static::Contracted->value => '签约经销商',
|
static::Contracted->value => '签约经销商',
|
||||||
static::Secondary->value => '二级经销商',
|
static::Secondary->value => '签约经销商II',
|
||||||
static::Top->value => '一级经销商',
|
static::Top->value => '签约经销商I',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,19 @@ class UserInfo extends Model
|
||||||
self::AGENT_LEVEL_DIRECTOR => '默认用户',
|
self::AGENT_LEVEL_DIRECTOR => '默认用户',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理等级图标
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public static $agentLevelIcons = [
|
||||||
|
self::AGENT_LEVEL_COMMUNITY => 'https://cdn.zichunsheng.cn/statics/icons/lvl_2.png',
|
||||||
|
self::AGENT_LEVEL_DISTRICT => 'https://cdn.zichunsheng.cn/statics/icons/lvl_3.png',
|
||||||
|
self::AGENT_LEVEL_CITY => 'https://cdn.zichunsheng.cn/statics/icons/lvl_4.png',
|
||||||
|
self::AGENT_LEVEL_PROVINCE => 'https://cdn.zichunsheng.cn/statics/icons/lvl_5.png',
|
||||||
|
self::AGENT_LEVEL_BRANCH => 'https://cdn.zichunsheng.cn/statics/icons/lvl_6.png',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
@ -458,6 +471,11 @@ class UserInfo extends Model
|
||||||
return static::$agentLevelTexts[$this->agent_level] ?? '未知';
|
return static::$agentLevelTexts[$this->agent_level] ?? '未知';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAgentLevelIconAttribute(): string
|
||||||
|
{
|
||||||
|
return static::$agentLevelIcons[$this->agent_level] ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取完整的邀请路径
|
* 获取完整的邀请路径
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue