Commit bd63db89 by 朱继来

Merge branch 'zjl_product_tracking_20201117'

parents a0d120d6 c6c7ce66
......@@ -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);
}
......
......@@ -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];
}
......
<?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 @@
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', '400px'],
area: ['800px', '600px'],
content: content,
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