fix(h5-shop): 门店 PAUSED 时点击扫码即弹窗,前置到首页
CI / verify (push) Has been cancelled

- 门店临时闭店/休息中(非 OPEN)点击首页「扫码核销」立即弹
  「门店目前休息中无法核销,是否开启营业」,不进入扫码流程
- 开张成功后刷新门店状态,可再次扫码
- 修正此前“扫码后才提示”的方案偏差;文档 E 节同步更新

Co-Authored-By: WorkBuddy <workbuddy@tencent.com>
This commit is contained in:
2026-08-17 23:03:55 +08:00
parent 3ac008a217
commit c0d04ee500
2 changed files with 63 additions and 6 deletions
+56
View File
@@ -112,6 +112,10 @@ export default function HomePage() {
const [authError, setAuthError] = useState('');
const [showOpenModal, setShowOpenModal] = useState(false);
const [opening, setOpening] = useState(false);
const pendingScanStartedRef = useRef(false);
@@ -309,6 +313,12 @@ export default function HomePage() {
setScanMsg('');
// 门店临时闭店/休息中(非营业状态)时,点击扫码直接提示,不进入扫码流程
if (status !== 'OPEN') {
setShowOpenModal(true);
return;
}
if (!isWechatEnv()) {
setScanMsg('请在微信内打开门店端进行扫码核销');
@@ -349,6 +359,25 @@ export default function HomePage() {
async function openStoreAndContinue() {
if (opening) return;
setOpening(true);
try {
await request('SHOP_H5', '/shop/store/status', {
method: 'PUT',
body: JSON.stringify({ status: 'OPEN' }),
});
setShowOpenModal(false);
setScanMsg('');
void loadDashboard(); // 刷新门店状态为营业中,扫码按钮可再次使用
} catch (e) {
setShowOpenModal(false);
setScanMsg(e instanceof Error ? e.message : '开启营业失败');
} finally {
setOpening(false);
}
}
async function startWechatAuth() {
setAuthLoading(true);
@@ -615,6 +644,33 @@ export default function HomePage() {
/>
{showOpenModal && (
<div className="shop-redeem-modal" role="dialog" aria-modal="true">
<div className="shop-redeem-modal-card">
<h4 className="shop-redeem-modal-title"></h4>
<p className="shop-redeem-modal-desc"></p>
<div className="shop-redeem-modal-actions">
<button
type="button"
className="shop-redeem-modal-cancel"
disabled={opening}
onClick={() => setShowOpenModal(false)}
>
</button>
<button
type="button"
className="shop-redeem-modal-confirm"
disabled={opening}
onClick={() => void openStoreAndContinue()}
>
{opening ? '开启中…' : '确认开启'}
</button>
</div>
</div>
</div>
)}
</PullToRefresh>
);