Commit 9e49add3 authored by wzy's avatar wzy

feat: 弹窗修整

parent 7ff0590c
module.exports = [
{ name: 'LogisticsV2', token: '732fb8e33970ff5dee830423a630e8e85c3ef3293abba7581b16749dfce8608b', categoryIds: [0], }, // 物流能力v2
{ name: 'ProductV2', token: 'df37f2a0e3829c4288708ae211920bdbdee55e5e2f48b1e8cf7d1925ac618d9a', categoryIds: [0], }, // 商品服务V2
{ name: 'ProductV2', token: 'fc83f33ea247145db5825729df1c0740f2cbb527ac763ed890629ad5896dba0d', categoryIds: [0], }, // 商品服务V2
{ name: 'TemplateV2', token: '7bb5578bc50e4e7935cbc146a2192e978053d5380cc96fcfdc0a754cfe885ec5', categoryIds: [0], }, // 页面模板服务V2
{ name: 'PayV2', token: '4b5f2f2d42f0774b61074d69d5d756c725ba067d9dafe2c3785f592ae85d1696', categoryIds: [0], }, // 支付服务
{ name: 'SearchV2', token: 'f3e6ec26764f54d06ba33f487ff42d7debeaef397e51dc395040447737eb2e66', categoryIds: [0], }, // 搜索服务V2
......
......@@ -935,8 +935,8 @@ const Products: React.FC<{}> = () => {
<p>{intl.formatMessage({ id: 'commodity.products.textfour' })}</p>
</Modal>
<ProductView visible={upModal} setVisible={setUpModal} productId={uppId} />
<ProductSel visible={upSelModal} setVisible={setUpSelModal} title="upperMemberName" />
<ProductSel visible={downSelModal} setVisible={setDownSelModal} title="subMemberName" />
<ProductSel visible={upSelModal} setVisible={setUpSelModal} titleKey="upperMemberName" />
<ProductSel visible={downSelModal} setVisible={setDownSelModal} titleKey="subMemberName" />
{/* 选择上游商品 */}
<UpperProductModalTable currentRef={upperRef} type="checkbox" tableRef={ref} />
{/* 商品上架引导 */}
......
......@@ -4,12 +4,12 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable';
// import {
// getProductCommodityGetSubCommodityListS2B,
// getProductCommodityGetUpperCommodityListS2B,
// postProductCommodityChoiceSubCommodity,
// postProductCommodityChoiceUpperCommodity,
// } from '@/services/ProductV2Api';
import {
getProductCommodityGetSubCommodityListS2B,
getProductCommodityGetUpperCommodityListS2B,
postProductCommodityChoiceSubCommodity,
postProductCommodityChoiceUpperCommodity,
} from '@/services/ProductV2Api';
import { PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { Button, Modal, Table } from 'antd';
......@@ -75,38 +75,22 @@ export const newSchema = (key: string) => ({
id:
'commodity.products.schema.productSchema.priceTypeList.placeholder',
}),
style: { width: '174px' },
},
},
brandName: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: getIntl().formatMessage({
id: 'commodity.products.schema.productSchema.brandId',
}),
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px' },
searchValue: null,
dataoption: [],
},
},
customerCategoryName: {
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: getIntl().formatMessage({
id: 'commodity.products.schema.productSchema.customerCategoryId',
}),
showSearch: true,
notFoundContent: null,
style: { width: '174px' },
dataoption: [],
fieldNames: { label: 'title', value: 'id', children: 'children' },
},
},
memberName: {
......@@ -211,7 +195,7 @@ export const ProductView = props => {
dataIndex: 'min',
key: 'min',
render: (text, record) => {
return `${text}~¥${record.max}`;
return `${getIntl().formatMessage({ id: 'commodity.products.directChannel.columns.currency'})}${text}~${getIntl().formatMessage({ id: 'commodity.products.directChannel.columns.currency'})}${record.max}`;
},
},
];
......@@ -234,16 +218,16 @@ export const ProductView = props => {
// };
useEffect(() => {
if (productId) {
// const params = {
// current: '1',
// pageSize: '50',
// productId,
// };
// getProductCommodityGetUpperCommodityListS2B(params).then(res => {
// if (res.code === 1000) {
// setDataSource(res.data.data);
// }
// });
const params = {
current: '1',
pageSize: '50',
productId,
};
getProductCommodityGetUpperCommodityListS2B(params).then(res => {
if (res.code === 1000) {
setDataSource(res.data.data);
}
});
}
}, [productId]);
return (
......@@ -274,13 +258,13 @@ export const ProductView = props => {
export const ProductSel = props => {
// 选择商品
const { visible, setVisible, key, productId } = props;
const { visible, setVisible, titleKey } = props;
/** 带参数查询,给表单带默认值 */
// const { clear } = useSetSearchValueInTable();
const ref = useRef<any>({});
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id' });
const [loading, setLoading] = useState<boolean>(false);
const columns = (key: string) => {
const columns = (tKey: string) => {
const arr = [
{
title: getIntl().formatMessage({ id: 'commodity.products.shangpinID' }),
......@@ -336,7 +320,7 @@ export const ProductSel = props => {
},
{
title: `${
key === 'upperMemberName'
tKey === 'upperMemberName'
? getIntl().formatMessage({
id: 'commodity.products.shangyougongyinghuiyuan',
})
......@@ -344,24 +328,34 @@ export const ProductSel = props => {
id: 'commodity.products.xiayouxiaoshouhuiyuan',
})
}`,
dataIndex: key,
key: key,
dataIndex: tKey,
key: tKey,
},
{
title: getIntl().formatMessage({ id: 'commodity.products.danjia' }),
dataIndex: 'min',
key: 'min',
render: (text, record) => {
return `${text}~¥${record.max}`;
return `${getIntl().formatMessage({ id: 'commodity.products.directChannel.columns.currency'})}${text}~${getIntl().formatMessage({ id: 'commodity.products.directChannel.columns.currency'})}${record.max}`;
},
},
{
title: getIntl().formatMessage({ id: 'commodity.products.zhuangtai' }),
dataIndex: 'status',
key: 'status',
render: text => {
switch(text) {
case 1: return getIntl().formatMessage({ id:'commodity.checkProduct.status.1'})
case 2: return getIntl().formatMessage({ id:'commodity.checkProduct.status.2'})
case 3: return getIntl().formatMessage({ id:'commodity.checkProduct.status.3'})
case 4: return getIntl().formatMessage({ id:'commodity.checkProduct.status.4'})
case 5: return getIntl().formatMessage({ id:'commodity.checkProduct.status.5'})
case 6: return getIntl().formatMessage({ id:'commodity.checkProduct.status.6'})
}
}
},
];
if (key === 'subMemberName') {
if (tKey === 'subMemberName') {
arr.splice(7, 1);
}
return arr;
......@@ -371,53 +365,44 @@ export const ProductSel = props => {
const params = {
current: '1',
pageSize: '10',
productId,
// name: '',
// priceType: '',
// customerCategoryName: '',
// memberName: '',
// brandName: '',
// productId: '',
...item,
};
// const fn =
// key === 'upperMemberName'
// ? getProductCommodityGetUpperCommodityListS2B
// : getProductCommodityGetSubCommodityListS2B;
// return new Promise(resolve => {
// fn(params).then(res => {
// resolve({
// totalCount: res.data.totalCount,
// data: res.data.data,
// });
// });
// });
return Promise.resolve({
totalCount: 1,
data: [
{
id: 1,
name: '234',
},
],
const fn =
titleKey === 'upperMemberName'
? getProductCommodityGetUpperCommodityListS2B
: getProductCommodityGetSubCommodityListS2B;
return new Promise(resolve => {
fn(params).then(res => {
resolve({
totalCount: res.data.totalCount,
data: res.data.data,
});
});
});
};
const handleOk = () => {
// setLoading(true)
// const fn =
// key === 'upperMemberName'
// ? postProductCommodityChoiceSubCommodity
// : postProductCommodityChoiceUpperCommodity;
// fn({ idList: RowCtl.selectedRowKeys }).then(res => {
// if (res.code === 1000) {
// setVisible(false);
// }
// setLoading(false)
// });
setLoading(true)
const fn =
titleKey === 'upperMemberName'
? postProductCommodityChoiceSubCommodity
: postProductCommodityChoiceUpperCommodity;
fn({ idList: RowCtl.selectedRowKeys }).then(res => {
if (res.code === 1000) {
setVisible(false);
}
setLoading(false)
});
};
return (
<Modal
title={
key === 'upperMemberName'
titleKey === 'upperMemberName'
? getIntl().formatMessage({
id: 'commodity.products.xuanzeshangyougongyingshangpin',
})
......@@ -432,7 +417,7 @@ export const ProductSel = props => {
confirmLoading={loading}
>
<StandardTable
columns={columns(key)}
columns={columns(titleKey)}
currentRef={ref}
rowSelection={rowSelection}
tableProps={{
......@@ -443,7 +428,7 @@ export const ProductSel = props => {
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
schema={newSchema(key)}
schema={newSchema(titleKey)}
/>
}
/>
......
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