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 { ShoppingCartUpdateApi, ShoppingCartDeleteApi, ShoppingCartListApi } from './shopping/index'
export {
DeliverNoticeOrderList,
DeliverNoticeOrder,
DeliveryNoticeOrderUpload,
DeliveryNoticeOrderAudit,
DeliveryNoticeOrderRejection,
EnumDeliveryNoticeTypeList,
EnumSaleorderStatus,
} from './delivery/index'
import { useRequest } from '@/use/useHttp' import { useRequest } from '@/use/useHttp'
/** /**
* *

View File

@ -1,4 +1,6 @@
.status_list { .status_list {
display: flex;
flex-flow: row nowrap;
background-color: #fff; background-color: #fff;
font-size: $font_size; font-size: $font_size;
color: #000; color: #000;
@ -7,13 +9,14 @@
padding: 20px; padding: 20px;
box-sizing: border-box; box-sizing: border-box;
} }
.list_scroll {
display: flex;
justify-content: space-around;
white-space: nowrap;
}
}
.selected { .selected {
font-weight: 700; font-weight: 700;
color: #337FFF; color: #337fff;
border-bottom: 4px solid #337FFF; border-bottom: 4px solid #337fff;
}
.list_scroll{
white-space: nowrap;
display: flex;
}
} }

View File

@ -3,9 +3,14 @@ import classnames from 'classnames'
import { FC, useEffect, useState } from 'react' import { FC, useEffect, useState } from 'react'
import styles from './index.module.scss' import styles from './index.module.scss'
type Segment = {
id: number
name: string
}
type PropsType = { type PropsType = {
list: { id: number; name: string }[] list: Segment[]
defaultId?: number | null defaultId?: number
onSelect?: (val: number) => void onSelect?: (val: number) => void
} }
@ -14,9 +19,10 @@ const segmentedControl: FC<PropsType> = (props) => {
selected: -1, //当前选中的id selected: -1, //当前选中的id
tabId: '', //需要滚动到的id tabId: '', //需要滚动到的id
}) })
const { list, defaultId, onSelect } = props const { list, defaultId = -1, onSelect } = props
useEffect(() => { useEffect(() => {
console.log('defaultId', defaultId)
if (typeof defaultId === 'number' && defaultId >= 0) { if (typeof defaultId === 'number' && defaultId >= 0) {
console.log('defaultId:::', defaultId) console.log('defaultId:::', defaultId)
const index = list?.findIndex((item) => { const index = list?.findIndex((item) => {
@ -28,6 +34,7 @@ const segmentedControl: FC<PropsType> = (props) => {
} }
} }
setSelectInfo((e) => ({ ...e, selected: defaultId || -1 })) setSelectInfo((e) => ({ ...e, selected: defaultId || -1 }))
console.log('selectInfo', selectInfo)
}, [defaultId]) }, [defaultId])
const clickEvent = ({ item, index }: { item: any; index: number }) => { 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}> <ScrollView scrollX scrollIntoView={`tabs_${selectInfo.tabId}`} scrollWithAnimation={true}>
<View className={styles.list_scroll}> <View className={styles.list_scroll}>
{list.map((item, index) => { {list.map((item, index) => {
console.log('selected=+>', selectInfo.selected)
return ( return (
<View <View
key={item.id} key={item.id}
id={`tabs_${item.id}`} id={`tabs_${item.id}`}
onClick={() => clickEvent({ item, index })} 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} {item.name}
</View> </View>
) )

View File

@ -15,10 +15,21 @@ interface PropsType {
onClick?: Function onClick?: Function
circle?: boolean circle?: boolean
customStyle?: React.CSSProperties customStyle?: React.CSSProperties
customClassName?: string
} }
const Tag: FC<PropsType> = (props) => { 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) => { const handleClick = (event) => {
if (disabled) { if (disabled) {
return return
@ -37,7 +48,7 @@ const Tag: FC<PropsType> = (props) => {
return classObject return classObject
} }
return ( 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> <Text className={styles['tag--text']}>{children}</Text>
</View> </View>
) )

View File

@ -2,18 +2,19 @@
margin: 24px; margin: 24px;
} }
.topBar { .topBar {
font-size: 28px;
&__orderNo { &__orderNo {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
justify-content: space-between; justify-content: space-between;
color: $color_font_one; color: $color_font_one;
font-size: 28px;
} }
&__orderType { &__orderType {
color: rgba($color: #000000, $alpha: 0.6); color: rgba($color: #000000, $alpha: 0.6);
font-weight: 550; font-weight: 550;
} }
&__orderStatus { &__orderStatus {
font-weight: 550;
color: #e42945; color: #e42945;
} }
} }
@ -36,10 +37,11 @@
flex-flow: row nowrap; flex-flow: row nowrap;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
padding: 0 24px;
margin-top: 10px; margin-top: 10px;
&__button { &__button {
margin: 0 24px; margin: 0 24px;
font-size: 28px;
padding: 0 26px;
} }
&__button:last-child { &__button:last-child {
margin: 0; margin: 0;
@ -48,3 +50,6 @@
.bord { .bord {
color: $color_font_one; 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 { FC } from 'react'
import NormalButton from '@/components/normalButton' import NormalButton from '@/components/normalButton'
import styles from './index.module.scss' import styles from './index.module.scss'
import classnames from 'classnames'
type PropsType = { type PropsType = {
itemData?: Record<string, any> itemData?: Record<string, any>
@ -30,12 +31,12 @@ const ItemList:FC<PropsType> = (props) => {
</View> </View>
<Text className={styles.topBar__orderType}></Text> <Text className={styles.topBar__orderType}></Text>
</View> </View>
<Divider direction='horizontal'></Divider> <Divider direction='horizontal' customStyles={{ margin: '30rpx 0' }}></Divider>
<View className={styles.content}> <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__left}></View>
<View className={styles.content__row__right}> <View className={styles.content__row__right}>
<Tag type='primary' circle plain> <Tag type='primary' circle plain size='small' customClassName={styles.tag}>
</Tag> </Tag>
245 245
@ -51,7 +52,12 @@ const ItemList:FC<PropsType> = (props) => {
</View> </View>
</View> </View>
<View className={styles.bottomBar}> <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>
<NormalButton customClassName={styles.bottomBar__button} type='primary' round onClick={handleAudit}> <NormalButton customClassName={styles.bottomBar__button} type='primary' round onClick={handleAudit}>

View File

@ -1,104 +1,29 @@
page { page {
background: #f7f7f7; background: #f7f7f7;
height: 100%;
display: flex;
flex-flow: column nowrap;
} }
.delivery { .delivery {
display: flex; display: flex;
flex-flow: column nowrap; flex-flow: column nowrap;
overflow: hidden;
padding-bottom: env(safe-area-inset-bottom);
.searchBox { .searchBox {
display: flex; display: flex;
align-items: center; align-items: center;
background: #ffffff; background: #ffffff;
padding: 8px 24px; padding: 8px 24px;
flex: none;
} }
.listBox { .listBox {
flex: 1 1 auto;
background-color: #f7f7f7; 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{ .scanHandler{
width: 40px; width: 40px;

View File

@ -9,123 +9,123 @@ import { useRouter } from '@tarojs/taro'
import InfiniteScroll from '@/components/infiniteScroll' import InfiniteScroll from '@/components/infiniteScroll'
import { dataLoadingStatus, getFilterData } from '@/common/util' import { dataLoadingStatus, getFilterData } from '@/common/util'
import IconText from '@/components/iconText' import IconText from '@/components/iconText'
import SegmentedControl from '@/components/SegmentedControl' import SegmentedControl from '@/components/segmentedControl'
import IconFont from '@/components/iconfont/iconfont' import IconFont from '@/components/iconfont/iconfont'
import ItemList from './components/ItemList' import ItemList from './components/ItemList'
// 发货列表 // 发货列表
const Delivery: FC = () => { const Delivery: FC = () => {
const [search, setSearch] = useState({ // const [search, setSearch] = useState({
name: null, // name: null,
page: 1, // page: 1,
size: 10, // size: 10,
}) // })
const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 }) // const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
const { fetchData: clitentFetch, state: orderState } = ClientListApi() // const { fetchData: clitentFetch, state: orderState } = ClientListApi()
//数据加载状态 // //数据加载状态
const statusMore = useMemo(() => { // const statusMore = useMemo(() => {
return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading }) // return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading })
}, [clentList, orderState]) // }, [clentList, orderState])
const [clientObj, setclientObj] = useState({ // const [clientObj, setclientObj] = useState({
clientId: null, // clientId: null,
clientName: '', // clientName: '',
}) // })
//输入了搜索关键字 //输入了搜索关键字
const getSearchData = useCallback((eq) => { const getSearchData = useCallback((eq) => {
pageNum.current.page = 1 // pageNum.current.page = 1
setClientlist(() => ({ list: [], total: 0 })) // setClientlist(() => ({ list: [], total: 0 }))
setSearch((e) => ({ ...e, name: eq, size: 10 })) // setSearch((e) => ({ ...e, name: eq, size: 10 }))
}, []) }, [])
const router = useRouter() // const router = useRouter()
useEffect(() => { // useEffect(() => {
if (search.name === '') { // if (search.name === '') {
setSearch((e) => ({ ...e, name: null })) // setSearch((e) => ({ ...e, name: null }))
} // }
if (search.name !== '') getCuss() // if (search.name !== '') getCuss()
}, [search]) // }, [search])
//上拉加载数据 // //上拉加载数据
const pageNum = useRef({ size: search.size, page: search.page }) // const pageNum = useRef({ size: search.size, page: search.page })
const getScrolltolower = useCallback(() => { // const getScrolltolower = useCallback(() => {
if (clentList.list.length < clentList.total) { // if (clentList.list.length < clentList.total) {
pageNum.current.page++ // pageNum.current.page++
const size = pageNum.current.size * pageNum.current.page // const size = pageNum.current.size * pageNum.current.page
setSearch((e) => ({ ...e, size })) // setSearch((e) => ({ ...e, size }))
console.log(search, 11111) // console.log(search, 11111)
} // }
}, [clentList]) // }, [clentList])
//列表下拉刷新 // //列表下拉刷新
const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false) // const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false)
const getRefresherRefresh = async () => { // const getRefresherRefresh = async () => {
pageNum.current.size = 1 // pageNum.current.size = 1
setRefresherTriggeredStatus(true) // setRefresherTriggeredStatus(true)
setSearch((val) => ({ ...val, size: 10 })) // setSearch((val) => ({ ...val, size: 10 }))
} // }
const getCuss = async () => { // const getCuss = async () => {
let res = await clitentFetch({ name: search.name === null ? '' : search.name, page: search.page, size: search.size }) // let res = await clitentFetch({ name: search.name === null ? '' : search.name, page: search.page, size: search.size })
if (router?.params.clientId) { // if (router?.params.clientId) {
res.data.list.map((item) => { // res.data.list.map((item) => {
if (item.id == router?.params.clientId) { // if (item.id == router?.params.clientId) {
item.checked = true // item.checked = true
} else { // } else {
item.checked = false // item.checked = false
} // }
return item // return item
}) // })
} // }
setClientlist((e) => ({ ...e, list: res.data?.list, total: res.data?.total })) // setClientlist((e) => ({ ...e, list: res.data?.list, total: res.data?.total }))
setRefresherTriggeredStatus(() => false) // setRefresherTriggeredStatus(() => false)
} // }
//选择客户 // //选择客户
const selectClient = (item) => { // const selectClient = (item) => {
clentList.list.map((it) => { // clentList.list.map((it) => {
if (item.id === it.id) { // if (item.id === it.id) {
it.checked = true // it.checked = true
} else { // } else {
it.checked = false // it.checked = false
} // }
return it // return it
}) // })
setclientObj(item) // setclientObj(item)
let pages = Taro.getCurrentPages() // 获取当前的页面栈 // let pages = Taro.getCurrentPages() // 获取当前的页面栈
let prevPage = pages[pages.length - 2] // let prevPage = pages[pages.length - 2]
prevPage.setData({ // prevPage.setData({
//设置上一个页面的值 // //设置上一个页面的值
clientId: item.id, // clientId: item.id,
clientName: item.name, // clientName: item.name,
}) // })
setClientlist((e) => ({ ...e, list: clentList?.list, total: clentList?.total })) // setClientlist((e) => ({ ...e, list: clentList?.list, total: clentList?.total }))
Taro.navigateBack({ // Taro.navigateBack({
delta: 1, // delta: 1,
}) // })
} // }
useEffect(() => { // useEffect(() => {
if (clientObj?.clientId !== null) { // if (clientObj?.clientId !== null) {
setclientObj(clientObj) // setclientObj(clientObj)
} else { // } else {
let pages = Taro.getCurrentPages() // 获取当前的页面栈 // let pages = Taro.getCurrentPages() // 获取当前的页面栈
let prevPage = pages[pages.length - 2] // let prevPage = pages[pages.length - 2]
prevPage.setData({ // prevPage.setData({
//设置上一个页面的值 // //设置上一个页面的值
clientId: '', // clientId: '',
clientName: '', // clientName: '',
}) // })
} // }
}, [clientObj]) // }, [clientObj])
// 筛选列表 // 筛选列表
const onShowFilter = () => {} const onShowFilter = () => {}
const [statusList, setStatusList] = useState([ const [statusList, setStatusList] = useState([
{ {
id: 1, id: -1,
name: '待发货', name: '待发货',
}, },
{ {
@ -136,7 +136,7 @@ const Delivery: FC = () => {
// //状态改变 // //状态改变
const changeStatus = useCallback((e) => { const changeStatus = useCallback((e) => {
pageNum.current.page = 1 // pageNum.current.page = 1
// setSearchField((value) => ({ ...value, status: e, size: 10 })) // setSearchField((value) => ({ ...value, status: e, size: 10 }))
console.log(e, '123123') console.log(e, '123123')
@ -163,7 +163,7 @@ const Delivery: FC = () => {
</Search> </Search>
</View> </View>
{/* 状态栏 */} {/* 状态栏 */}
<SegmentedControl list={statusList} onSelect={changeStatus} defaultId={0} /> <SegmentedControl list={statusList} onSelect={changeStatus} defaultId={-1} />
<View className={styles.listBox}> <View className={styles.listBox}>
{/* <InfiniteScroll {/* <InfiniteScroll

View File

View File

@ -32,7 +32,7 @@ const feature: IconCardType[] = [
{ {
iconName: 'icon-fahuoliebiao', iconName: 'icon-fahuoliebiao',
name: '发货列表', name: '发货列表',
path: '', path: '/pages/delivery/index',
}, },
{ {
iconName: 'icon-yaoqingma', iconName: 'icon-yaoqingma',
@ -169,7 +169,7 @@ const UserInfo: FC = () => {
<View className={styles.layoutTitle}></View> <View className={styles.layoutTitle}></View>
<View className={styles['grid-container']}> <View className={styles['grid-container']}>
{statisticAnalysis.map((item) => { {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> </View>
</LayoutBlock> </LayoutBlock>