Commit 49ce2f07 by 朱继来

Merge branch 'zjl_self_order_20180502' into development

parents 81c0d78b 91855c2a
......@@ -597,7 +597,7 @@ Class OrderController extends Controller
if (!empty($list)) {
// 订单数据处理
$export = $this->exportList($list);
$export = $this->exportList($request, $list, $map['order_goods_type']);
$xlsName = '订单数据导出';
$xlslist = exportExcel($xlsName, $xlsCell, $export);
......@@ -626,7 +626,7 @@ Class OrderController extends Controller
* @param [type] $order [查询出的订单数据]
* @return [type] [description]
*/
public function exportList($order)
public function exportList($request, $order, $type)
{
// 订单类型
$order_type = array(
......@@ -680,7 +680,17 @@ Class OrderController extends Controller
$tmp[$i]['goods_name'] = $val->goods_name;
$tmp[$i]['goods_number'] = $val->goods_number;
$tmp[$i]['goods_price'] = $val->goods_price;
$tmp[$i]['order_amount'] = $val->goods_number * $val->goods_price;
$express_fee = 0;
// 自营运费
if ($type == 2) {
$data = array();
$data = $this->orderDetail($request, $val->order_id);
$express_fee = $data['order_price_info']['shipping_price'];
}
$tmp[$i]['order_amount'] = $val->goods_number * $val->goods_price + $express_fee;
$tmp[$i]['currency'] = $val->currency == 1 ? 'RMB' : 'USD';
$tmp[$i]['order_type'] = $order_type[$val->order_pay_type];
$tmp[$i]['order_status'] = $order_status[$val->status];
......@@ -1391,18 +1401,19 @@ Class OrderController extends Controller
if (!$update) return ['errcode'=>-1, 'errmsg'=>'取消失败'];
// 解锁库存
$info = $this->orderDetail($request, $order_id);
$sku = array();
// $info = $this->orderDetail($request, $order_id);
// $sku = array();
foreach ($info['order_items_info'] as $v) {
$sku[$v['rec_id']] = $v['goods_number'];
}
// foreach ($info['order_items_info'] as $v) {
// $sku[$v['rec_id']] = $v['goods_number'];
// }
$res = json_decode($this->unlockSku($order_id, $sku));
// $res = json_decode($this->unlockSku($order_id, $sku));
if ($res['errcode'] != 0) return ['errcode'=>-1, 'errmsg'=>'解锁库存失败'];
// if ($res['errcode'] != 0) return ['errcode'=>-1, 'errmsg'=>'解锁库存失败'];
return ['errcode'=>0, 'errmsg'=>'取消成功并解锁库存'];
// return ['errcode'=>0, 'errmsg'=>'取消成功并解锁库存'];
return ['errcode'=>0, 'errmsg'=>'取消成功'];
}
}
......@@ -1438,18 +1449,18 @@ Class OrderController extends Controller
// 更新订单状态
DB::connection('order')->table('lie_order')->where('order_id', $order_id)->update(['status'=>8]);
$info = $this->orderDetail($request, $order_id);
$sku = array();
// $info = $this->orderDetail($request, $order_id);
// $sku = array();
foreach ($info['order_items_info'] as $v) {
$sku[$v['rec_id']] = $v['goods_number'];
}
// foreach ($info['order_items_info'] as $v) {
// $sku[$v['rec_id']] = $v['goods_number'];
// }
$res = json_decode($this->unlockSku($order_id, $sku, true));
// $res = json_decode($this->unlockSku($order_id, $sku, true));
if ($res['errcode'] != 0) return ['errcode'=>-1, 'errmsg'=>'锁定库存失败'];
// if ($res['errcode'] != 0) return ['errcode'=>-1, 'errmsg'=>'锁定库存失败'];
return ['errcode'=>0, 'errmsg'=>'填写快递单成功并锁定库存'];
// return ['errcode'=>0, 'errmsg'=>'填写快递单成功并锁定库存'];
}
return ['errcode'=>0, 'errmsg'=>'填写快递单成功'];
......
......@@ -107,7 +107,7 @@ Class OrderCountController extends Controller
/**
* 订单数统计
*/
public function count(Request $request)
public function count(Request $request, $type = 1, $view = 'count')
{
$info = $this->getPageInfo($request);
......@@ -116,19 +116,19 @@ Class OrderCountController extends Controller
$data['k1'] = time();
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$resData = array("pf"=>1, "k1"=>$data['k1'], "k2"=>$data['k2']);
$resData = array("pf"=>1, "k1"=>$data['k1'], "k2"=>$data['k2'], 'type'=>$type);
$temp = json_decode(curlApi($url,$resData,"POST"), true);
$info['count'] = $temp['data'];
return view('count', $info);
return view($view, $info);
}
/**
* 金额统计 -- 订单列表
*/
public function amount(Request $request)
public function amount(Request $request, $type = 1, $view = 'amount')
{
$info = $this->getPageInfo($request);
......@@ -144,6 +144,7 @@ Class OrderCountController extends Controller
$map['checkTime'] = $checkTime = $request->input('checkTime', '1'); // 默认选择订单付款时间
$map['checkStatus'] = $checkStatus = $request->input('checkStatus', '1'); // 默认选择查询全部
$map['order_goods_type'] = $type;
// 竞调账号
if ($info['username'] != 'vpadmin@ichunt.com') {
......@@ -184,8 +185,18 @@ Class OrderCountController extends Controller
$info['time_start'] = $time_start;
$info['time_end'] = $time_end;
return view('amount', $info);
return view($view, $info);
}
// 自营订单统计
public function selfCount(REQUEST $request)
{
return $this->count($request, 2, 'self_count');
}
// 自营订单金额统计
public function selfAmount(REQUEST $request)
{
return $this->amount($request, 2, 'self_amount');
}
}
\ No newline at end of file
......@@ -237,7 +237,7 @@
foreach ($val as $k => $v) {
if (is_array($v)) {
foreach ($v as $k1 => $v1) {
if (preg_match('/_check/', $v1)) {
if (preg_match('/_check$/', $v1)) {
$menuData[$key][] = $k;
continue;
}
......
......@@ -58,7 +58,9 @@ Route::group(['middleware' => 'web'], function () {
Route::resource('/prompt', 'PromptController@index');
Route::get('/count', 'OrderCountController@count');
Route::get('/self_count', 'OrderCountController@selfCount');
Route::get('/amount', 'OrderCountController@amount');
Route::get('/self_amount', 'OrderCountController@selfAmount');
Route::match('post', '/ajaxDelayTime', 'OrderController@ajaxDelayTime');
......
......@@ -10,7 +10,7 @@
'自营订单' => [
'订单列表' => ['self_order_check', 'self_order_export', 'self_order_cancel', 'self_order_express', 'self_order_invoice_express', 'self_order_update_address', 'self_order_update_invoice', 'self_check_test_order', 'self_order_download_contract'],
'快递配置' => ['self_order_express_set'],
'快递配置' => ['self_order_express_set_check'],
],
'订单统计' => [
......
......@@ -9,11 +9,18 @@
},
bind:function(){
$('.order-amount-search').click(function(){
searchAmount('/amount');
})
$('.self-order-amount-search').click(function(){
searchAmount('/self_amount');
})
function searchAmount(url) {
var checkTime = $('#checkTime').val(),
time_start = $('input[name="time_start"]').val(),
time_end = $('input[name="time_end"]').val(),
checkStatus = $('#checkStatus').val(),
url = '/amount';
time_start = Date.parse(time_start) / 1000;
time_end = Date.parse(time_end) / 1000;
......@@ -21,7 +28,7 @@
url = url+'?checkTime='+checkTime+'&time_start='+time_start+'&time_end='+time_end+'&checkStatus='+checkStatus;
location.href = url;
})
}
}
}
......
<div class="page-content">
<ul class="nav nav-tabs">
<li><a href="{{URL('count')}}">订单数统计</a></li>
<li><a href="{{URL('count')}}">联营订单数统计</a></li>
<li class="active"><a href="javascript:;">订单金额统计</a></li>
</ul>
<div class="tabs-box">
......
<div class="page-content">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">订单状态概览</a></li>
<li class="active"><a href="javascript:;">联营订单状态概览</a></li>
<li><a href="{{URL('amount')}}">订单金额统计</a></li>
</ul>
<div class="tabs-box">
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单管理后台 | 订单统计金额</title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
@include('orderlist.css')
@include('orderlist.js')
</head>
<body class="">
<div id="wrapper">
<!-- layouts.navigation -->
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
<div class="row">
@include('self_amount.content')
</div>
</div>
</div>
</body>
<div class="page-content">
<ul class="nav nav-tabs">
<li><a href="{{URL('self_count')}}">自营订单数统计</a></li>
<li class="active"><a href="javascript:;">订单金额统计</a></li>
</ul>
<div class="tabs-box">
<div class="row-fluid order-amount">
<select name="checkTime" id="checkTime" style="width: 150px; margin-bottom: 0;">
<option value="1">订单付款时间</option>
<option value="2">订单创建时间</option>
</select>
<input type="text" readonly name="time_start" value="{{ !empty($time_start) ? date('Y-m-d H:i:s', $time_start) : '' }}" class="Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
<span> - </span>
<input type="text" readonly name="time_end" value="{{ !empty($time_end) ? date('Y-m-d H:i:s', $time_end) : '' }}" class="Wdate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
<select name="checkStatus" id="checkStatus" style="width: 80px; margin-bottom: 0;">
<option value="1">全部</option>
<option value="2">已完成</option>
<option value="3">未完成</option>
</select>
<button class="btn btn-primary self-order-amount-search">搜索</button>
</div>
</div>
<div class="tabs-box">
<div class="row-fluid">
<table class="table table-bordered">
<tr>
<th>序号</th>
<th>订单号</th>
<th>订单付款时间</th>
<th>交易完成时间</th>
<th>订单金额</th>
</tr>
<empty name="list">
@if (empty($list))
<tr><td colspan="5">没有更多数据~</td></tr>
@else
@foreach ($list as $key => $vo)
<tr>
<td>{{$key + 1}}</td>
<td>{{$vo['order_sn']}}</td>
<td>
<?php
// 全款
if ($vo['order_pay_type'] == 1) {
echo date('Y-m-d H:i:s', $vo['pay_time']);
} else if ($vo['order_pay_type'] == 2) { // 预付款
$exp = explode(',', $vo['pay_time']);
$pay_amount = explode(',', $vo['pay_amount']);
if (count($exp) == 1) {
// 如果有两条金额记录,支付时间只有一条,则首尾款时间一致
if (count($pay_amount) == 2) {
echo date('Y-m-d H:i:s', $exp[0]).' (尾款)<br>'.date('Y-m-d H:i:s', $exp[0]).' (首款)';
} else {
if ($vo['pay_type'] == 2) {
echo date('Y-m-d H:i:s', $exp[0]).' (首款)';
} else {
echo date('Y-m-d H:i:s', $exp[0]).' (尾款)';
}
}
} else {
if ($exp[0] < $exp[1]){
echo date('Y-m-d H:i:s', $exp[1]).' (尾款)<br>'.date('Y-m-d H:i:s', $exp[0]).' (首款)';
} else {
echo date('Y-m-d H:i:s', $exp[0]).' (尾款)<br>'.date('Y-m-d H:i:s', $exp[1]).' (首款)';
}
}
}
?>
</td>
<td>
@if ($vo['finish_time'] != 0)
{{date('Y-m-d H:i:s', $vo['finish_time'])}}
@endif
</td>
<td>
<?php
if ($vo['currency'] == 1) {
$currency = '¥';
} else {
$currency = '$';
}
if ($vo['order_pay_type'] == 1) { // 全款
echo $currency.$vo['pay_amount'];
} else if ($vo['order_pay_type'] == 2) { // 预付款
$exp = explode(',', $vo['pay_amount']);
if (count($exp) == 1) {
if ($vo['pay_type'] == 2) {
echo $currency.$exp[0].' (首款)';
} else {
echo $currency.$exp[0].' (尾款)';
}
} else {
if ($exp[0] > $exp[1]) {
echo $currency.$exp[0].' (尾款)<br>'.$currency.$exp[1].' (首款)';
} else {
echo $currency.$exp[1].' (尾款)<br>'.$currency.$exp[0].' (首款)';
}
}
}
?>
</td>
</tr>
@endforeach
@endif
</table>
</div>
<div class="row-fluid pagination">
<span>
@if ($checkStatus == 1)
实收金额:¥{{isset($pay_count['rmb_pay']) ? $pay_count['rmb_pay'] : 0}} &nbsp; ${{isset($pay_count['usd_pay']) ? $pay_count['usd_pay'] : 0}}
已完成金额:¥{{!empty($pay_count['rmb_pay_finish']) ? $pay_count['rmb_pay_finish'] : 0}} &nbsp; ${{!empty($pay_count['usd_pay_finish']) ? $pay_count['usd_pay_finish'] : 0}}
未完成金额:¥{{!empty($pay_count['rmb_pay_unfinish']) ? $pay_count['rmb_pay_unfinish'] : 0}} &nbsp; ${{!empty($pay_count['usd_pay_unfinish']) ? $pay_count['usd_pay_unfinish'] : 0}}
@elseif ($checkStatus == 2)
实收金额:¥{{isset($pay_count['rmb_pay']) ? $pay_count['rmb_pay'] : 0}} &nbsp; ${{isset($pay_count['usd_pay']) ? $pay_count['usd_pay'] : 0}}
已完成金额:¥{{!empty($pay_count['rmb_pay_finish']) ? $pay_count['rmb_pay_finish'] : 0}} &nbsp; ${{!empty($pay_count['usd_pay_finish']) ? $pay_count['usd_pay_finish'] : 0}}
@else
实收金额:¥{{isset($pay_count['rmb_pay']) ? $pay_count['rmb_pay'] : 0}} &nbsp; ${{isset($pay_count['usd_pay']) ? $pay_count['usd_pay'] : 0}}
未完成金额:¥{{!empty($pay_count['rmb_pay_unfinish']) ? $pay_count['rmb_pay_unfinish'] : 0}} &nbsp; ${{!empty($pay_count['usd_pay_unfinish']) ? $pay_count['usd_pay_unfinish'] : 0}}
@endif
</span>
<?php echo isset($page) ? $page : ''; ?>
</div>
</div>
</div>
<script>
$.lie.orderamount.index();
var checkTime = '{{$checkTime}}';
var checkStatus = '{{$checkStatus}}';
$('#checkTime').val(checkTime);
$('#checkStatus').val(checkStatus);
$('#side-menu').children('li').last().attr('class', 'active');
$('#side-menu').children('li').last().children('ul').children('li').eq(2).attr('class', 'active');
</script>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单管理后台 | 订单统计</title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
@include('orderlist.css')
@include('orderlist.js')
</head>
<body class="">
<div id="wrapper">
<!-- layouts.navigation -->
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
<div class="row">
@include('self_count.content')
</div>
</div>
</div>
</body>
<div class="page-content">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">自营订单状态概览</a></li>
<li><a href="{{URL('self_amount')}}">订单金额统计</a></li>
</ul>
<div class="tabs-box">
<div class="row-fluid">
<table class="table">
<tr>
<th>时间</th>
<th title = "指定时间内,新创建的订单,不考虑该订单是否有状态变化。">新创建订单数</th>
<th title = "指定时间内,客户完成了所有款项的支付,并系统对账完成的订单数量。(对应待发货状态)">已付款</th>
<th title = "指定时间内,订单完成发货,但客户还未完成收货状态的订单数量。(对应待收货状态)">待收货</th>
<th title = "指定时间内,订单已完成状态的订单数量(对应已完成状态)">已完成</th>
<th title = "指定时间内,订单已取消的订单数量(对应已取消状态) ">已取消</th>
</tr>
<tr>
<td>今日</td>
<td>{{$count['all']['today']}}</td>
<td>{{$count['paid']['today']}}</td>
<td>{{$count['send']['today']}}</td>
<td>{{$count['done']['today']}}</td>
<td>{{$count['cancel']['today']}}</td>
</tr>
<tr>
<td>近7天</td>
<td>{{$count['all']['week']}}</td>
<td>{{$count['paid']['week']}}</td>
<td>{{$count['send']['week']}}</td>
<td>{{$count['done']['week']}}</td>
<td>{{$count['cancel']['week']}}</td>
</tr>
<tr>
<td>近30天</td>
<td>{{$count['all']['month']}}</td>
<td>{{$count['paid']['month']}}</td>
<td>{{$count['send']['month']}}</td>
<td>{{$count['done']['month']}}</td>
<td>{{$count['cancel']['month']}}</td>
</tr>
</table>
</div>
</div>
</div>
<script>
$.lie.order.index();
</script>
\ No newline at end of file
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