Commit a3b00b88 authored by XieZhiXiong's avatar XieZhiXiong
parents d5b42400 362c1aa1
/*
* @Author: LeeJiancong
* @Date: 2020-07-31 19:56:22
* @LastEditors: XieZhiXiong
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-14 19:37:53
* @LastEditTime: 2020-09-15 17:18:01
*/
const TranactionRoute = {
......@@ -72,26 +72,22 @@ const TranactionRoute = {
{
path:'/memberCenter/tranactionAbility/enquirySubmit/enquirySearch',
name:'enquirySearch',
key:'enquirySearch',
component: '@/pages/transaction/enquirySubmit/enquirySearch'
},
{
path:'/memberCenter/tranactionAbility/enquirySubmit/toAddSubmitList',
name:'toAddSubmitList',
key:'toAddSubmitList',
component: '@/pages/transaction/enquirySubmit/toAddSubmit'
},
{
path:'/memberCenter/tranactionAbility/enquirySubmit/addEnquiry',
name:'addEnquiry',
key:'addEnquiry',
component: '@/pages/transaction/enquirySubmit/toAddSubmit/detail',
hideInMenu: true,
},
{//需求单详情
path:'/memberCenter/tranactionAbility/enquirySubmit/viewEnquiryDetail',
name:'viewEnquiryDetail',
key:'viewEnquiryDetail',
component: '@/pages/transaction/enquirySubmit/components/detail',
hideInMenu: true,
},
......@@ -99,19 +95,16 @@ const TranactionRoute = {
{
path:'/memberCenter/tranactionAbility/enquirySubmit/enquiryOne',
name:'enquiryOne',
key:'enquiryOne',
component: '@/pages/transaction/enquirySubmit/enquiryOne'
},
{
path:'/memberCenter/tranactionAbility/enquirySubmit/enquiryTwo',
name:'enquiryTwo',
key:'enquiryTwo',
component: '@/pages/transaction/enquirySubmit/enquiryTwo'
},
{
path:'/memberCenter/tranactionAbility/enquirySubmit/toSubmit',
name:'toSubmit',
key:'toSubmit',
component: '@/pages/transaction/enquirySubmit/toSubmit'
},
......@@ -133,13 +126,11 @@ const TranactionRoute = {
{
path:'/memberCenter/tranactionAbility/enquiryOffer/enquirySearch',
name:'enquirySearch',
key:'enquirySearch',
component: '@/pages/transaction/enquiryOffer/enquirySearch'
},
{//需求单详情
path:'/memberCenter/tranactionAbility/enquiryOffer/viewEnquiryDetail',
name:'viewEnquiryDetail',
key:'viewEnquiryDetail',
component: '@/pages/transaction/enquiryOffer/components/detail',
hideInMenu: true,
},
......@@ -148,14 +139,12 @@ const TranactionRoute = {
{
path:'/memberCenter/tranactionAbility/enquiryOffer/toAddSubmitList',
name:'toAddSubmitList',
key:'toAddSubmitList',
component: '@/pages/transaction/enquiryOffer/toAddSubmit'
},
//新增
{
path:'/memberCenter/tranactionAbility/enquiryOffer/addEnquiry',
name:'addEnquiry',
key:'addEnquiry',
component: '@/pages/transaction/enquiryOffer/toAddSubmit/detail',
hideInMenu: true,
},
......
......@@ -41,7 +41,7 @@
"copy-to-clipboard": "^3.3.1",
"god": "^0.1.27",
"lingxi-design": "^1.0.7",
"lingxi-design-ui": "^1.1.2",
"lingxi-design-ui": "^1.1.3",
"lingxi-editor-core": "^1.0.6",
"lingxi-web": "^1.0.6",
"lint-staged": "^10.0.7",
......
......@@ -33,14 +33,22 @@
}
.shop_url {
width: 572px;
color: #6B778C;
margin-top: 16px;
font-size: 14px;
display: flex;
&>label {
flex: 1;
width: 0;
display: block;
color: #172B4D;
margin-left: 8px;
margin-right: 15px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.copy_icon {
......
......@@ -143,7 +143,7 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
message.error("店铺链接不能为空")
return
}
value.storeUrl = storeUrl
value.storeUrl = storeUrl || `${siteUrl}/channelmall`
value.shopId = shopId
setConfirmLoading(true)
//@ts-ignore
......@@ -209,21 +209,57 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
}
const handleMallSelectChange = (mallId: number) => {
let selectItem = allMallList.filter(item => item.id === mallId)
setShopId(mallId)
if (mallId) {
setStoreUrl(`${siteUrl}/channelmall?id=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`)
// setStoreUrl(`${siteUrl}/${selectItem[0].url}?id=${1}`)
if (shopInfo.shopId && shopInfo.memberId) {
let resUrl = getMallItemAndSetUrl(mallId)
setStoreUrl(resUrl)
} else {
setStoreUrl(null)
}
}
const getMallItemAndSetUrl = (mallId) => {
let result = ""
let mallItem = allMallList.filter(item => item.id === mallId)[0]
if (mallItem.environment === 1) {
switch (mallItem.type) {
case 3:
result = `${siteUrl}/channelmall?id=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`
break
case 4:
result = `${siteUrl}/channelmall?id=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`
break
case 5:
result = `${siteUrl}/channelmall/pointsMall?id=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`
break
default:
result = ""
break
}
} else {
result = ""
}
return result
}
const handleFormValueChange = () => {
console.log('handleFormValueChange')
setFormIsHalfFilledOut(true)
}
const getSelectMallStoreUrl = () => {
if (shopId && shopInfo.shopId && shopInfo.memberId) {
let resUrl = getMallItemAndSetUrl(shopId)
return resUrl ? (
<div className={styles.shop_url}>
<span>当前店铺链接:</span>
<label>{resUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(resUrl)} />
</div>
) : null
}
return null
}
return (
<PageHeaderWrapper>
<Prompt when={formIsHalfFilledOut} message="您还有未保存的内容,是否确定要离开?" />
......@@ -331,7 +367,6 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
labelAlign="left"
name="shopId"
label={<RequireItem label="店铺链接" />}
// rules={[{ required: true, message: "请输入客服链接" }]}
>
<Select allowClear value={shopId} className={styles.form_item} onChange={handleMallSelectChange}>
{
......@@ -341,13 +376,7 @@ const ChannelInfo: React.FC<ShopInfoPropsType> = (props) => {
}
</Select>
{
storeUrl && (
<div className={styles.shop_url}>
<span>当前店铺链接:</span>
<label>{storeUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(storeUrl)} />
</div>
)
getSelectMallStoreUrl()
}
</Form.Item>
<Form.Item
......
......@@ -106,12 +106,20 @@ const ChannelIndex: React.FC<ChannelIndexPropsType> = (props) => {
let categoryDetail: any = await fetchCategoryById(item.id)
result.push(
<ShopFloorLine
linkUrl={`/channelmall/commodity?id=${shopUrlParam}&categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
anchor={`floorline_${item.id}`}
key={item.id}
title={item.name}
>
<ShopFloorLine.Category categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl} categoryList={categoryDetail.categoryBOList} />
<ShopFloorLine.Goods goodsList={categoryDetail.goodsBOList} />
<ShopFloorLine.Category
categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl}
categoryList={categoryDetail.categoryBOList}
linkUrl={`/channelmall/commodity?id=${shopUrlParam}`}
/>
<ShopFloorLine.Goods
goodsList={categoryDetail.goodsBOList}
linkUrl={`/channelmall/commodity/detail?id=${shopUrlParam}`}
/>
</ShopFloorLine>
)
}
......
......@@ -60,15 +60,10 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
const [filterConfig, setFilterConfig] = useState([FILTER_TYPE.categoryAndAttr, FILTER_TYPE.brand, FILTER_TYPE.price, FILTER_TYPE.useArea, FILTER_TYPE.commodityType])
useEffect(() => {
setCurrent(1)
fetchCommodityList()
fetchCommodityList(1)
}, [filterParam])
useEffect(() => {
fetchCommodityList()
}, [current])
useEffect(() => {
if (categoryId && categoryName) {
onFilter({
key: [categoryId],
......@@ -102,9 +97,9 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
})
}, [layoutType])
const fetchCommodityList = () => {
const fetchCommodityList = (currentParam?: number) => {
let param: filterQuery = {
current,
current: currentParam ? currentParam : current,
pageSize
}
......@@ -130,6 +125,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
getFn(param).then(res => {
setLoading(false)
if (res.code === 1000) {
console.log(res.data.data)
setCommodityList(res.data.data)
setTotalCount(res.data.totalCount)
}
......@@ -153,6 +149,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
const handlePageChange = (page) => {
setCurrent(page)
fetchCommodityList(page)
}
/**
......
......@@ -76,17 +76,24 @@ const CommodityDetail = (props) => {
fetchDetail()
}, [])
/**
* 获取商品详情
*/
const fetchDetail = () => {
PublicApi.getSearchShopStoreGetCommodityDetail({ commodityId: id }).then(res => {
if (res.code === 1000) {
setCommodityDetail(res.data)
initAttributeAndValueList(res.data?.unitPriceAndPicList)
initAttributeAndValueList(res.data)
getPayWayListByMemberId(res.data?.memberId)
res.data?.isMemberPrice && getMemberCredit(res.data?.memberId, res.data?.memberRoleId)
}
})
}
/**
* 获取供货商的支付方式
* @param memberId
*/
const getPayWayListByMemberId = (memberId: number) => {
if (!memberId) {
return
......@@ -99,6 +106,10 @@ const CommodityDetail = (props) => {
})
}
/**
* 初始化支付方式
* @param data
*/
const initPayWayList = (data) => {
if (!data) {
return []
......@@ -138,6 +149,11 @@ const CommodityDetail = (props) => {
setPayWayList(result)
}
/**
* 获取会员权益餐宿
* @param memberId
* @param memberRoleId
*/
const getMemberCredit = (memberId, memberRoleId) => {
let param = {
parentMemberId: memberId,
......@@ -189,13 +205,15 @@ const CommodityDetail = (props) => {
return JSON.stringify(item) === JSON.stringify(listItem)
})
})
// console.log(result, "result")
return result
} else {
return false
}
}
/**
* 加入进货单
*/
const handleAddToPurchase = () => {
if (!selectCommodityId) {
message.destroy()
......@@ -224,6 +242,9 @@ const CommodityDetail = (props) => {
}
}
/**
* 立即购买
*/
const handleToBuy = () => {
if (!selectCommodityId) {
message.destroy()
......@@ -278,6 +299,9 @@ const CommodityDetail = (props) => {
}
/**
* 根据条件渲染页面按钮
*/
const renderBtn = () => {
switch (commodityDetail?.priceType) {
case COMMODITY_TYPE.prompt:
......@@ -301,18 +325,27 @@ const CommodityDetail = (props) => {
* 初始化商品详情数据
* @param unitPriceAndPicList
*/
const initAttributeAndValueList = (unitPriceAndPicList: any) => {
let tempAttrList = []
let tempImgList = []
const initAttributeAndValueList = (dataInfo: any) => {
let unitPriceAndPicList = dataInfo?.unitPriceAndPicList
if (!unitPriceAndPicList) {
return
}
let tempAttrList = []
let tempImgList: any = [{
id: dataInfo.id,
commodityPic: dataInfo.mainPic
}]
for (let item of unitPriceAndPicList) {
// 初始化商品图片-》 商品主图加上商品属性图片
if (item.commodityPic) {
tempImgList = [...tempImgList, {
id: item.id,
commodityPic: item.commodityPic[0]
}]
let tempCommodityPic = item.commodityPic.map((picItem, picIndex) => {
return {
id: `${item.id}-${picIndex}`,
commodityPic: picItem
}
})
tempImgList = [...tempImgList, ...tempCommodityPic]
}
for (let attrListItem of item.attributeAndValueList) {
if (judgeAttrInList(tempAttrList, attrListItem.customerAttribute.id)) {
......@@ -343,15 +376,17 @@ const CommodityDetail = (props) => {
}
}
}
setCurrentPriceRange(unitPriceAndPicList[0].unitPrice)
setStockCount(unitPriceAndPicList[0].stockCount || 2000)
setCommodityImgList(tempImgList)
setAttributeList(tempAttrList)
}
/**
* 设置当前选择的sku的价格区间
* @param uniPrice
*/
const setCurrentPriceRange = (uniPrice) => {
// console.log(JSON.stringify(uniPrice), "item.unitPrice")
let initPriceRange = uniPrice
let tempPriceRange = []
Object.keys(initPriceRange).forEach((key) => {
......@@ -433,12 +468,18 @@ const CommodityDetail = (props) => {
return unitPrice
}
/**
* 获取合计金额
*/
const getAmount = () => {
let unitPrice = getUnitPrice()
let amount = unitPrice * (Number(buyCount) || 0)
return priceFormat(amount)
}
/**
* 获取金额区间中数量最大的区间
*/
const getMaxCountRange = () => {
let maxItem: any = {}
for (let item of commodityPriceInfo) {
......
......@@ -60,6 +60,17 @@ const Category: React.FC<CategoryPropsType> = (props) => {
}
}
const getBrandLink = (item) => {
switch (type) {
case LAYOUT_TYPE.shop:
return `/shop/commodity?brandId=${item.brandId}&brandName=${btoa(encodeURIComponent(item.brandName))}&shopId=${shopUrlParam}`
case LAYOUT_TYPE.channel:
return `/channelmall/commodity?brandId=${item.brandId}&brandName=${btoa(encodeURIComponent(item.brandName))}&id=${shopUrlParam}`
default:
return `/commodity?brandId=${item.brandId}&brandName=${btoa(encodeURIComponent(item.brandName))}`
}
}
return (
<div className={styles.category}>
<div className={styles.category_type}>
......@@ -108,7 +119,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
{
(item.brandBOList && item.brandBOList.length > 0) && item.brandBOList.map(brandItem => (
<div key={`category_advert_item_${brandItem.category_advert_item}`} className={styles.category_advert_item}>
<img src={brandItem.brandLogo} />
<Link to={getBrandLink(brandItem)}> <img src={brandItem.brandLogo} /></Link>
</div>
))
}
......
......@@ -23,10 +23,9 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const [categoryList, setCategoryList] = useState<any>([])
const [lastCategoryId, setLastCategoryId] = useState<number>()
const [attributeList, setAttributeList] = useState<any>([])
const [selectAttrbuteList, setSelectAttrbuteList] = useState<any>([])
useEffect(() => {
console.log(layoutType, "layoutType")
if (isEmpty(filterList)) {
setSelectedKeys([])
} else {
......@@ -64,7 +63,6 @@ const Category: React.FC<CategoryPropsType> = (props) => {
break
default:
break
}
getCategoryListFn && getCategoryListFn(param).then((res) => {
if (res.code === 1000) {
......@@ -93,12 +91,30 @@ const Category: React.FC<CategoryPropsType> = (props) => {
}
getAttributeFn(param).then(res => {
if (res.code === 1000) {
setAttributeList(initAttributeList(res.data))
}
})
}
}, [lastCategoryId])
const initAttributeList = (attrbuteList) => {
if (!attrbuteList) {
return []
}
return attrbuteList.map(item => {
return {
id: item.id,
name: item.name,
attributeValueList: item.attributeValueList ? item.attributeValueList.map(childItem => {
return {
label: childItem.value,
value: childItem.id
}
}) : []
}
})
}
const initTreeData = (list: any) => {
if (!list) {
......@@ -139,7 +155,6 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const handleSelect = (selectedKeys, info) => {
const { title, isLastNode, name } = info.node
console.log(info)
setSelectedKeys(selectedKeys)
if (isLastNode) {
if (lastCategoryId !== selectedKeys[0]) {
......@@ -163,8 +178,32 @@ const Category: React.FC<CategoryPropsType> = (props) => {
{ label: '自然摔纹', value: '3' },
];
const handleChange = (e) => {
console.log(e)
// "customerAttributeList": [{
// "customerAttributeId": 1,
// "customerAttributeValueList": [{
// "id": 3
// }, {
// "id": 4
// }]
// }, {
// "customerAttributeId": 2,
// "customerAttributeValueList": [{
// "id": 5
// }, {
// "id": 6
// }]
// }]
const handleChange = (attrId, checkedList) => {
let tempItem = {
customerAttributeId: attrId,
customerAttributeValueList: checkedList.map(item => {
return {
id: item
}
})
}
console.log(tempItem, "tempItem")
}
return (
......@@ -183,15 +222,16 @@ const Category: React.FC<CategoryPropsType> = (props) => {
</div>
</FilterBox>
{
showAttr && attributeList.length > 0 && (
showAttr && attributeList.length > 0 && attributeList.map((attrItem) => (
<FilterBox
title="风格"
key={attrItem.id}
title={attrItem.name}
>
<div className={styles.filter_style}>
<CheckboxGroup options={styleOptions} onChange={handleChange} />
<CheckboxGroup options={attrItem.attributeValueList} onChange={(val) => handleChange(attrItem.id, val)} />
</div>
</FilterBox>
)
))
}
</Fragment>
)
......
......@@ -3,15 +3,15 @@ import cx from 'classnames'
import { Input } from 'antd'
import { history } from 'umi'
import { FileTextOutlined } from '@ant-design/icons'
import { GlobalConfig } from '@/global/config'
import isEmpty from 'lodash/isEmpty'
import styles from './index.less'
interface HeaderPropsType {
logo: string,
}
const Header: React.FC<HeaderPropsType> = (props) => {
const { logo } = props
const [searchType, setSearchType] = useState<number>(1) // 1:商品; 2:店铺
const [searchValue, setSearchValue] = useState<string>("")
const { search } = history.location.query
......@@ -50,7 +50,7 @@ const Header: React.FC<HeaderPropsType> = (props) => {
<div className={styles.header}>
<div className={styles.header_container}>
<div className={styles.logo}>
<img src={GlobalConfig.global.logo} />
<img src={logo} />
</div>
<div className={styles.mall_search}>
<div className={styles.mall_search_tags}>
......
......@@ -7,9 +7,11 @@ import styles from './index.less'
interface QuickNavPropsType {
UserStore?: any;
name?: string
}
const QuickNav: React.FC<QuickNavPropsType> = (props) => {
const { name } = props
const { userInfo } = props.UserStore
const [tabType, setTabType] = useState<number>(1) // 1; 卖家服务;2:买家服务
......@@ -85,7 +87,7 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => {
<div className={styles.member_no_login}>
<div className={styles.welcome}>
<div className={styles.welcome_avatar}>Hi</div>
<span className={styles.welcome_text}>Hi,欢迎来到XX商城</span>
<span className={styles.welcome_text}>Hi,欢迎来到{name}</span>
</div>
{
!userInfo && (
......
......@@ -7,17 +7,18 @@ import styles from './index.less'
interface TopBarPropsType {
langComponent?: React.ReactNode;
UserStore?: any;
name?: string;
}
const TopBar: React.FC<TopBarPropsType> = (props) => {
const { langComponent } = props
const { langComponent, name } = props
const { userInfo } = props.UserStore
return (
<div className={styles.topbar}>
<div className={styles.topbar_container}>
<ul className={cx(styles.topbar_menu, styles.left)}>
<li className={cx(styles.topbar_menu_item, styles.pad_left_0)}>
<span>XX商城欢迎你!</span>
<span>{name}欢迎你!</span>
</li>
<li className={styles.topbar_menu_item}>
<EnvironmentOutlined className={styles.icon} />
......@@ -46,7 +47,7 @@ const TopBar: React.FC<TopBarPropsType> = (props) => {
</li>
<li className={styles.topbar_menu_item}>我的消息</li>
<li className={styles.topbar_menu_item}>
<a href="http://p.qiao.baidu.com/cps/chat?siteId=11220066&userId=24534830&siteToken=49f62d4365e46c0f2c81538e4d168ab9" target="_blank">客户服务</a>
客户服务
</li>
{
langComponent && (<li className={cx(styles.topbar_menu_item, styles.nopad)}>{langComponent}</li>)
......
......@@ -12,10 +12,12 @@ import { LAYOUT_TYPE } from '@/constants'
import styles from './index.less'
interface MallIndexPropsType {
SiteStore?: any
SiteStore?: any;
mallInfo: any
}
const MallIndex: React.FC<MallIndexPropsType> = (props) => {
const { mallInfo } = props
const [categoryList, setCategoryList] = useState<GetTemplatePlatformFindAllFirstCategoryResponse>([])
const { mallTemplateId } = props.SiteStore
const [firstAdvertList, setFirstAdvertList] = useState([])
......@@ -135,7 +137,7 @@ const MallIndex: React.FC<MallIndexPropsType> = (props) => {
return (
<div className={styles.mall_index}>
{
useMemo(() => <Advert type="banner" advertList={firstAdvertList} hasQuickNav={true} ><QuickNav /></Advert>, [firstAdvertList])
useMemo(() => <Advert type="banner" advertList={firstAdvertList} hasQuickNav={true} ><QuickNav name={mallInfo.name} /></Advert>, [firstAdvertList])
}
<FloorAnchor anchorList={categoryList} type="mall" />
{
......
......@@ -7,6 +7,7 @@ import SelectLang from '@/layouts/components/SelectLang'
import { useIntl } from 'umi'
import { inject, observer } from 'mobx-react'
import { LAYOUT_TYPE } from '@/constants'
import { GlobalConfig } from '@/global/config'
import TopBar from '../components/TopBar'
import Header from '../components/Header'
import MainNav from '../components/MainNav'
......@@ -28,13 +29,13 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
const { children, location } = props
const [templateName] = useState<string>('theme-mall-science')
const { siteId, mallTemplateInfo, findUseMallTemplate } = props.SiteStore
const [mallInfo, setMallInfo] = useState<any>({})
const getMenuRouter = (routes: any, pathname: any) => {
let list = routes.filter((item: any) => pathname.indexOf(item.key) > -1)
return list[0] || {}
}
const { formatMessage } = useIntl();
const basicInfo = getMenuData(props.route.routes, { locale: true }, formatMessage)
const menuData = basicInfo.menuData ? basicInfo.menuData.filter(item => !item.redirect) : []
......@@ -44,8 +45,16 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
if (isEmpty(mallTemplateInfo)) {
findUseMallTemplate()
}
getWebMallInfo()
}, [])
const getWebMallInfo = () => {
const shopInfo = GlobalConfig.web.shopInfo
let webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0]
console.log(webMallInfo, "webMallInfo")
setMallInfo(webMallInfo)
}
useEffect(() => {
if (!isEmpty(mallTemplateInfo)) {
let body = document.getElementsByTagName('body')[0];
......@@ -55,12 +64,12 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
return (
<div className={styles.lxmall_page}>
<TopBar langComponent={<SelectLang />} />
<TopBar langComponent={<SelectLang />} name={mallInfo.name} />
<div className={styles.content}>
{
!menuRouter?.hideHeader && (
<>
<Header />
<Header logo={mallInfo.logoUrl} />
<MainNav menuData={menuData} pathname={location.pathname} type={LAYOUT_TYPE.mall} />
</>
)
......@@ -70,6 +79,7 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
return React.cloneElement(child,
{
layoutType: LAYOUT_TYPE.mall,
mallInfo: mallInfo
},
);
})
......
......@@ -13,6 +13,7 @@ import Footer from '../components/Footer'
import { PublicApi } from '@/services/api'
import { GetTemplateShopFindShopResponse } from '@/services/TemplateApi'
import { LAYOUT_TYPE } from '@/constants'
import { GlobalConfig } from '@/global/config'
import styles from './index.less'
interface LXMallLayoutPropsType {
......@@ -36,13 +37,22 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
const { shopId } = location.query
const [shopInfo, setShopInfo] = useState<GetTemplateShopFindShopResponse>()
const [query, setQuery] = useState<any>({})
const [mallInfo, setMallInfo] = useState<any>({})
useEffect(() => {
let queryParam = shopId ? atob(shopId) : undefined
queryParam = queryParam ? JSON.parse(queryParam) : {}
setQuery(queryParam)
getWebMallInfo()
}, [])
const getWebMallInfo = () => {
const shopInfo = GlobalConfig.web.shopInfo
let webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0]
setMallInfo(webMallInfo)
}
useEffect(() => {
if (query.memberId) {
fetchShopInfo(query.memberId)
......@@ -71,7 +81,7 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
return (
<div className={styles.lxmall_page}>
<TopBar />
<TopBar name={mallInfo.name} />
<div className={styles.content}>
<ShopHeader shopId={query.shopId} shopUrlParam={shopId} shopInfo={shopInfo} />
<MainNav menuData={menuData} pathname={location.pathname} type={LAYOUT_TYPE.shop} shopId={query.shopId} shopUrlParam={shopId} />
......
......@@ -108,11 +108,16 @@ const ShopIndex: React.FC<ChannelIndexPropsType> = (props) => {
result.push(
<ShopFloorLine
anchor={`floorline_${item.id}`}
linkUrl={`/shop/commodity?shopId=${shopUrlParam}&categoryId=${item.id}&categoryName=${btoa(encodeURIComponent(item.name))}`}
key={item.id}
title={item.name}
>
<ShopFloorLine.Category categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl} categoryList={categoryDetail.categoryBOList} />
<ShopFloorLine.Goods goodsList={categoryDetail.goodsBOList} />
<ShopFloorLine.Category
categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl}
categoryList={categoryDetail.categoryBOList}
linkUrl={`/shop/commodity?shopId=${shopUrlParam}`}
/>
<ShopFloorLine.Goods goodsList={categoryDetail.goodsBOList} linkUrl={`/shop/commodity/detail?shopId=${shopUrlParam}`} />
</ShopFloorLine>
)
}
......
......@@ -33,14 +33,22 @@
}
.shop_url {
width: 572px;
color: #6B778C;
margin-top: 16px;
font-size: 14px;
display: flex;
&>label {
flex: 1;
width: 0;
display: block;
color: #172B4D;
margin-left: 8px;
margin-right: 15px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.copy_icon {
......
......@@ -37,10 +37,6 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
const [shopId, setShopId] = useState<number>()
useEffect(() => {
console.log(selectCityData, "selectCityData")
}, [selectCityData])
useEffect(() => {
fetchShopInfo()
fetchAllShop()
}, [])
......@@ -68,7 +64,9 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
setShopId(data.shopId)
setWorkshopPics(data.workshopPics || [])
setHonorPics(data.honorPics || [])
setStoreUrl(data.storeUrl || "")
if (data.shopId && data.memberId) {
setStoreUrl(data.storeUrl || "")
}
form.setFieldsValue({
describe: data.describe,
customerUrl: data.customerUrl,
......@@ -146,7 +144,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
message.error("店铺链接不能为空")
return
}
value.storeUrl = storeUrl
value.storeUrl = storeUrl || `${siteUrl}/shop`
value.shopId = shopId
//@ts-ignore
PublicApi.postTemplateShopSaveShop(value).then(res => {
......@@ -209,20 +207,55 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
}
const handleMallSelectChange = (mallId: number) => {
let selectItem = allMallList.filter(item => item.id === mallId)
// let selectItem = allMallList.filter(item => item.id === mallId)
setShopId(mallId)
if (mallId) {
setStoreUrl(`${siteUrl}/shop?shopId=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`)
if (shopInfo.shopId && shopInfo.memberId) {
let resUrl = getMallItemAndSetUrl(mallId)
setStoreUrl(resUrl)
} else {
setStoreUrl(null)
}
}
const getMallItemAndSetUrl = (mallId) => {
let result = ""
let mallItem = allMallList.filter(item => item.id === mallId)[0]
if (mallItem.environment === 1) {
switch (mallItem.type) {
case 1:
result = `${siteUrl}/shop?shopId=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`
break
case 2:
result = `${siteUrl}/shop/pointsMall?shopId=${btoa(JSON.stringify({ shopId: shopInfo.shopId, memberId: shopInfo.memberId }))}`
break
default:
result = ""
break
}
} else {
result = ""
}
return result
}
const handleFormValueChange = () => {
console.log('handleFormValueChange')
setFormIsHalfFilledOut(true)
}
const getSelectMallStoreUrl = () => {
if (shopId && shopInfo.shopId && shopInfo.memberId) {
let resUrl = getMallItemAndSetUrl(shopId)
return resUrl ? (
<div className={styles.shop_url}>
<span>当前店铺链接:</span>
<label>{resUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(resUrl)} />
</div>
) : null
}
return null
}
return (
<PageHeaderWrapper>
<Prompt when={formIsHalfFilledOut} message="您还有未保存的内容,是否确定要离开?" />
......@@ -339,15 +372,8 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
}
</Select>
{
storeUrl && (
<div className={styles.shop_url}>
<span>当前店铺链接:</span>
<label>{storeUrl}</label>
<CopyOutlined className={styles.copy_icon} onClick={() => handleCopyLinke(storeUrl)} />
</div>
)
getSelectMallStoreUrl()
}
</Form.Item>
<Form.Item
labelAlign="left"
......
import React, { Component,ReactNode } from 'react';
import {Badge} from 'antd'
/****** *********************** 需求单 ************************** */
/**
* @description: 一级
* @description: 需求提交一级
* @param {type}
* @return {type}
*/
......@@ -17,7 +17,7 @@ export const interiorState = (text:any) => {
/**
* @description: 二级
* @description: 需求提交二级
* @param {type}
* @return {type}
*/
......@@ -62,4 +62,10 @@ export const enquirySearchexternalState = (text:any) => {
text === 6 ? component = <Badge status='error' text="审核不通过" />:
component = <Badge status="default" text="取消报价单" />
return component;
}
\ No newline at end of file
}
/****** *********************** 报价单 ************************** */
......@@ -3,9 +3,9 @@
* @Date: 2020-08-28 10:07:45
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-12 11:40:07
* @LastEditTime: 2020-09-15 14:32:41
*/
import React, { Component, useState, useEffect } from 'react';
import React, { Component, useState,useRef, useEffect,useImperativeHandle } from 'react';
import { Modal, Button,Space, Form, Radio, AutoComplete, Badge,Tabs, Input, Select, Checkbox } from 'antd'
import { PublicApi } from '@/services/api'
import ModalTable from '@/components/ModalTable'
......@@ -20,13 +20,17 @@ const { TextArea } = Input
export interface Params {
sourceData?: Array<any>[],
eqInfo: any,
id?: any,
mode?: number,
type?: number | string,
dialogVisible: boolean;
currentRef?: any;
onCancel: Function;
onRef?: any;
onOK?: Function;
initialValues?: any;
productAttributeJson: Function;//明细中的属性
dontReceive?: boolean; //默认展示
}
const layout = {
......@@ -44,10 +48,10 @@ const layout = {
* @param {type}
* @return {type}
*/
// const fetchData = async (params) => {
// const res = await PublicApi.getProductCommodityCommonGetCommodityDetailList({ ...params, environment: 1, shopType: 1 })
// return res.data
// }
const fetchData = async (params) => {
const res = await PublicApi.getProductCommodityCommonGetCommodityDetailList({ ...params, environment: 1, shopType: 1 })
return res.data
}
//数据是真实的 只是模拟
let data = [
......@@ -69,18 +73,18 @@ let data = [
unitName: "件"
}
]
const fetchData = params => {
return new Promise((resolve, reject) => {
const queryResult = data.find(v => v.key === params.keywords);
setTimeout(() => {
resolve({
code: 200,
message: '',
data: queryResult ? [queryResult] : data,
});
}, 1000);
});
};
// const fetchData = params => {
// return new Promise((resolve, reject) => {
// const queryResult = data.find(v => v.key === params.keywords);
// setTimeout(() => {
// resolve({
// code: 200,
// message: '',
// data: queryResult ? [queryResult] : data,
// });
// }, 1000);
// });
// };
const columns: ColumnType<any>[] = [
{
......@@ -113,7 +117,9 @@ const columns: ColumnType<any>[] = [
* @param {type}
* @return {type}
*/
const comfirmDialog: React.FC<Params> = (props) => {
const comfirmDialog: React.FC<Params> = (props,{onRef}) => {
// const {onRef} = props
// const cRef = props.currentRef
// console.log('数据',props.sourceData)
const [visible, setsVisible] = useState(false) //state hook写法
const [Curform] = Form.useForm()
......@@ -128,6 +134,14 @@ const comfirmDialog: React.FC<Params> = (props) => {
const [placeOfOriginList, setplaceOfOriginList] = useState([])//产地
const handleCancel = () => {
}
const inRef = useRef<any>({})
useImperativeHandle(onRef,() => {
retSetForm: () => {
Curform.resetFields()
}
})
//选择商品
const handleLink = () => {
......@@ -137,16 +151,24 @@ const comfirmDialog: React.FC<Params> = (props) => {
const handleSelectOk = () => {
console.log('数据', productRowCtl);
const selectRow = productRowCtl.selectRow[0]
let { commodityId, id, goodsId, roleId, name, brandName } = selectRow
let { commodityId, id,customerCategoryName, goodsId, roleId, name, brandName } = selectRow
Curform.setFieldsValue({
name: name,//商品名称
brand: brandName
brand: brandName,
category: customerCategoryName
})
//查询属性
PublicApi.getProductCommodityGetCommodity({ id: commodityId }).then(res => {
//查询属性
// PublicApi.getProductCommodityGetCommodity({ id: commodityId }).then(res => {
// if (res.code === 1000) {
// let { data } = res || {}
// setcommodityAttributedataSource(data)
// }
// })
PublicApi.getProductCommodityGetCommodityAttributeByUnitPriceAndPicId({unitPriceAndPicId: id}).then(res => {
if (res.code === 1000) {
let { data } = res || {}
setcommodityAttributedataSource(data)
console.log('data',data)
}
})
setsVisible(false)
......@@ -155,22 +177,21 @@ const comfirmDialog: React.FC<Params> = (props) => {
setsVisible(false)
}
/**
* @description: 报价明细
* @param {type}
* @return {type}
*/
const handletOk = () => {
Curform.validateFields().then(v => {
console.log('表单', v)
// props.onOK(v)
props.onOK(v,commodityAttributedataSource)
props.productAttributeJson(commodityAttributedataSource)
Curform.resetFields()
})
// if(props.type){
// value.type = props.type
// }
// console.log('列表',value)
}
useEffect(() => {
// onRef(inRef)
return () => {
}
}, [])
......@@ -284,10 +305,10 @@ const comfirmDialog: React.FC<Params> = (props) => {
</>
)
}
const placeholderText = '请先选择对应需求单号'
return (
<>
<Modal
// title={props.mode === 0 ? '新增报价明细' : '查看报价明细'}
title={headerTitle}
width={800}
......@@ -302,10 +323,14 @@ const comfirmDialog: React.FC<Params> = (props) => {
<Form
{...layout}
colon={false}
ref={inRef}
labelAlign="left"
form={Curform}
autoComplete="off"
initialValues={{
purchaseQuantity: props.eqInfo.purchaseQuantity,
purchaseNuit: props.eqInfo.purchaseNuit
}}
>
<Tabs defaultActiveKey='tab1'
......@@ -317,12 +342,17 @@ const comfirmDialog: React.FC<Params> = (props) => {
name='model'
rules={[
{
required: true
}
]}
>
<Select>
<Option value="1">11</Option>
<Select placeholder="请先选择对应需求单号">
{
props.eqInfo.modelList.map((item,index) => {
return <Option key={index} value={item}>{item}</Option>
})
}
</Select>
</Form.Item>
<Form.Item
......@@ -350,6 +380,13 @@ const comfirmDialog: React.FC<Params> = (props) => {
>
<Input disabled placeholder='' />
</Form.Item>
<Form.Item
label='品类'
name='category'
hidden
>
<Input disabled placeholder='' />
</Form.Item>
</Tabs.TabPane>
{
......@@ -372,8 +409,8 @@ const comfirmDialog: React.FC<Params> = (props) => {
}
{
commodityAttributedataSource.commodityAttributeList.length > 0 && commodityAttributedataSource.commodityAttributeList.map((item: any) => <>
<TabPane tab={item.customerAttribute.name} key={item.customerAttribute.id}>
commodityAttributedataSource.length > 0 && commodityAttributedataSource.map((item: any) => <>
<TabPane tab={item.customerAttribute.name} key={item.customerAttribute.name}>
<Space key={item.customerAttribute.id} direction="vertical" size={16}>
{item.customerAttributeValueList.map((child,childIndex) => {
return <Badge text={child.value} key={childIndex} status="default"/>
......@@ -391,12 +428,11 @@ const comfirmDialog: React.FC<Params> = (props) => {
name='purchaseNuit'
rules={[
{
required: true,
message:"请先选择需求单"
required: true
}
]}
>
<Input placeholder='' />
<Input disabled placeholder={placeholderText} />
</Form.Item>
<Form.Item
......@@ -404,12 +440,11 @@ const comfirmDialog: React.FC<Params> = (props) => {
name='purchaseQuantity'
rules={[
{
required: true,
message:"请先选择需求单"
required: true
}
]}
>
<Input placeholder='' />
<Input disabled placeholder={placeholderText} />
</Form.Item>
<Form.Item
label='报价单价'
......@@ -453,6 +488,10 @@ const comfirmDialog: React.FC<Params> = (props) => {
)
}
comfirmDialog.defaultProps = {
eqInfo:{
// purchaseQuantity: '',//数量
// purchaseNuit:''//单位
},//规格列表
dontReceive: true,
type: 1 //1.支付宝 2.支付宝转账到银行卡参数配置 3.微信
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-24 11:39:11
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-11 16:59:50
* @LastEditTime: 2020-09-15 14:11:15
*/
import React, { ReactNode, useRef, useState,useEffect } from 'react';
import { history } from 'umi';
......@@ -158,7 +158,7 @@ const List:React.FC<{}> = () => {
},[])
const toEdit = (id:number | string) => {
history.push(`/memberCenter/tranactionAbility/enquirySubmit/addEnquiry?id=${id}`)
history.push(`/memberCenter/tranactionAbility/enquiryOffer/addEnquiry?id=${id}`)
}
/**
* @description: 删除
......
......@@ -3,7 +3,7 @@
* @Date: 2020-08-24 11:39:29
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-11 11:43:16
* @LastEditTime: 2020-09-15 15:15:36
*/
import React, { Component, useState, useEffect } from 'react'
import ReactDOM from 'react-dom'
......@@ -912,7 +912,6 @@ const Detail: React.FC<{}> = () => {
if (id) {//修改
values['id'] = id
console.log('编辑',values)
return
PublicApi.postOrderRequisitionFormUpdate(values).then(res => {
if (res.code === 1000) {
setTimeout(() => {
......@@ -922,7 +921,6 @@ const Detail: React.FC<{}> = () => {
})
} else {
PublicApi.postOrderRequisitionFormAdd(values).then(res => {
if (res.code === 1000) {
setTimeout(() => {
......
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