From 18df424f7030e8d081735e22c754f11f7e8b78c6 Mon Sep 17 00:00:00 2001 From: Haiyi <1021441632@qq.com> Date: Fri, 21 Oct 2022 18:43:22 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=E5=AE=A2=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=8620%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project.private.config.json | 14 +++ src/app.config.ts | 4 + src/components/AddressList/index.tsx | 8 +- src/pages/addAddress/index.module.scss | 2 +- .../components/form/index.module.scss | 80 ++++++++++++ .../customerDetails/components/form/index.tsx | 38 ++++++ .../components/tabs/index.module.scss | 42 +++++++ .../customerDetails/components/tabs/index.tsx | 32 +++++ .../components/tagPopup/index.module.scss | 0 .../components/tagPopup/index.tsx | 19 +++ src/pages/customerDetails/index.config.ts | 3 + src/pages/customerDetails/index.module.scss | 119 ++++++++++++++++++ src/pages/customerDetails/index.tsx | 88 +++++++++++++ .../components/ItemList/index.module.scss | 106 ++++++++++++++++ .../components/ItemList/index.tsx | 55 ++++++++ .../components/Sort/index.module.scss | 31 +++++ .../components/Sort/index.tsx | 87 +++++++++++++ .../components/Tag/index.module.scss | 44 +++++++ .../components/Tag/index.tsx | 86 +++++++++++-- .../customerManagement/index.module.scss | 64 +++++++++- src/pages/customerManagement/index.tsx | 96 +++++++++++++- 21 files changed, 997 insertions(+), 21 deletions(-) create mode 100644 src/pages/customerDetails/components/form/index.module.scss create mode 100644 src/pages/customerDetails/components/form/index.tsx create mode 100644 src/pages/customerDetails/components/tabs/index.module.scss create mode 100644 src/pages/customerDetails/components/tabs/index.tsx create mode 100644 src/pages/customerDetails/components/tagPopup/index.module.scss create mode 100644 src/pages/customerDetails/components/tagPopup/index.tsx create mode 100644 src/pages/customerDetails/index.config.ts create mode 100644 src/pages/customerDetails/index.module.scss create mode 100644 src/pages/customerDetails/index.tsx create mode 100644 src/pages/customerManagement/components/ItemList/index.module.scss create mode 100644 src/pages/customerManagement/components/ItemList/index.tsx create mode 100644 src/pages/customerManagement/components/Sort/index.module.scss create mode 100644 src/pages/customerManagement/components/Sort/index.tsx diff --git a/project.private.config.json b/project.private.config.json index b20639c..9c59ea7 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -176,6 +176,20 @@ "query": "", "launchMode": "default", "scene": null + }, + { + "name": "", + "pathName": "pages/customerManagement/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "", + "pathName": "pages/customerDetails/index", + "query": "id=642", + "launchMode": "default", + "scene": null } ] } diff --git a/src/app.config.ts b/src/app.config.ts index 40827f1..fbf73f8 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -128,5 +128,9 @@ export default defineAppConfig({ root: 'pages/customerManagement', pages: ['index'], }, + { + root: 'pages/customerDetails', + pages: ['index'], + }, ], }) diff --git a/src/components/AddressList/index.tsx b/src/components/AddressList/index.tsx index fbd8dd7..47e4018 100644 --- a/src/components/AddressList/index.tsx +++ b/src/components/AddressList/index.tsx @@ -36,14 +36,14 @@ const AddressList = memo((props: Params) => { }) } } - useDidShow(() => { + useEffect(() => { getData(); // 监听刷新 Taro.eventCenter.on("addressList:refresh", getData); return () => { Taro.eventCenter.off("addressList:refresh", getData); } - }) + }, []) // 处理刷新 const [refreshState, setRefreshState] = useState(false); const handleRefresh = async () => { @@ -127,7 +127,7 @@ const AddressList = memo((props: Params) => { item.is_default && {item.phone.replace(item.phone.substring(3, 7), "****")} } - e.stopPropagation()} url={`/pages/addAddress/index?type=edit&id=${item.id}&&purchaser_id=${Number(router.params.purchaser_id)}`} hoverClass="none" className="address-edit"> + e.stopPropagation()} url={`/pages/addAddress/index?type=edit&id=${item.id}&&purchaser_id=${Number(props.purchaser_id)}`} hoverClass="none" className="address-edit"> {/* */} @@ -139,7 +139,7 @@ const AddressList = memo((props: Params) => { } - {addButtonEnabled && 添加收货地址} + {addButtonEnabled && 添加收货地址} ) }) diff --git a/src/pages/addAddress/index.module.scss b/src/pages/addAddress/index.module.scss index 4c6a516..c24cd8c 100644 --- a/src/pages/addAddress/index.module.scss +++ b/src/pages/addAddress/index.module.scss @@ -91,7 +91,7 @@ } .checkBox { - margin-left: 32px; + margin-left: 24px; margin-top: 24px; width: 702px; height: 120px; diff --git a/src/pages/customerDetails/components/form/index.module.scss b/src/pages/customerDetails/components/form/index.module.scss new file mode 100644 index 0000000..f6e495a --- /dev/null +++ b/src/pages/customerDetails/components/form/index.module.scss @@ -0,0 +1,80 @@ +.mainItem { + display: flex; + align-items: center; + border-bottom: 1px solid #e5e5e5; + padding-bottom: 40px; + margin-bottom: 40px; + + .mainItem_left { + width: 176px; + font-size: 28px; + font-weight: 500; + color: #000000; + } + + .mainItem_right { + font-size: 28px; + font-weight: 400; + color: #000000; + margin-right: 16px; + } + + .mainItem_active_right { + font-size: 28px; + font-weight: 400; + color: #337FFF; + margin-right: 16px; + } + + .call { + width: 65px; + height: 34px; + border-radius: 8px; + border: 1px solid #337FFF; + font-size: 24px; + font-weight: 400; + color: #337FFF; + line-height: 34px; + text-align: center; + } +} + +.mainItem_active { + display: flex; + align-items: center; + border-bottom: none; + margin-bottom: 40px; + + .mainItem_left { + width: 176px; + font-size: 28px; + font-weight: 500; + color: #000000; + } + + .mainItem_right { + font-size: 28px; + font-weight: 400; + color: #000000; + margin-right: 16px; + } + + .mainItem_active_right { + font-size: 28px; + font-weight: 400; + color: #337FFF; + margin-right: 16px; + } + + .call { + width: 65px; + height: 34px; + border-radius: 8px; + border: 1px solid #337FFF; + font-size: 24px; + font-weight: 400; + color: #337FFF; + line-height: 34px; + text-align: center; + } +} \ No newline at end of file diff --git a/src/pages/customerDetails/components/form/index.tsx b/src/pages/customerDetails/components/form/index.tsx new file mode 100644 index 0000000..5b4a316 --- /dev/null +++ b/src/pages/customerDetails/components/form/index.tsx @@ -0,0 +1,38 @@ +import { View } from '@tarojs/components' +import React, { useCallback, memo, useEffect, useMemo, useRef, useState, ReactNode } from 'react' +import styles from "./index.module.scss" +import classnames from "classnames"; +import Taro, { usePullDownRefresh, useRouter, useDidShow } from '@tarojs/taro'; +import { alert } from '@/common/common' +import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' +import IconFont from '@/components/iconfont/iconfont' +interface Props { + title: string, + des: string | number, + isPhone?: boolean + isBorder?: boolean +} + +export default memo((props: Props) => { + const { + isPhone = false, + isBorder = true, + } = props + + const handPhone = () => { + Taro.makePhoneCall({ + phoneNumber: props.des as string + }) + } + + + return ( + + {props.title} + {props.des} + { + isPhone && handPhone()}>拨打 + } + + ) +}) \ No newline at end of file diff --git a/src/pages/customerDetails/components/tabs/index.module.scss b/src/pages/customerDetails/components/tabs/index.module.scss new file mode 100644 index 0000000..fa9ec85 --- /dev/null +++ b/src/pages/customerDetails/components/tabs/index.module.scss @@ -0,0 +1,42 @@ +.flexBox { + width: 100%; + height: 102px; + background: #ffffff; + display: flex; + position: sticky; + top: 80px; + .itemBox { + position: relative; + flex: 1; + min-width: 138px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; + height: 102px; + + .itemFont { + font-size: 28px; + font-family: Microsoft YaHei, Microsoft YaHei-Bold; + font-weight: 700; + color: #000000; + } + + .activeItems { + font-size: 28px; + font-family: Microsoft YaHei, Microsoft YaHei-Regular; + font-weight: 400; + color: #337FFF; + } + + .borderBox { + position: absolute; + bottom: 0; + width: 138px; + height: 6px; + background: #337FFF; + border-radius: 4px; + } + } +} \ No newline at end of file diff --git a/src/pages/customerDetails/components/tabs/index.tsx b/src/pages/customerDetails/components/tabs/index.tsx new file mode 100644 index 0000000..6ed5f40 --- /dev/null +++ b/src/pages/customerDetails/components/tabs/index.tsx @@ -0,0 +1,32 @@ +import { View, Input, Button } from '@tarojs/components' +import { useCallback, useEffect, useMemo, useRef, useState, memo } from 'react' +import styles from "./index.module.scss" +import classnames from "classnames"; + +interface Props { + list: any[], + handChose?: (any) => void +} +export default memo((props: Props) => { + const { list = [], handChose } = props + + return ( + + { + list.map((item, index) => { + return ( + handChose?.(item)}> + {item?.name} + { + item.showBorder && + } + + ) + }) + } + + ) +}) \ No newline at end of file diff --git a/src/pages/customerDetails/components/tagPopup/index.module.scss b/src/pages/customerDetails/components/tagPopup/index.module.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/customerDetails/components/tagPopup/index.tsx b/src/pages/customerDetails/components/tagPopup/index.tsx new file mode 100644 index 0000000..c43a384 --- /dev/null +++ b/src/pages/customerDetails/components/tagPopup/index.tsx @@ -0,0 +1,19 @@ +import { View } from '@tarojs/components' +import React, { useCallback, memo, useEffect, useMemo, useRef, useState, ReactNode } from 'react' +import styles from "./index.module.scss" +import classnames from "classnames"; +import Taro, { usePullDownRefresh, useRouter, useDidShow } from '@tarojs/taro'; +import { alert } from '@/common/common' +import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' +import IconFont from '@/components/iconfont/iconfont' +import Popup from '@/components/popup'; +interface Props { + showPopup: boolean, + handClose: () => void, + +} +export default memo((props: Props) => { + return ( + { props.handClose() }}> + ) +}) \ No newline at end of file diff --git a/src/pages/customerDetails/index.config.ts b/src/pages/customerDetails/index.config.ts new file mode 100644 index 0000000..c4c4d7d --- /dev/null +++ b/src/pages/customerDetails/index.config.ts @@ -0,0 +1,3 @@ +export default { + navigationBarTitleText: '客户详情', +} diff --git a/src/pages/customerDetails/index.module.scss b/src/pages/customerDetails/index.module.scss new file mode 100644 index 0000000..8730f64 --- /dev/null +++ b/src/pages/customerDetails/index.module.scss @@ -0,0 +1,119 @@ +.mainTop { + padding-top: 24px; + background: #fff; + overflow: hidden; + + .mainUser { + padding-top: 36px; + margin-left: 24px; + margin-right: 24px; + display: flex; + position: relative; + background: #F6F7FB; + border-radius: 16px; + padding-bottom: 20px; + // margin-bottom: 16px; + + .itemCile { + width: 78px; + height: 78px; + background: linear-gradient(337deg, #7BB7FF 0%, #4581FF 100%); + font-size: 32px; + font-weight: 500; + color: #FFFFFF; + text-align: center; + line-height: 78px; + border-radius: 50%; + margin-right: 32px; + margin-left: 32px; + } + + .item_top_one { + .item_top_one_flex { + display: flex; + align-items: center; + + .itemName { + font-size: 28px; + font-weight: 500; + color: #000000; + margin-right: 24px; + } + + .itemPhone { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + } + + .item_tag_box { + margin-top: 16px; + display: flex; + align-items: center; + flex-wrap: wrap; + + .item_tagItem { + margin-bottom: 5px; + margin-right: 16px; + padding: 6px 16px 6px 16px; + font-size: 24px; + font-weight: 500; + color: #4581FF; + background: #ecf2ff; + border-radius: 8px; + } + + .item_tagAdd { + color: #4581FF; + background: #ecf2ff; + width: 114px; + height: 45px; + border-radius: 8px; + display: flex; + align-items: center; + + justify-content: space-between; + + .item_add { + line-height: 45px; + // font-size: 40px; + margin-left: 8px; + } + + .item_add_font { + font-size: 24px; + font-weight: 500; + color: #4581FF; + margin-right: 10px; + } + } + } + } + + .pos { + position: absolute; + top: 25px; + right: 24px; + font-size: 28px; + font-weight: 400; + color: #337FFF; + } + } + +} + +.formBox { + margin-top: 24px; + margin-left: 24px; + margin-right: 24px; + background: #FFFFFF; + border-radius: 16px; + padding: 40px 32px 40px 32px; +} + +.order_list { + height: calc(100vh - 250px); + margin-top: 24px; +} \ No newline at end of file diff --git a/src/pages/customerDetails/index.tsx b/src/pages/customerDetails/index.tsx new file mode 100644 index 0000000..259f7a9 --- /dev/null +++ b/src/pages/customerDetails/index.tsx @@ -0,0 +1,88 @@ +import { View } from '@tarojs/components' +import React, { useCallback, memo, useEffect, useMemo, useRef, useState, ReactNode } from 'react' +import styles from "./index.module.scss" +import classnames from "classnames"; +import Taro, { usePullDownRefresh, useRouter, useDidShow } from '@tarojs/taro'; +import Popup from '@/components/popup' +import { debounce } from '@/common/util' +import { alert } from '@/common/common' +import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' +import { ClientListApi } from '@/api/order' +import Tabs from "./components/tabs" +import Form from "./components/form" +import AddressList from "@/components/AddressList" +import TagPopup from './components/tagPopup'; +export default () => { + const router = useRouter() + const [status, setstatus] = useState(1) + + //顶部栏 + const [TarBarList, setTarBarList] = useState([{ id: 1, name: '基础信息', showBorder: true }, { id: 2, name: '收货地址', showBorder: false }]) + const handChose = (item) => { + TarBarList.map(it => { + if (it.id === item.id) { + it.showBorder = true + } else { + it.showBorder = false + } + setTarBarList([...TarBarList]) + setstatus(item.id) + // pageNum.current.page = 1 + // setOrderData(() => ({ list: [], total: 0 })) + // setSearchField((val) => ({ ...val, size: 10, status: item.id })) + }) + } + + const [showPopup, setshowPopup] = useState(false) + return ( + + + + + + + 欧阳斌峰 + 133****7761 + + + 二批 + 二批 + setshowPopup(true)}> + + + 标签 + + + + {'编辑 >'} + + handChose?.(item)}> + + { + status === 1 && +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ } + { + status === 2 && + + + + } + setshowPopup(false)}> +
+ ) +} \ No newline at end of file diff --git a/src/pages/customerManagement/components/ItemList/index.module.scss b/src/pages/customerManagement/components/ItemList/index.module.scss new file mode 100644 index 0000000..5ae1029 --- /dev/null +++ b/src/pages/customerManagement/components/ItemList/index.module.scss @@ -0,0 +1,106 @@ +.mainItem { + margin-left: 24px; + margin-right: 24px; + margin-bottom: 24px; + background: #fff; + overflow: hidden; + padding-bottom: 16px; + border-radius: 16px; + + .itemTop { + margin-top: 36px; + display: flex; + justify-content: space-between; + + .itemLeft { + margin-left: 24px; + display: flex; + + .itemCile { + width: 78px; + height: 78px; + background: linear-gradient(337deg, #7BB7FF 0%, #4581FF 100%); + font-size: 32px; + font-weight: 500; + color: #FFFFFF; + text-align: center; + line-height: 78px; + border-radius: 50%; + margin-right: 32px; + } + + .item_top_one { + .item_top_one_flex { + display: flex; + align-items: center; + + .itemName { + font-size: 28px; + font-weight: 500; + color: #000000; + margin-right: 24px; + } + + .itemPhone { + font-size: 28px; + font-family: PingFangSC-Regular, PingFang SC; + font-weight: 400; + color: #000000; + } + } + + .item_tag_box { + margin-top: 16px; + display: flex; + align-items: center; + flex-wrap: wrap; + + .item_tagItem { + margin-bottom: 5px; + margin-right: 16px; + padding: 6px 16px 6px 16px; + font-size: 24px; + font-weight: 500; + color: #4581FF; + background: #ecf2ff; + border-radius: 8px; + } + } + } + } + + .itemRight { + display: flex; + + .phoneFont { + margin-right: 40px; + margin-left: 16px; + font-size: 24px; + font-weight: 400; + color: #4581FF; + } + } + } + + .line { + height: 1px; + background: #000000; + opacity: 0.1; + margin-right: 24px; + margin-left: 24px; + margin-top: 20px; + margin-bottom: 16px; + } + + .flex_bottom { + display: flex; + justify-content: space-between; + align-items: center; + padding-left: 24px; + padding-right: 24px; + font-size: 24px; + font-weight: 400; + color: #000000; + } + +} \ No newline at end of file diff --git a/src/pages/customerManagement/components/ItemList/index.tsx b/src/pages/customerManagement/components/ItemList/index.tsx new file mode 100644 index 0000000..e0af1bc --- /dev/null +++ b/src/pages/customerManagement/components/ItemList/index.tsx @@ -0,0 +1,55 @@ +import { View } from '@tarojs/components' +import React, { useCallback, memo, useEffect, useMemo, useRef, useState, ReactNode } from 'react' +import styles from "./index.module.scss" +import classnames from "classnames"; +import Taro, { usePullDownRefresh, useRouter, useDidShow } from '@tarojs/taro'; +import { alert } from '@/common/common' +import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' +import IconFont from '@/components/iconfont/iconfont' +interface Props { + obj: any +} + +export default memo((props: Props) => { + + const handPhone = () => { + Taro.makePhoneCall({ + phoneNumber: props.obj?.phone + }) + } + + const handNav = () => { + Taro.navigateTo({ + url: '/pages/customerDetails/index?purchaser_id=' + props.obj?.id + }) + } + + return ( + handNav()}> + + + + + + 欧阳斌峰 + 133****7761 + + + 二批 + 二批 + + + + handPhone()}> + + 联系TA + + + + + 广东省广州市海珠区 + 更新时间:2022-09-20 17:10 + + + ) +}) \ No newline at end of file diff --git a/src/pages/customerManagement/components/Sort/index.module.scss b/src/pages/customerManagement/components/Sort/index.module.scss new file mode 100644 index 0000000..d5133a0 --- /dev/null +++ b/src/pages/customerManagement/components/Sort/index.module.scss @@ -0,0 +1,31 @@ +.mainBox { + display: flex; + flex-wrap: wrap; + padding-left: 40px; + + .itemFlex { + padding: 23px 11px 23px 11px; + background: #f6f6f6; + box-sizing: border-box; + border: 1px solid #f6f6f6; + font-size: 28px; + font-weight: 400; + color: #000000; + margin-right: 24px; + margin-bottom: 24px; + border-radius: 16px; + } + + .itemactiveFlex { + padding: 23px 11px 23px 11px; + background: rgba(51, 127, 255, 0.1); + border-radius: 16px; + border: 1px solid #337FFF; + box-sizing: border-box; + font-size: 28px; + font-weight: 400; + color: #337FFF; + margin-right: 24px; + margin-bottom: 24px; + } +} \ No newline at end of file diff --git a/src/pages/customerManagement/components/Sort/index.tsx b/src/pages/customerManagement/components/Sort/index.tsx new file mode 100644 index 0000000..e01c98b --- /dev/null +++ b/src/pages/customerManagement/components/Sort/index.tsx @@ -0,0 +1,87 @@ +import { View } from '@tarojs/components' +import React, { useCallback, memo, useEffect, useMemo, useRef, useState, ReactNode } from 'react' +import styles from "./index.module.scss" +import classnames from "classnames"; +import Taro, { usePullDownRefresh, useRouter, useDidShow } from '@tarojs/taro'; +import { alert } from '@/common/common' +import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' +import DropDownItem from '@/components/dropDown-item' +interface Props { + handSort?: (any) => void +} + +export default memo((props: Props) => { + + const DropDownItemRef = useRef() + // const close = () => { + // DropDownItemRef.current.closePopup() + // } + + const [list, setlist] = useState([ + { + name: '下单时间升序', + id: 0, + checked: false + }, + { + name: '下单时间升序', + id: 1, + checked: false + }, + { + name: '下单时间升序', + id: 2, + checked: false + }, + { + name: '下单时间升序', + id: 3, + checked: false + }, + { + name: '下单时间升序', + id: 4, + checked: false + }, + ]) + + const [currentValue, setCurrentValue] = useState(-1) + + const handItem = (it) => { + list.map(item => { + if (item.id == it.id) { + item.checked = true + } else { + item.checked = false + } + return item + }) + setlist([...list]) + props.handSort?.(it) + } + + + const title = useMemo(() => { + let arr = list.filter(item => { return item.checked }) + if (!arr.length) { + return '默认排序' + } else { + return arr[0]?.name + } + }, [list]) + + + return ( + + + { + list.map((item, index) => { + return ( + handItem?.(item)}>{item.name} + ) + }) + } + + + ) +}) \ No newline at end of file diff --git a/src/pages/customerManagement/components/Tag/index.module.scss b/src/pages/customerManagement/components/Tag/index.module.scss index e69de29..a08c8a3 100644 --- a/src/pages/customerManagement/components/Tag/index.module.scss +++ b/src/pages/customerManagement/components/Tag/index.module.scss @@ -0,0 +1,44 @@ +.mainBox { + .pussTitle { + font-size: 28px; + font-weight: 500; + color: #000000; + margin-bottom: 24px; + margin-left: 40px; + margin-top: 15px; + } + + .pussBox { + display: flex; + flex-wrap: wrap; + padding-left: 40px; + + + + .itemFlex { + padding: 23px 47px 23px 47px; + background: #f6f6f6; + box-sizing: border-box; + border: 1px solid #f6f6f6; + font-size: 28px; + font-weight: 400; + color: #000000; + margin-right: 24px; + margin-bottom: 24px; + border-radius: 16px; + } + + .itemactiveFlex { + padding: 23px 47px 23px 47px; + background: rgba(51, 127, 255, 0.1); + border-radius: 16px; + border: 1px solid #337FFF; + box-sizing: border-box; + font-size: 28px; + font-weight: 400; + color: #337FFF; + margin-right: 24px; + margin-bottom: 24px; + } + } +} \ No newline at end of file diff --git a/src/pages/customerManagement/components/Tag/index.tsx b/src/pages/customerManagement/components/Tag/index.tsx index 4e2354a..2c437f7 100644 --- a/src/pages/customerManagement/components/Tag/index.tsx +++ b/src/pages/customerManagement/components/Tag/index.tsx @@ -3,24 +3,96 @@ import React, { useCallback, memo, useEffect, useMemo, useRef, useState, ReactNo import styles from "./index.module.scss" import classnames from "classnames"; import Taro, { usePullDownRefresh, useRouter, useDidShow } from '@tarojs/taro'; -import Popup from '@/components/popup' -import { debounce } from '@/common/util' import { alert } from '@/common/common' import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' -import IconFont from '@/components/iconfont/iconfont' import DropDownItem from '@/components/dropDown-item' export default memo(() => { const DropDownItemRef = useRef() - const close = () => { - DropDownItemRef.current.closePopup() + + const [currentValue, setCurrentValue] = useState(-1) + + const [list, setlist] = useState([ + { + name: '二批', + id: 0, + checked: false + }, + { + name: '制衣厂', + id: 1, + checked: false + }, + { + name: '布行', + id: 2, + checked: false + } + ]) + + const [taglist, settaglist] = useState([ + { + name: '二批321312', + id: 0, + checked: false + }, + { + name: '制衣厂312412', + id: 1, + checked: false + }, + { + name: '布行54354', + id: 2, + checked: false + } + ]) + + const handItem = (it) => { + list.map(item => { + if (item.id == it.id) { + item.checked = !item.checked + } + return item + }) + setlist([...list]) } + + const handTag = (it) => { + taglist.map(item => { + if (item.id == it.id) { + item.checked = !item.checked + } + return item + }) + settaglist([...taglist]) + } + return ( - + - close()}>111 + 客户类型 + + { + list.map((item, index) => { + return ( + handItem?.(item)}>{item.name} + ) + }) + } + + 自定义标签 + + { + taglist.map((item, index) => { + return ( + handTag?.(item)}>{item.name} + ) + }) + } + ) diff --git a/src/pages/customerManagement/index.module.scss b/src/pages/customerManagement/index.module.scss index 75a1150..8271758 100644 --- a/src/pages/customerManagement/index.module.scss +++ b/src/pages/customerManagement/index.module.scss @@ -1,9 +1,65 @@ .mainBox { - overflow: hidden; - .menuBox { + .topBox { width: 100%; - display: flex; - flex: 1; + position: sticky; + top: 0; + z-index: 999; + padding-bottom: 24px; + background: #fff; + // overflow: hidden; + + .search_input { + padding-top: 8px; + margin-left: 24px; + margin-right: 24px; + margin-bottom: 10px; + } + + .menuBox { + width: 100%; + display: flex; + flex: 1; + + + } + + } + + .totalFont { + margin-top: 24px; + margin-left: 24px; + font-size: 26px; + font-weight: 400; + color: #000000; + margin-bottom: 15px; + } + + .order_list { + // height: calc(100vh - env(safe-area-inset-bottom) - 230px); + background: #f7f7f7; + } + + .bottom_box { + height: 160px; + background: #FFFFFF; + position: fixed; + bottom: 0; + z-index: 1; + + .bottom_btn { + margin-top: 16px; + margin-left: 24px; + margin-right: 24px; + width: 702px; + height: 80px; + background: #337FFF; + border-radius: 44px; + line-height: 80px; + text-align: center; + font-size: 28px; + font-weight: 500; + color: #FFFFFF; + } } } \ No newline at end of file diff --git a/src/pages/customerManagement/index.tsx b/src/pages/customerManagement/index.tsx index 3c0c8a7..dc9b224 100644 --- a/src/pages/customerManagement/index.tsx +++ b/src/pages/customerManagement/index.tsx @@ -7,16 +7,102 @@ import Popup from '@/components/popup' import { debounce } from '@/common/util' import { alert } from '@/common/common' import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format' -import IconFont from '@/components/iconfont/iconfont' +import { dataLoadingStatus, getFilterData } from '@/common/util' import Tag from './components/Tag'; +import Sort from './components/Sort'; +import Search from '@/components/search' +import ItemLiist from "./components/ItemList" +import InfiniteScroll from '@/components/infiniteScroll' +import { ClientListApi } from '@/api/order' export default () => { + + const [searchField, setSearchField] = useState<{ page: number; size: number; order_no: string }>({ + page: 1, + size: 10, + order_no: '', + }) + + const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 }) + const { fetchData: listFetchData, state: orderState } = ClientListApi() + const getOrderList = async () => { + let res = await listFetchData({ + ...getFilterData(searchField) + }) + setOrderData((e) => ({ ...e, list: res.data?.list, total: res.data?.total })) + setRefresherTriggeredStatus(() => false) + } + + //监听筛选条件变化 + useEffect(() => { + getOrderList() + }, [searchField]) + + + //输入了搜索关键字 + const getSearchData = useCallback((e) => { + // pageNum.current.page = 1 + // setOrderData(() => ({ list: [], total: 0 })) + // setSearchField((val) => ({ ...val, order_no: e, size: 10 })) + }, []) + + //数据加载状态 + const statusMore = useMemo(() => { + return dataLoadingStatus({ list: orderData.list, total: orderData.total, status: orderState.loading }) + }, [orderData, orderState]) + + //上拉加载数据 + const pageNum = useRef({ size: searchField.size, page: searchField.page }) + const getScrolltolower = useCallback(() => { + if (orderData.list.length < orderData.total) { + pageNum.current.page++ + const size = pageNum.current.size * pageNum.current.page + setSearchField({ ...searchField, size }) + } + }, [orderData]) + + //列表下拉刷新 + const [refresherTriggeredStatus, setRefresherTriggeredStatus] = useState(false) + const getRefresherRefresh = async () => { + pageNum.current.size = 1 + setRefresherTriggeredStatus(true) + setSearchField((val) => ({ ...val, size: 10 })) + } + + //选择排序 + const handSort = useCallback((val) => { + console.log(val, 456456) + }, []) + return ( - - - - + + + + + + + + + + + 共 36 个客户 + + + {orderData?.list?.map((item, index) => { + return ( + + ) + })} + + + + 新建用户 )