完成consumer端同步

This commit is contained in:
2026-05-14 15:28:09 +08:00
parent 612fb3d360
commit 0ffbc53902
197 changed files with 92657 additions and 7564 deletions

View File

@@ -98,7 +98,9 @@ const loadAddresses = async () => {
}
onLoad((options) => {
if (options['selectMode'] == 'true') {
if (options == null) return
const optionsObj = options as UTSJSONObject
if ((optionsObj.getString('selectMode') ?? '') == 'true') {
selectionMode.value = true
}
})
@@ -121,34 +123,34 @@ const addAddress = () => {
}
// 删除地址
const doDeleteAddress = async (id: string): Promise<void> => {
const success = await supabaseService.deleteAddress(id)
if (success) {
const index = addresses.value.findIndex(addr => addr.id === id)
if (index !== -1) {
addresses.value.splice(index, 1)
uni.setStorageSync('addresses', JSON.stringify(addresses.value))
uni.showToast({
title: '删除成功',
icon: 'success'
})
}
} else {
console.error('删除地址失败')
uni.showToast({
title: '删除失败',
icon: 'none'
})
}
}
const deleteAddress = (id: string) => {
uni.showModal({
title: '提示',
content: '确定要删除该地址吗?',
success: (res) => {
if (res.confirm) {
// 调用Supabase服务删除地址
supabaseService.deleteAddress(id).then((success) => {
if (success) {
// 从本地列表移除
const index = addresses.value.findIndex(addr => addr.id === id)
if (index !== -1) {
addresses.value.splice(index, 1)
// 更新本地存储缓存
uni.setStorageSync('addresses', JSON.stringify(addresses.value))
uni.showToast({
title: '删除成功',
icon: 'success'
})
}
} else {
console.error('删除地址失败')
uni.showToast({
title: '删除失败',
icon: 'none'
})
}
})
doDeleteAddress(id)
}
}
})