Commit 6b893492 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix: 处理价格策略批量设置价格无效,商品新增属性值校验异常

parent 24c2dc51
......@@ -248,41 +248,42 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
{
attrItem.type === 1 &&
<Form.Item
name={attrItem.id}
label={attrItem.name}
rules={attrItem.isEmpty && [{
required: true,
message: intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.message' })
}]}
label={<span>{attrItem.name}<i style={{color:'red'}}>*</i></span>}
>
<Row>
<Col span={20}>
<Select
disabled={_isDisabled}
placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.placeholder.1' })}
allowClear
onChange={(v) => onChange(v, attrItem)}
dropdownRender={menu => (
<>
{menu}
<Divider style={{ margin: '8px 0' }} />
<Space align="baseline" style={{ padding: '0 8px 4px' }}>
<Form.Item>
<Input placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.addAttribute.placeholder' })} value={newValue} onChange={onNameChange} />
</Form.Item>
<Typography.Link onClick={(e) => addItem(e, attrItem)} style={{ whiteSpace: 'nowrap' }}>
<PlusOutlined /> {intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.addAttribute.addButton' })}
</Typography.Link>
</Space>
</>
)}
<Form.Item
name={attrItem.id}
rules={attrItem.isEmpty && [{
required: true,
message: intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.message' })
}]}
>
{
attrItem?.customerAttributeValueList.length > 0 && attrItem.customerAttributeValueList.map((item: any) => (
<Option key={item.id} value={item.id}>{item.value}</Option>
))
}
</Select>
<Select
disabled={_isDisabled}
placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.placeholder.1' })}
allowClear
onChange={(v) => onChange(v, attrItem)}
dropdownRender={menu => (
<>
{menu}
<Divider style={{ margin: '8px 0' }} />
<Space align="baseline" style={{ padding: '0 8px 4px' }}>
<Input placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.addAttribute.placeholder' })} value={newValue} onChange={onNameChange} />
<Typography.Link onClick={(e) => addItem(e, attrItem)} style={{ whiteSpace: 'nowrap' }}>
<PlusOutlined /> {intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.addAttribute.addButton' })}
</Typography.Link>
</Space>
</>
)}
>
{
attrItem?.customerAttributeValueList.length > 0 && attrItem.customerAttributeValueList.map((item: any) => (
<Option key={item.id} value={item.id}>{item.value}</Option>
))
}
</Select>
</Form.Item>
</Col>
</Row>
</Form.Item>
......
......@@ -106,11 +106,23 @@ const PriceModal: React.FC<PriceModalProps> = (props) => {
}
let _row = { ...curretSetPriceRow, [intl.formatMessage({ id: 'priceManage.priceStrategy.priceModal.unitPrice' })]: _priceRange }
let newTabeData = [...memberUnitPriceList]
let newTabeData = []
if (isBatchSetting) { // 判断是否批量设置价格
newTabeData.map(item => item[intl.formatMessage({ id: 'priceManage.priceStrategy.priceModal.unitPrice' })] = _priceRange)
// newTabeData.map(item => item[intl.formatMessage({ id: 'priceManage.priceStrategy.priceModal.unitPrice' })] = _priceRange)
memberUnitPriceList.forEach(element => {
let __item = {...element}
__item[intl.formatMessage({ id: 'priceManage.priceStrategy.priceModal.unitPrice' })] = _priceRange
newTabeData.push(__item)
});
} else {
newTabeData[curretSetPriceRow[intl.formatMessage({ id: 'priceManage.priceStrategy.priceModal.index' })]] = _row
// newTabeData[curretSetPriceRow[intl.formatMessage({ id: 'priceManage.priceStrategy.priceModal.index' })]] = _row
memberUnitPriceList.forEach(element => {
if(element[intl.formatMessage({ id: 'priceManage.priceStrategy.priceModal.index' })] === curretSetPriceRow[intl.formatMessage({ id: 'priceManage.priceStrategy.priceModal.index' })]) {
newTabeData.push(_row)
} else {
newTabeData.push({...element})
}
})
}
schemaAction.setFieldValue("memberUnitPriceList", newTabeData)
......
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