优化细节

This commit is contained in:
2025-07-23 14:15:50 +08:00
parent d3f39dab68
commit 3e315bf9ee
28 changed files with 2547 additions and 303 deletions

124
src/user/address/index.tsx Normal file
View File

@@ -0,0 +1,124 @@
import {useEffect, useState} from "react";
import {Button, Cell, CellGroup, Space, Empty, ConfigProvider, Divider} from '@nutui/nutui-react-taro'
import {Dongdong, ArrowRight, CheckNormal, Checked} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
import {View} from '@tarojs/components'
import {ShopUserAddress} from "@/api/shop/shopUserAddress/model";
import {listShopUserAddress} from "@/api/shop/shopUserAddress";
const Address = () => {
const [list, setList] = useState<ShopUserAddress[]>([{},{},{},{}])
const reload = () => {
listShopUserAddress({userId: Taro.getStorageSync('UserId')}).then(res => {
// setList(res)
}).catch(error => {
console.error("Failed to fetch goods detail:", error);
})
}
useEffect(() => {
reload()
}, []);
if (list.length == 0) {
return (
<ConfigProvider>
<div className={'h-full flex flex-col justify-center items-center'} style={{
height: 'calc(100vh - 300px)',
}}>
<Empty
style={{
backgroundColor: 'transparent'
}}
description="您还没有地址哦"
/>
<Space>
<Button onClick={() => Taro.navigateTo({url: '/user/address/add'})}></Button>
<Button type="success" fill="dashed"></Button>
</Space>
</div>
</ConfigProvider>
)
}
if (list.length == 0) {
return (
<CellGroup>
<Cell className={''}>
<Space>
<Button></Button>
<Button></Button>
</Space>
</Cell>
</CellGroup>
)
}
return (
<>
<CellGroup>
<Cell
onClick={() => Taro.navigateTo({url: '/user/address/wxAddress'})}
>
<div className={'flex justify-between items-center w-full'}>
<div className={'flex items-center gap-3'}>
<Dongdong className={'text-green-600'}/>
<div></div>
</div>
<ArrowRight className={'text-gray-400'}/>
</div>
</Cell>
</CellGroup>
{list.map((item,index) => (
// <CellGroup key={item.id}>
// <Cell title={item.name}
// extra={
// <Button
// type="primary"
// size="small"
// >
// 修改
// </Button>
// }
// >
// <div className={'text-sm'}>{item.fullAddress}</div>
//
// </Cell>
// </CellGroup>
<Cell.Group>
<Cell className={'flex flex-col gap-1'}>
<View>
<View className={'font-medium text-sm'}> 13800010001</View>
</View>
<View className={'text-xs'}>
广西13
</View>
</Cell>
<Cell
align="center"
title={
<View className={'flex items-center gap-1'}>
{index == 0 ? <Checked className={'text-green-600'} size={16}/> : <CheckNormal size={16} />}
<View className={'text-gray-400'}></View>
</View>
}
extra={
<>
<View className={'text-gray-400'}>
</View>
<Divider direction={'vertical'}/>
<View className={'text-gray-400'}>
</View>
</>
}
/>
</Cell.Group>
))}
</>
);
};
export default Address;