From b8fdcde922b503fb1d555f07481fc6e401fbbc49 Mon Sep 17 00:00:00 2001
From: vine_liutk <961510893@qq.com>
Date: Fri, 25 Feb 2022 16:33:06 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=95=86=E5=9F=8E=E7=AD=89?=
=?UTF-8?q?=E7=BA=A7=E6=96=87=E5=AD=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/Admin/Controllers/AfterSaleController.php | 104 ++++++------
app/Admin/Controllers/OrderController.php | 151 +++++++++---------
app/Admin/Controllers/UserController.php | 67 ++++----
app/Admin/Metrics/Users.php | 14 +-
.../Controllers/Merchant/AgentController.php | 10 +-
app/Models/UserInfo.php | 14 +-
6 files changed, 184 insertions(+), 176 deletions(-)
diff --git a/app/Admin/Controllers/AfterSaleController.php b/app/Admin/Controllers/AfterSaleController.php
index 3ca7ef3b..c4c66e9c 100644
--- a/app/Admin/Controllers/AfterSaleController.php
+++ b/app/Admin/Controllers/AfterSaleController.php
@@ -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 ''.$value.'';
- }
- 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 ''.$value.'';
+ }
+ 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) {
diff --git a/app/Admin/Controllers/OrderController.php b/app/Admin/Controllers/OrderController.php
index 4b11cc3c..4c89c4ed 100644
--- a/app/Admin/Controllers/OrderController.php
+++ b/app/Admin/Controllers/OrderController.php
@@ -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 = ' '.$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 <<
-
- 支付方式
-
+ if ($this->pay_way) {
+ $content = ' '.$this->pay_way->getMallOrderText();
+ }
-
-
-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) {
diff --git a/app/Admin/Controllers/UserController.php b/app/Admin/Controllers/UserController.php
index 9ceb7907..f1e22353 100644
--- a/app/Admin/Controllers/UserController.php
+++ b/app/Admin/Controllers/UserController.php
@@ -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.= " 冻结";
+ $value .= " 冻结";
}
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.= " 冻结";
+ $value .= " 冻结";
}
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();
diff --git a/app/Admin/Metrics/Users.php b/app/Admin/Metrics/Users.php
index f832d023..bc2f38d0 100644
--- a/app/Admin/Metrics/Users.php
+++ b/app/Admin/Metrics/Users.php
@@ -140,7 +140,7 @@ class Users extends Donut
- 店铺
+ 会员
{$vip}
@@ -149,7 +149,7 @@ class Users extends Donut
- 社区
+ 铁牌会员
{$community}
@@ -158,7 +158,7 @@ class Users extends Donut
- 区级
+ 铜牌会员
{$district}
@@ -168,7 +168,7 @@ class Users extends Donut
- 市级
+ 银牌会员
{$city}
@@ -178,7 +178,7 @@ class Users extends Donut
- 省级
+ 金牌会员
{$province}
@@ -187,7 +187,7 @@ class Users extends Donut
- 分公司
+ 钻石会员
{$branch}
@@ -196,7 +196,7 @@ class Users extends Donut
- 董事
+ 默认用户
{$director}
diff --git a/app/Endpoint/Api/Http/Controllers/Merchant/AgentController.php b/app/Endpoint/Api/Http/Controllers/Merchant/AgentController.php
index 767b7eac..2133aaaf 100644
--- a/app/Endpoint/Api/Http/Controllers/Merchant/AgentController.php
+++ b/app/Endpoint/Api/Http/Controllers/Merchant/AgentController.php
@@ -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'],
],
diff --git a/app/Models/UserInfo.php b/app/Models/UserInfo.php
index 425f166e..059f1ae5 100644
--- a/app/Models/UserInfo.php
+++ b/app/Models/UserInfo.php
@@ -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 => '默认用户',
];
/**