From a8f59183dfae5c872355e6e2b92bf674e66db4a1 Mon Sep 17 00:00:00 2001 From: zlwu <704541015@qq.com> Date: Mon, 3 Aug 2026 22:39:36 +0800 Subject: [PATCH] feat(mobile-h5): add CRM/PL option APIs and select-only pickers Provide customer/product/vehicle pickers that search portal master data without create-on-type. Co-authored-by: Cursor --- mobile-h5/src/api/crmOptionsApi.ts | 46 ++++++ mobile-h5/src/api/vehicleOptionsApi.ts | 45 ++++++ .../components/pickers/DbCustomerPicker.vue | 102 +++++++++++++ .../components/pickers/DbProductPicker.vue | 109 ++++++++++++++ .../components/pickers/DbVehiclePicker.vue | 135 ++++++++++++++++++ 5 files changed, 437 insertions(+) create mode 100644 mobile-h5/src/api/crmOptionsApi.ts create mode 100644 mobile-h5/src/api/vehicleOptionsApi.ts create mode 100644 mobile-h5/src/components/pickers/DbCustomerPicker.vue create mode 100644 mobile-h5/src/components/pickers/DbProductPicker.vue create mode 100644 mobile-h5/src/components/pickers/DbVehiclePicker.vue diff --git a/mobile-h5/src/api/crmOptionsApi.ts b/mobile-h5/src/api/crmOptionsApi.ts new file mode 100644 index 000000000..0e597ecd8 --- /dev/null +++ b/mobile-h5/src/api/crmOptionsApi.ts @@ -0,0 +1,46 @@ +import api from '@/utils/http' + +export interface CrmCustomerOption { + id: string + customerName: string + customerNo?: string +} + +export interface CrmProductOption { + id: string + productName: string + model?: string + unit?: string + status?: string +} + +function extractList(res: unknown): T[] { + const data = (res as { list?: T[]; rows?: T[] }) || {} + return data.list || data.rows || [] +} + +/** CRM 客户远程搜索(只读) */ +export async function fetchCustomerOptions(keyword?: string): Promise { + const res = await api.post<{ list?: CrmCustomerOption[] }>({ + url: '/web/crm/customer/list', + data: { + page: 1, + pageSize: keyword?.trim() ? 50 : 20, + ...(keyword?.trim() ? { customerName: keyword.trim() } : {}) + } + }) + return extractList(res) +} + +/** CRM 产品远程搜索(只读) */ +export async function fetchProductOptions(keyword?: string): Promise { + const res = await api.post<{ list?: CrmProductOption[] }>({ + url: '/web/crm/products/list', + data: { + page: 1, + pageSize: keyword?.trim() ? 50 : 20, + ...(keyword?.trim() ? { productName: keyword.trim() } : {}) + } + }) + return extractList(res) +} diff --git a/mobile-h5/src/api/vehicleOptionsApi.ts b/mobile-h5/src/api/vehicleOptionsApi.ts new file mode 100644 index 000000000..f2bd06372 --- /dev/null +++ b/mobile-h5/src/api/vehicleOptionsApi.ts @@ -0,0 +1,45 @@ +import api from '@/utils/http' + +export interface VehicleOption { + id: string + licensePlate: string + vehicleType?: string +} + +function extractList(res: unknown): T[] { + const data = (res as { list?: T[]; rows?: T[]; items?: T[] }) || {} + return data.list || data.rows || data.items || (Array.isArray(res) ? (res as T[]) : []) +} + +/** 登录态:运输车辆(自有 + 三方),只读搜索 */ +export async function fetchVehicleOptions(q?: string): Promise { + const res = await api.get<{ list?: VehicleOption[]; total?: number }>({ + url: '/transport/vehicle', + params: { + ...(q?.trim() ? { q: q.trim() } : {}), + page: 1, + pageSize: 100 + } + }) + return extractList(res) +} + +/** 免登:现场页车牌 options(依赖 Task 6 公共接口) */ +export async function fetchPublicVehiclePlates(params: { + q?: string + inventoryId?: string + planId?: string +}): Promise> { + const res = await api.get | { + list?: Array<{ licensePlate: string; vehicleType?: string }> + }>({ + url: '/public/db/vehicle-plates', + params: { + q: params.q, + inventoryId: params.inventoryId, + planId: params.planId + } + }) + if (Array.isArray(res)) return res + return extractList(res) +} diff --git a/mobile-h5/src/components/pickers/DbCustomerPicker.vue b/mobile-h5/src/components/pickers/DbCustomerPicker.vue new file mode 100644 index 000000000..a7b352903 --- /dev/null +++ b/mobile-h5/src/components/pickers/DbCustomerPicker.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/mobile-h5/src/components/pickers/DbProductPicker.vue b/mobile-h5/src/components/pickers/DbProductPicker.vue new file mode 100644 index 000000000..95d3c6421 --- /dev/null +++ b/mobile-h5/src/components/pickers/DbProductPicker.vue @@ -0,0 +1,109 @@ + + + + + diff --git a/mobile-h5/src/components/pickers/DbVehiclePicker.vue b/mobile-h5/src/components/pickers/DbVehiclePicker.vue new file mode 100644 index 000000000..54690fe4f --- /dev/null +++ b/mobile-h5/src/components/pickers/DbVehiclePicker.vue @@ -0,0 +1,135 @@ + + + + +