feat: 支持订单列表独立搜索快递单号和用户电话
This commit is contained in:
@@ -42,6 +42,8 @@ const manualForm = ref<AdminManualOrderCreatePayload>(createManualOrderForm());
|
|||||||
const manualAddressRecognitionText = ref("");
|
const manualAddressRecognitionText = ref("");
|
||||||
|
|
||||||
const keyword = ref("");
|
const keyword = ref("");
|
||||||
|
const trackingNo = ref("");
|
||||||
|
const userMobile = ref("");
|
||||||
const serviceProvider = ref("");
|
const serviceProvider = ref("");
|
||||||
const status = ref("");
|
const status = ref("");
|
||||||
const sourceChannel = ref("");
|
const sourceChannel = ref("");
|
||||||
@@ -201,6 +203,8 @@ async function fetchOrders() {
|
|||||||
try {
|
try {
|
||||||
const response = await adminApi.getOrders({
|
const response = await adminApi.getOrders({
|
||||||
keyword: keyword.value,
|
keyword: keyword.value,
|
||||||
|
tracking_no: trackingNo.value,
|
||||||
|
user_mobile: userMobile.value,
|
||||||
service_provider: serviceProvider.value,
|
service_provider: serviceProvider.value,
|
||||||
status: status.value,
|
status: status.value,
|
||||||
source_channel: sourceChannel.value,
|
source_channel: sourceChannel.value,
|
||||||
@@ -531,6 +535,8 @@ onMounted(fetchOrders);
|
|||||||
<el-card class="panel-card" shadow="never">
|
<el-card class="panel-card" shadow="never">
|
||||||
<div class="filters-row">
|
<div class="filters-row">
|
||||||
<el-input v-model="keyword" placeholder="搜索订单号 / 鉴定单号 / 商品名称" clearable style="width: 320px" />
|
<el-input v-model="keyword" placeholder="搜索订单号 / 鉴定单号 / 商品名称" clearable style="width: 320px" />
|
||||||
|
<el-input v-model="trackingNo" placeholder="搜索快递单号" clearable style="width: 180px" />
|
||||||
|
<el-input v-model="userMobile" placeholder="搜索用户电话" clearable style="width: 180px" />
|
||||||
<el-select v-model="serviceProvider" placeholder="服务类型" style="width: 160px">
|
<el-select v-model="serviceProvider" placeholder="服务类型" style="width: 160px">
|
||||||
<el-option v-for="item in providerOptions" :key="item.value" :label="item.label" :value="item.value" />
|
<el-option v-for="item in providerOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ class OrdersController
|
|||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$keyword = trim((string)$request->input('keyword', ''));
|
$keyword = trim((string)$request->input('keyword', ''));
|
||||||
|
$trackingNo = trim((string)$request->input('tracking_no', ''));
|
||||||
|
$userMobile = trim((string)$request->input('user_mobile', ''));
|
||||||
$status = trim((string)$request->input('status', ''));
|
$status = trim((string)$request->input('status', ''));
|
||||||
$serviceProvider = trim((string)$request->input('service_provider', ''));
|
$serviceProvider = trim((string)$request->input('service_provider', ''));
|
||||||
$sourceChannel = $this->normalizeOrderSourceChannel((string)$request->input('source_channel', ''));
|
$sourceChannel = $this->normalizeOrderSourceChannel((string)$request->input('source_channel', ''));
|
||||||
@@ -62,6 +64,30 @@ class OrdersController
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($trackingNo !== '') {
|
||||||
|
$query->whereRaw(
|
||||||
|
"EXISTS (SELECT 1 FROM order_logistics ol WHERE ol.order_id = o.id AND ol.logistics_type IN ('send_to_center', 'return_to_user') AND ol.tracking_no LIKE :tracking_no)",
|
||||||
|
[
|
||||||
|
'tracking_no' => "%{$trackingNo}%",
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($userMobile !== '') {
|
||||||
|
$query->leftJoin('users u', 'u.id = o.user_id')
|
||||||
|
->leftJoin('order_return_addresses ra', 'ra.order_id = o.id');
|
||||||
|
|
||||||
|
$query->where(function ($builder) use ($userMobile) {
|
||||||
|
$builder->whereRaw(
|
||||||
|
'(u.mobile LIKE :user_mobile OR ra.mobile LIKE :return_mobile)',
|
||||||
|
[
|
||||||
|
'user_mobile' => "%{$userMobile}%",
|
||||||
|
'return_mobile' => "%{$userMobile}%",
|
||||||
|
]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$warehouseStatusFilters = [
|
$warehouseStatusFilters = [
|
||||||
'warehouse_active',
|
'warehouse_active',
|
||||||
'warehouse_pending_inbound',
|
'warehouse_pending_inbound',
|
||||||
|
|||||||
Reference in New Issue
Block a user