Commit 56ecb93c authored by 前端-许佳敏's avatar 前端-许佳敏
parents f962a1b5 5cdb0772
......@@ -209,7 +209,7 @@ const Products: React.FC<{}> = () => {
const handleSearch = (val: string) => {
console.log(val)
let obj = {...filterParams, name: val}
let obj = val ? {...filterParams, name: val} : { ...filterParams }
setFilterParams(obj)
//@ts-ignore
ref.current.reload(obj)
......@@ -322,6 +322,9 @@ const Products: React.FC<{}> = () => {
/>
</Input.Group>
</Col>
<Col>
<Button type="primary" onClick={()=>handleSearch()}>查询</Button>
</Col>
</Col>
</Row>
</Col>
......
......@@ -49,6 +49,9 @@ const viewProducts: React.FC<{}> = () => {
const [imageArrByImageRender, setImageArrByImageRender] = useState<any[]>([])
const [checkStatus, setCheckStatus] = useState<number>(4)
const [disableCheck, setDisableCheck] = useState<boolean>(false)
const [logisticTemplateName, setLogisticTemplateName] = useState<string>()
const [logisticResourceCompanyName, setLogisticResourceCompanyName] = useState<string>()
const [logisticResourceSendAddress, setLogisticResourceSendAddress] = useState<string>()
useEffect(() => {
const { id } = history.location.query
......@@ -56,9 +59,10 @@ const viewProducts: React.FC<{}> = () => {
PublicApi.getProductCommodityGetCommodity({id: id}).then(res=>{
const { code, data } = res
if(code===1000){
console.log(data, 'data')
// console.log(data, 'data')
setPorductDetail(data)
renderDataByTab(data)
renderLogistics(data.logistics)
constructTableData(data.name, data.unitPriceAndPicList)
if(data.status===1) setFixStep(0)
else if(data.status===2) setFixStep(1)
......@@ -78,6 +82,26 @@ const viewProducts: React.FC<{}> = () => {
}
}, [])
const renderLogistics = (params) => {
console.log(params, 'params')
if(params?.templateId)
PublicApi.getLogisticsFreightTemplateGet({id: params.templateId}).then(res => {
setLogisticTemplateName(res.data?.name)
})
if(params?.company)
PublicApi.getLogisticsCompanyGet({id: params.company}).then(res => {
if(res.code === 1000)
setLogisticResourceCompanyName(res.data?.name)
})
if(params?.sendAddress)
PublicApi.getLogisticsShipperAddressGet({id: params.sendAddress}).then(res => {
if(res.code === 100){
const { provinceName, cityName, districtName, address } = res.data
setLogisticResourceSendAddress(provinceName + cityName + districtName + address)
}
})
}
const columns: ColumnType<any>[] = [
{
title: '序号',
......@@ -102,7 +126,7 @@ const viewProducts: React.FC<{}> = () => {
else if (record.status === 4)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (record.status === 3)
component = (<><span className="commonStatusInvalid">审核不通过</span></>)
component = (<><span className="commonStatusInvalid"></span>审核不通过</>)
return component
}
},
......@@ -190,7 +214,7 @@ const viewProducts: React.FC<{}> = () => {
const content = <>
<Descriptions colon={true} style={{paddingLeft:128}}>
<Descriptions.Item label="商品品牌">{productDetail?.brand?.name}</Descriptions.Item>
<Descriptions.Item label="商品品类">{productDetail?.customerCategoryFullName}</Descriptions.Item>
<Descriptions.Item label="商品品类">{productDetail?.customerCategory?.fullName}</Descriptions.Item>
<Descriptions.Item label="上架商城">
{
productDetail?.commodityShopList?.length>0 && productDetail.commodityShopList.map((item, index)=><span key={index}>{item.name}&nbsp;</span>)
......@@ -407,7 +431,7 @@ const viewProducts: React.FC<{}> = () => {
<p>运费模版:</p>
</Col>
<Col span={20}>
<p>快递按重量计算运费模版</p>
<p>{logisticTemplateName}</p>
</Col>
</Row>
<Row>
......@@ -415,7 +439,7 @@ const viewProducts: React.FC<{}> = () => {
<p>物流公司:</p>
</Col>
<Col span={20}>
<p>{productDetail?.logistics?.company}</p>
<p>{logisticResourceCompanyName}</p>
</Col>
</Row>
<Row>
......@@ -423,7 +447,7 @@ const viewProducts: React.FC<{}> = () => {
<p>发货地址:</p>
</Col>
<Col span={20}>
<p>{productDetail?.logistics?.sendAddress}</p>
<p>{logisticResourceSendAddress}</p>
</Col>
</Row>
</Card>
......
......@@ -210,9 +210,9 @@ const Products: React.FC<{}> = () => {
console.log(value, 'handleClassChange')
}
const handleSearch = (val: string) => {
const handleSearch = (val?: string) => {
console.log(val)
let obj = {...filterParams, name: val}
let obj = val ? {...filterParams, name: val} : { ...filterParams }
setFilterParams(obj)
//@ts-ignore
ref.current.reload(obj)
......@@ -335,6 +335,9 @@ const Products: React.FC<{}> = () => {
/>
</Input.Group>
</Col>
<Col>
<Button type="primary" onClick={()=>handleSearch()}>查询</Button>
</Col>
</Col>
</Row>
</Col>
......
......@@ -48,6 +48,9 @@ const viewProducts: React.FC<{}> = () => {
const [tableRenderDatas, setTableRenderDatas] = useState<any[]>([])
const [attributeArrByImageRender, setAttributeArrByImageRender] = useState<any[]>([])
const [imageArrByImageRender, setImageArrByImageRender] = useState<any[]>([])
const [logisticTemplateName, setLogisticTemplateName] = useState<string>()
const [logisticResourceCompanyName, setLogisticResourceCompanyName] = useState<string>()
const [logisticResourceSendAddress, setLogisticResourceSendAddress] = useState<string>()
useEffect(() => {
const { id } = history.location.query
......@@ -55,9 +58,9 @@ const viewProducts: React.FC<{}> = () => {
PublicApi.getProductCommodityGetCommodity({id: id}).then(res=>{
const { code, data } = res
if(code===1000){
console.log(data, 'data')
setPorductDetail(data)
renderDataByTab(data)
renderLogistics(data.logistics)
constructTableData(data.name, data.unitPriceAndPicList)
if(data.status===1) setFixStep(0)
else if(data.status===2) setFixStep(1)
......@@ -69,14 +72,32 @@ const viewProducts: React.FC<{}> = () => {
})
PublicApi.getProductCommodityGetCommodityCheckRecord({commodityId: id}).then(res=>{
const { code, data } = res
if(code===1000){
console.log(data)
if(code===1000)
setCheckRecord(data)
}
})
}
}, [])
const renderLogistics = (params) => {
console.log(params, 'params')
if(params?.templateId)
PublicApi.getLogisticsFreightTemplateGet({id: params.templateId}).then(res => {
setLogisticTemplateName(res.data?.name)
})
if(params?.company)
PublicApi.getLogisticsCompanyGet({id: params.company}).then(res => {
if(res.code === 1000)
setLogisticResourceCompanyName(res.data?.name)
})
if(params?.sendAddress)
PublicApi.getLogisticsShipperAddressGet({id: params.sendAddress}).then(res => {
if(res.code === 100){
const { provinceName, cityName, districtName, address } = res.data
setLogisticResourceSendAddress(provinceName + cityName + districtName + address)
}
})
}
const columns: ColumnType<any>[] = [
{
title: '序号',
......@@ -101,7 +122,7 @@ const viewProducts: React.FC<{}> = () => {
else if (record.status === 4)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (record.status === 3)
component = (<><span className="commonStatusInvalid">审核不通过</span></>)
component = (<><span className="commonStatusInvalid"></span>审核不通过</>)
return component
}
},
......@@ -144,7 +165,7 @@ const viewProducts: React.FC<{}> = () => {
let dataByTab = groupBy(archiveByAttributeGroup, 'groupName')
setDataByTab(Object.values(dataByTab))
setDataByTabTitle(Object.keys(dataByTab))
console.log(dataByTab,'dataByData')
// console.log(dataByTab,'dataByData')
}
/* 按属性归类 */
......@@ -191,7 +212,7 @@ const viewProducts: React.FC<{}> = () => {
const content = <>
<Descriptions colon={true} style={{paddingLeft:128}}>
<Descriptions.Item label="商品品牌">{productDetail?.brand?.name}</Descriptions.Item>
<Descriptions.Item label="商品品类">{productDetail?.customerCategoryFullName}</Descriptions.Item>
<Descriptions.Item label="商品品类">{productDetail?.customerCategory?.fullName}</Descriptions.Item>
<Descriptions.Item label="上架商城">
{
productDetail?.commodityShopList?.length>0 && productDetail.commodityShopList.map((item, index)=><span key={index}>{item.name}&nbsp;</span>)
......@@ -214,7 +235,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)
......@@ -284,7 +305,7 @@ const viewProducts: React.FC<{}> = () => {
}
return temp
})
console.log(_tableData, _attributeArrByImageRender, '_tableData')
// console.log(_tableData, _attributeArrByImageRender, '_tableData')
setTableRenderDatas(_tableData)
setAttributeArrByImageRender(_attributeArrByImageRender)
setImageArrByImageRender(_imageArrByImageRender)
......@@ -377,7 +398,7 @@ const viewProducts: React.FC<{}> = () => {
<p>运费模版:</p>
</Col>
<Col span={20}>
<p>快递按重量计算运费模版</p>
<p>{logisticTemplateName}</p>
</Col>
</Row>
<Row>
......@@ -385,7 +406,7 @@ const viewProducts: React.FC<{}> = () => {
<p>物流公司:</p>
</Col>
<Col span={20}>
<p>{productDetail?.logistics?.company}</p>
<p>{logisticResourceCompanyName}</p>
</Col>
</Row>
<Row>
......@@ -393,7 +414,7 @@ const viewProducts: React.FC<{}> = () => {
<p>发货地址:</p>
</Col>
<Col span={20}>
<p>{productDetail?.logistics?.sendAddress}</p>
<p>{logisticResourceSendAddress}</p>
</Col>
</Row>
</Card>
......
......@@ -39,6 +39,7 @@ const errorMessage: httpStatus = {
const defaultHeaders = {
'Content-Type': 'Application/json',
'token': '21954519911775ff2c65fa5887b9b11b',
'source': '99'
}
......
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