Commit d884f21b by 朱继来

Merge branch 'master' of http://119.23.72.7/zhujilai/Order into zjl_account_20180911

parents 52f138dc 4b319b50
......@@ -318,7 +318,7 @@ Class AddOrderController extends Controller
$response = json_decode(curlApi($url, $data), true);
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
}
}
......
......@@ -107,11 +107,11 @@ function getPayName($order_id)
return false;
}
function getShipping($order_id)
function getShipping($order_id, $shipping_type=1)
{
$shipping = DB::connection('order')
->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')
->orderBy('order_shipping_id')
->get();
......@@ -611,6 +611,7 @@ Class OrderController extends Controller
array('order_type', '订单类型'),
array('order_status', '订单状态'),
array('shipping_status','发货状态'),
array('inv_type', '发票类型'),
array('invoice_status', '发票状态'),
array('company_name', '供应商'),
array('sale_name', $sale_name),
......@@ -761,7 +762,7 @@ Class OrderController extends Controller
})
->where('it.status', '<>', -1)
->where('o.order_goods_type', '=', $map['order_goods_type'])
->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.supplier_name', 'o.order_id', 'o.order_sn', 'o.order_pay_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'i.invoice_status', 'a.consignee', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'c.com_name', 'oe.send_remark')
->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.supplier_name', 'o.order_id', 'o.order_sn', 'o.order_pay_type', 'o.order_goods_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'i.inv_type', 'i.invoice_status', 'a.consignee', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'c.com_name', 'oe.send_remark')
->groupBy('it.rec_id')
->orderBy('o.create_time', 'DESC')
->get();
......@@ -826,6 +827,14 @@ Class OrderController extends Controller
'2' => '已签',
);
// 发票类型
$inv_type = array(
'1' => '不开发票',
'2' => '普通发票',
'3' => '增值税专用发票',
'4' => '增值税普通发票',
);
// 发票状态
$invoice_status = array(
'-1' => '待确认',
......@@ -843,8 +852,8 @@ Class OrderController extends Controller
}
$tmp[$i]['order_id'] = $order[$i]->order_id;
$tmp[$i]['goods_name'] = $order[$i]->goods_name;
// 自营商品名称换成商品型号
$tmp[$i]['goods_name'] = $order[$i]->order_goods_type == 1 ? $order[$i]->goods_name : getGoodsName($order[$i]->goods_id);
$tmp[$i]['goods_number'] = $order[$i]->goods_number;
$tmp[$i]['goods_price'] = $order[$i]->goods_price;
$tmp[$i]['goods_amount'] = $order[$i]->goods_number*$order[$i]->goods_price;
......@@ -865,6 +874,7 @@ Class OrderController extends Controller
$tmp[$i]['order_type'] = '';
$tmp[$i]['order_status'] = '';
$tmp[$i]['shipping_status'] = ''; // 发货状态
$tmp[$i]['inv_type'] = ''; // 发票类型
$tmp[$i]['invoice_status'] = ''; // 发票状态
$tmp[$i]['company_name'] = '';
$tmp[$i]['sale_name'] = ''; // 推送业务员
......@@ -888,6 +898,7 @@ Class OrderController extends Controller
$tmp[$i]['order_type'] = !empty($order[$i]->order_pay_type) ? $order_type[$order[$i]->order_pay_type] : '未知';
$tmp[$i]['order_status'] = !empty($order[$i]->status) ? $order_status[$order[$i]->status] : '未知';
$tmp[$i]['shipping_status'] = !empty($order[$i]->shipping_status) ? $shipping_status[$order[$i]->shipping_status] : '无发货信息'; // 发货状态
$tmp[$i]['inv_type'] = $order[$i]->inv_type ? $inv_type[$order[$i]->inv_type] : '未知'; // 发票类型
$tmp[$i]['invoice_status'] = !empty($order[$i]->invoice_status) ? $invoice_status[$order[$i]->invoice_status] : '无发票信息'; // 发票状态
$tmp[$i]['company_name'] = $order[$i]->supplier_name;
$tmp[$i]['sale_name'] = isset($sales) ? $sales->name : ''; // 推送业务员
......@@ -1790,6 +1801,30 @@ Class OrderController extends Controller
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点
......
......@@ -75,9 +75,9 @@ Route::group(['middleware' => 'web'], function () {
Route::match(['get', 'post'], '/express_set', 'OrderController@expressSet');
Route::match(['get', 'post'], '/tempcount', 'OrderController@tempCount');
Route::post('/ajaxDownloadContract', 'OrderController@ajaxDownloadContract');
Route::post('/ajaxDownloadContract', 'OrderController@ajaxDownloadContract');
Route::post('/ajaxInputCancelReason', 'OrderController@ajaxInputCancelReason');
Route::post('/ajax/shipping', 'OrderController@shipping');
Route::get('/add_order', 'AddOrderController@addOrder');
Route::post('/ajax/getUserInfo', 'AddOrderController@getUserInfo');
......@@ -97,7 +97,6 @@ Route::group(['middleware' => 'web'], function () {
Route::post('/ajax/deleteGoods', 'AddOrderController@deleteGoods');
Route::post('/ajax/create', 'AddOrderController@create');
Route::get('/addorder/success', 'AddOrderController@success');
Route::post('/ajax/selfCheck', 'AddOrderController@selfCheck');
});
......
......@@ -293,7 +293,7 @@
// 添加到商品列表
$('.add-to-lists').click(function() {
var goods_min_num = $(this).parents('.sku-info').find('.goods-min-num').text();
var goods_min_num = $(this).parents('.sku-info').find('.moq').text();
var goods_id = $(this).siblings('.goods_id').val();
var type = $(this).siblings('.goods_type').val();
var delivery_place = 1; // 1.大陆,2.香港 自营默认是大陆
......
......@@ -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 @@
<div class="order-info">
<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">
<tr class="caption">
<th colspan="7" style="text-align: center; background: #f9f9f9;">
......@@ -338,26 +339,51 @@
</tr>
</table>
@endif
<?php
$shipping = App\Http\Controllers\getShipping($order_info['order_id']);
?>
@if (!empty($shipping))
<!-- 订单或发票物流 -->
@if (!empty($order_shipping_info) || !empty($order_invoice_shipping_info))
<table class="table table-bordered table-hover">
<tr class="caption">
<th colspan="4" style="text-align: center; background: #f9f9f9;">
订单物流信息
</th>
</tr>
@foreach ($shipping as $s)
<tr>
<th width="10%">快递单号:</th>
<td>{{$s->shipping_no}}</td>
<th width="10%">配送状态:</th>
<td>
<tr class="caption">
<th colspan="8" style="text-align: center; background: #f9f9f9;">
物流信息
</th>
</tr>
@if (!empty($order_shipping_info))
<tr>
<th width="5%">订单物流</th>
<th width="5%">快递公司:</th>
<td width="10%">{{$order_shipping_info['shipping_name']}}</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>
@endif
@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
switch ($s->status) {
switch ($order_invoice_shipping_info['status']) {
case 0:
case 1: echo '已配送'; break;
case 2: echo '已签收'; break;
......@@ -365,10 +391,13 @@
}
?>
</td>
<td width="5%">
<a class="btn btn-xs btn-success view-shipping" data-type="2">查看物流轨迹</a>
</td>
</tr>
@endforeach
@endif
</table>
@endif
@endif
</div>
<div class="tabs-box goods-price">
......@@ -595,8 +624,9 @@
@if ($order_info['status'] == 4 && in_array('self_order_express', $userPerms))
<a class="btn btn-default self_express" href="javascript:;" data-id="{{$order_info['order_id']}}" class="btn btn-default">填写快递单</a>
@endif
@if ($order_info['status'] >= 4 && in_array('self_order_invoice_express', $userPerms))
<!-- 订单状态大于4,且处于开票状态,且存在权限 -->
@if ($order_info['status'] >= 4 && $order_invoice_info['inv_type'] > 1 && in_array('self_order_invoice_express', $userPerms))
<a class="btn btn-default self_invoice_express" data-id="{{$order_info['order_id']}}" href="javascript:;" class="btn btn-default">填写发票快递</a>
@endif
</div>
......
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