✨ feat:客户管理70%
This commit is contained in:
@@ -7,19 +7,34 @@ 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';
|
||||
import { goLink } from '@/common/common'
|
||||
|
||||
import { mppurchaser } from '@/api/customer'
|
||||
export default () => {
|
||||
const router = useRouter()
|
||||
|
||||
const [status, setstatus] = useState<number>(1)
|
||||
|
||||
useDidShow(() => {
|
||||
getInfo()
|
||||
})
|
||||
const [infoObj, setinfoObj] = useState<any>()
|
||||
const { fetchData: getDesc } = mppurchaser()
|
||||
const getInfo = async () => {
|
||||
Taro.showLoading({
|
||||
title: '请稍等...',
|
||||
mask: true
|
||||
})
|
||||
const res = await getDesc({ id: router.params.purchaser_id })
|
||||
setinfoObj(res.data)
|
||||
Taro.hideLoading()
|
||||
}
|
||||
|
||||
//顶部栏
|
||||
const AddressListRef = useRef<any>()
|
||||
const [TarBarList, setTarBarList] = useState<any[]>([{ id: 1, name: '基础信息', showBorder: true }, { id: 2, name: '收货地址', showBorder: false }])
|
||||
const handChose = (item) => {
|
||||
TarBarList.map(it => {
|
||||
@@ -34,6 +49,11 @@ export default () => {
|
||||
// setOrderData(() => ({ list: [], total: 0 }))
|
||||
// setSearchField((val) => ({ ...val, size: 10, status: item.id }))
|
||||
})
|
||||
if (item.id == 2) {
|
||||
Taro.nextTick(() => {
|
||||
AddressListRef.current?.getData()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const [showPopup, setshowPopup] = useState(false)
|
||||
@@ -41,48 +61,48 @@ export default () => {
|
||||
<View className={styles.mainBox}>
|
||||
<View className={styles.mainTop}>
|
||||
<View className={styles.mainUser}>
|
||||
<View className={styles.itemCile}>欧</View>
|
||||
<View className={styles.itemCile}>{infoObj?.name?.[0]}</View>
|
||||
<View className={styles.item_top_one}>
|
||||
<View className={styles.item_top_one_flex}>
|
||||
<View className={styles.itemName}>欧阳斌峰</View>
|
||||
<View className={styles.itemPhone}>133****7761</View>
|
||||
<View className={styles.itemName}>{infoObj?.name}</View>
|
||||
<View className={styles.itemPhone}>{infoObj?.phone}</View>
|
||||
</View>
|
||||
<View className={styles.item_tag_box}>
|
||||
<View className={styles.item_tagItem}>二批</View>
|
||||
<View className={styles.item_tagItem}>二批</View>
|
||||
<View className={styles.item_tagItem}>{infoObj?.sale_user_name}</View>
|
||||
<View className={styles.item_tagAdd} onClick={() => setshowPopup(true)}>
|
||||
<View className={styles.item_add}>+</View>
|
||||
<View className={styles.item_add_font}>标签</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.pos} onClick={() => goLink('/pages/customerEditor/index?id=' + router.params.purchaser_id)}>{'编辑 >'}</View>
|
||||
<View className={styles.pos} onClick={() => goLink('/pages/customerEditor/index?id=' + router.params.purchaser_id + '&type=edit')}>{'编辑 >'}</View>
|
||||
</View>
|
||||
<Tabs list={TarBarList} handChose={(item) => handChose?.(item)}></Tabs>
|
||||
</View>
|
||||
{
|
||||
status === 1 && <View className={styles.formBox}>
|
||||
<Form title={'客户全称'} des={'2222'} ></Form>
|
||||
<Form title={'客户简称'} des={'2222'} ></Form>
|
||||
<Form title={'客户类型'} des={'2222'} ></Form>
|
||||
<Form title={'联系人'} des={'2222'} ></Form>
|
||||
<Form title={'联系电话'} des={'2222'} isPhone></Form>
|
||||
<Form title={'省市区'} des={'2222'} ></Form>
|
||||
<Form title={'详细地址'} des={'2222'} ></Form>
|
||||
<Form title={'业务人员'} des={'2222'} ></Form>
|
||||
<Form title={'客户来源'} des={'2222'} ></Form>
|
||||
<Form title={'备注信息'} des={'2222'} ></Form>
|
||||
<Form title={'下单时间'} des={'2222'} ></Form>
|
||||
<Form title={'创建时间'} des={'2222'} ></Form>
|
||||
<Form title={'创建人'} des={'2222'} ></Form>
|
||||
<Form title={'更新人'} des={'2222'} ></Form>
|
||||
<Form title={'更新时间'} des={'2222'} isBorder={false}></Form>
|
||||
<Form title={'客户全称'} des={infoObj?.name} ></Form>
|
||||
<Form title={'客户简称'} des={infoObj?.short_name} ></Form>
|
||||
<Form title={'客户类型'} des={infoObj?.purchaser_type_name} ></Form>
|
||||
<Form title={'联系人'} des={infoObj?.director} ></Form>
|
||||
<Form title={'联系电话'} des={infoObj?.phone} isPhone></Form>
|
||||
<Form title={'省市区'} des={infoObj?.province_name + infoObj?.city_name + infoObj?.district_name} ></Form>
|
||||
<Form title={'详细地址'} des={infoObj?.address_detail} ></Form>
|
||||
<Form title={'业务人员'} des={infoObj?.sale_user_name} ></Form>
|
||||
<Form title={'客户来源'} des={infoObj?.qqq} ></Form>
|
||||
<Form title={'备注信息'} des={infoObj?.qqqq} ></Form>
|
||||
<Form title={'下单时间'} des={infoObj?.qqq} ></Form>
|
||||
<Form title={'创建时间'} des={infoObj?.qqqq} ></Form>
|
||||
<Form title={'创建人'} des={infoObj?.qqqq} ></Form>
|
||||
<Form title={'更新人'} des={infoObj?.qqqqq} ></Form>
|
||||
<Form title={'更新时间'} des={infoObj?.qqqqq} isBorder={false}></Form>
|
||||
</View>
|
||||
}
|
||||
{
|
||||
status === 2 &&
|
||||
<View className={styles.order_list}>
|
||||
<AddressList refresherEnabled={true} purchaser_id={router.params.id as any} />
|
||||
<AddressList ref={AddressListRef} refresherEnabled={true} purchaser_id={router.params.purchaser_id as any} />
|
||||
</View>
|
||||
}
|
||||
<TagPopup showPopup={showPopup} handClose={() => setshowPopup(false)}></TagPopup>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { View, Button } 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 Taro, { usePullDownRefresh, useRouter, useDidShow, setNavigationBarTitle } from '@tarojs/taro';
|
||||
import Popup from '@/components/popup'
|
||||
import { debounce } from '@/common/util'
|
||||
import { alert, goLink } from '@/common/common'
|
||||
@@ -22,26 +22,34 @@ export default () => {
|
||||
|
||||
//默认业务员
|
||||
useDidShow(() => {
|
||||
let userInfo = Taro.getStorageSync('userInfo')
|
||||
if (router.params.type === 'add') {
|
||||
setNavigationBarTitle({ title: "新增客户" })
|
||||
} else {
|
||||
getInfo()
|
||||
setNavigationBarTitle({ title: "客户编辑" })
|
||||
}
|
||||
let userInfo = JSON.parse(Taro.getStorageSync('userInfo'))
|
||||
//获取选择的客户
|
||||
let pages = Taro.getCurrentPages();
|
||||
let currPage = pages[pages.length - 1]; // 获取当前页面
|
||||
if (currPage.data?.saleuserId) {
|
||||
//判断是否有跳转选择业务员
|
||||
if (currPage.data?.saleuserId && currPage.data?.saleuserId !== '') {
|
||||
setformData((e) => ({
|
||||
...e,
|
||||
sale_user_id: currPage.data?.saleuserId ? currPage.data?.saleuserId : userInfo?.user_id,
|
||||
sale_user_name: currPage.data?.saleuserName ? currPage.data?.saleuserName : userInfo?.user_name,
|
||||
sale_user_id: currPage.data?.saleuserId,
|
||||
sale_user_name: currPage.data?.saleuserName
|
||||
}))
|
||||
}
|
||||
//默认业务员
|
||||
if (currPage.data?.saleuserId == null) {
|
||||
setformData((e) => ({
|
||||
...e,
|
||||
sale_user_id: userInfo?.user_id,
|
||||
sale_user_name: userInfo?.user_name,
|
||||
}))
|
||||
}
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
getInfo()
|
||||
}, [])
|
||||
|
||||
|
||||
|
||||
|
||||
const { fetchData: getDesc } = mppurchaser()
|
||||
const getInfo = async () => {
|
||||
Taro.showLoading({
|
||||
@@ -69,6 +77,7 @@ export default () => {
|
||||
addressName: res.data?.province_name + res.data?.city_name + res.data?.district_name,
|
||||
address_detail: res.data?.address_detail,
|
||||
purchaser_type: res.data?.purchaser_type,
|
||||
district_id: res.data?.district_id
|
||||
// remark: res.data?.remark
|
||||
})
|
||||
Taro.hideLoading()
|
||||
@@ -100,17 +109,17 @@ export default () => {
|
||||
//客户类型数组
|
||||
const [list, setlist] = useState<any[]>([
|
||||
{
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: '布行',
|
||||
check: false
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
id: 2,
|
||||
name: '二批',
|
||||
check: false
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
id: 3,
|
||||
name: '制衣厂',
|
||||
check: false
|
||||
},
|
||||
@@ -147,7 +156,7 @@ export default () => {
|
||||
})
|
||||
if (ev.length === 3) {
|
||||
setShowSiteModal(false)
|
||||
setformData((val) => ({ ...val, addressName: ev[0]?.name + ev[1]?.name + ev[2]?.name || '', }))
|
||||
setformData((val) => ({ ...val, addressName: ev[0]?.name + ev[1]?.name + ev[2]?.name || '', district_id: ev[2]?.id }))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,10 +167,8 @@ export default () => {
|
||||
const isDisabled = useMemo(() => {
|
||||
let empty: any = null;
|
||||
if (typeof (formData) == 'undefined') return
|
||||
console.log(formData, 12313)
|
||||
for (const key in formData) {
|
||||
if (formData.hasOwnProperty(key)) {
|
||||
console.log('formData[key]=>', formData[key])
|
||||
if (formData[key] !== '' && typeof (formData[key]) !== 'undefined') {
|
||||
empty = false
|
||||
} else {
|
||||
@@ -170,7 +177,6 @@ export default () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(empty, 1111)
|
||||
return empty;
|
||||
}, [formData])
|
||||
|
||||
@@ -188,6 +194,7 @@ export default () => {
|
||||
address_detail: '',
|
||||
purchaser_type: '',
|
||||
remark: '',
|
||||
district_id: ''
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,8 @@ interface Props {
|
||||
|
||||
export default memo((props: Props) => {
|
||||
|
||||
const handPhone = () => {
|
||||
const handPhone = (e) => {
|
||||
e.stopPropagation()
|
||||
Taro.makePhoneCall({
|
||||
phoneNumber: props.obj?.phone
|
||||
})
|
||||
@@ -28,27 +29,27 @@ export default memo((props: Props) => {
|
||||
<View className={styles.mainItem} onClick={() => handNav()}>
|
||||
<View className={styles.itemTop}>
|
||||
<View className={styles.itemLeft}>
|
||||
<View className={styles.itemCile}>欧</View>
|
||||
<View className={styles.itemCile}>{props.obj.name[0]}</View>
|
||||
<View className={styles.item_top_one}>
|
||||
<View className={styles.item_top_one_flex}>
|
||||
<View className={styles.itemName}>欧阳斌峰</View>
|
||||
<View className={styles.itemPhone}>133****7761</View>
|
||||
<View className={styles.itemName}>{props.obj.name}</View>
|
||||
<View className={styles.itemPhone}>{props.obj.phone}</View>
|
||||
</View>
|
||||
<View className={styles.item_tag_box}>
|
||||
<View className={styles.item_tagItem}>二批</View>
|
||||
<View className={styles.item_tagItem}>二批</View>
|
||||
<View className={styles.item_tagItem}>{props.obj.sale_user_name}</View>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.itemRight} onClick={() => handPhone()}>
|
||||
<IconFont name={'icon-dizhi'} size={30} color={'#5C5C66'}></IconFont>
|
||||
<View className={styles.itemRight} onClick={(e) => handPhone(e)}>
|
||||
<IconFont name={'icon-dianhua'} size={30} color={'#337FFF'}></IconFont>
|
||||
<View className={styles.phoneFont}>联系TA</View>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.line}></View>
|
||||
<View className={styles.flex_bottom}>
|
||||
<View className={styles.flex_left}>广东省广州市海珠区</View>
|
||||
<View className={styles.flex_right}>更新时间:2022-09-20 17:10</View>
|
||||
<View className={styles.flex_left}>{props.obj.default_address.province_name + props.obj.default_address.city_name + props.obj.default_address.district_name}</View>
|
||||
<View className={styles.flex_right}>更新时间:{formatDateTime(props.obj.recent_order_time)}</View>
|
||||
</View>
|
||||
</View >
|
||||
)
|
||||
|
||||
@@ -15,7 +15,7 @@ import Search from '@/components/search'
|
||||
import ItemLiist from "./components/ItemList"
|
||||
import InfiniteScroll from '@/components/infiniteScroll'
|
||||
import { ClientListApi } from '@/api/order'
|
||||
|
||||
import { goLink } from '@/common/common'
|
||||
export default () => {
|
||||
|
||||
const [searchField, setSearchField] = useState<{ page: number; size: number; order_no: string }>({
|
||||
@@ -42,9 +42,9 @@ export default () => {
|
||||
|
||||
//输入了搜索关键字
|
||||
const getSearchData = useCallback((e) => {
|
||||
// pageNum.current.page = 1
|
||||
// setOrderData(() => ({ list: [], total: 0 }))
|
||||
// setSearchField((val) => ({ ...val, order_no: e, size: 10 }))
|
||||
pageNum.current.page = 1
|
||||
setOrderData(() => ({ list: [], total: 0 }))
|
||||
setSearchField((val) => ({ ...val, order_no: e, size: 10 }))
|
||||
}, [])
|
||||
|
||||
//数据加载状态
|
||||
@@ -92,7 +92,7 @@ export default () => {
|
||||
<Tag></Tag>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.totalFont}>共 36 个客户</View>
|
||||
<View className={styles.totalFont}>共 {orderData?.total || 0} 个客户</View>
|
||||
<View className={styles.order_list}>
|
||||
<InfiniteScroll
|
||||
statusMore={statusMore}
|
||||
@@ -108,7 +108,7 @@ export default () => {
|
||||
</InfiniteScroll>
|
||||
</View>
|
||||
<View className={styles.bottom_box}>
|
||||
<View className={styles.bottom_btn}>新建用户</View>
|
||||
<View className={styles.bottom_btn} onClick={() => goLink('/pages/customerEditor/index?type=add')}>新建用户</View>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
|
||||
+38
-11
@@ -14,11 +14,28 @@ import { dataLoadingStatus } from '@/common/util'
|
||||
import Taro, { useDidShow } from '@tarojs/taro'
|
||||
import { getFilterData } from '@/common/util'
|
||||
import userInfo from '@/reducers/userInfo'
|
||||
import { ClientListApi } from '@/api/order'
|
||||
export default () => {
|
||||
|
||||
useEffect(() => {
|
||||
categoryList()
|
||||
getClient()
|
||||
}, [])
|
||||
|
||||
//获取客户
|
||||
const [clienList, setclienList] = useState<any[]>([])
|
||||
const { fetchData: listFetchData } = ClientListApi()
|
||||
const getClient = async () => {
|
||||
const res = await listFetchData({
|
||||
page: 1, size: 10
|
||||
})
|
||||
setclientObj({
|
||||
clientId: res.data.list.length > 0 ? res.data.list[0]?.id : -1,
|
||||
clientName: res.data.list.length > 0 ? res.data.list[0]?.name : '',
|
||||
})
|
||||
setclienList([...res.data.list])
|
||||
}
|
||||
|
||||
//获取面料种类
|
||||
const [kindData, setKindData] = useState<any>({ list: [], defaultId: 0 })
|
||||
const { fetchData } = kindListApi()
|
||||
@@ -107,7 +124,6 @@ export default () => {
|
||||
const [goodObj, setGoodsobj] = useState({})
|
||||
//点击对应商品显示购物车
|
||||
const showCart = async (item) => {
|
||||
console.log(item, 6666)
|
||||
setSearchObj((e) => ({ ...e, goodsId: item.id }))
|
||||
setShowShopCart(true)
|
||||
setGoodsobj(item)
|
||||
@@ -200,16 +216,7 @@ export default () => {
|
||||
clientId: -1,
|
||||
clientName: ''
|
||||
})
|
||||
useDidShow(() => {
|
||||
|
||||
//获取选择的客户
|
||||
let pages = Taro.getCurrentPages();
|
||||
let currPage = pages[pages.length - 1]; // 获取当前页面
|
||||
setclientObj({
|
||||
clientId: currPage.data?.clientId,
|
||||
clientName: currPage.data?.clientName,
|
||||
})
|
||||
})
|
||||
|
||||
//加入购物车
|
||||
const { fetchData: preViewFetch, } = mpshoppingCartproductColorlist()
|
||||
@@ -289,9 +296,29 @@ export default () => {
|
||||
|
||||
useEffect(() => {
|
||||
setGoodlist(goodList)
|
||||
console.log(goodList, 'goodListgoodList')
|
||||
}, [goodList])
|
||||
|
||||
|
||||
useDidShow(() => {
|
||||
//获取选择的客户
|
||||
let pages = Taro.getCurrentPages();
|
||||
let currPage = pages[pages.length - 1]; // 获取当前页面
|
||||
//判断是否有跳转选择客户
|
||||
if (currPage.data?.clientId && currPage.data?.clientId !== '') {
|
||||
setclientObj({
|
||||
clientId: currPage.data?.clientId,
|
||||
clientName: currPage.data?.clientName,
|
||||
})
|
||||
}
|
||||
//默认客户
|
||||
if (currPage.data?.clientId == null) {
|
||||
setclientObj({
|
||||
clientId: clienList.length > 0 ? clienList[0]?.id : - 1,
|
||||
clientName: clienList.length > 0 ? clienList[0]?.name : '',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
// <MoveBtn onClick={() => setShowShopCart(showShopCart)}>
|
||||
<View className={styles.main}>
|
||||
|
||||
@@ -16,25 +16,52 @@ import {
|
||||
mpsearchHistory
|
||||
} from "@/api/order"
|
||||
import { getFilterData } from '@/common/util'
|
||||
|
||||
import { ClientListApi } from '@/api/order'
|
||||
|
||||
export default memo(() => {
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
getClient()
|
||||
}, [])
|
||||
|
||||
const [clientObj, setclientObj] = useState({
|
||||
clientId: -1,
|
||||
clientName: ''
|
||||
})
|
||||
useDidShow(() => {
|
||||
|
||||
//获取客户
|
||||
const [clienList, setclienList] = useState<any[]>([])
|
||||
const { fetchData: listFetchData } = ClientListApi()
|
||||
const getClient = async () => {
|
||||
const res = await listFetchData({
|
||||
page: 1, size: 10
|
||||
})
|
||||
setclientObj({
|
||||
clientId: res.data.list.length > 0 ? res.data.list[0]?.id : -1,
|
||||
clientName: res.data.list.length > 0 ? res.data.list[0]?.name : '',
|
||||
})
|
||||
setclienList([...res.data.list])
|
||||
}
|
||||
|
||||
useDidShow(() => {
|
||||
//获取选择的客户
|
||||
let pages = Taro.getCurrentPages();
|
||||
let currPage = pages[pages.length - 1]; // 获取当前页面
|
||||
setclientObj({
|
||||
clientId: currPage.data?.clientId,
|
||||
clientName: currPage.data?.clientName,
|
||||
})
|
||||
//判断是否有跳转选择客户
|
||||
if (currPage.data?.clientId && currPage.data?.clientId !== '') {
|
||||
setclientObj({
|
||||
clientId: currPage.data?.clientId,
|
||||
clientName: currPage.data?.clientName,
|
||||
})
|
||||
}
|
||||
//默认客户
|
||||
if (currPage.data?.clientId == null) {
|
||||
setclientObj({
|
||||
clientId: clienList.length > 0 ? clienList[0]?.id : - 1,
|
||||
clientName: clienList.length > 0 ? clienList[0]?.name : '',
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -298,6 +325,9 @@ export default memo(() => {
|
||||
setGoodlist([...goodList])
|
||||
}
|
||||
|
||||
//选择中后的值到输入框
|
||||
const [defaultvalue, setdefaultvalue] = useState('')
|
||||
|
||||
//点击关键字搜索内容
|
||||
const handItem = (item) => {
|
||||
Taro.showLoading({
|
||||
@@ -311,6 +341,7 @@ export default memo(() => {
|
||||
Taro.hideLoading()
|
||||
}
|
||||
})
|
||||
setdefaultvalue(item.search_key)
|
||||
}
|
||||
//点击返回文字
|
||||
const handBack = () => {
|
||||
@@ -319,7 +350,7 @@ export default memo(() => {
|
||||
}
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<Search placeholder='请输入搜索布料' showBtn={false} changeOnSearch={getSearchData} debounceTime={300} >
|
||||
<Search placeholder='请输入搜索布料' defaultValue={defaultvalue} showBtn={false} changeOnSearch={getSearchData} debounceTime={300} >
|
||||
<View className={styles.cancelFont} onClick={() => back()}>取消</View>
|
||||
</Search>
|
||||
<View className={styles.line}></View>
|
||||
|
||||
Reference in New Issue
Block a user