Commit d4b96f9f by 朱继来

Merge branch 'zjl_export_20180730' into development

parents 51f659a0 1fee021d
...@@ -185,6 +185,14 @@ function getSalesName($sale_id) ...@@ -185,6 +185,14 @@ function getSalesName($sale_id)
return isset($user->name) ? $user->name : ''; return isset($user->name) ? $user->name : '';
} }
// 判断用户是否为新用户 -- 第一次下单
function isNewClient($user_id)
{
$count = DB::connection('order')->table('lie_order')->where('user_id', $user_id)->count();
return $count == 1 ? true : false;
}
Class OrderController extends Controller Class OrderController extends Controller
{ {
// 首页 // 首页
...@@ -510,6 +518,9 @@ Class OrderController extends Controller ...@@ -510,6 +518,9 @@ Class OrderController extends Controller
array('company_name', '供应商'), array('company_name', '供应商'),
array('sale_name', $sale_name), array('sale_name', $sale_name),
array('adtags', 'adtags来源'), array('adtags', 'adtags来源'),
array('is_new_client', '是否为新用户'),
array('client_source', '新用户来源'),
array('cancel_reason', '取消原因'),
); );
// 非竞调账号,则查看真实数据 // 非竞调账号,则查看真实数据
...@@ -520,6 +531,7 @@ Class OrderController extends Controller ...@@ -520,6 +531,7 @@ Class OrderController extends Controller
$list = DB::connection('order') $list = DB::connection('order')
->table('lie_order_items as it') ->table('lie_order_items as it')
->leftJoin('lie_order as o', 'it.order_id', '=', 'o.order_id') ->leftJoin('lie_order as o', 'it.order_id', '=', 'o.order_id')
->leftJoin('lie_order_extend as oe', 'it.order_id', '=', 'oe.order_id')
->leftJoin('lie_pay_log as p', 'it.order_id', '=', 'p.order_id') ->leftJoin('lie_pay_log as p', 'it.order_id', '=', 'p.order_id')
->leftJoin('lie_order_invoice as i', 'it.order_id', '=', 'i.order_id') ->leftJoin('lie_order_invoice as i', 'it.order_id', '=', 'i.order_id')
->leftJoin('lie_order_address as a', function($join) { ->leftJoin('lie_order_address as a', function($join) {
...@@ -652,7 +664,7 @@ Class OrderController extends Controller ...@@ -652,7 +664,7 @@ Class OrderController extends Controller
}) })
->where('it.status', '<>', -1) ->where('it.status', '<>', -1)
->where('o.order_goods_type', '=', $map['order_goods_type']) ->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', 'i.invoice_status', 'a.consignee', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'c.com_name') ->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', 'oe.is_newclient', 'oe.client_source', 'i.invoice_status', 'a.consignee', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'c.com_name')
->groupBy('it.rec_id') ->groupBy('it.rec_id')
->orderBy('o.create_time', 'DESC') ->orderBy('o.create_time', 'DESC')
->get(); ->get();
...@@ -734,31 +746,47 @@ Class OrderController extends Controller ...@@ -734,31 +746,47 @@ Class OrderController extends Controller
} }
$tmp[$i]['order_id'] = $order[$i]->order_id; $tmp[$i]['order_id'] = $order[$i]->order_id;
$tmp[$i]['order_sn'] = "\t".$order[$i]->order_sn."\t";
$tmp[$i]['user_account'] = $order[$i]->mobile ? $order[$i]->mobile : $order[$i]->email;
$tmp[$i]['consignee'] = isset($order[$i]->consignee) ? $order[$i]->consignee : '';
$tmp[$i]['create_time_date'] = date('Y-m-d', $order[$i]->create_time);
$tmp[$i]['create_time_sec'] = date('H:i:s', $order[$i]->create_time);
$tmp[$i]['com_name'] = isset($order[$i]->com_name) ? $order[$i]->com_name : '';
$tmp[$i]['goods_name'] = $order[$i]->goods_name; $tmp[$i]['goods_name'] = $order[$i]->goods_name;
$tmp[$i]['goods_number'] = $order[$i]->goods_number; $tmp[$i]['goods_number'] = $order[$i]->goods_number;
$tmp[$i]['goods_price'] = $order[$i]->goods_price; $tmp[$i]['goods_price'] = $order[$i]->goods_price;
$tmp[$i]['goods_amount'] = $order[$i]->goods_number*$order[$i]->goods_price; $tmp[$i]['goods_amount'] = $order[$i]->goods_number*$order[$i]->goods_price;
if ($i > 0 && $order[$i]->order_id == $order[$i-1]->order_id) { if ($i > 0 && $order[$i]->order_id == $order[$i-1]->order_id) {
$tmp[$i]['order_sn'] = '';
$tmp[$i]['user_account'] = '';
$tmp[$i]['consignee'] = '';
$tmp[$i]['create_time_date'] = '';
$tmp[$i]['create_time_sec'] = '';
$tmp[$i]['com_name'] = '';
$tmp[$i]['goods_sum'] = ''; $tmp[$i]['goods_sum'] = '';
$tmp[$i]['shipping_fee'] = ''; $tmp[$i]['shipping_fee'] = '';
$tmp[$i]['extra_fee'] = ''; $tmp[$i]['extra_fee'] = '';
$tmp[$i]['coupon'] = ''; $tmp[$i]['coupon'] = '';
$tmp[$i]['order_amount'] = ''; $tmp[$i]['order_amount'] = '';
$tmp[$i]['currency'] = '';
$tmp[$i]['order_type'] = '';
$tmp[$i]['order_status'] = '';
$tmp[$i]['shipping_status'] = ''; // 发货状态
$tmp[$i]['invoice_status'] = ''; // 发票状态
$tmp[$i]['company_name'] = '';
$tmp[$i]['sale_name'] = ''; // 推送业务员
$tmp[$i]['adtags'] = '';
$tmp[$i]['is_new_client'] = '';
$tmp[$i]['client_source'] = '';
$tmp[$i]['cancel_reason'] = '';
} else { } else {
$tmp[$i]['order_sn'] = "\t".$order[$i]->order_sn."\t";
$tmp[$i]['user_account'] = $order[$i]->mobile ? $order[$i]->mobile : $order[$i]->email;
$tmp[$i]['consignee'] = isset($order[$i]->consignee) ? $order[$i]->consignee : '';
$tmp[$i]['create_time_date'] = date('Y-m-d', $order[$i]->create_time);
$tmp[$i]['create_time_sec'] = date('H:i:s', $order[$i]->create_time);
$tmp[$i]['com_name'] = isset($order[$i]->com_name) ? $order[$i]->com_name : '';
$tmp[$i]['goods_sum'] = $this->getOrderPrice($order[$i]->order_id, 1); $tmp[$i]['goods_sum'] = $this->getOrderPrice($order[$i]->order_id, 1);
$tmp[$i]['shipping_fee'] = $this->getOrderPrice($order[$i]->order_id, 3); $tmp[$i]['shipping_fee'] = $this->getOrderPrice($order[$i]->order_id, 3);
$tmp[$i]['extra_fee'] = $this->getOrderPrice($order[$i]->order_id, 2); $tmp[$i]['extra_fee'] = $this->getOrderPrice($order[$i]->order_id, 2);
$tmp[$i]['coupon'] = $this->getOrderPrice($order[$i]->order_id, -4); $tmp[$i]['coupon'] = $this->getOrderPrice($order[$i]->order_id, -4);
$tmp[$i]['order_amount'] = $order[$i]->order_amount; $tmp[$i]['order_amount'] = $order[$i]->order_amount;
}
$tmp[$i]['currency'] = $order[$i]->currency == 1 ? 'RMB' : 'USD'; $tmp[$i]['currency'] = $order[$i]->currency == 1 ? 'RMB' : 'USD';
$tmp[$i]['order_type'] = $order_type[$order[$i]->order_pay_type]; $tmp[$i]['order_type'] = $order_type[$order[$i]->order_pay_type];
$tmp[$i]['order_status'] = $order_status[$order[$i]->status]; $tmp[$i]['order_status'] = $order_status[$order[$i]->status];
...@@ -767,6 +795,10 @@ Class OrderController extends Controller ...@@ -767,6 +795,10 @@ Class OrderController extends Controller
$tmp[$i]['company_name'] = $order[$i]->supplier_name; $tmp[$i]['company_name'] = $order[$i]->supplier_name;
$tmp[$i]['sale_name'] = isset($sales) ? $sales->name : ''; // 推送业务员 $tmp[$i]['sale_name'] = isset($sales) ? $sales->name : ''; // 推送业务员
$tmp[$i]['adtags'] = $order[$i]->order_source; $tmp[$i]['adtags'] = $order[$i]->order_source;
$tmp[$i]['is_new_client'] = $order[$i]->is_newclient == 1 ? '是' : '否';
$tmp[$i]['client_source'] = $order[$i]->client_source;
$tmp[$i]['cancel_reason'] = $order[$i]->cancel_reason;
}
unset($sales); unset($sales);
} }
......
...@@ -1152,6 +1152,7 @@ ...@@ -1152,6 +1152,7 @@
var payTime = $('.payTime').val(); var payTime = $('.payTime').val();
var payTimeOther = $('.payTimeOther').val(); var payTimeOther = $('.payTimeOther').val();
if (isNewClient) {
// 用户来源 // 用户来源
if (is_newClient == null) { if (is_newClient == null) {
layer.msg('请选择用户来源!'); layer.msg('请选择用户来源!');
...@@ -1169,6 +1170,7 @@ ...@@ -1169,6 +1170,7 @@
} }
} }
} }
}
// 审核不通过 // 审核不通过
if (order_status == -1) { if (order_status == -1) {
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
<input type="hidden" name="check_failed_info" value=""> <input type="hidden" name="check_failed_info" value="">
<input type="hidden" name="change_pay_type" value=""> <input type="hidden" name="change_pay_type" value="">
<?php $isNewClient = App\Http\Controllers\isNewClient($order_info['user_id']); ?>
@if ($isNewClient)
<!-- 用户来源 --> <!-- 用户来源 -->
<p>用户来源</p> <p>用户来源</p>
<table class="table table-bordered table-hover check-table"> <table class="table table-bordered table-hover check-table">
...@@ -43,6 +45,7 @@ ...@@ -43,6 +45,7 @@
</td> </td>
</tr> </tr>
</table> </table>
@endif
<!-- 审核 --> <!-- 审核 -->
<p>审核</p> <p>审核</p>
...@@ -344,6 +347,7 @@ ...@@ -344,6 +347,7 @@
<script> <script>
var is_manager = "{{ $role == 1 || $role == 2 ? true : false }}"; var is_manager = "{{ $role == 1 || $role == 2 ? true : false }}";
var isNewClient = "{{$isNewClient}}";
var order_amount = "{{$order_info['order_amount']}}"; var order_amount = "{{$order_info['order_amount']}}";
var currency = "{{$order_info['currency']}}"; var currency = "{{$order_info['currency']}}";
var order_pay_type = "{{$order_info['order_pay_type']}}"; var order_pay_type = "{{$order_info['order_pay_type']}}";
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
<dl> <dl>
<dt></dt> <dt></dt>
<dd> <dd>
<input type="checkbox" name="test_order"> 所有订单-包括测试 <label><input type="checkbox" name="test_order"> 所有订单-包括测试</label>
</dd> </dd>
</dl> </dl>
@endif @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