Commit cf4e073e by 朱继来

调整生产跟踪

parent bac54290
...@@ -18,6 +18,7 @@ use App\Model\UserMainModel; ...@@ -18,6 +18,7 @@ use App\Model\UserMainModel;
use App\Model\OrderActionLogModel; use App\Model\OrderActionLogModel;
use App\Model\OrderReturnModel; use App\Model\OrderReturnModel;
use App\Model\OrderItemsTrackModel; use App\Model\OrderItemsTrackModel;
use App\Model\OrderItemsTrackingModel;
use App\Model\CmsModel; use App\Model\CmsModel;
use App\Model\QueuedModel; use App\Model\QueuedModel;
use App\Model\ErpPayLogModel; use App\Model\ErpPayLogModel;
...@@ -303,15 +304,22 @@ function getOrderExtend($order_id, $field="*", $where=array()) ...@@ -303,15 +304,22 @@ function getOrderExtend($order_id, $field="*", $where=array())
return $extend; return $extend;
} }
// 获取订单跟踪 // 获取最新订单跟踪
function getLastTrack($rec_id) function getLastTrack($rec_id)
{ {
$OrderItemsTrackModel = new OrderItemsTrackModel; // $OrderItemsTrackModel = new OrderItemsTrackModel;
$track = $OrderItemsTrackModel->getLastItemTrack($rec_id); // $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; if (!$track) return false;
return $track['track_content'].',数量:'.$track['track_num']; return $track['msg'].',状态:'.$track['status_cn'];
} }
Class OrderController extends Controller Class OrderController extends Controller
...@@ -2015,8 +2023,11 @@ Class OrderController extends Controller ...@@ -2015,8 +2023,11 @@ Class OrderController extends Controller
if ($request->isMethod('post')) { if ($request->isMethod('post')) {
$rec_id = $request->input('rec_id'); $rec_id = $request->input('rec_id');
$OrderItemsTrackModel = new OrderItemsTrackModel; // $OrderItemsTrackModel = new OrderItemsTrackModel;
$data = $OrderItemsTrackModel->getOrderItemsTrack($rec_id); // $data = $OrderItemsTrackModel->getOrderItemsTrack($rec_id);
$OrderItemsTrackingModel = new OrderItemsTrackingModel;
$data = $OrderItemsTrackingModel->getOrderItemsTrack($rec_id);
return ['errcode'=>0, 'errmsg'=>'成功', 'data'=>$data]; return ['errcode'=>0, 'errmsg'=>'成功', 'data'=>$data];
} }
......
<?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
...@@ -17,20 +17,22 @@ ...@@ -17,20 +17,22 @@
var data = resp.data; var data = resp.data;
var content = '<table class="table">\ var content = '<table class="table">\
<tr>\ <tr>\
<th width="30%">时间</th>\ <th width="20%">时间</th>\
<th>状态</th>\
<th>说明</th>\ <th>说明</th>\
<th width="13%">负责人</th>\ <th width="20%">负责人</th>\
</tr>'; </tr>';
for (var i = 0; i < data.length; i++) { 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>'; content += '</table>';
layer.open({ layer.open({
title: '订单明细跟踪', title: '订单明细跟踪',
area: ['600px', '400px'], area: ['800px', '600px'],
content: content, content: content,
btn: [], btn: [],
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment