6
0
Fork 0

Store/Order

base
panliang 2023-04-23 15:07:10 +08:00
parent 3bf4e1de14
commit bdd0c9f1f0
2 changed files with 10 additions and 8 deletions

View File

@ -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();

View File

@ -61,6 +61,7 @@ return [
'market_price' => '市场价',
'cost_price' => '成本价',
'profit_price' => '毛利',
'desk_id' => '桌号',
],
'options' => [
],