6
0
Fork 0

调整商城等级文字

release
vine_liutk 2022-02-25 16:33:06 +08:00
parent d706b14456
commit b8fdcde922
6 changed files with 184 additions and 176 deletions

View File

@ -52,7 +52,7 @@ class AfterSaleController extends AdminController
$grid->column('tags', '标签')->display(function ($tags) {
$array = [];
foreach ($this->tags as $key => $tag) {
$array[] = $tag->name;
$array[] = $tag->name;
}
return $array;
})->label();
@ -136,56 +136,66 @@ class AfterSaleController extends AdminController
protected function detail($id)
{
return function (Row $row) use ($id) {
$row->column(4, function ($column) use ($id) {
$row->column(5, function ($column) use ($id) {
$builder = AfterSale::with(['user', 'user.userInfo', 'order', 'orderProduct', 'tags']);
$column->row(Show::make($id, $builder, function (Show $show) {
$show->field('id');
$show->field('sn');
$show->field('order.sn', '售后订单')->unescape()->as(function ($value) {
if (Admin::user()->can('dcat.admin.orders.show')) {
return '<a href="'.admin_route('orders.show', ['order'=>$this->order]).'" target="_blank">'.$value.'</a>';
}
return $value;
});
$show->field('order_product.name', '售后商品')->as(function ($value) {
return $value.'*'. $this->num;
});
// $show->field('num');
if (in_array($show->model()->type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_REFUND])) {
$show->field('amount', '售后金额')->as(function ($amount) {
return '¥'.bcdiv($amount, 100, 2);
// $show->field('id');
$type = $show->model()->type;
$show->row(function (Show\Row $show) use ($type) {
$show->width(6)->field('sn');
$show->field('order.sn', '关联订单编号')->unescape()->as(function ($value) {
if (Admin::user()->can('dcat.admin.orders.show')) {
return '<a href="'.admin_route('orders.show', ['order'=>$this->order]).'" target="_blank">'.$value.'</a>';
}
return $value;
});
}
$show->field('type')->using([
AfterSaleModel::TYPE_REFUND_AND_RETURN => '退款退货',
AfterSaleModel::TYPE_REFUND => '退款',
AfterSaleModel::TYPE_CHANGE => '换货',
AfterSaleModel::TYPE_FILL => '漏发',
])->label();
$show->field('state')->using(AfterSaleModel::$stateText)->dot([
AfterSaleModel::STATE_APPLY=>'warning',
AfterSaleModel::STATE_VERIFY=>'danger',
AfterSaleModel::STATE_AGREE=>'warning',
AfterSaleModel::STATE_SHIPPING=>'primary',
AfterSaleModel::STATE_FINANCE=>'primary',
AfterSaleModel::STATE_FINISH=>'success',
AfterSaleModel::STATE_CANCEL=>'#b3b9bf',
]);
$show->field('user.user_info.nickname', '下单用户');
$show->field('user.phone');
if (in_array($show->model()->type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_CHANGE])) {
$show->field('tracking_number');
}
$show->field('order_product.name', '售后商品')->as(function ($value) {
return $value.'*'. $this->num;
});
// $show->field('num');
if (in_array($type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_REFUND])) {
$show->field('amount', '售后金额')->as(function ($amount) {
return '¥'.bcdiv($amount, 100, 2);
});
}
$show->width(6)->field('user.user_info.nickname', '下单用户');
$show->field('user.phone');
$show->field('type')->using([
AfterSaleModel::TYPE_REFUND_AND_RETURN => '退款退货',
AfterSaleModel::TYPE_REFUND => '退款',
AfterSaleModel::TYPE_CHANGE => '换货',
AfterSaleModel::TYPE_FILL => '漏发',
])->label();
if (in_array($type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_REFUND, AfterSaleModel::TYPE_CHANGE])) {
$show->field('sales_value', '销售值');
}
});
$status = $stae = $show->model()->state;
$show->row(function (Show\Row $show) use ($type, $status) {
$show->width(6)->field('state')->using(AfterSaleModel::$stateText)->dot([
AfterSaleModel::STATE_APPLY=>'warning',
AfterSaleModel::STATE_VERIFY=>'danger',
AfterSaleModel::STATE_AGREE=>'warning',
AfterSaleModel::STATE_SHIPPING=>'primary',
AfterSaleModel::STATE_FINANCE=>'primary',
AfterSaleModel::STATE_FINISH=>'success',
AfterSaleModel::STATE_CANCEL=>'#b3b9bf',
]);
if (in_array($type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_CHANGE]) && in_array($status, [
AfterSaleModel::STATE_SHIPPING, AfterSaleModel::STATE_FINANCE, AfterSaleModel::STATE_FINISH,
])) {
$show->field('tracking_number');
}
});
$show->row(function (Show\Row $show) use ($type, $status) {
$show->width(12)->field('tags')->width(10, 1)->as(function () {
return $this->tags->pluck('name');
})->label();
$show->width(6)->field('created_at');
$show->field('updated_at');
});
$show->field('tags')->as(function () {
return $this->tags->pluck('name');
})->label();
if (in_array($show->model()->type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_REFUND, AfterSaleModel::TYPE_CHANGE])) {
$show->field('sales_value', '销售值');
}
// $show->field('order_product.cover')->image();
$show->field('created_at');
$show->field('updated_at');
$show->panel()
->tools(function (Show\Tools $tools) use ($show) {
$tools->disableEdit();
@ -214,7 +224,7 @@ class AfterSaleController extends AdminController
});
}));
});
$row->column(8, function ($column) use ($id) {
$row->column(7, function ($column) use ($id) {
$afterSale = AfterSaleModel::findOrFail($id);
$builder = AfterSaleModel::with('orderProduct')->where('order_product_id', $afterSale?->order_product_id)->where('id', '<>', $id);
$column->row(Box::make('相关售后', Grid::make($builder, function (Grid $grid) {

View File

@ -154,92 +154,85 @@ class OrderController extends AdminController
$builder = OrderModel::with(['user', 'userCoupon', 'tags'])->withCount('afterSales');
$column->row(Show::make($id, $builder, function (Show $show) {
// $show->field('id');
$show->field('sn');
$show->field('order_status')->as(function ($v) {
return $this->order_status;
})->using([
0=>'待付款',
1=>'待发货',
2=>'发货中',
3=>'已发货',
9=>'已完成',
10=>'已取消',
])->dot([
0=>'primary',
1=>'warning',
2=>'danger',
3=>'success',
9=>'success',
10=>'#b3b9bf',
]);
$show->field('total_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('¥');
$show->field('created_at');
$show->html(function () {
$content = '';
$show->row(function (Show\Row $show) {
$show->width(6)->field('sn');
$show->field('order_status')->as(function ($v) {
return $this->order_status;
})->using([
0=>'待付款',
1=>'待发货',
2=>'发货中',
3=>'已发货',
9=>'已完成',
10=>'已取消',
])->dot([
0=>'primary',
1=>'warning',
2=>'danger',
3=>'success',
9=>'success',
10=>'#b3b9bf',
]);
if ($this->pay_way) {
$content = '<i class="fa fa-circle" style="font-size: 13px;color: '.$this->pay_way->color().'"></i>&nbsp;&nbsp;'.$this->pay_way->getMallOrderText();
}
$show->field('created_at');
$show->width(6)->field('tags')->as(function () {
return $this->tags->pluck('name');
})->label();
$show->field('pay_at');
$show->field('pay_way')->unescape()->as(function () {
$content = '';
return <<<HTML
<div class="show-field form-group row">
<div class="col-sm-2 control-label">
<span>支付方式</span>
</div>
if ($this->pay_way) {
$content = '<i class="fa fa-circle" style="font-size: 13px;color: '.$this->pay_way->color().'"></i>&nbsp;&nbsp;'.$this->pay_way->getMallOrderText();
}
<div class="col-sm-8">
<div class="box box-solid box-default no-margin box-show">
<div class="box-body">{$content}&nbsp;</div>
</div>
</div>
</div>
HTML;
return $content;
});
});
$show->field('pay_at');
$show->field('tags')->as(function () {
return $this->tags->pluck('name');
})->label();
$show->divider();
$show->field('consignee_name');
$show->field('consignee_telephone');
$show->field('consignee')->as(function () {
return $this->consignee_zone . ' '. $this->consignee_address;
$show->row(function (Show\Row $show) {
$show->width(6)->field('consignee_name');
$show->field('consignee_telephone');
$show->width(12)->field('consignee')->width(10, 1)->as(function () {
return $this->consignee_zone . ' '. $this->consignee_address;
});
});
// $show->field('user.phone');
$show->divider();
$show->field('products_total_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('¥');
$show->field('vip_discount_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('- ¥');
if ($show->model()->user_coupon_id) {
$show->field('user_coupon.coupon_name', '优惠券')->label();
$show->field('coupon_discount_amount')->as(function ($v) {
$userCouponId = $show->model()->user_coupon_id;
$show->row(function (Show\Row $show) use ($userCouponId) {
$show->width(6)->field('products_total_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('¥');
$show->field('vip_discount_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('- ¥');
}
$show->field('shipping_fee')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('+ ¥');
$show->field('reduced_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('- ¥');
$show->divider();
$show->field('sales_value', '总销售值');
$show->field('is_settle', '是否结算')->using([
0=>'未结算',
1=>'已结算',
])->dot([
0=>'danger',
1=>'success',
]);
$show->field('completed_at', '完成时间');
$show->divider();
$show->field('note');
$show->field('remark');
if ($userCouponId) {
$show->field('user_coupon.coupon_name', '优惠券')->label();
$show->field('coupon_discount_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('- ¥');
}
$show->field('shipping_fee')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('+ ¥');
$show->field('reduced_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('- ¥');
$show->field('total_amount')->as(function ($v) {
return bcdiv($v, 100, 2);
})->prepend('¥');
});
$show->row(function (Show\Row $show) use ($userCouponId) {
$show->width(6)->field('sales_value', '总销售值');
$show->field('is_settle', '是否结算')->using([
0=>'未结算',
1=>'已结算',
])->dot([
0=>'danger',
1=>'success',
]);
$show->field('completed_at', '完成时间');
$show->width(12)->field('note')->width(10, 1);
$show->width(12)->field('remark')->width(10, 1);
});
$show->panel()
->tools(function (Show\Tools $tools) use ($show) {

View File

@ -60,7 +60,7 @@ class UserController extends AdminController
$grid->column('userInfo.code')->copyable();
$grid->column('userInfo.agent_level')->display(function ($value) {
return $this->userInfo?->agent_level_name??'未知';
return $this->userInfo?->agent_level_name ?? '未知';
})->label();
$grid->column('userInfo.inviterInfo.user.phone')->copyable();
@ -71,18 +71,18 @@ class UserController extends AdminController
Grid\Column\Filter\Between::make()
);
$grid->column('wallet.balance')->display(function ($value) {
$value = bcdiv($value, 100, 2);
$value = bcdiv($value, 100, 2);
if ($this->wallet?->is_frozen) {
$value.= " &nbsp;<span class='label' style='background:#b3b9bf'>冻结</span>";
$value .= " &nbsp;<span class='label' style='background:#b3b9bf'>冻结</span>";
}
return $value;
})->prepend('¥')->filter(
PriceBetween::make()
);
$grid->column('balance.balance')->display(function ($value) {
$value = bcdiv($value, 100, 2);
$value = bcdiv($value, 100, 2);
if ($this->balance?->is_frozen) {
$value.= " &nbsp;<span class='label' style='background:#b3b9bf'>冻结</span>";
$value .= " &nbsp;<span class='label' style='background:#b3b9bf'>冻结</span>";
}
return $value;
})->prepend('¥')->filter(
@ -170,34 +170,39 @@ class UserController extends AdminController
$row->column(5, function ($column) use ($id) {
$builder = User::with(['userInfo', 'wallet', 'balance', 'userInfo.inviterInfo.user']);
$column->row(Show::make($id, $builder, function (Show $show) {
$show->field('id');
$show->field('phone');
$show->field('user_info.nickname');
$show->field('user_info.gender')->using(UserInfo::$genderTexts)->label();
$show->field('user_info.birthday');
$show->field('user_info.agent_level')->as(function ($value) {
return $this->userInfo?->agent_level_name??'未知';
})->label();
$show->field('user_info.inviter_info.user.phone');
$show->field('user_info.growth_value');
$show->field('user_info.group_sales_value');
$show->row(function (Show\Row $show) {
$show->width(12)->field('id')->width(10, 1);
$show->width(6)->field('phone');
$show->field('user_info.inviter_info.user.phone');
$show->field('user_info.nickname');
$show->field('user_info.gender')->using(UserInfo::$genderTexts)->label();
$show->field('user_info.birthday');
$show->field('user_info.agent_level')->as(function ($value) {
return $this->userInfo?->agent_level_name ?? '未知';
})->label();
$show->field('wallet.balance')->as(function ($value) {
$value = bcdiv($value, 100, 2);
return $value;
})->prepend('¥');
$show->field('balance.balance')->as(function ($value) {
$value = bcdiv($value, 100, 2);
return $value;
})->prepend('¥');
$show->field('user_info.quota_v2');
$show->field('user_info.quota_v1');
$show->field('user_info.points');
$show->field('user_info.growth_value');
$show->field('user_info.group_sales_value');
$show->field('wallet.balance')->as(function ($value) {
$value = bcdiv($value, 100, 2);
return $value;
})->prepend('¥');
$show->field('balance.balance')->as(function ($value) {
$value = bcdiv($value, 100, 2);
return $value;
})->prepend('¥');
$show->field('user_info.quota_v2');
$show->field('user_info.quota_v1');
$show->field('user_info.points');
});
$show->row(function (Show\Row $show) {
$show->width(6)->field('last_login_ip');
$show->field('last_login_at');
$show->field('register_ip');
$show->field('created_at');
});
$show->field('last_login_ip');
$show->field('last_login_at');
$show->field('register_ip');
$show->field('created_at');
$show->panel()
->tools(function ($tools) use ($show) {
$tools->disableEdit();

View File

@ -140,7 +140,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-warning"></i>
<span class="text-bold-600 ml-50">店铺</span>
<span class="text-bold-600 ml-50">会员</span>
</div>
<div class="product-result">
<span>{$vip}</span>
@ -149,7 +149,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-danger"></i>
<span class="text-bold-600 ml-50">社区</span>
<span class="text-bold-600 ml-50">铁牌会员</span>
</div>
<div class="product-result">
<span>{$community}</span>
@ -158,7 +158,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1" >
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-info"></i>
<span class="text-bold-600 ml-50">区级</span>
<span class="text-bold-600 ml-50">铜牌会员</span>
</div>
<div class="product-result">
<span>{$district}</span>
@ -168,7 +168,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-primary"></i>
<span class="text-bold-600 ml-50">市级</span>
<span class="text-bold-600 ml-50">银牌会员</span>
</div>
<div class="product-result">
<span>{$city}</span>
@ -178,7 +178,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-warning"></i>
<span class="text-bold-600 ml-50">省级</span>
<span class="text-bold-600 ml-50">金牌会员</span>
</div>
<div class="product-result">
<span>{$province}</span>
@ -187,7 +187,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-danger"></i>
<span class="text-bold-600 ml-50">分公司</span>
<span class="text-bold-600 ml-50">钻石会员</span>
</div>
<div class="product-result">
<span>{$branch}</span>
@ -196,7 +196,7 @@ class Users extends Donut
<div class="chart-info d-flex justify-content-between mb-1">
<div class="series-info d-flex align-items-center">
<i class="fa fa-circle-o text-bold-700 text-info"></i>
<span class="text-bold-600 ml-50">董事</span>
<span class="text-bold-600 ml-50">默认用户</span>
</div>
<div class="product-result">
<span>{$director}</span>

View File

@ -34,7 +34,7 @@ class AgentController extends Controller
],
// 代理
'agents_count' => [
'label' => '店铺',
'label' => '会员',
'current_agents_count' => $userInfo->getVipAgentsCount(),
'upgrade_agents_count' => $rules['community']['vips_agents_count'],
],
@ -50,7 +50,7 @@ class AgentController extends Controller
'upgrade_team_sales_value' => (string) $rules['district']['team_sales_value'],
],
'agents_count' => [
'label' => '店铺',
'label' => '会员',
'current_agents_count' => $userInfo->getVipAgentsCount(),
'upgrade_agents_count' => $rules['district']['vips_agents_count'],
],
@ -66,7 +66,7 @@ class AgentController extends Controller
'upgrade_team_sales_value' => (string) $rules['city']['team_sales_value'],
],
'agents_count' => [
'label' => '区代',
'label' => '铜牌会员',
'current_agents_count' => $userInfo->getDistrictAgentsCountOnDifferentLines(),
'upgrade_agents_count' => $rules['city']['district_agents_count'],
],
@ -82,7 +82,7 @@ class AgentController extends Controller
'upgrade_team_sales_value' => (string) $rules['province']['team_sales_value'],
],
'agents_count' => [
'label' => '市代',
'label' => '银牌会员',
'current_agents_count' => $userInfo->getCityAgentsCountOnDifferentLines(),
'upgrade_agents_count' => $rules['province']['city_agents_count'],
],
@ -98,7 +98,7 @@ class AgentController extends Controller
'upgrade_team_sales_value' => (string) $rules['branch']['team_sales_value'],
],
'agents_count' => [
'label' => '省代',
'label' => '金牌会员',
'current_agents_count' => $userInfo->getProvinceAgentsCountOnDifferentLines(),
'upgrade_agents_count' => $rules['branch']['province_agents_count'],
],

View File

@ -116,13 +116,13 @@ class UserInfo extends Model
*/
public static $agentLevelTexts = [
self::AGENT_LEVEL_CIVILIAN => '粉丝',
self::AGENT_LEVEL_VIP => '店铺',
self::AGENT_LEVEL_COMMUNITY => '社区',
self::AGENT_LEVEL_DISTRICT => '区级',
self::AGENT_LEVEL_CITY => '市级',
self::AGENT_LEVEL_PROVINCE => '省级',
self::AGENT_LEVEL_BRANCH => '分公司',
self::AGENT_LEVEL_DIRECTOR => '董事',
self::AGENT_LEVEL_VIP => '会员',
self::AGENT_LEVEL_COMMUNITY => '铁牌会员',
self::AGENT_LEVEL_DISTRICT => '铜牌会员',
self::AGENT_LEVEL_CITY => '银牌会员',
self::AGENT_LEVEL_PROVINCE => '金牌会员',
self::AGENT_LEVEL_BRANCH => '钻石会员',
self::AGENT_LEVEL_DIRECTOR => '默认用户',
];
/**