feat: 新增工单中心、房间巡查、失物招领等业务模块

- 新增工单中心(ticket_center)与工单工作台(ticket_workbench)页面
- 新增房间巡查(room_inspection)与失物招领发布(lost_found_publish)页面
- 预约看样流程新增房型/楼栋/楼层选择器组件
- 新增工具模块: booking-entry、privacy、reservation-flow
- api/index.js 补充楼层列表、看样提交等接口
- locales/messages.js 补充多语言文案
- manifest.json 开启微信小程序隐私检查
- 完善登录、注册、申请详情、账单等相关页面交互
This commit is contained in:
liangjian
2026-07-24 09:35:46 +08:00
parent 9fea127de1
commit 445bd850f4
36 changed files with 9281 additions and 340 deletions

176
utils/reservation-flow.js Normal file
View File

@@ -0,0 +1,176 @@
const RESERVATION_FLOW_STEP = {
INSPECTION: 10,
BILL: 20,
CONTRACT: 30,
CHECKIN: 40
}
function getLanguage(language) {
return language === 'en' ? 'en' : 'zh'
}
function parseJsonStringMaybe(value) {
if (typeof value !== 'string') {
return value
}
const text = value.trim()
if (!text) {
return value
}
const isJsonLike = (
(text.startsWith('{') && text.endsWith('}'))
|| (text.startsWith('[') && text.endsWith(']'))
)
if (!isJsonLike) {
return value
}
try {
return JSON.parse(text)
} catch (error) {
return value
}
}
function normalizeArray(value) {
if (Array.isArray(value)) {
return value
}
return []
}
export function parseReservationFlowResponse(response) {
const rawPayload = response && response.data ? response.data : response
const payload = parseJsonStringMaybe(rawPayload)
if (Array.isArray(payload)) {
return payload
}
if (payload && Array.isArray(payload.data)) {
return payload.data
}
if (payload && payload.data && Array.isArray(payload.data.data)) {
return payload.data.data
}
return []
}
export function getReservationOrderNo(source = {}) {
const candidates = [
source.orderNo,
source.OrderNo,
source.reservationOrderNo,
source.searchedOrderNo,
source.bookingOrderNo
]
for (let index = 0; index < candidates.length; index += 1) {
const value = String(candidates[index] || '').trim()
if (value) {
return value
}
}
return ''
}
export function getReservationCurrentNode(flow = {}) {
const nodes = normalizeArray(flow && flow.flowNodes)
.filter(item => item && typeof item === 'object')
.sort((a, b) => Number(a.sort || 0) - Number(b.sort || 0))
if (!nodes.length) {
return null
}
return nodes.find(item => item.isCurrent) || nodes[nodes.length - 1]
}
export function buildReservationFlowMap(flowList = []) {
return normalizeArray(flowList)
.filter(item => item && typeof item === 'object')
.reduce((result, item) => {
const orderNo = getReservationOrderNo(item)
if (!orderNo) {
return result
}
result[orderNo] = {
...item,
orderNo,
currentNode: getReservationCurrentNode(item)
}
return result
}, {})
}
export function attachReservationFlow(item = {}, flowMap = {}) {
const orderNo = getReservationOrderNo(item)
const matchedFlow = orderNo ? flowMap[orderNo] : null
return {
...item,
reservationOrderNo: orderNo,
reservationFlow: matchedFlow || null,
reservationCurrentNode: matchedFlow && matchedFlow.currentNode ? matchedFlow.currentNode : null
}
}
export function getReservationStepMeta(step, language = 'zh') {
const currentLanguage = getLanguage(language)
const map = {
[RESERVATION_FLOW_STEP.INSPECTION]: {
label: currentLanguage === 'en' ? 'Inspection' : '验房',
actionText: currentLanguage === 'en' ? 'View Inspection' : '查看验房'
},
[RESERVATION_FLOW_STEP.BILL]: {
label: currentLanguage === 'en' ? 'Bill' : '账单',
actionText: currentLanguage === 'en' ? 'Go to Bill' : '去缴费'
},
[RESERVATION_FLOW_STEP.CONTRACT]: {
label: currentLanguage === 'en' ? 'Contract' : '合同',
actionText: currentLanguage === 'en' ? 'Go to Contract' : '去签约'
},
[RESERVATION_FLOW_STEP.CHECKIN]: {
label: currentLanguage === 'en' ? 'Check-in' : '入住',
actionText: currentLanguage === 'en' ? 'Go to Check-in' : '去入住'
}
}
return map[Number(step)] || {
label: currentLanguage === 'en' ? 'Current Step' : '当前步骤',
actionText: currentLanguage === 'en' ? 'View Current Step' : '查看当前步骤'
}
}
export function getReservationCurrentStepText(source = {}, language = 'zh') {
const node = source && source.reservationCurrentNode
? source.reservationCurrentNode
: getReservationCurrentNode(source)
if (!node) {
return ''
}
return String(node.stepDesc || '').trim() || getReservationStepMeta(node.step, language).label
}
export function getReservationCurrentActionText(source = {}, language = 'zh') {
const node = source && source.reservationCurrentNode
? source.reservationCurrentNode
: getReservationCurrentNode(source)
if (!node) {
return ''
}
return getReservationStepMeta(node.step, language).actionText
}
export { RESERVATION_FLOW_STEP }