Commit 4d63c859 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理新增渠道商品价格设置异常和提交字段异常

parent 301e31ae
......@@ -82,7 +82,7 @@ const SetPrice:React.FC<IProps> = (props) => {
}, [priceTableData])
useEffect(() => {
if(productSelectRowInStore.priceType === 3) {
if(productSelectRowInStore?.priceType === 3) {
// 积分
formPrice.setFieldsValue({isMemberPrice: false})
setDisabledMemberPrice(true)
......@@ -108,7 +108,7 @@ const SetPrice:React.FC<IProps> = (props) => {
}
const structureTable = (data: any, name?: string) => {
console.log(data, 'structureTableData')
// console.log(data, 'structureTableData')
// 构建table 列columns
let col: any = []
let temp: any = []
......@@ -162,6 +162,11 @@ const SetPrice:React.FC<IProps> = (props) => {
item.attributeAndValueList.map(_item => {
temp[_item.customerAttribute.name] = {value: _item.customerAttributeValue.value, vId: _item.customerAttributeValue.id, id: _item.customerAttribute.id }
})
// 预先排序
let tempUnit = {}
Object.keys(item.unitPrice).sort((a: any, b: any)=>a.split('-')[0] - b.split('-')[0]).forEach( key => {
tempUnit[key] = item.unitPrice[key];
})
_tableData.push({
"id": item.id, // 行数据id
"goodsId": item.goods?.id || '', // 货品ID 可能为null
......@@ -170,7 +175,7 @@ const SetPrice:React.FC<IProps> = (props) => {
"商品名称": name || productName,
"对应货品": item.goods?.name || '',
...temp,
"单价": item.unitPrice
"单价": tempUnit
})
})
setSpecTableData(_tableData)
......@@ -256,7 +261,7 @@ const SetPrice:React.FC<IProps> = (props) => {
if(isBatchSetting){ // 判断是否批量设置价格
newTabeData.map(_item => _item['单价'] = _priceRange)
}else{
newTabeData[curretSetPriceRow['索引']] = _row
newTabeData = newTabeData.map(_item => _item['id'] === curretSetPriceRow['id'] ? _row : _item)
}
setPriceTableData(newTabeData)
constructedPrarams()
......
......@@ -52,7 +52,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
let params: any = {}
console.log(values, 'vvv')
values.map((item, index) => {
if(index !== 2)
if(!item?.carriageType)
params = { ...params, ...item }
else
params.logistics = { ...item }
......
......@@ -337,7 +337,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if(productInfoByEdit.unitPriceAndPicList[i]?.unitPrice) {
let tempUnit = {}
let unitPric = productInfoByEdit.unitPriceAndPicList[i]?.unitPrice
Object.keys(unitPric).sort().forEach(function(key) {
Object.keys(unitPric).sort().forEach(key => {
tempUnit[key] = unitPric[key];
})
_tempObj['单价'] = tempUnit
......@@ -349,7 +349,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if(_tableDataSource[i] && tableDataSource[i] && tableDataSource[i]['单价']) {
let tempUnit = {}
let unitPric = _tableDataSource[i] && tableDataSource[i] && tableDataSource[i]['单价']
Object.keys(unitPric).sort().forEach(function(key) {
Object.keys(unitPric).sort().forEach(key => {
tempUnit[key] = unitPric[key]
})
_tempObj['单价'] = tempUnit
......@@ -416,7 +416,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
id: attributeObjArr[_index].customerAttributeId,
name: attributeObjArr[_index].attributeName
}
console.log(attributeValObjArr, item, index, _item, _index, _tableDataSource, '调试属性')
// console.log(attributeValObjArr, item, index, _item, _index, _tableDataSource, '调试属性')
_tempObject.customerAttributeValue = {
// @fixed bug: 属性名称相同的情况下 只找第一个元素 会出现id异常
// id: attributeValObjArr.map(__item => __item.find(_ => _.value===_item)).filter(__ => __)[0].id,
......
......@@ -169,6 +169,7 @@ const DirectChannel: React.FC<{}> = () => {
{
title: '操作',
dataIndex: 'option',
width: 150,
render: (text:any, record:any) => {
return (
<>
......
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