Commit a869b895 by 朱继来

调整导出

parent e9e8b2b0
Showing with 27 additions and 10 deletions
......@@ -29,6 +29,9 @@ class OrderModel extends Model
if ($request->isMethod('get')) {
$map['order_type'] = $request->input('order_type', '');
$map['order_contain'] = $request->input('order_contain', '');
$map['order_sn'] = $request->input('order_sn', '');
$map['erp_sn'] = $request->input('erp_sn', '');
$map['goods_name'] = $request->input('goods_name', '');
$map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', '');
$map['order_status'] = $request->input('order_status', '');
......@@ -80,24 +83,38 @@ class OrderModel extends Model
->where(function ($query) use ($map) {
// 查询类型
if (!empty($map['order_contain'])) {
if ($map['order_type'] == 1) { // 会员账号
if ($map['order_type'] == 3) { // 发票抬头
$query->where('i.tax_title', '=', $map['order_contain']);
} else if($map['order_type'] == 4) { // 会员ID
$query->where('o.user_id', '=', $map['order_contain']);
} else { // 会员账号
if (preg_match('/@/', $map['order_contain'])) {
$query->where('u.email', '=', $map['order_contain']);
} else {
$query->where('u.mobile', '=', $map['order_contain']);
}
} else if ($map['order_type'] == 2) { // 型号名称
$query->where('it.goods_name', '=', $map['order_contain']);
} else if ($map['order_type'] == 3) { // 发票抬头
$query->where('i.tax_title', '=', $map['order_contain']);
} else if($map['order_type'] == 4) {
$query->where('o.user_id', '=', $map['order_contain']);
} else { // 订单编号
$query->where('o.order_sn', '=', $map['order_contain']);
}
}
}
})
->where(function ($query) use ($map) {
// 订单编号
if (!empty($map['order_sn'])) {
$query->where('o.order_sn', '=', $map['order_sn']);
}
})
->where(function ($query) use ($map) {
// ERP订单编号
if (!empty($map['erp_sn'])) {
$query->where('oe.erp_sn', '=', $map['erp_sn']);
}
})
->where(function ($query) use ($map) {
// 型号
if (!empty($map['goods_name'])) {
$query->where('it.goods_name', '=', $map['goods_name']);
}
})
->where(function ($query) use ($map) {
// 创建时间
if (!empty($map['time_start']) && !empty($map['time_end'])) {
$query->whereBetween('o.create_time', [$map['time_start'], $map['time_end']]);
......
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