feat:客户管理70%

This commit is contained in:
Haiyi 2022-10-25 17:39:37 +08:00
parent 9764f9f1bc
commit bc9e43f8ea
11 changed files with 270 additions and 122 deletions

View File

@ -1,5 +1,5 @@
{
"symbol_url": "http//at.alicdn.com/t/c/font_3619513_j3kxbij3zac.js",
"symbol_url": "http://at.alicdn.com/t/c/font_3619513_kvbg4xjpk7.js",
"save_dir": "./src/components/iconfont",
"trim_icon_prefix": "",
"default_icon_size": 36,

View File

@ -183,6 +183,13 @@
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/customerDetails/index",
"query": "purchaser_id=1674",
"launchMode": "default",
"scene": null
}
]
}

View File

@ -2,16 +2,20 @@
height: 100%;
box-sizing: border-box;
position: relative;
scroll-view {
height: 100%;
box-sizing: border-box;
}
.address-scroll-view-content {
padding-bottom: 300px;
}
.address-list {
width: 704px;
height: 156px;
padding-bottom: 24px;
// height: 156px;
background: #ffffff;
border-radius: 20px;
box-shadow: 2px 4px 12px 0px rgba(0, 0, 0, 0.16);
@ -21,24 +25,30 @@
border: 1px solid #ffffff;
border: 1px solid rgba(0, 0, 0, 0.16);
}
.address-active {
border: 1px solid #68b4ff;
box-shadow: 0px 0px 10px 0px rgba(0, 122, 255, 0.27);
}
.address-list:first-child {
margin-top: 0;
}
.address-list-last {
margin-bottom: 300px;
}
.address-user {
font-size: 28px;
font-family: Microsoft YaHei, Microsoft YaHei-Bold;
font-weight: 700;
text-align: left;
color: #000000;
display: flex;align-items: center;
display: flex;
align-items: center;
}
.address-list-default {
width: 58px;
height: 28px;
@ -51,35 +61,44 @@
margin-left: 30px;
}
.address-list-phone {
font-size: 24px;
font-size: 28px;
font-weight: 400;
color: #ababab;
margin-left: 30px;
color: #000000;
margin-left: 16px;
margin-right: 16px;
}
.address-edit {
padding: 10px;
}
.address-edit .icon-bianji {
font-size: 40px;
}
.address-list-info {
font-size: 24px;
font-size: 28px;
font-weight: 400;
color: #3c3c3c;
color: #000000;
display: flex;
width: 100%;
width: 557px;
}
.address-list-info view {
max-width: 60%;
text-overflow: ellipsis;
overflow: hidden;white-space: nowrap;
max-width: 557px;
// text-overflow: ellipsis;
// overflow: hidden;
// white-space: nowrap;
}
.address-list-bottom {
display: flex;justify-content: space-between;
display: flex;
justify-content: space-between;
margin-top: 18px;
}
.add-address {
width: 668px;
height: 82px;
@ -88,10 +107,15 @@
font-size: 32px;
font-weight: 400;
color: #ffffff;
display: flex;align-items: center;justify-content: center;
position: absolute;bottom: 100px;left: 50%;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
bottom: 100px;
left: 50%;
transform: translateX(-50%);
}
.address-no-data {
font-size: 24px;
font-weight: 400;
@ -101,4 +125,19 @@
padding-top: 40%;
box-sizing: border-box;
}
.line {
margin-top: 16px;
width: 100%;
height: 1px;
background: #000000;
opacity: 0.1;
}
.bottom-font {
margin-top: 16px;
font-size: 28px;
font-weight: 400;
color: #000000;
}
}

View File

