Commit 777fac3c by 朱继来

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

parents 4d0e4693 bcee6243
......@@ -317,8 +317,12 @@ Class AddOrderController extends Controller
$url = Config('website.api_domain').'cart/addByOrderSystem';
$response = json_decode(curlApi($url, $data), true);
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
if ($response['err_code'] == 0) {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg'], 'data'=>$response['data']];
} else {
return ['errcode' => $response['err_code'], 'errmsg' => $response['err_msg']];
}
}
}
......
......@@ -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();
......@@ -620,6 +620,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),
......@@ -770,7 +771,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();
......@@ -835,6 +836,14 @@ Class OrderController extends Controller
'2' => '已签',
);
// 发票类型
$inv_type = array(
'1' => '不开发票',
'2' => '普通发票',
'3' => '增值税专用发票',
'4' => '增值税普通发票',
);
// 发票状态
$invoice_status = array(
'-1' => '待确认',
......@@ -852,8 +861,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;
......@@ -874,6 +883,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'] = ''; // 推送业务员
......@@ -897,6 +907,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 : ''; // 推送业务员
......@@ -1001,7 +1012,12 @@ Class OrderController extends Controller
{
$info = $this->orderDetail($request, $id);
//待审核才可以
// 账期订单跳转到详情页
if ($info['order_info']['status'] == 4) {
return redirect('/details/'.$id);
}
// 待审核才可以
if(!in_array($info['order_info']['status'], [-1, 1, 2])){
return redirect('/prompt')->with(['message'=>"该订单不符合人工审单条件~【status:{$info['order_info']['status']}】",'url' =>$_SERVER['HTTP_REFERER'], 'jumpTime'=>3,'status'=>false]);
}
......@@ -1795,6 +1811,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');
});
......
......@@ -49,6 +49,7 @@
<td class="check-select">
<label><input class="order_all_pay" type="radio" name="order_pay_type" value="1">全额付款</label>
<label><input class="order_advance_pay" type="radio" name="order_pay_type" value="2">预付首款</label>
<label><input class="order_account_period" type="radio" name="order_pay_type" value="3">账期</label>
</td>
</tr>
<tr>
......
......@@ -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