优化细节
This commit is contained in:
92
src/user/address/wxAddress.tsx
Normal file
92
src/user/address/wxAddress.tsx
Normal file
@@ -0,0 +1,92 @@
|
||||
import {useEffect, useState} from "react";
|
||||
import {Button, Cell, CellGroup, Space, Empty, ConfigProvider} from '@nutui/nutui-react-taro'
|
||||
import {Dongdong} from '@nutui/icons-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
|
||||
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
|
||||
|
||||
const Address = () => {
|
||||
const [list, setList] = useState<ShopUserAddress[]>([{
|
||||
id: 1,
|
||||
name: '张三',
|
||||
phone: '13800138000',
|
||||
country: '中国',
|
||||
province: '广东省',
|
||||
city: '广州市',
|
||||
region: '天河区',
|
||||
address: '黄埔大道西10号',
|
||||
fullAddress: '广东省广州市天河区黄埔大道西10号',
|
||||
lat: '23.129163',
|
||||
lng: '113.382391',
|
||||
gender: 1,
|
||||
type: 'home',
|
||||
isDefault: true,
|
||||
userId: 1,
|
||||
tenantId: 1,
|
||||
createTime: '2021-09-01 10:10:10',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '李四',
|
||||
phone: '13800138000',
|
||||
country: '中国',
|
||||
province: '广西壮族自治区',
|
||||
city: '南宁市',
|
||||
region: '青秀区',
|
||||
address: '青秀区民族大道100号',
|
||||
fullAddress: '广西壮族自治区南宁市青秀区民族大道100号',
|
||||
lat: '23.129163',
|
||||
lng: '113.382391',
|
||||
gender: 1,
|
||||
type: 'home',
|
||||
isDefault: true,
|
||||
userId: 1,
|
||||
tenantId: 1,
|
||||
createTime: '2021-09-01 10:10:10',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '张三',
|
||||
phone: '13800138000',
|
||||
country: '中国',
|
||||
province: '广西',
|
||||
city: '南宁市',
|
||||
region: '青秀区',
|
||||
address: '青秀区民族大道100号',
|
||||
fullAddress: '广西壮族自治区南宁市青秀区民族大道100号',
|
||||
lat: '23.129163',
|
||||
lng: '113.382391',
|
||||
gender: 1,
|
||||
type: 'home',
|
||||
isDefault: true,
|
||||
userId: 1,
|
||||
tenantId: 1,
|
||||
createTime: '2021-09-01 10:10:10',
|
||||
}])
|
||||
|
||||
const reload = () => {
|
||||
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
|
||||
// setList(res)
|
||||
}).catch(error => {
|
||||
console.error("Failed to fetch goods detail:", error);
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
reload()
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{list.map((item) => (
|
||||
<div className={'flex flex-col bg-white my-3 py-1 px-4'}>
|
||||
<div className={'py-1'}>{item.province}{item.city}{item.region}</div>
|
||||
<div className={'py-1'}>{item.address}</div>
|
||||
<div className={'text-gray-500 py-1'}>{item.name} {item.phone}</div>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default Address;
|
||||
Reference in New Issue
Block a user