@ -1,6 +1,6 @@
import { Button, Navigator, ScrollView, Text, View } from "@tarojs/components"
import { memo, useEffect, useState } from "react"
import { memo, useEffect, useState, forwardRef, useImperativeHandle } from "react"
import "./index.scss"
import { mppurchaseraddresslist } from "@/api/addressList"
import { alert } from "@/common/common"
@ -18,7 +18,10 @@ interface Params {
}
// 地址列表
const AddressList = memo((props: Params) => {
const AddressList = memo(forwardRef((props: Params, AddressListRef) => {
const { addButtonEnabled = true, focusBorderEnabled = false } = props;
const { fetchData, state } = mppurchaseraddresslist()
// 获取数据
@ -36,14 +39,14 @@ const AddressList = memo((props: Params) => {
})
}
}
useEffect(() => {
useDidShow(() => {
getData();
// 监听刷新
Taro.eventCenter.on("addressList:refresh", getData);
return () => {
Taro.eventCenter.off("addressList:refresh", getData);
}
}, [])
})
// 处理刷新
const [refreshState, setRefreshState] = useState(false);
const handleRefresh = async () => {
@ -100,6 +103,10 @@ const AddressList = memo((props: Params) => {
}
}
useImperativeHandle(AddressListRef, () => ({
getData
}))
return (
<View className="address-scroll-view">
<ScrollView scrollY refresherEnabled={props.refresherEnabled} enhanced refresherTriggered={refreshState} onRefresherRefresh={handleRefresh}>
@ -113,25 +120,28 @@ const AddressList = memo((props: Params) => {
<View onClick={() => handleSelect(item, index)} className={`address-list ${focusId == item.id && 'address-active'}`}>
<View className="address-user">
{item.name}
<Text className="address-list-phone">{item.phone}</Text>
{
item.is_default ? <Text className="address-list-default"></Text> :
<Text className="address-list-phone">{item.phone.replace(item.phone.substring(3, 7), "****")}</Text>
item.is_default && <Text className="address-list-default"></Text>
}
</View>
<View className="address-list-bottom">
<View className="address-list-info">
<View>{item.province_name + item.city_name + item.district_name}
<View>{item.province_name + item.city_name + item.district_name + item.address_detail}
{/* {item.address_detail} */}
</View>
{
{/* {
item.is_default && <Text className="address-list-phone">{item.phone.replace(item.phone.substring(3, 7), "****")}</Text>
}
} */}
</View>
<Navigator onClick={e => e.stopPropagation()} url={`/pages/addAddress/index?type=edit&id=${item.id}&&purchaser_id=${Number(props.purchaser_id)}`} hoverClass="none" className="address-edit">
{/* <Text className="iconfont icon-bianji"></Text> */}
<IconFont name={'icon-bianji'} size={40} ></IconFont>
</Navigator>
</View>
<View className='line'></View>
<View className='bottom-font'></View>
</View>
);
}) :
@ -142,6 +152,6 @@ const AddressList = memo((props: Params) => {
{addButtonEnabled && <Navigator url={`/pages/addAddress/index?type=add&purchaser_id=${Number(props.purchaser_id)}`} hoverClass="none" className="add-address"></Navigator>}
</View>
)
})
}))
export default AddressList;

View File

@ -24,7 +24,7 @@ function hex2rgb(hex) {
return "rgb(" + rgb.join(",") + ")";
}
export type IconNames = 'icon-zhankai1' | 'icon-shouqi1' | 'icon-shouhou1' | 'icon-cangku1' | 'icon-saoma' | 'icon-dizhi1' | 'icon-huodaofukuan' | 'icon-yufukuan1' | 'icon-yue' | 'icon-zidingyi' | 'icon-jinetiaozheng' | 'icon-tuikuan1' | 'icon-zhankai' | 'icon-shouqi' | 'icon-lujing' | 'icon-jizhumima' | 'icon-a-jizhumima' | 'icon-weixindenglu' | 'icon-kehuxinxi' | 'icon-yewuyuanqizi' | 'icon-chakanquanbukehu' | 'icon-biyan' | 'icon-bianji' | 'icon-daikuan' | 'icon-cangku' | 'icon-guanlidingdan' | 'icon-mima' | 'icon-guanbi' | 'icon-jianshao' | 'icon-dingwei' | 'icon-saomiao' | 'icon-peihuo' | 'icon-shaixuan' | 'icon-paiming' | 'icon-shanchusousuoxinxi' | 'icon-shijian' | 'icon-sousuo' | 'icon-shouhou' | 'icon-sousuofanhui' | 'icon-sousuoshanchu' | 'icon-tuikuan' | 'icon-tishi' | 'icon-xianxiahuizong' | 'icon-xinzeng' | 'icon-yonghuming' | 'icon-yanjing' | 'icon-yufukuan' | 'icon-wodekefu' | 'icon-dizhi' | 'icon-shouhouzhongxin' | 'icon-wodeshoucang' | 'icon-shoukuanliebiao' | 'icon-madanguanli' | 'icon-qusechazhao' | 'icon-pandiansaoma' | 'icon-yaoqingma' | 'icon-duizhang' | 'icon-tihuoliebiao' | 'icon-yangpinduibi' | 'icon-yansequyang' | 'icon-fahuoliebiao' | 'icon-yuncangkucun' | 'icon-xiaoshou' | 'icon-qianzhicangkucun' | 'icon-lingquseka' | 'icon-gouwu1' | 'icon-dingdan1' | 'icon-gerenzhongxin1' | 'icon-shouye1' | 'icon-gerenzhongxin' | 'icon-dingdan' | 'icon-shouye' | 'icon-gouwu';
export type IconNames = 'icon-dianhua' | 'icon-peibu' | 'icon-zhankai1' | 'icon-shouqi1' | 'icon-shouhou1' | 'icon-cangku1' | 'icon-saoma' | 'icon-dizhi1' | 'icon-huodaofukuan' | 'icon-yufukuan1' | 'icon-yue' | 'icon-zidingyi' | 'icon-jinetiaozheng' | 'icon-tuikuan1' | 'icon-zhankai' | 'icon-shouqi' | 'icon-lujing' | 'icon-jizhumima' | 'icon-a-jizhumima' | 'icon-weixindenglu' | 'icon-kehuxinxi' | 'icon-yewuyuanqizi' | 'icon-chakanquanbukehu' | 'icon-biyan' | 'icon-bianji' | 'icon-daikuan' | 'icon-cangku' | 'icon-guanlidingdan' | 'icon-mima' | 'icon-guanbi' | 'icon-jianshao' | 'icon-dingwei' | 'icon-saomiao' | 'icon-peihuo' | 'icon-shaixuan' | 'icon-paiming' | 'icon-shanchusousuoxinxi' | 'icon-shijian' | 'icon-sousuo' | 'icon-shouhou' | 'icon-sousuofanhui' | 'icon-sousuoshanchu' | 'icon-tuikuan' | 'icon-tishi' | 'icon-xianxiahuizong' | 'icon-xinzeng' | 'icon-yonghuming' | 'icon-yanjing' | 'icon-yufukuan' | 'icon-wodekefu' | 'icon-dizhi' | 'icon-shouhouzhongxin' | 'icon-wodeshoucang' | 'icon-shoukuanliebiao' | 'icon-madanguanli' | 'icon-qusechazhao' | 'icon-pandiansaoma' | 'icon-yaoqingma' | 'icon-duizhang' | 'icon-tihuoliebiao' | 'icon-yangpinduibi' | 'icon-yansequyang' | 'icon-fahuoliebiao' | 'icon-yuncangkucun' | 'icon-xiaoshou' | 'icon-qianzhicangkucun' | 'icon-lingquseka' | 'icon-gouwu1' | 'icon-dingdan1' | 'icon-gerenzhongxin1' | 'icon-shouye1' | 'icon-gerenzhongxin' | 'icon-dingdan' | 'icon-shouye' | 'icon-gouwu';
type PropsType = {
name: IconNames;
@ -82,6 +82,12 @@ const IconFont:FC<PropsType> = ({
className={classnames(icon, customClassName)}
/>
)} */}
{/* icon-dianhua */}
{ name === 'icon-dianhua' && (<View style={{backgroundImage: `url(${quot}data:image/svg+xml, %3Csvg viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='${svgSize}px' height='${svgSize}px'%3E%3Cpath d='M938.461867 771.925333a59.255467 59.255467 0 0 1 0 83.694934l-41.847467 41.847466c-30.9248 30.9248-71.611733 49.7664-120.9344 55.978667a293.410133 293.410133 0 0 1-36.864 2.286933c-35.84 0-74.581333-6.075733-115.541333-18.090666-111.274667-32.699733-228.2496-106.461867-329.352534-207.5648-101.102933-101.137067-174.865067-218.112-207.530666-329.352534-16.2816-55.3984-21.640533-106.7008-15.872-152.405333 6.2464-49.288533 25.088-89.975467 55.978666-120.900267l41.8816-41.847466a59.255467 59.255467 0 0 1 83.694934 0l184.149333 184.149333a59.255467 59.255467 0 0 1 0 83.694933l-41.847467 41.847467c-23.688533 23.6544-0.1024 100.352 66.9696 167.389867 67.072 67.072 143.701333 90.658133 167.389867 66.9696l41.8816-41.847467a59.255467 59.255467 0 0 1 83.694933 0l184.149334 184.149333z' fill='${(isStr ? colors : colors?.[0]) || 'rgb(69,129,255)'}' /%3E%3C/svg%3E${quot})`, width: `${svgSize}px`, height: `${svgSize}px`, ...customStyle}} className={classnames("icon", customClassName)} />) }
{/* icon-peibu */}
{ name === 'icon-peibu' && (<View style={{backgroundImage: `url(${quot}data:image/svg+xml, %3Csvg viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='${svgSize}px' height='${svgSize}px'%3E%3Cpath d='M336 96c77.504 0 142.144 55.12 156.864 128.288L492.8 224H832a80 80 0 0 1 80 80v544a80 80 0 0 1-80 80H384a80.16 80.16 0 0 1-19.84-2.48l1.072-0.192c-8.048 1.488-16.32 2.384-24.752 2.608L336 928h-64c-88.368 0-160-71.632-160-160V256c0-88.368 71.632-160 160-160h64z m160 191.984V768c0 35.952-11.84 69.12-31.872 95.84L464 864h368a16 16 0 0 0 15.888-14.128L848 848V304a16 16 0 0 0-14.128-15.888L832 288l-336-0.016zM336 672h-64a96 96 0 0 0-3.6 191.936L272 864h64a96 96 0 0 0 3.6-191.936L336 672z m0-512h-64a96 96 0 0 0-95.936 92.4L176 256v384a159.296 159.296 0 0 1 96-32h64c36.032 0 69.28 11.904 96 32V256a96 96 0 0 0-92.4-95.936L336 160z' fill='${(isStr ? colors : colors?.[0]) || 'rgb(0,0,0)'}' /%3E%3C/svg%3E${quot})`, width: `${svgSize}px`, height: `${svgSize}px`, ...customStyle}} className={classnames("icon", customClassName)} />) }
{/* icon-zhankai1 */}
{ name === 'icon-zhankai1' && (<View style={{backgroundImage: `url(${quot}data:image/svg+xml, %3Csvg viewBox='0 0 1489 1024' xmlns='http://www.w3.org/2000/svg' width='${svgSize}px' height='${svgSize}px'%3E%3Cpath d='M744.727273 954.181818L1442.909091 46.545455H46.545455z' fill='${(isStr ? colors : colors?.[0]) || 'rgb(51,51,51)'}' /%3E%3C/svg%3E${quot})`, width: `${svgSize}px`, height: `${svgSize}px`, ...customStyle}} className={classnames("icon", customClassName)} />) }

View File

@ -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>

View File

@ -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: ''
})
}

View File

@ -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 >
)

View File

@ -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>
)

View File

@ -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}>

View File

@ -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]; // 获取当前页面
//判断是否有跳转选择客户
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>