✨ feat:客户管理95%
This commit is contained in:
parent
41dd477f2e
commit
708b5027bb
@ -20,4 +20,18 @@ export const mppurchaserput = () => {
|
|||||||
url: `/v1/mp/purchaser`,
|
url: `/v1/mp/purchaser`,
|
||||||
method: "put",
|
method: "put",
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
//获取标签列表
|
||||||
|
export const mppurchaserlist = () => {
|
||||||
|
return useRequest({
|
||||||
|
url: `/v1/mp/purchaser/label/list`,
|
||||||
|
method: "get",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
//保存标签
|
||||||
|
export const mppurchaserlabeladd = () => {
|
||||||
|
return useRequest({
|
||||||
|
url: `/v1/mp/purchaser/label/add`,
|
||||||
|
method: "post",
|
||||||
|
})
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
export const BASE_URL = CURRENT_BASE_URL
|
// export const BASE_URL = CURRENT_BASE_URL
|
||||||
// export const BASE_URL = `http://192.168.0.75:50001/lymarket`
|
// export const BASE_URL = `http://192.168.0.75:50001/lymarket`
|
||||||
// export const BASE_URL = `http://192.168.0.89:50001/lymarket`
|
// export const BASE_URL = `http://192.168.0.89:50001/lymarket`
|
||||||
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
|
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
|
||||||
@ -15,7 +15,7 @@ export const BASE_URL = CURRENT_BASE_URL
|
|||||||
// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添
|
// export const BASE_URL = `http://192.168.1.7:50002/lymarket` // 添
|
||||||
// export const BASE_URL = `http://192.168.1.42:50002/lymarket` // 杰
|
// export const BASE_URL = `http://192.168.1.42:50002/lymarket` // 杰
|
||||||
// export const BASE_URL = `http://192.168.1.95:40001/lymarket` // 华
|
// export const BASE_URL = `http://192.168.1.95:40001/lymarket` // 华
|
||||||
// export const BASE_URL = 'http://192.168.1.22:50002/lymarket' // 婷
|
export const BASE_URL = 'http://192.168.1.22:50002/lymarket' // 婷
|
||||||
|
|
||||||
// CDN
|
// CDN
|
||||||
// 生成密钥
|
// 生成密钥
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { View, ScrollView, Button } from '@tarojs/components'
|
import { View, ScrollView, Button } from '@tarojs/components'
|
||||||
import React, { useCallback, memo, useEffect, useMemo, useRef, useState, ReactNode } from 'react'
|
import React, { useCallback, memo, useEffect, useMemo, useRef, useState, ReactNode, forwardRef, useImperativeHandle } from 'react'
|
||||||
import styles from "./index.module.scss"
|
import styles from "./index.module.scss"
|
||||||
import classnames from "classnames";
|
import classnames from "classnames";
|
||||||
import Taro, { usePullDownRefresh, useRouter, useDidShow } from '@tarojs/taro';
|
import Taro, { usePullDownRefresh, useRouter, useDidShow } from '@tarojs/taro';
|
||||||
@ -8,17 +8,28 @@ import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format
|
|||||||
import IconFont from '@/components/iconfont/iconfont'
|
import IconFont from '@/components/iconfont/iconfont'
|
||||||
import Popup from '@/components/popup';
|
import Popup from '@/components/popup';
|
||||||
import { goLink } from '@/common/common'
|
import { goLink } from '@/common/common'
|
||||||
|
import { mppurchaserlist, mppurchaserlabeladd } from "@/api/customer"
|
||||||
interface Props {
|
interface Props {
|
||||||
showPopup: boolean,
|
showPopup: boolean,
|
||||||
handClose: () => void,
|
handClose: () => void,
|
||||||
purchaser_id?: string | number
|
purchaser_id?: string | number
|
||||||
|
diseShow?: () => void
|
||||||
}
|
}
|
||||||
export default memo((props: Props) => {
|
export default memo(forwardRef((props: Props, ref) => {
|
||||||
|
const router = useRouter()
|
||||||
|
useEffect(() => {
|
||||||
|
getList()
|
||||||
|
}, [])
|
||||||
|
const { fetchData } = mppurchaserlist()
|
||||||
|
const getList = async () => {
|
||||||
|
const res = await fetchData()
|
||||||
|
if (res.data) {
|
||||||
|
setModeList([...res.data.list])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//标签
|
//标签
|
||||||
const [modeList, setModeList] = useState<any[]>([{ id: -1, name: '不限' }, { id: 0, name: '大货' }, { id: 1, name: '剪版' }, { id: 2, name: '散剪' }, { id: 3, name: '新开发客户' }])
|
const [modeList, setModeList] = useState<any[]>([])
|
||||||
//选择标签
|
//选择标签
|
||||||
const handCheckMode = (item) => {
|
const handCheckMode = (item) => {
|
||||||
modeList.map(it => {
|
modeList.map(it => {
|
||||||
@ -37,9 +48,34 @@ export default memo((props: Props) => {
|
|||||||
})
|
})
|
||||||
setModeList([...modeList])
|
setModeList([...modeList])
|
||||||
}
|
}
|
||||||
|
const { fetchData: addFetch } = mppurchaserlabeladd()
|
||||||
const handSure = () => {
|
const handSure = async () => {
|
||||||
|
const arr: any[] = []
|
||||||
|
const fltArr = modeList.filter(item => { return item.checked })
|
||||||
|
fltArr.forEach(item => {
|
||||||
|
arr.push({
|
||||||
|
label_id: item.id
|
||||||
|
})
|
||||||
|
})
|
||||||
|
Taro.showLoading({
|
||||||
|
title: '请稍等...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
const res = await addFetch({ binding_label: arr, purchaser_id: Number(router.params.purchaser_id) })
|
||||||
|
if (res.msg == 'success') {
|
||||||
|
Taro.showToast({
|
||||||
|
icon: 'success',
|
||||||
|
title: '成功'
|
||||||
|
})
|
||||||
|
Taro.hideLoading()
|
||||||
|
} else {
|
||||||
|
Taro.showToast({
|
||||||
|
icon: 'error',
|
||||||
|
title: res.msg
|
||||||
|
})
|
||||||
|
Taro.hideLoading()
|
||||||
|
}
|
||||||
|
props?.diseShow?.()
|
||||||
}
|
}
|
||||||
|
|
||||||
const isDisabled = useMemo(() => {
|
const isDisabled = useMemo(() => {
|
||||||
@ -56,6 +92,11 @@ export default memo((props: Props) => {
|
|||||||
return arr.length
|
return arr.length
|
||||||
}, [modeList])
|
}, [modeList])
|
||||||
|
|
||||||
|
|
||||||
|
useImperativeHandle(ref, () => ({
|
||||||
|
modeList,
|
||||||
|
setModeList
|
||||||
|
}))
|
||||||
return (
|
return (
|
||||||
<Popup title={'选择标签'} show={props.showPopup} onClose={() => { props.handClose() }}>
|
<Popup title={'选择标签'} show={props.showPopup} onClose={() => { props.handClose() }}>
|
||||||
<ScrollView scrollY className={styles.scrollView}>
|
<ScrollView scrollY className={styles.scrollView}>
|
||||||
@ -97,4 +138,4 @@ export default memo((props: Props) => {
|
|||||||
</View>
|
</View>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
})
|
}))
|
@ -12,22 +12,27 @@
|
|||||||
background: #F6F7FB;
|
background: #F6F7FB;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
// margin-bottom: 16px;
|
|
||||||
|
|
||||||
.itemCile {
|
// margin-bottom: 16px;
|
||||||
width: 78px;
|
.leftSafe {
|
||||||
height: 78px;
|
width: 142px;
|
||||||
background: linear-gradient(337deg, #7BB7FF 0%, #4581FF 100%);
|
|
||||||
font-size: 32px;
|
.itemCile {
|
||||||
font-weight: 500;
|
width: 78px;
|
||||||
color: #FFFFFF;
|
height: 78px;
|
||||||
text-align: center;
|
background: linear-gradient(337deg, #7BB7FF 0%, #4581FF 100%);
|
||||||
line-height: 78px;
|
font-size: 32px;
|
||||||
border-radius: 50%;
|
font-weight: 500;
|
||||||
margin-right: 32px;
|
color: #FFFFFF;
|
||||||
margin-left: 32px;
|
text-align: center;
|
||||||
|
line-height: 78px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 32px;
|
||||||
|
margin-left: 32px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.item_top_one {
|
.item_top_one {
|
||||||
.item_top_one_flex {
|
.item_top_one_flex {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -31,6 +31,7 @@ export default () => {
|
|||||||
const res = await getDesc({ id: router.params.purchaser_id })
|
const res = await getDesc({ id: router.params.purchaser_id })
|
||||||
setinfoObj(res.data)
|
setinfoObj(res.data)
|
||||||
Taro.hideLoading()
|
Taro.hideLoading()
|
||||||
|
setshowPopup(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
//顶部栏
|
//顶部栏
|
||||||
@ -57,11 +58,26 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [showPopup, setshowPopup] = useState(false)
|
const [showPopup, setshowPopup] = useState(false)
|
||||||
|
const TagPopupRef = useRef<any>()
|
||||||
|
const handShow = () => {
|
||||||
|
TagPopupRef?.current?.modeList.map(it => {
|
||||||
|
infoObj?.label_list?.forEach(item => {
|
||||||
|
if (it.id == item.label_id) {
|
||||||
|
it.checked = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return it
|
||||||
|
})
|
||||||
|
TagPopupRef.current.setModeList([...TagPopupRef.current.modeList])
|
||||||
|
setshowPopup(true)
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<View className={styles.mainBox}>
|
<View className={styles.mainBox}>
|
||||||
<View className={styles.mainTop}>
|
<View className={styles.mainTop}>
|
||||||
<View className={styles.mainUser}>
|
<View className={styles.mainUser}>
|
||||||
<View className={styles.itemCile}>{infoObj?.name?.[0]}</View>
|
<View className={styles.leftSafe}>
|
||||||
|
<View className={styles.itemCile}>{infoObj?.name?.[0]}</View>
|
||||||
|
</View>
|
||||||
<View className={styles.item_top_one}>
|
<View className={styles.item_top_one}>
|
||||||
<View className={styles.item_top_one_flex}>
|
<View className={styles.item_top_one_flex}>
|
||||||
<View className={styles.itemName}>{infoObj?.name}</View>
|
<View className={styles.itemName}>{infoObj?.name}</View>
|
||||||
@ -70,7 +86,14 @@ export default () => {
|
|||||||
<View className={styles.item_tag_box}>
|
<View className={styles.item_tag_box}>
|
||||||
<View className={styles.item_tagItem}>{infoObj?.purchaser_type_name || '暂无'}</View>
|
<View className={styles.item_tagItem}>{infoObj?.purchaser_type_name || '暂无'}</View>
|
||||||
<View className={styles.item_tagItem}>{infoObj?.sale_user_name || '暂无'}</View>
|
<View className={styles.item_tagItem}>{infoObj?.sale_user_name || '暂无'}</View>
|
||||||
<View className={styles.item_tagAdd} onClick={() => setshowPopup(true)}>
|
{
|
||||||
|
infoObj?.label_list?.map(item => {
|
||||||
|
return (
|
||||||
|
<View className={styles.item_tagItem}>{item.label_name}</View>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
<View className={styles.item_tagAdd} onClick={() => handShow()}>
|
||||||
<View className={styles.item_add}>+</View>
|
<View className={styles.item_add}>+</View>
|
||||||
<View className={styles.item_add_font}>标签</View>
|
<View className={styles.item_add_font}>标签</View>
|
||||||
</View>
|
</View>
|
||||||
@ -105,7 +128,7 @@ export default () => {
|
|||||||
<AddressList ref={AddressListRef} refresherEnabled={true} purchaser_id={router.params.purchaser_id as any} />
|
<AddressList ref={AddressListRef} refresherEnabled={true} purchaser_id={router.params.purchaser_id as any} />
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
<TagPopup showPopup={showPopup} handClose={() => setshowPopup(false)}></TagPopup>
|
<TagPopup ref={TagPopupRef} showPopup={showPopup} handClose={() => setshowPopup(false)} diseShow={() => getInfo()}></TagPopup>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
}
|
}
|
@ -116,12 +116,23 @@ export default memo(forwardRef((props: Props, ref) => {
|
|||||||
return it
|
return it
|
||||||
})
|
})
|
||||||
setcityList([...cityList])
|
setcityList([...cityList])
|
||||||
let provinceArr = list.filter(next => { return next.check })
|
let cityArr = cityList.filter(next => { return next.check })
|
||||||
if (item.check) {
|
if (item.check) {
|
||||||
choseCityArr.current.list.push(item)
|
choseCityArr.current.list.push(item)
|
||||||
} else {
|
} else {
|
||||||
deleteById(item.id, choseCityArr.current.list)
|
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)
|
props.handCity?.(provinceArr, choseCityArr.current.list)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,30 +19,20 @@ export default memo((props: Props) => {
|
|||||||
|
|
||||||
const [list, setlist] = useState<any[]>([
|
const [list, setlist] = useState<any[]>([
|
||||||
{
|
{
|
||||||
name: '下单时间升序',
|
name: '下单时间',
|
||||||
id: 0,
|
id: '1',
|
||||||
checked: false
|
checked: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '下单时间升序',
|
name: '创建时间',
|
||||||
id: 1,
|
id: '2',
|
||||||
checked: false
|
checked: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '下单时间升序',
|
name: '更新时间',
|
||||||
id: 2,
|
id: '3',
|
||||||
checked: false
|
checked: false
|
||||||
},
|
}
|
||||||
{
|
|
||||||
name: '下单时间升序',
|
|
||||||
id: 3,
|
|
||||||
checked: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '下单时间升序',
|
|
||||||
id: 4,
|
|
||||||
checked: false
|
|
||||||
},
|
|
||||||
])
|
])
|
||||||
|
|
||||||
const [currentValue, setCurrentValue] = useState<number>(-1)
|
const [currentValue, setCurrentValue] = useState<number>(-1)
|
||||||
@ -57,7 +47,7 @@ export default memo((props: Props) => {
|
|||||||
return item
|
return item
|
||||||
})
|
})
|
||||||
setlist([...list])
|
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 { alert } from '@/common/common'
|
||||||
import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format'
|
import { formatPriceDiv, formatDateTime, formatWeightDiv } from '@/common/format'
|
||||||
import DropDownItem from '@/components/dropDown-item'
|
import DropDownItem from '@/components/dropDown-item'
|
||||||
|
import { mppurchaserlist } from "@/api/customer"
|
||||||
interface Props {
|
interface Props {
|
||||||
handType: (any) => void,
|
handType: (any) => void,
|
||||||
handTags: (any) => void
|
handTags: (any) => void
|
||||||
@ -35,23 +36,18 @@ export default memo((props: Props) => {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
const [taglist, settaglist] = useState<any[]>([
|
useEffect(() => {
|
||||||
{
|
getList()
|
||||||
name: '二批321312',
|
}, [])
|
||||||
id: 0,
|
const { fetchData } = mppurchaserlist()
|
||||||
checked: false
|
const getList = async () => {
|
||||||
},
|
const res = await fetchData()
|
||||||
{
|
if (res.data) {
|
||||||
name: '制衣厂312412',
|
settaglist([...res.data.list])
|
||||||
id: 1,
|
|
||||||
checked: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '布行54354',
|
|
||||||
id: 2,
|
|
||||||
checked: false
|
|
||||||
}
|
}
|
||||||
])
|
}
|
||||||
|
|
||||||
|
const [taglist, settaglist] = useState<any[]>([])
|
||||||
|
|
||||||
const handItem = (it) => {
|
const handItem = (it) => {
|
||||||
list.map(item => {
|
list.map(item => {
|
||||||
|
@ -27,6 +27,7 @@ export default () => {
|
|||||||
name_phone_or_sale_user: string,
|
name_phone_or_sale_user: string,
|
||||||
province_id: any[] | string,
|
province_id: any[] | string,
|
||||||
city_id: any[] | string,
|
city_id: any[] | string,
|
||||||
|
abstract_sort_key: string,
|
||||||
}
|
}
|
||||||
>({
|
>({
|
||||||
page: 1,
|
page: 1,
|
||||||
@ -35,7 +36,8 @@ export default () => {
|
|||||||
purchaser_type: '',
|
purchaser_type: '',
|
||||||
name_phone_or_sale_user: '',
|
name_phone_or_sale_user: '',
|
||||||
province_id: '',
|
province_id: '',
|
||||||
city_id: ''
|
city_id: '',
|
||||||
|
abstract_sort_key: ''
|
||||||
})
|
})
|
||||||
|
|
||||||
const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
const [orderData, setOrderData] = useState<{ list: any[]; total: number }>({ list: [], total: 0 })
|
||||||
@ -85,8 +87,9 @@ export default () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//选择排序
|
//选择排序
|
||||||
const handSort = useCallback((val) => {
|
const handSort = useCallback((e: string) => {
|
||||||
console.log(val, 456456)
|
pageNum.current.page = 1
|
||||||
|
setSearchField((val) => ({ ...val, size: 10, abstract_sort_key: e }))
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
//筛选城市
|
//筛选城市
|
||||||
@ -108,14 +111,20 @@ export default () => {
|
|||||||
|
|
||||||
//选择客户类型
|
//选择客户类型
|
||||||
const handType = useCallback((val) => {
|
const handType = useCallback((val) => {
|
||||||
val.filter(item => { return item.checked })
|
const arr = val.filter(item => { return item.checked })
|
||||||
pageNum.current.page = 1
|
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) => {
|
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 (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user