Commit 055dc11b authored by Bill's avatar Bill

Merge branch 'fix0218' into 'v2-220218'

对接新增商品发货周期和新增属性值功能 See merge request linkseeks-design/pro-platform!30
parents 74fb1f14 dd7275d7
...@@ -94,7 +94,7 @@ export const classSchema: ISchema = { ...@@ -94,7 +94,7 @@ export const classSchema: ISchema = {
}, },
], ],
}, },
deadline: { sendCycle: {
type: 'string', type: 'string',
title: getIntl().formatMessage({ id: 'classAndProperty.class.classSchema.deadline' }), title: getIntl().formatMessage({ id: 'classAndProperty.class.classSchema.deadline' }),
'x-component-props': { 'x-component-props': {
......
...@@ -64,6 +64,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => { ...@@ -64,6 +64,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
setProductName, setProductName,
setSelectCategoryId, setSelectCategoryId,
setSelectBrandId, setSelectBrandId,
setSendCycle,
} = ProductStore } = ProductStore
useEffect(() => { useEffect(() => {
...@@ -147,10 +148,12 @@ const BasicInfoForm: React.FC<Iprops> = (props) => { ...@@ -147,10 +148,12 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
setShowCategory(data?.type) setShowCategory(data?.type)
setAttributeLists(data?.customerAttributeList) setAttributeLists(data?.customerAttributeList)
setSelectCategoryId(seletCategoryId) setSelectCategoryId(seletCategoryId)
setSendCycle(data?.sendCycle || 0)
}) })
} }
else else {
setShowCategory(null) setShowCategory(null)
}
} }
const onCommodityAreaChange = (value: any, selected: any) => { const onCommodityAreaChange = (value: any, selected: any) => {
......
...@@ -33,7 +33,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => { ...@@ -33,7 +33,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
const [banCarriageType, setBanCarriageType] = useState(false) const [banCarriageType, setBanCarriageType] = useState(false)
const [template, setTemplate] = useState(false) // 是否必填运费模板 const [template, setTemplate] = useState(false) // 是否必填运费模板
const { productInfoByEdit, selectCategoryId, productPriceType } = ProductStore const { productInfoByEdit, selectCategoryId, productPriceType, sendCycle } = ProductStore
useEffect(() => { useEffect(() => {
//传入ref给父级 //传入ref给父级
...@@ -85,6 +85,8 @@ const LogisticsForm: React.FC<Iprops> = (props) => { ...@@ -85,6 +85,8 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
} }
}, [productPriceType]) }, [productPriceType])
useEffect(() => { logisticsForm.setFieldsValue({ sendCycle: sendCycle }) }, [sendCycle])
const changeDeliveryType = (e) => { const changeDeliveryType = (e) => {
console.log(e) console.log(e)
setDeliveryType(e.target.value) setDeliveryType(e.target.value)
...@@ -246,7 +248,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => { ...@@ -246,7 +248,7 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
</Form.Item> </Form.Item>
} }
<Form.Item <Form.Item
name="deadline" name="sendCycle"
label={intl.formatMessage({ id: 'commodity.products.addProductsItem.logisticsForm.form.deadline' })} label={intl.formatMessage({ id: 'commodity.products.addProductsItem.logisticsForm.form.deadline' })}
rules={[ rules={[
{ {
......
...@@ -45,7 +45,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -45,7 +45,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
const [addVisible, setAddVisible] = useState<boolean>(false) const [addVisible, setAddVisible] = useState<boolean>(false)
const [loading, setLoading] = useState<boolean>(false) const [loading, setLoading] = useState<boolean>(false)
const currentRow = useRef<any>() const currentRow = useRef<any>()
const [dataSource, setDataSource] = useState<any>([...attributesData]) const [dataSource, setDataSource] = useState<any>([])
const [newValue, setNewValue] = useState<string>() const [newValue, setNewValue] = useState<string>()
useEffect(() => { useEffect(() => {
...@@ -58,6 +58,10 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -58,6 +58,10 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
}, []) }, [])
useEffect(() => { useEffect(() => {
setDataSource(() => [...attributesData])
}, [attributesData])
useEffect(() => {
// 属性变动 表明品类品牌变动 清空页面全局参数组合和store的选中属性 重置表单 (只对新增有效) // 属性变动 表明品类品牌变动 清空页面全局参数组合和store的选中属性 重置表单 (只对新增有效)
if (history.location.query?.id) { if (history.location.query?.id) {
// 编辑第一次执行不清空,之后的变动需要清空 // 编辑第一次执行不清空,之后的变动需要清空
...@@ -153,7 +157,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -153,7 +157,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
} }
const addAtttributeValue = (record) => { const addAtttributeValue = (record) => {
console.log(record)
currentRow.current = record currentRow.current = record
setAddVisible(true) setAddVisible(true)
addForm.setFieldsValue({'name': record['name'], isEnable: true, id: record['id']}) addForm.setFieldsValue({'name': record['name'], isEnable: true, id: record['id']})
...@@ -173,16 +176,14 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -173,16 +176,14 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
if(code === 1000) { if(code === 1000) {
const _dataSource = dataSource.map((item) => { const _dataSource = dataSource.map((item) => {
if(item.id === currentRow.current.id) { if(item.id === currentRow.current.id) {
// @todo 调用后台新增属性值接口 成功后把返回的id写入属性值 目前随机数生成
item.customerAttributeValueList.push({ item.customerAttributeValueList.push({
...item.customerAttributeValueList[0], ...item.customerAttributeValueList[0],
id: parseInt(Math.random()*10000+''), id: data,
...values, ...values,
}) })
} }
return item return item
}) })
console.log(_dataSource)
setDataSource([..._dataSource]) setDataSource([..._dataSource])
setAddVisible(false) setAddVisible(false)
setLoading(false) setLoading(false)
...@@ -208,18 +209,16 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => { ...@@ -208,18 +209,16 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
value: newValue value: newValue
}).then(({code, data}) => { }).then(({code, data}) => {
if(code === 1000) { if(code === 1000) {
// @todo 调用后台新增属性值接口 成功后把返回的id写入属性值 目前随机数生成
const _dataSource = dataSource.map((item, index) => { const _dataSource = dataSource.map((item, index) => {
if(item.id === record.id) { if(item.id === record.id) {
item.customerAttributeValueList.push({ item.customerAttributeValueList.push({
...item.customerAttributeValueList[0], ...item.customerAttributeValueList[0],
id: parseInt(Math.random()*10000+''), id: data,
value: newValue, value: newValue,
}) })
} }
return item return item
}) })
console.log(_dataSource)
setDataSource([..._dataSource]) setDataSource([..._dataSource])
setNewValue('') setNewValue('')
} }
......
...@@ -31,6 +31,7 @@ class ProductStore implements IProductModule { ...@@ -31,6 +31,7 @@ class ProductStore implements IProductModule {
@observable public tabClickItem: any[] = []; // tab标签页点击项 @observable public tabClickItem: any[] = []; // tab标签页点击项
@observable public productPriceType: any = null; // 商品价格类型 @observable public productPriceType: any = null; // 商品价格类型
@observable public isRecombination: boolean = false; // 编辑时 是否重新属性组合 @observable public isRecombination: boolean = false; // 编辑时 是否重新属性组合
@observable public sendCycle: number; // 品类发货周期
/** 计算操作 **/ /** 计算操作 **/
// 加工接口返回的数据,用户编辑回显数据 // 加工接口返回的数据,用户编辑回显数据
...@@ -234,6 +235,11 @@ class ProductStore implements IProductModule { ...@@ -234,6 +235,11 @@ class ProductStore implements IProductModule {
this.isRecombination = data this.isRecombination = data
} }
@action.bound
public setSendCycle(data: number) {
this.sendCycle = data
}
} }
export default ProductStore export default ProductStore
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