Commit c5959296 authored by 卢均锐's avatar 卢均锐

Merge branch 'v2' of http://10.0.0.22:3000/lingxi/lingxi-business-paltform into v2

* 'v2' of http://10.0.0.22:3000/lingxi/lingxi-business-paltform: fix: 处理商品新增/编辑页面报警告的问题
parents e5f571aa 386e40b3
......@@ -967,7 +967,7 @@ export default {
"37143": "已存在适用于指定合同的采购流程规则,不能配置适用所有合同的采购流程规则",
"37144": "供应商未配置交易流程规则",
"37145": "供应商配置的交易流程规则中未包含采购商品",
"37146": "当前供应会员未配置采购交易流程,无法提交订单",
"37146": "当前采购会员未配置采购交易流程,无法提交订单",
"56041": "活动商品不能为空",
"56042": "已达到活动最大限购数量,您最多可购买%s件!",
"56043": "已超出账户id限购数",
......
......@@ -30,12 +30,14 @@ const AddProducts: React.FC<{}> = (props) => {
const { siteId } = SiteStore
const [isEnableCheck, setIsEnableCheck] = useState(true)
const [responseId, setReponseId] = useState<number>(null)
const [attributeList, setAttributeList] = useState<any[]>([])
// const [attributeList, setAttributeList] = useState<any[]>([])
const [clickTabIndex, setClickTabIndex] = useState<string[]>(['1'])
const [clickCurrentIndex, setClickCurrentIndex] = useState<string>('1')
const [isDisableSaveBtn, setIsDisableSaveBtn] = useState<boolean>(false)
const [currentTemplateName, setCurrentTemplateName] = useState<string>()
let [formRefs, setFormRefs] = useState([]) //子form的ref数组
// let [formRefs, setFormRefs] = useState([]) //子form的ref数组
const childFormRefs = useRef([]) // 子form的ref数组
const attributeListRef = useRef([]) // 品类下的属性传递给商品属性tab
const clearPartRef = useRef<number>(1)
const { ProductStore } = store
......@@ -152,9 +154,9 @@ const AddProducts: React.FC<{}> = (props) => {
const onSave = () => {
setIsDisableSaveBtn(true)
const { id } = history.location.query
if (formRefs.length > 0) {
if (childFormRefs.current.length > 0) {
try {
let data = formRefs.map(async __ => {
let data = childFormRefs.current.map(async __ => {
return (
await __.current.validateFields()
)
......@@ -402,21 +404,21 @@ const AddProducts: React.FC<{}> = (props) => {
<Tabs onChange={callback} type="card" defaultActiveKey="1">
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addProducts.tab.1' })} key="1">
<BasicInfoForm
onRef={(refs) => setFormRefs([...formRefs, refs])}
onChangeAttributeList={(_lists: any) => setAttributeList(_lists)} />
onRef={(refs) => childFormRefs.current = [...childFormRefs.current, refs]}
onChangeAttributeList={(_lists) => attributeListRef.current = _lists} />
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addProducts.tab.2' })} key="2">
<SelectGoodsForm />
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addProducts.tab.3' })} key="3">
<ProductAttributeForm
onRef={(refs) => setFormRefs([...formRefs, refs])}
attributesData={attributeList}
onRef={(refs) => childFormRefs.current = [...childFormRefs.current, refs]}
attributesData={attributeListRef.current}
/>
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addProducts.tab.4' })} key="4">
<PriceAttributeForm
onRef={(refs) => setFormRefs([...formRefs, refs])}
onRef={(refs) => childFormRefs.current = [...childFormRefs.current, refs]}
/>
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addProducts.tab.5' })} key="5">
......@@ -429,12 +431,12 @@ const AddProducts: React.FC<{}> = (props) => {
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addProducts.tab.7' })} key="7">
<LogisticsForm
onRef={(refs) => setFormRefs([...formRefs, refs])}
onRef={(refs) => childFormRefs.current = [...childFormRefs.current, refs]}
/>
</TabPane>
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addProducts.tab.8' })} key="8">
<OtherForm
onRef={(refs) => setFormRefs([...formRefs, refs])}
onRef={(refs) => childFormRefs.current = [...childFormRefs.current, refs]}
/>
</TabPane>
</Tabs>
......
......@@ -103,9 +103,15 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
if (id && getBasicFormParamsByEdit?.name) {
handleBrandSearch(getBasicFormParamsByEdit.brandName)
onCustomerCategoryChange(getBasicFormParamsByEdit.customerCategoryId)
// 赋[]初值 显示一行区域选择
if(!getBasicFormParamsByEdit.commodityAreaList.length) {
getBasicFormParamsByEdit.commodityAreaList[0] = []
}
basicForm.setFieldsValue(getBasicFormParamsByEdit)
setSelectBrandId(getBasicFormParamsByEdit.brandId)
setIsUpdateAttribute(productInfoByEdit.isUpdateAttribute)
} else {
basicForm.setFieldsValue({'commodityAreaList': [[]]})
}
}, [getBasicFormParamsByEdit])
......@@ -265,46 +271,6 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
</Select>
</Form.Item>
}
{/* <Form.Item
name="customerCategoryId"
label="商品品类"
rules={[
{
required: true,
message: '请选择商品品类'
},
]}
>
<Cascader
allowClear={false}
disabled={history.location.query?.id}
options={customerCategoryTree}
fieldNames={{ label: 'title', value: 'id', children: 'children' }}
onChange={onCustomerCategoryChange}
placeholder="请选择品类"
/>
</Form.Item>
<Form.Item
name="brandId"
label="商品品牌"
>
<Select
disabled={!isUpdateAttribute}
showSearch={true}
showArrow={true}
placeholder="请输入或选择商品品牌"
allowClear
value={brandValue}
defaultActiveFirstOption={false}
filterOption={false}
onSearch={handleBrandSearch}
onChange={handleBrandChange}
onFocus={()=>handleBrandSearch(null)}
style={{ width: '100%' }}
>
{brandData.map(d => <Option value={d.id} key={d.id}>{d.name}</Option>)}
</Select>
</Form.Item> */}
<Form.Item
name="name"
label={
......@@ -371,9 +337,9 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
</Form.Item>
<Form.List name="commodityAreaList">
{(fields: any[], { add, remove }: any) => {
if (!fields.length) {
add()
}
// if (!fields.length) {
// add()
// }
return (
<div>
{fields.map((field, index) => (
......
......@@ -284,7 +284,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let _priceRange = _tableDataSource[record[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.index' })]][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.unitPrice' })]
if (!_priceRange || JSON.stringify(_priceRange) === '{}') return null
return Object.keys(_priceRange).map((v, i) => {
return <><span key={i}>{v === '0-0' ? '' : `${v}:`} <span style={{ color: 'red' }}>{planPrice === 3 ? '' : intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.currency' })}{_priceRange[v]}</span></span><br /></>
return <p key={i}><span>{v === '0-0' ? '' : `${v}:`} <span style={{ color: 'red' }}>{planPrice === 3 ? '' : intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.currency' })}{_priceRange[v]}</span></span></p>
})
}
})
......@@ -295,7 +295,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
render: (text, record) => {
const assistPrice = _tableDataSource[record[intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.index' })]][intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.planPrice' })]
if (assistPrice && Array.isArray(assistPrice)) {
return assistPrice.map(p => <p>{planPrice === 3 ? p : `${intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.currency' })}${p}`}</p>)
return assistPrice.map((p, i) => <p key={i}>{planPrice === 3 ? p : `${intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.currency' })}${p}`}</p>)
} else if (assistPrice) {
return planPrice === 3 ? assistPrice : (isNaN(assistPrice) ? `¥${0.00}` : `${intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.currency' })}${assistPrice}`)
}
......@@ -305,7 +305,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
title: intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.option' }),
dataIndex: 'option',
width: 100,
render: (text: any, record: any) => {
render: (text, record) => {
return (
<>
<Button type='link' onClick={() => clickSetPrice(record)}>{planPrice === 3 ? intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.button.1' }) : intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.button.2' })}</Button>
......
......@@ -76,7 +76,6 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
}, [selectCategoryId])
useEffect(() => {
console.log(fileImageList, 'fileImageList')
// 设置传输数据
setProductDescription({
video: videoList,
......
......@@ -22,12 +22,6 @@ export const PriceComp = (props) => {
/**新增物流单 初始值转换 */
export const procurmentRenderInit = (initValue: any) => {
return {
// ...initValue.requirement,
// vendorMemberId: initValue.vendorMemberId,
// vendorMemberName: initValue.vendorMemberName,
// vendorRoleId: initValue.vendorRoleId,
// product: initValue.product,
digest: initValue.digest,
shipmentOrderId: initValue.deliveryNo,
relevanceOrderId: initValue.orderId,
relevanceOrderCode: initValue.orderNo,
......
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