Commit 9074e630 by 朱继来

fix

parents e691f3bf 330616dd
......@@ -363,6 +363,7 @@ 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['is_new_order'] = $request->input('is_new_order', '');
}
// 订单查看权限---交易员、客服、测试
......@@ -1691,4 +1692,32 @@ Class OrderController extends Controller
echo '一年增票订单数:'.$yearAddInvoice.'<br>';
}
// 检查历史订单数据
public function checkHistroyOrder(Request $request)
{
// 查找用户订单数,并更新用户表和订单扩展表
$subQuery = OrderModel::where('is_type', '=', 0)->orderBy('order_id');
OrderModel::from(DB::raw("({$subQuery->toSql()}) as sub"))
->mergeBindings($subQuery->getQuery())
->select(DB::raw('sub.user_id, sub.order_id, count(*) as order_count'))
->groupBy('sub.user_id')
->chunk(100, function($orderCount) {
foreach ($orderCount as $k=>$v) {
if ($v->order_count == 1) {
$new_user['is_new'] = 1; // 新用户
$new_order['is_new'] = 1; // 新订单
} else {
$new_user['is_new'] = 2; // 老用户
$new_order['is_new'] = 1; // 多订单将第一个订单设置为新订单
}
// 更新用户
DB::connection('order')->table('lie_user_main')->where('user_id', $v->user_id)->update($new_user);
// 更新订单
DB::connection('order')->table('lie_order_extend')->where('order_id', $v->order_id)->update($new_order);
}
});
}
}
\ No newline at end of file
......@@ -86,6 +86,8 @@
return 7;
} else if ($department->name == '运营助理') {
return 8;
} else if ($department->name == '财务') {
return 9;
} else {
return 0;
}
......
......@@ -110,6 +110,6 @@ Route::group(['middleware' => 'web'], function () {
Route::group(['middleware' => 'api'], function () {
Route::get ('/api/check/sendsms', 'OrderController@checkOrderSendSms');
Route::get ('/api/check/cancelorder', 'OrderController@checkOrderCancel');
Route::get ('/api/check/cancelselforder', 'OrderController@selfOrderCancel');
Route::get ('/api/check/histroyorder', 'OrderController@checkHistroyOrder');
});
......@@ -44,6 +44,8 @@ class OrderModel extends Model
$map['order_payment_mode'] = $request->input('order_payment_mode', '');
$map['order_invoice_status'] = $request->input('order_invoice_status', '');
$map['order_goods_type'] = $request->input('order_goods_type', '');
$map['is_new'] = $request->input('is_new', '');
$map['is_new_order'] = $request->input('is_new_order', '');
}
/* 临时添加 所有人只能查看线上订单 */
......@@ -187,9 +189,21 @@ class OrderModel extends Model
$query->where('i.inv_type', '=', $map['order_invoice_status']);
}
})
->where(function ($query) use ($map) {
// 是否为新用户
if ($map['is_new'] != '') {
$query->where('u.is_new', '=', $map['is_new']);
}
})
->where(function ($query) use ($map) {
// 是否新订单
if ($map['is_new_order'] != '') {
$query->where('oe.is_new', '=', $map['is_new_order']);
}
})
->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.single_pre_price', 'it.brand_name', '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.tax_title', 'i.inv_type', 'i.invoice_status', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'a.consignee', 'a.address', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'c.com_name', 'oe.send_remark')
->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', '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.tax_title', 'i.inv_type', 'i.invoice_status', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'a.consignee', 'a.address', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'c.com_name', 'oe.send_remark', 'oe.is_new as is_new_order')
->groupBy('it.rec_id')
->orderBy('o.create_time', 'DESC')
->get()
......@@ -200,7 +214,7 @@ class OrderModel extends Model
$cellData = $this->exportList($list);
// 标题
$headerCell = ['订单ID', '订单编号', '会员账号', '是否为新用户', '收货人', '下单日期', '下单时间', '客户名称', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', $sale_name, '商品总额', '运费', '附加费', '优惠券', '订单总额', '订单类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注'];
$headerCell = ['订单ID', '订单编号', '会员账号', '是否为新用户', '是否为新订单', '收货人', '下单日期', '下单时间', '客户名称', '商品型号', '制造商', '供应商', '数量', '单价', '均摊后单价', '商品小计', '币种', $sale_name, '商品总额', '运费', '附加费', '优惠券', '订单总额', '订单类型', '订单状态', '发货状态', '收货地址', '发票类型', '发票状态', '发票抬头', '公司注册地址', '公司电话', 'adtags来源', '新用户来源', '取消原因', '推送备注'];
array_unshift($cellData, $headerCell);
......@@ -284,6 +298,7 @@ class OrderModel extends Model
$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]['is_new'] = $order[$i]['is_new'] == 1 ? '是' : '否'; // 是否为新用户
$tmp[$i]['is_new_order'] = $order[$i]['is_new_order'] == 1 ? '是' : '否'; // 是否为新订单
$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']);
......
......@@ -82,6 +82,7 @@
test_order = $('input[name=test_order]'),
erp_order_id = $('#erp_order_id').data('default'),
is_new = $('#is_new').val(),
is_new_order = $('#is_new_order').data('default'),
listUrl = '/list';
listUrl += '?order_type=' + order_type;
......@@ -142,11 +143,15 @@
listUrl += '&is_new=' + is_new;
}
if (is_new_order) {
listUrl += '&is_new_order=' + is_new_order;
}
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 && (is_new === '') && !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 === '') && !is_new_order && !test_order.is(':checked')) {
listUrl = '/list';
}
......@@ -170,14 +175,15 @@
erp_order_id = $('#erp_order_id').data('default'),
test_order = $('input[name=test_order]'),
is_new = $('#is_new').val() ? $('#is_new').val() : '';
is_new_order = $('#is_new_order').data('default');
if (test_order.length) {
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 && !is_new_order && !test_order.is(':checked')) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
} else {
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) {
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 && !is_new_order) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
......@@ -201,7 +207,7 @@
test_order = '';
}
location.href = '/export?order_type='+order_type+'&order_contain='+order_contain+'&time_start='+time_start+'&time_end='+time_end+'&order_pay_type='+order_pay_type+'&order_status='+order_status+'&shipping_name='+shipping_name+'&order_send='+order_send+'&order_source_pf='+order_source_pf+'&order_source_adtag='+order_source_adtag+'&order_source_ptag='+order_source_ptag+'&erp_order_id='+erp_order_id+'&test_order='+test_order+'&is_new='+is_new+'&order_goods_type='+1;
location.href = '/export?order_type='+order_type+'&order_contain='+order_contain+'&time_start='+time_start+'&time_end='+time_end+'&order_pay_type='+order_pay_type+'&order_status='+order_status+'&shipping_name='+shipping_name+'&order_send='+order_send+'&order_source_pf='+order_source_pf+'&order_source_adtag='+order_source_adtag+'&order_source_ptag='+order_source_ptag+'&erp_order_id='+erp_order_id+'&test_order='+test_order+'&is_new='+is_new+'&is_new_order='+is_new_order+'&order_goods_type='+1;
})
// 选择查看测试订单
......
......@@ -21,6 +21,7 @@
order_source_ptag = $('input[name="order_source_ptag"]').val(),
test_order = $('input[name=test_order]'),
is_new = $('#is_new').data('default'),
is_new_order = $('#is_new_order').data('default'),
listUrl = '/self_order';
listUrl += '?order_type=' + order_type;
......@@ -77,11 +78,16 @@
listUrl += '&is_new=' + is_new;
}
if (is_new_order !== '') {
listUrl += '&is_new_order=' + is_new_order;
}
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_source_pf && !order_source_adtag && !order_source_ptag && (is_new === '') && !test_order.is(':checked')) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag && (is_new === '') && !is_new_order && !test_order.is(':checked')) {
listUrl = '/self_order';
}
......@@ -102,15 +108,17 @@
order_invoice_status = $('#order_invoice_status').data('default'),
order_source_adtag = $('input[name="order_source_adtag"]').val(),
order_source_ptag = $('input[name="order_source_ptag"]').val(),
is_new = $('#is_new').data('default'),
is_new_order = $('#is_new_order').data('default'),
test_order = $('input[name=test_order]');
if (test_order.length) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !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 && !sale_type && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag && !is_new && !is_new_order && !test_order.is(':checked')) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
} else {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag) {
if (!order_contain && !time_start && !time_end && !order_payment_mode && !order_status && !sale_type && !order_invoice_status && !order_source_pf && !order_source_adtag && !order_source_ptag && !is_new && !is_new_order) {
layer.msg('请选择筛选条件,再导出!');
return false;
}
......@@ -130,7 +138,7 @@
test_order = '';
}
location.href = '/export?order_type='+order_type+'&order_contain='+order_contain+'&time_start='+time_start+'&time_end='+time_end+'&order_payment_mode='+order_payment_mode+'&order_status='+order_status+'&sale_type='+sale_type+'&order_invoice_status='+order_invoice_status+'&order_source_pf='+order_source_pf+'&order_source_adtag='+order_source_adtag+'&order_source_ptag='+order_source_ptag+'&test_order='+test_order+'&order_goods_type='+2;
location.href = '/export?order_type='+order_type+'&order_contain='+order_contain+'&time_start='+time_start+'&time_end='+time_end+'&order_payment_mode='+order_payment_mode+'&order_status='+order_status+'&sale_type='+sale_type+'&order_invoice_status='+order_invoice_status+'&order_source_pf='+order_source_pf+'&order_source_adtag='+order_source_adtag+'&order_source_ptag='+order_source_ptag+'&test_order='+test_order+'&is_new='+is_new+'&is_new_order='+is_new_order+'&order_goods_type='+2;
})
// 选择查看测试订单
......
......@@ -170,6 +170,18 @@
</div> -->
</dd>
</dl>
<dl>
<dt>新订单:</dt>
<dd style="width: 115px;">
<div class="droplist" data-default="{{$condition['is_new_order']}}" id="is_new_order" name="is_new_order">
<ul class="dropdown-menu">
<li data-val="" class="active">全部</li>
<li data-val="1"></li>
<li data-val="0"></li>
</ul>
</div>
</dd>
</dl>
@if (in_array('check_test_order', $userPerms))
<dl>
......
......@@ -147,6 +147,18 @@
</div>
</dd>
</dl>
<dl>
<dt>新订单:</dt>
<dd style="width: 115px;">
<div class="droplist" data-default="{{$condition['is_new_order']}}" id="is_new_order" name="is_new_order">
<ul class="dropdown-menu">
<li data-val="" class="active">全部</li>
<li data-val="1"></li>
<li data-val="0"></li>
</ul>
</div>
</dd>
</dl>
@if (in_array('self_check_test_order', $userPerms))
<dl>
......
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