Commit dff0fe5c authored by XieZhiXiong's avatar XieZhiXiong
parents 5f54bc5c a93fb0e0
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
"god": "^0.2.4", "god": "^0.2.4",
"immutability-helper": "^3.1.1", "immutability-helper": "^3.1.1",
"lingxi-design": "^1.0.8", "lingxi-design": "^1.0.8",
"lingxi-design-ui": "^1.1.17", "lingxi-design-ui": "^1.1.18",
"lingxi-editor-core": "^1.0.6", "lingxi-editor-core": "^1.0.6",
"lingxi-web": "^1.0.6", "lingxi-web": "^1.0.6",
"lint-staged": "^10.0.7", "lint-staged": "^10.0.7",
......
...@@ -72,10 +72,10 @@ export const isDev = process.env.NODE_ENV === "development" ...@@ -72,10 +72,10 @@ export const isDev = process.env.NODE_ENV === "development"
// export const isDev = false // export const isDev = false
export const Environment_Status = { export const Environment_Status = {
0: "所有", 1: "web",
1: "PC",
2: "H5", 2: "H5",
3: "APP" 3: "小程序",
4: "APP"
} }
export enum FILTER_TYPE { export enum FILTER_TYPE {
......
...@@ -2,7 +2,6 @@ import React from 'react' ...@@ -2,7 +2,6 @@ import React from 'react'
import { PlayCircleOutlined } from '@ant-design/icons' import { PlayCircleOutlined } from '@ant-design/icons'
import cx from 'classnames' import cx from 'classnames'
import { Link } from 'umi' import { Link } from 'umi'
import default_img from '@/assets/imgs/template_default_img.png'
import styles from './index.less' import styles from './index.less'
interface TemplateItemPropsType { interface TemplateItemPropsType {
......
...@@ -7,7 +7,6 @@ import UseModal from '../components/useModal' ...@@ -7,7 +7,6 @@ import UseModal from '../components/useModal'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { Environment_Status } from '@/constants' import { Environment_Status } from '@/constants'
import { GetTemplateWebPageTemplateWebFindChannelTemplateDetailsResponse } from '@/services/TemplateApi' import { GetTemplateWebPageTemplateWebFindChannelTemplateDetailsResponse } from '@/services/TemplateApi'
import default_img from '@/assets/imgs/template_default_img.png'
import styles from './index.less' import styles from './index.less'
interface TemplateDetailPropsType { interface TemplateDetailPropsType {
...@@ -74,7 +73,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => { ...@@ -74,7 +73,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
<div className={styles.template_info_wrap}> <div className={styles.template_info_wrap}>
<div className={styles.template_img_box}> <div className={styles.template_img_box}>
<div className={cx(styles.type_tag)}>{Environment_Status[detailInfo?.environment]}</div> <div className={cx(styles.type_tag)}>{Environment_Status[detailInfo?.environment]}</div>
<img src={default_img} /> <img src={detailInfo?.templatePicUrl} />
</div> </div>
<div className={styles.template_info}> <div className={styles.template_info}>
<div className={styles.template_info_line}> <div className={styles.template_info_line}>
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
line-height: 32px; line-height: 32px;
right: 0; right: 0;
bottom: 0; bottom: 0;
&.hide {
display: none;
}
} }
:global { :global {
...@@ -68,4 +72,4 @@ ...@@ -68,4 +72,4 @@
} }
} }
} }
\ No newline at end of file
...@@ -22,13 +22,26 @@ const ProductDescription: React.FC<ProductDescriptionPropsType> = (props) => { ...@@ -22,13 +22,26 @@ const ProductDescription: React.FC<ProductDescriptionPropsType> = (props) => {
const [productIds, setProductIds] = useState<number[]>([]) const [productIds, setProductIds] = useState<number[]>([])
const [tradeRecordCount, setTradeRecordCount] = useState<number>(0) const [tradeRecordCount, setTradeRecordCount] = useState<number>(0)
const [commentCount, setCommentCount] = useState<number>(0) const [commentCount, setCommentCount] = useState<number>(0)
const [backTopVisible, setBackTopVisible] = useState<boolean>(false)
const handleAnchorChange = (currentActiveLink: string) => { const handleAnchorChange = (currentActiveLink: string) => {
if (currentActiveLink) { if (currentActiveLink) {
setBackTopVisible(true)
setCurrentAnchor(currentActiveLink) setCurrentAnchor(currentActiveLink)
} }
} }
const handleScroll = () => {
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
if(scrollTop === 0) {
setBackTopVisible(false)
}
}
useEffect(() => {
window.addEventListener('scroll', handleScroll)
}, [])
useEffect(() => { useEffect(() => {
if (commodityDetail) { if (commodityDetail) {
if (commodityDetail.unitPricePicList) { if (commodityDetail.unitPricePicList) {
...@@ -47,7 +60,13 @@ const ProductDescription: React.FC<ProductDescriptionPropsType> = (props) => { ...@@ -47,7 +60,13 @@ const ProductDescription: React.FC<ProductDescriptionPropsType> = (props) => {
<Link className={cx(currentAnchor === "#introduction" ? 'active' : '')} href="#introduction" title="产品简介" /> <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="#trade_record" title={commodityDetail?.priceType === COMMODITY_TYPE.integral ? `兑换记录${tradeRecordCount ? `(${tradeRecordCount})` : `(0)`}` : `交易记录${tradeRecordCount ? `(${tradeRecordCount})` : `(0)`}`} />
<Link href="#comment" title={`交易评价(${commentCount > 999 ? '999+' : commentCount})`} /> <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> </Anchor>
<Introduction commodityDetail={commodityDetail} /> <Introduction commodityDetail={commodityDetail} />
<TradeRecord productIds={productIds} setCount={(count) => setTradeRecordCount(count)} /> <TradeRecord productIds={productIds} setCount={(count) => setTradeRecordCount(count)} />
......
...@@ -547,8 +547,8 @@ const CommodityDetail = (props) => { ...@@ -547,8 +547,8 @@ const CommodityDetail = (props) => {
name: commodityDetail.name, name: commodityDetail.name,
priceRange: commodityPriceInfo, priceRange: commodityPriceInfo,
memberDiscount: parameter, memberDiscount: parameter,
category: commodityDetail.customerCategory.name, category: commodityDetail.customerCategory && commodityDetail.customerCategory.name,
brand: commodityDetail.brand.name, brand: commodityDetail.brand && commodityDetail.brand.name,
stockCount: stockCount, stockCount: stockCount,
minOrder: commodityDetail.minOrder, minOrder: commodityDetail.minOrder,
commodityPic: attrAndValList.commodityPic ? attrAndValList.commodityPic[0] : commodityDetail.mainPic, commodityPic: attrAndValList.commodityPic ? attrAndValList.commodityPic[0] : commodityDetail.mainPic,
...@@ -556,7 +556,7 @@ const CommodityDetail = (props) => { ...@@ -556,7 +556,7 @@ const CommodityDetail = (props) => {
isMemberPrice: commodityDetail.isMemberPrice ? 1 : 0 isMemberPrice: commodityDetail.isMemberPrice ? 1 : 0
} }
if(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) { if(layoutType === LAYOUT_TYPE.channel || layoutType === LAYOUT_TYPE.ichannel) {
buyCommodityInfo.channelProductId = commodityDetail.id buyCommodityInfo.channelProductId = selectCommodityUnitPriceId
} }
const sessionKey = `${commodityDetail.id}${new Date().getTime()}` const sessionKey = `${commodityDetail.id}${new Date().getTime()}`
......
...@@ -4,6 +4,7 @@ import { inject, observer } from 'mobx-react' ...@@ -4,6 +4,7 @@ import { inject, observer } from 'mobx-react'
import { Link } from 'umi' import { Link } from 'umi'
import cx from 'classnames' import cx from 'classnames'
import { LAYOUT_TYPE } from '@/constants' import { LAYOUT_TYPE } from '@/constants'
import ImageBox from '@/components/ImageBox'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { GlobalConfig } from '@/global/config' import { GlobalConfig } from '@/global/config'
import styles from './index.less' import styles from './index.less'
...@@ -140,9 +141,11 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -140,9 +141,11 @@ const Category: React.FC<CategoryPropsType> = (props) => {
<div className={styles.category_type_right_wrap}> <div className={styles.category_type_right_wrap}>
<div className={styles.category_advert}> <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}> <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> </div>
)) ))
} }
......
...@@ -18,6 +18,14 @@ interface CategoryPropsType { ...@@ -18,6 +18,14 @@ interface CategoryPropsType {
showAttr?: boolean 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 Category: React.FC<CategoryPropsType> = (props) => {
const { layoutType = LAYOUT_TYPE.mall, shopId, memberId, showAttr = false } = props const { layoutType = LAYOUT_TYPE.mall, shopId, memberId, showAttr = false } = props
const { onFilter, filterList } = props.FilterStore const { onFilter, filterList } = props.FilterStore
...@@ -165,41 +173,56 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -165,41 +173,56 @@ const Category: React.FC<CategoryPropsType> = (props) => {
} }
const initTreeData = (list: any) => { const initTreeData = (list: any, parentKey?: string) => {
if (!list) { if (!list) {
return [] return []
} }
const initExpandKeys = [] const initExpandKeys = []
const result: any = list.map(item => {
const result: any = list.map(item => {
initExpandKeys.push(item.id) initExpandKeys.push(item.id)
return { const newItem: CategoryItemType = {
title: item.title, title: item.title,
name: item.title,
key: item.id, 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 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 handleSelect = (selectedKeys, info) => {
const { title, children, name } = info.node const { title, children, name } = info.node
setSelectedKeys(selectedKeys) setSelectedKeys(selectedKeys)
if (children.length === 0) { if (!children) {
if (lastCategoryId !== selectedKeys[0]) { if (lastCategoryId !== selectedKeys[0]) {
setLastCategoryId(selectedKeys[0]) setLastCategoryId(selectedKeys[0])
} }
...@@ -209,26 +232,29 @@ const Category: React.FC<CategoryPropsType> = (props) => { ...@@ -209,26 +232,29 @@ const Category: React.FC<CategoryPropsType> = (props) => {
if(selectedKeys.length === 0) { if(selectedKeys.length === 0) {
initAttribute() initAttribute()
} }
const categoryNameList = findParentByKey(selectedKeys[0], categoryList).reverse()
const filterCatogoryName = categoryNameList.map(item => item.name).join(' > ')
switch(layoutType) { switch(layoutType) {
case LAYOUT_TYPE.mall: case LAYOUT_TYPE.mall:
onFilter({ onFilter({
type: FILTER_TYPE.category, type: FILTER_TYPE.category,
key: selectedKeys, key: selectedKeys,
title: typeof title === 'string' ? title : name title: filterCatogoryName
}) })
break break
case LAYOUT_TYPE.purchaseOnline: case LAYOUT_TYPE.purchaseOnline:
onFilter({ onFilter({
type: FILTER_TYPE.categoryName, type: FILTER_TYPE.categoryName,
key: typeof title === 'string' ? title : name, key: filterCatogoryName,
title: typeof title === 'string' ? title : name title: filterCatogoryName
}) })
break break
default: default:
onFilter({ onFilter({
type: FILTER_TYPE.customerCategory, type: FILTER_TYPE.customerCategory,
key: selectedKeys, key: selectedKeys,
title: typeof title === 'string' ? title : name title: filterCatogoryName
}) })
break break
} }
......
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react'
import cx from 'classnames' import cx from 'classnames'
import editIcon from './edit_icon.png'
import { inject, observer } from 'mobx-react' 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' import styles from './index.less'
interface QuickNavPropsType { interface QuickNavPropsType {
...@@ -15,6 +15,7 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => { ...@@ -15,6 +15,7 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => {
const { userInfo } = props.UserStore const { userInfo } = props.UserStore
const [tabType, setTabType] = useState<number>(1) // 1; 卖家服务;2:买家服务 const [tabType, setTabType] = useState<number>(1) // 1; 卖家服务;2:买家服务
const [consumerNav, setConsumerNav] = useState<any>() const [consumerNav, setConsumerNav] = useState<any>()
const [memberMallBacklog, setMemberMallBacklog] = useState<GetReportMallGetMemberMallBacklogResponse>()
const handleChangeTabType = (type: number) => { const handleChangeTabType = (type: number) => {
if (tabType !== type) { if (tabType !== type) {
...@@ -22,12 +23,27 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => { ...@@ -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(() => { useEffect(() => {
if (userInfo) { if (userInfo) {
getNavList() fetchMemberMallBacklog()
} }
}, []) }, [])
useEffect(() => {
getNavList()
}, [memberMallBacklog])
// 卖家服务快捷导航 // 卖家服务快捷导航
const sell_quick_nav_list = [ const sell_quick_nav_list = [
{ {
...@@ -117,19 +133,19 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => { ...@@ -117,19 +133,19 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => {
if (userInfo.memberRoleType === 1) { if (userInfo.memberRoleType === 1) {
component = <div className={styles.navList}> component = <div className={styles.navList}>
<div className={styles.navList_item}> <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 className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/saleOrder/readyApprovedOrder'}>待审核</a></div>
</div> </div>
<div className={styles.navList_item}> <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 className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/saleOrder/readyConfirmOrder'}>待确认</a></div>
</div> </div>
<div className={styles.navList_item}> <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 className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/saleOrder/addSaleDelevedOrder'}>待发货</a></div>
</div> </div>
<div className={styles.navList_item}> <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 className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/saleOrder/readyReturnDocument'}>待归档</a></div>
</div> </div>
</div> </div>
...@@ -137,19 +153,19 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => { ...@@ -137,19 +153,19 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => {
component = <div className={styles.navList}> component = <div className={styles.navList}>
<div className={styles.navList_item}> <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 className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/purchaseOrder/firstApprovedOrder'}>待审核</a></div>
</div> </div>
<div className={styles.navList_item}> <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 className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/purchaseOrder/readyPayOrder'}>待支付</a></div>
</div> </div>
<div className={styles.navList_item}> <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 className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/purchaseOrder/readyReceiveOrder'}>待收货</a></div>
</div> </div>
<div className={styles.navList_item}> <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 className={styles.navList_item_text}><a href={'/memberCenter/tranactionAbility/purchaseOrder/readyFileOrder'}>待归档</a></div>
</div> </div>
</div> </div>
......
...@@ -74,7 +74,7 @@ const TopBar: React.FC<TopBarPropsType> = (props) => { ...@@ -74,7 +74,7 @@ const TopBar: React.FC<TopBarPropsType> = (props) => {
<div className={styles.userInfo_card_header}> <div className={styles.userInfo_card_header}>
<ImageBox width={64} height={64} circle={true} direction="column" imgUrl={defaultAvatar} /> <ImageBox width={64} height={64} circle={true} direction="column" imgUrl={defaultAvatar} />
<div className={styles.userInfo_card_column}> <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 className={styles.user_type}>{userInfo.levelTag}</div>
</div> </div>
<div className={styles.sign_out_btn} onClick={handleSignOut}>退出账号</div> <div className={styles.sign_out_btn} onClick={handleSignOut}>退出账号</div>
......
...@@ -565,8 +565,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => { ...@@ -565,8 +565,8 @@ const PurchaseOrder: React.FC<PurchaseOrderPropsType> = (props) => {
name: item.commodityUnitPrice.commodity.name, name: item.commodityUnitPrice.commodity.name,
minOrder: item.commodityUnitPrice.commodity.minOrder, minOrder: item.commodityUnitPrice.commodity.minOrder,
priceRange: item.commodityUnitPrice.priceRange, priceRange: item.commodityUnitPrice.priceRange,
category: item.commodityUnitPrice.commodity.customerCategory.name, category: item.commodityUnitPrice.commodity.customerCategory && item.commodityUnitPrice.commodity.customerCategory.name,
brand: item.commodityUnitPrice.commodity.brand.name, brand: item.commodityUnitPrice.commodity.brand && item.commodityUnitPrice.commodity.brand.name,
commodityPic: item.commodityUnitPrice.commodity.mainPic, commodityPic: item.commodityUnitPrice.commodity.mainPic,
attribute: item.commodityUnitPrice.attributeAndValueList, attribute: item.commodityUnitPrice.attributeAndValueList,
stockCount: item.stockCount || 0, stockCount: item.stockCount || 0,
......
import React from 'react' import React from 'react'
import { PlayCircleOutlined } from '@ant-design/icons' import { PlayCircleOutlined } from '@ant-design/icons'
import cx from 'classnames' import cx from 'classnames'
import { Link } from 'umi' import { Link } from 'umi'
import default_img from '@/assets/imgs/template_default_img.png' import default_img from '@/assets/imgs/template_default_img.png'
import styles from './index.less' import styles from './index.less'
interface TemplateItemPropsType { interface TemplateItemPropsType {
templateInfo: any; templateInfo: any;
type: string; type: string;
} }
const Environment_Status = { const Environment_Status = {
0: { 1: {
name: "所有" name: "web"
}, },
1: { 2: {
name: "PC " name: "H5"
}, },
2: { 3: {
name: "H5 " name: "小程序"
}, },
3: { 4: {
name: "APP " name: "APP"
} }
} }
const TemplateItem: React.FC<TemplateItemPropsType> = (props) => { const TemplateItem: React.FC<TemplateItemPropsType> = (props) => {
const { templateInfo, type } = props const { templateInfo, type } = props
return ( return (
<div className={styles.template_item}> <div className={styles.template_item}>
<div className={styles.img_box} style={{ backgroundImage: `url(${templateInfo.templatePicUrl})` }}> <div className={styles.img_box} style={{ backgroundImage: `url(${templateInfo.templatePicUrl})` }}>
<div className={styles.img_box_mask}> <div className={styles.img_box_mask}>
<Link to={`/memberCenter/shopAbility/template/detail?type=${type}&id=${templateInfo.id}`} className={styles.detail_btn}>查看详情</Link> <Link to={`/memberCenter/shopAbility/template/detail?type=${type}&id=${templateInfo.id}`} className={styles.detail_btn}>查看详情</Link>
</div> </div>
<div className={cx(styles.type_tag, templateInfo.environment === 2 ? styles.h5 : '')}>{Environment_Status[templateInfo.environment].name}</div> <div className={cx(styles.type_tag, templateInfo.environment === 2 ? styles.h5 : '')}>{Environment_Status[templateInfo.environment].name}</div>
</div> </div>
<div className={styles.template_info}> <div className={styles.template_info}>
<div className={styles.template_info_name}> <div className={styles.template_info_name}>
<span>{templateInfo.templateName}</span> <span>{templateInfo.templateName}</span>
{ {
templateInfo.isDefault && <div className={styles.tag}>默认模板</div> templateInfo.isDefault && <div className={styles.tag}>默认模板</div>
} }
</div> </div>
<div className={cx(styles.template_info_content, type === 'goods' ? styles.goods : '')}> <div className={cx(styles.template_info_content, type === 'goods' ? styles.goods : '')}>
<div className={styles.template_info_content_text_wrap}> <div className={styles.template_info_content_text_wrap}>
<div className={styles.template_info_content_text_line}> <div className={styles.template_info_content_text_line}>
<label>使用站点:</label> <label>使用站点:</label>
<span>{templateInfo.siteName}</span> <span>{templateInfo.siteName}</span>
</div> </div>
<div className={styles.template_info_content_text_line}> <div className={styles.template_info_content_text_line}>
<label>使用商城:</label> <label>使用商城:</label>
<span>{templateInfo.shopName}</span> <span>{templateInfo.shopName}</span>
</div> </div>
</div> </div>
<div className={cx(styles.template_item_btn, templateInfo.use === 1 ? styles.active : '')}> <div className={cx(styles.template_item_btn, templateInfo.use === 1 ? styles.active : '')}>
<PlayCircleOutlined /> <PlayCircleOutlined />
<label>{templateInfo.use === 1 ? '启用中' : '启用'}</label> <label>{templateInfo.use === 1 ? '启用中' : '启用'}</label>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
) )
} }
export default TemplateItem export default TemplateItem
...@@ -6,7 +6,6 @@ import UseModal from '../components/useModal' ...@@ -6,7 +6,6 @@ import UseModal from '../components/useModal'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { Environment_Status } from '@/constants' import { Environment_Status } from '@/constants'
import { GetTemplateWebPageTemplateWebFindShopTemplateDetailsResponse } from '@/services/TemplateApi' import { GetTemplateWebPageTemplateWebFindShopTemplateDetailsResponse } from '@/services/TemplateApi'
import default_img from '@/assets/imgs/template_default_img.png'
import styles from './index.less' import styles from './index.less'
interface TemplateDetailPropsType { interface TemplateDetailPropsType {
...@@ -74,7 +73,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => { ...@@ -74,7 +73,7 @@ const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
<div className={styles.template_info_wrap}> <div className={styles.template_info_wrap}>
<div className={styles.template_img_box}> <div className={styles.template_img_box}>
<div className={cx(styles.type_tag)}>{Environment_Status[detailInfo?.environment]}</div> <div className={cx(styles.type_tag)}>{Environment_Status[detailInfo?.environment]}</div>
<img src={default_img} /> <img src={detailInfo?.templatePicUrl} />
</div> </div>
<div className={styles.template_info}> <div className={styles.template_info}>
<div className={styles.template_info_line}> <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