Commit 74e9ec7b authored by GuanHua's avatar GuanHua

feat:搜索商品列表接口修改

parent 115fcb15
......@@ -10,16 +10,16 @@ interface dataListType {
}
interface InfoListProps {
data: dataListType[]
options: dataListType[]
}
const InfoList: React.FC<InfoListProps> = (props) => {
const { data = [] } = props
const { options = [] } = props
return (
<div className={styles.info_list}>
{
data && data.map((item, index) => (
options && options.map((item, index) => (
<div className={styles.info_list_line} key={`info_list_line_${index}`}>
<div className={cx(styles.info_list_line_label, item.labelClassName ? item.labelClassName : "")}>{item.label}{item.required && <i className={styles.required}>*</i>}</div>
<div className={styles.info_list_line_value}>{item.value}</div>
......
import React from 'react'
import { Input } from 'antd'
import { FormInstance } from 'antd/lib/form'
import InfoList from '../../../../components/InfoList'
interface BasicInfoProps {
form: FormInstance
}
const BasicInfo: React.FC<BasicInfoProps> = (props) => {
const { form } = props
let detailList = [
{
label: '申请单摘要',
......@@ -38,7 +39,7 @@ const BasicInfo: React.FC<BasicInfoProps> = (props) => {
return (
<div>
<InfoList data={detailList} />
<InfoList options={detailList} />
</div>
)
}
......
......@@ -128,7 +128,7 @@ const ProofFile: React.FC<ProofFilePropsType> = (props) => {
return (
<div>
<InfoList data={detailList} />
<InfoList options={detailList} />
</div>
)
}
......
import React from 'react'
import InfoList from '../../../../components/InfoList'
import styles from './index.less'
interface ReplaceAddressPropsType {
}
const ReplaceAddress: React.FC<ReplaceAddressPropsType> = (props) => {
let detailList = [
{
label: '换货收货地址',
labelClassName: styles.flexStart,
value: <>
133
</>,
},
]
return (
<div>
<InfoList options={detailList} />
</div>
)
}
export default ReplaceAddress
import React from 'react'
interface AddressPropsType {
interface ReturnAddressPropsType {
}
const Address: React.FC<AddressPropsType> = (props) => {
const ReturnAddress: React.FC<ReturnAddressPropsType> = (props) => {
return (
<div>
......@@ -13,4 +13,4 @@ const Address: React.FC<AddressPropsType> = (props) => {
)
}
export default Address
export default ReturnAddress
import React, { useState } from 'react'
import React, { useState, useEffect } from 'react'
import { SaveOutlined } from '@ant-design/icons'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { history, Helmet } from 'umi'
import { Button, Tabs } from 'antd'
import { Button, Tabs, Form } from 'antd'
import ReutrnEle from '@/components/ReturnEle'
import BasicInfo from './components/basicInfo'
import ExchangeGoods from './components/exchangeGoods'
import ProofFile from './components/proofFile'
import Log from './components/log'
import Address from './components/address'
import ReplaceAddress from './components/replaceAddress'
import ReturnAddress from './components/returnAddress'
import styles from './detail.less'
interface OrderDetailProps {
......@@ -19,8 +20,21 @@ interface OrderDetailProps {
const { TabPane } = Tabs
const OrderDetail: React.FC<OrderDetailProps> = (props) => {
const { type } = props.match.params
const { location } = props
const [form] = Form.useForm()
const [type, setType] = useState<'add' | 'edit' | 'detail'>()
const [btnLoading, setBtnLoading] = useState<boolean>(false)
const [tabActiveKey, setTabActiveKey] = useState<string>('replaceAddress')
useEffect(() => {
getPathNameType(location.pathname)
}, [])
const getPathNameType = (pathname) => {
let typeArr = pathname.split('/')
let result = typeArr[typeArr.length - 1]
setType(result)
}
const getPageTitle = () => {
switch (type) {
......@@ -35,6 +49,11 @@ const OrderDetail: React.FC<OrderDetailProps> = (props) => {
}
}
const handleSave = () => {
}
return (
<>
<Helmet>
......@@ -44,16 +63,16 @@ const OrderDetail: React.FC<OrderDetailProps> = (props) => {
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={getPageTitle()}
extra={[
<Button key="1" onClick={() => { }} loading={btnLoading} type="primary" icon={<SaveOutlined />}>
extra={type !== 'detail' ? [
<Button key="1" onClick={() => handleSave()} loading={btnLoading} type="primary" icon={<SaveOutlined />}>
保存
</Button>,
]}
] : []}
>
<div className={styles.detail_wrap}>
<Tabs type="card" defaultActiveKey="proofFile" className={styles.detail_tabs}>
<Tabs type="card" activeKey={tabActiveKey} onChange={(key) => setTabActiveKey(key)} className={styles.detail_tabs}>
<TabPane tab="基本信息" key="basicInfo">
<BasicInfo />
<BasicInfo form={form} />
</TabPane>
<TabPane tab="换货商品" key="exchangeGoods">
<ExchangeGoods />
......@@ -61,8 +80,11 @@ const OrderDetail: React.FC<OrderDetailProps> = (props) => {
<TabPane tab="举证附件" key="proofFile">
<ProofFile />
</TabPane>
<TabPane tab="换货收货地址" key="address">
<Address />
<TabPane tab="退货收货地址" key="returnAddress">
<ReturnAddress />
</TabPane>
<TabPane tab="换货收货地址" key="replaceAddress">
<ReplaceAddress />
</TabPane>
<TabPane tab="流转记录" key="log">
<Log />
......
......@@ -4,7 +4,7 @@ import Filter from '../components/Filter'
import { FILTER_TYPE } from '@/constants'
import cx from 'classnames'
import { history } from 'umi'
import { Pagination } from 'antd'
import { Pagination, message } from 'antd'
import CommodityList from './list'
import SearchNoResult from '../components/SearchNoResult'
import isEmpty from 'lodash/isEmpty'
......@@ -13,7 +13,7 @@ import { store } from '@/store'
import { PublicApi } from '@/services/api'
import { LAYOUT_TYPE } from '@/constants'
import { useLocalStore, observer } from 'mobx-react'
import { GetSearchShopEnterpriseGetCommodityListResponseDetail } from '@/services/SearchApi'
import { PostSearchShopEnterpriseGetCommodityListResponseDetail } from '@/services/SearchApi'
import arrowDownIcon from '@/assets/imgs/arrow_down.png'
import arrowDownActiveIcon from '@/assets/imgs/arrow_down_active.png'
import styles from './index.less'
......@@ -52,7 +52,7 @@ const CommoditySearch: React.FC<CommodityPropsType> = (props) => {
const { query: { search = "" } } = props.location
const [loading, setLoading] = useState<boolean>(true)
const [showType, setShowType] = useState<number>(1) // 展示方式:1:矩阵排列; 2:列表排列
const [commodityList, setCommodityList] = useState<GetSearchShopEnterpriseGetCommodityListResponseDetail[]>([])
const [commodityList, setCommodityList] = useState<PostSearchShopEnterpriseGetCommodityListResponseDetail[]>([])
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(20)
const [totalCount, setTotalCount] = useState<number>(0)
......@@ -98,19 +98,19 @@ const CommoditySearch: React.FC<CommodityPropsType> = (props) => {
let getFn;
switch (layoutType) {
case LAYOUT_TYPE.mall:
getFn = PublicApi.getSearchShopEnterpriseGetCommodityList
getFn = PublicApi.postSearchShopEnterpriseGetCommodityList
break
case LAYOUT_TYPE.shop:
param.storeId = shopId
getFn = PublicApi.getSearchShopStoreGetCommodityList
getFn = PublicApi.postSearchShopStoreGetCommodityList
break
case LAYOUT_TYPE.channel:
param.channelMemberId = memberId
getFn = PublicApi.getSearchShopChannelGetCommodityList
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
param.channelMemberId = memberId
getFn = PublicApi.getSearchShopChannelGetCommodityList
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
}
......@@ -118,6 +118,7 @@ const CommoditySearch: React.FC<CommodityPropsType> = (props) => {
getFn && getFn(param).then(res => {
setLoading(false)
if (res.code === 1000) {
message.destroy()
setCommodityList(res.data.data)
setTotalCount(res.data.totalCount)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment