Commit e4edf262 by 朱继来

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

parents a7172daa 8e804a06
......@@ -188,13 +188,14 @@ function getSalesName($sale_id)
// 判断用户是否为新用户 -- 第一次下单
function isNewClient($order_goods_type, $user_id, $create_time)
{
$half_year_time = intval($create_time - round(365 / 2) * 86400);
// $half_year_time = intval($create_time - round(365 / 2) * 86400);
$order = DB::connection('order')->table('lie_order')->where('order_goods_type', $order_goods_type)->where('user_id', $user_id)->whereBetween('create_time', [$half_year_time, $create_time-1])->get();
// $order = DB::connection('order')->table('lie_order')->where('order_goods_type', $order_goods_type)->where('user_id', $user_id)->whereBetween('create_time', [$half_year_time, $create_time-1])->get();
$user = DB::connection('order')->table('lie_user_main')->where('user_id', $user_id)->first();
return empty($order) && empty($user->client_source) ? true : false;
// return empty($order) && empty($user->client_source) ? true : false;
return $user->is_new == 0 && empty($user->client_source) ? true : false;
}
// 用户来源
......@@ -216,30 +217,33 @@ function getGoodsName($goods_id)
}
// 获取订单来源
function getOrderSource($order_id)
function getOrderSource($order_id, $order_type=1)
{
$order = DB::connection('order')->table('lie_order_extend')->where('order_id', $order_id)->select('order_type')->first();
if ($order) {
switch ($order->order_type) {
case 1:
case 2:
case 3:
$source = '后台';
break;
case 0:
$order_source = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->select('order_source')->first();
if (preg_match('/pf=1/', $order_source->order_source)) {
$source = 'PC端';
} else if (preg_match('/pf=2/', $order_source->order_source)) {
$source = '移动端';
} else {
$source = '未知';
}
if ($order_type == 1) {
$order = DB::connection('order')->table('lie_order_extend')->where('order_id', $order_id)->select('order_type')->first();
if ($order) {
switch ($order->order_type) {
case 1:
case 2:
case 3:
return '后台';
}
}
$order_source = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->select('order_source')->first();
if (preg_match('/pf=1/', $order_source->order_source)) {
$source = 'PC端';
} else if (preg_match('/pf=2/', $order_source->order_source)) {
$source = '移动端';
} else {
$source = '未知';
}
return $source;
} else if ($order_type == 3) {
return '京东';
}
return false;
......@@ -377,11 +381,9 @@ Class OrderController extends Controller
$map['order_payment_mode'] = $request->input('order_payment_mode', '');
$map['order_invoice_status']= $request->input('order_invoice_status', '');
$map['is_new'] = $request->input('is_new', '');
}
/* 临时添加 所有人只能查看线上订单 */
$map['online_order'] = 1;
// 订单查看权限---交易员、客服、测试
if (in_array($info['role'], [3, 4, 5])) {
// 筛选自己的订单
......@@ -397,6 +399,12 @@ Class OrderController extends Controller
$map['order_goods_type'] = $tid;
if ($tid == 1) {
$map['order_type_filter'] = [1];
} else {
$map['order_type_filter'] = [1, 3]; // 1. 网站 2. 京东
}
// 获取所有的业务员 (包括经理、交易员、客服、测试)
$perm = new PermController;
......@@ -458,8 +466,10 @@ Class OrderController extends Controller
$map['order_source'] = $request->input('order_source', '');
}
$map['order_goods_type'] = 1; // 联营订单
/* 查看ERP/JD订单 */
$map['offline_order'] = [2, 3]; // 2-ERP, 3-JD
$map['order_type_filter'] = [2, 3]; // 2-ERP, 3-JD
// 非竞调账号,则查看真实数据
if ($info['username'] != 'vpadmin@ichunt.com') {
......@@ -931,7 +941,7 @@ Class OrderController extends Controller
{
$data = $this->orderDetail($request, $id);
if ($data['order_info']['order_goods_type'] == 2 && $data['order_info']['order_type'] == 1) { // 平台自营订单
if ($data['order_info']['order_goods_type'] == 2 && in_array($data['order_info']['order_type'], [1, 3])) { // 平台自营订单
if ($request->input('tags') != 'self') {
return redirect('self_order'); // URL重定向
} else {
......
......@@ -81,6 +81,7 @@
order_source_ptag = $('input[name="order_source_ptag"]').val(),
test_order = $('input[name=test_order]'),
erp_order_id = $('#erp_order_id').data('default'),
is_new = $('#is_new').data('default'),
listUrl = '/list';
listUrl += '?order_type=' + order_type;
......@@ -137,11 +138,15 @@
listUrl += '&erp_order_id=' + erp_order_id;
}
if (is_new !== '') {
listUrl += '&is_new=' + is_new;
}
if (test_order.is(':checked')) {
listUrl += '&test_order=' + 1;
}
if (!order_contain && !time_start && !time_end && !order_pay_type && !order_status && !shipping_name && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && !erp_order_id && !test_order.is(':checked')) {
if (!order_contain && !time_start && !time_end && !order_pay_type && !order_status && !shipping_name && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && !erp_order_id && (is_new === '') && !test_order.is(':checked')) {
listUrl = '/list';
}
......@@ -301,11 +306,11 @@
var val = $(this).data('val'); // 当前值
var def = $(this).parents('.droplist').data('default'); // 默认值
if (val != def) {
if (val !== def) {
if ($(this).parents('.droplist').attr('name') == 'order_type') {
$('input[name=order_contain]').val(''); // 清空
}
$(this).parents('.droplist').data('default', val); // 赋值
}
})
......
......@@ -19,6 +19,7 @@
order_source_adtag = $('input[name="order_source_adtag"]').val(),
order_source_ptag = $('input[name="order_source_ptag"]').val(),
test_order = $('input[name=test_order]'),
is_new = $('#is_new').data('default'),
listUrl = '/self_order';
listUrl += '?order_type=' + order_type;
......@@ -67,11 +68,15 @@
listUrl += '&order_source_ptag=' + order_source_ptag;
}
if (is_new !== '') {
listUrl += '&is_new=' + is_new;
}
if (test_order.is(':checked')) {
listUrl += '&test_order=' + 1;
}
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !order_invoice_status && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && !test_order.is(':checked')) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !order_invoice_status && !order_send && !order_source_pf && !order_source_adtag && !order_source_ptag && (is_new === '') && !test_order.is(':checked')) {
listUrl = '/self_order';
}
......@@ -136,11 +141,11 @@
var val = $(this).data('val'); // 当前值
var def = $(this).parents('.droplist').data('default'); // 默认值
if (val != def) {
if (val !== def) {
if ($(this).parents('.droplist').attr('name') == 'order_type') {
$('input[name=order_contain]').val(''); // 清空
}
console.log(val)
$(this).parents('.droplist').data('default', val); // 赋值
}
})
......
......@@ -148,6 +148,20 @@
</div>
</dd>
</dl>
<dl>
<dt>用户标签:</dt>
<dd>
<div class="droplist" data-default="{{$condition['is_new']}}" name="is_new" id="is_new">
<ul class="dropdown-menu">
<li data-val="" class="active">全部</li>
<li data-val="0">用户</li>
<li data-val="1">新客户</li>
<li data-val="2">老客户</li>
</ul>
</div>
</dd>
</dl>
@if (in_array('check_test_order', $userPerms))
<dl>
<dt></dt>
......@@ -242,7 +256,7 @@
<td class="show-list"><?php print_r(App\Http\Controllers\getSalesName($v['sale_id'])); ?></td>
<td class="show-list" class="show-list">
<td class="show-list">
<?php
$shipping = App\Http\Controllers\getShipping($v['order_id']);
......@@ -276,7 +290,7 @@
}
?>
</td>
<td><?php echo App\Http\Controllers\getOrderAddress($v['order_id']); ?></td>
<td class="show-list"><?php echo App\Http\Controllers\getOrderAddress($v['order_id']); ?></td>
<td class="show-list">{{$username != 'vpadmin@ichunt.com' ? date('Y-m-d H:i:s', $v['create_time']) : date('Y-m-d', $v['create_time'])}}</td>
<td>
<div class="btn-group btn-group-xs">
......
......@@ -69,6 +69,7 @@
<li data-val="1">PC端</li>
<li data-val="2">移动端</li>
<li data-val="3">后台</li>
<li data-val="4">京东</li>
</ul>
</div>
</dd>
......@@ -111,6 +112,19 @@
<input type="text" name="order_source_ptag" value="{{$condition['order_source_ptag']}}" placeholder="请输入内容">
</dd>
</dl>
<dl>
<dt>用户标签:</dt>
<dd>
<div class="droplist" data-default="{{$condition['is_new']}}" name="is_new" id="is_new">
<ul class="dropdown-menu">
<li data-val="" class="active">全部</li>
<li data-val="0">用户</li>
<li data-val="1">新客户</li>
<li data-val="2">老客户</li>
</ul>
</div>
</dd>
</dl>
@if (in_array('self_check_test_order', $userPerms))
<dl>
......@@ -192,7 +206,7 @@
<td class="show-list"><?php print_r(App\Http\Controllers\getPayName($v['order_id'])); ?></td>
<td class="show-list"><?php echo App\Http\Controllers\getOrderSource($v['order_id']); ?></td>
<td class="show-list"><?php echo App\Http\Controllers\getOrderSource($v['order_id'], $v['order_type']); ?></td>
<td class="show-list" class="show-list">
<?php
......
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