优化(订单服务): 固定提交按钮并完善未成年提示滚动

This commit is contained in:
2026-11-27 16:20:12 +08:00
parent c3a13c5f36
commit 77371728c0
4 changed files with 352 additions and 5 deletions
@@ -125,6 +125,7 @@ export default function OrderServicePage() {
required: ageGateRequired,
decision: ageGateDecision,
})
const hasFixedSubmit = !ageGateOpen && pendingItems.length === 1
useOrderServicePageMeta(ageGateOpen ? '购买前确认' : info?.items[0]?.title || '订单服务')
@@ -329,7 +330,7 @@ export default function OrderServicePage() {
].join('、') || '订单商品'
return (
<main className="collect-link-page">
<main className={`collect-link-page${hasFixedSubmit ? ' has-fixed-submit' : ''}`}>
{selectedAgeGate ? (
<OrderServiceAgeGateModal
open={ageGateOpen}
@@ -412,6 +413,7 @@ export default function OrderServicePage() {
code={orderNo}
submitting={submittingId === item.workOrderId}
disabled={submittingId !== 0}
fixedSubmit={hasFixedSubmit}
screenshots={screenshotsByOrder[item.workOrderId] ?? item.screenshots ?? []}
onScreenshotsChange={(files) => {
setScreenshotsByOrder((current) => ({
@@ -638,6 +640,7 @@ function OrderServiceForm({
code,
submitting,
disabled,
fixedSubmit,
screenshots,
onScreenshotsChange,
onSubmit,
@@ -646,6 +649,7 @@ function OrderServiceForm({
code: string
submitting: boolean
disabled: boolean
fixedSubmit: boolean
screenshots: UploadedFile[]
onScreenshotsChange: (files: UploadedFile[]) => void
onSubmit: (values: Record<string, unknown>) => void
@@ -767,7 +771,7 @@ function OrderServiceForm({
</Form.Item>
) : null}
<div className="collect-link-actions">
<div className={`collect-link-actions${fixedSubmit ? ' is-viewport-fixed' : ''}`}>
<Button
block
htmlType="submit"
+82 -3
View File
@@ -665,6 +665,46 @@
min-width: 180px;
}
/* 单商品待补资料时,提交按钮固定在一屏底部,避免长表单或引导图把按钮推离视口。 */
.collect-link-page.has-fixed-submit {
padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}
.collect-link-actions.is-viewport-fixed {
position: fixed;
left: 50%;
bottom: calc(12px + env(safe-area-inset-bottom, 0px));
z-index: 30;
width: min(664px, calc(100vw - 88px));
margin: 0;
padding: 0;
background: transparent;
border: 0;
box-shadow: none;
transform: translateX(-50%);
}
.collect-link-actions.is-viewport-fixed .ant-btn {
width: 100%;
min-width: 0;
height: 48px;
color: #ffffff;
font-size: 16px;
font-weight: 600;
background: #ff6a00;
border-color: #ff6a00;
border-radius: 8px;
box-shadow: 0 10px 26px rgba(255, 106, 0, 0.28);
}
.collect-link-actions.is-viewport-fixed .ant-btn:not(:disabled):hover,
.collect-link-actions.is-viewport-fixed .ant-btn:not(:disabled):active,
.collect-link-actions.is-viewport-fixed .ant-btn:not(:disabled):focus-visible {
color: #ffffff;
background: #ff6a00;
border-color: #ff6a00;
}
.collect-link-footnote {
display: block;
text-align: center;
@@ -703,6 +743,15 @@
.collect-link-actions .ant-btn {
width: 100%;
}
.collect-link-page.has-fixed-submit {
padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}
.collect-link-actions.is-viewport-fixed {
bottom: calc(10px + env(safe-area-inset-bottom, 0px));
width: min(664px, calc(100vw - 64px));
}
}
@media (max-width: 480px) {
@@ -767,6 +816,14 @@
.collect-link-order-meta {
display: grid;
}
.collect-link-page.has-fixed-submit {
padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}
.collect-link-actions.is-viewport-fixed {
width: calc(100vw - 48px);
}
}
/* ===== 工单补资料页未成年提示 ===== */
@@ -797,16 +854,37 @@
}
.order-service-age-gate .ant-modal-body {
flex: 1 1 auto;
flex: 1 1 0;
min-height: 0;
padding-right: 6px;
max-height: max(96px, calc(100dvh - 230px));
padding-right: 8px;
overflow-y: auto;
overscroll-behavior: contain;
scrollbar-gutter: stable;
scrollbar-width: thin;
scrollbar-color: #cbd5e1 transparent;
-webkit-overflow-scrolling: touch;
}
.order-service-age-gate .ant-modal-body::-webkit-scrollbar {
width: 6px;
}
.order-service-age-gate .ant-modal-body::-webkit-scrollbar-track {
background: transparent;
}
.order-service-age-gate .ant-modal-body::-webkit-scrollbar-thumb {
background: #cbd5e1;
border-radius: 999px;
}
.order-service-age-gate .ant-modal-footer {
flex: none;
margin-top: 12px;
padding-top: 12px;
background: #ffffff;
border-top: 1px solid #eef2f7;
}
.order-service-age-gate-content {
@@ -966,7 +1044,8 @@
}
.order-service-age-gate .ant-modal-body {
padding-right: 2px;
max-height: max(88px, calc(100dvh - 220px));
padding-right: 4px;
}
.order-service-age-gate-warning {
@@ -0,0 +1,57 @@
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import test from 'node:test'
test('订单服务单商品提交按钮固定在一屏底部并预留手机安全区', async () => {
const [page, styles] = await Promise.all([
readFile(new URL('../src/pages/public/OrderServicePage.tsx', import.meta.url), 'utf8'),
readFile(new URL('../src/styles/client/collect.css', import.meta.url), 'utf8'),
])
assert.ok(page.includes('const hasFixedSubmit = !ageGateOpen && pendingItems.length === 1'))
assert.ok(page.includes('fixedSubmit={hasFixedSubmit}'))
assert.ok(page.includes('is-viewport-fixed'))
assert.ok(styles.includes('.collect-link-page.has-fixed-submit'))
assert.match(styles, /\.collect-link-actions\.is-viewport-fixed\s*\{[^}]*position:\s*fixed;/s)
assert.ok(styles.includes('env(safe-area-inset-bottom, 0px)'))
assert.ok(styles.includes('calc(100vw - 48px)'))
assert.match(
styles,
/\.collect-link-actions\.is-viewport-fixed\s*\{[^}]*background:\s*transparent;/s,
)
assert.match(
styles,
/\.collect-link-actions\.is-viewport-fixed \.ant-btn\s*\{[^}]*background:\s*#ff6a00;/s,
)
assert.match(
styles,
/\.collect-link-actions\.is-viewport-fixed \.ant-btn:not\(:disabled\):hover[\s\S]*background:\s*#ff6a00;/s,
)
})
test('多商品待补资料时保留逐商品按钮,避免固定按钮互相覆盖', async () => {
const page = await readFile(
new URL('../src/pages/public/OrderServicePage.tsx', import.meta.url),
'utf8',
)
assert.ok(page.includes('pendingItems.length === 1'))
assert.ok(page.includes('fixedSubmit={hasFixedSubmit}'))
assert.ok(page.includes('className={`collect-link-actions${fixedSubmit'))
})
test('未成年提示正文独立滚动,底部操作按钮始终可见', async () => {
const styles = await readFile(
new URL('../src/styles/client/collect.css', import.meta.url),
'utf8',
)
assert.match(
styles,
/\.order-service-age-gate \.ant-modal-body\s*\{[^}]*flex:\s*1 1 0;[^}]*max-height:\s*max\(96px, calc\(100dvh - 230px\)\);[^}]*overflow-y:\s*auto;/s,
)
assert.match(
styles,
/\.order-service-age-gate \.ant-modal-footer\s*\{[^}]*flex:\s*none;[^}]*border-top:/s,
)
assert.ok(styles.includes('.order-service-age-gate .ant-modal-body::-webkit-scrollbar-thumb'))
})