Commit 8c6185f6 authored by GuanHua's avatar GuanHua

fix: 询价商品处理商城跳转过来的数据

parent 9e8988e6
import React, { useEffect, useState } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import Commodity from './commodity'
import Infomation from './information'
import Shops from './shops'
import { Tabs } from 'antd'
import styles from './index.less'
const { TabPane } = Tabs
interface CollectionPropsType {
location: any
}
const Collection: React.FC<CollectionPropsType> = (props) => {
const { query: { type } } = props.location
const [tabKey, setTabKey] = useState<string>("commodity")
useEffect(() => {
if (type) {
setTabKey(type)
}
}, [type])
const handleChange = (key) => {
setTabKey(key)
}
return (
<PageHeaderWrapper>
<div className={styles.collection_wrap}>
<Tabs activeKey={tabKey} className={styles.collection_tabs} onChange={handleChange} >
<TabPane tab="商品收藏" key="commodity">
<Commodity />
</TabPane>
<TabPane tab="店铺收藏" key="shops">
<Shops />
</TabPane>
<TabPane tab="资讯收藏" key="information">
<Infomation />
</TabPane>
</Tabs>
</div>
</PageHeaderWrapper>
)
}
export default Collection
\ No newline at end of file
import React, { useEffect, useState } from 'react'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import Commodity from './commodity'
import Infomation from './information'
import Shops from './shops'
import Purchase from './purchase'
import Logistics from './logistics'
import Process from './process'
import { Tabs } from 'antd'
import styles from './index.less'
const { TabPane } = Tabs
interface CollectionPropsType {
location: any
}
const Collection: React.FC<CollectionPropsType> = (props) => {
const { query: { type } } = props.location
const [tabKey, setTabKey] = useState<string>("commodity")
useEffect(() => {
if (type) {
setTabKey(type)
}
}, [type])
const handleChange = (key) => {
setTabKey(key)
}
return (
<PageHeaderWrapper>
<div className={styles.collection_wrap}>
<Tabs activeKey={tabKey} className={styles.collection_tabs} onChange={handleChange} >
<TabPane tab="商品收藏" key="commodity">
<Commodity />
</TabPane>
<TabPane tab="店铺收藏" key="shops">
<Shops />
</TabPane>
<TabPane tab="资讯收藏" key="information">
<Infomation />
</TabPane>
<TabPane tab="门户收藏" key="srm">
<Purchase />
</TabPane>
<TabPane tab="物流商收藏" key="logistics">
<Logistics />
</TabPane>
<TabPane tab="加工商收藏" key="manufacture">
<Process />
</TabPane>
</Tabs>
</div>
</PageHeaderWrapper>
)
}
export default Collection
import React, { useEffect, useState } from 'react'
import cx from 'classnames'
import { Pagination, message, Modal } from 'antd'
import { StarFilled } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
import { LOGISTICS_CENTER_URL } from '@/constants'
import moment from 'moment'
import styles from './index.less'
const Logistics: React.FC = () => {
const [list, setList] = useState([])
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
const [totalCount, setTotalCount] = useState<number>(0)
useEffect(() => {
fetchCollectList()
}, [current])
/**
* 获取收藏的资讯列表
*/
const fetchCollectList = () => {
const param: any = {
current,
pageSize
}
PublicApi.getTemplateWebMemberLogisticsWebCollectList(param).then(res => {
if (res.code === 1000) {
setList(res.data.data)
setTotalCount(res.data.totalCount)
}
})
}
const handleChange = (page) => {
setCurrent(page)
}
const linkToDetail = (detail) => {
if (detail.status !== 0) {
const el = document.createElement('a')
el.href = `${LOGISTICS_CENTER_URL}/aboutUs/${detail.id}`;
el.target = '_blank';
el.id = detail.id
if(!document.getElementById(detail.id)) {
document.body.appendChild(el);
}
el.click()
} else {
message.destroy()
message.info("物流商已被冻结")
}
}
const handleCancelCollect = (detail) => {
Modal.confirm({
centered: true,
className: styles.mallComfirm,
content: `是否要取消收藏?`,
onOk: () => {
return new Promise((resolve, reject) => {
const param = {
id: detail.id,
status: false
}
PublicApi.postTemplateWebMemberLogisticsWebCollect(param).then(res => {
if (res.code === 1000) {
// fetchPurchaseList()
fetchCollectList()
resolve(true)
} else {
reject()
}
}).catch(() => {
reject()
})
})
}
})
}
return (
<>
<div className={styles.information_list}>
{
list && list.map((item, index) => (
<div className={styles.information_list_item} key={`information_list_item_${index}`}>
<div className={cx(styles.information_list_item_item, styles.morehalf)}>
<div className={styles.information_header_info}>
<div className={styles.information_header_info_logo}>
<img src={item.logo} />
</div>
<div className={styles.information_header_info_content}>
<div className={styles.information_header_info_content_name} onClick={() => linkToDetail(item)}>
<span>{item.memberName}</span>
</div>
</div>
</div>
</div>
<div className={cx(styles.information_list_item_item)}>
<span className={styles.date}>{moment(item.createTime).format("YYYY-MM-DD HH:mm")}</span>
</div>
<div className={cx(styles.information_list_item_item)} onClick={() => handleCancelCollect(item)}>
<div className={cx(styles.collection_state)}>
<StarFilled />
<label>收藏</label>
</div>
</div>
</div>
))
}
</div>
{
totalCount > 0 && (
<div className={styles.pagination_wrap}>
<Pagination showSizeChanger={false} current={current} total={totalCount} pageSize={pageSize} onChange={handleChange} />
</div>
)
}
</>
)
}
export default Logistics
import React, { useEffect, useState } from 'react'
import cx from 'classnames'
import { Pagination, message, Modal } from 'antd'
import { StarFilled } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
import { MANUFACTURE_CENTER_URL } from '@/constants'
import moment from 'moment'
import styles from './index.less'
const Process: React.FC = () => {
const [list, setList] = useState([])
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
const [totalCount, setTotalCount] = useState<number>(0)
useEffect(() => {
fetchCollectList()
}, [current])
/**
* 获取收藏的资讯列表
*/
const fetchCollectList = () => {
const param: any = {
current,
pageSize
}
PublicApi.getTemplateWebMemberProcessWebCollectList(param).then(res => {
if (res.code === 1000) {
setList(res.data.data)
setTotalCount(res.data.totalCount)
}
})
}
const handleChange = (page) => {
setCurrent(page)
}
const linkToDetail = (detail) => {
if (detail.status !== 0) {
const el = document.createElement('a')
el.href = `${MANUFACTURE_CENTER_URL}/aboutUs/${detail.id}`;
el.target = '_blank';
el.id = detail.id
if(!document.getElementById(detail.id)) {
document.body.appendChild(el);
}
el.click()
} else {
message.destroy()
message.info("加工商已被冻结")
}
}
const handleCancelCollect = (detail) => {
Modal.confirm({
centered: true,
className: styles.mallComfirm,
content: `是否要取消收藏?`,
onOk: () => {
return new Promise((resolve, reject) => {
const param = {
id: detail.id,
status: false
}
PublicApi.postTemplateWebMemberProcessWebCollect(param).then(res => {
if (res.code === 1000) {
// fetchPurchaseList()
fetchCollectList()
resolve(true)
} else {
reject()
}
}).catch(() => {
reject()
})
})
}
})
}
return (
<>
<div className={styles.information_list}>
{
list && list.map((item, index) => (
<div className={styles.information_list_item} key={`information_list_item_${index}`}>
<div className={cx(styles.information_list_item_item, styles.morehalf)}>
<div className={styles.information_header_info}>
<div className={styles.information_header_info_logo}>
<img src={item.logo} />
</div>
<div className={styles.information_header_info_content}>
<div className={styles.information_header_info_content_name} onClick={() => linkToDetail(item)}>
<span>{item.memberName}</span>
</div>
</div>
</div>
</div>
<div className={cx(styles.information_list_item_item)}>
<span className={styles.date}>{moment(item.createTime).format("YYYY-MM-DD HH:mm")}</span>
</div>
<div className={cx(styles.information_list_item_item)} onClick={() => handleCancelCollect(item)}>
<div className={cx(styles.collection_state)}>
<StarFilled />
<label>收藏</label>
</div>
</div>
</div>
))
}
</div>
{
totalCount > 0 && (
<div className={styles.pagination_wrap}>
<Pagination showSizeChanger={false} current={current} total={totalCount} pageSize={pageSize} onChange={handleChange} />
</div>
)
}
</>
)
}
export default Process
import React, { useEffect, useState } from 'react'
import cx from 'classnames'
import { Pagination, message, Modal } from 'antd'
import { StarFilled } from '@ant-design/icons'
import { PublicApi } from '@/services/api'
import { SRM_CENTER_URL } from '@/constants'
import moment from 'moment'
import styles from './index.less'
const Purchase: React.FC = () => {
const [list, setList] = useState([])
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
const [totalCount, setTotalCount] = useState<number>(0)
useEffect(() => {
fetchCollectPurchaseList()
}, [current])
/**
* 获取收藏的资讯列表
*/
const fetchCollectPurchaseList = () => {
const param: any = {
current,
pageSize
}
PublicApi.getTemplateWebMemberPurchaseWebCollectList(param).then(res => {
if (res.code === 1000) {
setList(res.data.data)
setTotalCount(res.data.totalCount)
}
})
}
const handleChange = (page) => {
setCurrent(page)
}
const linkToDetail = (detail) => {
if (detail.status !== 0) {
const el = document.createElement('a')
el.href = `${SRM_CENTER_URL}/shopIndex/${detail.id}`;
el.target = '_blank';
el.id = detail.id
if(!document.getElementById(detail.id)) {
document.body.appendChild(el);
}
el.click()
} else {
message.destroy()
message.info("该门户已被冻结")
}
}
const handleCancelCollect = (detail) => {
Modal.confirm({
centered: true,
className: styles.mallComfirm,
content: `是否要取消收藏?`,
onOk: () => {
return new Promise((resolve, reject) => {
const param = {
id: detail.id,
status: false
}
PublicApi.postTemplateWebMemberPurchaseWebCollect(param).then(res => {
if (res.code === 1000) {
// fetchPurchaseList()
fetchCollectPurchaseList()
resolve(true)
} else {
reject()
}
}).catch(() => {
reject()
})
})
}
})
}
return (
<>
<div className={styles.information_list}>
{
list && list.map((item, index) => (
<div className={styles.information_list_item} key={`information_list_item_${index}`}>
<div className={cx(styles.information_list_item_item, styles.morehalf)}>
<div className={styles.information_header_info}>
<div className={styles.information_header_info_logo}>
<img src={item.logo} />
</div>
<div className={styles.information_header_info_content}>
<div className={styles.information_header_info_content_name} onClick={() => linkToDetail(item)}>
<span>{item.memberName}</span>
</div>
</div>
</div>
</div>
<div className={cx(styles.information_list_item_item)}>
<span className={styles.date}>{moment(item.createTime).format("YYYY-MM-DD HH:mm")}</span>
</div>
<div className={cx(styles.information_list_item_item)} onClick={() => handleCancelCollect(item)}>
<div className={cx(styles.collection_state)}>
<StarFilled />
<label>收藏</label>
</div>
</div>
</div>
))
}
</div>
{
totalCount > 0 && (
<div className={styles.pagination_wrap}>
<Pagination showSizeChanger={false} current={current} total={totalCount} pageSize={pageSize} onChange={handleChange} />
</div>
)
}
</>
)
}
export default Purchase
......@@ -96,10 +96,12 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
if (isEdit && spam) {
// const data: any = JSON.parse(sessionStorage.getItem(spam));
const data: any = getCookie(spam)
if (!data) return
const inquiryListProductRequests: any[] = [];
inquiryListProductRequests.push({
commodityId: id,
productId: data.id,
imgUrl: data.imgUrl,
productName: data.name,
category: data.category,
brand: data.brand.name,
......@@ -109,7 +111,16 @@ const AddedFormLayout: React.FC<AddedFormLayoutProps> = (props: any) => {
memberId: data.memberId,
memberRoleId: data.memberRoleId
})
setMenberInfo({
memberId: data.memberId,
roleId: data.memberRoleId,
roleName: data.memberName,
})
setInquiryProduct(inquiryListProductRequests)
form.setFieldsValue({
memberName: data.memberName,
"inquiryListProductRequests": inquiryListProductRequests
})
} else if (isEdit) {
PublicApi.getTransactionInquiryListDetails({ id }).then(res => {
if (res.code !== 1000) {
......
......@@ -6,6 +6,7 @@ import TableModal from '@/pages/transaction/components/TableModal';
import { PublicApi } from '@/services/api';
import style from './index.less';
import { isEmpty } from '@formily/shared';
import { ENTERPRISE_CENTER_URL } from '@/constants'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
......@@ -72,14 +73,14 @@ const BasicInfoLayout: React.FC<BasicInfoLayoutProps> = (props: any) => {
}
const hanleGoMall = () => {
console.log(member)
if (member.memberId) {
window.open(`/shop?shopId=${btoa(JSON.stringify({ memberId: member.memberId, roleId: member.roleId }))}`)
window.open(`${ENTERPRISE_CENTER_URL}/shop/${member.memberId}_${member.roleId}`)
}
}
useEffect(() => {
if (!isEmpty(memb)) {
console.log(memb, 'memb')
setMember(memb)
}
}, [memb])
......
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