fix(user): 放宽所在地区锁定,允许手动选择

- 取消 openRegionPicker 中对 regionLocked 的拦截,始终显示选择器
- 去掉 handleRegionChange 中的 regionLocked 拦截,设置手动修改后解除锁定
- 移除 chooseLocation 失败时对 regionLocked 的判断,确保手动选择始终可用
- 调整提示逻辑,取消“修改请重新选择定位”限制
- 保留 regionLocked 用于区分文本与地图地区显示,不阻止用户操作
This commit is contained in:
2026-07-12 23:08:55 +08:00
parent b02f0d91b1
commit be130408de
2 changed files with 16 additions and 19 deletions

View File

@@ -328,42 +328,28 @@ const AddressEditPage: React.FC = () => {
cancelText: '再试一次',
}).then((modal) => {
if (modal.confirm) {
if (regionLocked) {
Taro.showToast({title: '所在地区已由定位确定,修改请重新选择定位', icon: 'none'})
} else {
setRegionPickerVisible(true)
}
setRegionPickerVisible(true)
} else {
Taro.chooseLocation({})
.then((res: any) => applyChosenLocation(res))
.catch(() => {
if (!regionLocked) setRegionPickerVisible(true)
})
.catch(() => setRegionPickerVisible(true))
}
}).catch(() => {
if (!regionLocked) setRegionPickerVisible(true)
})
}).catch(() => setRegionPickerVisible(true))
}
}
/** 打开地区选择器 */
const openRegionPicker = () => {
if (regionLocked) {
Taro.showToast({title: '所在地区已由定位确定,修改请重新选择定位', icon: 'none'})
return
}
setRegionPickerVisible(true)
}
/** 地区选择器确认 */
const handleRegionChange = (value: string[]) => {
if (regionLocked) {
Taro.showToast({title: '所在地区已由定位确定,修改请重新选择定位', icon: 'none'})
return
}
const [province, city, region] = value
setFormData(prev => ({...prev, province, city, region}))
setRegionText(value.join(' '))
// 用户手动修改了所在地区,解除"由地图定位锁定"状态,后续可继续手动调整
setRegionLocked(false)
}
/** 保存地址 */