Commit f586269c by 朱继来

Merge branch 'zjl_order_track_20190815' into development

parents 3993ec31 a3c6eed7
......@@ -2,15 +2,14 @@
namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Model\PaymentDaysModel;
use App\Model\Pcb\PcbOrderModel;
use App\Model\Pcb\PcbPublicModel;
use App\Model\Pcb\PcbPurchaseModel;
use App\Model\Pcb\PcbServerModel;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class ApiController extends Controller
{
......
......@@ -16,6 +16,7 @@ use App\Model\OrderModel;
use App\Model\UserMainModel;
use App\Model\OrderActionLogModel;
use App\Model\OrderReturnModel;
use App\Model\OrderItemsTrackModel;
// 获取订单优惠券金额
function getCoupon($order_id)
......@@ -285,6 +286,17 @@ function getOrderExtend($order_id, $field="*", $where=array())
return $extend;
}
// 获取订单跟踪
function getLastTrack($rec_id)
{
$OrderItemsTrackModel = new OrderItemsTrackModel;
$track = $OrderItemsTrackModel->getLastItemTrack($rec_id);
if (!$track) return false;
return $track['track_content'].',数量:'.$track['track_num'];
}
Class OrderController extends Controller
{
// 首页
......@@ -1724,6 +1736,19 @@ Class OrderController extends Controller
}
}
// 获取订单明细跟踪
public function getOrderItemsTrack(Request $request)
{
if ($request->isMethod('post')) {
$rec_id = $request->input('rec_id');
$OrderItemsTrackModel = new OrderItemsTrackModel;
$data = $OrderItemsTrackModel->getOrderItemsTrack($rec_id);
return ['errcode'=>0, 'errmsg'=>'成功', 'data'=>$data];
}
}
public function tempCount(Request $request)
{
$current = strtotime(date('Y-m-d', time())); // 当天0点
......
......@@ -136,6 +136,7 @@ Route::group(['middleware' => 'web'], function () {
Route::post('/ajax/addGoods', 'AddOrderController@addGoods');
Route::post('/ajax/uploadContract', 'OrderController@uploadContract');
Route::post('/ajax/getOrderItemsTrack', 'OrderController@getOrderItemsTrack');
});
// 不需要登陆态
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
class OrderItemsTrackModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_items_track';
protected $primaryKey = 'track_items_id';
protected $guarded = ['amount_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('track_items_id', 'order_id', 'track_content', 'track_num', 'create_name', 'create_time')->orderBy('create_time', 'desc')->first();
}
// 获取所有明细跟踪
public function getOrderItemsTrack($rec_id)
{
return $this->where('rec_id', $rec_id)->select('track_items_id', 'order_id', 'track_content', 'track_num', 'create_name', 'create_time')->orderBy('create_time', 'desc')->get();
}
}
\ No newline at end of file
......@@ -756,6 +756,46 @@
})
})
// 查看订单明细跟踪
$('.order-track').click(function () {
var rid = $(this).data('rid');
$.ajax({
url : '/ajax/getOrderItemsTrack',
type: 'post',
data: {rec_id : rid},
success: function(resp) {
if (resp.errcode == 0) {
var data = resp.data;
var content = '<table class="table">\
<tr>\
<th width="30%">时间</th>\
<th>说明</th>\
<th width="13%">负责人</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 += '</table>';
layer.open({
title: '订单明细跟踪',
area: ['600px', '400px'],
content: content,
btn: [],
})
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function(err) {
console.log(err);
}
})
})
// 点击物流展开
$('.click-down').click(function() {
$(this).parents('tbody').find('.other-infos').show();
......
......@@ -476,6 +476,10 @@
<th>供应商</th>
@endif
@if ($order_info['order_goods_type'] == 1)
<th>生产跟踪</th>
@endif
<?php
if ($action_name == 'changeOrder' && count($order_items_info) > 1 && in_array($order_info['status'], [1, 2])) {
echo '<th>操作</th>';
......@@ -516,6 +520,10 @@
<td>{{$v['supplier_name']}}</td>
@endif
@if ($order_info['order_goods_type'] == 1)
<th><a class="order-track" data-rid="{{$v['rec_id']}}">{{ App\Http\Controllers\getLastTrack($v['rec_id']) }}</a></th>
@endif
@if ($action_name == 'changeOrder' && count($order_items_info) > 1 && in_array($order_info['status'], [1, 2]))
<td><a class="btn btn-danger deletegoods" href="javascript:;" data-id="{{$v['rec_id']}}">删除</a></td>
@endif
......
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