✨ feat(发货单): 调整发货单 API

This commit is contained in:
xuan
2022-09-20 19:39:16 +08:00
parent adc7c36193
commit 078f3e79b7
12 changed files with 235 additions and 216 deletions
@@ -2,18 +2,19 @@
margin: 24px;
}
.topBar {
font-size: 28px;
&__orderNo {
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
color: $color_font_one;
font-size: 28px;
}
&__orderType {
color: rgba($color: #000000, $alpha: 0.6);
font-weight: 550;
}
&__orderStatus {
font-weight: 550;
color: #e42945;
}
}
@@ -36,10 +37,11 @@
flex-flow: row nowrap;
justify-content: flex-end;
align-items: center;
padding: 0 24px;
margin-top: 10px;
&__button {
margin: 0 24px;
font-size: 28px;
padding: 0 26px;
}
&__button:last-child {
margin: 0;
@@ -48,3 +50,6 @@
.bord {
color: $color_font_one;
}
.tag{
margin: 0 16px;
}
@@ -5,6 +5,7 @@ import { View, Text } from '@tarojs/components'
import { FC } from 'react'
import NormalButton from '@/components/normalButton'
import styles from './index.module.scss'
import classnames from 'classnames'
type PropsType = {
itemData?: Record<string, any>
@@ -30,12 +31,12 @@ const ItemList:FC<PropsType> = (props) => {
</View>
<Text className={styles.topBar__orderType}>销售发货单</Text>
</View>
<Divider direction='horizontal'></Divider>
<Divider direction='horizontal' customStyles={{ margin: '30rpx 0' }}></Divider>
<View className={styles.content}>
<View className={styles.content__row}>
<View className={classnames(styles.content__row, styles.bord)}>
<View className={styles.content__row__left}>货品信息:</View>
<View className={styles.content__row__right}>
<Tag type='primary' circle plain>
<Tag type='primary' circle plain size='small' customClassName={styles.tag}>
大货
</Tag>
2种面料,4种颜色,共5米
@@ -51,7 +52,12 @@ const ItemList:FC<PropsType> = (props) => {
</View>
</View>
<View className={styles.bottomBar}>
<NormalButton customClassName={styles.bottomBar__button} type='info' round onClick={handleDetail}>
<NormalButton
customClassName={styles.bottomBar__button}
type='info'
customStyles={{ color: '#8e8e8e', borderColor: '#8e8e8e' }}
round
onClick={handleDetail}>
查看详情
</NormalButton>
<NormalButton customClassName={styles.bottomBar__button} type='primary' round onClick={handleAudit}>
+8 -83
View File
@@ -1,104 +1,29 @@
page {
background: #f7f7f7;
height: 100%;
display: flex;
flex-flow: column nowrap;
}
.delivery {
display: flex;
flex-flow: column nowrap;
overflow: hidden;
padding-bottom: env(safe-area-inset-bottom);
.searchBox {
display: flex;
align-items: center;
background: #ffffff;
padding: 8px 24px;
flex: none;
}
.listBox {
flex: 1 1 auto;
background-color: #f7f7f7;
overflow: scroll;
}
.itemBox {
margin-left: 24px;
background: #ffffff;
border-radius: 16px;
display: flex;
align-items: center;
margin-top: 24px;
box-sizing: border-box;
.cussName {
margin-left: 48px;
width: 168px;
height: 34px;
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.phone {
margin-left: 88px;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
.woker {
margin-left: 88px;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
}
.acticveitemBox {
margin-left: 24px;
width: 702px;
height: 104px;
background: #ffffff;
border-radius: 16px;
display: flex;
align-items: center;
margin-top: 24px;
box-sizing: border-box;
border: 1px solid #337fff;
.cussName {
margin-left: 48px;
width: 168px;
height: 34px;
font-size: 28px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.phone {
margin-left: 88px;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
.woker {
margin-left: 88px;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
}
}
}
.scanHandler{
width: 40px;
+101 -101
View File
@@ -9,123 +9,123 @@ import { useRouter } from '@tarojs/taro'
import InfiniteScroll from '@/components/infiniteScroll'
import { dataLoadingStatus, getFilterData } from '@/common/util'
import IconText from '@/components/iconText'
import SegmentedControl from '@/components/SegmentedControl'
import SegmentedControl from '@/components/segmentedControl'
import IconFont from '@/components/iconfont/iconfont'
import ItemList from './components/ItemList'
// 发货列表
const Delivery: FC = () => {
const [search, setSearch] = useState({
name: null,
page: 1,
size: 10,
})
const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
// const [search, setSearch] = useState({
// name: null,
// page: 1,
// size: 10,
// })
// const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
const { fetchData: clitentFetch, state: orderState } = ClientListApi()
//数据加载状态
const statusMore = useMemo(() => {
return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading })
}, [clentList, orderState])
// const { fetchData: clitentFetch, state: orderState } = ClientListApi()
// //数据加载状态
// const statusMore = useMemo(() => {
// return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading })
// }, [clentList, orderState])
const [clientObj, setclientObj] = useState({
clientId: null,
clientName: '',
})
// const [clientObj, setclientObj] = useState({
// clientId: null,
// clientName: '',
// })
//输入了搜索关键字
const getSearchData = useCallback((eq) => {
pageNum.current.page = 1
setClientlist(() => ({ list: [], total: 0 }))
setSearch((e) => ({ ...e, name: eq, size: 10 }))
// pageNum.current.page = 1
// setClientlist(() => ({ list: [], total: 0 }))
// setSearch((e) => ({ ...e, name: eq, size: 10 }))
}, [])
const router = useRouter()
// const router = useRouter()
useEffect(() => {
if (search.name === '') {
setSearch((e) => ({ ...e, name: null }))
}
if (search.name !== '') getCuss()
}, [search])
// useEffect(() => {
// if (search.name === '') {
// setSearch((e) => ({ ...e, name: null }))
// }
// if (search.name !== '') getCuss()
// }, [search])
//上拉加载数据
const pageNum = useRef({ size: search.size, page: search.page })
const getScrolltolower = useCallback(() => {
if (clentList.list.length < clentList.total) {
pageNum.current.page++
const size = pageNum.current.size * pageNum.current.page
setSearch((e) => ({ ...e, size }))
console.log(search, 11111)
}
}, [clentList])
// //上拉加载数据
// const pageNum = useRef({ size: search.size, page: search.page })
// const getScrolltolower = useCallback(() => {
// if (clentList.list.length < clentList.total) {
// pageNum.current.page++
// const size = pageNum.current.size * pageNum.current.page
// setSearch((e) => ({ ...e, size }))
// console.log(search, 11111)
// }
// }, [clentList])
//列表下拉刷新
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
const getRefresherRefresh = async () => {
pageNum.current.size = 1
setRefresherTriggeredStatus(true)
setSearch((val) => ({ ...val, size: 10 }))
}
const getCuss = async () => {
let res = await clitentFetch({ name: search.name === null ? '' : search.name, page: search.page, size: search.size })
if (router?.params.clientId) {
res.data.list.map((item) => {
if (item.id == router?.params.clientId) {
item.checked = true
} else {
item.checked = false
}
return item
})
}
setClientlist((e) => ({ ...e, list: res.data?.list, total: res.data?.total }))
setRefresherTriggeredStatus(() => false)
}
// //列表下拉刷新
// const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
// const getRefresherRefresh = async () => {
// pageNum.current.size = 1
// setRefresherTriggeredStatus(true)
// setSearch((val) => ({ ...val, size: 10 }))
// }
// const getCuss = async () => {
// let res = await clitentFetch({ name: search.name === null ? '' : search.name, page: search.page, size: search.size })
// if (router?.params.clientId) {
// res.data.list.map((item) => {
// if (item.id == router?.params.clientId) {
// item.checked = true
// } else {
// item.checked = false
// }
// return item
// })
// }
// setClientlist((e) => ({ ...e, list: res.data?.list, total: res.data?.total }))
// setRefresherTriggeredStatus(() => false)
// }
//选择客户
const selectClient = (item) => {
clentList.list.map((it) => {
if (item.id === it.id) {
it.checked = true
} else {
it.checked = false
}
return it
})
setclientObj(item)
let pages = Taro.getCurrentPages() // 获取当前的页面栈
let prevPage = pages[pages.length - 2]
prevPage.setData({
//设置上一个页面的值
clientId: item.id,
clientName: item.name,
})
setClientlist((e) => ({ ...e, list: clentList?.list, total: clentList?.total }))
Taro.navigateBack({
delta: 1,
})
}
useEffect(() => {
if (clientObj?.clientId !== null) {
setclientObj(clientObj)
} else {
let pages = Taro.getCurrentPages() // 获取当前的页面栈
let prevPage = pages[pages.length - 2]
prevPage.setData({
//设置上一个页面的值
clientId: '',
clientName: '',
})
}
}, [clientObj])
// //选择客户
// const selectClient = (item) => {
// clentList.list.map((it) => {
// if (item.id === it.id) {
// it.checked = true
// } else {
// it.checked = false
// }
// return it
// })
// setclientObj(item)
// let pages = Taro.getCurrentPages() // 获取当前的页面栈
// let prevPage = pages[pages.length - 2]
// prevPage.setData({
// //设置上一个页面的值
// clientId: item.id,
// clientName: item.name,
// })
// setClientlist((e) => ({ ...e, list: clentList?.list, total: clentList?.total }))
// Taro.navigateBack({
// delta: 1,
// })
// }
// useEffect(() => {
// if (clientObj?.clientId !== null) {
// setclientObj(clientObj)
// } else {
// let pages = Taro.getCurrentPages() // 获取当前的页面栈
// let prevPage = pages[pages.length - 2]
// prevPage.setData({
// //设置上一个页面的值
// clientId: '',
// clientName: '',
// })
// }
// }, [clientObj])
// 筛选列表
const onShowFilter = () => {}
const [statusList, setStatusList] = useState([
{
id: 1,
id: -1,
name: '待发货',
},
{
@@ -136,7 +136,7 @@ const Delivery: FC = () => {
// //状态改变
const changeStatus = useCallback((e) => {
pageNum.current.page = 1
// pageNum.current.page = 1
// setSearchField((value) => ({ ...value, status: e, size: 10 }))
console.log(e, '123123')
@@ -163,7 +163,7 @@ const Delivery: FC = () => {
</Search>
</View>
{/* 状态栏 */}
<SegmentedControl list={statusList} onSelect={changeStatus} defaultId={0} />
<SegmentedControl list={statusList} onSelect={changeStatus} defaultId={-1} />
<View className={styles.listBox}>
{/* <InfiniteScroll
@@ -187,10 +187,10 @@ const Delivery: FC = () => {
)
})}
</InfiniteScroll> */}
<ItemList ></ItemList>
<ItemList ></ItemList>
<ItemList ></ItemList>
<ItemList ></ItemList>
<ItemList></ItemList>
<ItemList></ItemList>
<ItemList></ItemList>
<ItemList></ItemList>
</View>
</View>
)
View File
+2 -2
View File
@@ -32,7 +32,7 @@ const feature: IconCardType[] = [
{
iconName: 'icon-fahuoliebiao',
name: '发货列表',
path: '',
path: '/pages/delivery/index',
},
{
iconName: 'icon-yaoqingma',
@@ -169,7 +169,7 @@ const UserInfo: FC = () => {
<View className={styles.layoutTitle}>统计分析</View>
<View className={styles['grid-container']}>
{statisticAnalysis.map((item) => {
return <IconCard iconName={item.iconName} title={item.name}></IconCard>
return <IconCard iconName={item.iconName} title={item.name} onClick={() => handleClickIconCard(item)}></IconCard>
})}
</View>
</LayoutBlock>