Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bd63db89
authored
Nov 19, 2020
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_product_tracking_20201117'
parents
a0d120d6
c6c7ce66
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
13 deletions
app/Http/Controllers/ApiController.php
app/Http/Controllers/OrderController.php
app/Model/OrderItemsTrackingModel.php
public/js/order_track.js
app/Http/Controllers/ApiController.php
View file @
bd63db89
...
...
@@ -16,6 +16,7 @@ use App\Model\OrderModel;
use
App\Model\OrderExtendModel
;
use
App\Model\OrderItemsModel
;
use
App\Model\OrderItemsTrackModel
;
use
App\Model\OrderItemsTrackingModel
;
use
App\Model\UserSampleApplyModel
;
use
App\Model\OrderActionLogModel
;
use
App\Model\UserSampleInviteModel
;
...
...
@@ -161,12 +162,19 @@ class ApiController extends Controller
{
$rec_id
=
$request
->
input
(
'rec_id'
);
$OrderItemsTrackModel
=
new
OrderItemsTrackModel
;
$track
=
$OrderItemsTrackModel
->
getLastItemTrack
(
$rec_id
);
// $OrderItemsTrackModel = new OrderItemsTrackModel;
// $track = $OrderItemsTrackModel->getLastItemTrack($rec_id);
// if (!$track) $this->Export(1, '无跟踪明细');
// $data = $track['track_content'].',数量:'.$track['track_num'];
$OrderItemsTrackingModel
=
new
OrderItemsTrackingModel
;
$track
=
$OrderItemsTrackingModel
->
getLastItemTrack
(
$rec_id
);
if
(
!
$track
)
$this
->
Export
(
1
,
'无跟踪明细'
);
$data
=
$track
[
'
track_content'
]
.
',数量:'
.
$track
[
'track_num
'
];
$data
=
$track
[
'
msg'
]
.
',状态:'
.
$track
[
'status_cn
'
];
$this
->
Export
(
0
,
''
,
$data
);
}
...
...
app/Http/Controllers/OrderController.php
View file @
bd63db89
...
...
@@ -18,6 +18,7 @@ use App\Model\UserMainModel;
use
App\Model\OrderActionLogModel
;
use
App\Model\OrderReturnModel
;
use
App\Model\OrderItemsTrackModel
;
use
App\Model\OrderItemsTrackingModel
;
use
App\Model\CmsModel
;
use
App\Model\QueuedModel
;
use
App\Model\ErpPayLogModel
;
...
...
@@ -303,15 +304,22 @@ function getOrderExtend($order_id, $field="*", $where=array())
return
$extend
;
}
// 获取订单跟踪
// 获取
最新
订单跟踪
function
getLastTrack
(
$rec_id
)
{
$OrderItemsTrackModel
=
new
OrderItemsTrackModel
;
$track
=
$OrderItemsTrackModel
->
getLastItemTrack
(
$rec_id
);
// $OrderItemsTrackModel = new OrderItemsTrackModel;
// $track = $OrderItemsTrackModel->getLastItemTrack($rec_id);
// if (!$track) return false;
// return $track['track_content'].',数量:'.$track['track_num'];
$OrderItemsTrackingModel
=
new
OrderItemsTrackingModel
;
$track
=
$OrderItemsTrackingModel
->
getLastItemTrack
(
$rec_id
);
if
(
!
$track
)
return
false
;
return
$track
[
'
track_content'
]
.
',数量:'
.
$track
[
'track_num
'
];
return
$track
[
'
msg'
]
.
',状态:'
.
$track
[
'status_cn
'
];
}
Class
OrderController
extends
Controller
...
...
@@ -2018,8 +2026,11 @@ Class OrderController extends Controller
if
(
$request
->
isMethod
(
'post'
))
{
$rec_id
=
$request
->
input
(
'rec_id'
);
$OrderItemsTrackModel
=
new
OrderItemsTrackModel
;
$data
=
$OrderItemsTrackModel
->
getOrderItemsTrack
(
$rec_id
);
// $OrderItemsTrackModel = new OrderItemsTrackModel;
// $data = $OrderItemsTrackModel->getOrderItemsTrack($rec_id);
$OrderItemsTrackingModel
=
new
OrderItemsTrackingModel
;
$data
=
$OrderItemsTrackingModel
->
getOrderItemsTrack
(
$rec_id
);
return
[
'errcode'
=>
0
,
'errmsg'
=>
'成功'
,
'data'
=>
$data
];
}
...
...
app/Model/OrderItemsTrackingModel.php
0 → 100644
View file @
bd63db89
<?php
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
class
OrderItemsTrackingModel
extends
Model
{
protected
$connection
=
'order'
;
protected
$table
=
'lie_order_items_tracking'
;
protected
$primaryKey
=
'track_items_id'
;
protected
$guarded
=
[
'track_items_id'
];
public
$timestamps
=
true
;
const
CREATED_AT
=
'create_time'
;
public
function
fromDateTime
(
$value
)
{
return
strtotime
(
parent
::
fromDateTime
(
$value
));
}
// 获取最新的明细跟踪
public
function
getLastItemTrack
(
$rec_id
)
{
return
$this
->
where
(
'rec_id'
,
$rec_id
)
->
select
(
'msg'
,
'status_cn'
)
->
orderBy
(
'track_items_id'
,
'desc'
)
->
first
();
}
// 获取所有明细跟踪
public
function
getOrderItemsTrack
(
$rec_id
)
{
return
$this
->
where
(
'rec_id'
,
$rec_id
)
->
select
(
'msg'
,
'status_cn'
,
'create_name'
,
'create_time'
)
->
orderBy
(
'track_items_id'
,
'desc'
)
->
get
();
}
}
\ No newline at end of file
public/js/order_track.js
View file @
bd63db89
...
...
@@ -17,20 +17,22 @@
var
data
=
resp
.
data
;
var
content
=
'<table class="table">\
<tr>\
<th width="30%">时间</th>\
<th width="20%">时间</th>\
<th>状态</th>\
<th>说明</th>\
<th width="
13
%">负责人</th>\
<th width="
20
%">负责人</th>\
</tr>'
;
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
content
+=
'<tr><td>'
+
data
[
i
].
create_time
+
'</td><td>'
+
data
[
i
].
track_content
+
',数量:'
+
data
[
i
].
track_num
+
'</td><td>'
+
data
[
i
].
create_name
+
'</td></tr>'
;
// content += '<tr><td>'+data[i].create_time+'</td><td>'+data[i].track_content+',数量:'+data[i].track_num+'</td><td>'+data[i].create_name+'</td></tr>';
content
+=
'<tr><td>'
+
data
[
i
].
create_time
+
'</td><td>'
+
data
[
i
].
status_cn
+
'</td><td>'
+
data
[
i
].
msg
+
'</td><td>'
+
data
[
i
].
create_name
+
'</td></tr>'
;
}
content
+=
'</table>'
;
layer
.
open
({
title
:
'订单明细跟踪'
,
area
:
[
'
600px'
,
'4
00px'
],
area
:
[
'
800px'
,
'6
00px'
],
content
:
content
,
btn
:
[],
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment