Files

356 lines
18 KiB
Plaintext
Raw Permalink Normal View History

<view class="auth-page-root" style="{{themeVars}}">
2026-05-29 13:30:56 +08:00
<navigation-bar title="账号中心" showBack="{{true}}" fallbackPath="/pages/home/index" color="{{navThemeColor || '#4A443F'}}" background="{{navThemeBackground || '#FDFBF9'}}"></navigation-bar>
2026-04-01 15:18:35 +08:00
<scroll-view class="auth-scroll" scroll-y="true" enhanced="true" show-scrollbar="false">
2026-04-22 16:53:32 +08:00
<view class="page-shell auth-page-shell auth-page">
<view class="page-content auth-content {{keyboardVisible ? 'keyboard-active' : ''}}">
<view class="page-card auth-panel">
<view class="tab-row">
<view class="tab-item {{activeTab === 'login' ? 'active' : ''}}" data-tab="login" bindtap="handleTabChange">登录</view>
<view class="tab-item {{activeTab === 'register' ? 'active' : ''}}" data-tab="register" bindtap="handleTabChange">注册</view>
2026-04-02 13:57:52 +08:00
</view>
2026-04-01 15:18:35 +08:00
2026-04-22 16:53:32 +08:00
<block wx:if="{{activeTab === 'login'}}">
<view wx:if="{{!traditionalLoginExpanded}}" class="wechat-login-panel">
2026-04-22 16:53:32 +08:00
<view class="wechat-login-copy">
<text class="wechat-login-title">微信手机号一键登录</text>
<text class="wechat-login-desc">更快登录</text>
</view>
2026-04-02 13:20:28 +08:00
2026-04-22 16:53:32 +08:00
<button
wx:if="{{wechatMiniSupported}}"
class="primary-btn wechat-login-btn"
open-type="getPhoneNumber"
bindgetphonenumber="handleWechatMiniPhoneLogin"
loading="{{wechatMiniLoading}}"
disabled="{{wechatMiniLoading || loading}}"
>
{{wechatMiniLoading ? '正在获取微信手机号...' : '微信手机号一键登录'}}
</button>
2026-04-02 13:20:28 +08:00
2026-04-22 16:53:32 +08:00
<button
wx:else
class="secondary-btn wechat-login-btn wechat-login-btn-disabled"
bindtap="handleWechatMiniUnavailableTap"
>
微信手机号一键登录
</button>
2026-04-02 13:20:28 +08:00
2026-04-22 16:53:32 +08:00
<text class="wechat-login-hint">{{wechatMiniSupported ? '单门店可直接登录' : wechatMiniDisabledReason}}</text>
<view class="agreement-row wechat-agreement" bindtap="handleAgreementToggle">
<view class="agreement-check {{agreementAccepted ? 'checked' : ''}}">{{agreementAccepted ? '✓' : ''}}</view>
<view class="agreement-copy">
<text>我已阅读并同意</text>
<text class="agreement-link" data-type="USER_TERMS" catchtap="openAgreement">《用户协议》</text>
<text>和</text>
<text class="agreement-link" data-type="PRIVACY_POLICY" catchtap="openAgreement">《隐私政策》</text>
</view>
</view>
2026-04-22 16:53:32 +08:00
</view>
2026-04-02 13:20:28 +08:00
2026-04-22 16:53:32 +08:00
<view wx:if="{{miniShopTicket && !showMiniShopSelector}}" class="hint-card mini-login-resume">
<text class="mini-login-resume-text">请选择登录门店</text>
<view class="ghost-btn mini-login-resume-btn" bindtap="handleResumeMiniShopSelector">继续选择门店</view>
</view>
2026-04-02 13:20:28 +08:00
2026-04-22 16:53:32 +08:00
<view wx:if="{{!traditionalLoginExpanded}}" class="traditional-entry">
<view class="secondary-btn traditional-entry-btn" bindtap="handleShowTraditionalLogin">其他登录方式</view>
</view>
<view wx:if="{{traditionalLoginExpanded}}" class="traditional-login-panel">
<view class="login-divider">
<view class="divider-line"></view>
<text class="login-divider-text">其他方式</text>
<view class="divider-line"></view>
</view>
<view class="toggle-row">
<view class="toggle-item {{loginType === 'password' ? 'active' : ''}}" data-type="password" bindtap="handleLoginTypeChange">账号密码登录</view>
<view class="toggle-item {{loginType === 'phone' ? 'active' : ''}}" data-type="phone" bindtap="handleLoginTypeChange">验证码登录</view>
</view>
</view>
</block>
<view wx:if="{{activeTab === 'register' || traditionalLoginExpanded}}" class="auth-helper">{{authHelperText}}</view>
<block wx:if="{{activeTab === 'register'}}">
<view id="auth-register-nickname-anchor" class="field-block">
<text class="field-label">昵称</text>
<input
class="field-input"
placeholder="请输入昵称"
placeholder-class="field-placeholder"
value="{{form.nickname}}"
data-field="nickname"
data-keyboard-anchor="auth-register-nickname-anchor"
bindinput="handleInputChange"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
</block>
<view id="auth-account-anchor" wx:if="{{activeTab === 'register' || traditionalLoginExpanded}}" class="field-block">
<text class="field-label">账号</text>
<input
class="field-input"
placeholder="请输入账号"
placeholder-class="field-placeholder"
value="{{form.account}}"
data-field="account"
data-keyboard-anchor="auth-account-anchor"
bindinput="handleInputChange"
bindblur="handleAccountBlur"
bindfocus="handleKeyboardFocus"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
<text wx:if="{{activeTab === 'login' && loginAccountStatusText}}" class="status-text {{loginAccountStatusType}}">{{loginAccountStatusText}}</text>
<text wx:if="{{activeTab === 'register' && registerAccountStatusText}}" class="status-text {{registerAccountStatusType}}">{{registerAccountStatusText}}</text>
2026-04-02 14:22:13 +08:00
</view>
2026-04-22 16:53:32 +08:00
<view id="auth-phone-anchor" wx:if="{{activeTab === 'register' || (traditionalLoginExpanded && loginType === 'phone')}}" class="field-block">
<text class="field-label">手机号</text>
<input
class="field-input"
type="number"
placeholder="请输入手机号"
placeholder-class="field-placeholder"
value="{{form.phone}}"
data-field="phone"
data-keyboard-anchor="auth-phone-anchor"
bindinput="handleInputChange"
bindblur="handlePhoneBlur"
bindfocus="handleKeyboardFocus"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
<text wx:if="{{activeTab === 'register' && registerPhoneStatusText}}" class="status-text {{registerPhoneStatusType}}">{{registerPhoneStatusText}}</text>
2026-04-02 14:22:13 +08:00
</view>
2026-04-22 16:53:32 +08:00
<view id="auth-login-password-anchor" wx:if="{{activeTab === 'login' && traditionalLoginExpanded && loginType === 'password'}}" class="field-block">
<text class="field-label">密码</text>
<input
class="field-input"
password
placeholder="请输入密码"
placeholder-class="field-placeholder"
value="{{form.password}}"
data-field="password"
data-keyboard-anchor="auth-login-password-anchor"
bindinput="handleInputChange"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
<view id="auth-code-anchor" wx:if="{{activeTab === 'register' || (traditionalLoginExpanded && loginType === 'phone')}}" class="field-block">
<text class="field-label">验证码</text>
<view class="code-row">
<input
class="field-input code-input"
type="number"
placeholder="请输入验证码"
placeholder-class="field-placeholder"
value="{{form.verificationCode}}"
data-field="verificationCode"
data-keyboard-anchor="auth-code-anchor"
bindinput="handleInputChange"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
<view class="code-btn {{countdown > 0 ? 'disabled' : ''}}" bindtap="handleSendCode">{{countdown > 0 ? countdown + 's' : '发送验证码'}}</view>
</view>
</view>
<view id="auth-register-password-anchor" wx:if="{{activeTab === 'register'}}" class="field-block">
<text class="field-label">密码</text>
<input
class="field-input"
password
placeholder="请输入密码"
placeholder-class="field-placeholder"
value="{{form.password}}"
data-field="password"
data-keyboard-anchor="auth-register-password-anchor"
bindinput="handleInputChange"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
<view id="auth-register-confirm-password-anchor" wx:if="{{activeTab === 'register'}}" class="field-block">
<text class="field-label">确认密码</text>
<input
class="field-input"
password
placeholder="请再次输入密码"
placeholder-class="field-placeholder"
value="{{form.confirmPassword}}"
data-field="confirmPassword"
data-keyboard-anchor="auth-register-confirm-password-anchor"
bindinput="handleInputChange"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
<view wx:if="{{activeTab === 'register'}}" class="field-block">
<text class="field-label">选择门店</text>
<picker mode="selector" range="{{shops}}" range-key="shopName" value="{{registerShopIndex}}" bindchange="handleRegisterShopChange">
<view class="field-picker">{{registerShopDisplayName || '请选择门店'}}</view>
</picker>
</view>
<view wx:if="{{activeTab === 'login' && traditionalLoginExpanded && loginShops.length}}" class="field-block">
2026-04-22 16:53:32 +08:00
<text class="field-label">选择登录门店</text>
<picker mode="selector" range="{{loginShops}}" range-key="shopName" value="{{loginShopIndex}}" bindchange="handleLoginShopChange">
<view class="field-picker">{{loginShopDisplayName || '请选择登录门店'}}</view>
</picker>
</view>
<view wx:if="{{activeTab === 'login' && traditionalLoginExpanded && loginShopMessage}}" class="hint-card login-shop-tip">{{loginShopMessage}}</view>
<view wx:if="{{activeTab === 'login' && traditionalLoginExpanded}}" class="aux-row">
<text class="aux-link" bindtap="handleToggleResetPanel">忘记密码?</text>
</view>
<view wx:if="{{activeTab === 'register' || traditionalLoginExpanded}}" class="agreement-row" bindtap="handleAgreementToggle">
<view class="agreement-check {{agreementAccepted ? 'checked' : ''}}">{{agreementAccepted ? '✓' : ''}}</view>
<view class="agreement-copy">
<text>我已阅读并同意</text>
<text class="agreement-link" data-type="USER_TERMS" catchtap="openAgreement">《用户协议》</text>
<text>和</text>
<text class="agreement-link" data-type="PRIVACY_POLICY" catchtap="openAgreement">《隐私政策》</text>
</view>
</view>
<view wx:if="{{activeTab === 'register' || traditionalLoginExpanded}}" class="primary-btn submit-btn {{agreementAccepted ? '' : 'disabled'}}" bindtap="handleSubmit">{{activeTab === 'login' ? '立即登录' : '完成注册'}}</view>
2026-04-02 13:20:28 +08:00
</view>
2026-04-22 16:53:32 +08:00
<view wx:if="{{showResetPanel}}" class="page-card reset-card">
<view class="section-title">重置密码</view>
<view class="section-subtitle">短信验证后重置密码</view>
2026-04-01 15:18:35 +08:00
2026-04-22 16:53:32 +08:00
<view id="auth-reset-phone-anchor" class="field-block">
<text class="field-label">手机号</text>
<input
class="field-input"
type="number"
placeholder="请输入绑定手机号"
placeholder-class="field-placeholder"
value="{{resetForm.phone}}"
data-field="phone"
data-keyboard-anchor="auth-reset-phone-anchor"
bindinput="handleResetInputChange"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
2026-04-01 15:18:35 +08:00
2026-04-22 16:53:32 +08:00
<view id="auth-reset-code-anchor" class="field-block">
<text class="field-label">验证码</text>
<view class="code-row">
<input
class="field-input code-input"
type="number"
placeholder="请输入验证码"
placeholder-class="field-placeholder"
value="{{resetForm.verificationCode}}"
data-field="verificationCode"
data-keyboard-anchor="auth-reset-code-anchor"
bindinput="handleResetInputChange"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
<view class="code-btn {{forgotCountdown > 0 ? 'disabled' : ''}}" bindtap="handleSendForgotCode">{{forgotCountdown > 0 ? forgotCountdown + 's' : '发送验证码'}}</view>
</view>
</view>
2026-04-01 15:18:35 +08:00
2026-04-22 16:53:32 +08:00
<view id="auth-reset-password-anchor" class="field-block">
<text class="field-label">新密码</text>
<input
class="field-input"
password
placeholder="请输入新密码"
placeholder-class="field-placeholder"
value="{{resetForm.newPassword}}"
data-field="newPassword"
data-keyboard-anchor="auth-reset-password-anchor"
bindinput="handleResetInputChange"
bindfocus="handleKeyboardFocus"
bindblur="handleKeyboardBlur"
adjust-position="false"
cursor-spacing="{{keyboardCursorSpacing}}"
></input>
</view>
2026-04-01 15:18:35 +08:00
2026-04-22 16:53:32 +08:00
<view class="primary-btn submit-btn" bindtap="handleResetPassword">确认重置密码</view>
2026-04-01 15:18:35 +08:00
</view>
2026-06-04 16:39:06 +08:00
<view class="admin-switch-link" bindtap="handleOpenAdminLogin">管理后台登录</view>
2026-04-01 15:18:35 +08:00
</view>
2026-04-22 16:53:32 +08:00
<view wx:if="{{keyboardVisible}}" class="keyboard-spacer" style="height: {{keyboardInsetRpx}}rpx;"></view>
2026-04-01 15:18:35 +08:00
</view>
</scroll-view>
2026-04-02 13:20:28 +08:00
<view wx:if="{{showMiniShopSelector}}" class="mini-shop-mask" catchtouchmove="noop">
<view class="page-card mini-shop-modal">
<text class="mini-shop-kicker">{{miniShopNewUser ? '首次微信登录' : '确认本次登录门店'}}</text>
<text class="mini-shop-title">{{miniShopNewUser ? '先选门店' : '选择登录门店'}}</text>
<text class="mini-shop-desc">{{miniShopMessage || '选择后继续登录'}}</text>
2026-04-02 13:20:28 +08:00
<view class="field-block mini-shop-field">
<text class="field-label">登录门店</text>
<picker mode="selector" range="{{miniShops}}" range-key="shopName" value="{{miniShopIndex}}" bindchange="handleMiniShopChange">
<view class="field-picker">{{miniShopDisplayName || '请选择门店'}}</view>
</picker>
</view>
<view wx:if="{{miniShopNewUser}}" class="hint-card mini-shop-note">首次登录会自动注册并绑定手机号。</view>
2026-04-02 13:20:28 +08:00
<view class="agreement-row mini-shop-agreement" bindtap="handleAgreementToggle">
<view class="agreement-check {{agreementAccepted ? 'checked' : ''}}">{{agreementAccepted ? '✓' : ''}}</view>
<view class="agreement-copy">
<text>我已阅读并同意</text>
<text class="agreement-link" data-type="USER_TERMS" catchtap="openAgreement">《用户协议》</text>
<text>和</text>
<text class="agreement-link" data-type="PRIVACY_POLICY" catchtap="openAgreement">《隐私政策》</text>
</view>
</view>
2026-04-02 13:20:28 +08:00
<view class="mini-shop-actions">
<view class="secondary-btn mini-shop-action" bindtap="handleCloseMiniShopSelector">稍后再选</view>
<view class="primary-btn mini-shop-action" bindtap="handleConfirmMiniShopLogin">{{miniShopSubmitting ? '确认中...' : '确认登录'}}</view>
</view>
</view>
</view>
<view wx:if="{{agreementModalVisible}}" class="agreement-mask" catchtouchmove="noop">
<view class="agreement-modal">
<view class="agreement-modal-title">{{selectedAgreement.title || '协议详情'}}</view>
<view class="agreement-modal-meta">版本:{{selectedAgreement.version || '-'}}</view>
<scroll-view class="agreement-modal-body" scroll-y="true">
<text>{{selectedAgreement.content || '暂无协议内容'}}</text>
</scroll-view>
<view class="primary-btn agreement-modal-close" bindtap="closeAgreementModal">我知道了</view>
</view>
</view>
2026-04-01 15:18:35 +08:00
</view>