Commit dff0fe5c authored by XieZhiXiong's avatar XieZhiXiong
parents 5f54bc5c a93fb0e0
......@@ -57,7 +57,7 @@
"god": "^0.2.4",
"immutability-helper": "^3.1.1",
"lingxi-design": "^1.0.8",
"lingxi-design-ui": "^1.1.17",
"lingxi-design-ui": "^1.1.18",
"lingxi-editor-core": "^1.0.6",
"lingxi-web": "^1.0.6",
"lint-staged": "^10.0.7",
......
......@@ -72,10 +72,10 @@ export const isDev = process.env.NODE_ENV === "development"
// export const isDev = false
export const Environment_Status = {
0: "所有",
1: "PC",
1: "web",
2: "H5",
3: "APP"
3: "小程序",
4: "APP"
}
export enum FILTER_TYPE {
......
......@@ -2,7 +2,6 @@ import React from 'react'
import { PlayCircleOutlined } from '@ant-design/icons'
import cx from 'classnames'
import { Link } from 'umi'
import default_img from '@/assets/imgs/template_default_img.png'
import styles from './index.less'
interface TemplateItemPropsType {
......
......@@ -7,7 +7,6 @@ import UseModal from '../components/useModal'
import { PublicApi } from '@/services/api'
import { Environment_Status } from '@/constants'
import { GetTemplateWebPageTemplateWebFindChannelTemplateDetailsResponse } from '@/services/TemplateApi'
import default_img from '@/assets/imgs/template_default_img.png'
import styles from './index.less'
interface TemplateDetailPropsType {
......@@ -74,7 +73,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
<div className={styles.template_info_wrap}>
<div className={styles.template_img_box}>
<div className={cx(styles.type_tag)}>{Environment_Status[detailInfo?.environment]}</div>
<img src={default_img} />
<img src={detailInfo?.templatePicUrl} />
</div>
<div className={styles.template_info}>
<div className={styles.template_info_line}>
......
......@@ -19,6 +19,10 @@
line-height: 32px;
right: 0;
bottom: 0;
&.hide {
display: none;
}
}
:global {
......
......@@ -22,13 +22,26 @@ const ProductDescription: React.FC<ProductDescriptionPropsType> = (props) => {
const [productIds, setProductIds] = useState<number[]>([])
const [tradeRecordCount, setTradeRecordCount] = useState<number>(0)
const [commentCount, setCommentCount] = useState<number>(0)
const [backTopVisible, setBackTopVisible] = useState<boolean>(false)
const handleAnchorChange = (currentActiveLink: string) => {
if (currentActiveLink) {
setBackTopVisible(true)
setCurrentAnchor(currentActiveLink)
}
}
const handleScroll = () => {
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
if(scrollTop === 0) {
setBackTopVisible(false)
}
}
useEffect(() => {
window.addEventListener('scroll', handleScroll)
}, [])
useEffect(() => {
if (commodityDetail) {
if (commodityDetail.unitPricePicList) {
......@@ -47,7 +60,13 @@ const ProductDescription: React.FC<ProductDescriptionPropsType> = (props) => {
<Link className={cx(currentAnchor === "#introduction" ? 'active' : '')} href="#introduction" title="产品简介" />
<Link href="#trade_record" title={commodityDetail?.priceType === COMMODITY_TYPE.integral ? `兑换记录${tradeRecordCount ? `(${tradeRecordCount})` : `(0)`}` : `交易记录${tradeRecordCount ? `(${tradeRecordCount})` : `(0)`}`} />
<Link href="#comment" title={`交易评价(${commentCount > 999 ? '999+' : commentCount})`} />
<BackTop className={styles.buy_now_btn} visibilityHeight={800} >立即订购</BackTop>
<BackTop
className={cx(styles.buy_now_btn, !backTopVisible ? styles.hide : null)}
visibilityHeight={800}
onClick={() => setBackTopVisible(false)}
>
{commodityDetail?.priceType === COMMODITY_TYPE.integral ? '立即兑换' : '立即订购'}
</BackTop>
</Anchor>
<Introduction commodityDetail={commodityDetail} />
<TradeRecord productIds={productIds} setCount={(count) => setTradeRecordCount(count)} />
......
......@@ -547,8 +547,8 @@ const CommodityDetail = (props) => {
name: commodityDetail.name,
priceRange: commodityPriceInfo,
memberDiscount: parameter,
category: commodityDetail.customerCategory.name,
brand: commodityDetail.brand.name,
category: commodityDetail.customerCategory && commodityDetail.customerCategory.name,
brand: commodityDetail.brand && commodityDetail.brand.name,
stockCount: stockCount,
minOrder: commodityDetail.minOrder,
commodityPic: attrAndValList.commodityPic ? attrAndValList.commodityPic[0] : commodityDetail.mainPic,
......@@ -556,7 +556,7 @@ const CommodityDetail = (props) => {
isMemberPrice: commodityDetail.isMemberPrice ? 1 : 0
}
if(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) {
buyCommodityInfo.channelProductId = commodityDetail.id
buyCommodityInfo.channelProductId = selectCommodityUnitPriceId
}
const sessionKey = `${commodityDetail.id}${new Date().getTime()}`
......
......@@ -4,6 +4,7 @@ import { inject, observer } from 'mobx-react'
import { Link } from 'umi'
import cx from 'classnames'
import { LAYOUT_TYPE } from '@/constants'
import ImageBox from '@/components/ImageBox'
import { PublicApi } from '@/services/api'
import { GlobalConfig } from '@/global/config'
import styles from './index.less'
......@@ -140,9 +141,11 @@ const Category: React.FC<CategoryPropsType> = (props) => {
<div className={styles.category_type_right_wrap}>
<div className={styles.category_advert}>
{
(item.brandBOList && item.brandBOList.length > 0) && item.brandBOList.map((brandItem, brandIndex) => brandIndex < 4 && (
(item.brandList && item.brandList.length > 0) && item.brandList.map((brandItem, brandIndex) => brandIndex < 4 && (
<div key={`category_advert_item_${brandIndex}`} className={styles.category_advert_item}>
<Link to={getBrandLink(brandItem)}> <img src={brandItem.brandLogo} /></Link>
<a href={getBrandLink(brandItem)}>
<ImageBox width={160} height={80} imgUrl={brandItem.brandLogo} />
</a>
</div>
))
}
......
......@@ -18,6 +18,14 @@ interface CategoryPropsType {
showAttr?: boolean
}
type CategoryItemType = {
title: string | React.ReactNode,
key: string,
name?: string | React.ReactNode,
parentKey?: string,
children?: CategoryItemType[]
}
const Category: React.FC<CategoryPropsType> = (props) => {
const { layoutType = LAYOUT_TYPE.mall, shopId, memberId, showAttr = false } = props
const { onFilter, filterList } = props.FilterStore
......@@ -165,41 +173,56 @@ const Category: React.FC<CategoryPropsType> = (props) => {
}
const initTreeData = (list: any) => {
const initTreeData = (list: any, parentKey?: string) => {
if (!list) {
return []
}
const initExpandKeys = []
const result: any = list.map(item => {
initExpandKeys.push(item.id)
return {
const newItem: CategoryItemType = {
title: item.title,
name: item.title,
key: item.id,
children: item.children.map(secondCategoryItem => {
initExpandKeys.push(secondCategoryItem.id)
return {
title: secondCategoryItem.title,
key: secondCategoryItem.id,
children: secondCategoryItem.children.map(thirdCategoryItem => {
return {
title: <span className={styles.sub_category_title}>{thirdCategoryItem.title}</span>,
name: thirdCategoryItem.title,
key: thirdCategoryItem.id,
children: []
}
})
if(parentKey) {
newItem.parentKey = parentKey
}
})
if(item.children && item.children.length > 0) {
newItem.children = initTreeData(item.children, newItem.key)
} else {
newItem.title = <span className={styles.sub_category_title}>{newItem.title}</span>
}
return newItem
})
return result
}
const findParentByKey = (key: number, list) => {
const temp = []
const forFn = (arr, key) => {
for (let i = 0; i < arr.length; i++) {
const item = arr[i]
if (item.key === key) {
temp.push(item)
forFn(list, item.parentKey)
break
} else {
if (item.children) {
forFn(item.children, key)
}
}
}
}
forFn(list, key)
return temp
}
const handleSelect = (selectedKeys, info) => {
const { title, children, name } = info.node
setSelectedKeys(selectedKeys)
if (children.length === 0) {
if (!children) {
if (lastCategoryId !== selectedKeys[0]) {
setLastCategoryId(selectedKeys[0])
}
......@@ -209,26 +232,29 @@ const Category: React.FC<CategoryPropsType> = (props) => {
if(selectedKeys.length === 0) {
initAttribute()
}
const categoryNameList = findParentByKey(selectedKeys[0], categoryList).reverse()
const filterCatogoryName = categoryNameList.map(item => item.name).join(' > ')
switch(layoutType) {
case LAYOUT_TYPE.mall:
onFilter({
type: FILTER_TYPE.category,
key: selectedKeys,
title: typeof title === 'string' ? title : name
title: filterCatogoryName
})
break
case LAYOUT_TYPE.purchaseOnline:
onFilter({
type: FILTER_TYPE.categoryName,
key: typeof title === 'string' ? title : name,
title: typeof title === 'string' ? title : name
key: filterCatogoryName,
title: filterCatogoryName
})
break
default:
onFilter({
type: FILTER_TYPE.customerCategory,
key: selectedKeys,
title: typeof title === 'string' ? title : name
title: filterCatogoryName
})
break
}
......
import React, { useState, useEffect } from 'react'
import cx from 'classnames'
import editIcon from './edit_icon.png'
import { inject, observer } from 'mobx-react'
import { Link } from 'umi'
import { PublicApi } from '@/services/api'
import { GetReportMallGetMemberMallBacklogResponse } from '@/services/ReportApi'
import styles from './index.less'
interface QuickNavPropsType {
......@@ -15,6 +15,7 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => {
const { userInfo } = props.UserStore
const [tabType, setTabType] = useState<number>(1) // 1; 卖家服务;2:买家服务
const [consumerNav, setConsumerNav] = useState<any>()
const [memberMallBacklog, setMemberMallBacklog] = useState<GetReportMallGetMemberMallBacklogResponse>()
const handleChangeTabType = (type: number) => {
if (tabType !== type) {
......@@ -22,12 +23,27 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => {
}
}
const fetchMemberMallBacklog = () => {
const param: any = {
isPurchase: userInfo.memberRoleType === 2 ? 1 : 0
}
PublicApi.getReportMallGetMemberMallBacklog(param).then(res => {
if(res.code === 1000) {
setMemberMallBacklog(res.data)
}
})
}
useEffect(() => {
if (userInfo) {
getNavList()
fetchMemberMallBacklog()
}
}, [])
useEffect(() => {
getNavList()
}, [memberMallBacklog])
// 卖家服务快捷导航
const sell_quick_nav_list = [
{
......@@ -117,19 +133,19 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => {
if (userInfo.memberRoleType === 1) {
component = <div className={styles.navList}>
<div className={styles.navList_item}>
<div className={styles.navList_item_count}>0</div>
<div className={styles.navList_item_count}>{memberMallBacklog?.saleToBeValify || 0}</div>
<div className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/saleOrder/readyApprovedOrder'}>待审核</a></div>
</div>
<div className={styles.navList_item}>
<div className={styles.navList_item_count}>0</div>
<div className={styles.navList_item_count}>{memberMallBacklog?.saleToBeConfirm || 0}</div>
<div className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/saleOrder/readyConfirmOrder'}>待确认</a></div>
</div>
<div className={styles.navList_item}>
<div className={styles.navList_item_count}>0</div>
<div className={styles.navList_item_count}>{memberMallBacklog?.saleToBeDelivery || 0}</div>
<div className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/saleOrder/addSaleDelevedOrder'}>待发货</a></div>
</div>
<div className={styles.navList_item}>
<div className={styles.navList_item_count}>0</div>
<div className={styles.navList_item_count}>{memberMallBacklog?.saleToBeArchive || 0}</div>
<div className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/saleOrder/readyReturnDocument'}>待归档</a></div>
</div>
</div>
......@@ -137,19 +153,19 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => {
component = <div className={styles.navList}>
<div className={styles.navList_item}>
<div className={styles.navList_item_count}>0</div>
<div className={styles.navList_item_count}>{memberMallBacklog?.purchaseToBeValify || 0}</div>
<div className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/purchaseOrder/firstApprovedOrder'}>待审核</a></div>
</div>
<div className={styles.navList_item}>
<div className={styles.navList_item_count}>0</div>
<div className={styles.navList_item_count}>{memberMallBacklog?.purchaseToBePay || 0}</div>
<div className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/purchaseOrder/readyPayOrder'}>待支付</a></div>
</div>
<div className={styles.navList_item}>
<div className={styles.navList_item_count}>0</div>
<div className={styles.navList_item_count}>{memberMallBacklog?.purchaseToBeReceive || 0}</div>
<div className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/purchaseOrder/readyReceiveOrder'}>待收货</a></div>
</div>
<div className={styles.navList_item}>
<div className={styles.navList_item_count}>0</div>
<div className={styles.navList_item_count}>{memberMallBacklog?.purchaseToBeArchive || 0}</div>
<div className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/purchaseOrder/readyFileOrder'}>待归档</a></div>
</div>
</div>
......
......@@ -74,7 +74,7 @@ const TopBar: React.FC<TopBarPropsType> = (props) => {
<div className={styles.userInfo_card_header}>
<ImageBox width={64} height={64} circle={true} direction="column" imgUrl={defaultAvatar} />
<div className={styles.userInfo_card_column}>
<div className={styles.credit_count}>信用积分:<span>{numFormat(userInfo.score || 0)}</span></div>
<div className={styles.credit_count}>信用积分:<span>{numFormat(userInfo.creditPoint || 0)}</span></div>
<div className={styles.user_type}>{userInfo.levelTag}</div>
</div>
<div className={styles.sign_out_btn} onClick={handleSignOut}>退出账号</div>
......
......@@ -565,8 +565,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
name: item.commodityUnitPrice.commodity.name,
minOrder: item.commodityUnitPrice.commodity.minOrder,
priceRange: item.commodityUnitPrice.priceRange,
category: item.commodityUnitPrice.commodity.customerCategory.name,
brand: item.commodityUnitPrice.commodity.brand.name,
category: item.commodityUnitPrice.commodity.customerCategory && item.commodityUnitPrice.commodity.customerCategory.name,
brand: item.commodityUnitPrice.commodity.brand && item.commodityUnitPrice.commodity.brand.name,
commodityPic: item.commodityUnitPrice.commodity.mainPic,
attribute: item.commodityUnitPrice.attributeAndValueList,
stockCount: item.stockCount || 0,
......
......@@ -11,17 +11,17 @@ interface TemplateItemPropsType {
}
const Environment_Status = {
0: {
name: "所有"
},
1: {
name: "PC "
name: "web"
},
2: {
name: "H5 "
name: "H5"
},
3: {
name: "APP "
name: "小程序"
},
4: {
name: "APP"
}
}
......
......@@ -6,7 +6,6 @@ import UseModal from '../components/useModal'
import { PublicApi } from '@/services/api'
import { Environment_Status } from '@/constants'
import { GetTemplateWebPageTemplateWebFindShopTemplateDetailsResponse } from '@/services/TemplateApi'
import default_img from '@/assets/imgs/template_default_img.png'
import styles from './index.less'
interface TemplateDetailPropsType {
......@@ -74,7 +73,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
<div className={styles.template_info_wrap}>
<div className={styles.template_img_box}>
<div className={cx(styles.type_tag)}>{Environment_Status[detailInfo?.environment]}</div>
<img src={default_img} />
<img src={detailInfo?.templatePicUrl} />
</div>
<div className={styles.template_info}>
<div className={styles.template_info_line}>
......
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