diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index 3830ca6..e8a1bde 100644 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -478,8 +478,8 @@ class Order extends Backend $code = str_pad(mt_rand(0, 999999), 6, '0', STR_PAD_LEFT); // 组合生成的订单编号 $orderNumber = $prefix . $date . $code; - - return $orderNumber; + // 取 MD5 前10位 + return substr(md5($orderNumber), 0, 10); } use AmapTrait; diff --git a/application/admin/controller/statistics/Item.php b/application/admin/controller/statistics/Item.php index 5cc77c4..f6dd031 100644 --- a/application/admin/controller/statistics/Item.php +++ b/application/admin/controller/statistics/Item.php @@ -70,7 +70,7 @@ class Item extends Backend } - $build->whereBetween('audit_time', [$start, $end_at]) + $build->whereBetween('create_time', [$start, $end_at]) ->field([ 'item_title name', // 类型 'sum(total) total', // 营业额 @@ -97,7 +97,7 @@ class Item extends Backend $re['name'] = str_replace(' ', '', array_pop($name)); $re['performance_rate'] = $this->mydiv($re['performance'],$re['total']); $re['trans_rate'] = $this->mydiv($re['finish_num'],$re['count_num']); - $re['cash_value'] = $this->mydiv($re['performance'],$re['count_num']); + $re['cash_value'] = $this->mydiv($re['performance'],$re['count_num'],2,false); $re['total_avg'] = $this->mydiv($re['total'],$re['count_num'],2,false); $re['performance_avg'] = $this->mydiv($re['performance'],$re['finish_num'],2,false); @@ -147,12 +147,13 @@ class Item extends Backend } } - $res = $build->whereBetween('audit_time', [$start, $end_at]) - ->where('status', Order::STATUS_FINISHED) + $res = $build + ->whereBetween('create_time', [$start, $end_at]) ->field([ 'item_title name', // 类型 'sum(total) total', // 营业额 'count(id) count', // 单量 + 'count(if(status=60,1,null)) finish_num', // 单量 'sum(performance) performance', // 收益 'sum(refund_amount) refund_amount', // 公司退款 'sum(worker_refund_amount) worker_refund_amount', // 工人退款 @@ -165,6 +166,7 @@ class Item extends Backend $re['name'] = str_replace(' ', '', array_pop($name)); $data [] = $re; } +// dd($data); $xAxis = []; $totalPerformance = []; @@ -176,6 +178,7 @@ class Item extends Backend foreach ($data as $item) { $name = $item['name']; $total = (float)$item['total']; + $finish_num = (int)$item['finish_num']; $performance = (float)$item['performance']; $refund = (float)($item['refund_amount'] + $item['worker_refund_amount']); $workerRefund = (float)$item['worker_refund_amount']; @@ -183,10 +186,10 @@ class Item extends Backend $xAxis[] = $name; $totalPerformance[] = $total; - $conversionRate[] = $total > 0 ? round($performance / $total * 100, 2) : 0; - $profitRate[] = $total > 0 ? round(($total - $workerRefund) / $total * 100, 2) : 0; + $conversionRate[] = $total > 0 ? round($finish_num / $count * 100, 2) : 0; + $profitRate[] = $total > 0 ? round(($performance) / $total * 100, 2) : 0; $refundRate[] = $total > 0 ? round($refund / $total * 100, 2) : 0; - $monetizedValue[] = $total / $count; + $monetizedValue[] = round($total / $count, 2) ; } if ($totalPerformance){ diff --git a/application/admin/lang/zh-cn/orders/configorder.php b/application/admin/lang/zh-cn/orders/configorder.php index d7b12b9..59e088b 100644 --- a/application/admin/lang/zh-cn/orders/configorder.php +++ b/application/admin/lang/zh-cn/orders/configorder.php @@ -87,8 +87,8 @@ return [ 'Dispatch.image' => '收款凭证', 'Dispatch.plan_time' => '预约时间', 'Dispatch.finish_time' => '完成时间', - 'Dispatch.admin_id' => '派单人ID', - 'Dispatch.admin_user' => '派单人', + 'Dispatch.admin_id' => '派单员ID', + 'Dispatch.admin_user' => '派单员', 'Dispatch.create_time' => '派单时间', 'Dispatch.update_time' => '编辑时间' ]; diff --git a/application/admin/lang/zh-cn/orders/dispatch.php b/application/admin/lang/zh-cn/orders/dispatch.php index ec4179a..6713dd0 100644 --- a/application/admin/lang/zh-cn/orders/dispatch.php +++ b/application/admin/lang/zh-cn/orders/dispatch.php @@ -31,8 +31,8 @@ return [ 'Notice_num' => '通知次数', 'Plan_time' => '预约时间', 'Finish_time' => '完成时间', - 'Admin_id' => '派单人ID', - 'Admin_user' => '派单人', + 'Admin_id' => '派单员ID', + 'Admin_user' => '派单员', 'Create_time' => '派单时间', 'Update_time' => '编辑时间', 'Order.id' => 'ID', diff --git a/application/admin/lang/zh-cn/orders/dispatch2.php b/application/admin/lang/zh-cn/orders/dispatch2.php index f5c0627..5ce654a 100644 --- a/application/admin/lang/zh-cn/orders/dispatch2.php +++ b/application/admin/lang/zh-cn/orders/dispatch2.php @@ -39,13 +39,13 @@ return [ 'Notice_num' => '通知次数', 'Plan_time' => '预约时间', 'Finish_time' => '完成时间', - 'Admin_id' => '派单人ID', - 'Admin_user' => '派单人', + 'Admin_id' => '派单员ID', + 'Admin_user' => '派单员', 'Create_time' => '派单时间', 'Update_time' => '更新时间', 'Order.id' => 'ID', 'Order.order_no' => '订单编号', - 'Order.customer' => '客户姓名', + 'Order.customer' => '客户昵称', 'Order.tel' => '客户电话', 'Order.status' => '订单状态', 'Order.status 10' => '未派单', diff --git a/application/admin/view/orders/configorder/edit.html b/application/admin/view/orders/configorder/edit.html index ec8ce86..f2e88b3 100644 --- a/application/admin/view/orders/configorder/edit.html +++ b/application/admin/view/orders/configorder/edit.html @@ -24,6 +24,12 @@ +