Commit 9c35319a authored by 前端-许佳敏's avatar 前端-许佳敏
parents ead61aee 97dd7ab1
......@@ -139,14 +139,14 @@ const CommodityRoute = {
component: '@/pages/commodity/products/directChannel',
},
{
path: '/memberCenter/commodityAbility/commodity/products/addDirectChannel',
path: '/memberCenter/commodityAbility/commodity/products/directChannel/addDirectChannel',
name: 'addDirectChannel',
hideInMenu: true,
icon: 'smile',
component: '@/pages/commodity/products/addDirectChannel',
},
{
path: '/memberCenter/commodityAbility/commodity/products/viewDirectChannel',
path: '/memberCenter/commodityAbility/commodity/products/directChannel/viewDirectChannel',
name: 'viewDirectChannel',
hideInMenu: true,
icon: 'smile',
......
......@@ -89,7 +89,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
const [memberColumn, setMemberColumn] = useState<any[]>([])
const [queryId, setQueryId] = useState<number>()
const [productInfoByEdit, setProductInfoByEdit] = useState<GetProductChannelCommodityGetChannelCommodityResponse>()
// const [productInfoByEdit, setProductInfoByEdit] = useState<GetProductChannelCommodityGetChannelCommodityResponse>()
const productColumns: ColumnType<any>[] = [
{
......@@ -153,7 +153,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
if(id)
PublicApi.getProductChannelCommodityGetChannelCommodity({id: id}).then(res => {
const { data } = res
setProductInfoByEdit(data)
// setProductInfoByEdit(data)
formProduct.setFieldsValue({source: data.source})
setSource(data.source)
// @ts-ignore
......@@ -192,10 +192,10 @@ const AddDirectChannel:React.FC<{}> = (props) => {
useEffect(() => {
if(visibleAddTabs)
console.log(productRef.current, productFormActions,'132456')
// productRef.current.schemaAction.setFieldState('parentMemberId', state => {
// state.visible = source===1 ? true : false
// })
productRef?.current?.schemaAction?.setFieldState('parentMemberId', state => {
console.log('parentMemberId')
state.visible = source===1 ? true : false
})
}, [visibleAddTabs])
// 获取渠道商品
......@@ -734,7 +734,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
confirm={handleOkAddTabs}
cancel={handleCancelAddTabs}
visible={visibleAddTabs}
resetModal={{destroyOnClose: true}}
resetModal={{destroyOnClose: true, forceRender: true}}
columns={productColumns}
rowSelection={productRowSelection}
fetchTableData={(params:any) => fetchProductData(params)}
......
......@@ -125,6 +125,8 @@ const AddProducts: React.FC<{}> = (props) => {
if(productAttributeAndImageParams.length>0){
productAttributeAndImageParams.map(_item => {
if(_item.goodsCustomerAttributeList.length>0){
_item.goods = { id: _item.goodsId }
delete _item.goodsId
_item.goodsCustomerAttributeList.map(__item => {
delete __item.customerAttributeName
// __item.customerAttributeValueId = __item.id
......@@ -136,6 +138,8 @@ const AddProducts: React.FC<{}> = (props) => {
delete __item.customerAttributeId
})
}
_item.attributeAndValueList = _item.goodsCustomerAttributeList
delete _item.goodsCustomerAttributeList
if(_item.commodityPic.length>0){
// 编辑情况下兼顾手动添加图片列表属性
_item.commodityPic = _item.commodityPic.map(__item => __item?.response?.data || __item?.url)
......@@ -176,6 +180,16 @@ const AddProducts: React.FC<{}> = (props) => {
_params.packing = productInfoByEdit.packing
_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')
PublicApi.postProductCommoditySaveOrUpdateCommodity(_params).then(res => {
if(res.code === 1000){
......
......@@ -87,9 +87,9 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
// }
setPriceAttributeParamsByRender(_priceAttributeParams)
setProductAttributeAndImageParams(_priceAttributeParams)
console.log(_priceAttributeParams, priceAttributeParams, '_p')
console.log(_priceAttributeParams, priceAttributeParams, '_p') // 这里可能为空数组
// 初始化若是按所有属性共用做显示处理
if(setImageType){
if(setImageType && _priceAttributeParams.length>0){
setCommonImageList(_priceAttributeParams[0].commodityPic)
}
......@@ -261,7 +261,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
banner
showIcon={false}
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"
closable
style={{ backgroundColor: '#F0F8FF', color: '#1B9AEE' }}
......@@ -289,7 +289,7 @@ const ProductImageForm: React.FC<Iprops> = (props) => {
banner
showIcon={false}
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"
closable
style={{ backgroundColor: '#F0F8FF', color: '#1B9AEE' }}
......
......@@ -67,7 +67,7 @@ const DirectChannel: React.FC<{}> = () => {
key: 'name',
className: 'commonPickColor',
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}
</EyePreview>
......@@ -162,7 +162,7 @@ const DirectChannel: React.FC<{}> = () => {
];
const clickModify = (paramId: number) => {
history.push(`/memberCenter/commodityAbility/commodity/products/addDirectChannel?id=${paramId}`)
history.push(`/memberCenter/commodityAbility/commodity/products/directChannel/addDirectChannel?id=${paramId}`)
}
// paramId ? 单个删除 : 批量删除
......@@ -294,7 +294,7 @@ const DirectChannel: React.FC<{}> = () => {
<Space>
<Button
type='primary'
onClick={() => history.push('/memberCenter/commodityAbility/commodity/products/addDirectChannel')}
onClick={() => history.push('/memberCenter/commodityAbility/commodity/products/directChannel/addDirectChannel')}
>
<PlusOutlined />新建
</Button>
......@@ -362,7 +362,7 @@ const DirectChannel: React.FC<{}> = () => {
<Checkbox.Group style={{ width: '100%' }} onChange={onChangeUpShop} value={checkedValues}>
<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>
</Col>)
}
......
......@@ -228,9 +228,6 @@ export const addChannelSchema: ISchema = {
placeholder: '请选择品类',
className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
fetchSearch: PublicApi.getProductSelectGetSelectCategory,
style: {
width: 160
}
}
},
brandId: {
......@@ -239,9 +236,6 @@ export const addChannelSchema: ISchema = {
"x-component-props": {
placeholder: '请选择品牌',
fetchSearch: PublicApi.getProductSelectGetSelectBrand,
style: {
width: 160
}
}
},
parentMemberId: {
......@@ -249,9 +243,6 @@ export const addChannelSchema: ISchema = {
enum: [],
'x-component-props': {
placeholder: '上级渠道',
style: {
width: 160
}
},
},
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