Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
linweijiong
jinfa-platform
Commits
c1c49121
Commit
c1c49121
authored
Jul 23, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 对接商品、品类优惠券
parent
a3e8af6b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
157 additions
and
63 deletions
+157
-63
fetchDetailHoc.tsx
...etingAbility/merchantCoupon/common/hoc/fetchDetailHoc.tsx
+9
-7
index.tsx
...gAbility/merchantCoupon/components/CouponDetail/index.tsx
+39
-40
index.tsx
...merchantCouponUnsubmitted/components/CouponForm/index.tsx
+11
-15
index.tsx
...erchantCouponUnsubmitted/components/GoodsDrawer/index.tsx
+4
-0
utils.ts
...ages/transaction/marketingAbility/merchantCoupon/utils.ts
+94
-1
No files found.
src/pages/transaction/marketingAbility/merchantCoupon/common/hoc/fetchDetailHoc.tsx
View file @
c1c49121
...
@@ -36,13 +36,15 @@ const FetchDetailHoc = <P extends {}>(config: IConfig, WrapComponent: React.Comp
...
@@ -36,13 +36,15 @@ const FetchDetailHoc = <P extends {}>(config: IConfig, WrapComponent: React.Comp
getDetail
();
getDetail
();
},
[]);
},
[]);
return
(
props
:
Omit
<
P
,
(
'dataSource'
|
'loading'
)
>
):
JSX
.
Element
=>
{
return
React
.
useMemo
(()
=>
{
return
(
return
(
props
:
Omit
<
P
,
(
'dataSource'
|
'loading'
)
>
):
JSX
.
Element
=>
{
<
div
>
return
(
<
WrapComponent
{
...
props
as
any
}
dataSource=
{
detail
}
loading=
{
loading
}
/>
<
div
>
</
div
>
<
WrapComponent
{
...
props
as
any
}
dataSource=
{
detail
}
loading=
{
loading
}
/>
);
</
div
>
};
);
};
},
[
WrapComponent
,
detail
,
loading
]);
}
;
}
;
export default FetchDetailHoc;
export default FetchDetailHoc;
src/pages/transaction/marketingAbility/merchantCoupon/components/CouponDetail/index.tsx
View file @
c1c49121
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
* @Author: XieZhiXiong
* @Author: XieZhiXiong
* @Date: 2021-06-25 17:23:30
* @Date: 2021-06-25 17:23:30
* @LastEditors: XieZhiXiong
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-2
0 10:49:05
* @LastEditTime: 2021-07-2
3 15:16:09
* @Description: 商家优惠券页面详情组件
* @Description: 商家优惠券页面详情组件
*/
*/
import
React
from
'react'
;
import
React
,
{
useMemo
}
from
'react'
;
import
{
import
{
Row
,
Row
,
Col
,
Col
,
...
@@ -20,13 +20,21 @@ import {
...
@@ -20,13 +20,21 @@ import {
}
from
'@/constants/marketing'
;
}
from
'@/constants/marketing'
;
import
AnchorPage
from
'@/layouts/AnchorPage'
;
import
AnchorPage
from
'@/layouts/AnchorPage'
;
import
AuditProcess
from
'@/components/AuditProcess'
;
import
AuditProcess
from
'@/components/AuditProcess'
;
import
{
normalizeCategoryList
,
CategoryItemType
,
normalizeShopList
,
ShopItemType
,
normalizeBrandList
,
BrandItemType
,
}
from
'../../utils'
;
import
BacisInfo
,
{
PropsType
as
BacisInfoPropsType
}
from
'../../components/BacisInfo'
;
import
BacisInfo
,
{
PropsType
as
BacisInfoPropsType
}
from
'../../components/BacisInfo'
;
import
CouponRules
,
{
PropsType
as
CouponRulesPropsType
}
from
'../../components/CouponRules'
;
import
CouponRules
,
{
PropsType
as
CouponRulesPropsType
}
from
'../../components/CouponRules'
;
import
ApplicableGoods
,
{
ListItemDataType
}
from
'../../components/ApplicableGoods'
;
import
ApplicableGoods
,
{
ListItemDataType
}
from
'../../components/ApplicableGoods'
;
import
ApplicableShopList
from
'../../components/ApplicableShopList'
;
import
ApplicableShopList
from
'../../components/ApplicableShopList'
;
import
ApplicableCategories
from
'../../components/ApplicableCategories'
;
import
ApplicableCategories
from
'../../components/ApplicableCategories'
;
import
ApplicableBrands
from
'../../components/ApplicableBrands'
;
import
ApplicableBrands
from
'../../components/ApplicableBrands'
;
import
InnerFlowRecords
,
{
FlowItem
}
from
'../../components/InnerFlowRecords'
;
import
InnerFlowRecords
from
'../../components/InnerFlowRecords'
;
export
type
DetailType
=
BacisInfoPropsType
[
'dataSource'
]
&
CouponRulesPropsType
[
'dataSource'
]
&
{
export
type
DetailType
=
BacisInfoPropsType
[
'dataSource'
]
&
CouponRulesPropsType
[
'dataSource'
]
&
{
/**
/**
...
@@ -102,7 +110,19 @@ export type DetailType = BacisInfoPropsType['dataSource'] & CouponRulesPropsType
...
@@ -102,7 +110,19 @@ export type DetailType = BacisInfoPropsType['dataSource'] & CouponRulesPropsType
/**
/**
* 适用商品
* 适用商品
*/
*/
suitableCommoditySkuList
:
ListItemDataType
[],
suitableCommoditySkuList
?:
ListItemDataType
[],
/**
* 适用品类
*/
suitableCategoryList
?:
CategoryItemType
[][],
/**
* 适用品牌
*/
suitableBrandList
?:
BrandItemType
[],
/**
* 适用商城
*/
suitableMallTypes
?:
ShopItemType
[],
};
};
interface
IProps
{
interface
IProps
{
...
@@ -171,6 +191,18 @@ const MerchantCouponDetail: React.FC<IProps> = (props) => {
...
@@ -171,6 +191,18 @@ const MerchantCouponDetail: React.FC<IProps> = (props) => {
},
},
].
filter
(
Boolean
);
].
filter
(
Boolean
);
const
categories
=
useMemo
(()
=>
{
return
normalizeCategoryList
(
dataSource
?.
suitableCategoryList
);
},
[
dataSource
?.
suitableCategoryList
]);
const
shopList
=
useMemo
(()
=>
{
return
normalizeShopList
(
dataSource
?.
suitableMallTypes
);
},
[
dataSource
?.
suitableMallTypes
]);
const
brandList
=
useMemo
(()
=>
{
return
normalizeBrandList
(
dataSource
?.
suitableBrandList
);
},
[
dataSource
?.
suitableBrandList
]);
return
(
return
(
<
Spin
spinning=
{
loading
}
>
<
Spin
spinning=
{
loading
}
>
<
AnchorPage
<
AnchorPage
...
@@ -249,18 +281,7 @@ const MerchantCouponDetail: React.FC<IProps> = (props) => {
...
@@ -249,18 +281,7 @@ const MerchantCouponDetail: React.FC<IProps> = (props) => {
?
(
?
(
<
Col
span=
{
24
}
>
<
Col
span=
{
24
}
>
<
ApplicableCategories
<
ApplicableCategories
options=
{
[
options=
{
categories
}
{
logo
:
'http://www.yyfun001.com/res/htmlLX/gunbo1.jpg'
,
label
:
'成品皮-牛皮-头层牛皮'
,
value
:
1
,
},
{
logo
:
'http://www.yyfun001.com/res/htmlLX/gunbo1.jpg'
,
label
:
'成品皮-牛皮-头层牛皮'
,
value
:
2
,
},
]
}
id=
"applicableCategories"
id=
"applicableCategories"
/>
/>
</
Col
>
</
Col
>
...
@@ -276,18 +297,7 @@ const MerchantCouponDetail: React.FC<IProps> = (props) => {
...
@@ -276,18 +297,7 @@ const MerchantCouponDetail: React.FC<IProps> = (props) => {
?
(
?
(
<
Col
span=
{
24
}
>
<
Col
span=
{
24
}
>
<
ApplicableBrands
<
ApplicableBrands
options=
{
[
options=
{
brandList
}
{
logo
:
'http://www.yyfun001.com/res/htmlLX/gunbo4.jpg'
,
label
:
'头层牛皮'
,
value
:
1
,
},
{
logo
:
'http://www.yyfun001.com/res/htmlLX/gunbo4.jpg'
,
label
:
'牛皮'
,
value
:
2
,
},
]
}
id=
"applicableBrands"
id=
"applicableBrands"
/>
/>
</
Col
>
</
Col
>
...
@@ -299,18 +309,7 @@ const MerchantCouponDetail: React.FC<IProps> = (props) => {
...
@@ -299,18 +309,7 @@ const MerchantCouponDetail: React.FC<IProps> = (props) => {
{
/* 适用商城 */
}
{
/* 适用商城 */
}
<
Col
span=
{
24
}
>
<
Col
span=
{
24
}
>
<
ApplicableShopList
<
ApplicableShopList
options=
{
[
options=
{
shopList
}
{
logo
:
'http://www.yyfun001.com/res/htmlLX/gunbo3.jpg'
,
label
:
'WEB-渠道商城'
,
value
:
1
,
},
{
logo
:
'http://www.yyfun001.com/res/htmlLX/gunbo3.jpg'
,
label
:
'H5-渠道商城'
,
value
:
2
,
},
]
}
id=
"applicableShopList"
id=
"applicableShopList"
/>
/>
</
Col
>
</
Col
>
...
...
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/components/CouponForm/index.tsx
View file @
c1c49121
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Author: XieZhiXiong
* @Date: 2021-06-24 13:47:47
* @Date: 2021-06-24 13:47:47
* @LastEditors: XieZhiXiong
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-
19 18:30:06
* @LastEditTime: 2021-07-
23 14:42:48
* @Description: 新增/修改 优惠券表单
* @Description: 新增/修改 优惠券表单
*/
*/
import
React
,
{
useState
,
useMemo
}
from
'react'
;
import
React
,
{
useState
,
useMemo
}
from
'react'
;
...
@@ -113,14 +113,14 @@ export type SubmitValueType = {
...
@@ -113,14 +113,14 @@ export type SubmitValueType = {
/**
/**
* 适用品类
* 适用品类
*/
*/
applicableCategories
:
{
applicableCategories
?
:
{
category
:
string
[],
category
:
string
[]
[]
,
}[],
}[],
/**
/**
* 适用品牌
* 适用品牌
*/
*/
applicableBrands
:
{
applicableBrands
:
{
brand
:
string
,
brand
:
string
[]
,
}[],
}[],
/**
/**
* 适用用户
* 适用用户
...
@@ -240,26 +240,21 @@ const CouponForm: React.FC<IProps> = (props) => {
...
@@ -240,26 +240,21 @@ const CouponForm: React.FC<IProps> = (props) => {
...
restValue
...
restValue
}
=
values
;
}
=
values
;
let
applicationRelated
:
string
[]
=
[];
if
(
applicableBrands
&&
applicableBrands
.
length
)
{
applicationRelated
=
applicableBrands
.
map
((
item
)
=>
item
.
brand
);
}
if
(
applicableCategories
&&
applicableCategories
.
length
)
{
applicationRelated
=
applicableCategories
.
map
((
item
)
=>
item
.
category
.
join
(
'.'
));
}
const
suitableCommoditySkuList
=
goodsList
?.
map
((
item
)
=>
({
const
suitableCommoditySkuList
=
goodsList
?.
map
((
item
)
=>
({
id
:
item
.
id
,
id
:
item
.
id
,
commodityId
:
item
.
commodityId
,
commodityId
:
item
.
commodityId
,
name
:
item
.
name
,
name
:
item
.
name
,
mainPic
:
item
.
mainPic
,
customerCategoryName
:
item
.
customerCategoryName
,
customerCategoryName
:
item
.
customerCategoryName
,
brandName
:
item
.
brandName
,
brandName
:
item
.
brandName
,
unitName
:
item
.
unitName
,
unitName
:
item
.
unitName
,
unitPrice
:
item
.
unitPrice
,
unitPrice
:
item
.
unitPrice
,
}));
}));
const
suitableCategoryList
:
any
=
applicableCategories
?.
map
((
item
)
=>
item
.
category
);
const
suitableBrandList
:
any
=
applicableBrands
?.
map
((
item
)
=>
item
.
brand
);
const
payload
=
{
const
payload
=
{
conditionGetDay
:
+
conditionGetDay
,
conditionGetDay
:
+
conditionGetDay
,
conditionGetTotal
:
+
conditionGetTotal
,
conditionGetTotal
:
+
conditionGetTotal
,
...
@@ -272,8 +267,9 @@ const CouponForm: React.FC<IProps> = (props) => {
...
@@ -272,8 +267,9 @@ const CouponForm: React.FC<IProps> = (props) => {
effectiveTimeStart
:
effectiveTimeStart
?
moment
(
effectiveTimeStart
).
valueOf
()
:
undefined
,
effectiveTimeStart
:
effectiveTimeStart
?
moment
(
effectiveTimeStart
).
valueOf
()
:
undefined
,
effectiveTimeEnd
:
effectiveTimeEnd
?
moment
(
effectiveTimeEnd
).
valueOf
()
:
undefined
,
effectiveTimeEnd
:
effectiveTimeEnd
?
moment
(
effectiveTimeEnd
).
valueOf
()
:
undefined
,
suitableMemberLevelTypes
:
applicationMemberLevel
,
suitableMemberLevelTypes
:
applicationMemberLevel
,
relevanceProductData
:
applicationRelated
as
any
,
suitableCommoditySkuList
,
suitableCommoditySkuList
,
suitableCategoryList
,
suitableBrandList
,
...
restValue
,
...
restValue
,
};
};
...
...
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/components/GoodsDrawer/index.tsx
View file @
c1c49121
...
@@ -30,6 +30,10 @@ export type ProductItemType = {
...
@@ -30,6 +30,10 @@ export type ProductItemType = {
*/
*/
name
:
string
,
name
:
string
,
/**
/**
* 商品图片
*/
mainPic
:
string
,
/**
* 会员分类名称
* 会员分类名称
*/
*/
customerCategoryName
:
string
,
customerCategoryName
:
string
,
...
...
src/pages/transaction/marketingAbility/merchantCoupon/utils.ts
View file @
c1c49121
...
@@ -2,10 +2,12 @@
...
@@ -2,10 +2,12 @@
* @Author: XieZhiXiong
* @Author: XieZhiXiong
* @Date: 2021-07-20 10:10:55
* @Date: 2021-07-20 10:10:55
* @LastEditors: XieZhiXiong
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-2
0 10:27:34
* @LastEditTime: 2021-07-2
3 15:00:55
* @Description:
* @Description:
*/
*/
import
{
OptionItemType
}
from
'../components/ApplicableList'
;
type
OriginUnitPriceType
=
{
[
key
:
string
]:
any
}
type
OriginUnitPriceType
=
{
[
key
:
string
]:
any
}
type
UnitPriceType
=
{
type
UnitPriceType
=
{
/**
/**
* 起始
* 起始
...
@@ -21,6 +23,51 @@ type UnitPriceType = {
...
@@ -21,6 +23,51 @@ type UnitPriceType = {
price
:
number
,
price
:
number
,
}
}
export
type
CategoryItemType
=
{
/**
* 品类id
*/
id
:
number
,
/**
* 品类图片
*/
imageUrl
:
string
,
/**
* 品类名称
*/
name
:
string
,
}
export
type
ShopItemType
=
{
/**
* 商城id
*/
id
:
number
,
/**
* 商城图片
*/
logoUrl
:
string
,
/**
* 商城名称
*/
name
:
string
,
}
export
type
BrandItemType
=
{
/**
* 品牌id
*/
id
:
number
,
/**
* 品牌图片
*/
logoUrl
:
string
,
/**
* 品牌名称
*/
name
:
string
,
}
export
function
normalizeUnitPrice
(
unitPrice
:
UnitPriceType
):
UnitPriceType
[]
{
export
function
normalizeUnitPrice
(
unitPrice
:
UnitPriceType
):
UnitPriceType
[]
{
const
ret
=
[];
const
ret
=
[];
const
objKeys
=
Object
.
keys
(
unitPrice
).
sort
((
a
,
b
)
=>
parseFloat
(
a
)
-
parseFloat
(
b
));
const
objKeys
=
Object
.
keys
(
unitPrice
).
sort
((
a
,
b
)
=>
parseFloat
(
a
)
-
parseFloat
(
b
));
...
@@ -36,4 +83,49 @@ export function normalizeUnitPrice(unitPrice: UnitPriceType): UnitPriceType[] {
...
@@ -36,4 +83,49 @@ export function normalizeUnitPrice(unitPrice: UnitPriceType): UnitPriceType[] {
});
});
return
ret
;
return
ret
;
};
export
function
normalizeCategoryList
(
origin
:
CategoryItemType
[][]):
OptionItemType
[]
{
const
ret
:
OptionItemType
[]
=
[];
if
(
!
Array
.
isArray
(
origin
))
{
return
ret
;
}
origin
.
forEach
((
item
,
index
)
=>
{
ret
.
push
({
logo
:
item
[
item
.
length
-
1
]?.
imageUrl
,
label
:
item
.
map
((
item
)
=>
item
.
name
).
join
(
'-'
),
value
:
index
,
});
});
return
ret
;
};
export
function
normalizeShopList
(
origin
:
ShopItemType
[]):
OptionItemType
[]
{
const
ret
:
OptionItemType
[]
=
[];
if
(
!
Array
.
isArray
(
origin
))
{
return
ret
;
}
origin
.
forEach
((
item
)
=>
{
ret
.
push
({
logo
:
item
.
logoUrl
,
label
:
item
.
name
,
value
:
item
.
id
,
});
});
return
ret
;
};
export
function
normalizeBrandList
(
origin
:
BrandItemType
[]):
OptionItemType
[]
{
const
ret
:
OptionItemType
[]
=
[];
if
(
!
Array
.
isArray
(
origin
))
{
return
ret
;
}
origin
.
forEach
((
item
)
=>
{
ret
.
push
({
logo
:
item
.
logoUrl
,
label
:
item
.
name
,
value
:
item
.
id
,
});
});
return
ret
;
};
};
\ No newline at end of file
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