Commit c71bb4d3 authored by Bill's avatar Bill

Merge branch 'dev' into test

parents fc63fc0b ecab126e
......@@ -27,7 +27,7 @@ interface MallEditPropsType {
}
}
let TemplateList = ['science']
const TemplateList = ['science']
const MallEdit: React.FC<MallEditPropsType> = (props) => {
const { query: { id, template } } = props.location
......@@ -46,11 +46,11 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
const findFirstAdvertsByType = () => {
return new Promise((resolve) => {
let params = {
const params: any = {
templateId: id,
type: 1
}
//@ts-ignore
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -63,11 +63,11 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
const findSecondAdvertsByType = () => {
return new Promise((resolve) => {
let params = {
const params: any = {
templateId: id,
type: 2
}
//@ts-ignore
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -83,7 +83,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
PublicApi.getTemplatePlatformFindAllFirstCategory().then(res => {
PublicApi.getTemplateWebCategoryWebFindAllFirstCategory().then(res => {
if (res.code === 1000) {
resolve(res.data)
} else {
......@@ -98,25 +98,12 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
*/
const fetchCategoryById = (categoryId) => {
return new Promise((resolve) => {
let param = {
const param: any = {
templateId: id,
categoryId
}
// @ts-ignore
PublicApi.getTemplatePlatformFindFirstCategoryDetail(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
const fetchTmeplateInfo = () => {
return new Promise((resolve) => {
//@ts-ignore
PublicApi.getTemplatePlatformFindMallHome({ templateId: id }).then(res => {
PublicApi.getTemplateAdornWebEnterpriseCategoryAdorn(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
......@@ -129,13 +116,15 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
*/
const fetchLeadNews = () => {
return new Promise((resolve) => {
//@ts-ignore
PublicApi.getManageContentInformationFindAllByRecommendLabel({ recommendLabel: 1 }).then(res => {
const param: any = {
recommendLabel: 1
}
PublicApi.getManageContentInformationFindAllByRecommendLabel(param).then(res => {
if (res.code === 1000) {
let leadNewsList: any = res.data || []
const leadNewsList: any = res.data || []
if (leadNewsList.length >= 2) {
let leftList = leadNewsList.slice(0, Math.round(leadNewsList.length / 2))
let rightList = leadNewsList.slice(Math.round(leadNewsList.length / 2), leadNewsList.length)
const leftList = leadNewsList.slice(0, Math.round(leadNewsList.length / 2))
const rightList = leadNewsList.slice(Math.round(leadNewsList.length / 2), leadNewsList.length)
resolve({
leadLeftNews: leftList,
leadRightNews: rightList
......@@ -160,10 +149,10 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
PublicApi.getManageContentColumnAll().then(res => {
if (res.code === 1000) {
let result = ""
let allColumn = res.data
const allColumn = res.data
if (allColumn && allColumn.length > 0) {
let labelList = allColumn.map((item: any) => item.name)
let showCount = 4
const showCount = 4
if (labelList.length <= showCount) {
result = labelList.join(' | ')
} else {
......@@ -190,7 +179,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
interactAdvertConfig[interactAdvertConfig.key].props.advertList = await findSecondAdvertsByType()
const shopList = GlobalConfig.web.shopInfo
let webMallInfo = shopList.filter(item => item.environment === 1 && item.type === 1)[0]
const webMallInfo = shopList.filter(item => item.environment === 1 && item.type === 1)[0]
headerConfig[headerConfig.key].props.logoUrl = webMallInfo.logoUrl
topBarConfig[topBarConfig.key].props.shopname = webMallInfo.name
......@@ -200,17 +189,17 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
let initIndex = 100
let floorLineConfig: any = {}
let floorLineKeys: any = []
const floorLineKeys: any = []
let firstCategory: any = await fetchFirstCategory()
const firstCategory: any = await fetchFirstCategory()
for (let item of firstCategory) {
let categoryDetail: any = await fetchCategoryById(item.id)
for (const item of firstCategory) {
const categoryDetail: any = await fetchCategoryById(item.id)
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
let FloorLine = {
const FloorLine = {
[String(initIndex + 1)]: {
"componentName": "FloorLine",
"props": {
......@@ -219,7 +208,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
"childNodes": [String(initIndex + 2), String(initIndex + 3)]
}
}
let Horizontal1 = {
const Horizontal1 = {
[String(initIndex + 2)]: {
"componentName": "FloorLine.Horizontal",
"props": {},
......@@ -227,7 +216,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Brand = {
const Brand = {
[String(initIndex + 3)]: {
"componentName": "FloorLine.Brand",
"props": {
......@@ -238,7 +227,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Category = {
const Category = {
[String(initIndex + 4)]: {
"componentName": "FloorLine.Category",
"props": {
......@@ -250,7 +239,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Vertical1 = {
const Vertical1 = {
[String(initIndex + 5)]: {
"componentName": "FloorLine.Vertical",
"props": {},
......@@ -258,7 +247,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let FloorHeader = {
const FloorHeader = {
[String(initIndex + 6)]: {
"componentName": "FloorLine.FloorHeader",
"props": {
......@@ -270,7 +259,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Banner = {
const Banner = {
[String(initIndex + 7)]: {
"componentName": "FloorLine.Banner",
"props": {
......@@ -282,14 +271,14 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Horizontal2 = {
const Horizontal2 = {
[String(initIndex + 8)]: {
"componentName": "FloorLine.Horizontal",
"props": {},
"childNodes": [String(initIndex + 9), String(initIndex + 10)]
},
}
let Goods = {
const Goods = {
[String(initIndex + 9)]: {
"componentName": "FloorLine.Goods",
"props": {
......@@ -300,7 +289,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
},
}
let Shops = {
const Shops = {
[String(initIndex + 10)]: {
"componentName": "FloorLine.Shops",
"props": {
......@@ -317,7 +306,7 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
}
mallLayoutConfig["0"].childNodes = [...mallLayoutConfig["0"].childNodes, ...floorLineKeys, FindMoreConfig.key, InformationConfig.key, FooterConfig.key]
let config = {
const config = {
...mallLayoutConfig,
...topBarConfig,
...topAdvertConfig,
......@@ -349,4 +338,4 @@ const MallEdit: React.FC<MallEditPropsType> = (props) => {
) : <Loading />
}
export default MallEdit
\ No newline at end of file
export default MallEdit
......@@ -26,7 +26,7 @@ interface MallPreviewPropsType {
}
}
let TemplateList = ['science']
const TemplateList = ['science']
const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
const { query: { id, template } } = props.location
......@@ -45,11 +45,11 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
const findFirstAdvertsByType = () => {
return new Promise((resolve) => {
let params = {
const params: any = {
templateId: id,
type: 1
}
//@ts-ignore
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -62,11 +62,11 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
const findSecondAdvertsByType = () => {
return new Promise((resolve) => {
let params = {
const params: any = {
templateId: id,
type: 2
}
//@ts-ignore
PublicApi.getTemplatePlatformFindAdvertsByType(params).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -82,7 +82,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
*/
const fetchFirstCategory = () => {
return new Promise((resolve) => {
PublicApi.getTemplatePlatformFindAllFirstCategory().then(res => {
PublicApi.getTemplateWebCategoryWebFindAllFirstCategory().then(res => {
if (res.code === 1000) {
resolve(res.data)
} else {
......@@ -99,25 +99,12 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
*/
const fetchCategoryById = (categoryId) => {
return new Promise((resolve) => {
let param = {
const param: any = {
templateId: id,
categoryId
}
// @ts-ignore
PublicApi.getTemplatePlatformFindFirstCategoryDetail(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
})
})
}
const fetchTmeplateInfo = () => {
return new Promise((resolve) => {
//@ts-ignore
PublicApi.getTemplatePlatformFindMallHome({ templateId: id }).then(res => {
PublicApi.getTemplateAdornWebEnterpriseCategoryAdorn(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
}
......@@ -130,13 +117,15 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
*/
const fetchLeadNews = () => {
return new Promise((resolve) => {
//@ts-ignore
PublicApi.getManageContentInformationFindAllByRecommendLabel({ recommendLabel: 1 }).then(res => {
const param: any = {
recommendLabel: id
}
PublicApi.getManageContentInformationFindAllByRecommendLabel(param).then(res => {
if (res.code === 1000) {
let leadNewsList: any = res.data || []
const leadNewsList: any = res.data || []
if (leadNewsList.length >= 2) {
let leftList = leadNewsList.slice(0, Math.round(leadNewsList.length / 2))
let rightList = leadNewsList.slice(Math.round(leadNewsList.length / 2), leadNewsList.length)
const leftList = leadNewsList.slice(0, Math.round(leadNewsList.length / 2))
const rightList = leadNewsList.slice(Math.round(leadNewsList.length / 2), leadNewsList.length)
resolve({
leadLeftNews: leftList,
leadRightNews: rightList
......@@ -161,10 +150,10 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
PublicApi.getManageContentColumnAll().then(res => {
if (res.code === 1000) {
let result = ""
let allColumn = res.data
const allColumn = res.data
if (allColumn && allColumn.length > 0) {
let labelList = allColumn.map((item: any) => item.name)
let showCount = 4
const showCount = 4
if (labelList.length <= showCount) {
result = labelList.join(' | ')
} else {
......@@ -191,7 +180,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
interactAdvertConfig[interactAdvertConfig.key].props.advertList = await findSecondAdvertsByType()
const shopList = GlobalConfig.web.shopInfo
let webMallInfo = shopList.filter(item => item.environment === 1 && item.type === 1)[0]
const webMallInfo = shopList.filter(item => item.environment === 1 && item.type === 1)[0]
headerConfig[headerConfig.key].props.logoUrl = webMallInfo.logoUrl
topBarConfig[topBarConfig.key].props.shopname = webMallInfo.name
......@@ -201,17 +190,17 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
let initIndex = 100
let floorLineConfig: any = {}
let floorLineKeys: any = []
const floorLineKeys: any = []
let firstCategory: any = await fetchFirstCategory()
const firstCategory: any = await fetchFirstCategory()
for (let item of firstCategory) {
let categoryDetail: any = await fetchCategoryById(item.id)
for (const item of firstCategory) {
const categoryDetail: any = await fetchCategoryById(item.id)
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
let FloorLine = {
const FloorLine = {
[String(initIndex + 1)]: {
"componentName": "FloorLine",
"props": {
......@@ -220,7 +209,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
"childNodes": [String(initIndex + 2), String(initIndex + 3)]
}
}
let Horizontal1 = {
const Horizontal1 = {
[String(initIndex + 2)]: {
"componentName": "FloorLine.Horizontal",
"props": {},
......@@ -228,7 +217,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Brand = {
const Brand = {
[String(initIndex + 3)]: {
"componentName": "FloorLine.Brand",
"props": {
......@@ -239,7 +228,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Category = {
const Category = {
[String(initIndex + 4)]: {
"componentName": "FloorLine.Category",
"props": {
......@@ -251,7 +240,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Vertical1 = {
const Vertical1 = {
[String(initIndex + 5)]: {
"componentName": "FloorLine.Vertical",
"props": {},
......@@ -259,7 +248,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let FloorHeader = {
const FloorHeader = {
[String(initIndex + 6)]: {
"componentName": "FloorLine.FloorHeader",
"props": {
......@@ -271,7 +260,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Banner = {
const Banner = {
[String(initIndex + 7)]: {
"componentName": "FloorLine.Banner",
"props": {
......@@ -283,14 +272,14 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Horizontal2 = {
const Horizontal2 = {
[String(initIndex + 8)]: {
"componentName": "FloorLine.Horizontal",
"props": {},
"childNodes": [String(initIndex + 9), String(initIndex + 10)]
},
}
let Goods = {
const Goods = {
[String(initIndex + 9)]: {
"componentName": "FloorLine.Goods",
"props": {
......@@ -301,7 +290,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
},
}
let Shops = {
const Shops = {
[String(initIndex + 10)]: {
"componentName": "FloorLine.Shops",
"props": {
......@@ -318,7 +307,7 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
}
mallLayoutConfig["0"].childNodes = [...mallLayoutConfig["0"].childNodes, ...floorLineKeys, FindMoreConfig.key, InformationConfig.key, FooterConfig.key]
let config = {
const config = {
...mallLayoutConfig,
...topBarConfig,
...topAdvertConfig,
......@@ -349,4 +338,4 @@ const MallPreview: React.FC<MallPreviewPropsType> = (props) => {
) : <Loading />
}
export default MallPreview
\ No newline at end of file
export default MallPreview
......@@ -40,26 +40,26 @@ const formActions = createFormActions();
const common_columns: any = [
{ title: 'ID', dataIndex: 'memberId' },
{
title: '会员名称',
dataIndex: 'name',
{
title: '会员名称',
dataIndex: 'name',
render: (text: string, record: any) => {
return record.name || record.memberName
}
},
{ title: '会员类型', dataIndex: 'memberTypeName' },
{ title: '会员角色', dataIndex: 'roleName' },
{
title: '会员等级',
dataIndex: 'levelTag',
{
title: '会员等级',
dataIndex: 'levelTag',
render: (text: string, record: any) => {
return record.levelTag || record.levelName
}
}
},
]
const MemberSettleAdd: React.FC = () => {
const [visible, setVisible] = useState(false)
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'memberId' });
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'uniqueId' });
const [initialValue, setInitialValue] = useState({});
const [cacheMember, setCacheMember] = useState([]);
const { id, preview } = usePageStatus();
......@@ -69,28 +69,28 @@ const MemberSettleAdd: React.FC = () => {
const tableAddButton = () => {
return (
<div>
<Button
onClick={() => setVisible(true)}
style={{marginBottom: 16}}
block
icon={<PlusOutlined/>}
<Button
onClick={() => setVisible(true)}
style={{marginBottom: 16}}
block
icon={<PlusOutlined/>}
type='dashed'
>
选择适用会员
</Button>
</Button>
</div>
)
}
const columns = common_columns.concat(
[
{
title: '操作',
{
title: '操作',
render: (text, record) => {
return (
<a onClick={() => handleRemove(record.memberId)}>删除</a>
<a onClick={() => handleRemove(record.uniqueId)}>删除</a>
)
}
}
}
]
);
......@@ -102,17 +102,19 @@ const MemberSettleAdd: React.FC = () => {
// 获取适用会员
const fetchMemberData = async (params: any) => {
///member/manage/all/provider/page
const { data, code } = await PublicApi.getMemberManageAllProviderPage(params);
if(code === 1000) {
return data
const { data } = await PublicApi.getMemberManageAllProviderPage(params);
console.log(data);
return {
...data,
data: data.data.map((v) => ({...v, uniqueId: v.memberId + "_" + v.roleId})),
totalCount: data.totalCount
}
return [];
}
// 获取适用会员下拉搜索框
const fetchMemberSearchFilter = () => {
const linkage = useLinkageUtils();
onFormInit$().subscribe(() => {
PublicApi.getMemberManagePageitems({roleTypeEnum: '1'}).then(res => {
if(res.code === 1000) {
......@@ -135,8 +137,8 @@ const MemberSettleAdd: React.FC = () => {
// 提交
const handleSubmit = (value) => {
const memberList = value.someLists.map((item) => (
{
memberId: item.memberId,
{
memberId: item.memberId,
roleId: item.roleId,
}
)
......@@ -153,8 +155,8 @@ const MemberSettleAdd: React.FC = () => {
const serviceActions = isAdd
? PublicApi.postSettleAccountsPlatformConfigAddPlatformSettlementStrategy
: PublicApi.postSettleAccountsPlatformConfigUpdatePlatformSettlementStrategy
const postData = {...tempData, id: id || 0 }
const postData = {...tempData, id: id || 0 }
console.log(postData)
setSubmitLoading(true);
setUnsaved(false);
......@@ -175,14 +177,14 @@ const MemberSettleAdd: React.FC = () => {
const handleRemove = (id: number) => {
const string = 'Tabs.memberTab.someLists';
const chooseList = formActions.getFieldValue(string);
const res = chooseList.filter((item) => item.memberId !== id);
const res = chooseList.filter((item) => item.uniqueId !== id);
formActions.setFieldValue(string, res);
// 必须设置key
memberRowCtl.setSelectRow(res);
memberRowCtl.setSelectedRowKeys(res.map((item) => item.memberId))
memberRowCtl.setSelectedRowKeys(res.map((item) => item.uniqueId))
}
// 从PAAS平台--规则配置--平台规则配置取已勾选的结算方式决定是否显示结算方式
const fetchBalancedMethods = async () => {
const { data } = await PublicApi.getManageRuleConfigurationList({platformType: '5'});
......@@ -218,18 +220,17 @@ const MemberSettleAdd: React.FC = () => {
active: res.data.settlementWay,
otherValues: [res.data.settlementDays, res.data.settlementDate],
},
})
formActions.setFieldValue('Tabs.memberTab.layout.isDefault', res.data.isDefault)
formActions.setFieldValue('Tabs.memberTab.someLists', res.data.memberList);
const list = res.data.memberList.map((item) => ({...item, uniqueId: item.memberId + "_" + item.roleId}))
formActions.setFieldValue('Tabs.memberTab.someLists', list);
// 必须设置key
memberRowCtl.setSelectRow(res.data.memberList);
memberRowCtl.setSelectedRowKeys(res.data.memberList.map((item) => item.memberId))
memberRowCtl.setSelectRow(list);
memberRowCtl.setSelectedRowKeys(res.data.memberList.map((item) => item.memberId + "_" + item.roleId))
} else {
message.error({content: res.message})
}
}
getInfo();
}
......@@ -256,13 +257,13 @@ const MemberSettleAdd: React.FC = () => {
schema={addSchema}
effects={() => {
// 获取单据类型
useAsyncSelect(
"settlementOrderType",
useAsyncSelect(
"settlementOrderType",
fetchOptions(PublicApi.getSettleAccountsCommonGetPlatformStrategySettlementOrderType )
)
}}
/>
<ModalTable
modalTitle='选择适用会员'
confirm={handleOkAddMember}
......@@ -272,12 +273,12 @@ const MemberSettleAdd: React.FC = () => {
rowSelection={memberRowSelection}
fetchTableData={params => fetchMemberData(params)}
tableProps={{
rowKey: 'memberId',
rowKey: 'uniqueId',
}}
width={1000}
formilyProps={
{
ctx: {
ctx: {
schema: memberSchema,
actions: formActions,
components: { ModalSearch: Search, SearchSelect, Submit } ,
......@@ -300,4 +301,4 @@ const MemberSettleAdd: React.FC = () => {
)
}
export default MemberSettleAdd
\ No newline at end of file
export default MemberSettleAdd
......@@ -2,7 +2,7 @@ import { ISchema } from '@formily/antd'
import { FORM_FILTER_PATH } from '@/formSchema/const';
/**
* 新增会员结算策略schema
*
*
*/
export const addSchema: ISchema = {
......@@ -114,7 +114,7 @@ export const addSchema: ISchema = {
},
'x-component': 'MultTable',
'x-component-props': {
rowKey: 'memberId',
rowKey: 'uniqueId',
prefix: "{{tableAddButton}}",
columns: "{{tableColumns}}"
// columns: "{{tableColumns}}",
......@@ -192,4 +192,4 @@ export const memberSchema: ISchema = {
}
}
}
}
\ No newline at end of file
}
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