| | |
| | | <el-input v-model="query.productName" placeholder="请输入产品名称" clearable style="width: 100%" /> |
| | | </el-form-item> |
| | | <el-form-item label="行业领域" class="col-25"> |
| | | <el-select v-model="query.industry" placeholder="请选择行业领域" clearable style="width: 100%"> |
| | | <el-select v-model="query.industry" placeholder="请选择行业领域" clearable style="width: 100%" @change="handleIndustryChange"> |
| | | <el-option v-for="item in industryOptions" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="产品类型" class="col-30"> |
| | | <el-select v-model="query.productType" placeholder="请选择产品类型" clearable style="width: 100%"> |
| | | <el-select v-model="query.productType" placeholder="请选择产品类型" clearable style="width: 100%" @change="handleProductTypeChange"> |
| | | <el-option v-for="item in productTypeOptions" :key="item.value" :label="item.label" :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | > |
| | | 查看 |
| | | </el-button> |
| | | <el-button |
| | | <!-- <el-button |
| | | v-else-if="action.type === ActionType.TRACK" |
| | | type="primary" |
| | | link |
| | |
| | | @click="handleAction(action, row.parentOrder)" |
| | | > |
| | | 追踪 |
| | | </el-button> |
| | | </el-button> --> |
| | | </template> |
| | | </div> |
| | | </div> |
| | |
| | | import { Search, Refresh } from '@element-plus/icons-vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import orderApi from '@/api/orderApi' |
| | | import productApi from '@/api/productApi' |
| | | import { useUserInfo } from '@/stores/modules/userInfo' |
| | | import ProductOrderStatusDialog from '@/views/productManage/productOrderStatusDialog/index.vue' |
| | | import { OrderWorkflowController, OrderStatus, ActionType, PageType, StatusMapper } from '@/utils/orderWorkflow' |
| | | import { queryUserDetail } from '@/api/userInfo' |
| | | |
| | | const router = useRouter() |
| | | const userStore = useUserInfo() |
| | |
| | | { label: '已评价', value: 'EVALUATED' }, |
| | | ] |
| | | |
| | | // 行业领域选项 |
| | | const industryOptions = [ |
| | | { label: '建筑工程', value: 'construction' }, |
| | | { label: '交通工程', value: 'transportation' }, |
| | | { label: '水利工程', value: 'water' }, |
| | | { label: '电力工程', value: 'power' }, |
| | | ] |
| | | |
| | | // 单位工程选项 |
| | | const unitProjectOptions = [ |
| | | { label: '土建工程', value: 'civil' }, |
| | | { label: '安装工程', value: 'installation' }, |
| | | { label: '装饰工程', value: 'decoration' }, |
| | | ] |
| | | |
| | | // 产品类型选项 |
| | | const productTypeOptions = [ |
| | | { label: '企业私有SaaS版许可', value: 'enterprise_private' }, |
| | | { label: '企业公有SaaS版许可', value: 'enterprise_public' }, |
| | | { label: '项目公有SaaS版许可', value: 'project_public' }, |
| | | { label: '个人公有SaaS版许可', value: 'personal_public' }, |
| | | ] |
| | | |
| | | // 产品类型子级选项 |
| | | const productSubTypeOptions = [ |
| | | { label: '基础版', value: 'basic' }, |
| | | { label: '标准版', value: 'standard' }, |
| | | { label: '高级版', value: 'premium' }, |
| | | ] |
| | | // 动态选项数据 |
| | | const industryOptions = ref<any[]>([]) |
| | | const unitProjectOptions = ref<any[]>([]) |
| | | const productTypeOptions = ref<any[]>([]) |
| | | const productSubTypeOptions = ref<any[]>([]) |
| | | |
| | | // 查询条件 |
| | | const query = reactive({ |
| | |
| | | if (/(协议|agreement)/i.test(s)) return 'agreement' |
| | | if (/(免费|free)/i.test(s)) return 'free' |
| | | return 'currency' |
| | | } |
| | | |
| | | // 获取行业领域选项 |
| | | const getIndustryOptions = async () => { |
| | | try { |
| | | const res = await productApi.getCategoryByParent({ parentCode: 'business_direction' }) |
| | | if (res?.code === 200 && res.data) { |
| | | industryOptions.value = res.data.map((item: any) => ({ |
| | | label: item.name, |
| | | value: item.id |
| | | })) |
| | | } |
| | | } catch (error) { |
| | | console.error('获取行业领域选项失败:', error) |
| | | } |
| | | } |
| | | |
| | | // 获取产品类型选项 |
| | | const getProductTypeOptions = async () => { |
| | | try { |
| | | const res = await productApi.getCategoryByParent({ parentCode: 'product_type' }) |
| | | if (res?.code === 200 && res.data) { |
| | | productTypeOptions.value = res.data.map((item: any) => ({ |
| | | label: item.name, |
| | | value: item.id |
| | | })) |
| | | } |
| | | } catch (error) { |
| | | console.error('获取产品类型选项失败:', error) |
| | | } |
| | | } |
| | | |
| | | // 根据行业领域获取单位工程选项 |
| | | const getUnitProjectOptions = async (industryCode: string) => { |
| | | if (!industryCode) { |
| | | unitProjectOptions.value = [] |
| | | return |
| | | } |
| | | try { |
| | | const res = await productApi.getCategoryByParent({ parentId: industryCode }) |
| | | if (res?.code === 200 && res.data) { |
| | | unitProjectOptions.value = res.data.map((item: any) => ({ |
| | | label: item.name, |
| | | value: item.id |
| | | })) |
| | | } |
| | | } catch (error) { |
| | | console.error('获取单位工程选项失败:', error) |
| | | unitProjectOptions.value = [] |
| | | } |
| | | } |
| | | |
| | | // 根据产品类型获取产品子级选项 |
| | | const getProductSubTypeOptions = async (productTypeCode: string) => { |
| | | if (!productTypeCode) { |
| | | productSubTypeOptions.value = [] |
| | | return |
| | | } |
| | | try { |
| | | const res = await productApi.getCategoryByParent({ parentId: productTypeCode }) |
| | | if (res?.code === 200 && res.data) { |
| | | productSubTypeOptions.value = res.data.map((item: any) => ({ |
| | | label: item.name, |
| | | value: item.id |
| | | })) |
| | | } |
| | | } catch (error) { |
| | | console.error('获取产品子级选项失败:', error) |
| | | productSubTypeOptions.value = [] |
| | | } |
| | | } |
| | | |
| | | // 处理行业领域变化 |
| | | const handleIndustryChange = async (value: string) => { |
| | | // 清空单位工程选择 |
| | | query.unitProject = '' |
| | | // 获取对应的单位工程选项 |
| | | await getUnitProjectOptions(value) |
| | | } |
| | | |
| | | // 处理产品类型变化 |
| | | const handleProductTypeChange = async (value: string) => { |
| | | // 清空产品子级选择 |
| | | query.productSubType = '' |
| | | // 获取对应的产品子级选项 |
| | | await getProductSubTypeOptions(value) |
| | | } |
| | | |
| | | |
| | |
| | | try { |
| | | // 获取用户ID作为providerId,如果没有则使用默认值 |
| | | const userId = userStore.getUserId |
| | | const providerId = userId ? Number(userId) : 1 // 使用默认值1作为临时解决方案 |
| | | const providerId = userId ? userId : '' // 使用默认值1作为临时解决方案 |
| | | |
| | | const payload: any = { |
| | | pageNum: page.current, |
| | |
| | | payload.applyTimeEnd = query.dateRange[1] |
| | | } |
| | | |
| | | const res = (await orderApi.getSellerOrderPage(payload)) as any |
| | | // 添加产品条件查询 |
| | | if (query.industry) payload.industryId = query.industry |
| | | if (query.unitProject) payload.unitProjectId = query.unitProject |
| | | if (query.productType) payload.productTypeId = query.productType |
| | | if (query.productSubType) payload.productSubTypeId = query.productSubType |
| | | |
| | | // 根据是否有产品条件选择不同的API |
| | | const hasProductConditions = query.industry || query.unitProject || query.productType || query.productSubType |
| | | const apiMethod = hasProductConditions ? orderApi.getSellerOrderPageWithProductConditions : orderApi.getSellerOrderPage |
| | | |
| | | const res = (await apiMethod(payload)) as any |
| | | const pageData = res?.data |
| | | const list: any[] = Array.isArray(pageData?.list) ? pageData.list : [] |
| | | page.total = Number(pageData?.total || 0) |
| | | |
| | | // 并发获取每个订单的详情(用于构造子订单行) |
| | | const detailsArr = await Promise.all( |
| | | list.map(async (order: any) => { |
| | | try { |
| | | const detailRes = (await orderApi.getOrderDetail(order.orderId)) as any |
| | | return detailRes?.data |
| | | } catch (e) { |
| | | return null |
| | | } |
| | | }) |
| | | ) |
| | | |
| | | const flatData: any[] = [] |
| | | list.forEach((order: any, idx: number) => { |
| | | list.forEach((order: any) => { |
| | | const uiStatus = statusServerToUi[order.orderStatus] || 'WAIT_UPLOAD' |
| | | const mainRow: any = { |
| | | id: order.orderId, |
| | |
| | | status: uiStatus, |
| | | statusName: order.orderStatus || '', |
| | | orderStatus: StatusMapper.toUIStatus(order.orderStatus), // 转换为标准状态枚举 |
| | | workFlowId: order.workflowId || '' |
| | | } |
| | | |
| | | const detail = detailsArr[idx] |
| | | const subOrders: any[] = Array.isArray(detail?.orderDetails) |
| | | ? detail.orderDetails.map((d: any, i: number) => ({ |
| | | const subOrders: any[] = Array.isArray(order?.orderDetails) |
| | | ? order.orderDetails.map((d: any, i: number) => ({ |
| | | id: `${order.orderId}-${i + 1}`, |
| | | isMainOrder: false, |
| | | productName: order.productName || '', |
| | |
| | | status: '', |
| | | dateRange: [], |
| | | }) |
| | | // 清空动态选项 |
| | | unitProjectOptions.value = [] |
| | | productSubTypeOptions.value = [] |
| | | page.current = 1 |
| | | handleSearch() |
| | | } |
| | |
| | | // 路由跳转 |
| | | const toDetail = (row: any) => router.push({ name: 'tradeOrderDetail', params: { id: row.id } }) |
| | | |
| | | onMounted(handleSearch) |
| | | onMounted(async ()=>{ |
| | | // 获取用户信息 |
| | | if (!userStore.getUserId) { |
| | | try { |
| | | const res: any = await queryUserDetail() |
| | | if (res?.code === 200 && res.data) { |
| | | userStore.updateUserDetail(res.data) |
| | | } else { |
| | | ElMessage.error(res?.msg || '无法获取用户信息,请先登录') |
| | | return |
| | | } |
| | | } catch (e) { |
| | | console.error('获取用户详情失败:', e) |
| | | ElMessage.error('获取用户信息失败,请稍后重试') |
| | | return |
| | | } |
| | | } |
| | | |
| | | // 获取初始选项数据 |
| | | await Promise.all([ |
| | | getIndustryOptions(), |
| | | getProductTypeOptions() |
| | | ]) |
| | | |
| | | // 执行搜索 |
| | | handleSearch() |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |