master #1

Open
gxwebsoft wants to merge 108 commits from developer/template-10584:master into master
Showing only changes of commit 049b2396c3 - Show all commits

View File

@@ -7,7 +7,6 @@ import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
import {listShopUserAddress, removeShopUserAddress, updateShopUserAddress} from "@/api/shop/shopUserAddress"; import {listShopUserAddress, removeShopUserAddress, updateShopUserAddress} from "@/api/shop/shopUserAddress";
import FixedButton from "@/components/FixedButton"; import FixedButton from "@/components/FixedButton";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { getCurrentLngLat } from "@/utils/location";
const Address = () => { const Address = () => {
const [list, setList] = useState<ShopUserAddress[]>([]) const [list, setList] = useState<ShopUserAddress[]>([])
@@ -72,8 +71,7 @@ const Address = () => {
} }
const onDefault = async (item: ShopUserAddress) => { const onDefault = async (item: ShopUserAddress) => {
const loc = await getCurrentLngLat() if (item.isDefault) return
if (!loc) return
if (address) { if (address) {
await updateShopUserAddress({ await updateShopUserAddress({
@@ -84,8 +82,6 @@ const Address = () => {
await updateShopUserAddress({ await updateShopUserAddress({
...item, ...item,
isDefault: true, isDefault: true,
lng: loc.lng,
lat: loc.lat,
}) })
Taro.showToast({ Taro.showToast({
title: '设置成功', title: '设置成功',
@@ -108,8 +104,11 @@ const Address = () => {
} }
const selectAddress = async (item: ShopUserAddress) => { const selectAddress = async (item: ShopUserAddress) => {
const loc = await getCurrentLngLat() if (item.isDefault) {
if (!loc) return const backed = await safeNavigateBack()
if (!backed) reload()
return
}
if (address) { if (address) {
await updateShopUserAddress({ await updateShopUserAddress({
@@ -120,11 +119,10 @@ const Address = () => {
await updateShopUserAddress({ await updateShopUserAddress({
...item, ...item,
isDefault: true, isDefault: true,
lng: loc.lng,
lat: loc.lat,
}) })
setTimeout(() => { setTimeout(async () => {
Taro.navigateBack() const backed = await safeNavigateBack()
if (!backed) reload()
}, 500) }, 500)
} }