Commit 4ec7d23f by 朱继来

添加物流轨迹

parent ab3b0fcd
...@@ -107,11 +107,11 @@ function getPayName($order_id) ...@@ -107,11 +107,11 @@ function getPayName($order_id)
return false; return false;
} }
function getShipping($order_id) function getShipping($order_id, $shipping_type=1)
{ {
$shipping = DB::connection('order') $shipping = DB::connection('order')
->table('lie_order_shipping') ->table('lie_order_shipping')
->where(['order_id' => $order_id, 'shipping_type' => 1]) ->where(['order_id' => $order_id, 'shipping_type' => $shipping_type])
->select('shipping_no', 'status') ->select('shipping_no', 'status')
->orderBy('order_shipping_id') ->orderBy('order_shipping_id')
->get(); ->get();
...@@ -1787,6 +1787,30 @@ Class OrderController extends Controller ...@@ -1787,6 +1787,30 @@ Class OrderController extends Controller
return view('express_set', $info); return view('express_set', $info);
} }
// 查看物流轨迹
public function shipping(Request $request)
{
if ($request->isMethod('post')) {
$data['id'] = $request->input('order_id');
$data['uid'] = $request->input('user_id');
$data['type'] = $request->input('type');
$url = Config('website.api_domain').'order/shipping';
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$temp = json_decode(curlApi($url, $data, "POST"), true); // 连接API
if ($temp['err_code'] == 0) {
return ['errcode'=>0, 'errmsg'=>'', 'data'=>$temp['data'][0]['info']];
} else {
errorLog(Error::E_UPDATE_FAILED, '操作失败');
return ['errcode'=>Error::E_UPDATE_FAILED, 'errmsg'=>$temp['err_msg']];
}
}
}
/** /**
* 定时任务:提前一天上午10点 * 定时任务:提前一天上午10点
......
...@@ -75,9 +75,9 @@ Route::group(['middleware' => 'web'], function () { ...@@ -75,9 +75,9 @@ Route::group(['middleware' => 'web'], function () {
Route::match(['get', 'post'], '/express_set', 'OrderController@expressSet'); Route::match(['get', 'post'], '/express_set', 'OrderController@expressSet');
Route::match(['get', 'post'], '/tempcount', 'OrderController@tempCount'); Route::match(['get', 'post'], '/tempcount', 'OrderController@tempCount');
Route::post('/ajaxDownloadContract', 'OrderController@ajaxDownloadContract'); Route::post('/ajaxDownloadContract', 'OrderController@ajaxDownloadContract');
Route::post('/ajaxInputCancelReason', 'OrderController@ajaxInputCancelReason'); Route::post('/ajaxInputCancelReason', 'OrderController@ajaxInputCancelReason');
Route::post('/ajax/shipping', 'OrderController@shipping');
Route::get('/add_order', 'AddOrderController@addOrder'); Route::get('/add_order', 'AddOrderController@addOrder');
Route::post('/ajax/getUserInfo', 'AddOrderController@getUserInfo'); Route::post('/ajax/getUserInfo', 'AddOrderController@getUserInfo');
...@@ -97,7 +97,6 @@ Route::group(['middleware' => 'web'], function () { ...@@ -97,7 +97,6 @@ Route::group(['middleware' => 'web'], function () {
Route::post('/ajax/deleteGoods', 'AddOrderController@deleteGoods'); Route::post('/ajax/deleteGoods', 'AddOrderController@deleteGoods');
Route::post('/ajax/create', 'AddOrderController@create'); Route::post('/ajax/create', 'AddOrderController@create');
Route::get('/addorder/success', 'AddOrderController@success'); Route::get('/addorder/success', 'AddOrderController@success');
Route::post('/ajax/selfCheck', 'AddOrderController@selfCheck'); Route::post('/ajax/selfCheck', 'AddOrderController@selfCheck');
}); });
......
...@@ -584,6 +584,45 @@ ...@@ -584,6 +584,45 @@
}); });
// 查看物流轨迹
$('.view-shipping').click(function () {
var order_id = $('#order_id').val();
var user_id = $('#user_id').val();
var type = $(this).data('type');
$.ajax({
url : '/ajax/shipping',
type: 'post',
data: {order_id : order_id, user_id : user_id, type : type},
success: function(resp) {
if (resp.errcode == 0) {
var data = resp.data;
var content = '';
if (data.constructor == Array) { // 判断返回结果是否为数组
for (var i = 0; i < data.length; i++) {
content += '<p><span style="margin-right:10px;">'+data[i]['AcceptTime']+'</span>'+data[i]['AcceptStation']+'<span></span></p>'
}
} else {
content = data;
}
layer.open({
title: '物流轨迹',
area: ['800px', '600px'],
content: content,
btn: [],
})
} else {
layer.alert(resp.errmsg || '网络异常')
}
},
error: function(err) {
console.log(err);
}
})
})
}, },
//物流信息 //物流信息
......
...@@ -170,6 +170,7 @@ ...@@ -170,6 +170,7 @@
<div class="order-info"> <div class="order-info">
<input type="hidden" id="order_id" value="{{$order_info['order_id']}}"> <input type="hidden" id="order_id" value="{{$order_info['order_id']}}">
<input type="hidden" id="user_id" value="{{$order_info['user_id']}}">
<table class="table table-bordered"> <table class="table table-bordered">
<tr class="caption"> <tr class="caption">
<th colspan="7" style="text-align: center; background: #f9f9f9;"> <th colspan="7" style="text-align: center; background: #f9f9f9;">
...@@ -338,26 +339,48 @@ ...@@ -338,26 +339,48 @@
</tr> </tr>
</table> </table>
@endif @endif
<?php @if (!empty($order_shipping_info))
$shipping = App\Http\Controllers\getShipping($order_info['order_id']);
?>
@if (!empty($shipping))
<table class="table table-bordered table-hover"> <table class="table table-bordered table-hover">
<tr class="caption"> <tr class="caption">
<th colspan="4" style="text-align: center; background: #f9f9f9;"> <th colspan="8" style="text-align: center; background: #f9f9f9;">
订单物流信息 物流信息
</th> </th>
</tr> </tr>
@foreach ($shipping as $s)
<tr> <tr>
<th width="10%">快递单号:</th> <th width="5%">订单物流</th>
<td>{{$s->shipping_no}}</td> <th width="5%">快递公司:</th>
<th width="10%">配送状态:</th> <td width="10%">{{$order_shipping_info['shipping_name']}}</td>
<td> <th width="5%">快递单号:</th>
<td width="10%">{{$order_shipping_info['shipping_no']}}</td>
<th width="5%">配送状态:</th>
<td width="10%">
<?php
switch ($order_shipping_info['status']) {
case 0:
case 1: echo '已配送'; break;
case 2: echo '已签收'; break;
default: echo '未配送'; break;
}
?>
</td>
<td width="5%">
<a class="btn btn-xs btn-success view-shipping" data-type="1">查看物流轨迹</a>
</td>
</tr>
@if (!empty($order_invoice_shipping_info))
<tr>
<th width="5%">发票物流</th>
<th width="5%">快递公司:</th>
<td width="10%">{{$order_invoice_shipping_info['shipping_name']}}</td>
<th width="5%">快递单号:</th>
<td width="10%">{{$order_invoice_shipping_info['shipping_no']}}</td>
<th width="5%">配送状态:</th>
<td width="10%">
<?php <?php
switch ($s->status) { switch ($order_invoice_shipping_info['status']) {
case 0: case 0:
case 1: echo '已配送'; break; case 1: echo '已配送'; break;
case 2: echo '已签收'; break; case 2: echo '已签收'; break;
...@@ -365,10 +388,13 @@ ...@@ -365,10 +388,13 @@
} }
?> ?>
</td> </td>
<td width="5%">
<a class="btn btn-xs btn-success view-shipping" data-type="2">查看物流轨迹</a>
</td>
</tr> </tr>
@endforeach @endif
</table> </table>
@endif @endif
</div> </div>
<div class="tabs-box goods-price"> <div class="tabs-box goods-price">
......
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