| | |
| | | <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-input v-model="query.orderNo" placeholder="请输入订单编号" clearable style="width: 100%" /> |
| | | </el-form-item> |
| | | <el-form-item label="产品类型" class="col-25"> |
| | | <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> |
| | |
| | | <template #default="{ row }"> |
| | | <div v-if="row.isMainOrder" class="main-order-info"> |
| | | <div class="order-header"> |
| | | <div class="order-item status-item"> |
| | | <el-tag :type="getStatusType(row.status)" size="small">{{ row.statusName }}</el-tag> |
| | | </div> |
| | | |
| | | <div class="order-item"> |
| | | <span class="label">申请时间:</span> |
| | | <span class="value">{{ row.applyTime }}</span> |
| | |
| | | <div class="order-item"> |
| | | <span class="label">供应方:</span> |
| | | <span class="value">{{ row.supplySide }}</span> |
| | | </div> |
| | | <div class="order-item status-item"> |
| | | <el-tag :type="getStatusType(row.status)" size="small">{{ row.statusName }}</el-tag> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | </el-card> |
| | | |
| | | <!-- 订单状态对话框 --> |
| | | <ProductOrderStatusDialog |
| | | <!-- <ProductOrderStatusDialog |
| | | v-model="orderStatusDialogVisible" |
| | | :order-id="currentOrderId" |
| | | /> |
| | | /> --> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | 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) |
| | | } |
| | | |
| | | // 获取状态类型 |
| | |
| | | pageSize: page.size, |
| | | productName: query.productName || undefined, |
| | | orderId: query.orderNo || undefined, |
| | | userId: userStore.getUserId ? Number(userStore.getUserId) : undefined, |
| | | userId: userStore.getUserId ? userStore.getUserId : undefined, |
| | | } |
| | | if (query.status) payload.orderStatus = statusUiToServer[query.status] |
| | | if (Array.isArray(query.dateRange) && query.dateRange.length === 2) { |
| | | payload.applyTimeStart = query.dateRange[0] |
| | | payload.applyTimeEnd = query.dateRange[1] |
| | | } |
| | | |
| | | // 添加产品条件查询 |
| | | 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 |
| | | |
| | | const res = (await orderApi.getBuyerOrderPage(payload)) as any |
| | | // 根据是否有产品条件选择不同的API |
| | | const hasProductConditions = query.industry || query.unitProject || query.productType || query.productSubType |
| | | const apiMethod = hasProductConditions ? orderApi.getBuyerOrderPageWithProductConditions : orderApi.getBuyerOrderPage |
| | | |
| | | 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 toUpload = (row: any) => router.push({ name: 'tradeOrderUpload', params: { id: row.id } }) |
| | | const toConfirm = (row: any) => router.push({ name: 'tradeOrderConfirm', params: { id: row.id } }) |
| | | const toEvaluate = (row: any) => router.push({ name: 'tradeOrderEvaluate', params: { id: row.id } }) |
| | | const toTrack = (row: any) => router.push({ name: 'tradeTrack', params: { id: row.id } }) |
| | | const toTrack = (row: any) => { |
| | | if (!row.workFlowId) { |
| | | ElMessage.warning('该订单暂无工作流信息') |
| | | return |
| | | } |
| | | router.push({ name: 'tradeTrack', params: { id: row.workFlowId } }) |
| | | } |
| | | |
| | | // 追踪订单 - 显示订单状态对话框 |
| | | const showOrderTrack = (row: any) => { |
| | |
| | | toDetail(order) |
| | | break |
| | | case ActionType.TRACK: |
| | | showOrderTrack(order) |
| | | // showOrderTrack(order) |
| | | toTrack(order) |
| | | break |
| | | case ActionType.UPLOAD_FILE: |
| | | toUpload(order) |
| | |
| | | } |
| | | } |
| | | |
| | | 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"> |
| | |
| | | gap: 20px; |
| | | align-items: center; |
| | | overflow: hidden; |
| | | |
| | | .status-item{ |
| | | flex-direction: row-reverse; |
| | | } |
| | | .order-item { |
| | | display: flex; |
| | | align-items: center; |
| | | gap: 8px; |
| | | flex-shrink: 0; |
| | | flex: 1; |
| | | |
| | | .label { |
| | | color: #909399; |