Commit 37ea23df authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 商品上架商城和归属地显示变更

parent 13c32d69
......@@ -3,6 +3,8 @@ import { history } from 'umi'
import { Button, Steps, Card, Space, Modal, Form, Row, Col, Descriptions, Table, Tabs, Tag, Divider, Radio, Input } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
CaretDownOutlined,
CaretUpOutlined,
CheckSquareOutlined
} from '@ant-design/icons'
import { ColumnType } from 'antd/lib/table/interface'
......@@ -53,6 +55,7 @@ const viewProducts: React.FC<{}> = () => {
const [logisticTemplateName, setLogisticTemplateName] = useState<string>()
const [logisticResourceCompanyName, setLogisticResourceCompanyName] = useState<string>()
const [logisticResourceSendAddress, setLogisticResourceSendAddress] = useState<string>()
const [showMore, setShowMore] = useState<any>({ areaShowMore: false, shopShowMore: false })
useEffect(() => {
const { id } = history.location.query
......@@ -96,7 +99,7 @@ const viewProducts: React.FC<{}> = () => {
if(productDetail?.logistics?.sendAddress)
PublicApi.getLogisticsShipperAddressGet({id: productDetail?.logistics?.sendAddress + ''}).then(res => {
const { provinceName, cityName, districtName, address } = res.data
console.log(provinceName + cityName + districtName + address)
// console.log(provinceName + cityName + districtName + address)
setLogisticResourceSendAddress(provinceName + cityName + districtName + address)
})
}, [productDetail])
......@@ -218,11 +221,11 @@ const viewProducts: React.FC<{}> = () => {
<Descriptions colon={true} style={{paddingLeft:128}}>
<Descriptions.Item label="商品品牌">{productDetail?.brand?.name}</Descriptions.Item>
<Descriptions.Item label="商品品类">{productDetail?.customerCategory?.fullName}</Descriptions.Item>
<Descriptions.Item label="上架商城">
{/* <Descriptions.Item label="上架商城">
{
productDetail?.commodityShopList?.length>0 && productDetail.commodityShopList.map((item, index)=><span key={index}>{item.name}&nbsp;</span>)
}
</Descriptions.Item>
</Descriptions.Item> */}
{renderStatus(productDetail?.status, 1) && <Descriptions.Item label="审核状态">{renderStatus(productDetail?.status, 1)}</Descriptions.Item>}
{renderStatus(productDetail?.status, 2) && <Descriptions.Item label="商品状态">{renderStatus(productDetail?.status, 2)}</Descriptions.Item>}
<Descriptions.Item label="商品类型"><span className="commonStatusValid"></span>{renderCustomerCategoryType(productDetail?.customerCategory?.type)}</Descriptions.Item>
......@@ -250,7 +253,7 @@ const viewProducts: React.FC<{}> = () => {
/* 构建表格数据 */
const constructTableData = (productName: string, unitPriceAndPicList: GetProductCommodityGetCommodityResponse["unitPriceAndPicList"]) => {
// 构建列
console.log(productName, unitPriceAndPicList, '构建列')
// console.log(productName, unitPriceAndPicList, '构建列')
let _col:any = [];
let col_productName: IColumn = { title: '商品名称', dataIndex: '商品名称', key: '索引' }
_col.push(col_productName)
......@@ -320,7 +323,7 @@ const viewProducts: React.FC<{}> = () => {
}
return temp
})
console.log(_tableData, _attributeArrByImageRender, '_tableData')
// console.log(_tableData, _attributeArrByImageRender, '_tableData')
setTableRenderDatas(_tableData)
setAttributeArrByImageRender(_attributeArrByImageRender)
setImageArrByImageRender(_imageArrByImageRender)
......@@ -336,7 +339,7 @@ const viewProducts: React.FC<{}> = () => {
const handleOK = () => {
checkForm.validateFields().then(values => {
console.log(values, 'value')
// console.log(values, 'value')
PublicApi.postProductCommodityCheckCommodity({ id: productDetail?.id, ...values }).then(res=>{
if(res.code===1000){
handleCancel()
......@@ -352,6 +355,41 @@ const viewProducts: React.FC<{}> = () => {
setVisibleModal(false)
}
const toogleMore = (str: string) => {
if(str === 'area'){
setShowMore({
shopShowMore: showMore.shopShowMore,
areaShowMore: !showMore.areaShowMore
})
}else{
setShowMore({
shopShowMore: !showMore.shopShowMore,
areaShowMore: showMore.areaShowMore
})
}
}
const renderMoreList = (data, str) => {
const showDataSource = (str === 'area' ? showMore.areaShowMore : showMore.shopShowMore) ? data : [...data].splice(0, 3)
return <>
<p>
{
str === 'area'
?
showDataSource.map((_item, _i) => <p key={_i}>{_item.provinceName+'/'+(_item.cityName||'')}</p>)
:
showDataSource.map((_item, _i) => <p key={_i}>{_item.name}</p>)
}
</p>
{
data.length > 3 &&
<p onClick={()=>toogleMore(str)} style={{ cursor: 'pointer' }} className="commonPickColor">
展开{showMore.areaShowMore ? <CaretDownOutlined /> : <CaretUpOutlined />}
</p>
}
</>
}
return (
<PageHeaderWrapper
title={productDetail?.name}
......@@ -411,11 +449,26 @@ const viewProducts: React.FC<{}> = () => {
<Col span={20}>
<p>
{
productDetail?.commodityAreaList.length>0 ? productDetail?.commodityAreaList.map(_item => <p>{_item.provinceName+'/'+(_item.cityName||'')}</p>) : '全国'
productDetail?.commodityAreaList.length>0 ? renderMoreList(productDetail?.commodityAreaList, 'area') : '全国'
}
</p>
</Col>
</Row>
{
productDetail?.commodityShopList?.length>0 &&
<Row>
<Col span={4}>
<p>上架商城:</p>
</Col>
<Col span={20}>
<p>
{
renderMoreList(productDetail.commodityShopList, 'shop')
}
</p>
</Col>
</Row>
}
</Card>
</Col>
<Col span={8}>
......
......@@ -12,6 +12,7 @@ import {
GetProductCommodityGetCommodityCheckRecordResponse,
} from '@/services'
import moment from 'moment'
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons'
interface IAttributeByValue {
groupName?: string;
......@@ -46,6 +47,7 @@ const viewProducts: React.FC<{}> = () => {
const [logisticTemplateName, setLogisticTemplateName] = useState<string>()
const [logisticResourceCompanyName, setLogisticResourceCompanyName] = useState<string>()
const [logisticResourceSendAddress, setLogisticResourceSendAddress] = useState<string>()
const [showMore, setShowMore] = useState<any>({ areaShowMore: false, shopShowMore: false })
useEffect(() => {
const { id } = history.location.query
......@@ -209,11 +211,11 @@ const viewProducts: React.FC<{}> = () => {
<Descriptions colon={true} style={{paddingLeft:128}}>
<Descriptions.Item label="商品品牌">{productDetail?.brand?.name}</Descriptions.Item>
<Descriptions.Item label="商品品类">{productDetail?.customerCategory?.fullName}</Descriptions.Item>
<Descriptions.Item label="上架商城">
{/* <Descriptions.Item label="上架商城">
{
productDetail?.commodityShopList?.length>0 && productDetail.commodityShopList.map((item, index)=><span key={index}><img width="24" height="24" style={{borderRadius: '50%', marginRight: 4}} src={item.logoUrl} title={item.name} alt={item.name}/></span>)
}
</Descriptions.Item>
</Descriptions.Item> */}
{renderStatus(productDetail?.status, 1) && <Descriptions.Item label="审核状态">{renderStatus(productDetail?.status, 1)}</Descriptions.Item>}
{renderStatus(productDetail?.status, 2) && <Descriptions.Item label="商品状态">{renderStatus(productDetail?.status, 2)}</Descriptions.Item>}
<Descriptions.Item label="商品类型"><span className="commonStatusValid"></span>{renderCustomerCategoryType(productDetail?.customerCategory?.type)}</Descriptions.Item>
......@@ -317,6 +319,41 @@ const viewProducts: React.FC<{}> = () => {
setImageArrByImageRender(_imageArrByImageRender)
}
const toogleMore = (str: string) => {
if(str === 'area'){
setShowMore({
shopShowMore: showMore.shopShowMore,
areaShowMore: !showMore.areaShowMore
})
}else{
setShowMore({
shopShowMore: !showMore.shopShowMore,
areaShowMore: showMore.areaShowMore
})
}
}
const renderMoreList = (data, str) => {
const showDataSource = (str === 'area' ? showMore.areaShowMore : showMore.shopShowMore) ? data : [...data].splice(0, 3)
return <>
<p>
{
str === 'area'
?
showDataSource.map((_item, _i) => <p key={_i}>{_item.provinceName+'/'+(_item.cityName||'')}</p>)
:
showDataSource.map((_item, _i) => <p key={_i}>{_item.name}</p>)
}
</p>
{
data.length > 3 &&
<p onClick={()=>toogleMore(str)} style={{ cursor: 'pointer' }} className="commonPickColor">
展开{showMore.areaShowMore ? <CaretDownOutlined /> : <CaretUpOutlined />}
</p>
}
</>
}
return (
<PageHeaderWrapper
title={productDetail?.name}
......@@ -342,7 +379,7 @@ const viewProducts: React.FC<{}> = () => {
<Space direction="vertical" style={{width:'100%'}}>
<Row gutter={[26,0]}>
<Col span={8}>
<Card headStyle={{borderBottom:'none'}} title="基本信息" style={{height:'320px'}}>
<Card headStyle={{borderBottom:'none'}} title="基本信息" style={{height:'100%'}}>
{
productDetail?.slogan && <Row>
<Col span={4}>
......@@ -370,15 +407,30 @@ const viewProducts: React.FC<{}> = () => {
<Col span={20}>
<p>
{
productDetail?.commodityAreaList.length>0 ? productDetail?.commodityAreaList.map(_item => <p>{_item.provinceName+'/'+(_item.cityName||'')}</p>) : '全国'
productDetail?.commodityAreaList.length>0 ? renderMoreList(productDetail?.commodityAreaList, 'area') : '全国'
}
</p>
</Col>
</Row>
{
productDetail?.commodityShopList?.length>0 &&
<Row>
<Col span={4}>
<p>上架商城:</p>
</Col>
<Col span={20}>
<p>
{
renderMoreList(productDetail.commodityShopList, 'shop')
}
</p>
</Col>
</Row>
}
</Card>
</Col>
<Col span={8}>
<Card headStyle={{borderBottom:'none'}} title="物流信息" style={{height:'320px'}}>
<Card headStyle={{borderBottom:'none'}} title="物流信息" style={{height:'100%'}}>
{
renderDeliveryType(productDetail?.logistics?.deliveryType) &&
<Row>
......@@ -448,7 +500,7 @@ const viewProducts: React.FC<{}> = () => {
</Card>
</Col>
<Col span={8}>
<Card headStyle={{borderBottom:'none'}} title="其他信息" style={{height:'320px'}}>
<Card headStyle={{borderBottom:'none'}} title="其他信息" style={{height:'100%'}}>
<Row>
<Col span={4}>
<p>提供发票:</p>
......
......@@ -13,7 +13,6 @@ import {
} from '@ant-design/icons'
import { Button, message } from 'antd'
import NiceForm from '@/components/NiceForm'
import ModalTable from '@/components/ModalTable'
import { GlobalConfig } from '@/global/config'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import SearchSelect from '@/components/NiceForm/components/SearchSelect'
......@@ -23,6 +22,7 @@ import Submit from '@/components/NiceForm/components/Submit'
import LevelBrand from '@/pages/member/components/LevelBrand'
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect'
import SelectProcesss from './selectProcesss'
import ModalTable from '@/components/ModalTable'
export interface RuleSettingProps {
addSchemaAction: ISchemaFormActions,
......
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