✨ feat(Table|LoadMore组件): 新增Table和LoadMore组件

This commit is contained in:
xuan
2022-10-13 17:42:10 +08:00
parent 7bf3fedf9c
commit 3199628d4f
10 changed files with 399 additions and 10 deletions
+36
View File
@@ -51,3 +51,39 @@ page {
font-size: $font_size;
}
}
.rankingIndicatorTitle {
position: 'relative';
padding: 0 32px;
}
.rankingTabs {
position: relative;
background-color: #f5f5f5;
box-sizing: border-box;
border-radius: 8px;
margin-bottom: 24px;
width: 100%;
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: center;
.rankingTab {
flex: 1;
padding: 15px;
color: $color_font_one;
background-color: transparent;
text-align: center;
font-size: $font_size;
transition: all 0.1s;
}
.active {
color: white;
border-radius: 8px;
background-color: $color_main;
}
}
.amount {
color: $color_main;
}
+148 -3
View File
@@ -8,6 +8,7 @@ import SelectMarketingDepartment from '@/components/SelectMarketingDepartment'
import SelectSaleRankingIndicators from '@/components/SelectSaleRankingIndicators'
import SelectSaleType from '@/components/SelectSaleType'
import SelectTimePicker, { ChangedValue } from '@/components/SelectTimePicker'
import Table from '@/components/table'
import TimePicker from '@/components/timePicker'
import { View, Text } from '@tarojs/components'
import classnames from 'classnames'
@@ -30,8 +31,139 @@ const saleStatistic = () => {
console.log('indicators', indicators)
}
//需要传进来的数据示例
const exampledataSource = [
{
key: '1',
username: '小红',
count: '123打发手动阀手动阀啊手动阀',
gb: '321',
dbd: '¥6634.93w',
},
{
key: '2',
username: '小红',
count: '123',
gb: '321',
dbd: '¥6634.93w',
},
{
key: '3',
username: '小红',
count: '123',
gb: '321',
dbd: '¥6634.93w',
},
{
key: '4',
username: '小红',
count: '123',
gb: '321',
dbd: '¥6634.93w',
},
{
key: '5',
username: '小红',
count: '123',
gb: '321',
dbd: '¥6634.93w',
},
{
key: '6',
username: '小红',
count: '123',
gb: '321',
dbd: '¥6634.93w',
},
{
key: '7',
username: '小红',
count: '123',
gb: '321',
dbd: '¥6634.93w',
},
{
key: '8',
username: '小红',
count: '123',
gb: '321',
dbd: '¥6634.93w',
},
{
key: '9',
username: '小红',
count: '123',
gb: '321',
dbd: '¥6634.93w',
},
{
key: '10',
username: '小红',
count: '123',
gb: '321',
dbd: '¥6634.93w',
},
]
//需要传进来的表头数据示例
const examplecolumns = [
{
key: 'username',
title: '编号',
dataIndex: 'username',
width: '20%',
},
{
key: 'count',
title: '面料名称',
dataIndex: 'count',
width: '20%',
ellipsis: {
isEllipsis: true,
rows: 2,
},
},
{
key: 'gb',
title: '匹数',
dataIndex: 'gb',
width: '30%',
},
{
key: 'dbd',
title: '交易金额',
dataIndex: 'dbd',
width: '30%',
render: (text: string) => <Text className={styles.amount}>{text}</Text>,
},
]
const tabsConfig = [
{
name: '面料',
key: 0,
},
{
name: '客户',
key: 1,
},
{
name: '业务员',
key: 2,
},
]
const [currentKey, setCurrentKey] = useState(tabsConfig[0].key)
const handleClickTab = event => {
const key = event.target.dataset.key
if (key === currentKey) return
setCurrentKey(key)
}
return (
<View className={styles.saleStatistic}>
{/* <View style={{background: 'red', width: '100%', height: '200px'}}></View> */}
<View className={styles['saleStatistic--filterBar']}>
<SelectSaleType onChange={onChangeSaleType}></SelectSaleType>
<SelectMarketingDepartment onChange={onChangeDepartment}></SelectMarketingDepartment>
@@ -234,8 +366,8 @@ const saleStatistic = () => {
customClassName={styles['cell-desc']}></Cell>
</LayoutBlock>
{/* 销售排行 */}
<LayoutBlock circle flexDirection='col'>
<View className='flex-row justify-between'>
<LayoutBlock circle flexDirection='col' customStyle={{ padding: 0 }}>
<View className={classnames(styles.rankingIndicatorTitle, 'flex-row justify-between')} style={{ position: 'relative' }}>
<View className='flex-row items-center'>
<Iconfont name='icon-paiming' size={32}></Iconfont>
<Text className={styles.title}>销售排行</Text>
@@ -244,10 +376,23 @@ const saleStatistic = () => {
<SelectSaleRankingIndicators onChange={onChangeIndicators}></SelectSaleRankingIndicators>
</View>
</View>
<Divider direction='horizontal' customStyles={{ margin: '30rpx 0' }}></Divider>
<View style={{ padding: '0 32rpx' }}>
<Divider direction='horizontal' customStyles={{ margin: '10rpx 0 30rpx 0' }}></Divider>
<View className={styles.rankingTabs} onClick={handleClickTab}>
{tabsConfig.map(item => {
return (
<View data-key={item.key} className={classnames(styles.rankingTab, item.key === currentKey ? styles.active : '')} key={item.key}>
{item.name}
</View>
)
})}
</View>
<Table columns={examplecolumns} dataSource={exampledataSource}></Table>
</View>
</LayoutBlock>
</View>
</View>
)
}
export default saleStatistic