OrderShow.php
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
+-----------------------------------------------------------------------------------------------------------------------
* 管理端详情show trait层:渲染生成 Order 详情
+-----------------------------------------------------------------------------------------------------------------------
*
* PHP version 7
*
* @category App\Admin\Shows
* @package App\Admin\Shows
* @author Richer <yangzi1028@163.com>
* @date 2022年4月2日17:10:10
* @copyright 2020-2022 Richer (http://www.Richer.com/)
* @license http://www.Richer.com/ License
* @link http://www.Richer.com/
*/
namespace App\Admin\Shows;
use App\Models\Order\Order;
use App\Models\User\Role;
use Illuminate\Support\Arr;
/**
* Trait OrderShow.
*
* @category App\Admin\Shows
* @package App\Admin\Shows
* @author Richer <yangzi1028@163.com>
* @date 2022年4月2日17:10:10
* @copyright 2020-2022 Richer (http://www.Richer.com/)
* @license http://www.Richer.com/ License
* @link http://www.Richer.com/
*/
trait OrderShow
{
/**
* 为详情show渲染字段
*
* @return void
*/
protected function renderShowFields()
{
$this->showTextField('id');
$this->showTextField('number', __('order_number'));
$this->showTextField('type_show', __('type'));
$this->show->divider();
// $this->show->contents()->as(function ($content) {
// return "<pre>{$content}</pre>";
// });
$this->showTextField('user.nickname', __('nickname'));
$this->showSingleImageField('user.avatar', __('avatar'));
$this->showTextField('user.mobile', __('mobile'));
$this->showSingleSelectField('status', __('status'), Order::STATUS_OPTIONS, Order::STATUS_COLOR_OPTIONS);
$this->show->divider();
$this->show->express(__('express'), function ($express) {
$express->express_company_show(__('express_company'));
$express->express_no(__('express_no'));
$express->express_info(__('express_info'))->unescape()->as(function ($express_info) {
if (!$express_info) {
return '--';
}
$str ='<div class="track-list track-list-date"><ul>';
foreach ($express_info as $key => $vo) {
if ($key === 0) {
$str .= '<li class="afterdate node-to-change track-node-0008 first">';
} else {
$str .= '<li class="">';
}
$str .= '<i class="node-icon"><i class="dot"></i><i class="state-icon"></i></i><span class="date">'.$vo['datetime'].'</span>';
$str .= '<span class="txt">'.$vo['remark'].'</span>';
$str .= '</li>';
}
return $str;
});
});
// $this->show->express(__('express'))->as(function ($express) {
// if (!$express) {
// return '--';
// }
//
//
// return "<pre>{$express}</pre>";
// });
$this->showDateField('created_at', __('ordered_at'));
$this->showDateField('completed_at');
$this->showDateField('cancelled_at');
// $this->show->gifts(__('gift_records'), function ($gift) {
// $gift->resource('/admin/comments');
// $gift->id();
// $gift->content()->limit(10);
//
// $gift->filter(function ($filter) {
// $filter->like('content');
// });
// });
}
}