✨ feat:客户管理95%

This commit is contained in:
Haiyi
2022-10-28 18:03:10 +08:00
parent 41dd477f2e
commit 708b5027bb
9 changed files with 157 additions and 68 deletions
@@ -116,12 +116,23 @@ export default memo(forwardRef((props: Props, ref) => {
return it
})
setcityList([...cityList])
let provinceArr = list.filter(next => { return next.check })
let cityArr = cityList.filter(next => { return next.check })
if (item.check) {
choseCityArr.current.list.push(item)
} else {
deleteById(item.id, choseCityArr.current.list)
}
//将市区的全部不选后,该省的颜色不高亮
if (cityArr.length == 0) {
list.map(item => {
if (cityList[0]?.parent_id == item.id) {
item.check = false
}
return item
})
setlist([...list])
}
let provinceArr = list.filter(next => { return next.check })
props.handCity?.(provinceArr, choseCityArr.current.list)
}
@@ -19,30 +19,20 @@ export default memo((props: Props) => {
const [list, setlist] = useState<any[]>([
{
name: '下单时间升序',
id: 0,
name: '下单时间',
id: '1',
checked: false
},
{
name: '下单时间升序',
id: 1,
name: '创建时间',
id: '2',
checked: false
},
{
name: '下单时间升序',
id: 2,
name: '更新时间',
id: '3',
checked: false
},
{
name: '下单时间升序',
id: 3,
checked: false
},
{
name: '下单时间升序',
id: 4,
checked: false
},
}
])
const [currentValue, setCurrentValue] = useState<number>(-1)
@@ -57,7 +47,7 @@ export default memo((props: Props) => {
return item
})
setlist([...list])
props.handSort?.(it)
props.handSort?.(it.id)
}
@@ -6,6 +6,7 @@ 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'
import { mppurchaserlist } from "@/api/customer"
interface Props {
handType: (any) => void,
handTags: (any) => void
@@ -35,23 +36,18 @@ export default memo((props: Props) => {
}
])
const [taglist, settaglist] = useState<any[]>([
{
name: '二批321312',
id: 0,
checked: false
},
{
name: '制衣厂312412',
id: 1,
checked: false
},
{
name: '布行54354',
id: 2,
checked: false
useEffect(() => {
getList()
}, [])
const { fetchData } = mppurchaserlist()
const getList = async () => {
const res = await fetchData()
if (res.data) {
settaglist([...res.data.list])
}
])
}
const [taglist, settaglist] = useState<any[]>([])
const handItem = (it) => {
list.map(item => {
+15 -6
View File
@@ -27,6 +27,7 @@ export default () => {
name_phone_or_sale_user: string,
province_id: any[] | string,
city_id: any[] | string,
abstract_sort_key: string,
}
>({
page: 1,
@@ -35,7 +36,8 @@ export default () => {
purchaser_type: '',
name_phone_or_sale_user: '',
province_id: '',
city_id: ''
city_id: '',
abstract_sort_key: ''
})
const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
@@ -85,8 +87,9 @@ export default () => {
}
//选择排序
const handSort = useCallback((val) => {
console.log(val, 456456)
const handSort = useCallback((e: string) => {
pageNum.current.page = 1
setSearchField((val) => ({ ...val, size: 10, abstract_sort_key: e }))
}, [])
//筛选城市
@@ -108,14 +111,20 @@ export default () => {
//选择客户类型
const handType = useCallback((val) => {
val.filter(item => { return item.checked })
const arr = val.filter(item => { return item.checked })
pageNum.current.page = 1
setSearchField((val) => ({ ...val, size: 10, purchaser_type: val[0]?.id }))
setSearchField((val) => ({ ...val, size: 10, purchaser_type: arr[0]?.id }))
}, [])
//选择标签
const handTags = useCallback((val) => {
console.log(val, 899999)
const arr: number[] = []
const arrOne = val.filter(item => { return item.checked })
arrOne.forEach(item => {
arr.push(item.id)
})
pageNum.current.page = 1
setSearchField((val) => ({ ...val, size: 10, label_ids: arr.length === 0 ? '' : arr }))
}, [])
return (