- 创建 .editorconfig 文件统一代码风格配置 - 配置 .eslintrc 使用 taro/react 规则集 - 完善 .gitignore 忽略编译产物和敏感文件 - 添加 admin/article/add 页面实现文章管理功能 - 添加 dealer/apply/add 页面实现经销商申请功能 - 添加 dealer/bank/add 页面实现银行卡管理功能 - 添加 dealer/customer/add 页面实现客户管理功能 - 添加 user/address/add 页面实现用户地址管理功能 - 添加 user/chat/message/add 页面实现消息功能 - 添加 user/gift/add 页面实现礼品管理功能 - 配置各页面导航栏标题和样式 - 实现表单验证和数据提交功能 - 集成图片上传和头像选择功能 - 添加日期选择和数据校验逻辑 - 实现编辑和新增模式切换 - 集成用户权限和角色管理功能
68 lines
2.6 KiB
TypeScript
68 lines
2.6 KiB
TypeScript
import {useEffect, useState} from "react";
|
|
import {Image} from '@nutui/nutui-react-taro'
|
|
import {Share} from '@nutui/icons-react-taro'
|
|
import Taro from '@tarojs/taro'
|
|
import {ShopGoods} from "@/api/shop/shopGoods/model";
|
|
import {pageShopGoods} from "@/api/shop/shopGoods";
|
|
import './GoodsList.scss'
|
|
|
|
|
|
const BestSellers = () => {
|
|
const [list, setList] = useState<ShopGoods[]>([])
|
|
|
|
const reload = () => {
|
|
pageShopGoods({}).then(res => {
|
|
setList(res?.list || []);
|
|
})
|
|
}
|
|
|
|
useEffect(() => {
|
|
reload()
|
|
}, [])
|
|
|
|
return (
|
|
<>
|
|
<div className={'py-3'}>
|
|
<div className={'flex flex-wrap justify-between items-start rounded-lg px-2'}>
|
|
{list?.map((item, index) => {
|
|
return (
|
|
<div key={index} className={'flex flex-col rounded-lg bg-white shadow-sm mb-5'} style={{
|
|
width: '48%'
|
|
}}>
|
|
<Image src={item.image} mode={'scaleToFill'} lazyLoad={false}
|
|
radius="10px 10px 0 0" height="180"
|
|
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/>
|
|
<div className={'flex flex-col p-2 rounded-lg'}>
|
|
<div>
|
|
<div className={'car-no text-sm'}>{item.name}</div>
|
|
<div className={'flex justify-between text-xs py-1'}>
|
|
<span className={'text-orange-500'}>{item.comments}</span>
|
|
<span className={'text-gray-400'}>已售 {item.sales}</span>
|
|
</div>
|
|
<div className={'flex justify-between items-center py-2'}>
|
|
<div className={'flex text-red-500 text-xl items-baseline'}>
|
|
<span className={'text-xs'}>¥</span>
|
|
<span className={'font-bold text-2xl'}>{item.price}</span>
|
|
</div>
|
|
<div className={'buy-btn'}>
|
|
<div className={'cart-icon'}>
|
|
<Share size={20} className={'mx-4 mt-2'}
|
|
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}/>
|
|
</div>
|
|
<div className={'text-white pl-4 pr-5'}
|
|
onClick={() => Taro.navigateTo({url: '/shop/goodsDetail/index?id=' + item.goodsId})}>购买
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
})}
|
|
</div>
|
|
</div>
|
|
</>
|
|
)
|
|
}
|
|
export default BestSellers
|