Commit 20c7f197 by Lin

功能(接收):增强接收功能并改进日志记录

- 更新了 saveRecCustomer 函数,以包含请求和响应日志记录,从而更好地进行调试。
- 为测试目的,用示例数据初始化了 mobile 和 code 变量。
- 在 getLocalUnsubmittedReceptionRecords 中添加了控制台日志,以跟踪数据检索情况。
- 改进了 fieldStr 函数,使其能更稳健地处理空值和未定义值。
- 为 ListCustomer 和 ListReception 组件引入了方向处理功能,以实现更好的布局管理。
- 在接待列表中引入了 CSS 变量以实现双列布局,确保在不同设备上保持一致的样式。
1 parent 6268ff62
......@@ -13,7 +13,10 @@ export async function saveRecCustomer(params: UTSJSONObject): Promise<boolean> {
projectName: "boutique",
...params
};
return http.fetch("dj.api.smartcarlife.recepiton.customer.saveRecCustomer", data, false, "dj");
console.log("[saveRecCustomer] request", data);
const res = await http.fetch("dj.api.smartcarlife.recepiton.customer.saveRecCustomer", data, false, "dj");
console.log("[saveRecCustomer] response", res);
return res as boolean;
}
export async function searchRecordingEndTime(params: UTSJSONObject): Promise<string> {
const data: UTSJSONObject = {
......
......@@ -99,8 +99,8 @@ import pageVars from './styles/index.vars'
// 手机号正则
const phoneRex = /^1([3-9])\d{9}$/;
const mobile = ref<string>("");
const code = ref<string>("");
const mobile = ref<string>("13714966184");
const code = ref<string>("1234");
const count = ref<number>(0);
const noSignIn = ref<boolean>(true);
const readingStatus = ref<boolean>(false);
......
......@@ -237,10 +237,18 @@ function syncReceptionSafeTopSpacer(): void {
}
function fieldStr(data: UTSJSONObject | null, key: string): string {
if (data == null || data[key] == null) {
if (data == null) {
return ''
}
return `${data[key]}`
const raw = data[key]
if (raw == null) {
return ''
}
const s = `${raw}`.trim()
if (s === '' || s.toLowerCase() === 'null' || s.toLowerCase() === 'undefined') {
return ''
}
return `${raw}`
}
function orderFinishToIndex(item: UTSJSONObject): number {
......
......@@ -432,6 +432,7 @@ function toReceptionListRowFromLocalRecord(rec: RecordData): UTSJSONObject {
reviewFlag: 1,
orderFinishFlag: of != null ? of : null,
submitted: 0,
} as UTSJSONObject;
}
......@@ -440,10 +441,13 @@ async function getLocalUnsubmittedReceptionRecords(): Promise<UTSJSONObject[]> {
// - 未提交/待上传:已完成记录(recordStatus=1)
// - 未提交/待提交:临时记录(recordStatus=0)
const recorder = recordService.getRecorder();
console.log("[getLocalUnsubmittedReceptionRecords] recorder", recorder);
const db = recorder != null ? recorder.db : DBRecord.getInstance();
console.log("[getLocalUnsubmittedReceptionRecords] db", db);
const rows: RecordData[] = unsubmittedPendingTabIndex.value == 0
? (await db.getCompletedRecords())
: (await db.getTempRecords());
console.log("[getLocalUnsubmittedReceptionRecords] rows", rows);
const list: UTSJSONObject[] = [];
let i = 0;
while (i < rows.length) {
......@@ -914,6 +918,7 @@ getReceptionRecordListImpl = async (append: boolean): Promise<void> => {
const list = await getLocalUnsubmittedReceptionRecords();
receptionRecordList.value = list;
receptionListHasMore.value = false;
console.log("未提交本地接待列表:", list);
} catch (error) {
console.error("获取未提交本地接待列表失败:", error);
receptionRecordList.value = [];
......
......@@ -62,8 +62,11 @@
</template>
<script setup lang="uts">
import { computed, ref, watch } from 'vue'
// import { cssClassRef } from '@/services/adapter'
import { computed, onMounted, ref, watch, type Ref } from 'vue'
import { useOrientation, updateOrientation } from '@/services/adapter/hooks/index.uts'
/** 与 index.vars.uts 中 `resolutions['portrait-768x1174']`、ListReception 双列断点一致 */
const RECEPTION_LIST_DUAL_COLUMN_PORTRAIT_RESOLUTION_KEY = '768x1174'
const props = defineProps<{
/** 客户档案列表(由父级拉取并传入) */
......@@ -77,18 +80,20 @@ const props = defineProps<{
const loading = computed<boolean>(() => props.loading === true)
const skeletonCardCount = 6
/** 横屏或 768×1174 竖屏:列表双列(与 ListReception 一致;不再依赖 portrait.uts) */
const orientationHook = useOrientation()
const isPortrait = orientationHook.isPortrait as Ref<boolean>
const resolutionKey = orientationHook.resolutionKey as Ref<string>
onMounted((): void => {
updateOrientation()
})
/** 默认竖屏窄屏:单列;横屏或 768×1174 宽屏竖屏:双列(与 ListReception 一致) */
const isListDualColumn = computed((): boolean => {
// const cls = cssClassRef.value
// if (cls == null || cls == '') {
// return false
// }
// if (cls.indexOf('layout-landscape') >= 0) {
// return true
// }
// return cls.indexOf('layout-portrait-768x1174') >= 0
// TODO
return true
if (!isPortrait.value) {
return true
}
return resolutionKey.value == RECEPTION_LIST_DUAL_COLUMN_PORTRAIT_RESOLUTION_KEY
})
const emit = defineEmits<{
......@@ -289,7 +294,7 @@ function onEntryCardMaskDelete(item: UTSJSONObject): void {
}
.list-card-entry-landscape {
width: 49%;
width: var(--reception-list-card-width-dual, 49%);
}
.entry-card-mask {
......
......@@ -54,8 +54,11 @@
</template>
<script setup lang="uts">
import { computed } from 'vue'
// import { cssClassRef } from '@/services/adapter'
import { computed, onMounted, type Ref } from 'vue'
import { useOrientation, updateOrientation } from '@/services/adapter/hooks/index.uts'
/** 与 index.vars.uts 中 `resolutions['portrait-768x1174']` 的断点一致(useScreenVars 的 fullResKey 为 portrait-768x1174) */
const RECEPTION_LIST_DUAL_COLUMN_PORTRAIT_RESOLUTION_KEY = '768x1174'
const props = defineProps<{
/** 接待记录列表(由父级拉取并传入) */
......@@ -67,18 +70,20 @@ const props = defineProps<{
const loading = computed<boolean>(() => props.loading === true)
const skeletonCardCount = 6
/** 横屏或 768×1174 竖屏:列表双列(与 adapter 注入的 cssClassRef 保持一致) */
const orientationHook = useOrientation()
const isPortrait = orientationHook.isPortrait as Ref<boolean>
const resolutionKey = orientationHook.resolutionKey as Ref<string>
onMounted((): void => {
updateOrientation()
})
/** 默认竖屏窄屏:单列;横屏或 768×1174 宽屏竖屏(与 index.vars 中 portrait-768x1174 一致):双列 */
const isListDualColumn = computed((): boolean => {
// const cls = cssClassRef.value
// if (cls == null || cls == '') {
// return false
// }
// if (cls.indexOf('layout-landscape') >= 0) {
// return true
// }
// return cls.indexOf('layout-portrait-768x1174') >= 0
//TODO
return true
if (!isPortrait.value) {
return true
}
return resolutionKey.value == RECEPTION_LIST_DUAL_COLUMN_PORTRAIT_RESOLUTION_KEY
})
const emit = defineEmits<{
......@@ -94,6 +99,23 @@ function getStr(data: UTSJSONObject, key: string): string {
return `${v}`
}
/** 解析接口常见日期串(如 2026/04/16 20:07:49);不可用 parseFloat,否则只得到前导数字 2026 */
function parseDateLikeStringToMs(raw: string): number | null {
const s = raw.trim()
if (s == '') {
return null
}
let norm = s.replace(/\//g, '-')
if (norm.length > 10 && norm.substring(10, 11) == ' ') {
norm = norm.substring(0, 10) + 'T' + norm.substring(11)
}
const ms = Date.parse(norm)
if (isNaN(ms)) {
return null
}
return ms
}
function getTs(data: UTSJSONObject, key: string): number | null {
const v = data[key]
if (v == null) {
......@@ -102,7 +124,12 @@ function getTs(data: UTSJSONObject, key: string): number | null {
if (typeof v == 'number') {
return v
}
const n = parseFloat(`${v}`)
const str = `${v}`
const fromDate = parseDateLikeStringToMs(str)
if (fromDate != null) {
return fromDate
}
const n = parseFloat(str)
return isNaN(n) ? null : n
}
......@@ -156,8 +183,9 @@ function getOrderFinishResultLabel(item: UTSJSONObject): string {
}
function getReceptionSalesDisplay(item: UTSJSONObject): string {
const sales = getStr(item, 'salesName')
if (sales != '') {
const sales = getStr(item, 'salesName').trim()
const lower = sales.toLowerCase()
if (sales != '' && lower != 'null' && lower != 'undefined') {
return sales
}
return getStr(item, 'staffName')
......@@ -259,7 +287,7 @@ function onCardClick(item: UTSJSONObject): void {
}
.list-card-landscape {
width: 49%;
width: var(--reception-list-card-width-dual, 49%);
}
.card-header-row {
......
......@@ -61,6 +61,8 @@ const receptionPageVarsOnly = {
'--reception-list-info-label-font-size': '13px',
'--reception-list-info-value-font-size': '13px',
'--reception-list-status-badge-font-size': '11px',
// 接待复盘列表双列时卡片宽度(与 ListReception 横屏 / portrait-768x1174 双列布局一致;单列为 100% 即不显式设置)
'--reception-list-card-width-dual': '49%',
// receptionCenter: 客户录入列表(ListCustomer) 默认字号(可被 resolutions 覆盖)
'--reception-customer-list-card-name-font-size': '18px',
......@@ -195,44 +197,33 @@ const receptionPageVarsOnly = {
'--reception-form-detail-goods-meta-font-size': '12px',
'--reception-form-detail-goods-meta-line-height': '16px',
},
// 竖屏兜底:接待中心「大屏竖屏」字号与间距(原 portrait-768x1174 全量迁移至此)。
// 合并顺序中 portrait 早于 resolutions.*,故所有竖屏分辨率都会先套用本段;若某机型需缩小字号,在 resolutions 增加如 portrait-393x816 覆盖即可。
portrait: {
'--adapter-color': 'red',
'--adapter-fontsize': '50px',
'--test-view-height': '60px',
'--test-view-bg': 'red',
},
landscape: {
'--adapter-color': 'green',
'--adapter-fontsize': '50px',
'--test-view-height': '30px',
'--test-view-bg': 'green',
// 'padding': '10px'
},
resolutions: {
'portrait-768x1174': {
'--adapter-color': 'blue',
'--adapter-color': 'red',
'--adapter-fontsize': '50px',
'--test-view-height': '60px',
'--test-view-bg': 'blue',
// 'padding': '10px'
'--test-view-bg': 'red',
// 主 Tab 外层容器(接待中心壳)
'--reception-tabs-container-padding': '8px 12px 60px',
'--reception-tabs-container-margin-top': '30px',
'--reception-tabs-container-bgc': '#ffffff',
// 针对 768x1174 竖屏:tabs 字体自适应增大
// 竖屏:主 tabs 字体自适应增大
'--reception-main-tabs-active-font-size': '22px',
'--reception-main-tabs-inactive-font-size': '20px',
// 兼容旧变量(scss 里有引用)
'--reception-main-tabs-font-size': '24px',
// 针对 768x1174 竖屏:客户列表子 Tab 文本字号自适应增大
// 竖屏:客户列表子 Tab(ReceptionCustomerListTab)文本字号
'--reception-customer-list-sub-tab-title-font-size': '17px',
'--reception-customer-list-sub-tab-caption-font-size': '13px',
// 针对 768x1174 竖屏:列表底部提示文案字号自适应增大
// 竖屏:列表底部提示文案(加载中 / 已到底)
'--reception-list-footer-font-size': '16px',
'--reception-list-footer-line-height': '22px',
// 针对 768x1174 竖屏:列表筛选区字号与高度自适应增大
// 竖屏:列表筛选区(分段器 + 预录按钮)字号与高度
'--reception-list-filters-segmented-font-size': '16px',
'--reception-list-filters-segmented-height': '44px',
'--reception-list-filters-tabs-row-height': '44px',
......@@ -240,12 +231,12 @@ const receptionPageVarsOnly = {
'--reception-list-filters-pre-entry-btn-text-font-size': '15px',
'--reception-list-filters-pre-entry-btn-text-line-height': '22px',
'--reception-list-filters-pre-entry-icon-size': '13px',
// 针对 768x1174 竖屏:复盘筛选下拉(secondary filter)尺寸同步放大
// 竖屏:复盘筛选下拉(secondary filter)尺寸
'--reception-list-filters-review-tag-text-font-size': '15px',
'--reception-list-filters-review-tag-min-height': '46px',
'--reception-list-filters-review-tag-arrow-size': '16px',
// 针对 768x1174 竖屏:接待复盘列表(ListReception) 字号自适应增大
// 竖屏:接待复盘列表(ListReception)卡片与信息区字号
'--reception-list-card-name-font-size': '21px',
'--reception-list-card-car-font-size': '16px',
'--reception-list-card-car-margin-top': '8px',
......@@ -253,7 +244,7 @@ const receptionPageVarsOnly = {
'--reception-list-info-value-font-size': '15px',
'--reception-list-status-badge-font-size': '13px',
// 针对 768x1174 竖屏:客户录入列表(ListCustomer) 字号自适应增大
// 竖屏:客户录入列表(ListCustomer)卡片与遮罩操作字号
'--reception-customer-list-card-name-font-size': '21px',
'--reception-customer-list-card-car-font-size': '16px',
'--reception-customer-list-card-car-margin-top': '8px',
......@@ -261,7 +252,7 @@ const receptionPageVarsOnly = {
'--reception-customer-list-info-value-font-size': '15px',
'--reception-entry-mask-action-font-size': '16px',
// 针对 768x1174 竖屏:看板头部(header) 尺寸自适应增大
// 竖屏:看板头部(ReceptionDashboardTab header)尺寸
'--reception-dash-header-content-padding': '22px',
'--reception-dash-header-margin-bottom': '22px',
'--reception-dash-header-surface-padding': '18px',
......@@ -289,7 +280,7 @@ const receptionPageVarsOnly = {
'--reception-dash-header-progress-value-font-size': '17px',
'--reception-dash-header-progress-bar-height': '12px',
// 针对 768x1174 竖屏:看板(CardOutputValue) 字体/宽高自适应增大
// 竖屏:看板产出对比卡片(CardOutputValue)分段器与对比条
'--reception-dash-output-tabs-margin-bottom': '28px',
'--reception-dash-segmented-font-size': '19px',
'--reception-dash-segmented-height': '48px',
......@@ -302,23 +293,21 @@ const receptionPageVarsOnly = {
'--reception-dash-compare-value-font-size': '17px',
'--reception-dash-compare-value-width': '72px',
// 针对 768x1174 竖屏:客流卡片(CardFlow) 文本样式自适应增大
// 竖屏:客流卡片(CardFlow)指标与转化率;两卡默认纵向堆叠(换行),仅 768x1174 并排见 resolutions.portrait-768x1174
'--reception-dash-flow-title-font-size': '20px',
'--reception-dash-flow-metric-label-font-size': '16px',
'--reception-dash-flow-metric-value-font-size': '28px',
'--reception-dash-flow-metric-card-min-height': '72px',
// 针对 768x1174 竖屏:两个 metric card 并排展示
'--reception-dash-flow-metric-layout-direction': 'row',
'--reception-dash-flow-metric-layout-direction': 'column',
'--reception-dash-flow-metric-to-rate-gap': '16px',
'--reception-dash-flow-metric-card-width': 'auto',
'--reception-dash-flow-metric-card-flex-grow': '1',
'--reception-dash-flow-metric-card-flex-shrink': '1',
'--reception-dash-flow-metric-card-flex-basis': '0px',
// 针对 768x1174 竖屏:卡片内文字居中
'--reception-dash-flow-metric-text-align-items': 'center',
'--reception-dash-flow-metric-text-align': 'center',
'--reception-dash-flow-metric-card-primary-margin-right': '12px',
'--reception-dash-flow-metric-card-secondary-margin-top': '0px',
'--reception-dash-flow-metric-card-width': '100%',
'--reception-dash-flow-metric-card-flex-grow': '0',
'--reception-dash-flow-metric-card-flex-shrink': '0',
'--reception-dash-flow-metric-card-flex-basis': 'auto',
'--reception-dash-flow-metric-text-align-items': 'flex-start',
'--reception-dash-flow-metric-text-align': 'left',
'--reception-dash-flow-metric-card-primary-margin-right': '0px',
'--reception-dash-flow-metric-card-secondary-margin-top': '8px',
'--reception-dash-flow-metric-label-line-height': '20px',
'--reception-dash-flow-metric-value-line-height': '34px',
'--reception-dash-flow-rate-caption-font-size': '16px',
......@@ -328,7 +317,7 @@ const receptionPageVarsOnly = {
'--reception-dash-flow-rate-badge-size': '120px',
'--reception-dash-flow-rate-badge-radius': '60px',
// 针对 768x1174 竖屏:本月业绩卡片(CardMonthValue) 字体/尺寸自适应增大
// 竖屏:本月业绩卡片(CardMonthValue)汇总 / 环形 / 目标
'--reception-dash-month-title-font-size': '20px',
'--reception-dash-month-output-summary-margin-top': '22px',
......@@ -363,7 +352,7 @@ const receptionPageVarsOnly = {
'--reception-dash-month-target-value-font-size': '20px',
'--reception-dash-month-target-value-margin-top': '8px',
// 针对 768x1174 竖屏:FormAdd 文本与行高自适应增大
// 竖屏:客户档案新增/编辑(FormAdd)
'--reception-form-add-label-font-size': '18px',
'--reception-form-add-input-font-size': '18px',
'--reception-form-add-placeholder-font-size': '18px',
......@@ -374,7 +363,7 @@ const receptionPageVarsOnly = {
'--reception-form-add-item-padding-bottom': '10px',
'--reception-form-add-navbar-title-font-size': '22px',
// 针对 768x1174 竖屏:FormDetail 字体自适应增大
// 竖屏:客户档案详情(FormDetail)
'--reception-form-detail-navbar-title-font-size': '22px',
'--reception-form-detail-section-title-font-size': '20px',
'--reception-form-detail-label-font-size': '18px',
......@@ -383,7 +372,31 @@ const receptionPageVarsOnly = {
'--reception-form-detail-goods-name-font-size': '18px',
'--reception-form-detail-goods-meta-font-size': '16px',
'--reception-form-detail-goods-meta-line-height': '22px',
},
},
landscape: {
'--adapter-color': 'green',
'--adapter-fontsize': '50px',
'--test-view-height': '30px',
'--test-view-bg': 'green',
// 'padding': '10px'
},
resolutions: {
// 与 HomeFrame 的 portrait-768x1174 合并:大屏平板竖屏下 CardFlow 两指标并排,其它竖屏为 portrait 段的纵向堆叠
'portrait-768x1174': {
'--adapter-color': 'blue',
'--adapter-fontsize': '50px',
'--test-view-height': '60px',
'--test-view-bg': 'blue',
'--reception-dash-flow-metric-layout-direction': 'row',
'--reception-dash-flow-metric-card-width': 'auto',
'--reception-dash-flow-metric-card-flex-grow': '1',
'--reception-dash-flow-metric-card-flex-shrink': '1',
'--reception-dash-flow-metric-card-flex-basis': '0px',
'--reception-dash-flow-metric-text-align-items': 'center',
'--reception-dash-flow-metric-text-align': 'center',
'--reception-dash-flow-metric-card-primary-margin-right': '12px',
'--reception-dash-flow-metric-card-secondary-margin-top': '0px',
},
'landscape-1174x768': {
'--adapter-color': '#FF4444',
'--adapter-fontsize': '20px',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!