Commit 3fd07768 authored by wzy's avatar wzy

Merge branch 'jinfa-0518' of ssh://gitlab.shushangyun.com:8122/project/jinfa-mall into jinfa-0518

parents 44a0d2ee af03fe01
......@@ -24,7 +24,6 @@
"midway": "^2.3.0",
"mobx": "5.13.0",
"mobx-react": "6.1.3",
"pinyin": "^2.10.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
......@@ -47,7 +46,6 @@
"@types/jest": "^26.0.10",
"@types/lodash": "^4.14.175",
"@types/node": "14",
"@types/pinyin": "^2.8.2",
"@types/react": "16.9.5",
"@types/react-dom": "16.9.1",
"@types/react-helmet": "^6.1.1",
......@@ -95,6 +93,7 @@
"scripts": {
"api": "god-ytt",
"prod": "yarn getLocale && yarn api && yarn build && cross-env NODE_ENV=production LX_PM2_SCRIPT_NAME=lingxi-mall-b2b LX_PM2_SCRIPT=./bootstrap.js node ../../scripts/pm2Build.js",
"prod:pm2": "cross-env NODE_ENV=production LX_PM2_SCRIPT_NAME=lingxi-mall-b2b LX_PM2_SCRIPT=./bootstrap.js node ../../scripts/pm2Build.js",
"prod:node": "cross-env NODE_ENV=production node ./bootstrap.js",
"stop": "pm2 stop lingxi-mall-b2b",
"prune": "npm prune --production",
......
......@@ -60,7 +60,7 @@ export class Shop {
const subDomain = this.ctx.subdomains[0]
const mallList = getMallList()
let shopId = 1
let shopId = undefined
if (subDomain && (mallList && mallList.length > 0)) {
mallList.forEach((item: { url: any; id: any }) => {
if (item.url === subDomain) {
......@@ -70,7 +70,7 @@ export class Shop {
})
}
if (id) {
if (id && shopId) {
const splitStr = id.split('_')
const tempMemberId = splitStr[0]
const tempRoleId = splitStr[1]
......@@ -145,7 +145,7 @@ export class Shop {
let title = `商品详情`
const { id } = this.ctx.params
const subDomain = this.ctx.subdomains[0]
let shopId = 1
let shopId = undefined
const mallList = getMallList()
if (subDomain && (mallList && mallList.length > 0)) {
mallList.forEach((item: { url: any; id: any }) => {
......@@ -155,12 +155,14 @@ export class Shop {
}
})
}
const { commodityDetail } = await this.service.getCommodityDetail(id, shopId)
if (commodityDetail) {
const sellingPoint = (commodityDetail.sellingPoint && commodityDetail.sellingPoint.length > 0) ? commodityDetail.sellingPoint.join(' ') : ''
keyword = commodityDetail.keywords || sellingPoint
description = commodityDetail.description || commodityDetail.slogan
title = commodityDetail.title || commodityDetail.name
if (shopId) {
const { commodityDetail } = await this.service.getCommodityDetail(id, shopId)
if (commodityDetail) {
const sellingPoint = (commodityDetail.sellingPoint && commodityDetail.sellingPoint.length > 0) ? commodityDetail.sellingPoint.join(' ') : ''
keyword = commodityDetail.keywords || sellingPoint
description = commodityDetail.description || commodityDetail.slogan
title = commodityDetail.title || commodityDetail.name
}
}
const themeName = 'theme-shop-science'
......@@ -182,12 +184,14 @@ export class Shop {
let title = `商品详情`
const { id } = this.ctx.params
const shopId = getIntegralMallId()
const { commodityDetail } = await this.service.getCommodityDetail(id, shopId)
if (commodityDetail) {
const sellingPoint = (commodityDetail.sellingPoint && commodityDetail.sellingPoint.length > 0) ? commodityDetail.sellingPoint.join(' ') : ''
keyword = commodityDetail.keywords || sellingPoint
description = commodityDetail.description || commodityDetail.slogan
title = commodityDetail.title || commodityDetail.name
if (id && shopId) {
const { commodityDetail } = await this.service.getCommodityDetail(id, shopId)
if (commodityDetail) {
const sellingPoint = (commodityDetail.sellingPoint && commodityDetail.sellingPoint.length > 0) ? commodityDetail.sellingPoint.join(' ') : ''
keyword = commodityDetail.keywords || sellingPoint
description = commodityDetail.description || commodityDetail.slogan
title = commodityDetail.title || commodityDetail.name
}
}
const themeName = 'theme-shop-science'
......
......@@ -24,7 +24,9 @@ export class ApiService implements IApiService {
shopInfo: result.data
})
} catch (error) {
throw new Error('error=' + error)
return Promise.resolve({
shopInfo: undefined
})
}
}
......@@ -43,7 +45,9 @@ export class ApiService implements IApiService {
commodityDetail: result?.data
})
} catch (error) {
throw new Error('error=' + error)
return Promise.resolve({
commodityDetail: undefined
})
}
}
......@@ -59,7 +63,9 @@ export class ApiService implements IApiService {
categoryInfo: result?.data
})
} catch (error) {
throw new Error('error=' + error)
return Promise.resolve({
categoryInfo: {}
})
}
}
}
......@@ -77,25 +77,18 @@ const MainNav: React.FC<MainNavPropsType> = (props) => {
{
(navList && navList.length > 0) && navList.map(item => {
if(isMro){
if(item.type != 3 && item.status && item.type != 7){
if(item.type != 3 && item.status ){
return (
<li className={cx(styles.nav_item, judgeIsActiveRoute(item.link) ? styles.active : '')} key={item.link}>
<a href={item.link} title={getMessage(item.name)} >{getMessage(item.name)}</a>
<a href={item.type == 7 ? undefined :item.link} onClick={()=> item.type == 7 ? handleJumpSrm(item) : undefined} title={getMessage(item.name)} >{getMessage(item.name)}</a>
</li>
)
}
}
else if(item.type === 7){
return (
<li className={cx(styles.nav_item, judgeIsActiveRoute(item.link) ? styles.active : '')} key={item.link}>
<a onClick={()=>handleJumpSrm(item)} title={getMessage(item.name)} >{getMessage(item.name)}</a>
</li>
)
}
else{
return item.status && (
<li className={cx(styles.nav_item, judgeIsActiveRoute(item.link) ? styles.active : '')} key={item.link}>
<a href={item.link} title={getMessage(item.name)} >{getMessage(item.name)}</a>
<a href={item.type == 7 ? undefined :item.link} onClick={()=> item.type == 7 ? handleJumpSrm(item) : undefined} title={getMessage(item.name)} >{getMessage(item.name)}</a>
</li>
)
}
......
.mroModels {
display: flex;
position: relative;
width: 1200px;
margin: 16px auto;
flex-direction: column;
padding: 16px;
background-color: #fff;
border-radius: 8px;
overflow: hidden;
.title {
font-size: 16px;
color: #252D37;
line-height: 24px;
margin-bottom: 8px;
}
.searchInput {
width: 256px;
border: 0;
outline: 0;
background-color: #F5F6F7;
border-radius: 4px;
.ant-input{
background-color: #F5F6F7;
}
}
.btn {
border-radius: 4px;
}
.btn_reset {
background-color: #F5F6F7;
color: #252D37;
}
.bottom {
display: flex;
flex-direction: row;
margin-top: 16px;
.bottom_right {
flex: 1;
text-align: right;
}
}
}
import React, { useMemo, useState, useEffect } from 'react';
import { Space, Table, Button, Input, Pagination } from 'antd'
import { InputNumber } from '@linkseeks/lingxi-components'
import cx from 'classnames'
import { SearchOutlined } from '@ant-design/icons';
// import TableColumns, { UnitPricePicListType } from './columns';
import { GetSearchShopStoreGetCommodityDetailResponse } from "@/services/SearchV2Api";
import styles from './index.less'
import { ColumnsType } from "antd/lib/table";
import { cloneDeep } from 'lodash'
export type MroModelsProps = {
CommodityDetail: GetSearchShopStoreGetCommodityDetailResponse,
}
export const addMinNumber = (arr: any[], min: number) => {
return arr.map(item => {
item.minOrder = min;
return item
})
}
const MroModels: React.FC<MroModelsProps> = ({ CommodityDetail }) => {
const { unitPricePicList, minOrder } = CommodityDetail
const [isEmpty, setIsEmpty] = useState<boolean>(false)
const [source, setSource] = useState<any[]>(addMinNumber(cloneDeep(unitPricePicList) as any[], minOrder))
const [skuList, setSkuList] = useState<any[]>([])
useEffect(() => {
let flag = unitPricePicList.every((item: { attributeAndValueList: string | any[]; }) => item.attributeAndValueList.length > 0)
setIsEmpty(!flag)
initSkuList();
}, [])
const _tableData = useMemo(() => {
return source;
}, [source])
/**
* 判断数组中是否存在该数据
* @param list
* @param attrId
*/
const judgeAttrInList = (list: any[], attrId: number) => {
return list.some(item => item.customerAttribute.id === attrId)
}
const judgeAttrValueInList = (list: any[], attrId: number) => {
return list.some(item => item.id === attrId)
}
const initSkuList = () => {
const tempSkuList = []
for (const item of unitPricePicList) {
if (item.attributeAndValueList && item.attributeAndValueList.length > 0) {
for (const attrListItem of item.attributeAndValueList) {
if (attrListItem?.customerAttribute) {
if (attrListItem?.customerAttribute?.id && judgeAttrInList(tempSkuList, attrListItem.customerAttribute.id)) {
let tempSkuListIndex = 0
tempSkuList.map((item, index) => {
if (item.customerAttribute.id === attrListItem.customerAttribute?.id) {
tempSkuListIndex = index
}
})
const customerAttributeValue: any = { ...attrListItem.customerAttributeValue }
if (customerAttributeValue?.id && !judgeAttrValueInList(tempSkuList[tempSkuListIndex].customerAttributeValueList, customerAttributeValue?.id)) {
if (tempSkuListIndex === 0) {
if (item.commodityPic) {
customerAttributeValue.commodityPic = item.commodityPic[0]
}
}
tempSkuList[tempSkuListIndex].customerAttributeValueList = [...tempSkuList[tempSkuListIndex].customerAttributeValueList, customerAttributeValue]
}
} else {
const temp: any = {}
temp.id = attrListItem.id
temp.customerAttribute = attrListItem.customerAttribute
const customerAttributeValue: any = { ...attrListItem.customerAttributeValue }
if (tempSkuList.length === 0) {
if (item.commodityPic) {
customerAttributeValue.commodityPic = item.commodityPic[0]
}
}
temp.customerAttributeValueList = [customerAttributeValue]
tempSkuList.push(temp)
}
}
}
}
}
// let _proList = [];
// for (let key in tempSkuList) {
// let _reList: any = [];
// for (let _i = 0; _i <= tempSkuList[key]['customerAttributeValueList'].length - 1; _i++) {
// if (_proList.length) {
// for (let keys in _proList) {
// _reList.push(({ ..._proList[keys], [`customerAttribute${tempSkuList[key]['customerAttribute'].id}`]: tempSkuList[key]['customerAttributeValueList'][_i]?.value }))
// }
// } else {
// _reList.push({ [`customerAttribute${tempSkuList[key]['customerAttribute'].id}`]: tempSkuList[key]['customerAttributeValueList'][_i]?.value })
// }
// }
// console.log('_reList',_reList)
// _proList = _reList;
// }
console.log('tempSkuList', tempSkuList)
// console.log('_proList', _proList)
setSkuList(tempSkuList)
}
const _returnCustomerAttributeValue = (parentId: number, attributeAndValueList: any[]) => {
for (let _i = 0; _i <= attributeAndValueList.length - 1; _i++) {
if (attributeAndValueList[_i].customerAttribute.id === parentId) {
return attributeAndValueList[_i].customerAttributeValue.value;
}
}
return null;
}
const BackNewColumns = () => {
let addCol: ColumnsType<any> = skuList?.map((unit: any, index: number) => {
return {
title: `${unit.customerAttribute.name}`,
width: 150,
dataIndex: 'attributeAndValueList',
render: (_text: any, record: any) => {
return _returnCustomerAttributeValue(unit.customerAttribute.id, record.attributeAndValueList);
}
}
})
const _baseColumns: ColumnsType<any> = [
{
title: '库存',
dataIndex: 'stockCount',
width: 100,
fixed: "right"
},
{
title: '价格',
dataIndex: 'unitPrice',
width: 100,
fixed: "right",
render: (_text: any, record: any) => {
if (Object.values(record.unitPrice).length) {
return `¥${((Object.values(record.unitPrice)[0] as number) * record.minOrder).toFixed(2)}`
}
return <></>
}
},
{
title: '数量',
dataIndex: 'stockCount',
fixed: "right",
render: (text, record, index) => {
return <Space><InputNumber
disabled={false}
value={record?.buyNumber ?? record.minOrder}
min={record.priceType === 1 ? record.minOrder : 1}
max={record.stockCount}
onChange={(num: number) => {
record['buyNumber'] = num;
}
} />
</Space>
}
},
]
return addCol.concat(_baseColumns)
}
return (
<div className={styles['mroModels']}>
<div className={styles['title']}>全部型号</div>
<Space style={{ marginBottom: 16 }}>
<Input className={styles['searchInput']} placeholder="搜索关键字" suffix={<SearchOutlined />} />
<Button className={cx(styles['btn'])} type="primary">搜索</Button>
<Button className={cx(styles['btn'], styles['btn_reset'])}>重置</Button>
</Space>
<Table
scroll={isEmpty ? {} : {
x: 1200
}}
tableLayout="fixed"
pagination={false}
rowKey="id"
dataSource={source}
columns={BackNewColumns()}
/>
<div className={styles['bottom']}>
<Pagination
total={_tableData.length}
showTotal={total => `共 ${Math.ceil(total / 10)} 页`}
defaultPageSize={10}
defaultCurrent={1}
/>
<div className={styles['bottom_right']}>
<Space>
{`共选择了 2 种商品,总计 12 件`}
<Button type="primary">批量加入购物车</Button>
</Space>
</div>
</div>
</div>
)
}
export default MroModels;
......@@ -22,6 +22,7 @@ import GroupBuy from './components/GroupBuy'
// import Combination from './components/Combination'
import SkuInfo from './components/SkuInfo'
import Delivery from './components/Delivery'
// import MroModels from './components/MroModels'
import ErrorResult from './error'
import message from '@/utils/message'
import isEmpty from 'lodash/isEmpty'
......@@ -163,17 +164,19 @@ const CommodityDetail: SFC<CommodityDetailPropsType> = (props) => {
useEffect(() => {
if (currentSku && commodityDetail) {
getPayWayListByMemberId(commodityDetail.memberId, commodityDetail.memberRoleId)
getMarketingCampaign({
shopId: mallId!,
categoryId: commodityDetail.customerCategory.id!,
brandId: commodityDetail.brand ? commodityDetail?.brand.id : undefined,
productId: commodityDetail.id!,
memberId: commodityDetail.memberId!,
roleId: commodityDetail.memberRoleId!,
skuId: currentSku.skuId,
filterGroup: false,
commodityType: MEMBER_COMMODITY
})
if (commodityDetail.priceType !== COMMODITY_TYPE.inquiry) {
getMarketingCampaign({
shopId: mallId!,
categoryId: commodityDetail.customerCategory.id!,
brandId: commodityDetail.brand ? commodityDetail?.brand.id : undefined,
productId: commodityDetail.id!,
memberId: commodityDetail.memberId!,
roleId: commodityDetail.memberRoleId!,
skuId: currentSku.skuId,
filterGroup: false,
commodityType: MEMBER_COMMODITY
})
}
}
}, [currentSku])
......@@ -987,7 +990,7 @@ const CommodityDetail: SFC<CommodityDetailPropsType> = (props) => {
<Promotion data={marketingData?.tagDetailList} skuId={currentSku?.skuId} />
{/* 优惠券 */}
{
marketingData?.canUseCoupon === 1 && (
(marketingData?.canUseCoupon === 1 && commodityDetail?.priceType !== COMMODITY_TYPE.inquiry) && (
<Coupons
data={marketingData?.couponList}
userInfo={userInfo}
......@@ -1163,6 +1166,7 @@ const CommodityDetail: SFC<CommodityDetailPropsType> = (props) => {
/>
)
}
{/* <MroModels CommodityDetail={commodityDetail} /> */}
<div className={styles.commodity_detail_body}>
<div className={styles.commodity_detail_body_left}>
{layoutType === LAYOUT_TYPE.shop && <ShopInfo {...props} />}
......
......@@ -270,7 +270,7 @@ const QuickNav: React.FC<QuickNavPropsType> = (props) => {
</div>
<div className={styles.navList_item}>
<div className={styles.navList_item_count}>{memberMallBacklog?.saleToBeDelivery || 0}</div>
<div className={styles.navList_item_text}><a href={`${MEMBER_CENTER_URL}/memberCenter/order/saleOrder/addSaleDelevedOrder`}>{getMessage('lxMall.QuickNav.index.ToShipped')}</a></div>
<div className={styles.navList_item_text}><a href={`${MEMBER_CENTER_URL}/memberCenter/order/saleOrder/readyAddDelevedOrder`}>{getMessage('lxMall.QuickNav.index.ToShipped')}</a></div>
</div>
<div className={styles.navList_item}>
<div className={styles.navList_item_count}>{memberMallBacklog?.saleToBeArchive || 0}</div>
......
......@@ -38,7 +38,9 @@ const Album: React.FC<AlbumProps> = (props) => {
</div>
)
}
<div className={styles.more_img} onClick={() => history.push(moreImgLink)}>{getMessage('shop.album.morePhoto')}</div>
{
workshopPics.length > 3 && <div className={styles.more_img} onClick={() => history.push(moreImgLink)}>{getMessage('shop.album.morePhoto')}</div>
}
</div>
</div>
</div>
......
......@@ -128,21 +128,23 @@ const ShopIndex: React.FC<ShopIndexPropsType> = (props) => {
if (firstCategory && firstCategory.length > 0) {
for (const item of firstCategory) {
const categoryDetail: any = await fetchCategoryById(item.categoryId)
result.push(
<ShopFloorLine
anchor={`floorline_${item.categoryId}`}
linkUrl={`/shop/${shopUrlParam}/commodity/c${item.categoryId}`}
key={item.categoryId}
title={item.categoryName}
>
<ShopFloorLine.Category
categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl}
categoryList={categoryDetail.categoryBOList}
if (categoryDetail?.isShow === 1) {
result.push(
<ShopFloorLine
anchor={`floorline_${item.categoryId}`}
linkUrl={`/shop/${shopUrlParam}/commodity/c${item.categoryId}`}
/>
<ShopFloorLine.Goods goodsList={categoryDetail.goodsBOList} linkUrl={`/shop/${shopUrlParam}/commodity/detail`} />
</ShopFloorLine>
)
key={item.categoryId}
title={item.categoryName}
>
<ShopFloorLine.Category
categoryAdvertPicUrl={categoryDetail.categoryAdvertPicUrl}
categoryList={categoryDetail.categoryBOList}
linkUrl={`/shop/${shopUrlParam}/commodity/c${item.categoryId}`}
/>
<ShopFloorLine.Goods goodsList={categoryDetail.goodsBOList} linkUrl={`/shop/${shopUrlParam}/commodity/detail`} />
</ShopFloorLine>
)
}
}
setCategoryComponents(result)
}
......
......@@ -22,7 +22,7 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-router-dom": "^5.1.2",
"react-router-dom": "~5.1.2",
"react-intl": "^5.20.10",
"serialize-javascript": "^2.1.2",
"umi-request": "^1.3.5",
......
......@@ -1061,7 +1061,7 @@ const CommodityDetail: SFC<CommodityDetailPropsType> = (props) => {
<Promotion data={marketingData?.tagDetailList} skuId={currentSku?.skuId} />
{/* 优惠券 */}
{
marketingData?.canUseCoupon === 1 && (
(marketingData?.canUseCoupon === 1 && commodityDetail?.priceType !== COMMODITY_TYPE.inquiry) && (
<Coupons
memberId={memberId}
data={marketingData?.couponList}
......
......@@ -22,7 +22,7 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-intl": "^5.20.10",
"react-router-dom": "^5.1.2",
"react-router-dom": "~5.1.2",
"serialize-javascript": "^2.1.2",
"umi-request": "^1.3.5",
"ykfe-utils": "^3.0.0"
......
......@@ -18,7 +18,7 @@
"mobx-react": "6.1.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.1.2",
"react-router-dom": "~5.1.2",
"react-intl": "^5.20.10",
"serialize-javascript": "^2.1.2",
"umi-request": "^1.3.5",
......
......@@ -18,7 +18,7 @@
"mobx-react": "6.1.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.1.2",
"react-router-dom": "~5.1.2",
"react-intl": "^5.20.10",
"serialize-javascript": "^2.1.2",
"umi-request": "^1.3.5",
......
......@@ -20,7 +20,7 @@
"qrcode": "^1.4.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.1.2",
"react-router-dom": "~5.1.2",
"react-intl": "^5.20.10",
"serialize-javascript": "^2.1.2",
"umi-request": "^1.3.5",
......
......@@ -22,7 +22,7 @@
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet": "^6.1.0",
"react-router-dom": "^5.1.2",
"react-router-dom": "~5.1.2",
"react-intl": "^5.20.10",
"serialize-javascript": "^2.1.2",
"umi-request": "^1.3.5",
......
......@@ -141,14 +141,16 @@ export class Page {
const memberId = getUrlMemberId(id)
if (memberId) {
const { channelInfo } = await this.service.getChannelSeo(memberId)
if (channelInfo.aboutUs) {
title = channelInfo.aboutUs.title
keyword = channelInfo.aboutUs.keywords
description = channelInfo.aboutUs.description
} else {
title = channelInfo.memberName
keyword = channelInfo.memberName
description = channelInfo.describe
if (channelInfo) {
if (channelInfo.aboutUs) {
title = channelInfo.aboutUs.title
keyword = channelInfo.aboutUs.keywords
description = channelInfo.aboutUs.description
} else {
title = channelInfo.memberName
keyword = channelInfo.memberName
description = channelInfo.describe
}
}
}
const config = Object.assign(this.ctx.app.config, ssrConfig, { keyword, description, title, themeName })
......
import { inject, Context } from 'midway'
import { Provide } from '@midwayjs/decorator'
import { Context } from 'midway'
import { HttpService } from '@midwayjs/axios'
import { Provide, Inject } from '@midwayjs/decorator'
import { IApiService, ChannelInfoApiResult, CommodityDetailApiResult } from '../interface'
@Provide('ApiService')
export class ApiService implements IApiService {
@inject()
@Inject()
ctx: Context
@Inject()
httpService: HttpService;
async getChannelSeo (memberId: number): Promise<ChannelInfoApiResult> {
try {
const result = await this.ctx.curl(`${this.ctx.app.config.baseApi}/template/web/memberSelfWeb/memberSelfMain`, {
method: 'GET',
data: {
const result = await this.httpService.get('/template/web/memberSelfWeb/memberSelfMain', {
params: {
memberId,
},
dataType: 'json'
}
})
return Promise.resolve({
channelInfo: result.data.data
channelInfo: result?.data
})
} catch (error) {
console.log('selfSeoError-----', error)
......@@ -28,24 +31,25 @@ export class ApiService implements IApiService {
}
}
async getCommodityDetail (commodityId: number, shopId: number, type: number): Promise<CommodityDetailApiResult> {
const result = await this.ctx.curl(`${this.ctx.app.config.baseApi}/search/shop/store/getCommodityDetail`, {
method: 'GET',
headers: {
'shopId': `${shopId}`,
'type': `${type}`
},
data: {
commodityId
},
dataType: 'json'
})
const commodityDetail = result.data.data
return Promise.resolve({
commodityDetail
})
async getCommodityDetail (commodityId: number, shopId: number): Promise<CommodityDetailApiResult> {
try {
const result = await this.httpService.get('/search/shop/store/getCommodityDetail', {
params: {
commodityId
},
headers: {
shopId
}
})
return Promise.resolve({
commodityDetail: result?.data
})
} catch (error) {
return Promise.resolve({
commodityDetail: {}
})
}
}
}
......@@ -165,17 +165,19 @@ const CommodityDetail: SFC<CommodityDetailPropsType> = (props) => {
useEffect(() => {
if (currentSku && commodityDetail) {
getPayWayListByMemberId(commodityDetail.memberId, commodityDetail.memberRoleId)
getMarketingCampaign({
shopId: mallId!,
categoryId: commodityDetail.customerCategory.id!,
brandId: commodityDetail.brand ? commodityDetail?.brand.id : undefined,
productId: commodityDetail.id!,
memberId: commodityDetail.memberId!,
roleId: commodityDetail.memberRoleId!,
skuId: currentSku.skuId,
filterGroup: false,
commodityType: MEMBER_COMMODITY
})
if (commodityDetail.priceType !== COMMODITY_TYPE.inquiry) {
getMarketingCampaign({
shopId: mallId!,
categoryId: commodityDetail.customerCategory.id!,
brandId: commodityDetail.brand ? commodityDetail?.brand.id : undefined,
productId: commodityDetail.id!,
memberId: commodityDetail.memberId!,
roleId: commodityDetail.memberRoleId!,
skuId: currentSku.skuId,
filterGroup: false,
commodityType: MEMBER_COMMODITY
})
}
}
}, [currentSku])
......@@ -1032,7 +1034,7 @@ const CommodityDetail: SFC<CommodityDetailPropsType> = (props) => {
<Promotion memberId={memberId} data={marketingData?.tagDetailList} skuId={currentSku?.skuId} />
{/* 优惠券 */}
{
marketingData?.canUseCoupon === 1 && (
(marketingData?.canUseCoupon === 1 && commodityDetail?.priceType !== COMMODITY_TYPE.inquiry) && (
<Coupons
memberId={memberId}
data={marketingData?.couponList}
......
......@@ -19,7 +19,7 @@
"qrcode.react": "^1.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.1.2",
"react-router-dom": "~5.1.2",
"react-intl": "^5.20.10",
"serialize-javascript": "^2.1.2",
"umi-request": "^1.3.5",
......
.filter_usearea {
padding-top: 15px;
.filter_usearea_list {
display: flex;
flex-direction: column;
max-height: 320px;
overflow-y: auto;
overflow-x: hidden;
&::-webkit-scrollbar {
width: 8px;
}
&::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: rgba(48, 49, 51, 0.24);
}
&::-webkit-scrollbar-track {
background: rgba(48, 49, 51, 0.08);
}
&_item {
position: relative;
margin-bottom: 10px;
font-size: 12px;
color: #303133;
&_title {
color: #909399;
}
&_areaList {
display: flex;
flex-wrap: wrap;
margin: 10px -4px 0 -4px;
&_item {
width: 46px;
height: 16px;
line-height: 16px;
background-color: #F4F5F7;
margin: 0 4px 8px 4px;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #606266;
cursor: pointer;
a {
display: block;
color: #606266;
}
&.active {
background-color: #DAF2E7;
color: #00a98f;
a {
color: #00a98f;
}
}
}
}
&>.text {
cursor: pointer;
}
&.active {
&>.text {
padding: 1px 3px;
background-color: var(--mall_main_color);
color: #ffffff;
}
}
.more_panel {
// position: relative;
margin-top: 5px;
.sub_area_list_hidden {
position: relative;
display: flex;
opacity: 0;
left: -1240px;
width: 240px;
flex-wrap: wrap;
padding: 10px 5px 0 5px;
}
.sub_area_list_item {
padding: 0 10px;
margin-bottom: 10px;
cursor: pointer;
&.active {
color: var(--mall_main_color);
}
}
.sub_area_list {
position: absolute;
width: 240px;
padding: 10px 5px 0 5px;
left: 0;
display: flex;
flex-wrap: wrap;
background-color: #F4F5F7;
}
}
}
}
}
import React, { useState, useEffect } from 'react'
import { GetSearchShopEnterpriseGetAreaResponse } from '@/services/SearchV2Api'
import { LAYOUT_TYPE } from '@/constants'
import { observer } from 'mobx-react'
import { Link } from 'react-router-dom'
import { getQueryString, changeURLArg, useMessageIntl } from '@linkseeks/lingxi-utils'
import { FilterStoreModal } from '@/store/filterStore/modal'
import pinyin from 'pinyin'
import FilterBox from '../FilterBox'
import cx from 'classnames'
import styles from './index.less'
interface CityListType {
title: string,
data: CityItemType[]
}
interface CityItemType {
cityName?: string;
cityCode?: string;
provinceName?: string,
provinceCode?: string,
title?: string;
}
interface UseAreaPropsType {
FilterStore?: FilterStoreModal;
layoutType?: LAYOUT_TYPE;
shopId?: number;
memberId?: number;
location?: {
pathname: string,
search: string
},
}
const UseArea: React.FC<UseAreaPropsType> = (props) => {
const { FilterStore } = props
const { useAreaList } = FilterStore || {}
const { pathname, search } = props.location || {}
const [areaList, setAreaList] = useState<CityListType[]>([])
const [selectCity, setSelectCity] = useState<string>()
const { getMessage } = useMessageIntl()
useEffect(() => {
if (useAreaList && useAreaList.length > 0) {
setAreaList(initDataList(useAreaList))
}
}, [useAreaList])
useEffect(() => {
if (search) {
const searchProvinceCode = getQueryString('provinceCode', search)
const searchCityCode = getQueryString('cityCode', search)
if (searchCityCode || searchProvinceCode) {
setSelectCity(searchCityCode || searchProvinceCode || "")
}
}
}, [search])
const initDataList = (list: GetSearchShopEnterpriseGetAreaResponse) => {
const newList = [...list]
const tempCityList: CityItemType[] = []
// 1.根据每个城市名获取首字母添加到数据中
newList.forEach((listItem) => {
if (listItem.cityList) {
listItem.cityList.forEach((cityItem) => {
const newCityItem: CityItemType = { ...cityItem }
if (newCityItem.cityName) {
const cityNameFirstWordPinyin = pinyin(newCityItem.cityName)[0][0]
const letter: string = cityNameFirstWordPinyin.split('')[0].toUpperCase()
newCityItem.title = letter
}
tempCityList.push(newCityItem)
})
}
})
// 2. 根据首字母对城市数组进行分组
const newCityList: CityListType[] = []
tempCityList.forEach((cityItem) => {
if (newCityList.every((item) => item.title !== cityItem.title)) {
newCityList.push({
title: cityItem.title || "",
data: [cityItem],
})
} else {
for (let i = 0; i < newCityList.length; i += 1) {
const newCityItem = newCityList[i]
if (newCityItem.title === cityItem.title) {
newCityItem.data = [...newCityItem.data, cityItem]
}
}
}
})
// 3. 根据字母进行排序
const sortData = newCityList.sort((a, b) => a.title.localeCompare(b.title))
// 4. 添加省份数据
sortData.unshift({
title: getMessage('locales.sheng', '省'),
data: list.map((dataItem) => ({
provinceName: dataItem.provinceName,
provinceCode: dataItem.provinceCode,
})),
})
return sortData
}
const getLink = (areaItem: CityItemType) => {
if (pathname) {
const url = `${pathname}${search}`
if (areaItem.provinceCode) {
if (search) {
return changeURLArg(url, 'provinceCode', areaItem.provinceCode)
} else {
return `${pathname}?provinceCode=${areaItem.provinceCode}`
}
} else if (areaItem.cityCode) {
if (search) {
return changeURLArg(url, 'cityCode', areaItem.cityCode)
} else {
return `${pathname}?cityCode=${areaItem.cityCode}`
}
}
}
return "#!"
}
return (
// {
areaList.length>0?<FilterBox
title={getMessage('locales.shiyongdiqu', '适用地区')}
>
<div className={styles.filter_usearea}>
<div className={styles.filter_usearea_list}>
{
areaList.map(item => (
<div key={`areaItem_${item.title}`} className={cx(styles.filter_usearea_list_item)}>
<div className={styles.filter_usearea_list_item_title}>
<span>{item.title}</span>
</div>
<div className={styles.filter_usearea_list_item_areaList}>
{
item.data && item.data.map((areaItem) => (
<div
className={cx(styles.filter_usearea_list_item_areaList_item, selectCity === (areaItem.cityCode || areaItem.provinceCode) ? styles.active : "")}
key={areaItem.cityCode || areaItem.provinceCode}
>
<Link to={getLink(areaItem)} title={areaItem.cityName || areaItem.provinceName}>{areaItem.cityName || areaItem.provinceName}</Link>
</div>
))
}
</div>
</div>
))
}
</div>
</div>
</FilterBox>:
<></>
// }
)
}
export default observer(UseArea)
......@@ -7,7 +7,6 @@ import { FilterStoreModal } from '@/store/filterStore/modal'
import Category from './components/Category'
import Brand from './components/Brand'
import Price from './components/Price'
import UseArea from './components/UseArea'
import CommodityType from './components/CommodityType'
import ActiveStores from './components/ActiveStores'
import NewJoin from './components/NewJoin'
......@@ -44,8 +43,6 @@ const Filter: React.FC<FilterPropsType> = (props) => {
return <Brand key={type} {...props} />
case FILTER_TYPE.price:
return <Price key={type} {...props} />
// case FILTER_TYPE.useArea:
// return <UseArea key={type} {...props} />
case FILTER_TYPE.commodityType:
return <CommodityType key={type} {...props} />
case FILTER_TYPE.activeStores:
......
......@@ -65,7 +65,7 @@ const MallLayout: SFC<LayoutProps> = (
useEffect(() => {
if (urlParam && urlParam.id) {
getMemberPurchaseMain(urlParam.id);
SiteStore.updateCurrentMallLink(`${SRM_CENTER_URL}/shopIndex/${urlParam.id}`)
SiteStore.updateCurrentMallLink(`${SRM_CENTER_URL}${shopId ? `/${shopId}` : ''}/shopIndex/${urlParam.id}`)
}
}, [urlParam]);
......
......@@ -12,6 +12,7 @@ import { ConfigProvider } from 'antd'
import 'moment/locale/zh-cn';
import locale from 'antd/lib/locale/zh_CN';
import { SelectAreaItemType } from '@linkseeks/lingxi-components/dist/SwitchCity/types'
import { findRouterShopId } from '@/utils'
interface LayoutProps {
children?: JSX.Element | null,
path: string,
......@@ -24,7 +25,7 @@ const ThemeLayout: SFC<LayoutProps> = (props: LayoutProps): JSX.Element | null =
const SiteStore: SiteStoreModal = useLocalStore(() => new store().SiteStore)
const { initMallInfoByHost, mallInfo, updateCurrentMallLink } = SiteStore
const history = useHistory()
const shopId = findRouterShopId(history?.location?.pathname)
const SrmShopId :string = JSON.stringify(mallInfo?.id)
if(SrmShopId && typeof(SrmShopId) == "string"){
......@@ -34,7 +35,7 @@ const ThemeLayout: SFC<LayoutProps> = (props: LayoutProps): JSX.Element | null =
console.log('SrmDataSource',getCookie('SrmDataSource'))
useEffect(() => {
console.log(currentCity, 'currentCity')
updateCurrentMallLink(SRM_CENTER_URL)
updateCurrentMallLink(SRM_CENTER_URL + (shopId ? '/'+ shopId : ''))
initMallInfoByHost(document.domain)
// 延迟显示公共布局200ms,让页面跳转url时隐藏公共布局
setLoading(true)
......
......@@ -116,6 +116,7 @@ function PurchaseModular(props: Props) {
isSign={isSign}
shopId={shopId}
isType={pageType}
isSubMember={item.isSubMember}
></InquiryCard>
</li>
})
......
import React,{ useState } from 'react'
import styles from './index.less'
import bannerImg from './1.png'
import { useMessageIntl } from '@linkseeks/lingxi-utils'
import React, { useState } from "react";
import styles from "./index.less";
import bannerImg from "./1.png";
import { useMessageIntl } from "@linkseeks/lingxi-utils";
interface Props {
companyImgList?:Array<any>,
shopMessageId?:string
companyImgList?: Array<any>;
shopMessageId?: string;
}
function CompanyAlbum(props: Props) {
const {
companyImgList=[bannerImg,bannerImg],
shopMessageId
} = props
const { getMessage } = useMessageIntl()
return (
<div className={styles['img-warp']}>
<div className={styles['title']}>{getMessage('locales.gongsixiangce', '公司相册')}</div>
<ul className={styles['box-warp']}>
<li className={styles['img-left']}>
<img src={companyImgList[0]} alt=""/>
</li>
<li className={styles['img-right']}>
{
companyImgList[1] &&
<div className={styles['img-rifht-top']}><img src={companyImgList[1]} alt=""/></div>
}
{
companyImgList.length>=2 &&
<li className={styles['box-warp']}>
{
companyImgList.map((url:string,index:number)=>{
if (index<2){
return;
}
if (index ==4){
return <div className={`${styles['box-left']} ${styles['show-more']}`}>
{getMessage('locales.gengduozhaopian', '更多照片')}
<a href={`/aboutUs/${shopMessageId}`} className='all-jump'></a>
</div>
}
if (index>2){
return;
}
return <div key={index + 'img'} className={styles['box-left']}><img src={url} alt=""/></div>
})
}
</li>
}
</li>
</ul>
</div>
)
const { companyImgList = [bannerImg, bannerImg], shopMessageId } = props;
const { getMessage } = useMessageIntl();
return (
<div className={styles["img-warp"]}>
<div className={styles["title"]}>
{getMessage("locales.gongsixiangce", "公司相册")}
</div>
<ul className={styles["box-warp"]}>
<li className={styles["img-left"]}>
<img src={companyImgList[0]} alt="" />
</li>
<li className={styles["img-right"]}>
{companyImgList[1] && (
<div className={styles["img-rifht-top"]}>
<img src={companyImgList[1]} alt="" />
</div>
)}
{companyImgList.length > 2 && (
<li className={styles["box-warp"]}>
<div className={styles["box-left"]}>
<img src={companyImgList[2]} alt="" />
</div>
{companyImgList.length > 3 && (
<div
className={`${styles["box-left"]} ${styles["show-more"]}`}
>
{getMessage("locales.gengduozhaopian", "更多照片")}
<a
href={`/aboutUs/${shopMessageId}`}
className="all-jump"
></a>
</div>
)}
</li>
)}
</li>
</ul>
</div>
);
}
export default CompanyAlbum
export default CompanyAlbum;
......@@ -79,11 +79,11 @@ function InquiryCard(props: Props) {
* 获取跳转报名的链接
*/
const fnGetsignUpUrl = () => {
if (jumpUrl === 'InquiryDetail') { // 询价
if (jumpUrl.indexOf('InquiryDetail') > -1) { // 询价
return `${MEMBER_CENTER_URL}/memberCenter/procurementAbility/offter/quote?id=${id}&number=${purchaseInquiryNo}`
} else if (jumpUrl === 'competeDetail') { // 竞价
} else if (jumpUrl.indexOf('competeDetail') > -1) { // 竞价
return `${MEMBER_CENTER_URL}/memberCenter/procurementAbility/onlineBid/readySignUp/signUp?id=${id}&number=${purchaseInquiryNo}`
} else if (jumpUrl === 'biddingDetail') { // 招标
} else if (jumpUrl.indexOf('biddingDetail') > -1) { // 招标
return `${MEMBER_CENTER_URL}/memberCenter/procurementAbility/tender/readyBidRegister/add?id=${id}`
}
return ''
......
......@@ -61,8 +61,8 @@ export const compareTime = (startTime: string,endTime: string): boolean => {
* 查找路由中的商城id
*/
export const findRouterShopId = ()=>{
const pathname = window.location.pathname
export const findRouterShopId = (path?:string)=>{
const pathname = path ? path : window?.location?.pathname
let shopId = findStrIndex(pathname,'/',1) > -1 ? pathname.substring(findStrIndex(pathname,'/',0) + 1 , findStrIndex(pathname,'/',1) ) : pathname.substring(findStrIndex(pathname,'/',0) + 1 )
return Number(shopId) > 0 ? shopId : '';
......
......@@ -86,7 +86,8 @@
"react-dom": ">=16.12.0"
},
"resolutions": {
"@types/react": "17.0.44"
"@types/react": "17.0.44",
"@antv/g2": "4.1.32"
},
"workspaces": {
"packages": [
......@@ -98,6 +99,7 @@
}
},
"dependencies": {
"@types/js-cookie": "^3.0.1",
"pm2": "^5.1.0",
"react-intl": "^5.20.10"
},
......
......@@ -32,10 +32,9 @@
"antd": "^4.15.1",
"classnames": "^2.2.6",
"js-cookie": "^2.2.1",
"@linkseeks/lingxi-utils": "^1.0.0",
"react": "^17.0.2",
"react": "17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.1.2"
"react-router-dom": "~5.1.2"
},
"devDependencies": {
"@umijs/test": "^3.0.5",
......
......@@ -31,7 +31,7 @@
"@types/crypto-js": "^4.0.1",
"crypto-js": "^4.0.0",
"js-cookie": "^2.2.1",
"react": "^17.0.0",
"react": "17.0.2",
"react-intl": "^5.20.10"
},
"devDependencies": {
......
......@@ -38,7 +38,7 @@
"@linkseeks/lingxi-utils": "^1.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.1.2"
"react-router-dom": "~5.1.2"
},
"devDependencies": {
"@umijs/test": "^3.0.5",
......
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