diff --git a/src/api/delivery/index.ts b/src/api/delivery/index.ts new file mode 100644 index 0000000..fe211d4 --- /dev/null +++ b/src/api/delivery/index.ts @@ -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', + }) +} diff --git a/src/api/index.ts b/src/api/index.ts index 5fd0136..35f83bc 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -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' /** * 系列列表 diff --git a/src/app.config.ts b/src/app.config.ts index 284cd11..4350d24 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -40,6 +40,10 @@ export default defineAppConfig({ root: 'pages/delivery', pages: ['index'], }, + { + root: 'pages/deliveryDetail', + pages: ['index'], + }, { root: 'pages/colorRelated', pages: ['sampleComparison/index', 'takeColor/index', 'findColor/index'], diff --git a/src/common/util.ts b/src/common/util.ts index ea5bc51..f99bf64 100644 --- a/src/common/util.ts +++ b/src/common/util.ts @@ -111,6 +111,7 @@ export const dataLoadingStatus = ({ list = [], total = 0, status = false }: { li function delay(delayTime = 25): Promise { return new Promise(resolve => { setTimeout(() => { + // @ts-ignore resolve() }, delayTime) }) @@ -171,4 +172,4 @@ export const shareShop = () => { } export { delayQuerySelector -} \ No newline at end of file +} diff --git a/src/components/SegmentedControl/index.module.scss b/src/components/SegmentedControl/index.module.scss index 3e79f43..3a40726 100644 --- a/src/components/SegmentedControl/index.module.scss +++ b/src/components/SegmentedControl/index.module.scss @@ -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; } diff --git a/src/components/SegmentedControl/index.tsx b/src/components/SegmentedControl/index.tsx index 10d7ad1..2f2446a 100644 --- a/src/components/SegmentedControl/index.tsx +++ b/src/components/SegmentedControl/index.tsx @@ -3,10 +3,15 @@ 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 - onSelect?: (val: number) => void + list: Segment[] + defaultId?: number + onSelect?: (data: {id: number, name:string}) => void } const segmentedControl: FC = (props) => { @@ -14,9 +19,10 @@ const segmentedControl: FC = (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,12 +34,13 @@ const segmentedControl: FC = (props) => { } } setSelectInfo((e) => ({ ...e, selected: defaultId || -1 })) + console.log('selectInfo', selectInfo) }, [defaultId]) const clickEvent = ({ item, index }: { item: any; index: number }) => { const num = index > 0 ? index - 1 : 0 setSelectInfo((e) => ({ ...e, tabId: list[num].id.toString(), selected: item.id })) - onSelect?.(item.id) + onSelect?.(item) } return ( @@ -41,12 +48,13 @@ const segmentedControl: FC = (props) => { {list.map((item, index) => { + console.log('selected=+>', selectInfo.selected) return ( 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} ) diff --git a/src/components/normalButton/index.module.scss b/src/components/normalButton/index.module.scss index 5b8718c..a7f1868 100644 --- a/src/components/normalButton/index.module.scss +++ b/src/components/normalButton/index.module.scss @@ -57,6 +57,9 @@ } } &--text { + display: flex; + flex-flow: row nowrap; + align-items: center; color: currentColor; } // active 伪类 diff --git a/src/components/normalButton/index.tsx b/src/components/normalButton/index.tsx index f9ef2d5..bd7d4ae 100644 --- a/src/components/normalButton/index.tsx +++ b/src/components/normalButton/index.tsx @@ -17,6 +17,7 @@ interface PropsType { onClick?: Function customClassName?: string customStyles?: React.CSSProperties + customTextClassName?: string } const NormalButton: FC = (props) => { @@ -31,6 +32,7 @@ const NormalButton: FC = (props) => { circle = false, customStyles = {}, customClassName = '', + customTextClassName = '' } = props const getClassName = () => { const classObject = { @@ -54,7 +56,7 @@ const NormalButton: FC = (props) => { return ( - {children} + {children} ) } diff --git a/src/components/search/index.module.scss b/src/components/search/index.module.scss index 2e5038e..ea90ebd 100644 --- a/src/components/search/index.module.scss +++ b/src/components/search/index.module.scss @@ -1,69 +1,76 @@ -.search_main{ +.search_main { + display: flex; + align-items: center; + position: relative; + width: 100%; + z-index: 0; + .icon_a_sousuo1_self { + color: $color_font_two; + } + .search_con { + position: relative; display: flex; align-items: center; - position: relative; - width: 100%; - z-index: 0; - .icon_a_sousuo1_self{ - font-size: 37px; - color: $color_font_two; + flex: 1 1 auto; + justify-content: space-between; + .input_bar { + border-radius: 50px; + width: 100%; + height: 60px; + flex: 1 1 auto; + padding-left: 60px; + padding-right: 30px; + background: #eee; + box-sizing: border-box; + display: flex; + align-items: center; } - .search_con{ - position: relative; - display: flex; - align-items: center; - flex: 1 1 auto; - input{ - font-size: 27px; - background: #eee; - width: 100%; - height: 60px; - border-radius: 50px; - padding: 0 60px; - box-sizing: border-box; - z-index:0; - &::-webkit-input-placeholder { /* WebKit browsers */ - color: #999; - font-size: 16px; - } - - &::-moz-placeholder { /* Mozilla Firefox 19+ */ - color: #999; - font-size: 16px; - } - - &::-ms-input-placeholder { /* Internet Explorer 10+ */ - color: #999; - font-size: 16px; - } - } - .search_closeBtn{ - position: absolute; - right: 10px; - } - - } - .btn{ - width: 100px; - font-size: $font_size_medium; - color: $color_font_two; - display: flex; - justify-content: center; - align-items: center; + input { + flex: 1 1 auto; + font-size: 27px; + z-index: 0; + &::-webkit-input-placeholder { + /* WebKit browsers */ + color: #999; + font-size: 16px; + } + &::-moz-placeholder { + /* Mozilla Firefox 19+ */ + color: #999; + font-size: 16px; + } + + &::-ms-input-placeholder { + /* Internet Explorer 10+ */ + color: #999; + font-size: 16px; + } } - .icon_inner{ - margin-right: 20px; - position: absolute; - left: 10px; - margin-right: 0; - z-index: 10; + .search_closeBtn { + margin: 0 15px; + flex: none; } - .icon_out{ - margin-right: 10px; - } - .input_out{ - padding-left: 20px !important; - } - + } + .btn { + width: 100px; + font-size: $font_size_medium; + color: $color_font_two; + display: flex; + justify-content: center; + align-items: center; + } + .icon_inner { + margin-right: 20px; + position: absolute; + left: 10px; + margin-right: 0; + z-index: 10; + } + .icon_out { + margin-right: 10px; + } + .input_out { + padding-left: 20px !important; + } } diff --git a/src/components/search/index.tsx b/src/components/search/index.tsx index 7925652..63c8473 100644 --- a/src/components/search/index.tsx +++ b/src/components/search/index.tsx @@ -1,110 +1,116 @@ -import { Input, View } from "@tarojs/components"; -import styles from "./index.module.scss" -import CloseBtn from "@/components/closeBtn" -import classnames from "classnames"; -import { debounce } from "@/common/util"; -import { Children, forwardRef, memo, ReactElement, ReactNode, useEffect, useImperativeHandle, useRef, useState } from "react"; +import { Input, View } from '@tarojs/components' +import styles from './index.module.scss' +import CloseBtn from '@/components/closeBtn' +import classnames from 'classnames' +import { debounce } from '@/common/util' +import { Children, forwardRef, memo, ReactElement, ReactNode, useEffect, useImperativeHandle, useRef, useState } from 'react' +import IconFont from '../iconfont/iconfont' type Params = { - clickOnSearch?: (val: string) => void - disabled?: false | true, - placeholder?: string, - changeOnSearch?: (any) => void, - showIcon?: false | true, - placeIcon?: 'out' | 'inner', - style?: Object, - showBtn?: false | true, - btnStyle?: Object, - btnTitle?: string, - debounceTime?: number //防抖时间,不设默认为零 - defaultValue?: string, - children?: ReactNode, - customRightSlot?: ReactNode + clickOnSearch?: (val: string) => void + disabled?: false | true + placeholder?: string + changeOnSearch?: (value: string) => void + showIcon?: false | true + placeIcon?: 'out' | 'inner' + style?: Object + showBtn?: false | true + btnStyle?: Object + btnTitle?: string + debounceTime?: number //防抖时间,不设默认为零 + defaultValue?: string + children?: ReactNode + customRightSlot?: ReactNode } -export default memo(forwardRef(({ - clickOnSearch, //点击筛选按钮触发 - changeOnSearch, //输入文字触发 - disabled = false, //是否禁用 - placeholder = '输入搜索内容', - showIcon = true, //是否显示关闭图标 - showBtn = false, //是否显示搜索按钮 - btnStyle = {}, - placeIcon = 'inner', //搜索图标位置:inner在里面,out在外面 - btnTitle = '搜索', //搜索文字 - debounceTime = 0, //防抖时间,不设默认为零 - defaultValue = '',//默认值 - children, - customRightSlot -}: Params, ref) => { - const [inputCon, setInputCon] = useState('') - const debounceTimeRef = useRef(0) - useEffect(() => { +export default memo( + forwardRef( + ( + { + clickOnSearch, //点击筛选按钮触发 + changeOnSearch, //输入文字触发 + disabled = false, //是否禁用 + placeholder = '输入搜索内容', + showIcon = true, //是否显示关闭图标 + showBtn = false, //是否显示搜索按钮 + btnStyle = {}, + placeIcon = 'inner', //搜索图标位置:inner在里面,out在外面 + btnTitle = '搜索', //搜索文字 + debounceTime = 0, //防抖时间,不设默认为零 + defaultValue = '', //默认值 + children, + customRightSlot, + }: Params, + ref, + ) => { + const [inputCon, setInputCon] = useState('') + const debounceTimeRef = useRef(0) + useEffect(() => { setInputCon(defaultValue) - }, [defaultValue]) + }, [defaultValue]) - useEffect(() => { + useEffect(() => { debounceTimeRef.current = debounceTime - }, [debounceTime]) + }, [debounceTime]) - const onInputEven = (e) => { + const onInputEven = (e) => { const value = e.detail.value changeData(value) - } + } - useImperativeHandle(ref, () => ({ - clearInput - })) + useImperativeHandle(ref, () => ({ + clearInput, + })) - const clearInput = () => { + const clearInput = () => { setInputCon('') changeOnSearch?.('') - } + } - const changeData = debounce((value) => { + const changeData = debounce((value) => { setInputCon(value) changeOnSearch?.(value) - }, debounceTimeRef.current) + }, debounceTimeRef.current) - const onSearch = () => { + const onSearch = () => { clickOnSearch?.(inputCon) - } + } - return ( - <> - - - {showIcon && ( - - )} - onInputEven(e)}> - {!!inputCon && ( - - clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} /> + return ( + <> + + + {showIcon && ( + + )} + + onInputEven(e)} + /> + + {!!inputCon && clearInput()} styleObj={{ width: '20rpx', height: '20rpx', backgroundColor: '#fff', border: '0' }} />} + + {customRightSlot} + + + {showBtn && ( + + {btnTitle} )} - {customRightSlot} + {children} - {showBtn && ( - - {btnTitle} - - )} - {children} - - - ) -})) + + ) + }, + ), +) diff --git a/src/components/tag/index.tsx b/src/components/tag/index.tsx index ec3a84f..4300a89 100644 --- a/src/components/tag/index.tsx +++ b/src/components/tag/index.tsx @@ -15,10 +15,21 @@ interface PropsType { onClick?: Function circle?: boolean customStyle?: React.CSSProperties + customClassName?: string } const Tag: FC = (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 = (props) => { return classObject } return ( - + {children} ) diff --git a/src/pages/delivery/components/DeliveryStatusList/index.module.scss b/src/pages/delivery/components/DeliveryStatusList/index.module.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/delivery/components/DeliveryStatusList/index.tsx b/src/pages/delivery/components/DeliveryStatusList/index.tsx new file mode 100644 index 0000000..150fad0 --- /dev/null +++ b/src/pages/delivery/components/DeliveryStatusList/index.tsx @@ -0,0 +1,42 @@ +import SegmentedControl from '@/components/segmentedControl' +import { FC, memo, useCallback, useEffect, useState } from 'react' +import { EnumSaleorderStatus } from '@/api/index' + +type PropsType = { + onChangeStatus?: (data: {id: number, name: string}) => void +} + +const DeliveryStatusList = memo((props) => { + const { onChangeStatus } = props + const { fetchData } = EnumSaleorderStatus() + const [statusList, setStatusList] = useState([ + { + id: -1, + name: '全部', + }, + ]) + // 请求 + const getDeliveryStatusList = async () => { + const res = await fetchData() + console.log(res.data.list); + setStatusList( + res.data.list.filter((item) => { + return item.id === 3 || item.id === 4 // 待发货 已完成 + }), + ) + } + + useEffect(() => { + getDeliveryStatusList() + }, []) + + // //状态改变 + const changeStatus = useCallback( + (data: {id:number, name: string}) => { + onChangeStatus && onChangeStatus({ id: data.id, name: data.name }) + }, + [onChangeStatus], + ) + return +}) +export default DeliveryStatusList diff --git a/src/pages/delivery/components/Filter/index.module.scss b/src/pages/delivery/components/Filter/index.module.scss new file mode 100644 index 0000000..c8d3e6f --- /dev/null +++ b/src/pages/delivery/components/Filter/index.module.scss @@ -0,0 +1,41 @@ + +.filterItem { + margin: 24px 48px; + &--title { + font-size: 28px; + font-weight: 550; + line-height: 1.5; + } + &--wrapper { + margin-top: 24px; + display: grid; + grid-gap: 16px 16px; + } +} +.filter { + &--time { + grid-template-columns: 1fr 1fr 1fr 1fr; + + } + &--inputBar { + } + &--type { + grid-template-columns: 1fr 1fr; + } +} +.filterTypeButton{ + padding: 0 24px; + font-size: 28px; + +} +.filterTypeText{ + color: #6e6e6e !important; +} +.filterTimeButton{ + padding: 0 24px; + font-size: 28px; + grid-column-start: span 2; +} +.selected{ + background-color: #eaf2ff; +} diff --git a/src/pages/delivery/components/Filter/index.tsx b/src/pages/delivery/components/Filter/index.tsx new file mode 100644 index 0000000..7909818 --- /dev/null +++ b/src/pages/delivery/components/Filter/index.tsx @@ -0,0 +1,152 @@ +import NormalButton from "@/components/normalButton" +import Popup from "@/components/popup" +import { View } from "@tarojs/components" +import classnames from "classnames" +import styles from './index.module.scss' +import { FC, memo, useEffect, useState } from 'react' +import Search from "@/components/search" +import IconFont from "@/components/iconfont/iconfont" +import {EnumDeliveryNoticeTypeList} from '@/api/index' + +type SearchFilter = { + type?: number +} + +const scanIcon = () => { + // 扫描 + const handleScan = () => {} + return ( + + + + ) +} + +const DeliveryFilter: FC = memo(() => { + + const {fetchData} = EnumDeliveryNoticeTypeList() + + const [searchFilter, useSearchFilter] = useState({ + + }) + const handleSelectedType = (type: string | number) => { + if (typeof type === 'string' && type === 'default') { + // setSearch((e) => ({ ...e })) + } else { + // setSearch((e) => ({ ...e, type: type as number })) + } + } + + const handleSearchBarChange = () => {} + + useEffect(() => { + getEnumData() + + }, []) + + + const [typeList, setTypeList] = useState<{id: number, name: string}[]>() + + const getEnumData = async () => { + const res = await fetchData() + setTypeList(res.data.list) + } + + + return ( + <> + + 发货类型 + + handleSelectedType('default')}> + 不限 + + {!!typeList?.length && typeList?.map(item => { + return ( + handleSelectedType(item?.id)}> + {item.name} + + ) + })} + {/* handleSelectedType(1)}> + 销售发货单 + + handleSelectedType(2)}> + 调拨发货单 + + handleSelectedType(3)}> + 采购退货单 + */} + + + + 发货单号 + + + + + + 查询日期 + + + 不限 + + + 今天 + + + 昨日 + + + 近7日 + + + 近30日 + + + 近90日 + + + 自定义起始时间{} + + + + + ) +}) +export default DeliveryFilter diff --git a/src/pages/delivery/components/ItemList/index.module.scss b/src/pages/delivery/components/ItemList/index.module.scss index 818974d..10a3502 100644 --- a/src/pages/delivery/components/ItemList/index.module.scss +++ b/src/pages/delivery/components/ItemList/index.module.scss @@ -2,19 +2,25 @@ 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 { - color: #e42945; + font-weight: 550; + &--toBeAudited{ + color: #e42945; + } + &--finish{ + color: $color_main; + } } } .content { @@ -26,8 +32,10 @@ font-size: 28px; color: rgba($color: #000000, $alpha: 0.4); &__left { + min-width: 140px; } &__right { + @include common_ellipsis(2); } } } @@ -36,10 +44,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 +57,6 @@ .bord { color: $color_font_one; } +.tag{ + margin: 0 16px; +} diff --git a/src/pages/delivery/components/ItemList/index.tsx b/src/pages/delivery/components/ItemList/index.tsx index 69c90a9..1d9383d 100644 --- a/src/pages/delivery/components/ItemList/index.tsx +++ b/src/pages/delivery/components/ItemList/index.tsx @@ -5,58 +5,104 @@ 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' +import { EnumSaleMode } from '@/common/Enumerate' +import { formatDateTime } from '@/common/format' +import { goLink } from '@/common/common' +import { DeliveryNoticeOrderAudit } from '@/api/index' +import Taro from '@tarojs/taro' type PropsType = { itemData?: Record + onSuccess?: Function } const ItemList:FC = (props) => { - const { itemData } = props + const { itemData, onSuccess } = props // 查看详情 - const handleDetail = () => { - + const handleDetail = (id: number) => { + goLink('/pages/deliveryDetail/index', { + id + }) } - // 确认审核 - const handleAudit = () => { + const {fetchData, state} = DeliveryNoticeOrderAudit() + + // 确认审核 + const handleAudit = (id: number) => { + Taro.showModal({ + content: '确认要审核吗?', + confirmColor: '#337FFF', + success: async (res) => { + if (res.confirm) { + const res = await fetchData({ id }) + if (res.success) { + Taro.showToast({ title: '审核成功', icon: 'success' }) + onSuccess?.() + }else{ + Taro.showToast({ title: '审核失败', icon: 'error' }) + } + } + }, + }) } return ( - 单号:XS-LY-2208220092 - 待审核 + 单号:{itemData?.order_no} + {itemData?.status === 1 && 已审核} + {itemData?.status === 0 && 待审核} - 销售发货单 + {itemData?.type_name} - + - + 货品信息: - - 大货 - - 2种面料,4种颜色,共5米 + {itemData?.sale_mode === EnumSaleMode.Bulk && ( + + 大货 + + )} + {itemData?.sale_mode === EnumSaleMode.Plate && ( + + 剪板 + + )} + {itemData?.sale_mode === EnumSaleMode.BulkCut && ( + + 散剪 + + )} + 2种面料,4种颜色,共{itemData?.sale_mode === EnumSaleMode.Bulk ? `${itemData?.delivery_roll}条` : `${itemData?.delivery_length}米`} 发货地址: - 永川纺织有限公司 + {itemData?.delivery_address || '空'} 创建时间: - 2022-09-01 18:32:32 + {formatDateTime(itemData?.create_time) || '空'} - + handleDetail(itemData?.id)}> 查看详情 - - 确认审核 - + {itemData?.status === 0 && ( + handleAudit(itemData?.id)}> + 确认审核 + + )} ) diff --git a/src/pages/delivery/index.module.scss b/src/pages/delivery/index.module.scss index 3deedf7..8886863 100644 --- a/src/pages/delivery/index.module.scss +++ b/src/pages/delivery/index.module.scss @@ -1,113 +1,42 @@ 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; - } - - .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; + overflow: scroll; + &--total { + display: block; + margin-top: 24px; + padding: 0 24px; + font-size: 24px; + color: #9d9d9d; } } } -.scanHandler{ +.scanHandler { width: 40px; height: 40px; - position: absolute; - right: 40px; } -.icon__filter{ - padding: 0 20px; - padding-right: 10px; +.icon__filter { + padding: 0 20px; + padding-right: 10px; } diff --git a/src/pages/delivery/index.tsx b/src/pages/delivery/index.tsx index e98cf5f..9ebd542 100644 --- a/src/pages/delivery/index.tsx +++ b/src/pages/delivery/index.tsx @@ -1,64 +1,89 @@ import { View, Text } from '@tarojs/components' -import { useCallback, useEffect, useMemo, useRef, useState, FC } from 'react' +import { useCallback, useEffect, useMemo, useRef, useState, FC, memo } from 'react' import styles from './index.module.scss' import classnames from 'classnames' import Search from '@/components/search' -import { ClientListApi } from '@/api/order' +import { DeliverNoticeOrderList, EnumSaleorderStatus } from '@/api/index' import Taro from '@tarojs/taro' 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 IconFont from '@/components/iconfont/iconfont' import ItemList from './components/ItemList' +import DeliveryStatusList from './components/DeliveryStatusList' +import Popup from '@/components/popup' +import DeliveryFilter from './components/Filter' + +type SearchData = { + delivery_notice_order_no?: string // 发货单号 + delivery_notice_order_status?: number | string // 发货状态 + date_min?: string // 开始时间 + date_max?: string // 结束时间 + type?: number // 发货类型 + page: number + size: number +} + +const scanIcon = () => { + // 扫描 + const handleScan = () => {} + return ( + + + + ) +} // 发货列表 const Delivery: FC = () => { - const [search, setSearch] = useState({ - name: null, + const [search, setSearch] = useState({ + delivery_notice_order_status: 0, // 待发货 page: 1, size: 10, }) - const [clentList, setClientlist] = useState<{ list: any[]; total: number }>({ list: [], total: 0 }) + const [deliveryOrderList, setDeliveryOrderList] = useState<{ list: any[]; total: number }>({ list: [], total: 0 }) - const { fetchData: clitentFetch, state: orderState } = ClientListApi() + const { fetchData: FetchDeliveryOrderList, state: orderState } = DeliverNoticeOrderList() //数据加载状态 const statusMore = useMemo(() => { - return dataLoadingStatus({ list: clentList.list, total: clentList.total, status: orderState.loading }) - }, [clentList, orderState]) + return dataLoadingStatus({ list: deliveryOrderList.list, total: deliveryOrderList.total, status: orderState.loading }) + }, [deliveryOrderList, 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 })) + //输入搜索关键字 + const getSearchData = useCallback((searchValue: string) => { + console.log('searchValue==>', searchValue) + // 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 })) + console.log('useEffect ===> search', search) + if (search.delivery_notice_order_no === '') { + setSearch((e) => ({ ...e, delivery_notice_order_no: undefined })) } - if (search.name !== '') getCuss() + if (search.delivery_notice_order_no !== '') getData() }, [search]) //上拉加载数据 const pageNum = useRef({ size: search.size, page: search.page }) - const getScrolltolower = useCallback(() => { - if (clentList.list.length < clentList.total) { + + const getScrollToLower = useCallback(() => { + if (deliveryOrderList.list.length < deliveryOrderList.total) { pageNum.current.page++ const size = pageNum.current.size * pageNum.current.page setSearch((e) => ({ ...e, size })) console.log(search, 11111) } - }, [clentList]) + }, [deliveryOrderList]) //列表下拉刷新 const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false) @@ -67,92 +92,88 @@ const Delivery: FC = () => { 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 })) + const getData = async () => { + const res = await FetchDeliveryOrderList(getFilterData(search)) + // if (router?.params.clientId) { + // res.data.list.map((item) => { + // if (item.id == router?.params.clientId) { + // item.checked = true + // } else { + // item.checked = false + // } + // return item + // }) + // } + setDeliveryOrderList((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: '', - }) + // //选择客户 + // 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 handleChangeFilterData = () => {} + + const [currentStatus, setCurrentStatus] = useState('待发货') + + const handleChangeStatus = ({ id: statusId, name: statusName }) => { + let fuckingBadCodeId: string | number = 0 + if (statusId === 3) { + fuckingBadCodeId = 0 + } else if (statusId === 4) { + fuckingBadCodeId = '1,2' } - }, [clientObj]) - - // 筛选列表 - const onShowFilter = () => {} - - const [statusList, setStatusList] = useState([ - { - id: 1, - name: '待发货', - }, - { - id: 2, - name: '已完成', - }, - ]) - - // //状态改变 - const changeStatus = useCallback((e) => { - pageNum.current.page = 1 - // setSearchField((value) => ({ ...value, status: e, size: 10 })) - - console.log(e, '123123') - // setOrderData(() => ({ list: [], total: 0 })) - }, []) - // 扫描 - const handleScan = () => {} - - const scanIcon = () => { - return ( - - - - ) + setCurrentStatus(statusName) + setSearch((e) => ({ ...e, delivery_notice_order_status: fuckingBadCodeId })) + getData() } + const handleAuditSuccess = () => { + getData() + } + + const [showFilter, setShowFilter] = useState(false) + // 筛选列表 + const onShowFilter = () => { + setShowFilter(true) + } + + + + return ( @@ -163,36 +184,28 @@ const Delivery: FC = () => { {/* 状态栏 */} - + - {/* - {clentList.list.map((item, index) => { - return ( - { - selectClient(item) - }}> - {item.name} - {item.phone} - {item.sale_user_name} - - ) + + {currentStatus}共 {deliveryOrderList.total} 单 + + {deliveryOrderList.list.map((item, index) => { + return })} - */} - - - - + + + + ) } + export default Delivery diff --git a/src/pages/deliveryDetail/index.config.ts b/src/pages/deliveryDetail/index.config.ts new file mode 100644 index 0000000..45c6544 --- /dev/null +++ b/src/pages/deliveryDetail/index.config.ts @@ -0,0 +1,3 @@ +export default { + navigationBarTitleText: '发货详情', +} diff --git a/src/pages/deliveryDetail/index.module.scss b/src/pages/deliveryDetail/index.module.scss new file mode 100644 index 0000000..57cfd8c --- /dev/null +++ b/src/pages/deliveryDetail/index.module.scss @@ -0,0 +1,3 @@ +.deliveryDetail{ + +} diff --git a/src/pages/deliveryDetail/index.tsx b/src/pages/deliveryDetail/index.tsx new file mode 100644 index 0000000..9802d02 --- /dev/null +++ b/src/pages/deliveryDetail/index.tsx @@ -0,0 +1,8 @@ +import { View } from "@tarojs/components" +import { FC } from "react" +import styles from './index.module.scss' + +const DeliveryDetail: FC = () => { + return 发货详情 +} +export default DeliveryDetail diff --git a/src/pages/shopping/components/shoppingCartItem/index.tsx b/src/pages/shopping/components/shoppingCartItem/index.tsx index 1237010..6f962bb 100644 --- a/src/pages/shopping/components/shoppingCartItem/index.tsx +++ b/src/pages/shopping/components/shoppingCartItem/index.tsx @@ -12,7 +12,7 @@ import NormalButton from '@/components/normalButton' import ColorKindItem from '../colorKindItem' import { EnumSaleMode } from '@/common/Enumerate' import { useNeedMemoCallback } from '@/use/useCommon' -import {selectList} from '../../config' +import { selectList } from '../../config' import { ShoppingContext } from '../../index' type PropsType = { @@ -138,48 +138,50 @@ export default memo((props) => { - - - - 订单类型 - - onSelectOrderType(EnumSaleMode.Bulk)}> - 大货 - - onSelectOrderType(EnumSaleMode.Plate)}> - 剪板 - - onSelectOrderType(EnumSaleMode.BulkCut)}> - 散剪 - + {openDetail && ( + + + + 订单类型 + + onSelectOrderType(EnumSaleMode.Bulk)}> + 大货 + + onSelectOrderType(EnumSaleMode.Plate)}> + 剪板 + + onSelectOrderType(EnumSaleMode.BulkCut)}> + 散剪 + + - - - - - 布料颜色 - - {selectList[selected].title}单位:{selectList[selected].unit} - + + + + 布料颜色 + + {selectList[selected].title}单位:{selectList[selected].unit} + + + {memoList} - {memoList} - + )} ) }, useNeedMemoCallback()) diff --git a/src/pages/user/index.tsx b/src/pages/user/index.tsx index 37db169..f64fedf 100644 --- a/src/pages/user/index.tsx +++ b/src/pages/user/index.tsx @@ -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 = () => { 统计分析 {statisticAnalysis.map((item) => { - return + return handleClickIconCard(item)}> })} diff --git a/src/styles/iconfont.scss b/src/styles/iconfont.scss index aa8004e..b109443 100644 --- a/src/styles/iconfont.scss +++ b/src/styles/iconfont.scss @@ -3,7 +3,7 @@ /* Project id 3619513 */ // url('/src/styles/iconfont.ttf') format('truetype'); src: - url('iconfont.ttf?t=1663556335905') format('truetype'); + url('/src/styles/iconfont.ttf?t=1663556335905') format('truetype'); } .iconfont {