fix(mini-user): address URL, form align, agreement checkbox, shop scan resume
CI / verify (pull_request) Has been cancelled
CI / verify (pull_request) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -29,7 +29,8 @@ export function buildAddressListUrl(ctx: CheckoutContext): string {
|
||||
export function buildAddressEditUrl(id: string | undefined, ctx: CheckoutContext): string {
|
||||
const base = id ? `/pages/address-edit/index?id=${encodeURIComponent(id)}` : '/pages/address-edit/index';
|
||||
const extra = buildQuery(ctx);
|
||||
return extra ? `${base}&${extra}` : base;
|
||||
if (!extra) return base;
|
||||
return `${base}${base.includes('?') ? '&' : '?'}${extra}`;
|
||||
}
|
||||
|
||||
export function buildPayUrl(params: {
|
||||
|
||||
@@ -82,6 +82,7 @@ export default function AddressEditPage() {
|
||||
const validationError = validateForm();
|
||||
if (validationError) {
|
||||
setError(validationError);
|
||||
toast(validationError);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,7 +111,9 @@ export default function AddressEditPage() {
|
||||
});
|
||||
}, 400);
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : '保存失败');
|
||||
const msg = e instanceof Error ? e.message : '保存失败';
|
||||
setError(msg);
|
||||
toast(msg);
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,9 @@ export default function AddressesPage() {
|
||||
className="address-action"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
Taro.navigateTo({ url: buildAddressEditUrl(a.id, checkoutCtx) });
|
||||
Taro.navigateTo({ url: buildAddressEditUrl(a.id, checkoutCtx) }).catch((err) => {
|
||||
toast(err instanceof Error ? err.message : '无法打开编辑页');
|
||||
});
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
@@ -120,7 +122,11 @@ export default function AddressesPage() {
|
||||
</View>
|
||||
<View
|
||||
className="address-fab"
|
||||
onClick={() => Taro.navigateTo({ url: buildAddressEditUrl(undefined, checkoutCtx) })}
|
||||
onClick={() => {
|
||||
Taro.navigateTo({ url: buildAddressEditUrl(undefined, checkoutCtx) }).catch((e) => {
|
||||
toast(e instanceof Error ? e.message : '无法打开新增地址页');
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Text>新增地址</Text>
|
||||
</View>
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
|
||||
.address-fab {
|
||||
position: fixed;
|
||||
left: 16px;
|
||||
right: 16px;
|
||||
left: var(--space-page, 16px);
|
||||
right: var(--space-page, 16px);
|
||||
bottom: calc(16px + env(safe-area-inset-bottom, 0px));
|
||||
height: 48px;
|
||||
border-radius: 999px;
|
||||
@@ -71,15 +71,19 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
.address-form-field {
|
||||
margin: 0 var(--space-page) 12px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.address-form-label {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
color: var(--color-on-surface-variant);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
@@ -88,22 +92,63 @@
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
padding: 0 14px;
|
||||
border: none;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--color-card);
|
||||
box-shadow: var(--shadow-card);
|
||||
font-size: 15px;
|
||||
line-height: 48px;
|
||||
color: var(--color-on-surface);
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Taro H5:样式常落在包装节点,需强制原生控件铺满对齐 */
|
||||
.address-form-input input,
|
||||
.address-form-input .taro-input,
|
||||
.address-form-input .weui-input {
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
min-height: 0 !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
border: none !important;
|
||||
background: transparent !important;
|
||||
box-sizing: border-box !important;
|
||||
font-size: 15px !important;
|
||||
line-height: normal !important;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.address-form-textarea {
|
||||
width: 100%;
|
||||
min-height: 88px;
|
||||
padding: 12px 14px;
|
||||
border: none;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--color-card);
|
||||
box-shadow: var(--shadow-card);
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
color: var(--color-on-surface);
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.address-form-textarea textarea,
|
||||
.address-form-textarea .taro-textarea,
|
||||
.address-form-textarea .weui-textarea {
|
||||
width: 100% !important;
|
||||
min-height: 64px !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
border: none !important;
|
||||
background: transparent !important;
|
||||
box-sizing: border-box !important;
|
||||
font-size: 15px !important;
|
||||
line-height: 1.5 !important;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.address-form-row {
|
||||
@@ -112,9 +157,11 @@
|
||||
justify-content: space-between;
|
||||
margin: 0 var(--space-page) 12px;
|
||||
padding: 12px 14px;
|
||||
min-height: 48px;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--color-card);
|
||||
box-shadow: var(--shadow-card);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.address-form-error {
|
||||
|
||||
@@ -285,14 +285,14 @@
|
||||
|
||||
.login-agreement {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.login-agreement-check {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-top: 2px;
|
||||
margin-top: 0;
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--color-outline, #c8c4be);
|
||||
flex-shrink: 0;
|
||||
@@ -300,6 +300,7 @@
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 11px;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user