Commit 7a9b7da7 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 商品详情添加副单价、

parent 3d53e635
......@@ -251,7 +251,7 @@ const viewProducts: React.FC<{}> = () => {
}
/* 构建表格数据 */
const constructTableData = (product: string, unitPriceAndPicList: GetProductCommodityGetCommodityResponse["unitPriceAndPicList"]) => {
const constructTableData = (product: any, unitPriceAndPicList: GetProductCommodityGetCommodityResponse["unitPriceAndPicList"]) => {
// 构建列
// console.log(productName, unitPriceAndPicList, '构建列')
let _col: any = [];
......@@ -294,6 +294,18 @@ const viewProducts: React.FC<{}> = () => {
})
}
})
_col.push({
title: product?.planPrice===3?'积分(副单位)':'单价(副单位)',
dataIndex: '副单价',
key: '副单价',
render: (text) => {
if(text && Array.isArray(text)) {
return text.map(p => <p>{product?.planPrice===3 ? p : `¥${p}`}</p>)
} else if(text) {
return product?.planPrice===3 ? text : `¥${text}`
}
}
})
setTableColumns(_col)
......@@ -314,12 +326,19 @@ const viewProducts: React.FC<{}> = () => {
attrWithObj = { ...attrWithObj, ...t }
}
_attributeArrByImageRender.push(attrWithObj)
const _price = sortLadderPrice(item.unitPrice)
const _priceRate = item.priceRate
const _priceNumber = Object.keys(_price)[0] === '0-0' ? Object.values(_price)[0] : Object.values(_price)
let temp = {
"索引": index,
"商品名称": product['name'],
"对应货品": item.goods?.code + '/' + item.goods?.name + '/' + item.goods?.type,
...attrWithObj,
"单价": sortLadderPrice(item.unitPrice),
"单价": _price,
'副单价率': _priceRate,
'副单价': Array.isArray(_priceNumber) ? _priceNumber.map(_p => (Number(_p) * Number(_priceRate) / 100).toFixed(2)) : (Number(_priceNumber) * Number(_priceRate) / 100).toFixed(2)
}
return temp
})
......@@ -619,6 +638,16 @@ const viewProducts: React.FC<{}> = () => {
<p>{productDetail?.unitName}</p>
</Col>
</Row>
{
productDetail?.subUnitName ? <Row>
<Col span={2}>
<p>计量副单位:</p>
</Col>
<Col span={22}>
<p>{productDetail?.subUnitName}</p>
</Col>
</Row> : null
}
<Row>
<Col span={2}>
<p>最小起订:</p>
......
......@@ -284,6 +284,18 @@ const viewProducts: React.FC<{}> = () => {
})
}
})
_col.push({
title: product?.planPrice===3?'积分(副单位)':'单价(副单位)',
dataIndex: '副单价',
key: '副单价',
render: (text) => {
if(text && Array.isArray(text)) {
return text.map(p => <p>{product?.planPrice===3 ? p : `¥${p}`}</p>)
} else if(text) {
return product?.planPrice===3 ? text : `¥${text}`
}
}
})
setTableColumns(_col)
......@@ -304,12 +316,19 @@ const viewProducts: React.FC<{}> = () => {
attrWithObj = {...attrWithObj, ...t}
}
_attributeArrByImageRender.push(attrWithObj)
const _price = sortLadderPrice(item.unitPrice)
const _priceRate = item.priceRate
const _priceNumber = Object.keys(_price)[0] === '0-0' ? Object.values(_price)[0] : Object.values(_price)
let temp = {
"索引": index,
"商品名称": product.name,
"对应货品": item.goods?.code+'/'+item.goods?.name+'/'+item.goods?.type,
...attrWithObj,
"单价": sortLadderPrice(item.unitPrice),
"单价": _price,
'副单价率': _priceRate,
'副单价': Array.isArray(_priceNumber) ? _priceNumber.map(_p => (Number(_p) * Number(_priceRate) / 100).toFixed(2)) : (Number(_priceNumber) * Number(_priceRate) / 100).toFixed(2)
}
return temp
})
......@@ -577,6 +596,16 @@ const viewProducts: React.FC<{}> = () => {
<p>{productDetail?.unitName}</p>
</Col>
</Row>
{
productDetail?.subUnitName ? <Row>
<Col span={2}>
<p>计量副单位:</p>
</Col>
<Col span={22}>
<p>{productDetail?.subUnitName}</p>
</Col>
</Row> : null
}
<Row>
<Col span={2}>
<p>最小起订:</p>
......
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