Commit 9c35319a authored by 前端-许佳敏's avatar 前端-许佳敏
parents ead61aee 97dd7ab1
...@@ -139,14 +139,14 @@ const CommodityRoute = { ...@@ -139,14 +139,14 @@ const CommodityRoute = {
component: '@/pages/commodity/products/directChannel', component: '@/pages/commodity/products/directChannel',
}, },
{ {
path: '/memberCenter/commodityAbility/commodity/products/addDirectChannel', path: '/memberCenter/commodityAbility/commodity/products/directChannel/addDirectChannel',
name: 'addDirectChannel', name: 'addDirectChannel',
hideInMenu: true, hideInMenu: true,
icon: 'smile', icon: 'smile',
component: '@/pages/commodity/products/addDirectChannel', component: '@/pages/commodity/products/addDirectChannel',
}, },
{ {
path: '/memberCenter/commodityAbility/commodity/products/viewDirectChannel', path: '/memberCenter/commodityAbility/commodity/products/directChannel/viewDirectChannel',
name: 'viewDirectChannel', name: 'viewDirectChannel',
hideInMenu: true, hideInMenu: true,
icon: 'smile', icon: 'smile',
......
...@@ -89,7 +89,7 @@ const AddDirectChannel:React.FC<{}> = (props) => { ...@@ -89,7 +89,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
const [memberColumn, setMemberColumn] = useState<any[]>([]) const [memberColumn, setMemberColumn] = useState<any[]>([])
const [queryId, setQueryId] = useState<number>() const [queryId, setQueryId] = useState<number>()
const [productInfoByEdit, setProductInfoByEdit] = useState<GetProductChannelCommodityGetChannelCommodityResponse>() // const [productInfoByEdit, setProductInfoByEdit] = useState<GetProductChannelCommodityGetChannelCommodityResponse>()
const productColumns: ColumnType<any>[] = [ const productColumns: ColumnType<any>[] = [
{ {
...@@ -153,7 +153,7 @@ const AddDirectChannel:React.FC<{}> = (props) => { ...@@ -153,7 +153,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
if(id) if(id)
PublicApi.getProductChannelCommodityGetChannelCommodity({id: id}).then(res => { PublicApi.getProductChannelCommodityGetChannelCommodity({id: id}).then(res => {
const { data } = res const { data } = res
setProductInfoByEdit(data) // setProductInfoByEdit(data)
formProduct.setFieldsValue({source: data.source}) formProduct.setFieldsValue({source: data.source})
setSource(data.source) setSource(data.source)
// @ts-ignore // @ts-ignore
...@@ -192,10 +192,10 @@ const AddDirectChannel:React.FC<{}> = (props) => { ...@@ -192,10 +192,10 @@ const AddDirectChannel:React.FC<{}> = (props) => {
useEffect(() => { useEffect(() => {
if(visibleAddTabs) if(visibleAddTabs)
console.log(productRef.current, productFormActions,'132456') productRef?.current?.schemaAction?.setFieldState('parentMemberId', state => {
// productRef.current.schemaAction.setFieldState('parentMemberId', state => { console.log('parentMemberId')
// state.visible = source===1 ? true : false state.visible = source===1 ? true : false
// }) })
}, [visibleAddTabs]) }, [visibleAddTabs])
// 获取渠道商品 // 获取渠道商品
...@@ -734,7 +734,7 @@ const AddDirectChannel:React.FC<{}> = (props) => { ...@@ -734,7 +734,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
confirm={handleOkAddTabs} confirm={handleOkAddTabs}
cancel={handleCancelAddTabs} cancel={handleCancelAddTabs}
visible={visibleAddTabs} visible={visibleAddTabs}
resetModal={{destroyOnClose: true}} resetModal={{destroyOnClose: true, forceRender: true}}
columns={productColumns} columns={productColumns}
rowSelection={productRowSelection} rowSelection={productRowSelection}
fetchTableData={(params:any) => fetchProductData(params)} fetchTableData={(params:any) => fetchProductData(params)}
......
...@@ -125,6 +125,8 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -125,6 +125,8 @@ const AddProducts: React.FC<{}> = (props) => {
if(productAttributeAndImageParams.length>0){ if(productAttributeAndImageParams.length>0){
productAttributeAndImageParams.map(_item => { productAttributeAndImageParams.map(_item => {
if(_item.goodsCustomerAttributeList.length>0){ if(_item.goodsCustomerAttributeList.length>0){
_item.goods = { id: _item.goodsId }
delete _item.goodsId
_item.goodsCustomerAttributeList.map(__item => { _item.goodsCustomerAttributeList.map(__item => {
delete __item.customerAttributeName delete __item.customerAttributeName
// __item.customerAttributeValueId = __item.id // __item.customerAttributeValueId = __item.id
...@@ -136,6 +138,8 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -136,6 +138,8 @@ const AddProducts: React.FC<{}> = (props) => {
delete __item.customerAttributeId delete __item.customerAttributeId
}) })
} }
_item.attributeAndValueList = _item.goodsCustomerAttributeList
delete _item.goodsCustomerAttributeList
if(_item.commodityPic.length>0){ if(_item.commodityPic.length>0){
// 编辑情况下兼顾手动添加图片列表属性 // 编辑情况下兼顾手动添加图片列表属性
_item.commodityPic = _item.commodityPic.map(__item => __item?.response?.data || __item?.url) _item.commodityPic = _item.commodityPic.map(__item => __item?.response?.data || __item?.url)
...@@ -176,6 +180,16 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -176,6 +180,16 @@ const AddProducts: React.FC<{}> = (props) => {
_params.packing = productInfoByEdit.packing _params.packing = productInfoByEdit.packing
_params.afterService = productInfoByEdit.afterService _params.afterService = productInfoByEdit.afterService
} }
// 校验价格
try{
let hasPriceArray = _params.unitPriceAndPicList.map(item => item.unitPrice)
hasPriceArray.map(item => {
if(JSON.stringify(item) === '{}')
throw new Error('商品价格为必填项!')
})
}catch(e){
return e
}
console.log(_params, 'params') console.log(_params, 'params')
PublicApi.postProductCommoditySaveOrUpdateCommodity(_params).then(res => { PublicApi.postProductCommoditySaveOrUpdateCommodity(_params).then(res => {
if(res.code === 1000){ if(res.code === 1000){
......
...@@ -87,9 +87,9 @@ const ProductImageForm: React.FC<Iprops> = (props) => { ...@@ -87,9 +87,9 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
// } // }
setPriceAttributeParamsByRender(_priceAttributeParams) setPriceAttributeParamsByRender(_priceAttributeParams)
setProductAttributeAndImageParams(_priceAttributeParams) setProductAttributeAndImageParams(_priceAttributeParams)
console.log(_priceAttributeParams, priceAttributeParams, '_p') console.log(_priceAttributeParams, priceAttributeParams, '_p') // 这里可能为空数组
// 初始化若是按所有属性共用做显示处理 // 初始化若是按所有属性共用做显示处理
if(setImageType){ if(setImageType && _priceAttributeParams.length>0){
setCommonImageList(_priceAttributeParams[0].commodityPic) setCommonImageList(_priceAttributeParams[0].commodityPic)
} }
...@@ -261,7 +261,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => { ...@@ -261,7 +261,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
banner banner
showIcon={false} showIcon={false}
message="" message=""
description={<>1. (按属性设置)一次可以选择 6 张图片<br />2. 图片尺寸为 800*800,单张大小不超过 600K,仅支持JPEG/JPG/PNG格式<br />3. 图片质量要清晰,不要虚化,建议主图为白色背景正面图</>} description={<>1. 一次可以选择 6 张图片<br />2. 图片尺寸为 800*800,单张大小不超过 600K,仅支持JPEG/JPG/PNG格式<br />3. 图片质量要清晰,不要虚化,建议主图为白色背景正面图</>}
type="info" type="info"
closable closable
style={{ backgroundColor: '#F0F8FF', color: '#1B9AEE' }} style={{ backgroundColor: '#F0F8FF', color: '#1B9AEE' }}
...@@ -289,7 +289,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => { ...@@ -289,7 +289,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
banner banner
showIcon={false} showIcon={false}
message="" message=""
description={<>1. (所有属性共用)一次可以选择 6 张图片<br />2. 图片尺寸为 800*800,单张大小不超过 600K,仅支持JPEG/JPG/PNG格式<br />3. 图片质量要清晰,不要虚化,建议主图为白色背景正面图</>} description={<>1. 一次可以选择 6 张图片<br />2. 图片尺寸为 800*800,单张大小不超过 600K,仅支持JPEG/JPG/PNG格式<br />3. 图片质量要清晰,不要虚化,建议主图为白色背景正面图</>}
type="info" type="info"
closable closable
style={{ backgroundColor: '#F0F8FF', color: '#1B9AEE' }} style={{ backgroundColor: '#F0F8FF', color: '#1B9AEE' }}
......
...@@ -67,7 +67,7 @@ const DirectChannel: React.FC<{}> = () => { ...@@ -67,7 +67,7 @@ const DirectChannel: React.FC<{}> = () => {
key: 'name', key: 'name',
className: 'commonPickColor', className: 'commonPickColor',
render: (text:any, record:any) => <EyePreview render: (text:any, record:any) => <EyePreview
url={`/memberCenter/commodityAbility/commodity/products/viewDirectChannel?id=${record.id}`} url={`/memberCenter/commodityAbility/commodity/products/directChannel/viewDirectChannel?id=${record.id}`}
> >
{text} {text}
</EyePreview> </EyePreview>
...@@ -162,7 +162,7 @@ const DirectChannel: React.FC<{}> = () => { ...@@ -162,7 +162,7 @@ const DirectChannel: React.FC<{}> = () => {
]; ];
const clickModify = (paramId: number) => { const clickModify = (paramId: number) => {
history.push(`/memberCenter/commodityAbility/commodity/products/addDirectChannel?id=${paramId}`) history.push(`/memberCenter/commodityAbility/commodity/products/directChannel/addDirectChannel?id=${paramId}`)
} }
// paramId ? 单个删除 : 批量删除 // paramId ? 单个删除 : 批量删除
...@@ -294,7 +294,7 @@ const DirectChannel: React.FC<{}> = () => { ...@@ -294,7 +294,7 @@ const DirectChannel: React.FC<{}> = () => {
<Space> <Space>
<Button <Button
type='primary' type='primary'
onClick={() => history.push('/memberCenter/commodityAbility/commodity/products/addDirectChannel')} onClick={() => history.push('/memberCenter/commodityAbility/commodity/products/directChannel/addDirectChannel')}
> >
<PlusOutlined />新建 <PlusOutlined />新建
</Button> </Button>
...@@ -362,7 +362,7 @@ const DirectChannel: React.FC<{}> = () => { ...@@ -362,7 +362,7 @@ const DirectChannel: React.FC<{}> = () => {
<Checkbox.Group style={{ width: '100%' }} onChange={onChangeUpShop} value={checkedValues}> <Checkbox.Group style={{ width: '100%' }} onChange={onChangeUpShop} value={checkedValues}>
<Row> <Row>
{ {
Array.isArray(shopsOption) && shopsOption.map((item, index) => <Col key={index} span={6}> Array.isArray(shopsOption) && shopsOption.map((item, index) => <Col key={index} span={8}>
<Checkbox value={item}>{item.name}</Checkbox> <Checkbox value={item}>{item.name}</Checkbox>
</Col>) </Col>)
} }
......
...@@ -228,9 +228,6 @@ export const addChannelSchema: ISchema = { ...@@ -228,9 +228,6 @@ export const addChannelSchema: ISchema = {
placeholder: '请选择品类', placeholder: '请选择品类',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ?? className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCategory, fetchSearch: PublicApi.getProductSelectGetSelectCategory,
style: {
width: 160
}
} }
}, },
brandId: { brandId: {
...@@ -239,9 +236,6 @@ export const addChannelSchema: ISchema = { ...@@ -239,9 +236,6 @@ export const addChannelSchema: ISchema = {
"x-component-props": { "x-component-props": {
placeholder: '请选择品牌', placeholder: '请选择品牌',
fetchSearch: PublicApi.getProductSelectGetSelectBrand, fetchSearch: PublicApi.getProductSelectGetSelectBrand,
style: {
width: 160
}
} }
}, },
parentMemberId: { parentMemberId: {
...@@ -249,9 +243,6 @@ export const addChannelSchema: ISchema = { ...@@ -249,9 +243,6 @@ export const addChannelSchema: ISchema = {
enum: [], enum: [],
'x-component-props': { 'x-component-props': {
placeholder: '上级渠道', placeholder: '上级渠道',
style: {
width: 160
}
}, },
}, },
submit: { submit: {
......
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