✨ feat(发货单): 调整发货单 API
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
.status_list{
|
||||
background-color: #fff;
|
||||
font-size: $font_size;
|
||||
color: #000;
|
||||
// margin-top: 20px;
|
||||
.status_item{
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.selected{
|
||||
font-weight: 700;
|
||||
color: #337FFF;
|
||||
border-bottom: 4px solid #337FFF;
|
||||
}
|
||||
.list_scroll{
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
}
|
||||
.status_list {
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
background-color: #fff;
|
||||
font-size: $font_size;
|
||||
color: #000;
|
||||
// margin-top: 20px;
|
||||
.status_item {
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.list_scroll {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
.selected {
|
||||
font-weight: 700;
|
||||
color: #337fff;
|
||||
border-bottom: 4px solid #337fff;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,14 @@ import classnames from 'classnames'
|
||||
import { FC, useEffect, useState } from 'react'
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type Segment = {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
|
||||
type PropsType = {
|
||||
list: { id: number; name: string }[]
|
||||
defaultId?: number | null
|
||||
list: Segment[]
|
||||
defaultId?: number
|
||||
onSelect?: (val: number) => void
|
||||
}
|
||||
|
||||
@@ -14,9 +19,10 @@ const segmentedControl: FC<PropsType> = (props) => {
|
||||
selected: -1, //当前选中的id
|
||||
tabId: '', //需要滚动到的id
|
||||
})
|
||||
const { list, defaultId, onSelect } = props
|
||||
const { list, defaultId = -1, onSelect } = props
|
||||
|
||||
useEffect(() => {
|
||||
console.log('defaultId', defaultId)
|
||||
if (typeof defaultId === 'number' && defaultId >= 0) {
|
||||
console.log('defaultId:::', defaultId)
|
||||
const index = list?.findIndex((item) => {
|
||||
@@ -28,6 +34,7 @@ const segmentedControl: FC<PropsType> = (props) => {
|
||||
}
|
||||
}
|
||||
setSelectInfo((e) => ({ ...e, selected: defaultId || -1 }))
|
||||
console.log('selectInfo', selectInfo)
|
||||
}, [defaultId])
|
||||
|
||||
const clickEvent = ({ item, index }: { item: any; index: number }) => {
|
||||
@@ -41,12 +48,13 @@ const segmentedControl: FC<PropsType> = (props) => {
|
||||
<ScrollView scrollX scrollIntoView={`tabs_${selectInfo.tabId}`} scrollWithAnimation={true}>
|
||||
<View className={styles.list_scroll}>
|
||||
{list.map((item, index) => {
|
||||
console.log('selected=+>', selectInfo.selected)
|
||||
return (
|
||||
<View
|
||||
key={item.id}
|
||||
id={`tabs_${item.id}`}
|
||||
onClick={() => clickEvent({ item, index })}
|
||||
className={classnames(styles.status_item, selectInfo.selected == item.id && styles.selected)}>
|
||||
className={classnames(styles.status_item, selectInfo.selected === item.id ? styles.selected : '')}>
|
||||
{item.name}
|
||||
</View>
|
||||
)
|
||||
|
||||
@@ -15,10 +15,21 @@ interface PropsType {
|
||||
onClick?: Function
|
||||
circle?: boolean
|
||||
customStyle?: React.CSSProperties
|
||||
customClassName?: string
|
||||
}
|
||||
|
||||
const Tag: FC<PropsType> = (props) => {
|
||||
const { type = 'primary', size = 'normal', disabled = false, children, onClick, circle = false, customStyle = {}, plain = false } = props
|
||||
const {
|
||||
type = 'primary',
|
||||
size = 'normal',
|
||||
disabled = false,
|
||||
children,
|
||||
onClick,
|
||||
circle = false,
|
||||
customStyle = {},
|
||||
plain = false,
|
||||
customClassName = '',
|
||||
} = props
|
||||
const handleClick = (event) => {
|
||||
if (disabled) {
|
||||
return
|
||||
@@ -37,7 +48,7 @@ const Tag: FC<PropsType> = (props) => {
|
||||
return classObject
|
||||
}
|
||||
return (
|
||||
<View className={classnames(styles.tag, getClassName())} style={customStyle} onClick={handleClick}>
|
||||
<View className={classnames(styles.tag, getClassName(), customClassName)} style={customStyle} onClick={handleClick}>
|
||||
<Text className={styles['tag--text']}>{children}</Text>
|
||||
</View>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user