|
@@ -2,7 +2,7 @@
|
|
{
|
|
{
|
|
layout: 'default',
|
|
layout: 'default',
|
|
style: {
|
|
style: {
|
|
- navigationBarTitleText: 'Address Book',
|
|
|
|
|
|
+ navigationBarTitleText: '%addressBook.title%',
|
|
navigationBarBackgroundColor: '#fff',
|
|
navigationBarBackgroundColor: '#fff',
|
|
},
|
|
},
|
|
}
|
|
}
|
|
@@ -14,6 +14,7 @@
|
|
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
|
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
|
|
import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
|
|
import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
|
|
import { addressDel, addressList } from '@/api/mine'
|
|
import { addressDel, addressList } from '@/api/mine'
|
|
|
|
+import { t } from '@/locale'
|
|
import { toPage } from '@/utils/page'
|
|
import { toPage } from '@/utils/page'
|
|
import { toast } from '@/utils/toast'
|
|
import { toast } from '@/utils/toast'
|
|
|
|
|
|
@@ -54,23 +55,19 @@ function editAddress(id: any) {
|
|
async function deleteAddress(id: any) {
|
|
async function deleteAddress(id: any) {
|
|
try {
|
|
try {
|
|
await uni.showLoading({
|
|
await uni.showLoading({
|
|
- title: 'Deleting...',
|
|
|
|
|
|
+ title: t('addressBook.delete.deleting'),
|
|
})
|
|
})
|
|
|
|
|
|
const res = await addressDel({ id })
|
|
const res = await addressDel({ id })
|
|
|
|
|
|
if (res.code === '200') {
|
|
if (res.code === '200') {
|
|
- toast.success('Address deleted successfully')
|
|
|
|
|
|
+ toast.success(t('addressBook.delete.success'))
|
|
// 刷新列表
|
|
// 刷新列表
|
|
paging.value.reload()
|
|
paging.value.reload()
|
|
}
|
|
}
|
|
- else {
|
|
|
|
- toast.error(res.message || 'Delete failed, please try again')
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
catch (error: any) {
|
|
catch (error: any) {
|
|
console.error('Delete address error:', error)
|
|
console.error('Delete address error:', error)
|
|
- toast.error(error.message || 'Delete failed, please try again')
|
|
|
|
}
|
|
}
|
|
finally {
|
|
finally {
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
@@ -81,8 +78,8 @@ async function deleteAddress(id: any) {
|
|
function handleAction(action: string, item: any) {
|
|
function handleAction(action: string, item: any) {
|
|
if (action === 'del') {
|
|
if (action === 'del') {
|
|
uni.showModal({
|
|
uni.showModal({
|
|
- title: 'Confirm Delete',
|
|
|
|
- content: 'Are you sure you want to delete this address?',
|
|
|
|
|
|
+ title: t('addressBook.delete.confirm'),
|
|
|
|
+ content: t('addressBook.delete.message'),
|
|
success: (res) => {
|
|
success: (res) => {
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
deleteAddress(item.id)
|
|
deleteAddress(item.id)
|
|
@@ -106,7 +103,7 @@ function handleAction(action: string, item: any) {
|
|
</text>
|
|
</text>
|
|
<text>{{ item.phone }}</text>
|
|
<text>{{ item.phone }}</text>
|
|
</view>
|
|
</view>
|
|
- <wd-text v-if="item.isDefault" type="primary" text="default" />
|
|
|
|
|
|
+ <wd-text v-if="item.isDefault" type="primary" :text="t('addressBook.tag.default')" />
|
|
</view>
|
|
</view>
|
|
<view class="text-22rpx text-#3A444C">
|
|
<view class="text-22rpx text-#3A444C">
|
|
{{ [item.province, item.city, item.district, item.street].filter(Boolean).join(', ') }} {{ item.postCode }}
|
|
{{ [item.province, item.city, item.district, item.street].filter(Boolean).join(', ') }} {{ item.postCode }}
|
|
@@ -117,7 +114,7 @@ function handleAction(action: string, item: any) {
|
|
<template #right>
|
|
<template #right>
|
|
<view class="action">
|
|
<view class="action">
|
|
<view class="button" style="background:var(--wot-color-theme);" @click="handleAction('del', item)">
|
|
<view class="button" style="background:var(--wot-color-theme);" @click="handleAction('del', item)">
|
|
- 删除
|
|
|
|
|
|
+ {{ t('addressBook.delete.button') }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
@@ -126,7 +123,7 @@ function handleAction(action: string, item: any) {
|
|
<template #bottom>
|
|
<template #bottom>
|
|
<view class="bg-white/60 px-28rpx py-30rpx backdrop-blur-20">
|
|
<view class="bg-white/60 px-28rpx py-30rpx backdrop-blur-20">
|
|
<wd-button plain block @click="toPage('/pages/mine/addressBookOperate')">
|
|
<wd-button plain block @click="toPage('/pages/mine/addressBookOperate')">
|
|
- Add New Address
|
|
|
|
|
|
+ {{ t('addressBook.button.add') }}
|
|
</wd-button>
|
|
</wd-button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|