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

This commit is contained in:
xuan 2022-09-20 11:28:36 +08:00
parent adc7c36193
commit 078f3e79b7
12 changed files with 235 additions and 216 deletions

51
src/api/delivery/index.ts Normal file
View File

@ -0,0 +1,51 @@
import { useRequest } from '@/use/useHttp'
//列表
export const DeliverNoticeOrderList = () => {
return useRequest({
url: `/v1/mp/deliveryNoticeOrder/list`,
method: 'get',
})
}
//发货详情
export const DeliverNoticeOrder = () => {
return useRequest({
url: `/v1/mp/deliveryNoticeOrder`,
method: 'get',
})
}
//发货附件上传
export const DeliveryNoticeOrderUpload = () => {
return useRequest({
url: `/v1/mp/deliveryNoticeOrder/upload`,
method: 'put',
})
}
//审核发货单
export const DeliveryNoticeOrderAudit = () => {
return useRequest({
url: `/v1/mp/deliveryNoticeOrder/audit`,
method: 'put',
})
}
//采购退货的拒收接口
export const DeliveryNoticeOrderRejection = () => {
return useRequest({
url: `/v1/mp/deliveryNoticeOrder/rejection`,
method: 'put',
})
}
//类型枚举
export const EnumDeliveryNoticeTypeList = () => {
return useRequest({
url: `/v1/mp/enum/deliveryNoticeType/list`,
method: 'get',
})
}
//tabs枚举
export const EnumSaleorderStatus = () => {
return useRequest({
url: `/v1/mp/enum/sale/order/status`,
method: 'get',
})
}

View File

@ -11,6 +11,16 @@ export {
export { ShoppingCartUpdateApi, ShoppingCartDeleteApi, ShoppingCartListApi } from './shopping/index'
export {
DeliverNoticeOrderList,
DeliverNoticeOrder,
DeliveryNoticeOrderUpload,
DeliveryNoticeOrderAudit,
DeliveryNoticeOrderRejection,
EnumDeliveryNoticeTypeList,
EnumSaleorderStatus,
} from './delivery/index'
import { useRequest } from '@/use/useHttp'
/**
*

View File

@ -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;
}

View File

@ -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>
)

View File

@ -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>
)

View File

@ -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;
}

View File

@ -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>
245
@ -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}>

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;

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

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>