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

fix: 商品草稿列表显示单价品类品牌

parent 552e983b
......@@ -50,6 +50,7 @@ const AddProducts: React.FC<{}> = (props) => {
areaOption,
productDescription,
brandName,
categoryName,
setProductName,
setAttributeLists,
clearData,
......@@ -434,6 +435,7 @@ const AddProducts: React.FC<{}> = (props) => {
let _params = {
..._bacsicForm,
brandName,
categoryName,
commodityAttributeList: productSelectAttribute,
commodityRemark: _productDescription,
isAllAttributePic: isAllAttributePic,
......@@ -566,6 +568,29 @@ const AddProducts: React.FC<{}> = (props) => {
if(_params?.logistics?.sendCycle) {
_params.sendCycle = _params.logistics.sendCycle
}
// 处理最大值最小值
if(_params.unitPriceAndPicList?.length) {
const _prices = []
const prices = _params.unitPriceAndPicList.map(item => {
if(item['unitPrice']['0-0']) {
return item['unitPrice']['0-0']
} else {
return Object.values(item['unitPrice'])
}
})
prices.forEach(element => {
if(Array.isArray(element)) {
element.forEach(e => _prices.push(e))
} else {
_prices.push(element)
}
})
if(_prices.length) {
_prices.sort((a, b) => Number(a) - Number(b))
_params['min'] = _prices[0]
_params['max'] = _prices[_prices.length - 1]
}
}
postProductCommoditySaveOrUpdateCommodityDraft(draftId ? {id: draftId, draft: _params} : {draft: _params}).then(({code}) => {
if(code === 1000) {
setIsDisableSaveDrate(false)
......
......@@ -64,6 +64,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
getBasicFormParamsByEdit,
setAttributeLists,
setProductName,
setCategoryName,
setBrandName,
setSelectCategoryId,
setSelectBrandId,
......@@ -160,6 +161,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
setAttributeLists(data?.customerAttributeList)
setSelectCategoryId(seletCategoryId)
setSendCycle(data?.sendCycle || 0)
setCategoryName(data?.name)
})
}
else {
......
......@@ -266,7 +266,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
<>
{menu}
<Divider style={{ margin: '8px 0' }} />
<Space align="center" style={{ padding: '0 8px 4px' }}>
<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>
......
......@@ -245,13 +245,13 @@ const Products: React.FC<{}> = () => {
},
{
title: intl.formatMessage({ id: 'commodity.products.columns.customerCategory' }),
dataIndex: ['draft', 'customerCategory', 'name'],
key: 'customerCategory.name',
dataIndex: ['draft', 'categoryName'],
key: 'categoryName',
},
{
title: intl.formatMessage({ id: 'commodity.products.columns.brand' }),
dataIndex: ['draft', 'brand', 'name'],
key: 'brand.name',
dataIndex: ['draft', 'brandName'],
key: 'branName',
},
{
title: intl.formatMessage({ id: 'commodity.products.columns.unitName' }),
......@@ -282,29 +282,30 @@ const Products: React.FC<{}> = () => {
title: intl.formatMessage({ id: 'commodity.products.columns.min' }),
dataIndex: ['draft', 'min'],
key: 'min',
render: (text, reocrd) => {
if (reocrd.priceType === 1) {
if (reocrd.max === reocrd.min)
return <>{intl.formatMessage({ id: 'commodity.products.columns.currency' })}{reocrd.min}</>
render: (text, record) => {
const { min = null, max = null, priceType } = record.draft
if ((priceType === 1) && min && max) {
if (max === min)
return <>{intl.formatMessage({ id: 'commodity.products.columns.currency' })}{min}</>
else
return <>{intl.formatMessage({ id: 'commodity.products.columns.currency' })}{reocrd.min} ~ {intl.formatMessage({ id: 'commodity.products.columns.currency' })}{reocrd.max}</>
return <>{intl.formatMessage({ id: 'commodity.products.columns.currency' })}{min} ~ {intl.formatMessage({ id: 'commodity.products.columns.currency' })}{max}</>
}
if (reocrd.priceType === 3) {
if (reocrd.max === reocrd.min)
return <>{reocrd.min}</>
if (priceType === 3) {
if (max === min)
return <>{min}</>
else
return <>{reocrd.min} ~ {reocrd.max}</>
return <>{min} ~ {max}</>
}
if (reocrd.priceType === 2)
if (priceType === 2)
return null
}
},
{
title: intl.formatMessage({ id: 'commodity.products.columns.applyTime' }),
dataIndex: ['draft', 'applyTime'],
key: 'applyTime',
render: text => text && moment(text).format('YYYY-MM-DD HH:mm:ss')
},
// {
// title: intl.formatMessage({ id: 'commodity.products.columns.applyTime' }),
// dataIndex: ['draft', 'applyTime'],
// key: 'applyTime',
// render: text => text && moment(text).format('YYYY-MM-DD HH:mm:ss')
// },
{
title: intl.formatMessage({ id: 'commodity.products.columns.status' }),
dataIndex: ['draft', 'status'],
......
......@@ -17,6 +17,7 @@ class ProductStore implements IProductModule {
@observable public attributeLists: any[] = [];
@observable public productName: string = "";
@observable public brandName: string = "";
@observable public categoryName: string = "";
@observable public selectCategoryId: any = null;
@observable public selectBrandId: any = null;
@observable public productSelectAttribute: IProductSelectAttribute[] = [];
......@@ -123,6 +124,11 @@ class ProductStore implements IProductModule {
}
@action.bound
public setCategoryName(name: string) {
this.categoryName = name;
}
@action.bound
public setBrandName(name: string) {
this.brandName = name;
}
......
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