Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shenshaokai
jinfa-admin
Commits
5496f5e7
Commit
5496f5e7
authored
Sep 28, 2021
by
前端-钟卫鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2' of
http://10.0.0.22:3000/lingxi/lingxi-business-system
into v2
parents
b079b4ba
454c67c5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
423 additions
and
196 deletions
+423
-196
useGetLayout.tsx
...stomized/categoryNavigation/common/hooks/useGetLayout.tsx
+11
-3
index.tsx
...mized/categoryNavigation/components/Layout/Tabs/index.tsx
+4
-0
index.tsx
src/pages/pageCustomized/categoryNavigation/index.tsx
+4
-3
editMallModal.tsx
.../ruleSettingManage/mallRules/components/editMallModal.tsx
+113
-0
mall.tsx
src/pages/ruleSettingManage/mallRules/components/mall.tsx
+0
-0
member.tsx
src/pages/ruleSettingManage/mallRules/components/member.tsx
+52
-36
constant.ts
src/pages/ruleSettingManage/mallRules/constant.ts
+51
-0
memberContext.tsx
...ges/ruleSettingManage/mallRules/context/memberContext.tsx
+9
-0
detail.tsx
src/pages/ruleSettingManage/mallRules/detail.tsx
+68
-29
index.tsx
src/pages/ruleSettingManage/mallRules/index.tsx
+18
-18
preview.tsx
src/pages/ruleSettingManage/mallRules/preview.tsx
+93
-107
No files found.
src/pages/pageCustomized/categoryNavigation/common/hooks/useGetLayout.tsx
View file @
5496f5e7
...
...
@@ -54,10 +54,18 @@ function useGetLayout() {
const
configKey
=
startKey
+
_index
;
dataFromRequest
[
_item
.
id
]
=
_item
;
tabKeys
.
push
(
configKey
.
toString
());
// const children = Object.keys(_item.children);
// console.log(children);
const
children
=
[
'secondary'
,
'flashSale'
,
'saleRanking'
,
'brand'
,
'suggestProduct'
];
/** [{ name: 'secondary', sort: 1 }] */
const
withSortedChildren
=
Object
.
keys
(
_item
.
children
).
map
((
_typeName
:
string
)
=>
{
const
{
sort
}
=
_item
.
children
[
_typeName
];
return
{
name
:
_typeName
,
sort
:
sort
,
};
});
// const children = ['secondary', 'flashSale', 'saleRanking', 'brand', 'suggestProduct'];
const
children
=
withSortedChildren
.
sort
((
a
,
b
)
=>
a
.
sort
-
b
.
sort
).
map
((
_sortItem
)
=>
_sortItem
.
name
);
const
tabConfig
:
any
=
{
componentName
:
tabName
,
title
:
_item
.
name
,
...
...
src/pages/pageCustomized/categoryNavigation/components/Layout/Tabs/index.tsx
View file @
5496f5e7
...
...
@@ -27,6 +27,9 @@ const CustomizeTabs: React.FC<Iprops> & { TabItem: typeof TabItem } = (props: Ip
// };
const
getActivityProduct
=
async
(
ids
:
number
[])
=>
{
if
(
ids
.
length
===
0
)
{
return
null
;
}
return
PublicApi
.
getMarketingAdornActivityGoodsAdorn
({
ids
:
ids
as
any
});
};
...
...
@@ -157,6 +160,7 @@ const CustomizeTabs: React.FC<Iprops> & { TabItem: typeof TabItem } = (props: Ip
...
resultData
};
const
cloneDeepPageConfig
=
cloneDeep
(
pageConfig
);
console
.
log
(
cloneDeepPageConfig
);
Object
.
keys
(
resultDataWithSecondary
).
forEach
((
_item
)
=>
{
const
parentKey
=
domKeyMap2Type
.
get
(
_item
);
if
(
!
parentKey
)
{
...
...
src/pages/pageCustomized/categoryNavigation/index.tsx
View file @
5496f5e7
...
...
@@ -81,7 +81,7 @@ const CategoryNavigation = () => {
/** domKey 从7开始都是tab 的值 */
setLoading
(
true
);
const
tabChildren
=
pageConfig
[
4
].
childNodes
.
slice
(
1
);
const
result
=
tabChildren
.
map
((
_nodeKey
)
=>
{
const
result
=
tabChildren
.
map
((
_nodeKey
:
string
)
=>
{
if
(
!
pageConfig
[
_nodeKey
])
{
return
;
}
...
...
@@ -100,13 +100,14 @@ const CategoryNavigation = () => {
};
const
tabItemData
=
{};
const
tabItemChild
=
pageConfig
[
_nodeKey
].
childNodes
;
tabItemChild
.
forEach
(
element
=>
{
tabItemChild
.
forEach
(
(
element
,
_index
)
=>
{
const
{
otherProps
:
{
type
},
props
,
childNodes
}
=
pageConfig
[
element
];
const
rest
=
type
===
'suggestProduct'
?
{
type
:
props
.
type
,
num
:
props
.
num
}
:
{};
const
rest
=
type
===
'suggestProduct'
?
{
type
:
props
.
type
||
1
,
num
:
props
.
num
||
50
}
:
{};
tabItemData
[
type
]
=
{
title
:
props
?.
title
||
TITLE_MAP
[
type
],
...
rest
,
sort
:
_index
+
1
,
children
:
childNodes
.
map
((
_son
)
=>
{
const
sonData
=
pageConfig
[
_son
];
...
...
src/pages/ruleSettingManage/mallRules/components/editMallModal.tsx
0 → 100644
View file @
5496f5e7
import
{
useState
,
useImperativeHandle
,
forwardRef
}
from
'react'
import
{
Modal
}
from
'antd'
import
NiceForm
from
'@/components/NiceForm'
;
import
{
ISchema
}
from
'@formily/antd'
;
import
{
createFormActions
}
from
'@formily/antd'
;
export
type
RefProps
=
{
show
:
(
flag
:
boolean
,
data
?:
any
)
=>
void
}
const
formActions
=
createFormActions
()
const
classSchema
:
ISchema
=
{
type
:
'object'
,
properties
:
{
megaLayout
:
{
type
:
'object'
,
"x-component"
:
"mega-layout"
,
"x-component-props"
:
{
grid
:
true
,
columns
:
16
,
labelAlign
:
'top'
},
properties
:
{
noField1
:
{
type
:
'object'
,
"x-component"
:
'mega-layout'
,
"x-component-props"
:
{
full
:
true
,
},
"x-mega-props"
:
{
span
:
1
},
properties
:
{
name
:
{
type
:
'string'
,
title
:
'商城名称'
,
required
:
true
,
"x-component-props"
:
{
placeholder
:
'请输入商城名称'
},
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
20
}
]
},
describe
:
{
type
:
'string'
,
title
:
'商城描述'
,
"x-component-props"
:
{
placeholder
:
'请输入商城描述'
},
"x-rules"
:
[
{
limitByte
:
true
,
maxByte
:
80
}
]
},
logoUrl
:
{
title
:
'商城LOGO'
,
'x-component'
:
'CustomUpload'
},
}
},
}
}
}
}
const
Page
=
({
onOk
}:
any
,
ref
:
any
)
=>
{
const
[
visible
,
setVisible
]
=
useState
<
boolean
>
(
false
)
const
[
initData
,
setInitData
]
=
useState
<
any
>
({})
useImperativeHandle
(
ref
,
()
=>
({
show
(
flag
:
boolean
,
data
?:
any
)
{
if
(
data
)
{
setInitData
(
data
)
}
setVisible
(
flag
)
}
}))
const
onFinish
=
(
value
)
=>
{
onOk
&&
onOk
(
value
)
setVisible
(
false
)
}
return
(
<
Modal
title=
'修改商城信息'
maskClosable=
{
false
}
destroyOnClose
visible=
{
visible
}
onOk=
{
()
=>
formActions
.
submit
()
}
onCancel=
{
()
=>
setVisible
(
false
)
}
>
<
NiceForm
value=
{
initData
}
name=
'classForm'
onSubmit=
{
onFinish
}
actions=
{
formActions
}
schema=
{
classSchema
}
>
</
NiceForm
>
</
Modal
>
)
}
export
default
forwardRef
(
Page
)
src/pages/ruleSettingManage/mallRules/components/mall.tsx
View file @
5496f5e7
This diff is collapsed.
Click to expand it.
src/pages/ruleSettingManage/mallRules/components/member.tsx
View file @
5496f5e7
import
React
,
{
Fragment
,
useEffect
,
useState
}
from
'react'
import
{
Form
,
Radio
,
Table
,
Button
}
from
'antd'
;
import
React
,
{
Fragment
,
useEffect
,
useState
,
useContext
}
from
'react'
import
{
Form
,
Table
,
Button
}
from
'antd'
;
import
{
ColumnType
}
from
'antd/lib/table'
;
import
ModalTable
from
'@/components/ModalTable'
import
SearchSelect
from
'@/components/NiceForm/components/SearchSelect'
...
...
@@ -13,18 +13,24 @@ import { PublicApi } from '@/services/api';
import
{
useRowSelectionTable
}
from
'@/hooks/useRowSelectionTable'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
LevelBrand
from
'@/components/LevelBrand'
;
import
{
Context
}
from
'../context/memberContext'
interface
Iprops
{
rowCtl
:
(
key
:
string
,
e
)
=>
void
,
initData
:
any
,
/** ID */
id
?:
number
}
const
MemberInfo
:
React
.
FC
<
Iprops
>
=
(
props
:
any
)
=>
{
const
{
rowCtl
,
id
}
=
props
;
const
MemberInfo
:
React
.
FC
<
Iprops
>
=
(
props
)
=>
{
const
{
rowCtl
,
initData
,
id
}
=
props
;
const
{
fnSetMemberId
}
=
useContext
(
Context
)
||
{};
const
[
visibleChannelRroduct
,
setVisibleChannelRroduct
]
=
useState
(
false
)
const
[
memberRowSelection
,
memberRowCtl
]
=
useRowSelectionTable
({
customKey
:
'id'
,
type
:
'radio'
})
const
[
dataSource
,
setDataSource
]
=
useState
<
any
>
([])
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
...
...
@@ -33,8 +39,8 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
},
{
title
:
'会员名称'
,
key
:
'
n
ame'
,
dataIndex
:
'
n
ame'
key
:
'
memberN
ame'
,
dataIndex
:
'
memberN
ame'
},
{
title
:
'会员类型'
,
...
...
@@ -48,16 +54,18 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
},
{
title
:
'会员等级'
,
key
:
'levelTag'
,
dataIndex
:
'levelTag'
key
:
'level'
,
dataIndex
:
'level'
,
render
:
(
text
)
=>
<
LevelBrand
level=
{
text
}
/>
},
{
title
:
'操作'
,
key
:
'operate'
,
dataIndex
:
'operate'
,
render
:
(
_text
,
record
)
=>
<
Button
type=
'link'
onClick=
{
()
=>
handleDelect
(
record
.
memberId
)
}
>
删除
</
Button
>
render
:
(
_text
,
record
)
=>
!
id
&&
<
Button
type=
'link'
onClick=
{
()
=>
handleDelect
(
record
.
memberId
)
}
>
删除
</
Button
>
}
]
const
columnsSetProduct
:
any
[]
=
[
{
dataIndex
:
'memberRoleId'
,
...
...
@@ -71,9 +79,9 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
key
:
'memberId'
},
{
dataIndex
:
'
n
ame'
,
dataIndex
:
'
memberN
ame'
,
title
:
'会员名称'
,
key
:
'
n
ame'
key
:
'
memberN
ame'
},
{
dataIndex
:
'memberTypeName'
,
...
...
@@ -86,12 +94,13 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
key
:
'roleName'
},
{
dataIndex
:
'level
Tag
'
,
dataIndex
:
'level'
,
title
:
'会员等级'
,
key
:
'level
Tag
'
,
render
:
(
text
,
record
)
=>
<
LevelBrand
level=
{
record
.
level
}
/>
key
:
'level'
,
render
:
(
text
)
=>
<
LevelBrand
level=
{
text
}
/>
},
]
const
formMember
:
ISchema
=
{
type
:
'object'
,
properties
:
{
...
...
@@ -156,8 +165,11 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
const
handleDelect
=
(
id
)
=>
{
const
data
=
[...
dataSource
];
const
source
=
data
.
filter
(
item
=>
item
.
memberId
!==
id
);
memberRowCtl
.
setSelectedRowKeys
(
source
.
map
(
v
=>
v
.
memberId
))
memberRowCtl
.
setSelectRow
(
source
);
setDataSource
(
source
);
rowCtl
(
'members'
,
source
)
fnSetMemberId
&&
fnSetMemberId
(
undefined
)
}
// 会员弹框筛选select值
...
...
@@ -183,7 +195,7 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
const
fetchMembersList
=
async
(
params
)
=>
{
const
res
=
await
PublicApi
.
getMemberManageAllProviderPage
(
params
)
const
{
code
,
data
}
=
res
let
_data
=
data
.
data
.
map
(
item
=>
({
...
item
,
memberRoleId
:
item
.
memberId
+
'_'
+
item
.
roleId
}))
let
_data
=
data
.
data
.
map
(
item
=>
({
...
item
,
member
Name
:
item
.
name
,
member
RoleId
:
item
.
memberId
+
'_'
+
item
.
roleId
}))
return
{
totalCount
:
data
.
totalCount
,
data
:
_data
}
}
...
...
@@ -194,41 +206,45 @@ const MemberInfo: React.FC<Iprops> = (props: any) => {
const
handleOkAddMember
=
()
=>
{
setVisibleChannelRroduct
(
false
)
setDataSource
(
memberRowCtl
.
selectRow
)
fnSetMemberId
&&
fnSetMemberId
(
memberRowCtl
.
selectRow
[
0
]?.
memberId
)
rowCtl
(
'members'
,
memberRowCtl
.
selectRow
.
map
(
item
=>
{
return
{
memberId
:
item
.
memberId
,
roleId
:
item
.
roleId
,
memberName
:
item
.
memberName
,
memberTypeName
:
item
.
memberTypeName
,
roleName
:
item
.
roleName
,
level
:
item
.
level
,
memberRoleId
:
item
.
roleId
}
}))
}
useEffect
(()
=>
{
if
(
id
)
{
PublicApi
.
getOrderPlatformPaymentMemberPage
({
paymentId
:
id
,
pageSize
:
'999'
,
current
:
'1'
,
name
:
''
}).
then
(
res
=>
{
if
(
res
.
code
!==
1000
)
{
return
}
const
{
data
}
=
res
.
data
;
memberRowCtl
.
setSelectedRowKeys
(
data
.
map
(
v
=>
v
.
memberId
))
memberRowCtl
.
setSelectRow
(
data
);
rowCtl
(
'members'
,
data
)
setDataSource
(
data
)
})
if
(
initData
.
members
)
{
memberRowCtl
.
setSelectedRowKeys
(
initData
.
members
.
map
(
v
=>
v
.
memberId
))
memberRowCtl
.
setSelectRow
(
initData
.
members
);
rowCtl
(
'members'
,
initData
.
members
)
setDataSource
(
initData
.
members
)
}
}
},
[
i
d
])
},
[
i
nitData
])
return
(
<
Fragment
>
<
Form
.
Item
name=
'members'
wrapperCol=
{
{
span
:
24
}
}
>
<
Button
type=
'dashed'
block
icon=
{
<
PlusOutlined
/>
}
style=
{
{
marginBottom
:
'24px'
}
}
onClick=
{
()
=>
setVisibleChannelRroduct
(
true
)
}
>
选择会员
</
Button
>
{
!
id
&&
<
Button
type=
'dashed'
block
icon=
{
<
PlusOutlined
/>
}
style=
{
{
marginBottom
:
'24px'
}
}
onClick=
{
()
=>
setVisibleChannelRroduct
(
true
)
}
>
选择会员
</
Button
>
}
<
Table
pagination=
{
{
size
:
'small'
...
...
src/pages/ruleSettingManage/mallRules/constant.ts
0 → 100644
View file @
5496f5e7
/**
* 商城类型
*/
export
const
MALL_TYPE
=
{
1
:
'企业商城'
,
2
:
'积分商城'
,
3
:
'渠道商城'
,
4
:
'渠道自有商城'
,
5
:
'渠道积分商城'
,
6
:
'采购门户'
,
7
:
'物流服务门户'
,
8
:
'加工服务门户'
,
9
:
'行情资讯门户'
}
/**
* 商城环境
*/
export
const
MALL_ENV
=
{
1
:
'web'
,
2
:
'H5'
,
3
:
'小程序'
,
4
:
'APP'
}
/**
* 商城属性
*/
export
const
MALL_PROPERTY
=
{
1
:
'B端商城'
,
2
:
'C端商城 '
,
3
:
'B端自营商城'
,
4
:
'C端自营商城'
}
/**
* 是否默认
*/
export
const
IS_DEFAULT
=
{
0
:
'否'
,
1
:
'是 '
,
}
/**
* 是否默认-COLOR
*/
export
const
IS_DEFAULT_COLOR
=
{
0
:
'default'
,
1
:
'processing '
,
}
\ No newline at end of file
src/pages/ruleSettingManage/mallRules/context/memberContext.tsx
0 → 100644
View file @
5496f5e7
import
React
from
'react'
;
export
const
Context
=
React
.
createContext
<
{
memberId
:
number
|
string
fnSetMemberId
:
Function
}
|
null
>
(
null
);
export
const
MemberProvider
=
Context
.
Provider
;
src/pages/ruleSettingManage/mallRules/detail.tsx
View file @
5496f5e7
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Card
,
Tabs
,
Form
,
Button
}
from
'antd'
;
import
{
Card
,
Tabs
,
Form
,
Button
,
message
}
from
'antd'
;
import
{
history
,
Prompt
}
from
'umi'
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
ReutrnEle
from
'@/components/ReturnEle'
;
...
...
@@ -7,6 +7,7 @@ import Mall from './components/mall';
import
Member
from
'./components/member'
;
import
{
SaveOutlined
}
from
'@ant-design/icons'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
MemberProvider
}
from
'./context/memberContext'
const
layout
:
any
=
{
colon
:
false
,
...
...
@@ -17,28 +18,38 @@ const layout: any = {
const
{
TabPane
}
=
Tabs
;
const
PaymentConfigLayout
=
()
=>
{
const
{
query
:
{
id
,
},
pathname
,
}:
any
=
history
.
location
;
const
[
path
]
=
useState
(
pathname
.
split
(
'/'
)[
pathname
.
split
(
'/'
).
length
-
1
]);
const
{
query
:
{
id
}
}:
any
=
history
.
location
;
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
)
const
[
unsaved
,
setUnsaved
]
=
useState
<
boolean
>
(
false
);
const
[
initData
,
setInitData
]
=
useState
<
any
>
({});
const
[
memberId
,
setMemberId
]
=
useState
<
any
>
();
const
[
form
]
=
Form
.
useForm
();
const
handleSubmit
=
()
=>
{
form
.
validateFields
().
then
(
res
=>
{
console
.
log
(
`res`
,
res
)
const
params
:
any
=
{
name
:
res
.
name
,
if
(
!
res
.
members
||
!
res
.
members
?.
length
)
{
return
message
.
warning
(
'请选择会员'
)
}
if
(
res
.
members
)
{
params
.
members
=
res
.
members
if
(
!
res
.
shopList
||
!
res
.
shopList
?.
length
)
{
return
message
.
warning
(
'请选择商城'
)
}
id
&&
(
params
.
paymentId
=
id
);
return
const
fetchApi
=
id
?
PublicApi
.
postOrderPlatformPaymentUpdate
:
PublicApi
.
postOrderPlatformPaymentCreate
;
const
params
:
any
=
{
id
,
...
res
.
members
[
0
],
shopList
:
res
.
shopList
.
map
(
item
=>
{
return
{
...
item
,
id
:
!
id
?
undefined
:
item
.
id
}
})
}
console
.
log
(
`params`
,
params
)
const
fetchApi
=
id
?
PublicApi
.
postManageShopRuleUpdate
:
PublicApi
.
postManageShopRuleAdd
;
setLoading
(
true
)
fetchApi
(
params
).
then
(
res
=>
{
if
(
res
.
code
!==
1000
)
{
...
...
@@ -58,15 +69,41 @@ const PaymentConfigLayout = () => {
})
}
const
fnSetMemberId
=
(
mId
)
=>
{
setMemberId
(
mId
)
let
shopList
=
form
.
getFieldValue
(
'shopList'
)
if
(
shopList
&&
shopList
.
length
)
{
shopList
=
shopList
.
map
(
item
=>
{
const
urlArr
=
item
.
url
.
split
(
'/'
)
urlArr
[
urlArr
.
length
-
1
]
=
mId
||
''
return
{
...
item
,
url
:
urlArr
.
join
(
'/'
)
}
})
setInitData
({
shopList
})
}
}
useEffect
(()
=>
{
if
(
id
)
{
PublicApi
.
getOrderPlatformPaymentDetail
({
paymentId
:
id
}).
then
(
res
=>
{
if
(
res
.
code
!==
1000
)
{
return
PublicApi
.
getManageShopRuleGet
({
id
}).
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
const
{
shopList
,
...
rest
}
=
res
.
data
const
data
=
{
members
:
[{
...
rest
}],
shopList
:
shopList
.
map
(
item
=>
{
let
url
=
item
.
url
.
split
(
'/'
)
url
.
pop
()
return
{
...
item
,
domainName
:
url
.
join
(
'/'
)
+
'/'
}
})
}
setMemberId
(
rest
.
memberId
)
setInitData
(
data
)
}
form
.
setFieldsValue
({
...
res
.
data
,
})
})
}
},
[])
...
...
@@ -95,14 +132,16 @@ const PaymentConfigLayout = () => {
}
}
}
>
<
Tabs
>
<
TabPane
tab=
'适用会员'
key=
{
1
}
forceRender
>
<
Member
id=
{
id
}
rowCtl=
{
rowCtl
}
/>
</
TabPane
>
<
TabPane
tab=
'适用商城'
key=
{
2
}
forceRender
>
<
Mall
id=
{
id
}
rowCtl=
{
rowCtl
}
/>
</
TabPane
>
</
Tabs
>
<
MemberProvider
value=
{
{
memberId
,
fnSetMemberId
}
}
>
<
Tabs
>
<
TabPane
tab=
'适用会员'
key=
{
1
}
forceRender
>
<
Member
id=
{
id
}
rowCtl=
{
rowCtl
}
initData=
{
initData
}
/>
</
TabPane
>
<
TabPane
tab=
'适用商城'
key=
{
2
}
forceRender
>
<
Mall
id=
{
id
}
rowCtl=
{
rowCtl
}
initData=
{
initData
}
/>
</
TabPane
>
</
Tabs
>
</
MemberProvider
>
</
Form
>
</
Card
>
<
Prompt
when=
{
unsaved
}
message=
"您还有未保存的内容,是否确定要离开?"
/>
...
...
src/pages/ruleSettingManage/mallRules/index.tsx
View file @
5496f5e7
...
...
@@ -14,15 +14,15 @@ const List: React.FC<{}> = () => {
const
columns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'会员ID'
,
dataIndex
:
'
payment
Id'
,
key
:
'
payment
Id'
,
dataIndex
:
'
member
Id'
,
key
:
'
member
Id'
,
},
{
title
:
'会员名称'
,
dataIndex
:
'
n
ame'
,
key
:
'
n
ame'
,
dataIndex
:
'
memberN
ame'
,
key
:
'
memberN
ame'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
EyePreview
url=
{
`/ruleSettingManager/mallRules/preview?id=${record.
paymentI
d}`
}
>
<
EyePreview
url=
{
`/ruleSettingManager/mallRules/preview?id=${record.
i
d}`
}
>
{
text
}
</
EyePreview
>
)
...
...
@@ -37,15 +37,15 @@ const List: React.FC<{}> = () => {
{
title
:
'会员角色'
,
align
:
'center'
,
dataIndex
:
'role
Type
Name'
,
key
:
'role
Type
Name'
,
dataIndex
:
'roleName'
,
key
:
'roleName'
,
// render: (data) => findArrayItem(MEMBER_ROLE_LISTS, data).label
},
{
title
:
'会员等级'
,
align
:
'center'
,
dataIndex
:
'level
Tag
'
,
key
:
'level
Tag
'
,
dataIndex
:
'level'
,
key
:
'level'
,
render
:
(
text
,
record
)
=>
<
LevelBrand
level=
{
record
.
level
}
/>
},
{
...
...
@@ -66,10 +66,10 @@ const List: React.FC<{}> = () => {
dataIndex
:
'operate'
,
render
:
(
_
,
record
)
=>
!
record
.
status
&&
(
<
Fragment
>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/ruleSettingManager/mallRules/edit?id=${record.
paymentI
d}`
)
}
>
修改
</
Button
>
<
Button
type=
'link'
onClick=
{
()
=>
history
.
push
(
`/ruleSettingManager/mallRules/edit?id=${record.
i
d}`
)
}
>
修改
</
Button
>
<
Popconfirm
title=
"确定要执行这个操作?"
onConfirm=
{
()
=>
handleDelete
(
record
.
paymentI
d
)
}
onConfirm=
{
()
=>
handleDelete
(
record
.
i
d
)
}
>
<
Button
type=
'link'
>
删除
</
Button
>
</
Popconfirm
>
...
...
@@ -78,16 +78,16 @@ const List: React.FC<{}> = () => {
}
]
const
handleModify
=
async
(
record
:
any
)
=>
{
await
PublicApi
.
postOrderPlatformPayment
Status
({
paymentId
:
record
.
paymentI
d
,
await
PublicApi
.
getManageShopRuleUpdate
Status
({
id
:
record
.
i
d
,
status
:
record
.
status
===
1
?
0
:
1
})
ref
.
current
.
reload
()
}
//删除
const
handleDelete
=
async
(
paymentI
d
)
=>
{
await
PublicApi
.
postOrderPlatformPaymentDelete
({
paymentI
d
})
const
handleDelete
=
async
(
i
d
)
=>
{
await
PublicApi
.
getManageShopRuleDelete
({
i
d
})
ref
.
current
.
reload
()
}
const
handleToAdd
=
()
=>
{
...
...
@@ -95,7 +95,7 @@ const List: React.FC<{}> = () => {
}
const
fetchData
=
(
params
:
any
)
=>
{
return
new
Promise
((
resolve
)
=>
{
PublicApi
.
get
OrderPlatformPaymentPage
({
...
params
}).
then
(
res
=>
{
PublicApi
.
get
ManageShopRuleList
({
...
params
}).
then
(
res
=>
{
resolve
(
res
.
data
)
})
})
...
...
@@ -104,7 +104,7 @@ const List: React.FC<{}> = () => {
<
Card
>
<
StandardTable
currentRef=
{
ref
}
tableProps=
{
{
rowKey
:
'
paymentI
d'
}
}
tableProps=
{
{
rowKey
:
'
i
d'
}
}
columns=
{
columns
}
fetchTableData=
{
(
params
:
any
)
=>
fetchData
(
params
)
}
formilyLayouts=
{
{
...
...
@@ -132,7 +132,7 @@ const List: React.FC<{}> = () => {
schema
:
{
type
:
'object'
,
properties
:
{
n
ame
:
{
memberN
ame
:
{
type
:
'string'
,
"x-component"
:
'search'
,
"x-component-props"
:
{
...
...
src/pages/ruleSettingManage/mallRules/preview.tsx
View file @
5496f5e7
import
React
,
{
Fragment
,
useEffect
,
useState
}
from
'react'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
PageHeaderWrapper
}
from
'@ant-design/pro-layout'
;
import
{
Card
,
Tabs
,
Form
,
Typography
,
Spac
e
}
from
'antd'
;
import
{
Card
,
Tabs
,
Form
,
Image
,
Tabl
e
}
from
'antd'
;
import
{
history
}
from
'umi'
import
{
PublicApi
}
from
'@/services/api'
;
import
ReutrnEle
from
'@/components/ReturnEle'
;
import
style
from
'./components/index.less'
;
import
ListLayout
from
'@/components/DetailLayout/components/listLayout'
;
import
{
ColumnType
}
from
'rc-table/lib/interface'
;
import
{
StandardTable
}
from
'god'
;
import
{
isEmpty
}
from
'@formily/shared'
;
import
StatusSwitch
from
'@/components/StatusSwitch'
import
LevelBrand
from
'@/components/LevelBrand'
;
import
{
MALL_ENV
,
MALL_PROPERTY
,
IS_DEFAULT
}
from
'./constant'
const
layout
:
any
=
{
colon
:
false
,
...
...
@@ -18,89 +16,13 @@ const layout: any = {
};
const
{
TabPane
}
=
Tabs
;
type
GetOrderPlatformPaymentDetailResponse
=
{
/**
* 支付策略Id
*/
paymentId
:
number
/**
* 指定会员
*/
allMembers
?:
boolean
,
/**
* 支付策略名称
*/
name
:
string
/**
* 支付方式与支付渠道列表 ,PlatformPaymentPayTypeDetailVO
*/
payTypes
:
{
/**
* 支付方式枚举
*/
payType
:
number
/**
* 支付方式名称
*/
payTypeName
:
string
/**
* 资金归集模式列表 ,PlatformPaymentFundModeVO
*/
fundModes
:
{
/**
* 资金归集模式枚举
*/
fundMode
?:
number
/**
* 资金归集模式名称
*/
fundModeName
?:
string
}[]
/**
* 已选择的资金归集模式枚举值
*/
fundMode
:
number
/**
* 支付渠道列表 ,PlatformPaymentPayChannelVO
*/
channels
:
{
/**
* 支付渠道类型枚举
*/
payChannel
?:
number
/**
* 支付渠道类型名称
*/
payChannelName
?:
string
}[]
/**
* 已选择的支付渠道枚举值列表 ,Integer
*/
payChannels
:
number
[]
}[]
}
const
Preview
=
()
=>
{
const
{
query
:
{
id
,
},
}:
any
=
history
.
location
;
const
[
data
,
setData
]
=
useState
<
GetOrderPlatformPaymentDetailResponse
>
();
const
{
query
:
{
id
}
}:
any
=
history
.
location
;
useEffect
(()
=>
{
if
(
id
)
{
PublicApi
.
getOrderPlatformPaymentDetail
({
paymentId
:
id
}).
then
(
res
=>
{
if
(
res
.
code
!==
1000
)
{
return
}
const
{
data
}
=
res
;
setData
(
data
)
})
}
},
[])
const
[
sourceData
,
setSourceData
]
=
useState
<
any
>
({
members
:
[],
shopList
:
[]
})
const
columns
:
any
[]
=
[
// 会员columns
const
memberColumns
=
[
{
title
:
'ID'
,
key
:
'memberId'
,
...
...
@@ -108,8 +30,8 @@ const Preview = () => {
},
{
title
:
'会员名称'
,
key
:
'
n
ame'
,
dataIndex
:
'
n
ame'
key
:
'
memberN
ame'
,
dataIndex
:
'
memberN
ame'
},
{
title
:
'会员类型'
,
...
...
@@ -123,21 +45,85 @@ const Preview = () => {
},
{
title
:
'会员等级'
,
key
:
'levelTag'
,
dataIndex
:
'levelTag'
key
:
'level'
,
dataIndex
:
'level'
,
render
:
(
text
)
=>
<
LevelBrand
level=
{
text
}
/>
}
]
// 商城列表columns
const
mallColumns
=
[
{
title
:
'商城ID'
,
key
:
'id'
,
dataIndex
:
'id'
},
{
title
:
'商城名称'
,
key
:
'name'
,
dataIndex
:
'name'
},
{
title
:
'商城LOGO'
,
key
:
'logoUrl'
,
dataIndex
:
'logoUrl'
,
render
:
(
tetx
)
=>
<
Image
src=
{
tetx
}
width=
{
40
}
/>
},
{
title
:
'商城环境'
,
key
:
'environment'
,
dataIndex
:
'environment'
,
render
:
(
text
)
=>
MALL_ENV
[
text
]
},
{
title
:
'商城属性'
,
key
:
'property'
,
dataIndex
:
'property'
,
render
:
(
text
)
=>
MALL_PROPERTY
[
text
]
},
{
title
:
'商城地址'
,
key
:
'url'
,
dataIndex
:
'url'
},
{
title
:
'商城描述'
,
key
:
'describe'
,
dataIndex
:
'describe'
},
{
title
:
'状态'
,
dataIndex
:
'state'
,
key
:
'state'
,
render
:
(
text
:
any
,
record
:
any
)
=>
(
<
StatusSwitch
fieldNames=
"state"
record=
{
record
}
/>
)
},
{
title
:
'是否默认'
,
key
:
'isDefault'
,
dataIndex
:
'isDefault'
,
render
:
(
text
)
=>
IS_DEFAULT
[
text
]
}
]
const
fetchTableData
=
(
params
)
=>
{
return
new
Promise
(
resolve
=>
{
PublicApi
.
getOrderPlatformPaymentMemberPage
({
paymentId
:
id
,
...
params
}).
then
(
res
=>
{
if
(
res
.
code
!==
1000
)
{
return
useEffect
(()
=>
{
if
(
id
)
{
PublicApi
.
getManageShopRuleGet
({
id
}).
then
(
res
=>
{
console
.
log
(
`res`
,
res
)
if
(
res
.
code
===
1000
)
{
const
{
shopList
,
...
rest
}
=
res
.
data
setSourceData
({
members
:
[{
...
rest
}],
shopList
})
}
resolve
(
res
.
data
);
})
}
)
}
}
}
,
[])
return
(
<
PageHeaderWrapper
...
...
@@ -150,17 +136,17 @@ const Preview = () => {
>
<
Tabs
>
<
TabPane
tab=
'适用会员'
key=
{
1
}
forceRender
>
<
Standard
Table
columns=
{
columns
}
tableProps=
{
{
rowKey
:
'id'
}
}
fetchTableData=
{
(
params
:
any
)
=>
fetchTableData
(
params
)
}
<
Table
rowKey=
{
record
=>
record
.
memberId
}
columns=
{
memberColumns
}
dataSource=
{
sourceData
.
members
}
/>
</
TabPane
>
<
TabPane
tab=
'适用商城'
key=
{
2
}
forceRender
>
<
Standard
Table
columns=
{
columns
}
tableProps=
{
{
rowKey
:
'id'
}
}
fetchTableData=
{
(
params
:
any
)
=>
fetchTableData
(
params
)
}
<
Table
rowKey=
{
record
=>
record
.
id
}
columns=
{
mallColumns
}
dataSource=
{
sourceData
.
shopList
}
/>
</
TabPane
>
</
Tabs
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment