Commit eb052984 by 张立顺

feat 场景功能开发

1 parent 0cb8e6dc
import request from './request'
/** 施工单分页查询 */
export const CONSTRUCTION_INFO_PAGE = 'dj.api.smarcarlife.construction.info.page'
/** 施工单导出(异步任务),与下载中心配合时在 exportParam 内带 method 字段 */
export const CONSTRUCTION_INFO_EXPORT = 'dj.api.smarcarlife.construction.info.export'
/** 施工单-技师列表(筛选用) */
export const CONSTRUCTION_TECHNICIAN_LIST = 'dj.api.smarcarlife.construction.technician.list'
/** 施工单-门店列表(筛选用) */
export const CONSTRUCTION_MERCHANT_LIST = 'dj.api.smarcarlife.construction.merchant.list'
/** 施工单-驻店/转化人员列表(筛选用) */
export const CONSTRUCTION_SELLER_LIST = 'dj.api.smarcarlife.construction.seller.list'
export function constructionInfoPage(data) {
return request({ ...data, method: CONSTRUCTION_INFO_PAGE }, 'post')
}
/**
* 技师列表,返回 technicianUuid / technicianName / staffPhone 等
* @param {Object} [data] 无文档时与分页类接口一致,可按需传 currentPage、pageSize
*/
export function constructionTechnicianList(data) {
return request({ ...data, method: CONSTRUCTION_TECHNICIAN_LIST }, 'post')
}
/**
* 门店列表,返回 merchantId、merchantName
* @param {Object} [data] 无文档时与分页类接口一致
*/
export function constructionMerchantList(data) {
return request({ ...data, method: CONSTRUCTION_MERCHANT_LIST }, 'post')
}
/**
* 驻店/转化人员列表,返回 sellerUserId、sellerName
* @param {Object} [data] 无文档时与分页类接口一致
*/
export function constructionSellerList(data) {
return request({ ...data, method: CONSTRUCTION_SELLER_LIST }, 'post')
}
...@@ -23,6 +23,14 @@ export function getOrderCount(data) { ...@@ -23,6 +23,14 @@ export function getOrderCount(data) {
return request(data) return request(data)
} }
/** 存在订单数据的场景列表;bizTypeCode 1-轻改 2-权益;businessType 可选 1-会员权益 2-延保 */
export function sceneListWithOrder(data = {}) {
return request({
method: "dj.smartcarlife.api.scene.list.with.order",
...data,
})
}
// 待补录订单统计(交易记录条数,已补录数,待补录数) // 待补录订单统计(交易记录条数,已补录数,待补录数)
export function waitinputorderCount(data) { export function waitinputorderCount(data) {
data.method = `${path2}waitinputorder.count` data.method = `${path2}waitinputorder.count`
......
...@@ -64,11 +64,6 @@ export const routerName = { ...@@ -64,11 +64,6 @@ export const routerName = {
authId: "90403", authId: "90403",
name: "订单详情", name: "订单详情",
parentId: "90401" parentId: "90401"
},
{
authId: "90410",
name: "订单详情",
parentId: "90401"
} }
] ]
}, },
...@@ -773,16 +768,49 @@ export const routerName = { ...@@ -773,16 +768,49 @@ export const routerName = {
], ],
component: _import("orderManage/referralAudit") component: _import("orderManage/referralAudit")
}, },
90411: {
path: "/constructionOrder",
name: "constructionOrder",
meta: {
title: "施工单",
authId: "90411",
parentId: "904",
cache: false
},
auth: [
{
authId: "9041101",
parentId: "90411",
label: "导出数据",
category: "Button",
type: "primary",
handle: "handleExport"
},
{
authId: "9041102",
parentId: "90411",
label: "查看详情",
handle: "handleDetail",
addRoutePath: [
{
authId: "90410",
name: "施工单详情",
parentId: "90411"
}]
}
],
component: _import("orderManage/constructionOrder/index")
},
90410: { 90410: {
path: "/constructionOrderDetail", path: "/constructionOrderDetail",
name: "constructionOrderDetail", name: "constructionOrderDetail",
meta: { meta: {
title: "施工单详情", title: "施工单详情",
authId: "90410", authId: "90410",
parentId: "90401", parentId: "90411",
cache: false, cache: false,
activePath: "/orderList" activePath: "/constructionOrder"
}, },
component: _import("orderManage/constructionOrderDetail") component: _import("orderManage/constructionOrder/detail")
} }
} }
...@@ -257,6 +257,16 @@ export default { ...@@ -257,6 +257,16 @@ export default {
ruleInfoDialog, ruleInfoDialog,
newSignRefundDialog newSignRefundDialog
}, },
props: {
baseSceneCode: {
type: String,
default: "",
},
sceneBusinessType: {
type: [Number, String],
default: undefined,
},
},
data() { data() {
return { return {
showNum: false, showNum: false,
...@@ -436,6 +446,16 @@ export default { ...@@ -436,6 +446,16 @@ export default {
} }
if (params.orderStatuses.includes("3") && params.requestSource == "0") { delete params.requestSource } if (params.orderStatuses.includes("3") && params.requestSource == "0") { delete params.requestSource }
delete params.createDate delete params.createDate
if (this.baseSceneCode) {
params.baseSceneCode = this.baseSceneCode
}
if (
this.sceneBusinessType !== undefined
&& this.sceneBusinessType !== null
&& this.sceneBusinessType !== ""
) {
params.businessType = Number(this.sceneBusinessType)
}
return params return params
}, },
...@@ -1096,6 +1116,7 @@ export default { ...@@ -1096,6 +1116,7 @@ export default {
line-height: 20px; line-height: 20px;
} }
/* 订单列表页:一级 tab + 二级子项,顶部留白(原单层 tab 为 m-t-40) */
.m-t-94 { .m-t-94 {
margin-top: 94px; margin-top: 94px;
} }
......
<!-- 施工单列表(布局占位,字段与接口待对接) -->
<template>
<div class="construction-order-list">
<d2-container class="m-t-40">
<div class="header" slot="header">
<d2-search
ref="showSearch"
class="show-search"
:search-form="searchForm"
:label-width="'150px'"
:form-data="searchFormData"
/>
<div class="up-btns">
<el-button type="primary" size="small" @click="handleSearch"> 查询 </el-button>
<el-button size="small" @click="handleReset"> 重置 </el-button>
</div>
</div>
<div class="tab-list construction-order__body">
<div class="export-bar">
<el-button type="primary" size="small" @click="handleExport"> 导出数据 </el-button>
</div>
<d2-table
ref="constructionTable"
:has-num="true"
:search-form="tableSearchForm"
:table-params="tableParams"
:get-list-api="getListApi"
:before-search-fn="beforeSearchFn"
>
<div slot="technicianCol" slot-scope="{ scope: row }" class="cell-multiline">
{{ row.technicianText || '-' }}
</div>
<div slot="serviceItemsCol" slot-scope="{ scope: row }" class="cell-stacked">
<div v-for="(line, idx) in (row.serviceLines || [{ name: '-' }])" :key="'s' + idx" class="cell-stacked__line">
{{ line.name }}
</div>
</div>
<div slot="actualOutCol" slot-scope="{ scope: row }" class="cell-stacked">
<div v-for="(line, idx) in (row.actualOutLines || ['-'])" :key="'a' + idx" class="cell-stacked__line">
{{ line }}
</div>
</div>
<div slot="constructionStatusCol" slot-scope="{ scope: row }" class="status-cell">
<span
:class="['table-circle', 'm-r-8', statusDotClass(row.constructionStatus)]"
/>
<span>{{ row.constructionStatusText || '-' }}</span>
</div>
<div slot="constructionTagCol" slot-scope="{ scope: row }" class="status-cell">
<span :class="['table-circle', 'm-r-8', tagDotClass(row.constructionTag)]" />
<span>{{ row.constructionTagText || '-' }}</span>
</div>
<div slot="constructionPhotoCol" slot-scope="{ scope: row }" class="thumb-cell">
<el-image
v-if="row.constructionPhotoUrl"
class="thumb-cell__img"
:src="row.constructionPhotoUrl"
fit="cover"
/>
<span v-else>-</span>
</div>
<div slot="auth-button" slot-scope="btnScope" class="action-cell">
<el-button type="text" size="small" @click="openDetail(btnScope.scope)"> 详情 </el-button>
</div>
</d2-table>
</div>
</d2-container>
</div>
</template>
<script>
import { buildMockBaseRows } from './constructionOrderMock'
const PLACEHOLDER_SELECT = [
{ confId: '', confName: '全部' },
{ confId: '1', confName: '示例一' },
{ confId: '2', confName: '示例二' }
]
const MOCK_BASE = buildMockBaseRows()
export default {
name: 'ConstructionOrder',
data() {
return {
searchForm: {
constructionCode: '',
storeId: '',
mainOrderCode: '',
technicianId: '',
carModel: '',
conversionStaff: '',
constructionStatus: '',
constructionTag: '',
dispatchTimeRange: [],
claimTimeRange: [],
completeTimeRange: []
},
searchFormData: [],
tableSearchForm: {},
tableParams: {
listName: 'list',
btnId: `construction_order_${new Date().getTime() + parseInt(String(Math.random() * 1000), 10)}`,
tableOption: {
width: '100',
align: 'center'
},
tableColumns: []
}
}
},
created() {
this.initSearchFormData()
this.initTableColumns()
},
methods: {
getListApi(params) {
const pageSize = params.pageSize || 10
const currentPage = params.currentPage || 1
const start = (currentPage - 1) * pageSize
const list = []
for (let i = 0; i < pageSize; i++) {
const base = { ...MOCK_BASE[(start + i) % MOCK_BASE.length] }
base.id = `row-${currentPage}-${i}`
list.push(base)
}
return Promise.resolve({
list,
total: 200,
pageNum: currentPage,
pageSize
})
},
beforeSearchFn() {
return new Promise((resolve) => {
this.tableSearchForm = { ...this.getParams() }
resolve()
})
},
getParams() {
return JSON.parse(JSON.stringify(this.searchForm))
},
handleSearch() {
if (this.$refs.constructionTable) {
this.$refs.constructionTable.refreshTable(true, true)
}
},
handleReset() {
this.searchForm = {
constructionCode: '',
storeId: '',
mainOrderCode: '',
technicianId: '',
carModel: '',
conversionStaff: '',
constructionStatus: '',
constructionTag: '',
dispatchTimeRange: [],
claimTimeRange: [],
completeTimeRange: []
}
if (this.$refs.constructionTable) {
this.$refs.constructionTable.refreshTable(true, true)
}
},
handleExport() {
this.$message.info('导出功能待接口对接后开放')
},
statusDotClass(s) {
if (s === 'done') return 'back-green'
if (s === 'custom') return 'back-red'
if (s === 'wait') return 'back-orange'
return 'back-grey'
},
tagDotClass(s) {
if (s === 'done') return 'back-green'
if (s === 'out' || s === 'wait') return 'back-orange'
return 'back-grey'
},
openDetail(row) {
if (!row || !row.constructionCode) return
this.$router.push({
name: 'constructionOrderDetail',
query: { constructionCode: row.constructionCode }
})
},
initSearchFormData() {
const opt = {
optionId: 'confId',
optionLabel: 'confName',
optionList: PLACEHOLDER_SELECT
}
this.searchFormData = [
{ label: '施工单编号', name: 'constructionCode', type: 'input' },
{ label: '门店名称', name: 'storeId', type: 'select', isClear: true, ...opt },
{ label: '主订单编号', name: 'mainOrderCode', type: 'input' },
{ label: '技师姓名', name: 'technicianId', type: 'select', isClear: true, ...opt },
{ label: '客户车型', name: 'carModel', type: 'input' },
{ label: '转化人员', name: 'conversionStaff', type: 'select', isClear: true, ...opt },
{ label: '施工状态', name: 'constructionStatus', type: 'select', isClear: true, ...opt },
{ label: '施工标记', name: 'constructionTag', type: 'select', isClear: true, ...opt },
{
label: '派单时间',
name: 'dispatchTimeRange',
type: 'datePicker',
isClear: true,
dateType: 'datetimerange'
},
{
label: '领单时间',
name: 'claimTimeRange',
type: 'datePicker',
isClear: true,
dateType: 'datetimerange'
},
{
label: '完工时间',
name: 'completeTimeRange',
type: 'datePicker',
isClear: true,
dateType: 'datetimerange'
}
]
},
initTableColumns() {
const center = { align: 'center' }
this.tableParams.tableColumns = [
{ label: '施工单编号', prop: 'constructionCode', minWidth: 150, showOverFlow: true, ...center },
{ label: '门店名称', prop: 'storeName', minWidth: 200, showOverFlow: true, ...center },
{ label: '技师姓名', prop: 'technicianText', minWidth: 160, addHtml: 'technicianCol', ...center },
{ label: '主订单编号', prop: 'mainOrderCode', minWidth: 150, showOverFlow: true, ...center },
{ label: '客户车型', prop: 'carModel', minWidth: 120, ...center },
{ label: '转化人员', prop: 'conversionStaff', minWidth: 100, ...center },
{ label: '服务项目', prop: 'serviceLines', minWidth: 120, addHtml: 'serviceItemsCol', ...center },
{ label: '实际出库数量(米/件)', prop: 'actualOutLines', minWidth: 140, addHtml: 'actualOutCol', ...center },
{ label: '子订单编号', prop: 'subOrderCode', minWidth: 150, showOverFlow: true, ...center },
{ label: '子商品名称', prop: 'subProductName', minWidth: 140, showOverFlow: true, ...center },
{ label: '物料编码', prop: 'materialCode', minWidth: 150, showOverFlow: true, ...center },
{ label: '施工状态', prop: 'constructionStatus', minWidth: 120, addHtml: 'constructionStatusCol', ...center },
{ label: '施工标记', prop: 'constructionTag', minWidth: 120, addHtml: 'constructionTagCol', ...center },
{ label: '派单时间', prop: 'dispatchTime', minWidth: 160, ...center },
{ label: '领单时间', prop: 'claimTime', minWidth: 160, ...center },
{ label: '完工时间', prop: 'completeTime', minWidth: 160, ...center },
{ label: '施工图片', prop: 'constructionPhotoUrl', minWidth: 100, addHtml: 'constructionPhotoCol', ...center }
]
}
}
}
</script>
<style lang="scss" scoped>
.construction-order-list {
/* 列表单元格文字默认居中(含非插槽列) */
::v-deep .el-table th > .cell,
::v-deep .el-table td > .cell {
text-align: center;
}
.construction-order__body {
background: #fff;
width: 100%;
margin-top: 16px;
padding: 20px 40px 24px;
box-sizing: border-box;
}
.export-bar {
text-align: center;
margin-bottom: 16px;
}
.cell-multiline {
text-align: center;
}
.cell-stacked {
padding: 4px 0;
text-align: center;
}
.cell-stacked__line {
line-height: 22px;
padding: 2px 0;
text-align: center;
}
.status-cell {
display: inline-flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
width: 100%;
text-align: center;
}
.thumb-cell {
text-align: center;
&__img {
width: 48px;
height: 48px;
border-radius: 4px;
}
}
.action-cell {
text-align: center;
}
}
.m-t-40 {
margin-top: 40px;
}
</style>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
:key="'st' + i" :key="'st' + i"
class="staff-card" class="staff-card"
> >
<div class="staff-card__avatar">{{ p.name && p.name.charAt(0) }}</div> <div class="staff-card__avatar">{{ nameInitial(p.name) }}</div>
<div class="staff-card__meta"> <div class="staff-card__meta">
<div class="staff-card__name">{{ p.name }}</div> <div class="staff-card__name">{{ p.name }}</div>
<el-tag size="small" type="info" class="staff-card__tag">{{ p.roleLabel }}</el-tag> <el-tag size="small" type="info" class="staff-card__tag">{{ p.roleLabel }}</el-tag>
...@@ -131,9 +131,9 @@ ...@@ -131,9 +131,9 @@
</template> </template>
<script> <script>
import { buildMockBaseRows, buildDetailFormFromListRow } from './constructionOrderMock' import { mapApiRowToDetailForm } from './listMap'
const MOCK_ROWS = buildMockBaseRows() const SESSION_DETAIL_KEY = 'CONSTRUCTION_ORDER_DETAIL'
const emptyForm = () => ({ const emptyForm = () => ({
constructionCode: '', constructionCode: '',
...@@ -168,21 +168,35 @@ export default { ...@@ -168,21 +168,35 @@ export default {
methods: { methods: {
loadDetail() { loadDetail() {
const code = this.$route.query.constructionCode const code = this.$route.query.constructionCode
const raw = sessionStorage.getItem(SESSION_DETAIL_KEY)
if (raw) {
try {
const row = JSON.parse(raw)
if (row && row.constructionCode && String(row.constructionCode) === String(code)) {
try {
const form = mapApiRowToDetailForm(row)
this.detailForm = form && typeof form === 'object' ? form : emptyForm()
} catch (e) {
this.detailForm = emptyForm()
}
return
}
} catch (e) {
// ignore
}
}
if (!code) { if (!code) {
this.detailForm = emptyForm() this.detailForm = emptyForm()
return return
} }
const row = MOCK_ROWS.find((r) => r.constructionCode === code) || MOCK_ROWS[0] this.detailForm = emptyForm()
this.detailForm = buildDetailFormFromListRow(row) },
nameInitial(name) {
if (name == null || name === '') return ''
return String(name).charAt(0) || ''
}, },
handleBack() { handleBack() {
this.$router.push({ this.$router.push({ path: '/constructionOrder' })
name: 'orderList',
params: {
tabPane: '6',
tabLabel: 'construction-order'
}
})
} }
} }
} }
......
/**
* 施工单列表行 / 详情与接口 ConstructionDetail 字段映射
*/
const CONSTRUCTION_STATUS_TEXT = { 0: '待施工', 1: '已施工', 2: '客户返工' }
const INNER_STATUS_TEXT = { 0: '待领单', 1: '待出库', 2: '待完工', 3: '已完工' }
/** 接口可能给数字或字符串,供色点/文案映射用 */
function toIntOrNull(v) {
if (v == null || v === '') return null
const n = Number(v)
return Number.isNaN(n) ? null : n
}
function formatTechnicianText(row) {
const mains = row.mainTechnicianList || []
const subs = row.subTechnicianList || []
const parts = []
mains.forEach((t) => {
if (t && t.technicianName) parts.push(`${t.technicianName} (主)`)
})
subs.forEach((t) => {
if (t && t.technicianName) parts.push(`${t.technicianName} (副)`)
})
return parts.length ? parts.join(' / ') : '-'
}
function serviceItemLinesForTable(row) {
// 仅接口字段 serviceItemsDetailList[].serviceItemsName
const fromDetail = (row.serviceItemsDetailList || [])
.filter((d) => d)
.map((d) => {
const n = d.serviceItemsName
if (n == null || String(n).trim() === '') return null
return { name: String(n).trim() }
})
.filter(Boolean)
return fromDetail.length ? fromDetail : [{ name: '-' }]
}
/** 实际用量展示:子订单产品实际用料 或 服务明细 useNum+标准 */
function outboundLinesForTable(row) {
const subs = row.subOrderList || []
if (subs.length) {
return subs.map((s) => {
if (!s) return '-'
if (s.materialsUsed != null && s.materialsUsed !== '') return String(s.materialsUsed)
if (s.number != null) return `${s.number} 件`
return '-'
})
}
const out = []
;(row.serviceItemsDetailList || []).forEach((d) => {
if (!d) return
const n = d.useNum != null ? d.useNum : ''
const m = d.materialStandard != null ? d.materialStandard : ''
if (n !== '' || m !== '') out.push([n, m].filter(Boolean).join(' / '))
})
return out.length ? out : ['-']
}
/**
* 接口行 -> 表格行(在原始字段上增加展示用属性)
* @param {Object} row - ConstructionDetail
* @param {number} index
*/
export function mapConstructionListRow(row, index) {
if (!row) return {}
const customer = row.customer || {}
const subList = row.subOrderList || []
const first = subList[0] || {}
const constructionPhotoUrls = (row.pictureList || [])
.map((p) => (p && p.pictureUrl ? String(p.pictureUrl).trim() : ''))
.filter(Boolean)
const pictureUrl = constructionPhotoUrls[0] || ''
const cst = toIntOrNull(row.constructionStatus)
const ist = toIntOrNull(row.constructionInnerStatus)
return {
...row,
_rowKey: row.id != null ? row.id : (row.constructionCode || `idx-${index}`),
technicianText: formatTechnicianText(row),
storeName: row.merchantName || row.sellerMerchantName || '-',
mainOrderText: row.orderCode || '-',
carTypeName: customer.carTypeName || '-',
sellerNameText: row.sellerName || '-',
serviceLines: serviceItemLinesForTable(row),
actualOutLines: outboundLinesForTable(row),
subOrderListForView: subList,
constructionStatusText: cst != null && CONSTRUCTION_STATUS_TEXT[cst] != null
? CONSTRUCTION_STATUS_TEXT[cst] : (cst != null ? String(cst) : '-'),
constructionTagText: ist != null && INNER_STATUS_TEXT[ist] != null
? INNER_STATUS_TEXT[ist] : (ist != null ? String(ist) : '-'),
constructionStatusVal: cst,
constructionInnerVal: ist,
dispatchTimeText: row.dispatchTime || row.createdDate || '-',
receiptTimeText: row.receiptTime || row.startTime || '-',
completionTimeText: row.finishTime || row.completedTime || row.endTime || '-',
/** 多图,每项来自 pictureList[].pictureUrl */
constructionPhotoUrls,
constructionPhotoUrl: pictureUrl,
// 兼容原列用 first 子单
subOrderCode: first.subOrderCode,
subProductName: first.upgradeGoodsName,
materialCode: first.materialCode
}
}
/**
* 列表同一行 -> 详情页展示结构(不请求详情接口)
*/
export function mapApiRowToDetailForm(row) {
if (!row) return null
const customer = row.customer || {}
const mainTech = (row.mainTechnicianList || [])
.filter((t) => t)
.map((t) => ({
name: t.technicianName,
role: 'main',
roleLabel: t.technicianType === 0 ? '主技师' : '技师'
}))
const subTech = (row.subTechnicianList || [])
.filter((t) => t)
.map((t) => ({
name: t.technicianName,
role: 'sub',
roleLabel: '副手技师'
}))
const staffList = [...mainTech, ...subTech]
const serviceItems = []
;(row.serviceItemsDetailList || []).forEach((d) => {
if (!d) return
const qty
= d.useNum != null && d.materialStandard != null
? `${d.useNum} / 标准${d.materialStandard}`
: (d.useNum != null ? String(d.useNum) : '-')
const name = d.serviceItemsName != null && String(d.serviceItemsName).trim() !== ''
? String(d.serviceItemsName).trim() : '-'
serviceItems.push({ name, qty })
})
const subOrders = (row.subOrderList || [])
.filter((s) => s)
.map((s) => ({
productName: s.upgradeGoodsName || '-',
materialCode: s.materialCode || '-',
tag1: CONSTRUCTION_STATUS_TEXT[s.constructionStatus] != null
? CONSTRUCTION_STATUS_TEXT[s.constructionStatus] : '-',
tag1Type: s.constructionStatus === 1 ? 'success' : s.constructionStatus === 2 ? 'danger' : 'warning',
tag2: INNER_STATUS_TEXT[row.constructionInnerStatus] != null
? INNER_STATUS_TEXT[row.constructionInnerStatus] : '-',
tag2Type: row.constructionInnerStatus === 3 ? 'success' : 'warning'
}))
return {
constructionCode: row.constructionCode,
mainOrderCode: row.orderCode,
storeName: row.merchantName || row.sellerMerchantName || '-',
carModel: customer.carTypeName || '-',
conversionStaff: row.sellerName || '-',
staffList: staffList.length
? staffList
: [{ name: '-', role: '', roleLabel: '-' }],
serviceItems: serviceItems.length ? serviceItems : [{ name: '-', qty: '-' }],
subOrders: subOrders.length
? subOrders
: [
{
productName: '-',
materialCode: '-',
tag1: '-',
tag1Type: 'info',
tag2: '-',
tag2Type: 'info'
}
],
dispatchTime: row.dispatchTime || row.createdDate || '-',
claimTime: row.receiptTime || row.startTime || '-',
completeTime: row.finishTime || row.completedTime || row.endTime || '-',
photos: (row.pictureList || [])
.map((p) => (p && p.pictureUrl != null ? String(p.pictureUrl).trim() : ''))
.filter(Boolean)
}
}
export { CONSTRUCTION_STATUS_TEXT, INNER_STATUS_TEXT }
import { Util } from '@/common/util'
/**
* 从筛选表单构建施工单列表/导出 query(与接口 query 参数名一致,含 a[0] 形式)
* @param {Object} form - 与 index.vue 中 searchForm 同结构
*/
export function buildConstructionListQuery(form) {
const raw = JSON.parse(JSON.stringify(form))
const out = {}
if (raw.constructionCode) out.constructionCode = String(raw.constructionCode).trim()
if (raw.merchantName) out.merchantName = String(raw.merchantName).trim()
if (raw.orderCode) out.orderCode = String(raw.orderCode).trim()
if (raw.technicianUuid) out['technicianUuidList[0]'] = String(raw.technicianUuid).trim()
if (raw.sellerUserId) out['sellerUserIdList[0]'] = String(raw.sellerUserId).trim()
if (raw.brandId !== '' && raw.brandId != null && !Number.isNaN(Number(raw.brandId))) {
out.brandId = Number(raw.brandId)
}
if (raw.merchantId !== '' && raw.merchantId != null && !Number.isNaN(Number(raw.merchantId))) {
out.merchantId = Number(raw.merchantId)
}
if (raw.constructionStatus !== '' && raw.constructionStatus != null) {
out['constructionStatusList[0]'] = Number(raw.constructionStatus)
}
if (raw.constructionInnerStatus !== '' && raw.constructionInnerStatus != null) {
out['constructionInnerStatusList[0]'] = Number(raw.constructionInnerStatus)
}
const r = (range, startKey, endKey) => {
if (range && Array.isArray(range) && range.length === 2) {
out[startKey] = Util.dateFormate(range[0], 'YYYY-MM-DD HH:mm:ss')
out[endKey] = Util.dateFormate(range[1], 'YYYY-MM-DD HH:mm:ss')
}
}
r(raw.dispatchTimeRange, 'dispatchStartTime', 'dispatchEndTime')
r(raw.receiptTimeRange, 'receiptStartTime', 'receiptEndTime')
r(raw.completionTimeRange, 'completionStartTime', 'completionEndTime')
return out
}
/**
* 施工单列表/详情占位数据(接口对接后可删或改为请求)
*/
import storeImg from '@/assets/store.png'
export function buildMockBaseRows() {
return [
{
constructionCode: 'CW0001',
storeName: '深圳承翰汽车销售集团有限公司',
technicianText: '李某 (主) / 李韩 (副)',
mainOrderCode: '52603161715449580002',
carModel: '丰田凯美瑞',
conversionStaff: '宋振',
serviceLines: [
{ name: '内饰清洗' },
{ name: '隔音安装' }
],
actualOutLines: ['1.2米/件', '2件'],
subOrderCode: '52603161715449580003',
subProductName: '强生尊誉版GH7车身',
materialCode: '260414115517373',
constructionStatus: 'wait',
constructionStatusText: '待施工',
constructionTag: 'wait',
constructionTagText: '待领单',
dispatchTime: '2026-02-24 09:15:00',
claimTime: '-',
completeTime: '-',
constructionPhotoUrl: storeImg
},
{
constructionCode: 'CW0002',
storeName: '示例门店B',
technicianText: '王伟 (主)',
mainOrderCode: '52603161715449580010',
carModel: '本田雅阁',
conversionStaff: '周敏',
serviceLines: [{ name: '轮毂修复' }],
actualOutLines: ['1.70米/件'],
subOrderCode: '52603161715449580011',
subProductName: '强生尊誉版GH7车身',
materialCode: '260414115517374',
constructionStatus: 'done',
constructionStatusText: '已施工',
constructionTag: 'done',
constructionTagText: '已完工',
dispatchTime: '2026-02-20 10:00:00',
claimTime: '2026-02-20 10:05:00',
completeTime: '2026-02-20 16:00:00',
constructionPhotoUrl: storeImg
},
{
constructionCode: 'CW0003',
storeName: '示例门店C',
technicianText: '张某 (主)',
mainOrderCode: '52603161715449580020',
carModel: '大众朗逸',
conversionStaff: '刘洋',
serviceLines: [{ name: '全车贴膜' }],
actualOutLines: ['1套'],
subOrderCode: '52603161715449580021',
subProductName: '前挡+车身',
materialCode: '260414115517375',
constructionStatus: 'custom',
constructionStatusText: '客户返工',
constructionTag: 'out',
constructionTagText: '待出库',
dispatchTime: '2026-02-18 11:00:00',
claimTime: '-',
completeTime: '-',
constructionPhotoUrl: storeImg
}
]
}
/** 列表行 -> 详情表单(占位) */
export function buildDetailFormFromListRow(row) {
return {
constructionCode: row.constructionCode,
mainOrderCode: row.mainOrderCode,
storeName: row.storeName,
carModel: row.carModel,
conversionStaff: row.conversionStaff,
staffList: [
{ name: '李某一', role: 'main', roleLabel: '主技师' },
{ name: '李韩', role: 'sub', roleLabel: '副手技师' },
{ name: '王某', role: 'sub', roleLabel: '副手技师' }
],
serviceItems: (row.serviceLines || []).map((l, i) => ({
name: l.name,
qty: (row.actualOutLines && row.actualOutLines[i]) || '-'
})),
subOrders: [
{
productName: row.subProductName,
materialCode: row.materialCode,
tag1: row.constructionStatusText,
tag1Type: row.constructionStatus === 'done' ? 'success' : row.constructionStatus === 'custom' ? 'danger' : 'warning',
tag2: row.constructionTagText,
tag2Type: row.constructionTag === 'done' ? 'success' : 'warning'
}
],
dispatchTime: row.dispatchTime,
claimTime: row.claimTime,
completeTime: row.completeTime,
photos: [storeImg, storeImg, storeImg, storeImg]
}
}
export { storeImg }
...@@ -352,6 +352,16 @@ export default { ...@@ -352,6 +352,16 @@ export default {
ruleInfoDialog, ruleInfoDialog,
newSignRefundDialog newSignRefundDialog
}, },
props: {
baseSceneCode: {
type: String,
default: "",
},
sceneBusinessType: {
type: [Number, String],
default: undefined,
},
},
data() { data() {
return { return {
fileVisible: false, fileVisible: false,
...@@ -713,6 +723,16 @@ export default { ...@@ -713,6 +723,16 @@ export default {
} }
if (params.orderStatuses.includes("3") && params.requestSource == "0") { delete params.requestSource } if (params.orderStatuses.includes("3") && params.requestSource == "0") { delete params.requestSource }
delete params.createDate delete params.createDate
if (this.baseSceneCode) {
params.baseSceneCode = this.baseSceneCode
}
if (
this.sceneBusinessType !== undefined
&& this.sceneBusinessType !== null
&& this.sceneBusinessType !== ""
) {
params.businessType = Number(this.sceneBusinessType)
}
return params return params
}, },
...@@ -1595,6 +1615,7 @@ export default { ...@@ -1595,6 +1615,7 @@ export default {
line-height: 20px; line-height: 20px;
} }
/* 订单列表页:一级 tab + 二级子项,顶部留白(原单层 tab 为 m-t-40) */
.m-t-94 { .m-t-94 {
margin-top: 94px; margin-top: 94px;
} }
......
<!-- 积分商城列表 --> <!-- 积分商城列表 -->
<template> <template>
<div class="integralShopping-list"> <div class="integralShopping-list">
<d2-container class="m-t-40"> <d2-container class="m-t-94">
<!-- 搜索 --> <!-- 搜索 -->
<div class="header" <div class="header"
slot="header"> slot="header">
...@@ -275,6 +275,16 @@ export default { ...@@ -275,6 +275,16 @@ export default {
ruleInfoDialog, ruleInfoDialog,
newSignRefundDialog newSignRefundDialog
}, },
props: {
baseSceneCode: {
type: String,
default: "",
},
sceneBusinessType: {
type: [Number, String],
default: undefined,
},
},
data() { data() {
return { return {
userInfo: this.$store.state.d2admin.user.info, userInfo: this.$store.state.d2admin.user.info,
...@@ -631,6 +641,16 @@ export default { ...@@ -631,6 +641,16 @@ export default {
} }
if (params.orderStatuses.includes("3") && params.requestSource == "0") { delete params.requestSource } if (params.orderStatuses.includes("3") && params.requestSource == "0") { delete params.requestSource }
delete params.createDate delete params.createDate
if (this.baseSceneCode) {
params.baseSceneCode = this.baseSceneCode
}
if (
this.sceneBusinessType !== undefined
&& this.sceneBusinessType !== null
&& this.sceneBusinessType !== ""
) {
params.businessType = Number(this.sceneBusinessType)
}
return params return params
}, },
...@@ -1164,8 +1184,9 @@ export default { ...@@ -1164,8 +1184,9 @@ export default {
line-height: 20px; line-height: 20px;
} }
.m-t-40 { /* 订单列表页:一级 tab + 二级子项,顶部留白(原单层 tab 为 m-t-40) */
margin-top: 40px; .m-t-94 {
margin-top: 94px;
} }
.integralShopping-list .upload-wrap { .integralShopping-list .upload-wrap {
......
/**
* 场景行 → 订单列表子组件(与 orderList 中 components 注册名一致)
* 可按 baseSceneCode 增补映射;未知时按名称关键字或类目默认。
*/
export const BASE_SCENE_TAB_MAP = {
// 示例:NEW_CAR_DELIVERY: "Order",
}
function pickLightTabName(scene) {
const code = (scene && scene.baseSceneCode) ? String(scene.baseSceneCode).trim() : ""
if (code && BASE_SCENE_TAB_MAP[code]) {
return BASE_SCENE_TAB_MAP[code]
}
const text = `${scene?.name || ""}${scene?.subTypeName || ""}`
if (/众筹/.test(text)) return "CrowdFunding"
if (/次新车|升配/.test(text)) return "configUpgradation"
return "Order"
}
/**
* @param {object} scene - 接口返回的场景
* @param {'light'|'rights'|'renewal'} category
* @param {{ sceneBusinessTypeGroup?: number }} options - 权益拉列表时传入 1 / 2
*/
export function resolveSceneTabName(scene, category, options = {}) {
if (category === "renewal") return "integralShopping"
if (category === "rights") return "carDamage"
if (category === "light") return pickLightTabName(scene)
return "Order"
}
function stableSceneId(category, scene, businessTypeGroup) {
const base = scene?.id ?? scene?.baseSceneCode ?? scene?.num ?? "x"
const btSeg =
businessTypeGroup != null && businessTypeGroup !== ""
? `${businessTypeGroup}-`
: ""
return `${category}-${btSeg}${base}`
}
/**
* @returns {{ id: string, label: string, tabName: string, baseSceneCode?: string, sceneBusinessType?: number, raw?: object }}
*/
export function buildSceneLeafItem(scene, category, options = {}) {
const tabName = resolveSceneTabName(scene, category, options)
const btFromRow = scene?.businessType
const bt =
options.sceneBusinessTypeGroup != null
? Number(options.sceneBusinessTypeGroup)
: btFromRow != null && btFromRow !== ""
? Number(btFromRow)
: undefined
const id = stableSceneId(category, scene, options.sceneBusinessTypeGroup)
const label = scene?.name || scene?.subTypeName || scene?.num || "场景"
return {
id,
label,
tabName,
baseSceneCode: scene?.baseSceneCode || "",
sceneBusinessType: Number.isNaN(bt) ? undefined : bt,
raw: scene,
}
}
export function normalizeSceneResponse(res) {
if (Array.isArray(res)) return res
if (res?.list && Array.isArray(res.list)) return res.list
if (res?.data && Array.isArray(res.data)) return res.data
if (res?.records && Array.isArray(res.records)) return res.records
return []
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!