diff --git a/app/Admin/Controllers/Store/OrderController.php b/app/Admin/Controllers/Store/OrderController.php index a902d653..0a9d871f 100644 --- a/app/Admin/Controllers/Store/OrderController.php +++ b/app/Admin/Controllers/Store/OrderController.php @@ -9,7 +9,7 @@ use App\Enums\PayWay; use Dcat\Admin\Layout\Row; use Dcat\Admin\Widgets\{Box, Tab, Card}; use App\Constants\OrderStatus; -use App\Models\Store\Store; +use App\Models\Store\{Store, Desk}; class OrderController extends AdminController { @@ -178,7 +178,8 @@ class OrderController extends AdminController protected function detail($id) { - $show = Show::make($id, Order::with(['user', 'inviter', 'userCoupon'])); + $show = Show::make($id, Order::with(['user', 'inviter', 'userCoupon', 'source'])); + $model = $show->model(); $show->field('id'); $show->field('sn'); $show->field('user.phone'); @@ -197,15 +198,15 @@ class OrderController extends AdminController $show->field('reduced_amount')->as(fn($value) => bcdiv($value, 100, 2))->prepend('- ¥'); $show->field('total_amount')->as(fn($value) => bcdiv($value, 100, 2))->prepend('¥'); $show->field('sales_value'); - $show->field('order_status')->as(function ($v) { - return $this->order_status; - })->using($this->statusMap)->dot($this->statusColor); - $show->field('pay_way')->as(function ($v) { - return $this->pay_way?->mallText(); - })->circleDot(PayWay::colors()); + $show->field('order_status')->as(fn() => $this->order_status)->using($this->statusMap)->dot($this->statusColor); + $show->field('pay_way')->as(fn() => $this->pay_way?->mallText())->circleDot(PayWay::colors()); $show->field('created_at'); $show->field('pay_at'); $show->field('completed_at'); + + if ($model->source_type == Desk::class) { + $show->field('desk_id')->as(fn() => data_get($model->source, 'name')); + } $show->panel()->tools(function (Show\Tools $tools) { $tools->disableEdit(); diff --git a/resources/lang/zh_CN/store-order.php b/resources/lang/zh_CN/store-order.php index 95ca9da9..4a707d55 100644 --- a/resources/lang/zh_CN/store-order.php +++ b/resources/lang/zh_CN/store-order.php @@ -61,6 +61,7 @@ return [ 'market_price' => '市场价', 'cost_price' => '成本价', 'profit_price' => '毛利', + 'desk_id' => '桌号', ], 'options' => [ ],