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:
@@ -2,6 +2,7 @@ import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
import { getEnums, getMyEffectiveContracts, getMyPendingSignContracts, orderSearchedMePage } from '@/api/index.js'
|
||||
import { normalizeBookingList, parseOrderListResponse, pickCurrentBooking, pickCurrentStayOrder } from '@/utils/booking-helper'
|
||||
import { getBuiltInEnums } from '@/utils/enum-store'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
@@ -62,6 +63,21 @@ function logRequestError(name, error) {
|
||||
return []
|
||||
}
|
||||
|
||||
function resolveOrderNo(order = {}) {
|
||||
const candidates = [order.orderNo, order.no, order.code, order.OrderNo]
|
||||
for (let index = 0; index < candidates.length; index += 1) {
|
||||
const value = candidates[index]
|
||||
if (value === undefined || value === null) {
|
||||
continue
|
||||
}
|
||||
const text = String(value).trim()
|
||||
if (text) {
|
||||
return text
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
let lastFetchStatusTime = 0
|
||||
let fetchUserGlobalStatusPromise = null
|
||||
let globalEnumsPromise = null
|
||||
@@ -89,7 +105,7 @@ const store = new Vuex.Store({
|
||||
vuex_effective_contracts: [],
|
||||
vuex_valid_orders: [],
|
||||
vuex_current_order: lifeData.vuex_current_order ? lifeData.vuex_current_order : null,
|
||||
vuex_enums: {}
|
||||
vuex_enums: getBuiltInEnums(lifeData.vuex_locale || 'zh-Hans')
|
||||
},
|
||||
mutations: {
|
||||
$tStore(state, payload) {
|
||||
@@ -148,14 +164,25 @@ const store = new Vuex.Store({
|
||||
lastFetchStatusTime = now
|
||||
|
||||
fetchUserGlobalStatusPromise = Promise.all([
|
||||
getMyPendingSignContracts({ UserCode: userCode }, language).catch((error) => logRequestError('getMyPendingSignContracts', error)),
|
||||
getMyEffectiveContracts({ UserCode: userCode }, language).catch((error) => logRequestError('getMyEffectiveContracts', error)),
|
||||
orderSearchedMePage({ PageIndex: 1, PageSize: 100, IsExport: false }, language).catch((error) => logRequestError('orderSearchedMePage', error))
|
||||
]).then(([pendingContractsResponse, effectiveContractsResponse, orderResponse]) => {
|
||||
const pendingContracts = parseContractList(pendingContractsResponse)
|
||||
const effectiveContracts = parseContractList(effectiveContractsResponse)
|
||||
]).then(([orderResponse]) => {
|
||||
const validOrders = normalizeBookingList(parseOrderListResponse(orderResponse), language)
|
||||
const currentOrder = pickCurrentStayOrder(validOrders)
|
||||
const currentOrderNo = resolveOrderNo(currentOrder)
|
||||
|
||||
return Promise.all([
|
||||
Promise.resolve(validOrders),
|
||||
Promise.resolve(currentOrder),
|
||||
currentOrderNo
|
||||
? getMyPendingSignContracts({ OrderNo: currentOrderNo, ProviderType: 'WechatMiniProgram' }, language).catch((error) => logRequestError('getMyPendingSignContracts', error))
|
||||
: Promise.resolve([]),
|
||||
currentOrderNo
|
||||
? getMyEffectiveContracts({ OrderNo: currentOrderNo }, language).catch((error) => logRequestError('getMyEffectiveContracts', error))
|
||||
: Promise.resolve([])
|
||||
])
|
||||
}).then(([validOrders, currentOrder, pendingContractsResponse, effectiveContractsResponse]) => {
|
||||
const pendingContracts = parseContractList(pendingContractsResponse)
|
||||
const effectiveContracts = parseContractList(effectiveContractsResponse)
|
||||
const currentBooking = pickCurrentBooking(validOrders)
|
||||
const nextUser = {
|
||||
...currentUser,
|
||||
@@ -208,7 +235,7 @@ const store = new Vuex.Store({
|
||||
globalEnumsPromise = getEnums({}, language)
|
||||
.then((res) => {
|
||||
const data = res && res.data ? res.data : res
|
||||
const enumsMap = {}
|
||||
const enumsMap = getBuiltInEnums(language)
|
||||
if (Array.isArray(data)) {
|
||||
data.forEach(item => {
|
||||
enumsMap[item.code] = item.data || []
|
||||
@@ -222,7 +249,7 @@ const store = new Vuex.Store({
|
||||
return enumsMap
|
||||
})
|
||||
.catch(() => {
|
||||
return hasEnums ? state.vuex_enums : {}
|
||||
return hasEnums ? state.vuex_enums : getBuiltInEnums(language)
|
||||
})
|
||||
.finally(() => {
|
||||
globalEnumsPromise = null
|
||||
|
||||
Reference in New Issue
Block a user