Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
admin
Commits
a38d7f4f
提交
a38d7f4f
authored
6月 02, 2023
作者:
ZhangLingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
功能:eslint --fix
上级
cde9a40b
显示空白字符变更
内嵌
并排
正在显示
67 个修改的文件
包含
3344 行增加
和
2739 行删除
+3344
-2739
index.ts
src/api/index.ts
+4
-10
activityManage.ts
src/api/interface/activityManage.ts
+5
-11
couponManage.ts
src/api/interface/couponManage.ts
+6
-19
makeManage.ts
src/api/interface/makeManage.ts
+1
-1
activityManage.ts
src/api/modules/activityManage.ts
+8
-10
common.ts
src/api/modules/common.ts
+7
-7
couponManage.ts
src/api/modules/couponManage.ts
+13
-13
makeManage.ts
src/api/modules/makeManage.ts
+6
-6
App.scss
src/assets/style/App.scss
+2
-2
index.tsx
src/common/hook/optionHook/index.tsx
+5
-5
index.tsx
src/components/box/index.tsx
+3
-3
index.scss
src/components/layout/index.scss
+8
-8
index.scss
src/components/layout/title/index.scss
+3
-4
index.scss
src/components/search-box/index.scss
+8
-5
index.tsx
src/components/search-box/index.tsx
+39
-64
index.tsx
src/components/tableBox/index.tsx
+2
-2
index.tsx
...anage/activityList/components/activityDataModal/index.tsx
+19
-24
index.tsx
...tyManage/activityList/components/addOrEditModal/index.tsx
+55
-98
index.tsx
src/pages/activityManage/activityList/index.tsx
+138
-152
index.scss
src/pages/common/login/index.scss
+48
-48
index.tsx
...ouponManage/couponDetailed/components/dataModal/index.tsx
+16
-16
index.tsx
src/pages/couponManage/couponDetailed/index.tsx
+401
-416
index.tsx
...pages/couponManage/couponList/comp/addEditModal/index.tsx
+35
-41
index.tsx
src/pages/couponManage/couponList/comp/dataModal/index.tsx
+14
-16
index.tsx
...ages/couponManage/couponList/comp/increaseModal/index.tsx
+21
-27
index.tsx
src/pages/couponManage/couponList/detail/index.tsx
+196
-233
index.tsx
src/pages/couponManage/couponList/index.tsx
+352
-366
index.tsx
...ouponList/addOrEditOrDetail/components/baseInfo/index.tsx
+11
-11
index.tsx
...st/addOrEditOrDetail/components/shareCouponInfo/index.tsx
+86
-95
index.tsx
...t/addOrEditOrDetail/components/sharedCouponInfo/index.tsx
+75
-94
index.scss
...couponManage/splitCouponList/addOrEditOrDetail/index.scss
+12
-11
index.tsx
.../couponManage/splitCouponList/addOrEditOrDetail/index.tsx
+31
-50
index.scss
src/pages/couponManage/splitCouponList/index.scss
+7
-3
index.tsx
src/pages/couponManage/splitCouponList/index.tsx
+313
-335
index.tsx
.../orderManage/equipmentOrder/comp/detailDelivery/index.tsx
+33
-0
index.tsx
...derManage/equipmentOrder/comp/detailInformation/index.tsx
+66
-0
index.tsx
...orderManage/equipmentOrder/comp/detailPurchaser/index.tsx
+54
-0
index.scss
src/pages/orderManage/equipmentOrder/detail/index.scss
+82
-0
index.tsx
src/pages/orderManage/equipmentOrder/detail/index.tsx
+50
-0
index.tsx
src/pages/orderManage/equipmentOrder/index.tsx
+187
-2
index.tsx
...es/orderManage/serviceOrder/comp/detailDelivery/index.tsx
+33
-0
index.tsx
...orderManage/serviceOrder/comp/detailInformation/index.tsx
+66
-0
index.tsx
...s/orderManage/serviceOrder/comp/detailPurchaser/index.tsx
+54
-0
index.scss
src/pages/orderManage/serviceOrder/detail/index.scss
+82
-0
index.tsx
src/pages/orderManage/serviceOrder/detail/index.tsx
+50
-0
index.tsx
src/pages/orderManage/serviceOrder/index.tsx
+187
-2
index.tsx
...pointManage/divideOrder/comp/divideAddEditModal/index.tsx
+33
-45
index.tsx
...ages/pointManage/divideOrder/comp/divideSetting/index.tsx
+77
-91
index.scss
src/pages/pointManage/divideOrder/index.scss
+1
-1
index.tsx
...pointManage/divideRules/comp/divideAddEditModal/index.tsx
+58
-79
index.tsx
...ointManage/divideRules/comp/divideAddEditObject/index.tsx
+33
-44
index.tsx
...ages/pointManage/pointDetail/comp/bankCardModal/index.tsx
+9
-15
index.tsx
src/pages/pointManage/pointList/comp/approveModal/index.tsx
+20
-32
index.tsx
src/pages/pointManage/pointList/comp/detailModal/index.tsx
+31
-36
index.tsx
...es/pointManage/pointList/comp/distributionModal/index.tsx
+33
-48
index.tsx
src/pages/pointManage/pointRules/comp/addEditModal/index.tsx
+39
-53
router.tsx
src/router/router.tsx
+57
-20
index.ts
src/store/hook/index.ts
+2
-2
index.ts
src/store/index.ts
+2
-2
index.ts
src/store/slice/index.ts
+2
-2
auth.ts
src/utils/auth.ts
+2
-2
dictionary.ts
src/utils/dictionary.ts
+12
-12
index.ts
src/utils/index.ts
+6
-6
isRoute.ts
src/utils/isRoute.ts
+2
-2
money.ts
src/utils/money.ts
+5
-5
order.ts
src/utils/order.ts
+12
-14
validateUtils.ts
src/utils/validateUtils.ts
+14
-18
没有找到文件。
src/api/index.ts
浏览文件 @
a38d7f4f
import
{
PointManageAPI
}
from
'./modules/pointManageAPI'
;
import
{
ActivityManageAPI
}
from
'./modules/activityManage'
;
import
{
CouponManageAPI
}
from
'./modules/couponManage'
import
{
CommonAPI
}
from
"./modules/common"
;
import
{
MakeManageAPI
}
from
'./modules/makeManage'
import
{
CouponManageAPI
}
from
'./modules/couponManage'
;
import
{
CommonAPI
}
from
'./modules/common'
;
import
{
MakeManageAPI
}
from
'./modules/makeManage'
;
export
{
PointManageAPI
,
ActivityManageAPI
,
CommonAPI
,
CouponManageAPI
,
MakeManageAPI
};
export
{
PointManageAPI
,
ActivityManageAPI
,
CommonAPI
,
CouponManageAPI
,
MakeManageAPI
};
src/api/interface/activityManage.ts
浏览文件 @
a38d7f4f
// 活动-裂变优惠券下拉类型
import
{
InterFunction
,
InterItemFunction
}
from
"~/api/interface"
;
import
{
SplitCouponItemType
}
from
"~/api/interface/couponManage"
;
import
{
InterFunction
,
InterItemFunction
}
from
'~/api/interface'
;
import
{
SplitCouponItemType
}
from
'~/api/interface/couponManage'
;
// 裂变优惠券-下拉
export
type
splitCouponDownType
=
InterFunction
<
{
type
:
number
},
SplitCouponItemType
[]
>
;
export
type
splitCouponDownType
=
InterFunction
<
{
type
:
number
},
SplitCouponItemType
[]
>
;
// 活动新增-type
export
type
addActivityItemType
=
{
...
...
@@ -21,7 +18,7 @@ export type addActivityItemType = {
show
:
number
;
startTime
:
string
;
time
?:
any
[];
redirectPath
?:
""
;
redirectPath
?:
''
;
};
export
type
addActivityType
=
InterFunction
<
addActivityItemType
,
null
>
;
// 活动-列表
...
...
@@ -41,7 +38,4 @@ export type activityDataType = InterFunction<
{
countFinishParticipate
:
number
;
countParticipate
:
number
}
>
;
// 活动-编辑
export
type
activityEditType
=
InterFunction
<
addActivityItemType
&
{
id
:
number
},
null
>
;
export
type
activityEditType
=
InterFunction
<
addActivityItemType
&
{
id
:
number
},
null
>
;
src/api/interface/couponManage.ts
浏览文件 @
a38d7f4f
import
{
InterFunction
,
InterItemFunction
,
InterListFunction
,
}
from
"~/api/interface"
;
import
{
PaginationEntity
}
from
"~/common/interface/PaginationEntity"
;
import
{
InterFunction
,
InterItemFunction
,
InterListFunction
}
from
'~/api/interface'
;
import
{
PaginationEntity
}
from
'~/common/interface/PaginationEntity'
;
// 裂变优惠券-表格数据类型
export
type
SplitCouponItemType
=
{
...
...
@@ -25,10 +21,7 @@ export type SplitCouponSearchType = {
useType
?:
number
;
state
?:
boolean
;
};
export
type
SplitCouponListType
=
InterItemFunction
<
SplitCouponSearchType
,
SplitCouponItemType
[]
>
;
export
type
SplitCouponListType
=
InterItemFunction
<
SplitCouponSearchType
,
SplitCouponItemType
[]
>
;
// 裂变优惠券-新建-数据类型
// 基本信息
export
type
baseInfoType
=
{
...
...
@@ -137,13 +130,10 @@ export type couponDetailItemType = {
transferorTime
:
string
;
};
export
type
couponDetailType
=
InterItemFunction
<
couponDetailSearchType
,
couponDetailItemType
[]
>
;
export
type
couponDetailType
=
InterItemFunction
<
couponDetailSearchType
,
couponDetailItemType
[]
>
;
export
type
couponDetailExportType
=
InterFunction
<
couponDetailSearchType
&
Pick
<
PaginationEntity
,
"pageNo"
|
"pageSize"
>
,
couponDetailSearchType
&
Pick
<
PaginationEntity
,
'pageNo'
|
'pageSize'
>
,
any
>
;
...
...
@@ -157,10 +147,7 @@ export type ListBrandInfoType = InterListFunction<
export
type
CouponSaveType
=
InterFunction
<
any
,
any
>
;
// 增发优惠券
export
type
CouponIncreaseType
=
InterFunction
<
{
id
:
number
;
count
:
number
},
{}
>
;
export
type
CouponIncreaseType
=
InterFunction
<
{
id
:
number
;
count
:
number
},
{}
>
;
// 获取优惠券使用数据
export
type
CouponGetDataType
=
InterFunction
<
...
...
src/api/interface/makeManage.ts
浏览文件 @
a38d7f4f
import
{
InterFunction
,
InterItemFunction
}
from
"~/api/interface"
;
import
{
InterFunction
,
InterItemFunction
}
from
'~/api/interface'
;
// 品牌管理-新增
export
type
MakeAddType
=
InterFunction
<
{
brandName
:
string
},
null
>
;
...
...
src/api/modules/activityManage.ts
浏览文件 @
a38d7f4f
...
...
@@ -5,41 +5,39 @@ import {
addActivityType
,
endActivityType
,
splitCouponDownType
,
}
from
"../interface/activityManage"
;
import
axios
from
"../request"
;
}
from
'../interface/activityManage'
;
import
axios
from
'../request'
;
export
class
ActivityManageAPI
{
// 活动-裂变优惠券-下拉
static
getActivityCouponPullDown
:
splitCouponDownType
=
(
params
)
=>
{
return
axios
.
get
(
"userpay/coupon/back/getActivityCouponPullDown"
,
{
return
axios
.
get
(
'userpay/coupon/back/getActivityCouponPullDown'
,
{
params
,
});
};
// 活动-新增
static
createActivity
:
addActivityType
=
(
data
)
=>
{
return
axios
.
post
(
"malluser/activity/create"
,
data
);
return
axios
.
post
(
'malluser/activity/create'
,
data
);
};
// 活动-编辑
static
editActivity
:
activityEditType
=
(
data
)
=>
{
return
axios
.
post
(
"malluser/activity/update"
,
data
);
return
axios
.
post
(
'malluser/activity/update'
,
data
);
};
// 活动-列表
static
getActivityList
:
activeTableItemType
=
(
params
)
=>
{
return
axios
.
get
(
"malluser/activity/list"
,
{
params
});
return
axios
.
get
(
'malluser/activity/list'
,
{
params
});
};
// 活动-结束
static
endActivity
:
endActivityType
=
(
params
)
=>
{
return
axios
.
get
(
"malluser/activity/stop"
,
{
params
});
return
axios
.
get
(
'malluser/activity/stop'
,
{
params
});
};
// 活动-数据
static
getActivityData
:
activityDataType
=
(
params
)
=>
{
return
axios
.
get
(
"malluser/activity/dataInfo"
,
{
params
});
return
axios
.
get
(
'malluser/activity/dataInfo'
,
{
params
});
};
}
src/api/modules/common.ts
浏览文件 @
a38d7f4f
import
axios
from
"../request"
;
import
axios
from
'../request'
;
// 运营人员
export
interface
operateEntity
{
...
...
@@ -14,8 +14,8 @@ export interface loginEntity {
}
export
class
CommonAPI
{
static
Login
=
(
data
:
Pick
<
loginEntity
,
"accountNo"
|
"passWord"
>
):
any
=>
{
return
axios
.
post
(
"userservlet/auth/platformLogin"
,
{
static
Login
=
(
data
:
Pick
<
loginEntity
,
'accountNo'
|
'passWord'
>
):
any
=>
{
return
axios
.
post
(
'userservlet/auth/platformLogin'
,
{
...
data
,
portType
:
1
,
});
...
...
@@ -23,21 +23,21 @@ export class CommonAPI {
// 上传图片
static
commonUpload
=
(
data
:
FormData
)
=>
{
return
axios
.
post
(
"ossservlet/upload/osses"
,
data
);
return
axios
.
post
(
'ossservlet/upload/osses'
,
data
);
};
// 上传图片
static
fileUpload
=
(
data
:
FormData
)
=>
{
return
axios
.
post
(
"ossservlet/upload/oss"
,
data
);
return
axios
.
post
(
'ossservlet/upload/oss'
,
data
);
};
// 运营人员列表
static
operateList
(
operateName
:
string
)
{
return
axios
.
post
(
"orderservlet/ordertask/listOperate"
,
{
operateName
});
return
axios
.
post
(
'orderservlet/ordertask/listOperate'
,
{
operateName
});
}
// 销售人员列表
static
getSaleList
()
{
return
axios
.
get
(
"userservlet/useraccount/getSaleList"
);
return
axios
.
get
(
'userservlet/useraccount/getSaleList'
);
}
}
src/api/modules/couponManage.ts
浏览文件 @
a38d7f4f
import
axios
from
"../request"
;
import
axios
from
'../request'
;
import
{
couponDetailExportType
,
couponDetailType
,
...
...
@@ -10,55 +10,55 @@ import {
ListBrandInfoType
,
SplitCouponAddType
,
SplitCouponListType
,
}
from
"~/api/interface/couponManage"
;
}
from
'~/api/interface/couponManage'
;
export
class
CouponManageAPI
{
// 优惠券管理-裂变优惠券列表
static
getPageActivityList
:
SplitCouponListType
=
(
data
)
=>
{
return
axios
.
post
(
"userpay/coupon/back/pageActivityList"
,
data
);
return
axios
.
post
(
'userpay/coupon/back/pageActivityList'
,
data
);
};
// 优惠券管理-裂变优惠券新建
static
saveActivity
:
SplitCouponAddType
=
(
data
)
=>
{
return
axios
.
post
(
"userpay/coupon/back/saveActivity"
,
data
);
return
axios
.
post
(
'userpay/coupon/back/saveActivity'
,
data
);
};
// 优惠券管理-裂变优惠券新建
static
CouponPageList
:
CouponPageListType
=
(
data
)
=>
{
return
axios
.
post
(
"userpay/coupon/back/pageList"
,
data
);
return
axios
.
post
(
'userpay/coupon/back/pageList'
,
data
);
};
// 优惠券明细
static
getCouponDetail
:
couponDetailType
=
(
data
)
=>
{
return
axios
.
post
(
"userpay/coupon/back/getUserCouponList"
,
data
);
return
axios
.
post
(
'userpay/coupon/back/getUserCouponList'
,
data
);
};
// 优惠券明细-导出
static
downloadCouponUserList
:
couponDetailExportType
=
(
data
)
=>
{
return
axios
.
post
(
"userpay/coupon/back/downloadCouponUserList"
,
data
,
{
responseType
:
"blob"
,
return
axios
.
post
(
'userpay/coupon/back/downloadCouponUserList'
,
data
,
{
responseType
:
'blob'
,
});
};
// 新增优惠券
static
CouponSave
:
CouponSaveType
=
(
data
)
=>
{
return
axios
.
post
(
"/userpay/coupon/back/save"
,
data
,
{
headers
:
{
"Content-Type"
:
"multipart/form-data"
},
return
axios
.
post
(
'/userpay/coupon/back/save'
,
data
,
{
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
});
};
// 增发优惠券
static
CouponIncrease
:
CouponIncreaseType
=
(
params
)
=>
{
return
axios
.
post
(
"/userpay/coupon/back/increase"
,
{},
{
params
});
return
axios
.
post
(
'/userpay/coupon/back/increase'
,
{},
{
params
});
};
// 获取优惠券详情
static
CouponGetData
:
CouponGetDataType
=
(
params
)
=>
{
return
axios
.
get
(
"/userpay/coupon/back/getData"
,
{
params
});
return
axios
.
get
(
'/userpay/coupon/back/getData'
,
{
params
});
};
// 关闭优惠券
static
CouponShutDown
:
CouponShutDownType
=
(
params
)
=>
{
return
axios
.
post
(
"/userpay/coupon/back/shutDown"
,
{},
{
params
});
return
axios
.
post
(
'/userpay/coupon/back/shutDown'
,
{},
{
params
});
};
}
src/api/modules/makeManage.ts
浏览文件 @
a38d7f4f
...
...
@@ -3,27 +3,27 @@ import {
MakeDeleteType
,
MakeEditType
,
MakeListType
,
}
from
"~/api/interface/makeManage"
;
import
axios
from
"../request"
;
}
from
'~/api/interface/makeManage'
;
import
axios
from
'../request'
;
export
class
MakeManageAPI
{
// 品牌-新增
static
addBrandInfo
:
MakeAddType
=
(
params
)
=>
{
return
axios
.
get
(
"uavgoods/brand/addBrandInfo"
,
{
params
});
return
axios
.
get
(
'uavgoods/brand/addBrandInfo'
,
{
params
});
};
// 品牌-编辑
static
editBrandInfo
:
MakeEditType
=
(
params
)
=>
{
return
axios
.
get
(
"uavgoods/brand/editBrandInfo"
,
{
params
});
return
axios
.
get
(
'uavgoods/brand/editBrandInfo'
,
{
params
});
};
// 品牌-列表
static
getListBrandInfo
:
MakeListType
=
(
params
)
=>
{
return
axios
.
get
(
"uavgoods/brand/listBrandInfo"
,
{
params
});
return
axios
.
get
(
'uavgoods/brand/listBrandInfo'
,
{
params
});
};
// 品牌刪除
static
deleteBrandInfo
:
MakeDeleteType
=
(
params
)
=>
{
return
axios
.
get
(
"uavgoods/brand/deleteBrandInfo"
,
{
params
});
return
axios
.
get
(
'uavgoods/brand/deleteBrandInfo'
,
{
params
});
};
}
src/assets/style/App.scss
浏览文件 @
a38d7f4f
...
...
@@ -24,11 +24,11 @@
}
.ant-table-row
:nth-child
(
odd
)
{
background
:
#
FCFCFC
;
background
:
#
fcfcfc
;
}
.ant-table-row
:nth-child
(
odd
)
>
td
{
background
:
#
FCFCFC
;
background
:
#
fcfcfc
;
}
::-webkit-scrollbar
{
...
...
src/common/hook/optionHook/index.tsx
浏览文件 @
a38d7f4f
import
{
useEffect
,
useState
}
from
"react"
;
import
{
RoleAPI
}
from
"@/api"
;
import
{
limitEntity
}
from
"@/api/modules/role"
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
RoleAPI
}
from
'@/api'
;
import
{
limitEntity
}
from
'@/api/modules/role'
;
function
useOptionShow
(
id
:
number
)
{
// const [show, setShow] = useState<boolean>(false);
return
JSON
.
parse
(
localStorage
.
getItem
(
"routeList"
)
as
string
)?.
some
(
(
v
:
limitEntity
)
=>
v
.
id
===
id
return
JSON
.
parse
(
localStorage
.
getItem
(
'routeList'
)
as
string
)?.
some
(
(
v
:
limitEntity
)
=>
v
.
id
===
id
,
);
// useEffect(() => {
// RoleAPI.getListCuserMenuInfo().then((res: any) => {
...
...
src/components/box/index.tsx
浏览文件 @
a38d7f4f
import
React
from
"react"
;
import
"./index.scss"
;
import
React
from
'react'
;
import
'./index.scss'
;
interface
PropsType
{
children
:
React
.
ReactNode
;
}
const
Box
:
React
.
FC
<
PropsType
>
=
({
children
})
=>
{
return
<
div
className=
"box-wrap"
>
{
children
}
</
div
>;
return
<
div
className=
'box-wrap'
>
{
children
}
</
div
>;
};
export
default
Box
;
src/components/layout/index.scss
浏览文件 @
a38d7f4f
//$page-background: #F6F7FB;
$page-background
:
#F3F6FF
;
$page-background
:
#f3f6ff
;
.layout-view
{
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
.layout-bg
{
.layout-bg
{
background
:
$page-background
;
}
...
...
@@ -47,7 +47,7 @@ $page-background: #F3F6FF ;
.ant-menu-dark
{
background
:
transparent
;
}
.ant-layout-sider-children
{
.ant-layout-sider-children
{
border-radius
:
10px
;
overflow
:
hidden
;
}
...
...
@@ -76,7 +76,7 @@ $page-background: #F3F6FF ;
background-color
:
#fff
;
border-top-right-radius
:
0
;
border-bottom-right-radius
:
0
;
color
:
#556
DA
7
;
color
:
#556
da
7
;
}
.sider-collapsed
{
...
...
@@ -98,11 +98,11 @@ $page-background: #F3F6FF ;
}
}
:where
(
.css-dev-only-do-not-override-rvhhh3
)
.ant-menu-light.ant-menu-inline
.ant-menu-sub.ant-menu-inline
{
:where
(
.css-dev-only-do-not-override-rvhhh3
)
.ant-menu-light.ant-menu-inline
.ant-menu-sub.ant-menu-inline
{
background
:
none
;
}
.layout-logo
{
height
:
100%
;
//width: 170px;
...
...
@@ -162,7 +162,7 @@ $page-background: #F3F6FF ;
.user-name
{
font-size
:
12px
;
font-weight
:
normal
;
color
:
#556DA7
;
color
:
#556da7
;
//color: #F6F7FB;
}
}
...
...
@@ -171,7 +171,7 @@ $page-background: #F3F6FF ;
margin-right
:
10px
;
width
:
24px
;
height
:
24px
;
border
:
1px
solid
#ffffff
;
border
:
1px
solid
#ffffff
;
//border:1px solid #1677ff;
border-radius
:
2px
;
padding
:
0
;
...
...
src/components/layout/title/index.scss
浏览文件 @
a38d7f4f
...
...
@@ -11,16 +11,15 @@
.hamburger.is-active
{
transform
:
rotate
(
180deg
)
translateY
(
3px
);
}
.effective
{
.ant-btn-default
{
.effective
{
.ant-btn-default
{
// display: none;
background-color
:
#1677ff
!
important
;
&
:hover
{
background-color
:
#4893fd
!
important
;
}
}
.ant-btn-primary
{
.ant-btn-primary
{
display
:
none
;
}
}
src/components/search-box/index.scss
浏览文件 @
a38d7f4f
...
...
@@ -27,23 +27,26 @@
margin-bottom
:
15px
;
padding-right
:
15px
;
div
,
.ant-btn
{
div
,
.ant-btn
{
margin-right
:
10px
;
}
div
:last-child
,
.ant-btn
:last-child
{
div
:last-child
,
.ant-btn
:last-child
{
margin-right
:
0
!
important
;
}
.backButton
{
.backButton
{
position
:
absolute
;
top
:
0
;
right
:
0
;
}
}
.search-sufFixBtn
{
.search-sufFixBtn
{
margin-bottom
:
10px
;
div
,
.ant-btn
{
div
,
.ant-btn
{
margin-right
:
10px
;
}
}
...
...
src/components/search-box/index.tsx
浏览文件 @
a38d7f4f
import
{
Form
,
Input
,
Button
,
Select
,
DatePicker
}
from
"antd"
;
import
moment
from
"dayjs"
;
import
{
SearchOutlined
,
ReloadOutlined
,
ExportOutlined
,
}
from
"@ant-design/icons"
;
import
React
,
{
useImperativeHandle
}
from
"react"
;
import
"./index.scss"
;
import
{
Form
,
Input
,
Button
,
Select
,
DatePicker
}
from
'antd'
;
import
moment
from
'dayjs'
;
import
{
SearchOutlined
,
ReloadOutlined
,
ExportOutlined
}
from
'@ant-design/icons'
;
import
React
,
{
useImperativeHandle
}
from
'react'
;
import
'./index.scss'
;
const
{
RangePicker
}
=
DatePicker
;
// 搜索列表的类型
export
interface
searchColumns
{
type
:
"input"
|
"select"
|
"rangePicker"
|
"DatePicker"
|
"Select"
;
type
:
'input'
|
'select'
|
'rangePicker'
|
'DatePicker'
|
'Select'
;
label
?:
string
;
name
:
string
;
placeholder
:
string
;
...
...
@@ -27,7 +23,7 @@ export interface searchColumns {
onSelect
?:
(
value
:
any
)
=>
void
;
disable
?:
boolean
;
onChange
?:
any
;
showTime
?:
{
format
:
"HH:mm:ss"
};
showTime
?:
{
format
:
'HH:mm:ss'
};
}
// 组件的类型
...
...
@@ -69,18 +65,17 @@ const Index: React.FC<propsType> = (props) => {
const
handleSubmit
=
(
data
:
any
)
=>
{
// console.log("提交数据 --->", data);
if
(
data
.
startTime
)
{
data
.
startTime
=
moment
(
data
.
startTime
).
format
(
"YYYY-MM-DD"
);
data
.
startTime
=
moment
(
data
.
startTime
).
format
(
'YYYY-MM-DD'
);
}
else
{
data
.
startTime
=
undefined
;
}
Object
.
keys
(
data
).
forEach
((
k
)
=>
{
const
isRangPicker
:
boolean
|
undefined
=
props
.
search
&&
props
.
search
.
some
((
v
)
=>
v
.
name
===
k
&&
v
.
type
===
"rangePicker"
);
props
.
search
&&
props
.
search
.
some
((
v
)
=>
v
.
name
===
k
&&
v
.
type
===
'rangePicker'
);
if
(
Array
.
isArray
(
data
[
k
])
&&
isRangPicker
)
{
data
[
k
]
=
[
`
${
moment
(
data
[
k
][
0
]).
format
(
"YYYY-MM-DD"
)}
00:00:00`
,
`
${
moment
(
data
[
k
][
1
]).
format
(
"YYYY-MM-DD"
)}
23:59:59`
,
`
${
moment
(
data
[
k
][
0
]).
format
(
'YYYY-MM-DD'
)}
00:00:00`
,
`
${
moment
(
data
[
k
][
1
]).
format
(
'YYYY-MM-DD'
)}
23:59:59`
,
];
}
});
...
...
@@ -94,38 +89,34 @@ const Index: React.FC<propsType> = (props) => {
props
.
exportEvent
();
};
return
(
<
div
className=
"header"
>
{
props
?.
preFixBtn
&&
(
<
div
className=
"search-children"
>
{
props
?.
preFixBtn
}
</
div
>
)
}
<
div
className=
'header'
>
{
props
?.
preFixBtn
&&
<
div
className=
'search-children'
>
{
props
?.
preFixBtn
}
</
div
>
}
<
Form
layout=
"inline"
layout=
'inline'
form=
{
form
}
initialValues=
{
{
layout
:
"inline"
}
}
initialValues=
{
{
layout
:
'inline'
}
}
onFinish=
{
handleSubmit
}
>
{
props
?.
child
&&
<
div
className=
"search-children"
>
{
props
?.
child
}
</
div
>
}
{
props
?.
children
&&
(
<
div
className=
"search-children"
>
{
props
?.
children
}
</
div
>
)
}
{
props
?.
child
&&
<
div
className=
'search-children'
>
{
props
?.
child
}
</
div
>
}
{
props
?.
children
&&
<
div
className=
'search-children'
>
{
props
?.
children
}
</
div
>
}
{
props
?.
search
?.
map
((
item
:
any
)
=>
{
return
(
<
Form
.
Item
name=
{
item
.
name
}
label=
{
item
.
label
}
key=
{
item
.
name
}
style=
{
{
marginBottom
:
"10px"
}
}
style=
{
{
marginBottom
:
'10px'
}
}
>
{
item
.
type
===
"input"
?
(
{
item
.
type
===
'input'
?
(
<
Input
placeholder=
{
item
.
placeholder
}
allowClear
style=
{
{
width
:
item
.
width
?
`${item.width}px`
:
"150px"
}
}
style=
{
{
width
:
item
.
width
?
`${item.width}px`
:
'150px'
}
}
maxLength=
{
50
}
/>
)
:
item
.
type
===
"select"
?
(
)
:
item
.
type
===
'select'
?
(
<
Select
style=
{
{
width
:
item
.
width
?
`${item.width}px`
:
"200px"
}
}
style=
{
{
width
:
item
.
width
?
`${item.width}px`
:
'200px'
}
}
placeholder=
{
item
.
placeholder
}
allowClear
>
...
...
@@ -137,14 +128,14 @@ const Index: React.FC<propsType> = (props) => {
);
})
}
</
Select
>
)
:
item
.
type
===
"Select"
?
(
)
:
item
.
type
===
'Select'
?
(
<
Select
style=
{
{
width
:
item
.
width
?
`${item.width}px`
:
"200px"
}
}
style=
{
{
width
:
item
.
width
?
`${item.width}px`
:
'200px'
}
}
placeholder=
{
item
.
placeholder
}
allowClear
options=
{
item
.
options
}
/>
)
:
item
.
type
===
"rangePicker"
?
(
)
:
item
.
type
===
'rangePicker'
?
(
<
RangePicker
// showTime=
{{
// // hideDisabledOptions: true,
...
...
@@ -153,64 +144,48 @@ const Index: React.FC<propsType> = (props) => {
// moment("23:59:59", "HH:mm:ss"),
// ],
//
}}
format=
"YYYY-MM-DD"
style=
{
{
width
:
item
.
width
?
`${item.width}px`
:
"220px"
}
}
format=
'YYYY-MM-DD'
style=
{
{
width
:
item
.
width
?
`${item.width}px`
:
'220px'
}
}
/>
)
:
item
.
type
===
"DatePicker"
?
(
)
:
item
.
type
===
'DatePicker'
?
(
<
DatePicker
showTime=
{
item
.
showTime
}
style=
{
{
width
:
item
.
width
?
`${item.width}px`
:
"180px"
}
}
style=
{
{
width
:
item
.
width
?
`${item.width}px`
:
'180px'
}
}
/>
)
:
(
""
''
)
}
</
Form
.
Item
>
);
})
}
{
props
?.
search
&&
props
?.
search
?.
length
>
0
&&
(
<>
<
Form
.
Item
style=
{
{
marginBottom
:
"10px"
}
}
>
<
Button
type=
"primary"
htmlType=
"submit"
icon=
{
<
SearchOutlined
/>
}
>
<
Form
.
Item
style=
{
{
marginBottom
:
'10px'
}
}
>
<
Button
type=
'primary'
htmlType=
'submit'
icon=
{
<
SearchOutlined
/>
}
>
搜索
</
Button
>
</
Form
.
Item
>
<
Form
.
Item
style=
{
{
marginBottom
:
"10px"
}
}
>
<
Button
type=
"primary"
onClick=
{
handleRest
}
icon=
{
<
ReloadOutlined
/>
}
>
<
Form
.
Item
style=
{
{
marginBottom
:
'10px'
}
}
>
<
Button
type=
'primary'
onClick=
{
handleRest
}
icon=
{
<
ReloadOutlined
/>
}
>
重置
</
Button
>
</
Form
.
Item
>
{
!!
props
.
otherChild
&&
(
<
Form
.
Item
style=
{
{
marginBottom
:
"10px"
}
}
>
{
props
.
otherChild
}
</
Form
.
Item
>
<
Form
.
Item
style=
{
{
marginBottom
:
'10px'
}
}
>
{
props
.
otherChild
}
</
Form
.
Item
>
)
}
</>
)
}
{
props
.
isExport
?
(
<
Form
.
Item
style=
{
{
marginBottom
:
"10px"
}
}
>
<
Button
type=
"primary"
onClick=
{
exportClick
}
icon=
{
<
ExportOutlined
/>
}
>
<
Form
.
Item
style=
{
{
marginBottom
:
'10px'
}
}
>
<
Button
type=
'primary'
onClick=
{
exportClick
}
icon=
{
<
ExportOutlined
/>
}
>
导出
</
Button
>
</
Form
.
Item
>
)
:
(
""
''
)
}
</
Form
>
{
!!
props
?.
sufFixBtn
&&
(
<
div
className=
"search-sufFixBtn"
>
{
props
?.
sufFixBtn
}
</
div
>
)
}
{
!!
props
?.
sufFixBtn
&&
<
div
className=
'search-sufFixBtn'
>
{
props
?.
sufFixBtn
}
</
div
>
}
</
div
>
);
};
...
...
src/components/tableBox/index.tsx
浏览文件 @
a38d7f4f
import
React
from
"react"
;
import
React
from
'react'
;
interface
PropsType
{
children
:
React
.
ReactNode
;
...
...
@@ -6,5 +6,5 @@ interface PropsType {
export
const
TableBox
:
React
.
FC
<
PropsType
>
=
(
props
)
=>
{
const
{
children
}
=
props
;
return
<
div
className=
"table-body-box"
>
{
children
}
</
div
>;
return
<
div
className=
'table-body-box'
>
{
children
}
</
div
>;
};
src/pages/activityManage/activityList/components/activityDataModal/index.tsx
浏览文件 @
a38d7f4f
import
{
Modal
,
Table
}
from
"antd"
;
import
{
FC
}
from
"react"
;
import
{
ColumnsType
}
from
"antd/es/table"
;
import
{
PropsType
}
from
"~/common/interface/modal"
;
import
{
activityDataType
}
from
"~/api/interface/activityManage"
;
import
{
Modal
,
Table
}
from
'antd'
;
import
{
FC
}
from
'react'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
PropsType
}
from
'~/common/interface/modal'
;
import
{
activityDataType
}
from
'~/api/interface/activityManage'
;
// 活动数据-类型
type
dataType
=
(
ReturnType
<
activityDataType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
];
type
dataType
=
(
ReturnType
<
activityDataType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
'result'
];
interface
selfProps
{
activityData
:
dataType
|
undefined
;
}
const
ActivityDataModal
:
FC
<
Pick
<
PropsType
,
"isModalVisible"
|
"handleCancel"
>
&
selfProps
>
=
({
isModalVisible
,
handleCancel
,
activityData
})
=>
{
const
ActivityDataModal
:
FC
<
Pick
<
PropsType
,
'isModalVisible'
|
'handleCancel'
>
&
selfProps
>
=
({
isModalVisible
,
handleCancel
,
activityData
,
})
=>
{
const
columns
:
ColumnsType
<
dataType
>
=
[
{
title
:
"参与总人数"
,
dataIndex
:
"countFinishParticipate"
,
align
:
"center"
,
title
:
'参与总人数'
,
dataIndex
:
'countFinishParticipate'
,
align
:
'center'
,
},
{
title
:
"参与成功人数"
,
dataIndex
:
"countParticipate"
,
align
:
"center"
,
title
:
'参与成功人数'
,
dataIndex
:
'countParticipate'
,
align
:
'center'
,
},
];
return
(
<
Modal
open=
{
isModalVisible
}
title=
"活动数据"
onCancel=
{
()
=>
handleCancel
()
}
footer=
{
null
}
>
<
Modal
open=
{
isModalVisible
}
title=
'活动数据'
onCancel=
{
()
=>
handleCancel
()
}
footer=
{
null
}
>
{
activityData
&&
(
<
Table
columns=
{
columns
}
pagination=
{
false
}
dataSource=
{
[
activityData
]
}
bordered
rowKey=
"countFinishParticipate"
rowKey=
'countFinishParticipate'
/>
)
}
</
Modal
>
...
...
src/pages/activityManage/activityList/components/addOrEditModal/index.tsx
浏览文件 @
a38d7f4f
import
{
FC
,
ForwardedRef
,
forwardRef
,
useState
,
useImperativeHandle
,
}
from
"react"
;
import
{
DatePicker
,
Form
,
Input
,
message
,
Modal
,
Radio
,
Select
,
Upload
,
}
from
"antd"
;
import
{
PlusOutlined
}
from
"@ant-design/icons"
;
import
type
{
UploadFile
}
from
"antd/es/upload/interface"
;
import
dayjs
from
"dayjs"
;
import
{
FC
,
ForwardedRef
,
forwardRef
,
useState
,
useImperativeHandle
}
from
'react'
;
import
{
DatePicker
,
Form
,
Input
,
message
,
Modal
,
Radio
,
Select
,
Upload
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
type
{
UploadFile
}
from
'antd/es/upload/interface'
;
import
dayjs
from
'dayjs'
;
import
{
RangePickerProps
}
from
"antd/es/date-picker"
;
import
{
PropsType
}
from
"~/common/interface/modal"
;
import
{
CommonAPI
}
from
"~/api"
;
import
{
SplitCouponItemType
}
from
"~/api/interface/couponManage"
;
import
{
addActivityItemType
}
from
"~/api/interface/activityManage"
;
import
{
ActivityManageAPI
}
from
"~/api/modules/activityManage"
;
import
{
RangePickerProps
}
from
'antd/es/date-picker'
;
import
{
PropsType
}
from
'~/common/interface/modal'
;
import
{
CommonAPI
}
from
'~/api'
;
import
{
SplitCouponItemType
}
from
'~/api/interface/couponManage'
;
import
{
addActivityItemType
}
from
'~/api/interface/activityManage'
;
import
{
ActivityManageAPI
}
from
'~/api/modules/activityManage'
;
interface
selfProps
{
couponData
:
SplitCouponItemType
[];
...
...
@@ -33,17 +18,7 @@ interface selfProps {
}
const
AddOrEditModal
:
FC
<
PropsType
&
selfProps
>
=
forwardRef
(
(
{
isModalVisible
,
handleOk
,
handleCancel
,
couponData
,
activityTypeChangeEvent
,
title
,
},
ref
)
=>
{
({
isModalVisible
,
handleOk
,
handleCancel
,
couponData
,
activityTypeChangeEvent
,
title
},
ref
)
=>
{
const
[
createActivityForm
]
=
Form
.
useForm
<
Exclude
<
addActivityItemType
,
...
...
@@ -61,32 +36,21 @@ const AddOrEditModal: FC<PropsType & selfProps> = forwardRef(
const
[
fileList
,
setFileList
]
=
useState
<
UploadFile
[]
>
([]);
const
handleOkEvent
=
()
=>
{
createActivityForm
.
validateFields
().
then
((
value
:
any
)
=>
{
const
splitCouponItem
=
couponData
.
find
(
(
v
)
=>
v
.
id
===
value
.
bindingCouponId
);
const
startTime
=
`
${
dayjs
(
value
.
time
[
0
]).
format
(
"YYYY-MM-DD"
)}
00:00:00`
;
const
endTime
=
`
${
dayjs
(
value
.
time
[
1
]).
format
(
"YYYY-MM-DD"
)}
23:59:59`
;
const
splitCouponItem
=
couponData
.
find
((
v
)
=>
v
.
id
===
value
.
bindingCouponId
);
const
startTime
=
`
${
dayjs
(
value
.
time
[
0
]).
format
(
'YYYY-MM-DD'
)}
00:00:00`
;
const
endTime
=
`
${
dayjs
(
value
.
time
[
1
]).
format
(
'YYYY-MM-DD'
)}
23:59:59`
;
delete
value
.
time
;
ActivityManageAPI
[
activityId
===
-
1
?
"createActivity"
:
"editActivity"
]({
ActivityManageAPI
[
activityId
===
-
1
?
'createActivity'
:
'editActivity'
]({
id
:
activityId
===
-
1
?
undefined
:
activityId
,
...
value
,
limitNum
:
Number
(
value
.
limitNum
),
helpType
:
splitCouponItem
?.
beSharedCoupon
?.
userTag
||
splitCouponItem
?.
userTag
,
shareNum
:
currentActivityType
===
1
?
splitCouponItem
?.
peopleNumber
:
undefined
,
helpType
:
splitCouponItem
?.
beSharedCoupon
?.
userTag
||
splitCouponItem
?.
userTag
,
shareNum
:
currentActivityType
===
1
?
splitCouponItem
?.
peopleNumber
:
undefined
,
startTime
,
endTime
,
}).
then
(({
code
})
=>
{
if
(
code
===
"200"
)
{
message
.
success
(
activityId
?
"编辑成功"
:
"新增成功"
);
if
(
code
===
'200'
)
{
message
.
success
(
activityId
?
'编辑成功'
:
'新增成功'
);
createActivityForm
.
resetFields
();
setFileList
([]);
handleOk
();
...
...
@@ -104,24 +68,24 @@ const AddOrEditModal: FC<PropsType & selfProps> = forwardRef(
const
reg
=
/
\/(
png|jpg|gif|jpeg|webp
)
$/
;
const
isType
=
reg
.
test
(
file
.
type
as
string
);
if
(
!
isType
)
{
message
.
warning
(
"文件格式错误"
);
message
.
warning
(
'文件格式错误'
);
}
return
isType
;
};
const
customRequest
=
(
value
:
any
)
=>
{
const
formData
=
new
FormData
();
formData
.
append
(
"uploadFile"
,
value
.
file
);
formData
.
append
(
'uploadFile'
,
value
.
file
);
CommonAPI
.
commonUpload
(
formData
).
then
((
res
:
any
)
=>
{
if
(
res
.
code
===
"200"
)
{
if
(
res
.
code
===
'200'
)
{
setFileList
([
{
uid
:
"uid"
,
name
:
"image"
,
uid
:
'uid'
,
name
:
'image'
,
url
:
res
.
result
[
0
],
status
:
"done"
,
status
:
'done'
,
},
]);
createActivityForm
.
setFieldValue
(
"activityImg"
,
res
.
result
[
0
]);
createActivityForm
.
setFieldValue
(
'activityImg'
,
res
.
result
[
0
]);
}
});
};
...
...
@@ -129,12 +93,12 @@ const AddOrEditModal: FC<PropsType & selfProps> = forwardRef(
const
list
=
fileList
.
filter
((
v
:
UploadFile
)
=>
v
.
uid
!==
file
.
uid
);
setFileList
(
list
);
setTimeout
(()
=>
{
createActivityForm
.
setFieldValue
(
"activityImg"
,
undefined
);
createActivityForm
.
setFieldValue
(
'activityImg'
,
undefined
);
});
};
// 活动类型改变
const
activityTypeChange
=
(
e
:
any
)
=>
{
createActivityForm
.
setFieldValue
(
"bindingCouponId"
,
undefined
);
createActivityForm
.
setFieldValue
(
'bindingCouponId'
,
undefined
);
setCurrentActivityType
(
e
.
target
.
value
);
activityTypeChangeEvent
(
e
.
target
.
value
);
};
...
...
@@ -142,7 +106,7 @@ const AddOrEditModal: FC<PropsType & selfProps> = forwardRef(
const
negativeNumberValidator
=
(
rule
:
any
,
value
:
string
,
callback
:
(
error
?:
string
)
=>
void
callback
:
(
error
?:
string
)
=>
void
,
)
=>
{
if
(
!
value
)
{
return
Promise
.
reject
(
new
Error
(
`请输入参与次数!`
));
...
...
@@ -152,7 +116,7 @@ const AddOrEditModal: FC<PropsType & selfProps> = forwardRef(
return
Promise
.
reject
(
new
Error
(
`参与次数为非零的正整数!`
));
}
if
(
Number
(
value
)
>
5
)
{
return
Promise
.
reject
(
new
Error
(
"参与次数最大值为5!"
));
return
Promise
.
reject
(
new
Error
(
'参与次数最大值为5!'
));
}
// const bindingCouponId =
// createActivityForm.getFieldValue("bindingCouponId");
...
...
@@ -167,7 +131,7 @@ const AddOrEditModal: FC<PropsType & selfProps> = forwardRef(
return
Promise
.
resolve
();
};
// rangPicker disabledDate
const
disabledDate
:
RangePickerProps
[
"disabledDate"
]
=
(
currentDate
)
=>
{
const
disabledDate
:
RangePickerProps
[
'disabledDate'
]
=
(
currentDate
)
=>
{
// const bindingCouponId = createActivityForm.getFieldValue("bindingCouponId");
// const couponObj = couponData.find((v) => v.id === bindingCouponId);
// const activityType = createActivityForm.getFieldValue("activityType");
...
...
@@ -188,7 +152,7 @@ const AddOrEditModal: FC<PropsType & selfProps> = forwardRef(
// );
// }
// }
return
currentDate
<
dayjs
().
subtract
(
1
,
"day"
);
return
currentDate
<
dayjs
().
subtract
(
1
,
'day'
);
};
useImperativeHandle
(
ref
,
()
=>
({
getForm
:
()
=>
createActivityForm
,
...
...
@@ -200,12 +164,7 @@ const AddOrEditModal: FC<PropsType & selfProps> = forwardRef(
},
}));
return
(
<
Modal
open=
{
isModalVisible
}
onOk=
{
handleOkEvent
}
onCancel=
{
handleCancelEvent
}
title=
{
title
}
>
<
Modal
open=
{
isModalVisible
}
onOk=
{
handleOkEvent
}
onCancel=
{
handleCancelEvent
}
title=
{
title
}
>
<
Form
labelCol=
{
{
span
:
5
}
}
wrapperCol=
{
{
span
:
14
}
}
...
...
@@ -213,48 +172,46 @@ const AddOrEditModal: FC<PropsType & selfProps> = forwardRef(
initialValues=
{
{
show
:
1
,
activityType
:
1
}
}
>
<
Form
.
Item
label=
"活动标题"
name=
"activityName"
rules=
{
[{
required
:
true
,
message
:
"请输入活动标题!"
}]
}
label=
'活动标题'
name=
'activityName'
rules=
{
[{
required
:
true
,
message
:
'请输入活动标题!'
}]
}
>
<
Input
placeholder=
"请输入活动标题"
maxLength=
{
25
}
/>
<
Input
placeholder=
'请输入活动标题'
maxLength=
{
25
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"活动类型"
name=
"activityType"
>
<
Form
.
Item
label=
'活动类型'
name=
'activityType'
>
<
Radio
.
Group
onChange=
{
activityTypeChange
}
>
<
Radio
value=
{
1
}
>
裂变活动
</
Radio
>
<
Radio
value=
{
2
}
>
普通活动
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
"活动中心展示"
name=
"show"
>
<
Form
.
Item
label=
'活动中心展示'
name=
'show'
>
<
Radio
.
Group
>
<
Radio
value=
{
1
}
>
是
</
Radio
>
<
Radio
value=
{
0
}
>
否
</
Radio
>
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
"推广简图"
name=
"activityImg"
rules=
{
[{
required
:
true
,
message
:
"请上传推广简图!"
}]
}
label=
'推广简图'
name=
'activityImg'
rules=
{
[{
required
:
true
,
message
:
'请上传推广简图!'
}]
}
>
<
Upload
listType=
"picture-card"
listType=
'picture-card'
fileList=
{
fileList
}
beforeUpload=
{
beforeUpload
}
customRequest=
{
customRequest
}
onRemove=
{
onRemove
}
accept=
"image/*"
accept=
'image/*'
>
{
fileList
.
length
<
1
&&
<
PlusOutlined
/>
}
</
Upload
>
</
Form
.
Item
>
<
Form
.
Item
label=
"关联优惠券"
name=
"bindingCouponId"
>
<
Form
.
Item
label=
'关联优惠券'
name=
'bindingCouponId'
>
<
Select
placeholder=
"请选择关联优惠券"
placeholder=
'请选择关联优惠券'
showSearch
filterOption=
{
(
input
,
option
:
any
)
=>
(
option
!
.
children
as
unknown
as
string
)
.
toLowerCase
()
.
includes
(
input
.
toLowerCase
())
(
option
!
.
children
as
unknown
as
string
).
toLowerCase
().
includes
(
input
.
toLowerCase
())
}
>
{
couponData
.
map
((
v
)
=>
(
...
...
@@ -266,24 +223,24 @@ const AddOrEditModal: FC<PropsType & selfProps> = forwardRef(
</
Form
.
Item
>
{
currentActivityType
===
1
&&
(
<
Form
.
Item
label=
"参与次数"
name=
"limitNum"
label=
'参与次数'
name=
'limitNum'
rules=
{
[{
required
:
true
,
validator
:
negativeNumberValidator
}]
}
>
<
Input
placeholder=
"请输入参与次数"
suffix=
"次"
/>
<
Input
placeholder=
'请输入参与次数'
suffix=
'次'
/>
</
Form
.
Item
>
)
}
<
Form
.
Item
label=
"生效时间"
rules=
{
[{
required
:
true
,
message
:
"请选择生效时间!"
}]
}
name=
"time"
label=
'生效时间'
rules=
{
[{
required
:
true
,
message
:
'请选择生效时间!'
}]
}
name=
'time'
>
<
DatePicker
.
RangePicker
disabledDate=
{
disabledDate
}
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
);
}
}
,
);
export
default
AddOrEditModal
;
src/pages/activityManage/activityList/index.tsx
浏览文件 @
a38d7f4f
import
{
FC
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
Button
,
Image
,
message
,
Modal
,
Table
}
from
"antd"
;
import
{
ColumnsType
}
from
"antd/es/table"
;
import
dayjs
from
"dayjs"
;
import
Box
from
"~/components/box"
;
import
AddOrEditModal
from
"./components/addOrEditModal"
;
import
ActivityDataModal
from
"./components/activityDataModal"
;
import
{
ActivityManageAPI
}
from
"~/api/modules/activityManage"
;
import
{
SplitCouponItemType
}
from
"~/api/interface/couponManage"
;
import
{
PaginationEntity
}
from
"~/common/interface/PaginationEntity"
;
import
{
activityDataType
,
activityItemType
,
}
from
"~/api/interface/activityManage"
;
import
useOperate
from
"~/common/hook/optionHook"
;
import
{
FC
,
useEffect
,
useRef
,
useState
}
from
'react'
;
import
{
Button
,
Image
,
message
,
Modal
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
dayjs
from
'dayjs'
;
import
Box
from
'~/components/box'
;
import
AddOrEditModal
from
'./components/addOrEditModal'
;
import
ActivityDataModal
from
'./components/activityDataModal'
;
import
{
ActivityManageAPI
}
from
'~/api/modules/activityManage'
;
import
{
SplitCouponItemType
}
from
'~/api/interface/couponManage'
;
import
{
PaginationEntity
}
from
'~/common/interface/PaginationEntity'
;
import
{
activityDataType
,
activityItemType
}
from
'~/api/interface/activityManage'
;
import
useOperate
from
'~/common/hook/optionHook'
;
// 活动数据-类型
type
dataType
=
(
ReturnType
<
activityDataType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
];
type
dataType
=
(
ReturnType
<
activityDataType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
'result'
];
const
ActivityList
:
FC
<
{}
>
=
()
=>
{
const
activityRef
=
useRef
();
const
tableColumns
:
ColumnsType
<
activityItemType
>
=
[
{
title
:
"ID"
,
align
:
"center"
,
dataIndex
:
"id"
,
title
:
'ID'
,
align
:
'center'
,
dataIndex
:
'id'
,
},
{
title
:
"活动标题"
,
align
:
"center"
,
dataIndex
:
"activityName"
,
title
:
'活动标题'
,
align
:
'center'
,
dataIndex
:
'activityName'
,
},
{
title
:
"活动类型"
,
align
:
"center"
,
dataIndex
:
"activityType"
,
title
:
'活动类型'
,
align
:
'center'
,
dataIndex
:
'activityType'
,
render
:
(
text
:
string
,
record
:
activityItemType
)
=>
(
<
div
>
{
record
.
activityType
===
1
?
"裂变活动"
:
"普通活动"
}
</
div
>
<
div
>
{
record
.
activityType
===
1
?
'裂变活动'
:
'普通活动'
}
</
div
>
),
},
{
title
:
"是否展示"
,
align
:
"center"
,
title
:
'是否展示'
,
align
:
'center'
,
render
:
(
text
:
number
,
record
:
activityItemType
)
=>
(
<
div
>
{
record
.
show
?
"展示"
:
"隐藏"
}
</
div
>
<
div
>
{
record
.
show
?
'展示'
:
'隐藏'
}
</
div
>
),
},
{
title
:
"推广简图"
,
align
:
"center"
,
title
:
'推广简图'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
activityItemType
)
=>
(
<
Image
src=
{
record
.
activityImg
}
width=
{
50
}
/>
),
},
{
title
:
"关联优惠"
,
align
:
"center"
,
dataIndex
:
"bindingCouponName"
,
title
:
'关联优惠'
,
align
:
'center'
,
dataIndex
:
'bindingCouponName'
,
},
{
title
:
"参与次数"
,
align
:
"center"
,
dataIndex
:
"limitNum"
,
title
:
'参与次数'
,
align
:
'center'
,
dataIndex
:
'limitNum'
,
},
{
title
:
"状态"
,
align
:
"center"
,
title
:
'状态'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
activityItemType
)
=>
record
.
activityStatus
===
1
?
"进行中"
:
"已下线"
,
record
.
activityStatus
===
1
?
'进行中'
:
'已下线'
,
},
{
title
:
"有效期"
,
align
:
"center"
,
title
:
'有效期'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
activityItemType
)
=>
(
<
div
>
<
div
>
起:
{
record
.
startTime
}
</
div
>
...
...
@@ -81,12 +76,12 @@ const ActivityList: FC<{}> = () => {
),
},
{
title
:
"操作"
,
align
:
"center"
,
title
:
'操作'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
activityItemType
,
index
:
number
)
=>
(
<>
<
Button
type=
"link"
type=
'link'
onClick=
{
()
=>
endActivityClick
(
record
)
}
disabled=
{
record
.
activityStatus
!==
1
||
!
isEndBtnShow
}
>
...
...
@@ -95,11 +90,7 @@ const ActivityList: FC<{}> = () => {
{
/* <Button type="link" onClick={() => addOrEditActivity(record)}> */
}
{
/* 编辑 */
}
{
/* </Button> */
}
<
Button
type=
"link"
onClick=
{
()
=>
showActivityData
(
record
)
}
disabled=
{
!
isDataBtnShow
}
>
<
Button
type=
'link'
onClick=
{
()
=>
showActivityData
(
record
)
}
disabled=
{
!
isDataBtnShow
}
>
数据
</
Button
>
</>
...
...
@@ -116,98 +107,99 @@ const ActivityList: FC<{}> = () => {
// 活动数据
const
[
activityData
,
setActivityData
]
=
useState
<
dataType
>
();
const
[
addOrEditModalShow
,
setAddOrEditModalShow
]
=
useState
<
boolean
>
(
false
);
const
[
addOrEditModalTitle
,
setAddOrEditModalTitle
]
=
useState
(
"创建活动"
);
const
[
activityDataModalShow
,
setActivityDataModalShow
]
=
useState
<
boolean
>
(
false
);
const
[
addOrEditModalTitle
,
setAddOrEditModalTitle
]
=
useState
(
'创建活动'
);
const
[
activityDataModalShow
,
setActivityDataModalShow
]
=
useState
<
boolean
>
(
false
);
const
[
couponData
,
setCouponData
]
=
useState
<
SplitCouponItemType
[]
>
([]);
// 按钮权限
const
isEndBtnShow
=
useOperate
(
19150
);
const
isDataBtnShow
=
useOperate
(
19200
);
// 活动列表
const
getActivityList
=
(
data
:
Pick
<
PaginationEntity
,
"pageNo"
|
"pageSize"
>
)
=>
{
const
getActivityList
=
(
data
:
Pick
<
PaginationEntity
,
'pageNo'
|
'pageSize'
>
)
=>
{
// setLoading(true);
const
list
:
any
=
[
const
list
:
any
=
[
{
"id"
:
4
,
"activityName"
:
"裂变活动测试"
,
"activityCode"
:
"AC77674"
,
"activityImg"
:
"https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/87681f78-67db-4603-aaf3-4bdbdb4546d2.jpg"
,
"bindingCouponId"
:
10000148
,
"bindingCouponName"
:
"裂变优惠券测试"
,
"activityStatus"
:
2
,
"activityType"
:
1
,
"shareNum"
:
2
,
"startTime"
:
"2023-04-23 00:00:00"
,
"endTime"
:
"2023-04-30 23:59:59"
,
"limitNum"
:
1
,
"deleted"
:
null
,
"show"
:
1
,
"redirectPath"
:
null
,
"couponActivityDTO"
:
null
,
"couponDTO"
:
null
id
:
4
,
activityName
:
'裂变活动测试'
,
activityCode
:
'AC77674'
,
activityImg
:
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/87681f78-67db-4603-aaf3-4bdbdb4546d2.jpg'
,
bindingCouponId
:
10000148
,
bindingCouponName
:
'裂变优惠券测试'
,
activityStatus
:
2
,
activityType
:
1
,
shareNum
:
2
,
startTime
:
'2023-04-23 00:00:00'
,
endTime
:
'2023-04-30 23:59:59'
,
limitNum
:
1
,
deleted
:
null
,
show
:
1
,
redirectPath
:
null
,
couponActivityDTO
:
null
,
couponDTO
:
null
,
},
{
"id"
:
3
,
"activityName"
:
"裂变活动测试"
,
"activityCode"
:
"AC55159"
,
"activityImg"
:
"https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/6e4f318f-3081-43b7-ad6a-79afabd9ddb9.jpg"
,
"bindingCouponId"
:
10000141
,
"bindingCouponName"
:
"测试裂变"
,
"activityStatus"
:
2
,
"activityType"
:
1
,
"shareNum"
:
2
,
"startTime"
:
"2023-04-23 00:00:00"
,
"endTime"
:
"2023-04-30 23:59:59"
,
"limitNum"
:
1
,
"deleted"
:
null
,
"show"
:
1
,
"redirectPath"
:
null
,
"couponActivityDTO"
:
null
,
"couponDTO"
:
null
id
:
3
,
activityName
:
'裂变活动测试'
,
activityCode
:
'AC55159'
,
activityImg
:
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/6e4f318f-3081-43b7-ad6a-79afabd9ddb9.jpg'
,
bindingCouponId
:
10000141
,
bindingCouponName
:
'测试裂变'
,
activityStatus
:
2
,
activityType
:
1
,
shareNum
:
2
,
startTime
:
'2023-04-23 00:00:00'
,
endTime
:
'2023-04-30 23:59:59'
,
limitNum
:
1
,
deleted
:
null
,
show
:
1
,
redirectPath
:
null
,
couponActivityDTO
:
null
,
couponDTO
:
null
,
},
{
"id"
:
2
,
"activityName"
:
"认证裂变"
,
"activityCode"
:
"AC17946"
,
"activityImg"
:
"https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/b22e0f43-fd04-4147-adc6-73d96b76c740.png"
,
"bindingCouponId"
:
null
,
"bindingCouponName"
:
null
,
"activityStatus"
:
2
,
"activityType"
:
1
,
"shareNum"
:
null
,
"startTime"
:
"2023-04-19 00:00:00"
,
"endTime"
:
"2023-12-31 23:59:59"
,
"limitNum"
:
1
,
"deleted"
:
null
,
"show"
:
1
,
"redirectPath"
:
null
,
"couponActivityDTO"
:
null
,
"couponDTO"
:
null
id
:
2
,
activityName
:
'认证裂变'
,
activityCode
:
'AC17946'
,
activityImg
:
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/b22e0f43-fd04-4147-adc6-73d96b76c740.png'
,
bindingCouponId
:
null
,
bindingCouponName
:
null
,
activityStatus
:
2
,
activityType
:
1
,
shareNum
:
null
,
startTime
:
'2023-04-19 00:00:00'
,
endTime
:
'2023-12-31 23:59:59'
,
limitNum
:
1
,
deleted
:
null
,
show
:
1
,
redirectPath
:
null
,
couponActivityDTO
:
null
,
couponDTO
:
null
,
},
{
"id"
:
1
,
"activityName"
:
"测试裂变"
,
"activityCode"
:
"AC01841"
,
"activityImg"
:
"https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/40f09893-01c5-4cc6-a64a-75dac1963791.jpg"
,
"bindingCouponId"
:
10000141
,
"bindingCouponName"
:
"测试裂变"
,
"activityStatus"
:
2
,
"activityType"
:
1
,
"shareNum"
:
2
,
"startTime"
:
"2023-04-19 00:00:00"
,
"endTime"
:
"2023-04-19 23:59:59"
,
"limitNum"
:
1
,
"deleted"
:
null
,
"show"
:
1
,
"redirectPath"
:
null
,
"couponActivityDTO"
:
null
,
"couponDTO"
:
null
}
]
setTableData
(
list
)
id
:
1
,
activityName
:
'测试裂变'
,
activityCode
:
'AC01841'
,
activityImg
:
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/40f09893-01c5-4cc6-a64a-75dac1963791.jpg'
,
bindingCouponId
:
10000141
,
bindingCouponName
:
'测试裂变'
,
activityStatus
:
2
,
activityType
:
1
,
shareNum
:
2
,
startTime
:
'2023-04-19 00:00:00'
,
endTime
:
'2023-04-19 23:59:59'
,
limitNum
:
1
,
deleted
:
null
,
show
:
1
,
redirectPath
:
null
,
couponActivityDTO
:
null
,
couponDTO
:
null
,
},
];
setTableData
(
list
);
ActivityManageAPI
.
getActivityList
(
data
).
then
(({
result
})
=>
{
setLoading
(
false
);
...
...
@@ -228,26 +220,24 @@ const ActivityList: FC<{}> = () => {
// 活动结束
const
endActivityClick
=
(
record
:
activityItemType
)
=>
{
Modal
.
confirm
({
content
:
"即将停止该活动,关联优惠券会停止发放"
,
content
:
'即将停止该活动,关联优惠券会停止发放'
,
onOk
:
()
=>
{
ActivityManageAPI
.
endActivity
({
activityId
:
record
.
id
}).
then
(
({
code
})
=>
{
if
(
code
===
"200"
)
{
message
.
success
(
"操作成功,该活动已结束"
);
ActivityManageAPI
.
endActivity
({
activityId
:
record
.
id
}).
then
(({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'操作成功,该活动已结束'
);
getActivityList
({
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
});
}
}
);
});
},
});
};
// 新增,编辑弹窗
const
addOrEditActivity
=
(
record
?:
activityItemType
)
=>
{
setAddOrEditModalTitle
(
record
?
"编辑活动"
:
"创建活动"
);
setAddOrEditModalTitle
(
record
?
'编辑活动'
:
'创建活动'
);
if
(
record
)
{
const
activityForm
=
(
activityRef
.
current
as
any
)?.
getForm
();
activityForm
.
setFieldsValue
({
...
...
@@ -263,10 +253,10 @@ const ActivityList: FC<{}> = () => {
const
setFileList
=
(
activityRef
.
current
as
any
)?.
setFileList
;
setFileList
([
{
uid
:
"uid"
,
name
:
"image"
,
uid
:
'uid'
,
name
:
'image'
,
url
:
record
.
activityImg
,
status
:
"done"
,
status
:
'done'
,
},
]);
}
...
...
@@ -286,11 +276,9 @@ const ActivityList: FC<{}> = () => {
};
// 活动数据弹窗
const
showActivityData
=
(
record
:
activityItemType
)
=>
{
ActivityManageAPI
.
getActivityData
({
activityId
:
record
.
id
}).
then
(
({
result
})
=>
{
ActivityManageAPI
.
getActivityData
({
activityId
:
record
.
id
}).
then
(({
result
})
=>
{
setActivityData
(
result
||
undefined
);
}
);
});
setActivityDataModalShow
(
true
);
};
const
activityDataModalCancel
=
()
=>
{
...
...
@@ -309,16 +297,16 @@ const ActivityList: FC<{}> = () => {
getActivityList
({
pageNo
:
1
,
pageSize
:
10
});
},
[]);
return
(
<
div
className=
"activity-list"
>
<
div
className=
'activity-list'
>
<
Box
>
<
Button
type=
"primary"
onClick=
{
()
=>
addOrEditActivity
()
}
>
<
Button
type=
'primary'
onClick=
{
()
=>
addOrEditActivity
()
}
>
新增
</
Button
>
</
Box
>
<
Table
columns=
{
tableColumns
}
bordered
rowKey=
"id"
rowKey=
'id'
dataSource=
{
tableData
}
pagination=
{
{
total
:
pagination
.
totalCount
,
...
...
@@ -326,10 +314,8 @@ const ActivityList: FC<{}> = () => {
current
:
pagination
.
pageNo
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
loading=
{
loading
}
/>
...
...
src/pages/common/login/index.scss
浏览文件 @
a38d7f4f
body
{
background-color
:rgb
(
245
,
246
,
250
)
;
body
{
background-color
:
rgb
(
245
,
246
,
250
);
position
:
relative
;
.login-warp
{
width
:
100%
;
height
:
100%
;
padding-top
:
calc
(((
100vh
-
(
576px
/
5
*
4
))
/
2
)
-
20px
)
;
}
.login-view
{
margin
:
0
auto
;
width
:
calc
(
1200px
/
5
*
4
)
;
height
:
calc
(
600px
/
5
*
4
)
;
background-image
:
url
(
..
/
..
/
..
/
assets
/
image
/
login
.jpg
)
;
background-size
:
100%
100%
;
border-radius
:
16px
;
overflow
:
hidden
;
box-shadow
:
0px
20px
30px
rgba
(
112
,
158
,
254
,
0
.45
);
display
:
flex
;
.login-warp
{
width
:
100%
;
height
:
100%
;
padding-top
:
calc
(((
100vh
-
(
576px
/
5
*
4
))
/
2
)
-
20px
);
}
.login-view
{
margin
:
0
auto
;
width
:
calc
(
1200px
/
5
*
4
);
height
:
calc
(
600px
/
5
*
4
);
background-image
:
url(../../../assets/image/login.jpg)
;
background-size
:
100%
100%
;
border-radius
:
16px
;
overflow
:
hidden
;
box-shadow
:
0px
20px
30px
rgba
(
112
,
158
,
254
,
0
.45
);
display
:
flex
;
flex-wrap
:
wrap
;
.login-flex
{
flex
:
1
;
.login-flex
{
flex
:
1
;
}
.login-content
{
text-align
:
center
;
.login-content
{
text-align
:
center
;
color
:
#000
;
.login-title
{
.login-title
{
margin-top
:
158px
;
font-size
:
24px
;
}
.login-text
{
.login-text
{
margin-top
:
26px
;
font-size
:
20px
;
}
.login-detail
{
.login-detail
{
margin-top
:
44px
;
font-size
:
13px
;
color
:
rgba
(
0
,
0
,
0
,
.
5
);
color
:
rgba
(
0
,
0
,
0
,
0
.5
);
}
}
.login-form
{
.login-image
{
.login-form
{
.login-image
{
margin
:
62px
auto
46px
;
width
:
84px
;
height
:
84px
;
background-image
:
url
(
..
/
..
/
..
/
assets
/
image
/
logo
.png
)
;
background-size
:
100%
;
background-image
:
url(../../../assets/image/logo.png)
;
background-size
:
100%
;
border
:
4px
#fff
solid
;
border-radius
:
50%
;
box-shadow
:
3px
3px
30px
#dddddd
;
border-radius
:
50%
;
box-shadow
:
3px
3px
30px
#dddddd
;
}
.login-input
{
.ant-form-item
{
.login-input
{
.ant-form-item
{
line-height
:
54px
;
}
.ant-input-affix-wrapper
{
background-color
:
#fff
;
border-radius
:
22px
;
.ant-input-affix-wrapper
{
background-color
:
#fff
;
border-radius
:
22px
;
line-height
:
30px
;
border
:
none
;
box-shadow
:
3px
3px
30px
#dddddd
;
box-shadow
:
3px
3px
30px
#dddddd
;
}
}
.login-password
{
margin-bottom
:
-8px
;
.login-password
{
margin-bottom
:
-8px
;
}
.login-remember
{
.login-remember
{
margin-bottom
:
0
;
transform
:
scale
(
0
.8
);
.ant-checkbox-checked
.ant-checkbox-inner
{
background-color
:
rgb
(
102
,
122
,
255
);
border-color
:
rgb
(
102
,
122
,
255
);
background-color
:
rgb
(
102
,
122
,
255
);
border-color
:
rgb
(
102
,
122
,
255
);
}
}
.login-submit
{
width
:
210px
;
font-size
:
13px
;
background
:rgb
(
102
,
122
,
255
)
;
border
:rgb
(
102
,
122
,
255
)
;
box-shadow
:
3px
3px
30px
#dddddd
;
.login-submit
{
width
:
210px
;
font-size
:
13px
;
background
:
rgb
(
102
,
122
,
255
);
border
:
rgb
(
102
,
122
,
255
);
box-shadow
:
3px
3px
30px
#dddddd
;
}
}
}
...
...
src/pages/couponManage/couponDetailed/components/dataModal/index.tsx
浏览文件 @
a38d7f4f
import
{
FC
}
from
"react"
;
import
{
Modal
,
Descriptions
}
from
"antd"
;
import
{
PropsType
}
from
"~/common/interface/modal"
;
import
{
couponDetailItemType
}
from
"~/api/interface/couponManage"
;
import
{
FC
}
from
'react'
;
import
{
Modal
,
Descriptions
}
from
'antd'
;
import
{
PropsType
}
from
'~/common/interface/modal'
;
import
{
couponDetailItemType
}
from
'~/api/interface/couponManage'
;
const
contentStyle
=
{
width
:
"100px"
};
const
contentStyle
=
{
width
:
'100px'
};
const
DataModal
:
FC
<
Pick
<
PropsType
,
"isModalVisible"
|
"handleCancel"
>
&
{
Pick
<
PropsType
,
'isModalVisible'
|
'handleCancel'
>
&
{
couponDetailItem
:
couponDetailItemType
|
undefined
;
}
>
=
({
isModalVisible
,
handleCancel
,
couponDetailItem
})
=>
{
return
(
<
Modal
open=
{
isModalVisible
}
title=
"查看详情"
title=
'查看详情'
footer=
{
null
}
onCancel=
{
()
=>
handleCancel
()
}
width=
{
650
}
>
<
Descriptions
bordered
size=
"small"
>
<
Descriptions
.
Item
label=
"兑换时间"
contentStyle=
{
contentStyle
}
>
<
Descriptions
bordered
size=
'small'
>
<
Descriptions
.
Item
label=
'兑换时间'
contentStyle=
{
contentStyle
}
>
{
couponDetailItem
?.
createTime
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"兑换比例"
contentStyle=
{
contentStyle
}
>
<
Descriptions
.
Item
label=
'兑换比例'
contentStyle=
{
contentStyle
}
>
{
couponDetailItem
?.
conversionRatio
}
</
Descriptions
.
Item
>
{
(
couponDetailItem
?.
gainType
===
"presented"
||
couponDetailItem
?.
gainType
===
"acquire"
)
&&
(
{
(
couponDetailItem
?.
gainType
===
'presented'
||
couponDetailItem
?.
gainType
===
'acquire'
)
&&
(
<>
<
Descriptions
.
Item
label=
"转赠人UID"
contentStyle=
{
contentStyle
}
>
<
Descriptions
.
Item
label=
'转赠人UID'
contentStyle=
{
contentStyle
}
>
{
couponDetailItem
?.
transferorUid
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"获赠人UID"
contentStyle=
{
contentStyle
}
>
<
Descriptions
.
Item
label=
'获赠人UID'
contentStyle=
{
contentStyle
}
>
{
couponDetailItem
?.
receiveUid
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"转赠时间"
contentStyle=
{
contentStyle
}
>
<
Descriptions
.
Item
label=
'转赠时间'
contentStyle=
{
contentStyle
}
>
{
couponDetailItem
?.
transferorTime
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"获赠时间"
contentStyle=
{
contentStyle
}
>
<
Descriptions
.
Item
label=
'获赠时间'
contentStyle=
{
contentStyle
}
>
{
couponDetailItem
?.
createTime
}
</
Descriptions
.
Item
>
</>
...
...
src/pages/couponManage/couponDetailed/index.tsx
浏览文件 @
a38d7f4f
import
{
Button
,
Table
}
from
"antd"
;
import
{
ColumnsType
}
from
"antd/es/table"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
dayjs
from
"dayjs"
;
import
FileSaver
from
"file-saver"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
qs
from
"query-string"
;
import
{
ExportOutlined
}
from
"@ant-design/icons"
;
import
SearchBox
,
{
searchColumns
}
from
"~/components/search-box"
;
import
{
CouponManageAPI
}
from
"~/api"
;
import
{
PaginationEntity
}
from
"~/common/interface/PaginationEntity"
;
import
{
couponDetailSearchType
,
couponDetailItemType
,
}
from
"~/api/interface/couponManage"
;
import
DataModal
from
"./components/dataModal"
;
import
useOperate
from
"~/common/hook/optionHook"
;
import
{
Button
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
dayjs
from
'dayjs'
;
import
FileSaver
from
'file-saver'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
qs
from
'query-string'
;
import
{
ExportOutlined
}
from
'@ant-design/icons'
;
import
SearchBox
,
{
searchColumns
}
from
'~/components/search-box'
;
import
{
CouponManageAPI
}
from
'~/api'
;
import
{
PaginationEntity
}
from
'~/common/interface/PaginationEntity'
;
import
{
couponDetailSearchType
,
couponDetailItemType
}
from
'~/api/interface/couponManage'
;
import
DataModal
from
'./components/dataModal'
;
import
useOperate
from
'~/common/hook/optionHook'
;
const
gainTypeList
=
[
{
id
:
"receive"
,
name
:
"用户领取"
},
{
id
:
"send"
,
name
:
"系统发放"
},
{
id
:
"presented"
,
name
:
"赠送"
},
{
id
:
"acquire"
,
name
:
"获赠"
},
{
id
:
"exchange"
,
name
:
"积分兑换"
},
{
id
:
'receive'
,
name
:
'用户领取'
},
{
id
:
'send'
,
name
:
'系统发放'
},
{
id
:
'presented'
,
name
:
'赠送'
},
{
id
:
'acquire'
,
name
:
'获赠'
},
{
id
:
'exchange'
,
name
:
'积分兑换'
},
];
const
stateList
=
[
{
id
:
0
,
name
:
"未使用"
},
{
id
:
1
,
name
:
"已使用"
},
{
id
:
2
,
name
:
"已失效"
},
{
id
:
3
,
name
:
"已转赠"
},
{
id
:
4
,
name
:
"使用中"
},
{
id
:
0
,
name
:
'未使用'
},
{
id
:
1
,
name
:
'已使用'
},
{
id
:
2
,
name
:
'已失效'
},
{
id
:
3
,
name
:
'已转赠'
},
{
id
:
4
,
name
:
'使用中'
},
];
const
CouponDetailed
=
()
=>
{
const
history
=
useNavigate
();
const
searchColumns
:
searchColumns
[]
=
[
{
type
:
"input"
,
name
:
"uid"
,
label
:
"UID"
,
placeholder
:
"请输入用户UID"
,
type
:
'input'
,
name
:
'uid'
,
label
:
'UID'
,
placeholder
:
'请输入用户UID'
,
},
{
type
:
"input"
,
name
:
"userPhone"
,
label
:
"手机号"
,
placeholder
:
"请输入用户手机号"
,
type
:
'input'
,
name
:
'userPhone'
,
label
:
'手机号'
,
placeholder
:
'请输入用户手机号'
,
},
{
type
:
"input"
,
name
:
"couponId"
,
label
:
"优惠券ID"
,
placeholder
:
"请输入优惠券ID"
,
type
:
'input'
,
name
:
'couponId'
,
label
:
'优惠券ID'
,
placeholder
:
'请输入优惠券ID'
,
},
{
type
:
"DatePicker"
,
name
:
"createTime"
,
label
:
"领取时间"
,
placeholder
:
""
,
type
:
'DatePicker'
,
name
:
'createTime'
,
label
:
'领取时间'
,
placeholder
:
''
,
},
{
type
:
"DatePicker"
,
name
:
"useTime"
,
label
:
"使用时间"
,
placeholder
:
""
,
type
:
'DatePicker'
,
name
:
'useTime'
,
label
:
'使用时间'
,
placeholder
:
''
,
},
{
type
:
"input"
,
name
:
"orderNumber"
,
label
:
"订单编号"
,
placeholder
:
"请输入订单编号"
,
type
:
'input'
,
name
:
'orderNumber'
,
label
:
'订单编号'
,
placeholder
:
'请输入订单编号'
,
},
{
type
:
"select"
,
name
:
"gainType"
,
label
:
"流通方式"
,
placeholder
:
"请选择流通方式"
,
type
:
'select'
,
name
:
'gainType'
,
label
:
'流通方式'
,
placeholder
:
'请选择流通方式'
,
options
:
gainTypeList
,
},
{
type
:
"select"
,
name
:
"state"
,
label
:
"全部状态"
,
placeholder
:
"请选择状态"
,
type
:
'select'
,
name
:
'state'
,
label
:
'全部状态'
,
placeholder
:
'请选择状态'
,
options
:
stateList
,
},
];
const
tableColumns
:
ColumnsType
<
couponDetailItemType
>
=
[
{
title
:
"优惠券ID"
,
align
:
"center"
,
dataIndex
:
"couponId"
,
title
:
'优惠券ID'
,
align
:
'center'
,
dataIndex
:
'couponId'
,
},
{
title
:
"优惠券名称"
,
align
:
"center"
,
dataIndex
:
"couponName"
,
title
:
'优惠券名称'
,
align
:
'center'
,
dataIndex
:
'couponName'
,
},
{
title
:
"用户UID"
,
align
:
"center"
,
dataIndex
:
"uuid"
,
title
:
'用户UID'
,
align
:
'center'
,
dataIndex
:
'uuid'
,
},
{
title
:
"手机号码"
,
align
:
"center"
,
dataIndex
:
"userPhone"
,
title
:
'手机号码'
,
align
:
'center'
,
dataIndex
:
'userPhone'
,
},
{
title
:
"流通方式"
,
align
:
"center"
,
title
:
'流通方式'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
couponDetailItemType
)
=>
(
<
div
>
{
gainTypeList
.
find
((
v
)
=>
v
.
id
===
record
.
gainType
)?.
name
||
""
}
</
div
>
<
div
>
{
gainTypeList
.
find
((
v
)
=>
v
.
id
===
record
.
gainType
)?.
name
||
''
}
</
div
>
),
},
{
title
:
"领取时间"
,
align
:
"center"
,
dataIndex
:
"createTime"
,
title
:
'领取时间'
,
align
:
'center'
,
dataIndex
:
'createTime'
,
},
{
title
:
"状态"
,
align
:
"center"
,
title
:
'状态'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
couponDetailItemType
)
=>
(
<
div
>
{
stateList
.
find
((
v
)
=>
v
.
id
===
record
.
status
)?.
name
||
""
}
</
div
>
<
div
>
{
stateList
.
find
((
v
)
=>
v
.
id
===
record
.
status
)?.
name
||
''
}
</
div
>
),
},
{
title
:
"使用时间"
,
align
:
"center"
,
dataIndex
:
"useTime"
,
title
:
'使用时间'
,
align
:
'center'
,
dataIndex
:
'useTime'
,
},
{
title
:
"订单编号"
,
align
:
"center"
,
dataIndex
:
"orderNo"
,
title
:
'订单编号'
,
align
:
'center'
,
dataIndex
:
'orderNo'
,
render
:
(
text
:
string
,
record
:
couponDetailItemType
)
=>
record
.
orderNo
&&
(
<
Button
type=
"link"
onClick=
{
()
=>
toOrderDetail
(
record
)
}
>
<
Button
type=
'link'
onClick=
{
()
=>
toOrderDetail
(
record
)
}
>
{
record
.
orderNo
}
</
Button
>
),
},
{
title
:
"操作"
,
align
:
"center"
,
title
:
'操作'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
couponDetailItemType
)
=>
(
<
Button
type=
"link"
type=
'link'
onClick=
{
()
=>
showDataModalClick
(
record
)
}
disabled=
{
!
isLookBtn
||
record
.
useType
!==
1
}
>
...
...
@@ -167,339 +162,338 @@ const CouponDetailed = () => {
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
query
,
setQuery
]
=
useState
<
couponDetailSearchType
>
();
const
[
dataModalShow
,
setDataModalShow
]
=
useState
<
boolean
>
(
false
);
const
[
couponDetailItem
,
setCouponDetailItem
]
=
useState
<
couponDetailItemType
>
();
const
[
couponDetailItem
,
setCouponDetailItem
]
=
useState
<
couponDetailItemType
>
();
// 按钮权限
const
isExportBtn
=
useOperate
(
26301
);
const
isLookBtn
=
useOperate
(
26302
);
// 获取优惠券明细
const
getCouponDetail
=
(
data
:
Pick
<
PaginationEntity
,
"pageNo"
|
"pageSize"
>
&
couponDetailSearchType
data
:
Pick
<
PaginationEntity
,
'pageNo'
|
'pageSize'
>
&
couponDetailSearchType
,
)
=>
{
// setLoading(true);
setTableData
([
{
"id"
:
45
,
"couponId"
:
10000147
,
"cid"
:
null
,
"orderNo"
:
null
,
"uid"
:
5058
,
"uuid"
:
"UID8723232"
,
"userPhone"
:
"13522927229"
,
"couponName"
:
"科比特品牌优惠券"
,
"couponType"
:
1
,
"useType"
:
2
,
"couponMoney"
:
null
,
"minPrice"
:
null
,
"couponDiscount"
:
5
,
"remainingBalance"
:
null
,
"gainType"
:
"send"
,
"status"
:
0
,
"createTime"
:
"2023-06-01 21:42:45"
,
"updateTime"
:
null
,
"startTime"
:
"2023-04-21 00:00:00"
,
"endTime"
:
"2023-12-31 23:59:59"
,
"useTime"
:
null
,
"primaryKey"
:
"25"
,
"conversionRatio"
:
null
,
"transferorUid"
:
null
,
"receiveUid"
:
null
,
"transferorTime"
:
null
,
"verificationType"
:
false
,
"preferentialLimit"
:
10000
,
"brandIds"
:
null
,
"discountCouponPrice"
:
null
id
:
45
,
couponId
:
10000147
,
cid
:
null
,
orderNo
:
null
,
uid
:
5058
,
uuid
:
'UID8723232'
,
userPhone
:
'13522927229'
,
couponName
:
'科比特品牌优惠券'
,
couponType
:
1
,
useType
:
2
,
couponMoney
:
null
,
minPrice
:
null
,
couponDiscount
:
5
,
remainingBalance
:
null
,
gainType
:
'send'
,
status
:
0
,
createTime
:
'2023-06-01 21:42:45'
,
updateTime
:
null
,
startTime
:
'2023-04-21 00:00:00'
,
endTime
:
'2023-12-31 23:59:59'
,
useTime
:
null
,
primaryKey
:
'25'
,
conversionRatio
:
null
,
transferorUid
:
null
,
receiveUid
:
null
,
transferorTime
:
null
,
verificationType
:
false
,
preferentialLimit
:
10000
,
brandIds
:
null
,
discountCouponPrice
:
null
,
},
{
"id"
:
44
,
"couponId"
:
10000147
,
"cid"
:
null
,
"orderNo"
:
null
,
"uid"
:
5102
,
"uuid"
:
"UID9585857"
,
"userPhone"
:
"17507736658"
,
"couponName"
:
"科比特品牌优惠券"
,
"couponType"
:
1
,
"useType"
:
2
,
"couponMoney"
:
null
,
"minPrice"
:
null
,
"couponDiscount"
:
5
,
"remainingBalance"
:
null
,
"gainType"
:
"send"
,
"status"
:
0
,
"createTime"
:
"2023-05-31 21:01:15"
,
"updateTime"
:
null
,
"startTime"
:
"2023-04-21 00:00:00"
,
"endTime"
:
"2023-12-31 23:59:59"
,
"useTime"
:
null
,
"primaryKey"
:
"25"
,
"conversionRatio"
:
null
,
"transferorUid"
:
null
,
"receiveUid"
:
null
,
"transferorTime"
:
null
,
"verificationType"
:
false
,
"preferentialLimit"
:
10000
,
"brandIds"
:
null
,
"discountCouponPrice"
:
null
id
:
44
,
couponId
:
10000147
,
cid
:
null
,
orderNo
:
null
,
uid
:
5102
,
uuid
:
'UID9585857'
,
userPhone
:
'17507736658'
,
couponName
:
'科比特品牌优惠券'
,
couponType
:
1
,
useType
:
2
,
couponMoney
:
null
,
minPrice
:
null
,
couponDiscount
:
5
,
remainingBalance
:
null
,
gainType
:
'send'
,
status
:
0
,
createTime
:
'2023-05-31 21:01:15'
,
updateTime
:
null
,
startTime
:
'2023-04-21 00:00:00'
,
endTime
:
'2023-12-31 23:59:59'
,
useTime
:
null
,
primaryKey
:
'25'
,
conversionRatio
:
null
,
transferorUid
:
null
,
receiveUid
:
null
,
transferorTime
:
null
,
verificationType
:
false
,
preferentialLimit
:
10000
,
brandIds
:
null
,
discountCouponPrice
:
null
,
},
{
"id"
:
43
,
"couponId"
:
10000147
,
"cid"
:
null
,
"orderNo"
:
null
,
"uid"
:
68
,
"uuid"
:
"UID0080718"
,
"userPhone"
:
"19168592452"
,
"couponName"
:
"科比特品牌优惠券"
,
"couponType"
:
1
,
"useType"
:
2
,
"couponMoney"
:
null
,
"minPrice"
:
null
,
"couponDiscount"
:
5
,
"remainingBalance"
:
null
,
"gainType"
:
"send"
,
"status"
:
0
,
"createTime"
:
"2023-05-29 19:53:05"
,
"updateTime"
:
null
,
"startTime"
:
"2023-04-21 00:00:00"
,
"endTime"
:
"2023-12-31 23:59:59"
,
"useTime"
:
null
,
"primaryKey"
:
"25"
,
"conversionRatio"
:
null
,
"transferorUid"
:
null
,
"receiveUid"
:
null
,
"transferorTime"
:
null
,
"verificationType"
:
false
,
"preferentialLimit"
:
10000
,
"brandIds"
:
null
,
"discountCouponPrice"
:
null
id
:
43
,
couponId
:
10000147
,
cid
:
null
,
orderNo
:
null
,
uid
:
68
,
uuid
:
'UID0080718'
,
userPhone
:
'19168592452'
,
couponName
:
'科比特品牌优惠券'
,
couponType
:
1
,
useType
:
2
,
couponMoney
:
null
,
minPrice
:
null
,
couponDiscount
:
5
,
remainingBalance
:
null
,
gainType
:
'send'
,
status
:
0
,
createTime
:
'2023-05-29 19:53:05'
,
updateTime
:
null
,
startTime
:
'2023-04-21 00:00:00'
,
endTime
:
'2023-12-31 23:59:59'
,
useTime
:
null
,
primaryKey
:
'25'
,
conversionRatio
:
null
,
transferorUid
:
null
,
receiveUid
:
null
,
transferorTime
:
null
,
verificationType
:
false
,
preferentialLimit
:
10000
,
brandIds
:
null
,
discountCouponPrice
:
null
,
},
{
"id"
:
42
,
"couponId"
:
10000147
,
"cid"
:
null
,
"orderNo"
:
null
,
"uid"
:
5107
,
"uuid"
:
"UID8562549"
,
"userPhone"
:
"17891113617"
,
"couponName"
:
"科比特品牌优惠券"
,
"couponType"
:
1
,
"useType"
:
2
,
"couponMoney"
:
null
,
"minPrice"
:
null
,
"couponDiscount"
:
5
,
"remainingBalance"
:
null
,
"gainType"
:
"send"
,
"status"
:
0
,
"createTime"
:
"2023-05-29 13:23:26"
,
"updateTime"
:
null
,
"startTime"
:
"2023-04-21 00:00:00"
,
"endTime"
:
"2023-12-31 23:59:59"
,
"useTime"
:
null
,
"primaryKey"
:
"25"
,
"conversionRatio"
:
null
,
"transferorUid"
:
null
,
"receiveUid"
:
null
,
"transferorTime"
:
null
,
"verificationType"
:
false
,
"preferentialLimit"
:
10000
,
"brandIds"
:
null
,
"discountCouponPrice"
:
null
id
:
42
,
couponId
:
10000147
,
cid
:
null
,
orderNo
:
null
,
uid
:
5107
,
uuid
:
'UID8562549'
,
userPhone
:
'17891113617'
,
couponName
:
'科比特品牌优惠券'
,
couponType
:
1
,
useType
:
2
,
couponMoney
:
null
,
minPrice
:
null
,
couponDiscount
:
5
,
remainingBalance
:
null
,
gainType
:
'send'
,
status
:
0
,
createTime
:
'2023-05-29 13:23:26'
,
updateTime
:
null
,
startTime
:
'2023-04-21 00:00:00'
,
endTime
:
'2023-12-31 23:59:59'
,
useTime
:
null
,
primaryKey
:
'25'
,
conversionRatio
:
null
,
transferorUid
:
null
,
receiveUid
:
null
,
transferorTime
:
null
,
verificationType
:
false
,
preferentialLimit
:
10000
,
brandIds
:
null
,
discountCouponPrice
:
null
,
},
{
"id"
:
41
,
"couponId"
:
10000147
,
"cid"
:
null
,
"orderNo"
:
null
,
"uid"
:
5103
,
"uuid"
:
"UID6512850"
,
"userPhone"
:
"15678897088"
,
"couponName"
:
"科比特品牌优惠券"
,
"couponType"
:
1
,
"useType"
:
2
,
"couponMoney"
:
null
,
"minPrice"
:
null
,
"couponDiscount"
:
5
,
"remainingBalance"
:
null
,
"gainType"
:
"send"
,
"status"
:
0
,
"createTime"
:
"2023-05-29 10:54:11"
,
"updateTime"
:
null
,
"startTime"
:
"2023-04-21 00:00:00"
,
"endTime"
:
"2023-12-31 23:59:59"
,
"useTime"
:
null
,
"primaryKey"
:
"25"
,
"conversionRatio"
:
null
,
"transferorUid"
:
null
,
"receiveUid"
:
null
,
"transferorTime"
:
null
,
"verificationType"
:
false
,
"preferentialLimit"
:
10000
,
"brandIds"
:
null
,
"discountCouponPrice"
:
null
id
:
41
,
couponId
:
10000147
,
cid
:
null
,
orderNo
:
null
,
uid
:
5103
,
uuid
:
'UID6512850'
,
userPhone
:
'15678897088'
,
couponName
:
'科比特品牌优惠券'
,
couponType
:
1
,
useType
:
2
,
couponMoney
:
null
,
minPrice
:
null
,
couponDiscount
:
5
,
remainingBalance
:
null
,
gainType
:
'send'
,
status
:
0
,
createTime
:
'2023-05-29 10:54:11'
,
updateTime
:
null
,
startTime
:
'2023-04-21 00:00:00'
,
endTime
:
'2023-12-31 23:59:59'
,
useTime
:
null
,
primaryKey
:
'25'
,
conversionRatio
:
null
,
transferorUid
:
null
,
receiveUid
:
null
,
transferorTime
:
null
,
verificationType
:
false
,
preferentialLimit
:
10000
,
brandIds
:
null
,
discountCouponPrice
:
null
,
},
{
"id"
:
40
,
"couponId"
:
10000147
,
"cid"
:
null
,
"orderNo"
:
null
,
"uid"
:
5101
,
"uuid"
:
"UID3723715"
,
"userPhone"
:
"15129481077"
,
"couponName"
:
"科比特品牌优惠券"
,
"couponType"
:
1
,
"useType"
:
2
,
"couponMoney"
:
null
,
"minPrice"
:
null
,
"couponDiscount"
:
5
,
"remainingBalance"
:
null
,
"gainType"
:
"send"
,
"status"
:
0
,
"createTime"
:
"2023-05-29 10:41:45"
,
"updateTime"
:
null
,
"startTime"
:
"2023-04-21 00:00:00"
,
"endTime"
:
"2023-12-31 23:59:59"
,
"useTime"
:
null
,
"primaryKey"
:
"25"
,
"conversionRatio"
:
null
,
"transferorUid"
:
null
,
"receiveUid"
:
null
,
"transferorTime"
:
null
,
"verificationType"
:
false
,
"preferentialLimit"
:
10000
,
"brandIds"
:
null
,
"discountCouponPrice"
:
null
id
:
40
,
couponId
:
10000147
,
cid
:
null
,
orderNo
:
null
,
uid
:
5101
,
uuid
:
'UID3723715'
,
userPhone
:
'15129481077'
,
couponName
:
'科比特品牌优惠券'
,
couponType
:
1
,
useType
:
2
,
couponMoney
:
null
,
minPrice
:
null
,
couponDiscount
:
5
,
remainingBalance
:
null
,
gainType
:
'send'
,
status
:
0
,
createTime
:
'2023-05-29 10:41:45'
,
updateTime
:
null
,
startTime
:
'2023-04-21 00:00:00'
,
endTime
:
'2023-12-31 23:59:59'
,
useTime
:
null
,
primaryKey
:
'25'
,
conversionRatio
:
null
,
transferorUid
:
null
,
receiveUid
:
null
,
transferorTime
:
null
,
verificationType
:
false
,
preferentialLimit
:
10000
,
brandIds
:
null
,
discountCouponPrice
:
null
,
},
{
"id"
:
39
,
"couponId"
:
10000147
,
"cid"
:
null
,
"orderNo"
:
null
,
"uid"
:
4358
,
"uuid"
:
"UID1649471"
,
"userPhone"
:
"15991160565"
,
"couponName"
:
"科比特品牌优惠券"
,
"couponType"
:
1
,
"useType"
:
2
,
"couponMoney"
:
null
,
"minPrice"
:
null
,
"couponDiscount"
:
5
,
"remainingBalance"
:
null
,
"gainType"
:
"send"
,
"status"
:
0
,
"createTime"
:
"2023-05-29 09:06:22"
,
"updateTime"
:
null
,
"startTime"
:
"2023-04-21 00:00:00"
,
"endTime"
:
"2023-12-31 23:59:59"
,
"useTime"
:
null
,
"primaryKey"
:
"25"
,
"conversionRatio"
:
null
,
"transferorUid"
:
null
,
"receiveUid"
:
null
,
"transferorTime"
:
null
,
"verificationType"
:
false
,
"preferentialLimit"
:
10000
,
"brandIds"
:
null
,
"discountCouponPrice"
:
null
id
:
39
,
couponId
:
10000147
,
cid
:
null
,
orderNo
:
null
,
uid
:
4358
,
uuid
:
'UID1649471'
,
userPhone
:
'15991160565'
,
couponName
:
'科比特品牌优惠券'
,
couponType
:
1
,
useType
:
2
,
couponMoney
:
null
,
minPrice
:
null
,
couponDiscount
:
5
,
remainingBalance
:
null
,
gainType
:
'send'
,
status
:
0
,
createTime
:
'2023-05-29 09:06:22'
,
updateTime
:
null
,
startTime
:
'2023-04-21 00:00:00'
,
endTime
:
'2023-12-31 23:59:59'
,
useTime
:
null
,
primaryKey
:
'25'
,
conversionRatio
:
null
,
transferorUid
:
null
,
receiveUid
:
null
,
transferorTime
:
null
,
verificationType
:
false
,
preferentialLimit
:
10000
,
brandIds
:
null
,
discountCouponPrice
:
null
,
},
{
"id"
:
38
,
"couponId"
:
10000147
,
"cid"
:
null
,
"orderNo"
:
null
,
"uid"
:
5083
,
"uuid"
:
"UID4145719"
,
"userPhone"
:
"18931209999"
,
"couponName"
:
"科比特品牌优惠券"
,
"couponType"
:
1
,
"useType"
:
2
,
"couponMoney"
:
null
,
"minPrice"
:
null
,
"couponDiscount"
:
5
,
"remainingBalance"
:
null
,
"gainType"
:
"send"
,
"status"
:
0
,
"createTime"
:
"2023-05-27 18:00:48"
,
"updateTime"
:
null
,
"startTime"
:
"2023-04-21 00:00:00"
,
"endTime"
:
"2023-12-31 23:59:59"
,
"useTime"
:
null
,
"primaryKey"
:
"25"
,
"conversionRatio"
:
null
,
"transferorUid"
:
null
,
"receiveUid"
:
null
,
"transferorTime"
:
null
,
"verificationType"
:
false
,
"preferentialLimit"
:
10000
,
"brandIds"
:
null
,
"discountCouponPrice"
:
null
id
:
38
,
couponId
:
10000147
,
cid
:
null
,
orderNo
:
null
,
uid
:
5083
,
uuid
:
'UID4145719'
,
userPhone
:
'18931209999'
,
couponName
:
'科比特品牌优惠券'
,
couponType
:
1
,
useType
:
2
,
couponMoney
:
null
,
minPrice
:
null
,
couponDiscount
:
5
,
remainingBalance
:
null
,
gainType
:
'send'
,
status
:
0
,
createTime
:
'2023-05-27 18:00:48'
,
updateTime
:
null
,
startTime
:
'2023-04-21 00:00:00'
,
endTime
:
'2023-12-31 23:59:59'
,
useTime
:
null
,
primaryKey
:
'25'
,
conversionRatio
:
null
,
transferorUid
:
null
,
receiveUid
:
null
,
transferorTime
:
null
,
verificationType
:
false
,
preferentialLimit
:
10000
,
brandIds
:
null
,
discountCouponPrice
:
null
,
},
{
"id"
:
37
,
"couponId"
:
10000147
,
"cid"
:
null
,
"orderNo"
:
null
,
"uid"
:
2376
,
"uuid"
:
"UID3278532"
,
"userPhone"
:
"15912163681"
,
"couponName"
:
"科比特品牌优惠券"
,
"couponType"
:
1
,
"useType"
:
2
,
"couponMoney"
:
null
,
"minPrice"
:
null
,
"couponDiscount"
:
5
,
"remainingBalance"
:
null
,
"gainType"
:
"send"
,
"status"
:
0
,
"createTime"
:
"2023-05-25 16:07:09"
,
"updateTime"
:
null
,
"startTime"
:
"2023-04-21 00:00:00"
,
"endTime"
:
"2023-12-31 23:59:59"
,
"useTime"
:
null
,
"primaryKey"
:
"25"
,
"conversionRatio"
:
null
,
"transferorUid"
:
null
,
"receiveUid"
:
null
,
"transferorTime"
:
null
,
"verificationType"
:
false
,
"preferentialLimit"
:
10000
,
"brandIds"
:
null
,
"discountCouponPrice"
:
null
id
:
37
,
couponId
:
10000147
,
cid
:
null
,
orderNo
:
null
,
uid
:
2376
,
uuid
:
'UID3278532'
,
userPhone
:
'15912163681'
,
couponName
:
'科比特品牌优惠券'
,
couponType
:
1
,
useType
:
2
,
couponMoney
:
null
,
minPrice
:
null
,
couponDiscount
:
5
,
remainingBalance
:
null
,
gainType
:
'send'
,
status
:
0
,
createTime
:
'2023-05-25 16:07:09'
,
updateTime
:
null
,
startTime
:
'2023-04-21 00:00:00'
,
endTime
:
'2023-12-31 23:59:59'
,
useTime
:
null
,
primaryKey
:
'25'
,
conversionRatio
:
null
,
transferorUid
:
null
,
receiveUid
:
null
,
transferorTime
:
null
,
verificationType
:
false
,
preferentialLimit
:
10000
,
brandIds
:
null
,
discountCouponPrice
:
null
,
},
{
"id"
:
35
,
"couponId"
:
10000156
,
"cid"
:
null
,
"orderNo"
:
null
,
"uid"
:
5055
,
"uuid"
:
"UID2886699"
,
"userPhone"
:
"15185632216"
,
"couponName"
:
"人党的飞飞"
,
"couponType"
:
3
,
"useType"
:
2
,
"couponMoney"
:
12
,
"minPrice"
:
null
,
"couponDiscount"
:
null
,
"remainingBalance"
:
null
,
"gainType"
:
"send"
,
"status"
:
0
,
"createTime"
:
"2023-05-25 15:34:13"
,
"updateTime"
:
null
,
"startTime"
:
"2023-05-26 00:00:00"
,
"endTime"
:
"2023-06-22 23:59:59"
,
"useTime"
:
null
,
"primaryKey"
:
"31"
,
"conversionRatio"
:
null
,
"transferorUid"
:
null
,
"receiveUid"
:
null
,
"transferorTime"
:
null
,
"verificationType"
:
false
,
"preferentialLimit"
:
null
,
"brandIds"
:
null
,
"discountCouponPrice"
:
null
}
])
id
:
35
,
couponId
:
10000156
,
cid
:
null
,
orderNo
:
null
,
uid
:
5055
,
uuid
:
'UID2886699'
,
userPhone
:
'15185632216'
,
couponName
:
'人党的飞飞'
,
couponType
:
3
,
useType
:
2
,
couponMoney
:
12
,
minPrice
:
null
,
couponDiscount
:
null
,
remainingBalance
:
null
,
gainType
:
'send'
,
status
:
0
,
createTime
:
'2023-05-25 15:34:13'
,
updateTime
:
null
,
startTime
:
'2023-05-26 00:00:00'
,
endTime
:
'2023-06-22 23:59:59'
,
useTime
:
null
,
primaryKey
:
'31'
,
conversionRatio
:
null
,
transferorUid
:
null
,
receiveUid
:
null
,
transferorTime
:
null
,
verificationType
:
false
,
preferentialLimit
:
null
,
brandIds
:
null
,
discountCouponPrice
:
null
,
}
,
])
;
CouponManageAPI
.
getCouponDetail
(
data
).
then
(({
result
})
=>
{
const
tableData
=
(
result
.
list
||
[]).
map
((
v
)
=>
({
...
v
,
...
...
@@ -516,12 +510,8 @@ const CouponDetailed = () => {
};
// 数据筛选
const
searchDataEvents
=
(
data
:
any
)
=>
{
data
.
createTime
=
data
.
createTime
?
dayjs
(
data
.
createTime
).
format
(
"YYYY-MM-DD"
)
:
undefined
;
data
.
useTime
=
data
.
useTime
?
dayjs
(
data
.
useTime
).
format
(
"YYYY-MM-DD"
)
:
undefined
;
data
.
createTime
=
data
.
createTime
?
dayjs
(
data
.
createTime
).
format
(
'YYYY-MM-DD'
)
:
undefined
;
data
.
useTime
=
data
.
useTime
?
dayjs
(
data
.
useTime
).
format
(
'YYYY-MM-DD'
)
:
undefined
;
setQuery
(
data
);
getCouponDetail
({
pageNo
:
1
,
pageSize
:
10
,
...
data
});
};
...
...
@@ -533,12 +523,9 @@ const CouponDetailed = () => {
pageSize
:
pagination
.
pageSize
,
}).
then
((
res
:
any
)
=>
{
const
blob
=
new
Blob
([
res
],
{
type
:
"application/vnd.ms-excel"
,
type
:
'application/vnd.ms-excel'
,
});
FileSaver
.
saveAs
(
blob
,
`优惠券明细数据导出_
${
new
Date
().
toLocaleString
()}
`
);
FileSaver
.
saveAs
(
blob
,
`优惠券明细数据导出_
${
new
Date
().
toLocaleString
()}
`
);
});
};
// 分页
...
...
@@ -556,7 +543,7 @@ const CouponDetailed = () => {
// 跳转订单详情
const
toOrderDetail
=
(
record
:
couponDetailItemType
)
=>
{
history
({
pathname
:
"/orderManage/list/detail"
,
pathname
:
'/orderManage/list/detail'
,
search
:
qs
.
stringify
({
id
:
record
.
cid
,
}),
...
...
@@ -568,14 +555,14 @@ const CouponDetailed = () => {
},
[]);
return
(
<
div
className=
"coupon-detailed"
>
<
div
className=
'coupon-detailed'
>
<
SearchBox
search=
{
searchColumns
}
searchData=
{
searchDataEvents
}
otherChild=
{
<
Button
onClick=
{
exportEvent
}
type=
"primary"
type=
'primary'
icon=
{
<
ExportOutlined
disabled=
{
!
isExportBtn
}
/>
}
>
导出
...
...
@@ -586,7 +573,7 @@ const CouponDetailed = () => {
columns=
{
tableColumns
}
bordered
dataSource=
{
tableData
}
rowKey=
"selfId"
rowKey=
'selfId'
loading=
{
loading
}
pagination=
{
{
total
:
pagination
.
totalCount
,
...
...
@@ -594,10 +581,8 @@ const CouponDetailed = () => {
current
:
pagination
.
pageNo
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
/>
<
DataModal
...
...
src/pages/couponManage/couponList/comp/addEditModal/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useState
}
from
"react"
;
import
{
DatePicker
,
Form
,
Input
,
message
,
Modal
,
Radio
}
from
"antd"
;
import
moment
from
"moment"
;
import
React
,
{
useState
}
from
'react'
;
import
{
DatePicker
,
Form
,
Input
,
message
,
Modal
,
Radio
}
from
'antd'
;
import
moment
from
'moment'
;
// 传参类型
interface
propType
{
...
...
@@ -30,7 +30,7 @@ export const AddEditModal: React.FC<propType> = (props: propType) => {
form
.
validateFields
()
.
then
((
values
)
=>
{
console
.
log
(
"handleOk -->"
,
values
);
console
.
log
(
'handleOk -->'
,
values
);
})
.
catch
((
err
)
=>
{
message
...
...
@@ -41,59 +41,53 @@ export const AddEditModal: React.FC<propType> = (props: propType) => {
});
};
return
(
<
Modal
open=
{
open
}
title=
{
title
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
destroyOnClose
>
<
Modal
open=
{
open
}
title=
{
title
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
destroyOnClose
>
<
Form
name=
"addForm"
name=
'addForm'
form=
{
form
}
labelAlign=
"right"
labelAlign=
'right'
// layout="inline"
>
<
Form
.
Item
label=
"规则名称"
name=
"ruleName"
rules=
{
[{
required
:
true
,
message
:
"请输入规则名称"
}]
}
label=
'规则名称'
name=
'ruleName'
rules=
{
[{
required
:
true
,
message
:
'请输入规则名称'
}]
}
>
<
Input
placeholder=
"请输入规则名称"
maxLength=
{
20
}
allowClear
/>
<
Input
placeholder=
'请输入规则名称'
maxLength=
{
20
}
allowClear
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"兑换比例(积分:券额)"
required
>
<
Form
.
Item
label=
'兑换比例(积分:券额)'
required
>
<
Form
.
Item
name=
"year"
rules=
{
[{
required
:
true
,
message
:
"请输入积分比例"
}]
}
style=
{
{
display
:
"inline-block"
,
width
:
"calc(50% - 8px)"
}
}
name=
'year'
rules=
{
[{
required
:
true
,
message
:
'请输入积分比例'
}]
}
style=
{
{
display
:
'inline-block'
,
width
:
'calc(50% - 8px)'
}
}
>
<
Input
placeholder=
"请输入积分比例"
/>
<
Input
placeholder=
'请输入积分比例'
/>
</
Form
.
Item
>
<
Form
.
Item
name=
"month"
rules=
{
[{
required
:
true
,
message
:
"请输入券额比例"
}]
}
name=
'month'
rules=
{
[{
required
:
true
,
message
:
'请输入券额比例'
}]
}
style=
{
{
display
:
"inline-block"
,
width
:
"calc(50% - 8px)"
,
margin
:
"0 8px"
,
display
:
'inline-block'
,
width
:
'calc(50% - 8px)'
,
margin
:
'0 8px'
,
}
}
>
<
Input
placeholder=
"请输入券额比例"
/>
<
Input
placeholder=
'请输入券额比例'
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
div
style=
{
{
transform
:
"translateY(-10px)"
}
}
>
<
div
style=
{
{
transform
:
'translateY(-10px)'
}
}
>
说明:若兑换比例为1:20,则1积分可兑20元VIP优惠券,且为无门槛优惠券
</
div
>
<
Form
.
Item
label=
"生效时间"
name=
"ruleSetting"
rules=
{
[{
required
:
true
,
message
:
"请选择生效时间"
}]
}
label=
'生效时间'
name=
'ruleSetting'
rules=
{
[{
required
:
true
,
message
:
'请选择生效时间'
}]
}
initialValue=
{
0
}
>
<
Radio
.
Group
options=
{
[
{
label
:
"立即生效"
,
value
:
0
},
{
label
:
"手动设置"
,
value
:
1
},
{
label
:
'立即生效'
,
value
:
0
},
{
label
:
'手动设置'
,
value
:
1
},
]
}
value=
{
radioValue
}
onChange=
{
({
target
:
{
value
}
})
=>
{
...
...
@@ -103,16 +97,16 @@ export const AddEditModal: React.FC<propType> = (props: propType) => {
</
Form
.
Item
>
{
radioValue
===
1
&&
(
<
Form
.
Item
label=
"手动设置"
name=
"ruleTime"
rules=
{
[{
required
:
radioValue
===
1
,
message
:
"请设置生效时间"
}]
}
label=
'手动设置'
name=
'ruleTime'
rules=
{
[{
required
:
radioValue
===
1
,
message
:
'请设置生效时间'
}]
}
>
<
DatePicker
placeholder=
"请输入账号有效期"
placeholder=
'请输入账号有效期'
allowClear
showTime=
{
{
format
:
"HH:mm:ss"
}
}
format=
"YYYY-MM-DD HH:mm:ss"
style=
{
{
width
:
"100%"
}
}
showTime=
{
{
format
:
'HH:mm:ss'
}
}
format=
'YYYY-MM-DD HH:mm:ss'
style=
{
{
width
:
'100%'
}
}
disabledDate=
{
(
current
)
=>
{
// 限制时间不可早于当日
return
current
&&
current
<=
moment
();
...
...
src/pages/couponManage/couponList/comp/dataModal/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Descriptions
,
message
,
Modal
}
from
"antd"
;
import
{
CouponManageAPI
}
from
"~/api"
;
import
{
CouponGetDataType
}
from
"~/api/interface/couponManage"
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Descriptions
,
message
,
Modal
}
from
'antd'
;
import
{
CouponManageAPI
}
from
'~/api'
;
import
{
CouponGetDataType
}
from
'~/api/interface/couponManage'
;
// 传参类型
interface
propType
{
...
...
@@ -12,11 +12,9 @@ interface propType {
}
// 列表的类型
type
DetailType
=
(
ReturnType
<
CouponGetDataType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
];
type
DetailType
=
(
ReturnType
<
CouponGetDataType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
'result'
];
const
contentStyle
=
{
width
:
"100px"
};
const
contentStyle
=
{
width
:
'100px'
};
export
const
DataModal
:
React
.
FC
<
propType
>
=
(
props
:
propType
)
=>
{
// 组件默认值
...
...
@@ -36,7 +34,7 @@ export const DataModal: React.FC<propType> = (props: propType) => {
const
res
=
await
CouponManageAPI
.
CouponGetData
({
id
:
data
.
id
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
setCouponDetail
(
res
.
result
);
}
};
...
...
@@ -54,23 +52,23 @@ export const DataModal: React.FC<propType> = (props: propType) => {
destroyOnClose
width=
{
650
}
>
<
Descriptions
column=
{
3
}
bordered
size=
"small"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"总发行量"
>
<
Descriptions
column=
{
3
}
bordered
size=
'small'
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'总发行量'
>
{
couponDetail
?.
couponTotal
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"领取量"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'领取量'
>
{
couponDetail
?.
receiveQuantity
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"领取率"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'领取率'
>
{
couponDetail
?.
claimRate
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"使用量"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'使用量'
>
{
couponDetail
?.
usageAmount
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"有效使用量"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'有效使用量'
>
{
couponDetail
?.
accountPaid
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"有效使用率"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'有效使用率'
>
{
couponDetail
?.
availability
}
</
Descriptions
.
Item
>
</
Descriptions
>
...
...
src/pages/couponManage/couponList/comp/increaseModal/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useEffect
}
from
"react"
;
import
{
Form
,
Input
,
message
,
Modal
}
from
"antd"
;
import
{
maxLength
}
from
"~/utils/validateUtils"
;
import
{
CouponManageAPI
}
from
"~/api"
;
import
React
,
{
useEffect
}
from
'react'
;
import
{
Form
,
Input
,
message
,
Modal
}
from
'antd'
;
import
{
maxLength
}
from
'~/utils/validateUtils'
;
import
{
CouponManageAPI
}
from
'~/api'
;
// 传参类型
interface
propType
{
...
...
@@ -59,8 +59,8 @@ export const IncreaseModal: React.FC<propType> = (props: propType) => {
id
:
data
.
id
,
count
:
Number
(
values
.
count
),
});
if
(
res
&&
res
.
code
===
"200"
)
{
message
.
success
(
"操作成功"
).
then
();
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
).
then
();
handleCancel
();
}
};
...
...
@@ -82,31 +82,25 @@ export const IncreaseModal: React.FC<propType> = (props: propType) => {
width=
{
400
}
>
<
Form
name=
"addForm"
name=
'addForm'
form=
{
form
}
labelAlign=
"right"
labelAlign=
'right'
labelCol=
{
{
span
:
8
}
}
// layout="inline"
>
<
Form
.
Item
label=
"当前发行总量"
name=
"lastTotal"
>
<
Input
placeholder=
"请输入当前发行总量"
maxLength=
{
20
}
allowClear
disabled
suffix=
"张"
/>
<
Form
.
Item
label=
'当前发行总量'
name=
'lastTotal'
>
<
Input
placeholder=
'请输入当前发行总量'
maxLength=
{
20
}
allowClear
disabled
suffix=
'张'
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"新增发行量"
name=
"count"
label=
'新增发行量'
name=
'count'
rules=
{
[
{
required
:
true
,
message
:
"请输入新增发行量"
},
{
required
:
true
,
message
:
'请输入新增发行量'
},
// 增发合计不能超过100000
{
validator
:
(
rule
,
value
)
=>
{
if
(
Number
(
data
.
lastTotal
)
+
Number
(
value
)
>
100000
)
{
return
Promise
.
reject
(
"增发合计不能超过100000"
);
return
Promise
.
reject
(
'增发合计不能超过100000'
);
}
return
Promise
.
resolve
();
},
...
...
@@ -114,23 +108,23 @@ export const IncreaseModal: React.FC<propType> = (props: propType) => {
]
}
>
<
Input
placeholder=
"请输入新增发行量"
placeholder=
'请输入新增发行量'
maxLength=
{
20
}
allowClear
prefix=
"+"
suffix=
"张"
type=
"number"
prefix=
'+'
suffix=
'张'
type=
'number'
onChange=
{
handleIncrease
}
onInput=
{
maxLength
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"更新后总发行量"
name=
"lastTotalBefore"
>
<
Form
.
Item
label=
'更新后总发行量'
name=
'lastTotalBefore'
>
<
Input
placeholder=
"请输入更新后总发行量"
placeholder=
'请输入更新后总发行量'
maxLength=
{
20
}
allowClear
disabled
suffix=
"张"
suffix=
'张'
/>
</
Form
.
Item
>
</
Form
>
...
...
src/pages/couponManage/couponList/detail/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
qs
from
"query-string"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
qs
from
'query-string'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
{
Button
,
Checkbox
,
...
...
@@ -15,29 +15,24 @@ import {
Space
,
Upload
,
UploadProps
,
}
from
"antd"
;
import
{
UploadOutlined
}
from
"@ant-design/icons"
;
import
dayjs
from
"dayjs"
;
import
{
CheckboxChangeEvent
}
from
"antd/es/checkbox"
;
import
saveAs
from
"file-saver"
;
import
{
isNull
}
from
"lodash"
;
import
{
TableDetailView
}
from
"~/components/tableDetailView"
;
import
{
CommonAPI
,
CouponManageAPI
,
MakeManageAPI
}
from
"~/api"
;
import
{
CouponPageListType
}
from
"~/api/interface/couponManage"
;
import
{
maxLength
,
maxLength6
,
maxLength8
,
maxNumber
,
}
from
"~/utils/validateUtils"
;
import
{
Uploader
}
from
"~/components/uploader"
;
}
from
'antd'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
dayjs
from
'dayjs'
;
import
{
CheckboxChangeEvent
}
from
'antd/es/checkbox'
;
import
saveAs
from
'file-saver'
;
import
{
isNull
}
from
'lodash'
;
import
{
TableDetailView
}
from
'~/components/tableDetailView'
;
import
{
CommonAPI
,
CouponManageAPI
,
MakeManageAPI
}
from
'~/api'
;
import
{
CouponPageListType
}
from
'~/api/interface/couponManage'
;
import
{
maxLength
,
maxLength6
,
maxLength8
,
maxNumber
}
from
'~/utils/validateUtils'
;
import
{
Uploader
}
from
'~/components/uploader'
;
// 列表的类型
type
DetailType
=
(
ReturnType
<
CouponPageListType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
][
"list"
][
0
];
:
never
)[
'result'
][
'list'
][
0
];
export
default
function
CouponDetail
(
props
:
{
location
:
{
search
:
string
}
})
{
export
default
function
CouponDetail
(
props
:
{
location
:
{
search
:
string
}
})
{
// 参数解析
const
option
:
any
=
qs
.
parse
(
props
.
location
.
search
);
// 路由钩子
...
...
@@ -61,23 +56,16 @@ export default function CouponDetail (props: { location: { search: string } }){
// 优惠券数据
const
[
couponDetail
,
setCouponDetail
]
=
useState
<
DetailType
>
();
// 品牌列表
const
[
primaryOptions
,
setPrimaryOptions
]
=
useState
<
{
label
:
string
;
value
:
number
}[]
>
();
const
[
primaryOptions
,
setPrimaryOptions
]
=
useState
<
{
label
:
string
;
value
:
number
}[]
>
();
// 获取优惠券详情
const
getCouponDetail
=
async
({
id
,
type
,
}:
{
id
:
string
;
type
:
number
;
})
=>
{
const
getCouponDetail
=
async
({
id
,
type
}:
{
id
:
string
;
type
:
number
})
=>
{
const
res
=
await
CouponManageAPI
.
CouponPageList
({
couponId
:
id
,
useType
:
type
,
pageNo
:
1
,
pageSize
:
1
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
const
data
=
res
.
result
.
list
[
0
];
// 优惠券详情
setCouponDetail
(
data
);
...
...
@@ -87,7 +75,7 @@ export default function CouponDetail (props: { location: { search: string } }){
rangeTime
:
[
dayjs
(
data
.
useStartTime
),
dayjs
(
data
.
useEndTime
)],
// useStartTime: data.useStartTime && dayjs(data.useStartTime),
// useEndTime: data.useEndTime && dayjs(data.useEndTime),
primaryKey
:
data
.
primaryKey
?.
split
(
","
)?.
map
((
i
)
=>
Number
(
i
)),
primaryKey
:
data
.
primaryKey
?.
split
(
','
)?.
map
((
i
)
=>
Number
(
i
)),
});
// 设置有效期类型
setIsFixedTime
(
data
.
isFixedTime
);
...
...
@@ -117,7 +105,7 @@ export default function CouponDetail (props: { location: { search: string } }){
setPrimaryOptions
(
res
.
result
?.
list
?.
map
((
i
)
=>
{
return
{
label
:
i
.
brandName
,
value
:
i
.
id
};
})
})
,
);
};
// 有效期状态
...
...
@@ -151,9 +139,9 @@ export default function CouponDetail (props: { location: { search: string } }){
const
handleIsLimited
=
({
target
:
{
value
}
}:
RadioChangeEvent
)
=>
{
setIsLimited
(
value
);
if
(
!
value
)
{
form
.
setFieldValue
(
"couponTotal"
,
"0"
);
form
.
setFieldValue
(
'couponTotal'
,
'0'
);
}
else
{
form
.
setFieldValue
(
"couponTotal"
,
undefined
);
form
.
setFieldValue
(
'couponTotal'
,
undefined
);
}
};
// 校验数据
...
...
@@ -167,13 +155,10 @@ export default function CouponDetail (props: { location: { search: string } }){
await
handleSubmit
({
...
values
,
// couponDiscount: Number(values.couponDiscount),
primaryKey
:
values
.
primaryKey
.
join
(
","
),
primaryKey
:
values
.
primaryKey
.
join
(
','
),
useStartTime
:
values
.
rangeTime
&&
dayjs
(
values
.
rangeTime
[
0
]).
format
(
"YYYY-MM-DD 00:00:00"
),
useEndTime
:
values
.
rangeTime
&&
dayjs
(
values
.
rangeTime
[
1
]).
format
(
"YYYY-MM-DD 23:59:59"
),
values
.
rangeTime
&&
dayjs
(
values
.
rangeTime
[
0
]).
format
(
'YYYY-MM-DD 00:00:00'
),
useEndTime
:
values
.
rangeTime
&&
dayjs
(
values
.
rangeTime
[
1
]).
format
(
'YYYY-MM-DD 23:59:59'
),
useType
:
option
.
type
,
});
})
...
...
@@ -190,13 +175,13 @@ export default function CouponDetail (props: { location: { search: string } }){
// console.log("handleSubmit --->", data);
const
formData
=
new
FormData
();
const
blob
=
new
Blob
([
JSON
.
stringify
(
data
)],
{
type
:
"application/json"
,
type
:
'application/json'
,
});
formData
.
append
(
"couponInfoVO"
,
blob
);
formData
.
append
(
"file"
,
data
.
file
);
formData
.
append
(
'couponInfoVO'
,
blob
);
formData
.
append
(
'file'
,
data
.
file
);
const
res
=
await
CouponManageAPI
.
CouponSave
(
formData
);
if
(
res
&&
res
.
code
===
"200"
)
{
message
.
success
(
"操作成功"
,
1
).
then
(()
=>
history
(
-
1
));
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
,
1
).
then
(()
=>
history
(
-
1
));
}
else
{
message
.
error
(
res
.
message
);
}
...
...
@@ -222,39 +207,34 @@ export default function CouponDetail (props: { location: { search: string } }){
}
}
onOK=
{
handleOk
}
>
<
div
className=
"detail-form"
>
<
div
className=
'detail-form'
>
<
Form
name=
"addForm"
name=
'addForm'
form=
{
form
}
labelAlign=
"right"
labelAlign=
'right'
disabled=
{
editDisable
}
// labelCol={{ span: 3 }}
>
<
div
className=
"detail-label"
>
基本信息
</
div
>
<
div
className=
'detail-label'
>
基本信息
</
div
>
<
Form
.
Item
label=
"优惠券名称"
name=
"couponName"
rules=
{
[{
required
:
true
,
message
:
"请输入优惠券名称"
}]
}
label=
'优惠券名称'
name=
'couponName'
rules=
{
[{
required
:
true
,
message
:
'请输入优惠券名称'
}]
}
>
<
Input
placeholder=
"请输入优惠券名称"
maxLength=
{
10
}
allowClear
showCount
/>
<
Input
placeholder=
'请输入优惠券名称'
maxLength=
{
10
}
allowClear
showCount
/>
</
Form
.
Item
>
<
Form
.
Item
name=
"isFixedTime"
label=
"有效期"
rules=
{
[{
required
:
true
,
message
:
"请选择有效期"
}]
}
name=
'isFixedTime'
label=
'有效期'
rules=
{
[{
required
:
true
,
message
:
'请选择有效期'
}]
}
initialValue=
{
0
}
>
<
Radio
.
Group
style=
{
{
marginTop
:
"2px"
}
}
style=
{
{
marginTop
:
'2px'
}
}
options=
{
[
{
value
:
0
,
label
:
"起始日期 至 结束日期"
},
{
value
:
1
,
label
:
"领取当日起"
},
{
value
:
2
,
label
:
"领取次日起"
},
{
value
:
0
,
label
:
'起始日期 至 结束日期'
},
{
value
:
1
,
label
:
'领取当日起'
},
{
value
:
2
,
label
:
'领取次日起'
},
]
}
value=
{
isFixedTime
}
onChange=
{
handleFixedTime
}
...
...
@@ -262,68 +242,68 @@ export default function CouponDetail (props: { location: { search: string } }){
</
Form
.
Item
>
{
isFixedTime
===
0
&&
(
<
Form
.
Item
label=
{
" "
}
label=
{
' '
}
colon=
{
false
}
name=
"rangeTime"
rules=
{
[{
required
:
true
,
message
:
"请输入有效期"
}]
}
name=
'rangeTime'
rules=
{
[{
required
:
true
,
message
:
'请输入有效期'
}]
}
required
style=
{
{
width
:
"400px"
,
marginLeft
:
"55px"
,
width
:
'400px'
,
marginLeft
:
'55px'
,
}
}
>
<
DatePicker
.
RangePicker
format=
"YYYY-MM-DD"
format=
'YYYY-MM-DD'
disabledDate=
{
(
current
)
=>
{
// 限制时间不可早于昨日
return
current
&&
current
<
dayjs
().
subtract
(
1
,
"days"
);
return
current
&&
current
<
dayjs
().
subtract
(
1
,
'days'
);
}
}
/>
</
Form
.
Item
>
)
}
{
isFixedTime
===
1
&&
(
<
Form
.
Item
label=
{
" "
}
label=
{
' '
}
colon=
{
false
}
name=
"couponDay"
rules=
{
[{
required
:
true
,
message
:
"请输入有效期"
}]
}
style=
{
{
width
:
"200px"
,
marginLeft
:
"55px"
}
}
name=
'couponDay'
rules=
{
[{
required
:
true
,
message
:
'请输入有效期'
}]
}
style=
{
{
width
:
'200px'
,
marginLeft
:
'55px'
}
}
>
<
Input
placeholder=
"请输入天数"
placeholder=
'请输入天数'
allowClear
suffix=
"天内可用"
type=
"number"
suffix=
'天内可用'
type=
'number'
onInput=
{
maxLength
}
/>
</
Form
.
Item
>
)
}
{
isFixedTime
===
2
&&
(
<
Form
.
Item
label=
{
" "
}
label=
{
' '
}
colon=
{
false
}
name=
"couponDay"
rules=
{
[{
required
:
true
,
message
:
"请输入有效期"
}]
}
style=
{
{
width
:
"200px"
,
marginLeft
:
"55px"
}
}
name=
'couponDay'
rules=
{
[{
required
:
true
,
message
:
'请输入有效期'
}]
}
style=
{
{
width
:
'200px'
,
marginLeft
:
'55px'
}
}
>
<
Input
placeholder=
"请输入天数"
placeholder=
'请输入天数'
maxLength=
{
10
}
allowClear
suffix=
"天内可用"
type=
"number"
suffix=
'天内可用'
type=
'number'
onInput=
{
maxLength
}
/>
</
Form
.
Item
>
)
}
<
Form
.
Item
name=
"primaryKey"
label=
"品牌范围"
rules=
{
[{
required
:
true
,
message
:
"请选择品牌范围"
}]
}
name=
'primaryKey'
label=
'品牌范围'
rules=
{
[{
required
:
true
,
message
:
'请选择品牌范围'
}]
}
>
<
Select
mode=
"multiple"
placeholder=
"请选择品牌范围"
mode=
'multiple'
placeholder=
'请选择品牌范围'
maxLength=
{
50
}
allowClear
options=
{
primaryOptions
}
...
...
@@ -333,18 +313,18 @@ export default function CouponDetail (props: { location: { search: string } }){
{
/* 说明:一张优惠券最多可以选择50个指定品牌。优惠券一旦创建,指定品牌只能增加,不能删除。 */
}
{
/* </div> */
}
<
Form
.
Item
label=
"发放方式"
name=
"getType"
rules=
{
[{
required
:
true
,
message
:
"请选择发放方式"
}]
}
label=
'发放方式'
name=
'getType'
rules=
{
[{
required
:
true
,
message
:
'请选择发放方式'
}]
}
initialValue=
{
1
}
>
<
Radio
.
Group
style=
{
{
marginTop
:
"4px"
}
}
style=
{
{
marginTop
:
'4px'
}
}
options=
{
[
{
label
:
"主动领取"
,
value
:
1
},
{
label
:
"系统发放"
,
value
:
2
},
{
label
:
"批量导入用户"
,
value
:
3
},
{
label
:
"活动裂变券"
,
value
:
4
,
disabled
:
true
},
{
label
:
'主动领取'
,
value
:
1
},
{
label
:
'系统发放'
,
value
:
2
},
{
label
:
'批量导入用户'
,
value
:
3
},
{
label
:
'活动裂变券'
,
value
:
4
,
disabled
:
true
},
]
}
value=
{
getType
}
onChange=
{
handleGetType
}
...
...
@@ -352,18 +332,18 @@ export default function CouponDetail (props: { location: { search: string } }){
</
Form
.
Item
>
{
getType
===
2
&&
(
<
Form
.
Item
name=
"userTag"
label=
"用户标签"
rules=
{
[{
required
:
true
,
message
:
"请选择用户标签"
}]
}
name=
'userTag'
label=
'用户标签'
rules=
{
[{
required
:
true
,
message
:
'请选择用户标签'
}]
}
>
<
Select
placeholder=
"请选择用户标签"
placeholder=
'请选择用户标签'
allowClear
maxLength=
{
50
}
options=
{
[
{
label
:
"新用户"
,
value
:
1
},
{
label
:
"实名认证"
,
value
:
2
},
{
label
:
"企业认证"
,
value
:
3
},
{
label
:
'新用户'
,
value
:
1
},
{
label
:
'实名认证'
,
value
:
2
},
{
label
:
'企业认证'
,
value
:
3
},
]
}
/>
</
Form
.
Item
>
...
...
@@ -371,77 +351,77 @@ export default function CouponDetail (props: { location: { search: string } }){
{
getType
===
3
&&
(
<>
<
Form
.
Item
name=
"fileUrl"
label=
"文件地址"
rules=
{
[{
required
:
true
,
message
:
"请上传文件"
}]
}
name=
'fileUrl'
label=
'文件地址'
rules=
{
[{
required
:
true
,
message
:
'请上传文件'
}]
}
wrapperCol=
{
{
span
:
6
}
}
hidden
>
<
Input
placeholder=
"请上传文件"
/>
<
Input
placeholder=
'请上传文件'
/>
</
Form
.
Item
>
<
Form
.
Item
name=
"file"
label=
"上传模板"
rules=
{
[{
required
:
true
,
message
:
"请上传模板"
}]
}
name=
'file'
label=
'上传模板'
rules=
{
[{
required
:
true
,
message
:
'请上传模板'
}]
}
>
<
Uploader
listType=
"text"
listType=
'text'
fileType=
{
[
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
,
"application/vnd.ms-excel"
,
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
,
'application/vnd.ms-excel'
,
]
}
fileUpload=
{
false
}
onChange=
{
(
file
)
=>
{
// 上传到服务器
const
formData
=
new
FormData
();
formData
.
append
(
"uploadFile"
,
file
[
0
]);
formData
.
append
(
'uploadFile'
,
file
[
0
]);
CommonAPI
.
fileUpload
(
formData
).
then
((
res
:
any
)
=>
{
if
(
res
&&
res
.
code
===
"200"
)
{
form
.
setFieldValue
(
"fileUrl"
,
res
?.
result
?.
filePath
);
form
.
setFieldValue
(
"file"
,
file
[
0
]);
if
(
res
&&
res
.
code
===
'200'
)
{
form
.
setFieldValue
(
'fileUrl'
,
res
?.
result
?.
filePath
);
form
.
setFieldValue
(
'file'
,
file
[
0
]);
}
else
{
message
.
error
(
"文件上传失败"
).
then
();
message
.
error
(
'文件上传失败'
).
then
();
}
});
}
}
// 默认文件列表
defaultFileList=
{
couponDetail
?.
fileUrl
?
[{
url
:
couponDetail
?.
file
,
name
:
"用户数据.xlsx"
}]
?
[{
url
:
couponDetail
?.
file
,
name
:
'用户数据.xlsx'
}]
:
[]
}
>
<
Button
icon=
{
<
UploadOutlined
/>
}
>
上传文件
</
Button
>
</
Uploader
>
<
Button
type=
"link"
type=
'link'
onClick=
{
()
=>
{
// 使用file-save保存文件,文件链接为:https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/doc/coupon-template.xlsx
saveAs
(
"https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/doc/coupon-template.xlsx"
,
"导入模板.xlsx"
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/doc/coupon-template.xlsx'
,
'导入模板.xlsx'
,
);
}
}
style=
{
{
position
:
"absolute"
,
top
:
"0px"
,
right
:
"120px"
}
}
style=
{
{
position
:
'absolute'
,
top
:
'0px'
,
right
:
'120px'
}
}
>
模板下载
</
Button
>
</
Form
.
Item
>
</>
)
}
<
div
className=
"detail-label"
>
面额信息
</
div
>
<
div
className=
'detail-label'
>
面额信息
</
div
>
<
Form
.
Item
label=
"优惠类型"
name=
"couponType"
rules=
{
[{
required
:
true
,
message
:
"请选择优惠类型"
}]
}
label=
'优惠类型'
name=
'couponType'
rules=
{
[{
required
:
true
,
message
:
'请选择优惠类型'
}]
}
initialValue=
{
1
}
>
<
Radio
.
Group
style=
{
{
marginTop
:
"4px"
}
}
style=
{
{
marginTop
:
'4px'
}
}
options=
{
[
{
label
:
"折扣券"
,
value
:
1
},
{
label
:
"满减券"
,
value
:
2
},
{
label
:
"无门槛"
,
value
:
3
},
{
label
:
'折扣券'
,
value
:
1
},
{
label
:
'满减券'
,
value
:
2
},
{
label
:
'无门槛'
,
value
:
3
},
]
}
value=
{
couponType
}
onChange=
{
handleCouponType
}
...
...
@@ -449,15 +429,12 @@ export default function CouponDetail (props: { location: { search: string } }){
</
Form
.
Item
>
{
couponType
===
1
&&
(
<>
<
Form
.
Item
label=
"打折条件"
rules=
{
[{
required
:
true
,
message
:
"请选择打折条件"
}]
}
>
<
Form
.
Item
label=
'打折条件'
rules=
{
[{
required
:
true
,
message
:
'请选择打折条件'
}]
}
>
<
Radio
.
Group
style=
{
{
marginTop
:
"4px"
}
}
style=
{
{
marginTop
:
'4px'
}
}
options=
{
[
{
label
:
"无门槛"
,
value
:
1
},
{
label
:
"有门槛"
,
value
:
2
},
{
label
:
'无门槛'
,
value
:
1
},
{
label
:
'有门槛'
,
value
:
2
},
]
}
value=
{
discountRule
}
onChange=
{
handleDiscountRule
}
...
...
@@ -465,109 +442,102 @@ export default function CouponDetail (props: { location: { search: string } }){
</
Form
.
Item
>
{
discountRule
===
2
&&
(
<
Form
.
Item
name=
"minPrice"
label=
"订单满"
rules=
{
[{
required
:
true
,
message
:
"请输入金额"
}]
}
name=
'minPrice'
label=
'订单满'
rules=
{
[{
required
:
true
,
message
:
'请输入金额'
}]
}
wrapperCol=
{
{
span
:
6
}
}
>
<
Input
placeholder=
"请输入金额"
suffix=
"元"
type=
"number"
placeholder=
'请输入金额'
suffix=
'元'
type=
'number'
onInput=
{
maxLength8
}
/>
</
Form
.
Item
>
)
}
<
Form
.
Item
name=
"couponDiscount"
label=
"打"
name=
'couponDiscount'
label=
'打'
rules=
{
[
{
required
:
true
,
message
:
"请输入数字"
},
{
required
:
true
,
message
:
'请输入数字'
},
{
pattern
:
/^10
(\.
00
)?
$|^
(\d
|
[
1-9
])(\.\d
{1,2}
)?
$/
,
message
:
"只能输入0.01到10.00的两位小数"
,
message
:
'只能输入0.01到10.00的两位小数'
,
},
]
}
wrapperCol=
{
{
span
:
6
}
}
>
<
Input
placeholder=
"请输入数字"
suffix=
"折"
type=
"number"
placeholder=
'请输入数字'
suffix=
'折'
type=
'number'
// onInput=
{
onlyNumber
}
/>
</
Form
.
Item
>
<
Checkbox
onChange=
{
handleMaxDiscount
}
style=
{
{
marginTop
:
"6px"
,
marginRight
:
"10px"
}
}
style=
{
{
marginTop
:
'6px'
,
marginRight
:
'10px'
}
}
checked=
{
maxDiscount
}
/>
<
Form
.
Item
name=
"preferentialLimit"
label=
"最多优惠"
rules=
{
[{
required
:
maxDiscount
,
message
:
"请输入金额"
}]
}
name=
'preferentialLimit'
label=
'最多优惠'
rules=
{
[{
required
:
maxDiscount
,
message
:
'请输入金额'
}]
}
wrapperCol=
{
{
span
:
7
}
}
style=
{
{
display
:
"inline-block"
,
width
:
"85%"
}
}
style=
{
{
display
:
'inline-block'
,
width
:
'85%'
}
}
>
<
Input
placeholder=
"请输入金额"
suffix=
"元"
type=
"number"
onInput=
{
maxLength8
}
/>
<
Input
placeholder=
'请输入金额'
suffix=
'元'
type=
'number'
onInput=
{
maxLength8
}
/>
</
Form
.
Item
>
<
div
className=
"detail-form-tips"
>
说明:最多优惠金额不可高于满折后的价格。
</
div
>
<
div
className=
'detail-form-tips'
>
说明:最多优惠金额不可高于满折后的价格。
</
div
>
</>
)
}
{
couponType
===
2
&&
(
<>
<
Form
.
Item
style=
{
{
marginLeft
:
"30px"
}
}
>
<
Form
.
Item
style=
{
{
marginLeft
:
'30px'
}
}
>
<
Form
.
Item
name=
"minPrice"
label=
"满"
name=
'minPrice'
label=
'满'
colon=
{
false
}
rules=
{
[{
required
:
true
,
message
:
"请输入金额"
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入金额'
}]
}
style=
{
{
display
:
"inline-block"
,
width
:
"calc(40% - 8px)"
,
display
:
'inline-block'
,
width
:
'calc(40% - 8px)'
,
}
}
>
<
Input
placeholder=
"请输入金额"
suffix=
"元"
type=
"number"
placeholder=
'请输入金额'
suffix=
'元'
type=
'number'
onInput=
{
maxLength8
}
onChange=
{
()
=>
{
form
.
validateFields
([
"couponMoney"
]).
then
();
form
.
validateFields
([
'couponMoney'
]).
then
();
}
}
/>
</
Form
.
Item
>
<
Form
.
Item
name=
"couponMoney"
label=
"减"
name=
'couponMoney'
label=
'减'
colon=
{
false
}
rules=
{
[
{
required
:
true
,
message
:
"请输入金额"
},
{
required
:
true
,
message
:
'请输入金额'
},
// 满减金额不能大于原价
{
validator
:
(
_
,
value
)
=>
Number
(
value
)
>
Number
(
form
.
getFieldValue
(
"minPrice"
))
?
Promise
.
reject
(
"满减金额不能大于原价"
)
Number
(
value
)
>
Number
(
form
.
getFieldValue
(
'minPrice'
))
?
Promise
.
reject
(
'满减金额不能大于原价'
)
:
Promise
.
resolve
(),
},
]
}
style=
{
{
display
:
"inline-block"
,
width
:
"calc(40% - 8px)"
,
margin
:
"0 8px"
,
display
:
'inline-block'
,
width
:
'calc(40% - 8px)'
,
margin
:
'0 8px'
,
}
}
>
<
Input
placeholder=
"请输入金额"
suffix=
"元"
type=
"number"
placeholder=
'请输入金额'
suffix=
'元'
type=
'number'
onInput=
{
maxLength8
}
/>
</
Form
.
Item
>
...
...
@@ -577,93 +547,86 @@ export default function CouponDetail (props: { location: { search: string } }){
{
couponType
===
3
&&
(
<>
<
Form
.
Item
name=
"couponMoney"
label=
"券的面额"
name=
'couponMoney'
label=
'券的面额'
rules=
{
[
{
required
:
true
,
message
:
"请输入面额"
},
{
required
:
true
,
message
:
'请输入面额'
},
{
validator
:
(
_
,
value
)
=>
Number
(
value
)
>
200000
?
Promise
.
reject
(
"面额不得超过20万元"
)
?
Promise
.
reject
(
'面额不得超过20万元'
)
:
Promise
.
resolve
(),
},
]
}
wrapperCol=
{
{
span
:
6
}
}
>
<
Input
placeholder=
"请输入面额"
suffix=
"元"
type=
"number"
onInput=
{
maxLength6
}
/>
<
Input
placeholder=
'请输入面额'
suffix=
'元'
type=
'number'
onInput=
{
maxLength6
}
/>
</
Form
.
Item
>
<
div
className=
"detail-form-tips"
>
说明:请输入整数金额,面额不得超过20万元。
</
div
>
<
div
className=
'detail-form-tips'
>
说明:请输入整数金额,面额不得超过20万元。
</
div
>
<
Form
.
Item
label=
"核销方式"
name=
"verificationType"
rules=
{
[{
required
:
true
,
message
:
"请选择核销方式"
}]
}
label=
'核销方式'
name=
'verificationType'
rules=
{
[{
required
:
true
,
message
:
'请选择核销方式'
}]
}
>
<
Radio
.
Group
style=
{
{
marginTop
:
"4px"
}
}
style=
{
{
marginTop
:
'4px'
}
}
options=
{
[
{
label
:
"单次核销"
,
value
:
false
},
{
label
:
"多次核销"
,
value
:
true
},
{
label
:
'单次核销'
,
value
:
false
},
{
label
:
'多次核销'
,
value
:
true
},
]
}
/>
</
Form
.
Item
>
</>
)
}
<
Form
.
Item
label=
"是否限量"
name=
"isLimited"
rules=
{
[{
required
:
true
,
message
:
"请选择核销方式"
}]
}
label=
'是否限量'
name=
'isLimited'
rules=
{
[{
required
:
true
,
message
:
'请选择核销方式'
}]
}
initialValue
hidden
>
<
Radio
.
Group
style=
{
{
marginTop
:
"4px"
}
}
style=
{
{
marginTop
:
'4px'
}
}
options=
{
[
{
label
:
"限量"
,
value
:
true
},
{
label
:
"不限量"
,
value
:
false
},
{
label
:
'限量'
,
value
:
true
},
{
label
:
'不限量'
,
value
:
false
},
]
}
value=
{
isLimited
}
onChange=
{
handleIsLimited
}
/>
</
Form
.
Item
>
<
Form
.
Item
name=
"couponTotal"
label=
"发行量"
name=
'couponTotal'
label=
'发行量'
rules=
{
[
{
required
:
true
,
message
:
"请输入发行量"
},
{
max
:
100000
,
message
:
"最大不能超过100000"
},
{
required
:
true
,
message
:
'请输入发行量'
},
{
max
:
100000
,
message
:
'最大不能超过100000'
},
]
}
hidden=
{
!
isLimited
}
>
<
Input
placeholder=
"至少1张,不超过10万"
suffix=
"张"
type=
"number"
placeholder=
'至少1张,不超过10万'
suffix=
'张'
type=
'number'
onInput=
{
maxNumber
}
/>
</
Form
.
Item
>
<
div
className=
"detail-form-tips"
style=
{
{
color
:
"red"
}
}
>
<
div
className=
'detail-form-tips'
style=
{
{
color
:
'red'
}
}
>
说明:优惠券创建后,发行量只能增加不能减少,请谨慎设置。
</
div
>
<
Form
.
Item
name=
"restrictedAccess"
label=
"每人限领"
rules=
{
[{
required
:
true
,
message
:
"请选择限领张数"
}]
}
name=
'restrictedAccess'
label=
'每人限领'
rules=
{
[{
required
:
true
,
message
:
'请选择限领张数'
}]
}
>
<
Select
placeholder=
"至少1张,不超过10万"
placeholder=
'至少1张,不超过10万'
options=
{
[
{
label
:
"1张"
,
value
:
1
},
{
label
:
"2张"
,
value
:
2
},
{
label
:
"3张"
,
value
:
3
},
{
label
:
"4张"
,
value
:
4
},
{
label
:
"5张"
,
value
:
5
},
{
label
:
'1张'
,
value
:
1
},
{
label
:
'2张'
,
value
:
2
},
{
label
:
'3张'
,
value
:
3
},
{
label
:
'4张'
,
value
:
4
},
{
label
:
'5张'
,
value
:
5
},
//
{
label
:
"不限"
,
value
:
0
},
]
}
// onChange={(e) => {
...
...
@@ -680,4 +643,4 @@ export default function CouponDetail (props: { location: { search: string } }){
</
TableDetailView
>
</>
);
}
;
}
src/pages/couponManage/couponList/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Button
,
message
,
Modal
,
Radio
,
RadioChangeEvent
,
Table
}
from
"antd"
;
import
{
ColumnsType
}
from
"antd/es/table"
;
import
{
PlusOutlined
}
from
"@ant-design/icons"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
moment
from
"moment"
;
import
SearchView
from
"~/components/search-box/index"
;
import
{
CouponManageAPI
}
from
"~/api"
;
import
{
TableBox
}
from
"~/components/tableBox"
;
import
{
IncreaseModal
}
from
"~/pages/couponManage/couponList/comp/increaseModal"
;
import
{
DataModal
}
from
"~/pages/couponManage/couponList/comp/dataModal"
;
import
{
CouponPageListType
}
from
"~/api/interface/couponManage"
;
import
useOperate
from
"~/common/hook/optionHook"
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Button
,
message
,
Modal
,
Radio
,
RadioChangeEvent
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
moment
from
'moment'
;
import
SearchView
from
'~/components/search-box/index'
;
import
{
CouponManageAPI
}
from
'~/api'
;
import
{
TableBox
}
from
'~/components/tableBox'
;
import
{
IncreaseModal
}
from
'~/pages/couponManage/couponList/comp/increaseModal'
;
import
{
DataModal
}
from
'~/pages/couponManage/couponList/comp/dataModal'
;
import
{
CouponPageListType
}
from
'~/api/interface/couponManage'
;
import
useOperate
from
'~/common/hook/optionHook'
;
// 列表的类型
type
TableType
=
(
ReturnType
<
CouponPageListType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
][
"list"
];
:
never
)[
'result'
][
'list'
];
type
ReqType
=
Parameters
<
CouponPageListType
>
[
0
];
// 搜索表单的数据
let
query
:
ReqType
=
{};
// 规则状态
const
stateOptions
=
[
// { id: null, name: "全部状态" },
{
id
:
true
,
name
:
"领取中"
},
{
id
:
false
,
name
:
"已结束"
},
{
id
:
true
,
name
:
'领取中'
},
{
id
:
false
,
name
:
'已结束'
},
];
// 优惠券类型
const
couponType
=
[
{
label
:
"打折券"
,
value
:
1
},
{
label
:
"减免券"
,
value
:
2
},
{
label
:
"无门槛"
,
value
:
3
},
{
label
:
'打折券'
,
value
:
1
},
{
label
:
'减免券'
,
value
:
2
},
{
label
:
'无门槛'
,
value
:
3
},
];
export
default
function
CouponList
()
{
export
default
function
CouponList
()
{
const
{
confirm
}
=
Modal
;
// 路由操作
const
history
=
useNavigate
();
...
...
@@ -65,276 +65,276 @@ export default function CouponList () {
// 只需要修改这个地方的接口即可
setTableData
([
{
"id"
:
10000157
,
"couponName"
:
"2223"
,
"couponMoney"
:
22
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
null
,
"couponTotal"
:
13
,
"lastTotal"
:
13
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32,31"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-27 00:00:00"
,
"useEndTime"
:
"2023-06-16 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
null
,
"couponStatus"
:
true
,
"isDel"
:
false
,
"preferentialLimit"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 17:47:50"
,
"updateTime"
:
null
,
"fileUrl"
:
null
id
:
10000157
,
couponName
:
'2223'
,
couponMoney
:
22
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
null
,
couponTotal
:
13
,
lastTotal
:
13
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32,31'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-27 00:00:00'
,
useEndTime
:
'2023-06-16 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
null
,
couponStatus
:
true
,
isDel
:
false
,
preferentialLimit
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 17:47:50'
,
updateTime
:
null
,
fileUrl
:
null
,
},
{
"id"
:
10000158
,
"couponName"
:
"2223"
,
"couponMoney"
:
22
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
1
,
"couponTotal"
:
12
,
"lastTotal"
:
12
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-27 00:00:00"
,
"useEndTime"
:
"2023-06-16 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
1
,
"couponStatus"
:
true
,
"isDel"
:
false
,
"preferentialLimit"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 17:47:50"
,
"updateTime"
:
null
,
"fileUrl"
:
null
id
:
10000158
,
couponName
:
'2223'
,
couponMoney
:
22
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
1
,
couponTotal
:
12
,
lastTotal
:
12
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-27 00:00:00'
,
useEndTime
:
'2023-06-16 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
1
,
couponStatus
:
true
,
isDel
:
false
,
preferentialLimit
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 17:47:50'
,
updateTime
:
null
,
fileUrl
:
null
,
},
{
"id"
:
10000156
,
"couponName"
:
"人党的飞飞"
,
"couponMoney"
:
12
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
3
,
"couponTotal"
:
12
,
"lastTotal"
:
0
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"31"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-26 00:00:00"
,
"useEndTime"
:
"2023-06-22 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
2
,
"userTag"
:
1
,
"couponStatus"
:
true
,
"isDel"
:
false
,
"preferentialLimit"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 17:05:52"
,
"updateTime"
:
null
,
"fileUrl"
:
null
id
:
10000156
,
couponName
:
'人党的飞飞'
,
couponMoney
:
12
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
3
,
couponTotal
:
12
,
lastTotal
:
0
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'31'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-26 00:00:00'
,
useEndTime
:
'2023-06-22 23:59:59'
,
couponDay
:
null
,
getType
:
2
,
userTag
:
1
,
couponStatus
:
true
,
isDel
:
false
,
preferentialLimit
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 17:05:52'
,
updateTime
:
null
,
fileUrl
:
null
,
},
{
"id"
:
10000155
,
"couponName"
:
"44444"
,
"couponMoney"
:
44
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
3
,
"couponTotal"
:
44
,
"lastTotal"
:
44
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32,24"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-24 00:00:00"
,
"useEndTime"
:
"2023-06-19 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
1
,
"userTag"
:
null
,
"couponStatus"
:
true
,
"isDel"
:
false
,
"preferentialLimit"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 17:01:11"
,
"updateTime"
:
null
,
"fileUrl"
:
null
id
:
10000155
,
couponName
:
'44444'
,
couponMoney
:
44
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
3
,
couponTotal
:
44
,
lastTotal
:
44
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32,24'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-24 00:00:00'
,
useEndTime
:
'2023-06-19 23:59:59'
,
couponDay
:
null
,
getType
:
1
,
userTag
:
null
,
couponStatus
:
true
,
isDel
:
false
,
preferentialLimit
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 17:01:11'
,
updateTime
:
null
,
fileUrl
:
null
,
},
{
"id"
:
10000153
,
"couponName"
:
"列表优惠券测试小嗯嗯"
,
"couponMoney"
:
22
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
null
,
"couponTotal"
:
3
,
"lastTotal"
:
3
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32,26"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-24 00:00:00"
,
"useEndTime"
:
"2023-06-21 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
null
,
"couponStatus"
:
false
,
"isDel"
:
false
,
"preferentialLimit"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 17:00:06"
,
"updateTime"
:
null
,
"fileUrl"
:
null
id
:
10000153
,
couponName
:
'列表优惠券测试小嗯嗯'
,
couponMoney
:
22
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
null
,
couponTotal
:
3
,
lastTotal
:
3
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32,26'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-24 00:00:00'
,
useEndTime
:
'2023-06-21 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
null
,
couponStatus
:
false
,
isDel
:
false
,
preferentialLimit
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 17:00:06'
,
updateTime
:
null
,
fileUrl
:
null
,
},
{
"id"
:
10000154
,
"couponName"
:
"列表优惠券测试小嗯嗯"
,
"couponMoney"
:
22
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
1
,
"couponTotal"
:
33
,
"lastTotal"
:
33
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-24 00:00:00"
,
"useEndTime"
:
"2023-06-21 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
1
,
"couponStatus"
:
false
,
"isDel"
:
false
,
"preferentialLimit"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 17:00:06"
,
"updateTime"
:
null
,
"fileUrl"
:
null
id
:
10000154
,
couponName
:
'列表优惠券测试小嗯嗯'
,
couponMoney
:
22
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
1
,
couponTotal
:
33
,
lastTotal
:
33
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-24 00:00:00'
,
useEndTime
:
'2023-06-21 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
1
,
couponStatus
:
false
,
isDel
:
false
,
preferentialLimit
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 17:00:06'
,
updateTime
:
null
,
fileUrl
:
null
,
},
{
"id"
:
10000152
,
"couponName"
:
"444"
,
"couponMoney"
:
444
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
2
,
"couponTotal"
:
444
,
"lastTotal"
:
444
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-24 00:00:00"
,
"useEndTime"
:
"2023-06-22 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
2
,
"userTag"
:
1
,
"couponStatus"
:
false
,
"isDel"
:
false
,
"preferentialLimit"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 16:57:44"
,
"updateTime"
:
null
,
"fileUrl"
:
null
id
:
10000152
,
couponName
:
'444'
,
couponMoney
:
444
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
2
,
couponTotal
:
444
,
lastTotal
:
444
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-24 00:00:00'
,
useEndTime
:
'2023-06-22 23:59:59'
,
couponDay
:
null
,
getType
:
2
,
userTag
:
1
,
couponStatus
:
false
,
isDel
:
false
,
preferentialLimit
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 16:57:44'
,
updateTime
:
null
,
fileUrl
:
null
,
},
{
"id"
:
10000151
,
"couponName"
:
"iii"
,
"couponMoney"
:
12
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
2
,
"couponTotal"
:
12
,
"lastTotal"
:
12
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-24 00:00:00"
,
"useEndTime"
:
"2023-06-20 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
1
,
"userTag"
:
null
,
"couponStatus"
:
false
,
"isDel"
:
false
,
"preferentialLimit"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 16:53:16"
,
"updateTime"
:
null
,
"fileUrl"
:
null
id
:
10000151
,
couponName
:
'iii'
,
couponMoney
:
12
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
2
,
couponTotal
:
12
,
lastTotal
:
12
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-24 00:00:00'
,
useEndTime
:
'2023-06-20 23:59:59'
,
couponDay
:
null
,
getType
:
1
,
userTag
:
null
,
couponStatus
:
false
,
isDel
:
false
,
preferentialLimit
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 16:53:16'
,
updateTime
:
null
,
fileUrl
:
null
,
},
{
"id"
:
10000150
,
"couponName"
:
"333"
,
"couponMoney"
:
33
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
2
,
"couponTotal"
:
33
,
"lastTotal"
:
33
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32,31"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-24 00:00:00"
,
"useEndTime"
:
"2023-06-20 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
2
,
"userTag"
:
1
,
"couponStatus"
:
false
,
"isDel"
:
false
,
"preferentialLimit"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 16:46:32"
,
"updateTime"
:
null
,
"fileUrl"
:
null
id
:
10000150
,
couponName
:
'333'
,
couponMoney
:
33
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
2
,
couponTotal
:
33
,
lastTotal
:
33
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32,31'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-24 00:00:00'
,
useEndTime
:
'2023-06-20 23:59:59'
,
couponDay
:
null
,
getType
:
2
,
userTag
:
1
,
couponStatus
:
false
,
isDel
:
false
,
preferentialLimit
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 16:46:32'
,
updateTime
:
null
,
fileUrl
:
null
,
},
{
"id"
:
10000148
,
"couponName"
:
"裂变优惠券测试"
,
"couponMoney"
:
1000
,
"couponDiscount"
:
9
,
"isLimited"
:
true
,
"restrictedAccess"
:
null
,
"couponTotal"
:
3
,
"lastTotal"
:
3
,
"couponType"
:
1
,
"useType"
:
2
,
"minPrice"
:
4000
,
"primaryKey"
:
"31"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-04-23 00:00:00"
,
"useEndTime"
:
"2023-04-30 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
null
,
"couponStatus"
:
false
,
"isDel"
:
false
,
"preferentialLimit"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-04-23 16:10:18"
,
"updateTime"
:
null
,
"fileUrl"
:
null
}
])
id
:
10000148
,
couponName
:
'裂变优惠券测试'
,
couponMoney
:
1000
,
couponDiscount
:
9
,
isLimited
:
true
,
restrictedAccess
:
null
,
couponTotal
:
3
,
lastTotal
:
3
,
couponType
:
1
,
useType
:
2
,
minPrice
:
4000
,
primaryKey
:
'31'
,
isFixedTime
:
0
,
useStartTime
:
'2023-04-23 00:00:00'
,
useEndTime
:
'2023-04-30 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
null
,
couponStatus
:
false
,
isDel
:
false
,
preferentialLimit
:
null
,
verificationType
:
false
,
createTime
:
'2023-04-23 16:10:18'
,
updateTime
:
null
,
fileUrl
:
null
,
}
,
])
;
const
res
=
await
CouponManageAPI
.
CouponPageList
({
useType
,
pageNo
:
pagination
.
current
,
...
...
@@ -342,7 +342,7 @@ export default function CouponList () {
...
value
,
...
query
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
const
{
list
,
pageNo
,
totalCount
,
pageSize
,
totalPage
}
=
res
.
result
;
// 解构
// console.log("getTableList --->", list);
setPagination
({
...
...
@@ -388,14 +388,14 @@ export default function CouponList () {
// 结束优惠券
const
handleEnd
=
(
record
:
TableType
[
0
])
=>
{
confirm
({
title
:
"提示"
,
content
:
"确认结束后,将停止发放该券,已领的优惠券可继续使用"
,
title
:
'提示'
,
content
:
'确认结束后,将停止发放该券,已领的优惠券可继续使用'
,
onOk
:
async
()
=>
{
const
res
=
await
CouponManageAPI
.
CouponShutDown
({
id
:
record
.
id
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
message
.
success
(
"操作成功"
).
then
();
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
).
then
();
paginationChange
(
pagination
.
current
,
pagination
.
pageSize
);
}
// console.log("删除成功 --->", record);
...
...
@@ -414,16 +414,16 @@ export default function CouponList () {
const
handleAdd
=
(
record
?:
TableType
[
0
])
=>
{
if
(
record
?.
id
)
{
history
({
pathname
:
"/couponManage/couponList/detail"
,
pathname
:
'/couponManage/couponList/detail'
,
search
:
`id=
${
record
?.
id
}
&
type
=
$
{
useType
}
`,
})
})
;
// history.push({
// pathname: "/couponManage/couponList/detail",
// search: `
id
=
$
{
record
?.
id
}
&
type
=
$
{
useType
}
`,
// });
} else {
history({
pathname:
"/couponManage/couponList/detail"
,
pathname:
'/couponManage/couponList/detail'
,
search: `
type
=
$
{
useType
}
`,
});
// history.push({
...
...
@@ -436,25 +436,24 @@ export default function CouponList () {
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{
title:
"优惠券ID"
,
dataIndex:
"id"
,
align:
"center"
,
title:
'优惠券ID'
,
dataIndex:
'id'
,
align:
'center'
,
},
{
title:
"优惠券名称"
,
dataIndex:
"couponName"
,
align:
"center"
,
title:
'优惠券名称'
,
dataIndex:
'couponName'
,
align:
'center'
,
},
{
title:
"满减规则"
,
align:
"center"
,
title:
'满减规则'
,
align:
'center'
,
render: (value, record) => {
if (record.couponType === 1)
return `
$
{
record
.
couponDiscount
}
折
$
{
couponType
.
find
((
i
)
=>
i
.
value
===
record
.
couponType
)?.
label
}
`;
if (record.couponType === 2)
return `
满
$
{
record
.
minPrice
}
元减
$
{
record
.
couponMoney
}
元
`;
if (record.couponType === 2) return `
满
$
{
record
.
minPrice
}
元减
$
{
record
.
couponMoney
}
元
`;
if (record.couponType === 3)
return `
$
{
record
.
couponMoney
}
元
$
{
couponType
.
find
((
i
)
=>
i
.
value
===
record
.
couponType
)?.
label
...
...
@@ -462,44 +461,39 @@ export default function CouponList () {
},
},
{
title:
"有效期"
,
align:
"center"
,
title:
'有效期'
,
align:
'center'
,
width: 280,
render: (value, record) => {
if (record.isFixedTime === 0)
return `
$
{
record
.
useStartTime
}
至
$
{
record
.
useEndTime
}
`;
if (record.isFixedTime === 1)
return `
领取成功后
$
{
record
.
couponDay
}
天内可用
`;
if (record.isFixedTime === 2)
return `
领取成功后次日
$
{
record
.
couponDay
}
天内可用
`;
if (record.isFixedTime === 0) return `
$
{
record
.
useStartTime
}
至
$
{
record
.
useEndTime
}
`;
if (record.isFixedTime === 1) return `
领取成功后
$
{
record
.
couponDay
}
天内可用
`;
if (record.isFixedTime === 2) return `
领取成功后次日
$
{
record
.
couponDay
}
天内可用
`;
},
},
{
title:
"状态"
,
align:
"center"
,
title:
'状态'
,
align:
'center'
,
render: (value, record) => {
if (!record.couponStatus) return
"已结束"
;
if (record.couponDay) return
"领取中"
;
if (!record.couponStatus) return
'已结束'
;
if (record.couponDay) return
'领取中'
;
// const after = moment(record.useStartTime).isAfter(moment());
const before = moment(record.useEndTime).isBefore(moment());
// if (after) return "未开始";
if (before) return
"已过期"
;
return
"领取中"
;
if (before) return
'已过期'
;
return
'领取中'
;
},
},
{
title:
"限领"
,
dataIndex:
"restrictedAccess"
,
align:
"center"
,
title:
'限领'
,
dataIndex:
'restrictedAccess'
,
align:
'center'
,
},
{
title:
"剩余/发行量"
,
dataIndex:
"proportion"
,
align:
"center"
,
title:
'剩余/发行量'
,
dataIndex:
'proportion'
,
align:
'center'
,
render: (value, record, index) =>
record.isLimited
? `
$
{
record
.
lastTotal
}
/${record.couponTotal}
`
:
"不限量"
,
record.isLimited ? `
$
{
record
.
lastTotal
}
/${record.couponTotal}` : '不限量'
,
},
// {
// title: "使用量",
...
...
@@ -511,31 +505,25 @@ export default function CouponList () {
// : "不限量",
// },
{
title
:
"创建时间"
,
dataIndex
:
"createTime"
,
align
:
"center"
,
title
:
'创建时间'
,
dataIndex
:
'createTime'
,
align
:
'center'
,
},
{
title
:
"操作"
,
align
:
"center"
,
fixed
:
"right"
,
width
:
"180px"
,
title
:
'操作'
,
align
:
'center'
,
fixed
:
'right'
,
width
:
'180px'
,
render
:
(
value
,
record
,
index
)
=>
{
const
disabled
=
moment
(
record
.
useEndTime
).
isBefore
(
moment
())
||
record
.
isDel
||
!
record
.
couponStatus
;
moment
(
record
.
useEndTime
).
isBefore
(
moment
())
||
record
.
isDel
||
!
record
.
couponStatus
;
return
(
<
div
className=
"table-body-action"
>
<
Button
type=
"link"
onClick=
{
()
=>
handleAdd
(
record
)
}
disabled=
{
!
isLookCouponBtn
}
>
<
div
className=
'table-body-action'
>
<
Button
type=
'link'
onClick=
{
()
=>
handleAdd
(
record
)
}
disabled=
{
!
isLookCouponBtn
}
>
查看
</
Button
>
<
Button
type=
"link"
type=
'link'
onClick=
{
()
=>
{
setRecordData
(
JSON
.
parse
(
JSON
.
stringify
(
record
)));
setIncreaseVisible
(
true
);
...
...
@@ -545,7 +533,7 @@ export default function CouponList () {
增发
</
Button
>
<
Button
type=
"link"
type=
'link'
onClick=
{
()
=>
{
setRecordData
(
JSON
.
parse
(
JSON
.
stringify
(
record
)));
setDataVisible
(
true
);
...
...
@@ -555,7 +543,7 @@ export default function CouponList () {
数据
</
Button
>
<
Button
type=
"link"
type=
'link'
onClick=
{
()
=>
handleEnd
(
record
)
}
disabled=
{
disabled
||
!
isEndCouponBtn
}
>
...
...
@@ -577,29 +565,29 @@ export default function CouponList () {
<
SearchView
search=
{
[
{
label
:
"规则状态"
,
name
:
"state"
,
type
:
"select"
,
placeholder
:
"请选择规则状态"
,
label
:
'规则状态'
,
name
:
'state'
,
type
:
'select'
,
placeholder
:
'请选择规则状态'
,
options
:
stateOptions
,
},
{
label
:
"生效时间"
,
name
:
"effectTime"
,
type
:
"rangePicker"
,
placeholder
:
"请选择生效时间"
,
label
:
'生效时间'
,
name
:
'effectTime'
,
type
:
'rangePicker'
,
placeholder
:
'请选择生效时间'
,
},
{
label
:
"优惠券ID"
,
name
:
"couponId"
,
type
:
"input"
,
placeholder
:
"请输入优惠券ID"
,
label
:
'优惠券ID'
,
name
:
'couponId'
,
type
:
'input'
,
placeholder
:
'请输入优惠券ID'
,
},
{
label
:
"优惠券名称"
,
name
:
"couponName"
,
type
:
"input"
,
placeholder
:
"请输入优惠券名称"
,
label
:
'优惠券名称'
,
name
:
'couponName'
,
type
:
'input'
,
placeholder
:
'请输入优惠券名称'
,
},
]
}
searchData=
{
onFinish
}
...
...
@@ -607,7 +595,7 @@ export default function CouponList () {
<>
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
"primary"
type=
'primary'
onClick=
{
()
=>
{
handleAdd
();
}
}
...
...
@@ -615,10 +603,10 @@ export default function CouponList () {
>
创建品牌券
</
Button
>
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
"primary"
disabled
>
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
'primary'
disabled
>
创建商品券
</
Button
>
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
"primary"
disabled
>
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
'primary'
disabled
>
创建店铺券
</
Button
>
</>
...
...
@@ -630,19 +618,19 @@ export default function CouponList () {
value=
{
useType
}
options=
{
[
//
{
label
:
"VIP券"
,
value
:
1
},
{
label
:
"品牌优惠券"
,
value
:
2
},
{
label
:
"商品优惠券"
,
value
:
3
,
disabled
:
true
},
{
label
:
"店铺优惠券"
,
value
:
4
,
disabled
:
true
},
{
label
:
"数据概览"
,
value
:
5
,
disabled
:
true
},
{
label
:
'品牌优惠券'
,
value
:
2
},
{
label
:
'商品优惠券'
,
value
:
3
,
disabled
:
true
},
{
label
:
'店铺优惠券'
,
value
:
4
,
disabled
:
true
},
{
label
:
'数据概览'
,
value
:
5
,
disabled
:
true
},
]
}
optionType=
"button"
style=
{
{
marginBottom
:
"10px"
}
}
optionType=
'button'
style=
{
{
marginBottom
:
'10px'
}
}
/>
<
Table
size=
"small"
size=
'small'
dataSource=
{
tableData
}
columns=
{
columns
}
rowKey=
"id"
rowKey=
'id'
scroll=
{
{
x
:
1500
}
}
bordered
pagination=
{
{
...
...
@@ -651,25 +639,23 @@ export default function CouponList () {
current
:
pagination
.
current
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
/>
</
TableBox
>
<
IncreaseModal
open=
{
increaseVisible
}
title=
"增发优惠券"
title=
'增发优惠券'
data=
{
recordData
}
closed=
{
handleCloseAll
}
/>
<
DataModal
open=
{
dataVisible
}
title=
"优惠券使用数据"
title=
'优惠券使用数据'
data=
{
recordData
}
closed=
{
handleCloseAll
}
/>
</>
);
}
;
}
src/pages/couponManage/splitCouponList/addOrEditOrDetail/components/baseInfo/index.tsx
浏览文件 @
a38d7f4f
import
{
FC
,
forwardRef
,
useImperativeHandle
}
from
"react"
;
import
"./index.scss"
;
import
{
Form
,
Input
}
from
"antd"
;
import
{
baseInfoType
}
from
"~/api/interface/couponManage"
;
import
{
FC
,
forwardRef
,
useImperativeHandle
}
from
'react'
;
import
'./index.scss'
;
import
{
Form
,
Input
}
from
'antd'
;
import
{
baseInfoType
}
from
'~/api/interface/couponManage'
;
interface
selfPops
{
ref
:
any
;
...
...
@@ -16,9 +16,9 @@ const BaseInfo: FC<selfPops> = forwardRef(({ isDetail }, ref) => {
}));
return
(
<
div
className=
"split-coupon-base-info"
>
<
div
className=
"title"
>
基本信息
</
div
>
<
div
className=
"base-info-form"
>
<
div
className=
'split-coupon-base-info'
>
<
div
className=
'title'
>
基本信息
</
div
>
<
div
className=
'base-info-form'
>
<
Form
labelCol=
{
{
span
:
2
}
}
wrapperCol=
{
{
span
:
5
}
}
...
...
@@ -26,11 +26,11 @@ const BaseInfo: FC<selfPops> = forwardRef(({ isDetail }, ref) => {
disabled=
{
isDetail
}
>
<
Form
.
Item
label=
"优惠券名称"
name=
"couponName"
rules=
{
[{
required
:
true
,
message
:
"请输入优惠券名称"
}]
}
label=
'优惠券名称'
name=
'couponName'
rules=
{
[{
required
:
true
,
message
:
'请输入优惠券名称'
}]
}
>
<
Input
placeholder=
"请输入优惠券名称"
maxLength=
{
10
}
/>
<
Input
placeholder=
'请输入优惠券名称'
maxLength=
{
10
}
/>
</
Form
.
Item
>
</
Form
>
</
div
>
...
...
src/pages/couponManage/splitCouponList/addOrEditOrDetail/components/shareCouponInfo/index.tsx
浏览文件 @
a38d7f4f
import
{
FC
,
forwardRef
,
useImperativeHandle
,
useState
}
from
"react"
;
import
{
DatePicker
,
Form
,
Input
,
Radio
,
Select
}
from
"antd"
;
import
dayjs
from
"dayjs"
;
import
{
RangePickerProps
}
from
"antd/es/date-picker"
;
import
{
shareCouponType
}
from
"~/api/interface/couponManage"
;
import
{
MakeItemEntity
}
from
"~/api/interface/makeManage"
;
import
{
splitCouponType
,
splitCouponUseType
}
from
"~/utils/dictionary"
;
import
{
FC
,
forwardRef
,
useImperativeHandle
,
useState
}
from
'react'
;
import
{
DatePicker
,
Form
,
Input
,
Radio
,
Select
}
from
'antd'
;
import
dayjs
from
'dayjs'
;
import
{
RangePickerProps
}
from
'antd/es/date-picker'
;
import
{
shareCouponType
}
from
'~/api/interface/couponManage'
;
import
{
MakeItemEntity
}
from
'~/api/interface/makeManage'
;
import
{
splitCouponType
,
splitCouponUseType
}
from
'~/utils/dictionary'
;
interface
selfProps
{
ref
:
any
;
...
...
@@ -12,8 +12,7 @@ interface selfProps {
isDetail
:
boolean
;
}
const
ShareCouponInfo
:
FC
<
selfProps
>
=
forwardRef
(
({
makeList
,
isDetail
},
ref
)
=>
{
const
ShareCouponInfo
:
FC
<
selfProps
>
=
forwardRef
(({
makeList
,
isDetail
},
ref
)
=>
{
const
[
shareCouponForm
]
=
Form
.
useForm
<
shareCouponType
>
();
// 优惠券类型
const
[
couponType
,
setCouponType
]
=
useState
<
number
>
(
3
);
...
...
@@ -25,37 +24,34 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
// 门槛类型选择
const
couponTypeChange
=
(
e
:
any
)
=>
{
shareCouponForm
.
setFieldValue
(
"verificationType"
,
e
.
target
.
value
===
3
?
0
:
undefined
);
shareCouponForm
.
setFieldValue
(
'verificationType'
,
e
.
target
.
value
===
3
?
0
:
undefined
);
setCouponType
(
e
.
target
.
value
);
shareCouponForm
.
setFieldValue
(
"minPrice"
,
undefined
);
shareCouponForm
.
setFieldValue
(
'minPrice'
,
undefined
);
};
// 表单规则
// 钱-基本校验
const
moneyValidator
=
(
value
:
string
)
=>
{
if
(
Number
(
value
)
<
0
)
{
return
Promise
.
reject
(
new
Error
(
"金额不能为负值!"
));
return
Promise
.
reject
(
new
Error
(
'金额不能为负值!'
));
}
if
(
Number
(
value
)
>
99999.99
)
{
return
Promise
.
reject
(
new
Error
(
"金额不能大于99999.99!"
));
return
Promise
.
reject
(
new
Error
(
'金额不能大于99999.99!'
));
}
if
(
Number
(
value
)
<
0
)
{
return
Promise
.
reject
(
new
Error
(
"金额不能为负值!"
));
return
Promise
.
reject
(
new
Error
(
'金额不能为负值!'
));
}
const
reg
=
/^0
\.([
1-9
]
|
\d[
1-9
])
$|^
[
0-9
]\d{0,8}\.\d{0,2}
$|^
[
0-9
]\d{0,8}
$/
;
if
(
!
reg
.
test
(
value
)
&&
value
)
{
return
Promise
.
reject
(
new
Error
(
"金额应为整数,小数且小数保留后两位"
));
return
Promise
.
reject
(
new
Error
(
'金额应为整数,小数且小数保留后两位'
));
}
return
Promise
.
resolve
();
};
// 优惠金额是否超标
const
isOverstep
=
()
=>
{
const
minPrice
=
shareCouponForm
.
getFieldValue
(
"minPrice"
);
const
discount
=
shareCouponForm
.
getFieldValue
(
"couponDiscount"
);
const
couponMoney
=
shareCouponForm
.
getFieldValue
(
"couponMoney"
);
const
minPrice
=
shareCouponForm
.
getFieldValue
(
'minPrice'
);
const
discount
=
shareCouponForm
.
getFieldValue
(
'couponDiscount'
);
const
couponMoney
=
shareCouponForm
.
getFieldValue
(
'couponMoney'
);
return
(
minPrice
&&
discount
&&
...
...
@@ -65,50 +61,48 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
};
const
couponMoneyValidator
=
async
(
rule
:
any
,
value
:
string
)
=>
{
if
(
!
value
)
{
return
Promise
.
reject
(
new
Error
(
"请输入优惠金额"
));
return
Promise
.
reject
(
new
Error
(
'请输入优惠金额'
));
}
const
res
:
any
=
await
moneyValidator
(
value
);
if
(
res
)
{
return
Promise
.
reject
(
res
);
}
const
minPrice
=
shareCouponForm
.
getFieldValue
(
"minPrice"
);
const
minPrice
=
shareCouponForm
.
getFieldValue
(
'minPrice'
);
if
(
couponType
===
1
)
{
if
(
isOverstep
())
{
return
Promise
.
reject
(
new
Error
(
"优惠金额超出最高优惠金额,请重新输入"
)
);
return
Promise
.
reject
(
new
Error
(
'优惠金额超出最高优惠金额,请重新输入'
));
}
if
(
shareCouponForm
.
getFieldValue
(
"couponDiscount"
)
&&
!
shareCouponForm
.
isFieldValidating
(
"couponDiscount"
)
shareCouponForm
.
getFieldValue
(
'couponDiscount'
)
&&
!
shareCouponForm
.
isFieldValidating
(
'couponDiscount'
)
)
{
await
shareCouponForm
.
validateFields
([
"couponDiscount"
]);
await
shareCouponForm
.
validateFields
([
'couponDiscount'
]);
}
}
if
(
couponType
!==
3
)
{
if
(
minPrice
&&
Number
(
minPrice
)
<
Number
(
value
))
{
return
Promise
.
reject
(
new
Error
(
"优惠金额应小于减免券金额"
));
return
Promise
.
reject
(
new
Error
(
'优惠金额应小于减免券金额'
));
}
if
(
minPrice
&&
!
shareCouponForm
.
isFieldValidating
(
"minPrice"
))
{
await
shareCouponForm
.
validateFields
([
"minPrice"
]);
if
(
minPrice
&&
!
shareCouponForm
.
isFieldValidating
(
'minPrice'
))
{
await
shareCouponForm
.
validateFields
([
'minPrice'
]);
}
}
return
Promise
.
resolve
();
};
const
minPriceValidator
=
async
(
rule
:
any
,
value
:
string
)
=>
{
if
(
!
value
)
{
return
Promise
.
reject
(
new
Error
(
"请输入满减金额"
));
return
Promise
.
reject
(
new
Error
(
'请输入满减金额'
));
}
const
res
:
any
=
await
moneyValidator
(
value
);
if
(
res
)
{
return
Promise
.
reject
(
res
);
}
const
couponMoney
=
shareCouponForm
.
getFieldValue
(
"couponMoney"
);
const
couponMoney
=
shareCouponForm
.
getFieldValue
(
'couponMoney'
);
if
(
couponMoney
&&
Number
(
couponMoney
)
>
Number
(
value
))
{
return
Promise
.
reject
(
new
Error
(
"满减金额应大于优惠金额!"
));
return
Promise
.
reject
(
new
Error
(
'满减金额应大于优惠金额!'
));
}
if
(
couponMoney
&&
!
shareCouponForm
.
isFieldValidating
(
"couponMoney"
))
{
shareCouponForm
.
validateFields
([
"couponMoney"
]).
then
().
catch
();
if
(
couponMoney
&&
!
shareCouponForm
.
isFieldValidating
(
'couponMoney'
))
{
shareCouponForm
.
validateFields
([
'couponMoney'
]).
then
().
catch
();
}
return
Promise
.
resolve
();
};
...
...
@@ -117,23 +111,23 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
return
Promise
.
reject
(
new
Error
(
`请输入折扣!`
));
}
if
(
Number
(
value
)
<=
0
)
{
return
Promise
.
reject
(
new
Error
(
"折扣不能小于等于0!"
));
return
Promise
.
reject
(
new
Error
(
'折扣不能小于等于0!'
));
}
if
(
Number
(
value
)
>=
10
)
{
return
Promise
.
reject
(
new
Error
(
"折扣应小于10"
));
return
Promise
.
reject
(
new
Error
(
'折扣应小于10'
));
}
const
reg
=
/^0
\.([
1-9
]
|
\d[
1-9
])
$|^
[
0-9
]\d{0,8}\.\d{0,2}
$|^
[
0-9
]\d{0,8}
$/
;
if
(
!
reg
.
test
(
value
))
{
return
Promise
.
reject
(
new
Error
(
"折扣应为整数,小数且小数保留后两位"
));
return
Promise
.
reject
(
new
Error
(
'折扣应为整数,小数且小数保留后两位'
));
}
if
(
isOverstep
())
{
return
Promise
.
reject
(
new
Error
(
"优惠金额超出最高优惠金额!"
));
return
Promise
.
reject
(
new
Error
(
'优惠金额超出最高优惠金额!'
));
}
if
(
shareCouponForm
.
getFieldValue
(
"couponMoney"
)
&&
!
shareCouponForm
.
isFieldValidating
(
"couponMoney"
)
shareCouponForm
.
getFieldValue
(
'couponMoney'
)
&&
!
shareCouponForm
.
isFieldValidating
(
'couponMoney'
)
)
{
shareCouponForm
.
validateFields
([
"couponMoney"
]).
then
().
catch
();
shareCouponForm
.
validateFields
([
'couponMoney'
]).
then
().
catch
();
}
return
Promise
.
resolve
();
};
...
...
@@ -141,7 +135,7 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
rule
:
any
,
value
:
string
,
callback
:
(
error
?:
string
)
=>
void
,
label
:
string
label
:
string
,
)
=>
{
if
(
!
value
)
{
return
Promise
.
reject
(
new
Error
(
`请输入
${
label
}
!`
));
...
...
@@ -151,12 +145,12 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
return
Promise
.
reject
(
new
Error
(
`
${
label
}
为正数!`
));
}
switch
(
label
)
{
case
"发行量"
:
case
'发行量'
:
if
(
Number
(
value
)
<
1
||
Number
(
value
)
>
100000
)
{
return
Promise
.
reject
(
new
Error
(
`
${
label
}
至少1张且不超过10万`
));
}
break
;
case
"限领数量"
:
case
'限领数量'
:
if
(
Number
(
value
)
>
5
)
{
return
Promise
.
reject
(
new
Error
(
`
${
label
}
限领数量最大为5`
));
}
...
...
@@ -165,14 +159,14 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
return
Promise
.
resolve
();
};
// 选择时间禁用
const
disabledDate
:
RangePickerProps
[
"disabledDate"
]
=
(
current
)
=>
{
const
disabledDate
:
RangePickerProps
[
'disabledDate'
]
=
(
current
)
=>
{
// Can not select days before today
return
current
&&
current
<
dayjs
().
subtract
(
1
,
"day"
);
return
current
&&
current
<
dayjs
().
subtract
(
1
,
'day'
);
};
return
(
<
div
className=
"share-coupon-info"
>
<
div
className=
"title"
>
分享者优惠券
</
div
>
<
div
className=
"share-coupon-form"
>
<
div
className=
'share-coupon-info'
>
<
div
className=
'title'
>
分享者优惠券
</
div
>
<
div
className=
'share-coupon-form'
>
<
Form
labelCol=
{
{
span
:
2
}
}
wrapperCol=
{
{
span
:
5
}
}
...
...
@@ -181,9 +175,9 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
disabled=
{
isDetail
}
>
<
Form
.
Item
label=
"券类型"
name=
"useType"
rules=
{
[{
required
:
true
,
message
:
"请选择券类型"
}]
}
label=
'券类型'
name=
'useType'
rules=
{
[{
required
:
true
,
message
:
'请选择券类型'
}]
}
>
<
Radio
.
Group
>
{
splitCouponUseType
.
map
((
v
)
=>
(
...
...
@@ -194,18 +188,16 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
"品牌"
name=
"primaryKey"
rules=
{
[{
required
:
true
,
message
:
"请选择品牌"
}]
}
label=
'品牌'
name=
'primaryKey'
rules=
{
[{
required
:
true
,
message
:
'请选择品牌'
}]
}
>
<
Select
placeholder=
"请选择品牌"
mode=
"multiple"
placeholder=
'请选择品牌'
mode=
'multiple'
maxTagCount=
{
50
}
filterOption=
{
(
input
,
option
)
=>
(
option
!
.
children
as
unknown
as
string
)
.
toLowerCase
()
.
includes
(
input
.
toLowerCase
())
(
option
!
.
children
as
unknown
as
string
).
toLowerCase
().
includes
(
input
.
toLowerCase
())
}
>
{
makeList
.
map
((
v
)
=>
(
...
...
@@ -216,15 +208,15 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
label=
"有效期"
name=
"time"
rules=
{
[{
required
:
true
,
message
:
"请选择有效期"
}]
}
label=
'有效期'
name=
'time'
rules=
{
[{
required
:
true
,
message
:
'请选择有效期'
}]
}
>
<
DatePicker
.
RangePicker
disabledDate=
{
disabledDate
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"优惠金额"
name=
"couponMoney"
label=
'优惠金额'
name=
'couponMoney'
rules=
{
[
{
required
:
true
,
...
...
@@ -232,12 +224,12 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
},
]
}
>
<
Input
placeholder=
"请输入优惠券金额"
suffix=
"元"
/>
<
Input
placeholder=
'请输入优惠券金额'
suffix=
'元'
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"使用门槛"
name=
"couponType"
rules=
{
[{
required
:
true
,
message
:
"请选择使用门槛"
}]
}
label=
'使用门槛'
name=
'couponType'
rules=
{
[{
required
:
true
,
message
:
'请选择使用门槛'
}]
}
>
<
Radio
.
Group
onChange=
{
couponTypeChange
}
>
{
splitCouponType
.
map
((
v
)
=>
(
...
...
@@ -249,9 +241,9 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
</
Form
.
Item
>
{
couponType
!==
3
&&
(
<
Form
.
Item
label=
"满"
style=
{
{
marginLeft
:
"30px"
}
}
name=
"minPrice"
label=
'满'
style=
{
{
marginLeft
:
'30px'
}
}
name=
'minPrice'
rules=
{
[
{
required
:
true
,
...
...
@@ -259,15 +251,15 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
},
]
}
>
<
Input
placeholder=
"请输入金额"
suffix=
"元"
/>
<
Input
placeholder=
'请输入金额'
suffix=
'元'
/>
</
Form
.
Item
>
)
}
{
couponType
===
1
&&
(
<>
<
Form
.
Item
label=
"打"
style=
{
{
marginLeft
:
"30px"
}
}
name=
"couponDiscount"
label=
'打'
style=
{
{
marginLeft
:
'30px'
}
}
name=
'couponDiscount'
rules=
{
[
{
required
:
true
,
...
...
@@ -275,7 +267,7 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
},
]
}
>
<
Input
placeholder=
"请输入折扣"
suffix=
"折"
/>
<
Input
placeholder=
'请输入折扣'
suffix=
'折'
/>
</
Form
.
Item
>
{
/* <Form.Item */
}
{
/* label="最多优惠" */
}
...
...
@@ -295,9 +287,9 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
)
}
{
couponType
===
3
&&
(
<
Form
.
Item
label=
"核销方式"
name=
"verificationType"
rules=
{
[{
required
:
true
,
message
:
"请选择核销方式"
}]
}
label=
'核销方式'
name=
'verificationType'
rules=
{
[{
required
:
true
,
message
:
'请选择核销方式'
}]
}
>
<
Radio
.
Group
>
<
Radio
value=
{
0
}
>
单次核销
</
Radio
>
...
...
@@ -307,17 +299,17 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
)
}
<
Form
.
Item
label=
"发行量"
name=
"couponTotal"
label=
'发行量'
name=
'couponTotal'
rules=
{
[
{
required
:
true
,
validator
:
(
rule
,
value
,
callback
)
=>
negativeNumberValidator
(
rule
,
value
,
callback
,
"发行量"
),
negativeNumberValidator
(
rule
,
value
,
callback
,
'发行量'
),
},
]
}
>
<
Input
placeholder=
"请输入发行量"
suffix=
"张"
/>
<
Input
placeholder=
'请输入发行量'
suffix=
'张'
/>
</
Form
.
Item
>
{
/* <Form.Item */
}
{
/* label="每人限领" */
}
...
...
@@ -333,23 +325,23 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
{
/* <Input placeholder="请输入限领数量" suffix="张" /> */
}
{
/* </Form.Item> */
}
<
Form
.
Item
label=
"分享人数"
name=
"peopleNumber"
label=
'分享人数'
name=
'peopleNumber'
rules=
{
[
{
required
:
true
,
message
:
"请选择分享人数"
,
message
:
'请选择分享人数'
,
},
]
}
>
<
Select
placeholder=
"请输入分享人数"
>
<
Select
placeholder=
'请输入分享人数'
>
<
Select
value=
{
2
}
>
2人
</
Select
>
<
Select
value=
{
3
}
>
3人
</
Select
>
<
Select
value=
{
5
}
>
5人
</
Select
>
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
label=
"被分享用户标签"
name=
"userTag"
>
<
Select
placeholder=
"请选择标签"
allowClear
>
<
Form
.
Item
label=
'被分享用户标签'
name=
'userTag'
>
<
Select
placeholder=
'请选择标签'
allowClear
>
<
Select
.
Option
value=
{
1
}
>
新人
</
Select
.
Option
>
<
Select
.
Option
value=
{
2
}
>
实名认证
</
Select
.
Option
>
<
Select
.
Option
value=
{
3
}
>
企业认证
</
Select
.
Option
>
...
...
@@ -359,7 +351,6 @@ const ShareCouponInfo: FC<selfProps> = forwardRef(
</
div
>
</
div
>
);
}
);
});
export
default
ShareCouponInfo
;
src/pages/couponManage/splitCouponList/addOrEditOrDetail/components/sharedCouponInfo/index.tsx
浏览文件 @
a38d7f4f
import
{
FC
,
forwardRef
,
useImperativeHandle
,
useState
}
from
"react"
;
import
{
Col
,
Form
,
Input
,
Radio
,
Row
,
Select
}
from
"antd"
;
import
{
MakeItemEntity
}
from
"~/api/interface/makeManage"
;
import
{
sharedCouponType
}
from
"~/api/interface/couponManage"
;
import
{
splitCouponType
,
splitCouponUseType
}
from
"~/utils/dictionary"
;
import
{
FC
,
forwardRef
,
useImperativeHandle
,
useState
}
from
'react'
;
import
{
Col
,
Form
,
Input
,
Radio
,
Row
,
Select
}
from
'antd'
;
import
{
MakeItemEntity
}
from
'~/api/interface/makeManage'
;
import
{
sharedCouponType
}
from
'~/api/interface/couponManage'
;
import
{
splitCouponType
,
splitCouponUseType
}
from
'~/utils/dictionary'
;
interface
selfProps
{
ref
:
any
;
...
...
@@ -24,51 +24,42 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
// 门槛类型选择
const
couponTypeChange
=
(
e
:
any
)
=>
{
sharedCouponForm
.
setFieldValue
(
"beSharedVerificationType"
,
e
.
target
.
value
===
3
?
0
:
undefined
'beSharedVerificationType'
,
e
.
target
.
value
===
3
?
0
:
undefined
,
);
sharedCouponForm
.
setFieldValue
(
"beSharedMinPrice"
,
undefined
);
sharedCouponForm
.
setFieldValue
(
'beSharedMinPrice'
,
undefined
);
setCouponType
(
e
.
target
.
value
);
};
// 获取被分享者最低发行量
const
getMinBeSharedCouponTotal
=
():
number
=>
{
const
shareCouponRefObj
=
shareCouponRef
.
current
;
const
couponTotal
=
shareCouponRefObj
.
getForm
()
.
getFieldValue
(
"couponTotal"
);
const
peopleNumber
=
shareCouponRefObj
.
getForm
()
.
getFieldValue
(
"peopleNumber"
);
return
(
(
couponTotal
&&
peopleNumber
&&
Number
(
couponTotal
)
*
Number
(
peopleNumber
)
*
1.5
)
||
0
);
const
couponTotal
=
shareCouponRefObj
.
getForm
().
getFieldValue
(
'couponTotal'
);
const
peopleNumber
=
shareCouponRefObj
.
getForm
().
getFieldValue
(
'peopleNumber'
);
return
(
couponTotal
&&
peopleNumber
&&
Number
(
couponTotal
)
*
Number
(
peopleNumber
)
*
1.5
)
||
0
;
};
// 表单规则
// 钱-基本校验
const
moneyValidator
=
(
value
:
string
)
=>
{
if
(
Number
(
value
)
<
0
)
{
return
Promise
.
reject
(
new
Error
(
"金额不能为负值!"
));
return
Promise
.
reject
(
new
Error
(
'金额不能为负值!'
));
}
if
(
Number
(
value
)
>
99999.99
)
{
return
Promise
.
reject
(
new
Error
(
"金额不能大于99999.99!"
));
return
Promise
.
reject
(
new
Error
(
'金额不能大于99999.99!'
));
}
if
(
Number
(
value
)
<
0
)
{
return
Promise
.
reject
(
new
Error
(
"金额不能为负值!"
));
return
Promise
.
reject
(
new
Error
(
'金额不能为负值!'
));
}
const
reg
=
/^0
\.([
1-9
]
|
\d[
1-9
])
$|^
[
0-9
]\d{0,8}\.\d{0,2}
$|^
[
0-9
]\d{0,8}
$/
;
if
(
!
reg
.
test
(
value
)
&&
value
)
{
return
Promise
.
reject
(
new
Error
(
"金额应为整数,小数且小数保留后两位"
));
return
Promise
.
reject
(
new
Error
(
'金额应为整数,小数且小数保留后两位'
));
}
return
Promise
.
resolve
();
};
// 优惠金额是否超标
const
isOverstep
=
()
=>
{
const
minPrice
=
sharedCouponForm
.
getFieldValue
(
"beSharedMinPrice"
);
const
discount
=
sharedCouponForm
.
getFieldValue
(
"beSharedCouponDiscount"
);
const
couponMoney
=
sharedCouponForm
.
getFieldValue
(
"beSharedCouponMoney"
);
const
minPrice
=
sharedCouponForm
.
getFieldValue
(
'beSharedMinPrice'
);
const
discount
=
sharedCouponForm
.
getFieldValue
(
'beSharedCouponDiscount'
);
const
couponMoney
=
sharedCouponForm
.
getFieldValue
(
'beSharedCouponMoney'
);
return
(
minPrice
&&
discount
&&
...
...
@@ -78,81 +69,73 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
};
const
couponMoneyValidator
=
async
(
rule
:
any
,
value
:
string
)
=>
{
if
(
!
value
)
{
return
Promise
.
reject
(
new
Error
(
"请输入优惠金额"
));
return
Promise
.
reject
(
new
Error
(
'请输入优惠金额'
));
}
const
res
:
any
=
await
moneyValidator
(
value
);
if
(
res
)
{
return
Promise
.
reject
(
res
);
}
const
minPrice
=
sharedCouponForm
.
getFieldValue
(
"beSharedMinPrice"
);
const
minPrice
=
sharedCouponForm
.
getFieldValue
(
'beSharedMinPrice'
);
if
(
couponType
===
1
)
{
if
(
isOverstep
())
{
return
Promise
.
reject
(
new
Error
(
"优惠金额超出最高优惠金额,请重新输入"
)
);
return
Promise
.
reject
(
new
Error
(
'优惠金额超出最高优惠金额,请重新输入'
));
}
if
(
sharedCouponForm
.
getFieldValue
(
"beSharedCouponDiscount"
)
&&
!
sharedCouponForm
.
isFieldValidating
(
"beSharedCouponDiscount"
)
sharedCouponForm
.
getFieldValue
(
'beSharedCouponDiscount'
)
&&
!
sharedCouponForm
.
isFieldValidating
(
'beSharedCouponDiscount'
)
)
{
await
sharedCouponForm
.
validateFields
([
"beSharedCouponDiscount"
]);
await
sharedCouponForm
.
validateFields
([
'beSharedCouponDiscount'
]);
}
}
if
(
couponType
!==
3
)
{
if
(
minPrice
&&
Number
(
minPrice
)
<
Number
(
value
))
{
return
Promise
.
reject
(
new
Error
(
"优惠金额应小于减免券金额"
));
return
Promise
.
reject
(
new
Error
(
'优惠金额应小于减免券金额'
));
}
if
(
minPrice
&&
!
sharedCouponForm
.
isFieldValidating
(
"beSharedMinPrice"
)
)
{
await
sharedCouponForm
.
validateFields
([
"minPrice"
]);
if
(
minPrice
&&
!
sharedCouponForm
.
isFieldValidating
(
'beSharedMinPrice'
))
{
await
sharedCouponForm
.
validateFields
([
'minPrice'
]);
}
}
return
Promise
.
resolve
();
};
const
minPriceValidator
=
async
(
rule
:
any
,
value
:
string
)
=>
{
if
(
!
value
)
{
return
Promise
.
reject
(
new
Error
(
"请输入满减金额"
));
return
Promise
.
reject
(
new
Error
(
'请输入满减金额'
));
}
const
res
:
any
=
await
moneyValidator
(
value
);
if
(
res
)
{
return
Promise
.
reject
(
res
);
}
const
couponMoney
=
sharedCouponForm
.
getFieldValue
(
"beSharedCouponMoney"
);
const
couponMoney
=
sharedCouponForm
.
getFieldValue
(
'beSharedCouponMoney'
);
if
(
couponMoney
&&
Number
(
couponMoney
)
>
Number
(
value
))
{
return
Promise
.
reject
(
new
Error
(
"满减金额应大于优惠金额!"
));
return
Promise
.
reject
(
new
Error
(
'满减金额应大于优惠金额!'
));
}
if
(
couponMoney
&&
!
sharedCouponForm
.
isFieldValidating
(
"beSharedCouponMoney"
)
)
{
sharedCouponForm
.
validateFields
([
"couponMoney"
]).
then
().
catch
();
if
(
couponMoney
&&
!
sharedCouponForm
.
isFieldValidating
(
'beSharedCouponMoney'
))
{
sharedCouponForm
.
validateFields
([
'couponMoney'
]).
then
().
catch
();
}
return
Promise
.
resolve
();
};
const
discountValidator
=
(
rule
:
any
,
value
:
string
)
=>
{
if
(
value
===
""
)
{
if
(
value
===
''
)
{
return
Promise
.
reject
(
new
Error
(
`请输入折扣!`
));
}
if
(
Number
(
value
)
<=
0
)
{
return
Promise
.
reject
(
new
Error
(
"折扣不能小于等于0!"
));
return
Promise
.
reject
(
new
Error
(
'折扣不能小于等于0!'
));
}
if
(
Number
(
value
)
>=
10
)
{
return
Promise
.
reject
(
new
Error
(
"折扣应小于10"
));
return
Promise
.
reject
(
new
Error
(
'折扣应小于10'
));
}
const
reg
=
/^0
\.([
1-9
]
|
\d[
1-9
])
$|^
[
0-9
]\d{0,8}\.\d{0,2}
$|^
[
0-9
]\d{0,8}
$/
;
if
(
!
reg
.
test
(
value
))
{
return
Promise
.
reject
(
new
Error
(
"折扣应为整数,小数且小数保留后两位"
));
return
Promise
.
reject
(
new
Error
(
'折扣应为整数,小数且小数保留后两位'
));
}
if
(
isOverstep
())
{
return
Promise
.
reject
(
new
Error
(
"优惠金额超出最高优惠金额!"
));
return
Promise
.
reject
(
new
Error
(
'优惠金额超出最高优惠金额!'
));
}
if
(
sharedCouponForm
.
getFieldValue
(
"beSharedCouponMoney"
)
&&
!
sharedCouponForm
.
isFieldValidating
(
"beSharedCouponMoney"
)
sharedCouponForm
.
getFieldValue
(
'beSharedCouponMoney'
)
&&
!
sharedCouponForm
.
isFieldValidating
(
'beSharedCouponMoney'
)
)
{
sharedCouponForm
.
validateFields
([
"beSharedCouponMoney"
]).
then
().
catch
();
sharedCouponForm
.
validateFields
([
'beSharedCouponMoney'
]).
then
().
catch
();
}
return
Promise
.
resolve
();
};
...
...
@@ -165,16 +148,14 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
return
Promise
.
reject
(
new
Error
(
`被分享者优惠券发行量为正数!`
));
}
if
(
Number
(
value
)
<
getMinBeSharedCouponTotal
())
{
return
Promise
.
reject
(
new
Error
(
"被分享者券发行量大于等于分享者券发行量*分享人数*1.5"
)
);
return
Promise
.
reject
(
new
Error
(
'被分享者券发行量大于等于分享者券发行量*分享人数*1.5'
));
}
return
Promise
.
resolve
();
};
return
(
<
div
className=
"shared-coupon-info"
>
<
div
className=
"title"
>
被分享者优惠券
</
div
>
<
div
className=
"shared-coupon-form"
>
<
div
className=
'shared-coupon-info'
>
<
div
className=
'title'
>
被分享者优惠券
</
div
>
<
div
className=
'shared-coupon-form'
>
<
Form
labelCol=
{
{
span
:
2
}
}
wrapperCol=
{
{
span
:
5
}
}
...
...
@@ -187,9 +168,9 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
disabled=
{
isDetail
}
>
<
Form
.
Item
label=
"券类型"
name=
"beSharedUseType"
rules=
{
[{
required
:
true
,
message
:
"请选择券类型"
}]
}
label=
'券类型'
name=
'beSharedUseType'
rules=
{
[{
required
:
true
,
message
:
'请选择券类型'
}]
}
>
<
Radio
.
Group
>
{
splitCouponUseType
.
map
((
v
)
=>
(
...
...
@@ -200,13 +181,13 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
</
Radio
.
Group
>
</
Form
.
Item
>
<
Form
.
Item
label=
"品牌"
name=
"beSharedPrimaryKey"
rules=
{
[{
required
:
true
,
message
:
"请选择品牌"
}]
}
label=
'品牌'
name=
'beSharedPrimaryKey'
rules=
{
[{
required
:
true
,
message
:
'请选择品牌'
}]
}
>
<
Select
placeholder=
"请选择品牌"
mode=
"multiple"
placeholder=
'请选择品牌'
mode=
'multiple'
maxTagCount=
{
50
}
filterOption=
{
(
input
,
option
)
=>
(
option
!
.
children
as
unknown
as
string
)
...
...
@@ -222,8 +203,8 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
label=
"优惠金额"
name=
"beSharedCouponMoney"
label=
'优惠金额'
name=
'beSharedCouponMoney'
rules=
{
[
{
required
:
true
,
...
...
@@ -231,12 +212,12 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
},
]
}
>
<
Input
placeholder=
"请输入优惠券金额"
suffix=
"元"
/>
<
Input
placeholder=
'请输入优惠券金额'
suffix=
'元'
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"使用门槛"
name=
"beSharedCouponType"
rules=
{
[{
required
:
true
,
message
:
"请选择使用门槛"
}]
}
label=
'使用门槛'
name=
'beSharedCouponType'
rules=
{
[{
required
:
true
,
message
:
'请选择使用门槛'
}]
}
>
<
Radio
.
Group
onChange=
{
couponTypeChange
}
>
{
splitCouponType
.
map
((
v
)
=>
(
...
...
@@ -248,9 +229,9 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
</
Form
.
Item
>
{
couponType
!==
3
&&
(
<
Form
.
Item
label=
"满"
style=
{
{
marginLeft
:
"30px"
}
}
name=
"beSharedMinPrice"
label=
'满'
style=
{
{
marginLeft
:
'30px'
}
}
name=
'beSharedMinPrice'
rules=
{
[
{
required
:
true
,
...
...
@@ -258,14 +239,14 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
},
]
}
>
<
Input
placeholder=
"请输入金额"
suffix=
"元"
/>
<
Input
placeholder=
'请输入金额'
suffix=
'元'
/>
</
Form
.
Item
>
)
}
{
couponType
===
1
&&
(
<
Form
.
Item
label=
"打"
style=
{
{
marginLeft
:
"30px"
}
}
name=
"beSharedCouponDiscount"
label=
'打'
style=
{
{
marginLeft
:
'30px'
}
}
name=
'beSharedCouponDiscount'
rules=
{
[
{
required
:
true
,
...
...
@@ -273,7 +254,7 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
},
]
}
>
<
Input
placeholder=
"请输入折扣"
suffix=
"折"
/>
<
Input
placeholder=
'请输入折扣'
suffix=
'折'
/>
</
Form
.
Item
>
)
}
{
/* <Form.Item */
}
...
...
@@ -292,9 +273,9 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
{
/* </Form.Item> */
}
{
couponType
===
3
&&
(
<
Form
.
Item
label=
"核销方式"
name=
"beSharedVerificationType"
rules=
{
[{
required
:
true
,
message
:
"请选择核销方式"
}]
}
label=
'核销方式'
name=
'beSharedVerificationType'
rules=
{
[{
required
:
true
,
message
:
'请选择核销方式'
}]
}
>
<
Radio
.
Group
>
<
Radio
value=
{
0
}
>
单次核销
</
Radio
>
...
...
@@ -304,8 +285,8 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
)
}
<
Form
.
Item
label=
"发行量"
name=
"beSharedCouponTotal"
label=
'发行量'
name=
'beSharedCouponTotal'
rules=
{
[
{
required
:
true
,
...
...
@@ -313,19 +294,19 @@ const SharedCouponInfo: FC<selfProps> = forwardRef(
},
]
}
>
<
Input
placeholder=
"请输入发行量"
suffix=
"张"
/>
<
Input
placeholder=
'请输入发行量'
suffix=
'张'
/>
</
Form
.
Item
>
<
Row
>
<
Col
span=
{
2
}
/>
<
Col
span=
{
22
}
style=
{
{
color
:
"#1677ff"
}
}
>
<
Col
span=
{
22
}
style=
{
{
color
:
'#1677ff'
}
}
>
被分享者券发行量大于等于分享者券发行量*分享人数*1.5
</
Col
>
</
Row
>
<
Form
.
Item
label=
"每人限领"
>
1张
</
Form
.
Item
>
<
Form
.
Item
label=
'每人限领'
>
1张
</
Form
.
Item
>
</
Form
>
</
div
>
</
div
>
);
}
}
,
);
export
default
SharedCouponInfo
;
src/pages/couponManage/splitCouponList/addOrEditOrDetail/index.scss
浏览文件 @
a38d7f4f
.add-or-edit-or-detail-wrap
{
.add-or-edit-or-detail-wrap
{
min-width
:
1200px
;
height
:
100%
;
position
:
relative
;
.add-or-edit-or-detail
{
.add-or-edit-or-detail
{
height
:
calc
(
100%
-
50px
);
overflow-y
:
auto
;
.split-coupon-base-info
,
.share-coupon-info
,
.shared-coupon-info
{
.split-coupon-base-info
,
.share-coupon-info
,
.shared-coupon-info
{
padding
:
10px
;
background-color
:
#fff
;
margin-bottom
:
20px
;
.title
{
.title
{
font-size
:
20px
;
font-weight
:
bold
;
color
:
#000
;
margin-bottom
:
10px
;
}
}
.ant-form-item
{
.ant-form-item
{
margin-bottom
:
10px
;
}
}
.footer-operate
{
.footer-operate
{
position
:
absolute
;
bottom
:
-15px
;
left
:
-10px
;
height
:
80px
;
width
:
calc
(
100%
+
20px
)
;
width
:
calc
(
100%
+
20px
);
background-color
:
#fff
;
box-shadow
:
0
-1px
2px
0
rgba
(
0
,
0
,
0
,
0
.1
);
box-shadow
:
0
-1px
2px
0
rgba
(
0
,
0
,
0
,
0
.1
);
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
button
{
button
{
width
:
100px
;
}
button
:first-child
{
button
:first-child
{
margin-right
:
150px
;
}
}
}
src/pages/couponManage/splitCouponList/addOrEditOrDetail/index.tsx
浏览文件 @
a38d7f4f
import
{
FC
,
useEffect
,
useRef
,
useState
}
from
"react"
;
import
"./index.scss"
;
import
{
Button
,
message
}
from
"antd"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
dayJs
from
"dayjs"
;
import
qs
from
"query-string"
;
import
BaseInfo
from
"./components/baseInfo"
;
import
ShareCouponInfo
from
"./components/shareCouponInfo"
;
import
SharedCouponInfo
from
"./components/sharedCouponInfo"
;
import
{
MakeManageAPI
}
from
"~/api/modules/makeManage"
;
import
{
MakeItemEntity
}
from
"~/api/interface/makeManage"
;
import
{
CouponManageAPI
}
from
"~/api"
;
import
{
FC
,
useEffect
,
useRef
,
useState
}
from
'react'
;
import
'./index.scss'
;
import
{
Button
,
message
}
from
'antd'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
dayJs
from
'dayjs'
;
import
qs
from
'query-string'
;
import
BaseInfo
from
'./components/baseInfo'
;
import
ShareCouponInfo
from
'./components/shareCouponInfo'
;
import
SharedCouponInfo
from
'./components/sharedCouponInfo'
;
import
{
MakeManageAPI
}
from
'~/api/modules/makeManage'
;
import
{
MakeItemEntity
}
from
'~/api/interface/makeManage'
;
import
{
CouponManageAPI
}
from
'~/api'
;
const
SplitCouponOperate
:
FC
<
any
>
=
(
props
)
=>
{
const
history
=
useNavigate
();
...
...
@@ -21,13 +21,11 @@ const SplitCouponOperate: FC<any> = (props) => {
const
[
makeList
,
setMakeList
]
=
useState
<
MakeItemEntity
[]
>
([]);
// 品牌-列表
const
getMakeList
=
()
=>
{
MakeManageAPI
.
getListBrandInfo
({
pageNo
:
1
,
pageSize
:
999999
}).
then
(
({
result
})
=>
{
MakeManageAPI
.
getListBrandInfo
({
pageNo
:
1
,
pageSize
:
999999
}).
then
(({
result
})
=>
{
setMakeList
(
result
.
list
||
[]);
}
);
});
};
const
[
splitCouponId
,
setSplitCouponId
]
=
useState
<
string
>
(
""
);
const
[
splitCouponId
,
setSplitCouponId
]
=
useState
<
string
>
(
''
);
// 详情
const
getSplitCouponDetail
=
(
couponId
:
string
)
=>
{
CouponManageAPI
.
getPageActivityList
({
...
...
@@ -37,22 +35,15 @@ const SplitCouponOperate: FC<any> = (props) => {
useType
:
2
,
}).
then
(({
result
})
=>
{
if
(
result
.
list
[
0
])
{
(
shareCouponRef
.
current
as
any
).
setCouponType
(
result
.
list
[
0
].
couponType
);
(
shareCouponRef
.
current
as
any
).
setCouponType
(
result
.
list
[
0
].
couponType
);
const
{
beSharedCoupon
}
=
result
.
list
[
0
];
(
sharedCouponRef
.
current
as
any
).
setCouponType
(
beSharedCoupon
.
couponType
);
(
sharedCouponRef
.
current
as
any
).
setCouponType
(
beSharedCoupon
.
couponType
);
(
baseInfoRef
.
current
as
any
).
getForm
().
setFieldsValue
({
couponName
:
result
.
list
[
0
].
couponName
,
});
(
shareCouponRef
.
current
as
any
).
getForm
().
setFieldsValue
({
primaryKey
:
(
result
.
list
[
0
].
primaryKey
as
any
).
split
(
","
).
map
(
Number
),
time
:
[
dayJs
(
result
.
list
[
0
].
useStartTime
),
dayJs
(
result
.
list
[
0
].
useEndTime
),
],
primaryKey
:
(
result
.
list
[
0
].
primaryKey
as
any
).
split
(
','
).
map
(
Number
),
time
:
[
dayJs
(
result
.
list
[
0
].
useStartTime
),
dayJs
(
result
.
list
[
0
].
useEndTime
)],
couponMoney
:
result
.
list
[
0
].
couponMoney
,
couponType
:
result
.
list
[
0
].
couponType
,
minPrice
:
result
.
list
[
0
].
minPrice
||
undefined
,
...
...
@@ -64,9 +55,7 @@ const SplitCouponOperate: FC<any> = (props) => {
userTag
:
beSharedCoupon
.
userTag
||
undefined
,
});
(
sharedCouponRef
.
current
as
any
).
getForm
().
setFieldsValue
({
beSharedPrimaryKey
:
(
beSharedCoupon
.
primaryKey
as
any
)
.
split
(
","
)
.
map
(
Number
),
beSharedPrimaryKey
:
(
beSharedCoupon
.
primaryKey
as
any
).
split
(
','
).
map
(
Number
),
beSharedCouponMoney
:
beSharedCoupon
.
couponMoney
,
beSharedCouponType
:
beSharedCoupon
.
couponType
,
beSharedMinPrice
:
beSharedCoupon
.
minPrice
||
undefined
,
...
...
@@ -87,22 +76,18 @@ const SplitCouponOperate: FC<any> = (props) => {
getSharedCouponForm
().
validateFields
(),
])
.
then
((
values
)
=>
{
values
[
1
].
useStartTime
=
`
${
dayJs
(
values
[
1
].
time
[
0
]).
format
(
"YYYY-MM-DD"
)}
00:00:00`
;
values
[
1
].
useEndTime
=
`
${
dayJs
(
values
[
1
].
time
[
1
]).
format
(
"YYYY-MM-DD"
)}
23:59:59`
;
values
[
1
].
primaryKey
=
values
[
1
].
primaryKey
.
join
(
","
);
values
[
2
].
beSharedPrimaryKey
=
values
[
2
].
beSharedPrimaryKey
.
join
(
","
);
values
[
1
].
useStartTime
=
`
${
dayJs
(
values
[
1
].
time
[
0
]).
format
(
'YYYY-MM-DD'
)}
00:00:00`
;
values
[
1
].
useEndTime
=
`
${
dayJs
(
values
[
1
].
time
[
1
]).
format
(
'YYYY-MM-DD'
)}
23:59:59`
;
values
[
1
].
primaryKey
=
values
[
1
].
primaryKey
.
join
(
','
);
values
[
2
].
beSharedPrimaryKey
=
values
[
2
].
beSharedPrimaryKey
.
join
(
','
);
delete
values
[
1
].
time
;
CouponManageAPI
.
saveActivity
({
...
values
[
0
],
...
values
[
1
],
...
values
[
2
],
}).
then
(({
code
,
message
:
msg
})
=>
{
if
(
code
===
"200"
)
{
message
.
success
(
"新增成功"
);
if
(
code
===
'200'
)
{
message
.
success
(
'新增成功'
);
getBaseInfoForm
().
resetFields
();
getShareCouponForm
().
resetFields
();
getSharedCouponForm
().
resetFields
();
...
...
@@ -133,16 +118,12 @@ const SplitCouponOperate: FC<any> = (props) => {
},
[]);
return
(
<
div
className=
"add-or-edit-or-detail-wrap"
>
<
div
className=
"add-or-edit-or-detail"
>
<
div
className=
'add-or-edit-or-detail-wrap'
>
<
div
className=
'add-or-edit-or-detail'
>
{
/* 基本信息 */
}
<
BaseInfo
ref=
{
baseInfoRef
}
isDetail=
{
!!
splitCouponId
}
/>
{
/* 分享者优惠券 */
}
<
ShareCouponInfo
ref=
{
shareCouponRef
}
makeList=
{
makeList
}
isDetail=
{
!!
splitCouponId
}
/>
<
ShareCouponInfo
ref=
{
shareCouponRef
}
makeList=
{
makeList
}
isDetail=
{
!!
splitCouponId
}
/>
{
/* 被分享者优惠券 */
}
<
SharedCouponInfo
ref=
{
sharedCouponRef
}
...
...
@@ -151,10 +132,10 @@ const SplitCouponOperate: FC<any> = (props) => {
isDetail=
{
!!
splitCouponId
}
/>
</
div
>
<
div
className=
"footer-operate"
>
<
div
className=
'footer-operate'
>
<
Button
onClick=
{
backRoute
}
>
返回
</
Button
>
{
!
splitCouponId
&&
(
<
Button
type=
"primary"
onClick=
{
addSplitCouponSubmit
}
>
<
Button
type=
'primary'
onClick=
{
addSplitCouponSubmit
}
>
确定
</
Button
>
)
}
...
...
src/pages/couponManage/splitCouponList/index.scss
浏览文件 @
a38d7f4f
.split-coupon-list
{
.ant-table-thead
>
tr
>
th
:not
(
:last-child
)
:not
(
.ant-table-selection-column
)
:not
(
.ant-table-row-expand-icon-cell
)
:not
([
colspan
])
::before
{
.split-coupon-list
{
.ant-table-thead
>
tr
>
th
:not
(
:last-child
)
:not
(
.ant-table-selection-column
)
:not
(
.ant-table-row-expand-icon-cell
)
:not
(
[
colspan
]
)
::before
{
width
:
0
;
}
.ant-table-tbody
>
tr
{
.ant-table-tbody
>
tr
{
border-bottom
:
1px
solid
#999
;
}
}
src/pages/couponManage/splitCouponList/index.tsx
浏览文件 @
a38d7f4f
import
{
FC
,
useEffect
,
useState
}
from
"react"
;
import
{
Button
,
Table
,
Modal
,
message
}
from
"antd"
;
import
{
PlusOutlined
}
from
"@ant-design/icons"
;
import
{
ColumnsType
}
from
"antd/es/table"
;
import
{
useNavigate
}
from
"react-router-dom"
;
import
qs
from
"query-string"
;
import
SearchBox
,
{
searchColumns
}
from
"~/components/search-box"
;
import
{
PaginationEntity
}
from
"~/common/interface/PaginationEntity"
;
import
{
SplitCouponItemType
,
SplitCouponSearchType
,
}
from
"~/api/interface/couponManage"
;
import
{
CouponManageAPI
}
from
"~/api"
;
import
{
splitCouponType
,
splitCouponUseType
}
from
"~/utils/dictionary"
;
import
{
DataModal
}
from
"~/pages/couponManage/couponList/comp/dataModal"
;
import
useOperate
from
"~/common/hook/optionHook"
;
import
"./index.scss"
;
import
{
FC
,
useEffect
,
useState
}
from
'react'
;
import
{
Button
,
Table
,
Modal
,
message
}
from
'antd'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
qs
from
'query-string'
;
import
SearchBox
,
{
searchColumns
}
from
'~/components/search-box'
;
import
{
PaginationEntity
}
from
'~/common/interface/PaginationEntity'
;
import
{
SplitCouponItemType
,
SplitCouponSearchType
}
from
'~/api/interface/couponManage'
;
import
{
CouponManageAPI
}
from
'~/api'
;
import
{
splitCouponType
,
splitCouponUseType
}
from
'~/utils/dictionary'
;
import
{
DataModal
}
from
'~/pages/couponManage/couponList/comp/dataModal'
;
import
useOperate
from
'~/common/hook/optionHook'
;
import
'./index.scss'
;
const
SplitCouponList
:
FC
=
()
=>
{
const
history
=
useNavigate
();
const
searchData
:
searchColumns
[]
=
[
{
type
:
"input"
,
placeholder
:
"请输入优惠券ID"
,
label
:
"ID"
,
name
:
"couponId"
,
type
:
'input'
,
placeholder
:
'请输入优惠券ID'
,
label
:
'ID'
,
name
:
'couponId'
,
},
{
type
:
"input"
,
placeholder
:
"请输入优惠券名称"
,
label
:
"名称"
,
name
:
"couponName"
,
type
:
'input'
,
placeholder
:
'请输入优惠券名称'
,
label
:
'名称'
,
name
:
'couponName'
,
},
// {
// type: "input",
...
...
@@ -38,89 +35,89 @@ const SplitCouponList: FC = () => {
// name: "",
// },
{
type
:
"select"
,
placeholder
:
"请选中状态"
,
name
:
"state"
,
label
:
"状态"
,
type
:
'select'
,
placeholder
:
'请选中状态'
,
name
:
'state'
,
label
:
'状态'
,
options
:
[
{
id
:
0
,
name
:
"已结束"
,
name
:
'已结束'
,
},
{
id
:
1
,
name
:
"领取中"
,
name
:
'领取中'
,
},
],
},
{
type
:
"rangePicker"
,
placeholder
:
""
,
label
:
"日期"
,
name
:
"time"
,
type
:
'rangePicker'
,
placeholder
:
''
,
label
:
'日期'
,
name
:
'time'
,
},
];
const
tableColumns
:
ColumnsType
<
SplitCouponItemType
>
=
[
{
title
:
"优惠券ID"
,
align
:
"center"
,
dataIndex
:
"id"
,
title
:
'优惠券ID'
,
align
:
'center'
,
dataIndex
:
'id'
,
onCell
:
(
record
:
SplitCouponItemType
,
rowIndex
:
any
)
=>
({
rowSpan
:
rowIndex
%
2
?
0
:
2
,
}),
},
{
title
:
"优惠券名称"
,
align
:
"center"
,
dataIndex
:
"couponName"
,
title
:
'优惠券名称'
,
align
:
'center'
,
dataIndex
:
'couponName'
,
},
{
title
:
"角色"
,
align
:
"center"
,
dataIndex
:
"activityRole"
,
title
:
'角色'
,
align
:
'center'
,
dataIndex
:
'activityRole'
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
)
=>
(
<
div
>
{
record
.
activityRole
===
"share"
?
"分享者"
:
"被分享者"
}
</
div
>
<
div
>
{
record
.
activityRole
===
'share'
?
'分享者'
:
'被分享者'
}
</
div
>
),
},
{
title
:
"状态"
,
align
:
"center"
,
dataIndex
:
"couponStatus"
,
title
:
'状态'
,
align
:
'center'
,
dataIndex
:
'couponStatus'
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
)
=>
(
<
div
>
{
record
.
couponStatus
?
"领取中"
:
"已结束"
}
</
div
>
<
div
>
{
record
.
couponStatus
?
'领取中'
:
'已结束'
}
</
div
>
),
},
{
title
:
"面额"
,
align
:
"center"
,
dataIndex
:
"couponMoney"
,
title
:
'面额'
,
align
:
'center'
,
dataIndex
:
'couponMoney'
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
)
=>
(
<
div
className=
"table-self-cell"
>
<
div
className=
'table-self-cell'
>
<
div
>
{
record
.
couponMoney
.
toLocaleString
()
}
</
div
>
</
div
>
),
},
{
title
:
"门槛"
,
align
:
"center"
,
dataIndex
:
"couponType"
,
title
:
'门槛'
,
align
:
'center'
,
dataIndex
:
'couponType'
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
)
=>
(
<
div
>
{
getCouponTypeById
(
record
.
couponType
)
}
</
div
>
),
},
{
title
:
"券类型"
,
align
:
"center"
,
dataIndex
:
"useType"
,
title
:
'券类型'
,
align
:
'center'
,
dataIndex
:
'useType'
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
)
=>
(
<
div
>
{
getCouponUseTypeById
(
record
.
useType
)
}
</
div
>
),
},
{
title
:
"有效期"
,
align
:
"center"
,
width
:
"15%"
,
title
:
'有效期'
,
align
:
'center'
,
width
:
'15%'
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
)
=>
(
<
div
>
<
div
>
起:
{
record
.
useStartTime
}
</
div
>
...
...
@@ -137,54 +134,40 @@ const SplitCouponList: FC = () => {
// ),
// },
{
title
:
"发行量"
,
align
:
"center"
,
dataIndex
:
"couponTotal"
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
)
=>
(
<
div
>
{
record
.
couponTotal
}
</
div
>
),
title
:
'发行量'
,
align
:
'center'
,
dataIndex
:
'couponTotal'
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
)
=>
<
div
>
{
record
.
couponTotal
}
</
div
>,
},
{
title
:
"已领取"
,
align
:
"center"
,
dataIndex
:
"amountReceived"
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
)
=>
(
<
div
>
{
record
.
amountReceived
}
</
div
>
),
title
:
'已领取'
,
align
:
'center'
,
dataIndex
:
'amountReceived'
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
)
=>
<
div
>
{
record
.
amountReceived
}
</
div
>,
},
{
title
:
"操作"
,
align
:
"center"
,
title
:
'操作'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
SplitCouponItemType
,
index
:
number
)
=>
(
<>
<
Button
type=
"link"
type=
'link'
onClick=
{
()
=>
toAddOrDetailSplitCoupon
(
record
.
activityRole
===
"share"
?
record
:
tableDataSource
[
index
-
1
]
record
.
activityRole
===
'share'
?
record
:
tableDataSource
[
index
-
1
],
)
}
disabled=
{
!
isLookBtn
}
>
查看
</
Button
>
<
Button
type=
"link"
onClick=
{
()
=>
showDataModalClick
(
record
)
}
disabled=
{
!
isDataBtn
}
>
<
Button
type=
'link'
onClick=
{
()
=>
showDataModalClick
(
record
)
}
disabled=
{
!
isDataBtn
}
>
数据
</
Button
>
<
Button
type=
"link"
type=
'link'
onClick=
{
()
=>
endSplitCoupon
(
record
.
activityRole
===
"share"
?
record
:
tableDataSource
[
index
-
1
]
)
endSplitCoupon
(
record
.
activityRole
===
'share'
?
record
:
tableDataSource
[
index
-
1
])
}
disabled=
{
!
record
.
couponStatus
||
!
isEndBtn
}
>
...
...
@@ -197,9 +180,7 @@ const SplitCouponList: FC = () => {
// }),
},
];
const
[
tableDataSource
,
setTableDataSource
]
=
useState
<
SplitCouponItemType
[]
>
(
[]
);
const
[
tableDataSource
,
setTableDataSource
]
=
useState
<
SplitCouponItemType
[]
>
([]);
const
[
queryData
,
setQueryData
]
=
useState
<
SplitCouponSearchType
>
({
useType
:
2
,
});
...
...
@@ -223,7 +204,7 @@ const SplitCouponList: FC = () => {
startTime
:
(
data
.
time
&&
data
.
time
[
0
])
||
undefined
,
endTime
:
(
data
.
time
&&
data
.
time
[
1
])
||
undefined
,
useType
:
2
,
state
:
data
.
state
===
undefined
?
""
:
!!
data
.
state
,
state
:
data
.
state
===
undefined
?
''
:
!!
data
.
state
,
};
delete
query
.
time
;
setQueryData
(
query
);
...
...
@@ -237,239 +218,239 @@ const SplitCouponList: FC = () => {
};
// get split coupon
const
getSplitCoupon
=
(
data
:
SplitCouponSearchType
&
Pick
<
PaginationEntity
,
"pageSize"
|
"pageNo"
>
data
:
SplitCouponSearchType
&
Pick
<
PaginationEntity
,
'pageSize'
|
'pageNo'
>
,
)
=>
{
// setLoading(true);
setTableDataSource
([
{
"id"
:
10000157
,
"couponName"
:
"2223"
,
"couponMoney"
:
22
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
null
,
"couponTotal"
:
13
,
"lastTotal"
:
13
,
"amountReceived"
:
0
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32,31"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-27 00:00:00"
,
"useEndTime"
:
"2023-06-16 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 17:47:50"
,
"updateTime"
:
null
,
"couponStatus"
:
true
,
"parentId"
:
null
,
"peopleNumber"
:
2
,
"activityRole"
:
"share"
,
"beSharedCoupon"
:
{
"id"
:
10000158
,
"couponName"
:
"2223"
,
"couponMoney"
:
22
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
1
,
"couponTotal"
:
12
,
"lastTotal"
:
12
,
"amountReceived"
:
0
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-27 00:00:00"
,
"useEndTime"
:
"2023-06-16 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
1
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 17:47:50"
,
"updateTime"
:
null
,
"couponStatus"
:
true
,
"parentId"
:
10000157
,
"peopleNumber"
:
null
,
"activityRole"
:
"beShare"
,
"beSharedCoupon"
:
null
}
id
:
10000157
,
couponName
:
'2223'
,
couponMoney
:
22
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
null
,
couponTotal
:
13
,
lastTotal
:
13
,
amountReceived
:
0
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32,31'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-27 00:00:00'
,
useEndTime
:
'2023-06-16 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 17:47:50'
,
updateTime
:
null
,
couponStatus
:
true
,
parentId
:
null
,
peopleNumber
:
2
,
activityRole
:
'share'
,
beSharedCoupon
:
{
id
:
10000158
,
couponName
:
'2223'
,
couponMoney
:
22
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
1
,
couponTotal
:
12
,
lastTotal
:
12
,
amountReceived
:
0
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-27 00:00:00'
,
useEndTime
:
'2023-06-16 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
1
,
verificationType
:
false
,
createTime
:
'2023-05-24 17:47:50'
,
updateTime
:
null
,
couponStatus
:
true
,
parentId
:
10000157
,
peopleNumber
:
null
,
activityRole
:
'beShare'
,
beSharedCoupon
:
null
,
}
,
},
{
"id"
:
10000153
,
"couponName"
:
"列表优惠券测试小嗯嗯"
,
"couponMoney"
:
22
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
null
,
"couponTotal"
:
3
,
"lastTotal"
:
3
,
"amountReceived"
:
0
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32,26"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-24 00:00:00"
,
"useEndTime"
:
"2023-06-21 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 17:00:06"
,
"updateTime"
:
null
,
"couponStatus"
:
false
,
"parentId"
:
null
,
"peopleNumber"
:
2
,
"activityRole"
:
"share"
,
"beSharedCoupon"
:
{
"id"
:
10000154
,
"couponName"
:
"列表优惠券测试小嗯嗯"
,
"couponMoney"
:
22
,
"couponDiscount"
:
null
,
"isLimited"
:
true
,
"restrictedAccess"
:
1
,
"couponTotal"
:
33
,
"lastTotal"
:
33
,
"amountReceived"
:
0
,
"couponType"
:
3
,
"useType"
:
2
,
"minPrice"
:
null
,
"primaryKey"
:
"32"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-05-24 00:00:00"
,
"useEndTime"
:
"2023-06-21 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
1
,
"verificationType"
:
false
,
"createTime"
:
"2023-05-24 17:00:06"
,
"updateTime"
:
null
,
"couponStatus"
:
false
,
"parentId"
:
10000153
,
"peopleNumber"
:
null
,
"activityRole"
:
"beShare"
,
"beSharedCoupon"
:
null
}
id
:
10000153
,
couponName
:
'列表优惠券测试小嗯嗯'
,
couponMoney
:
22
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
null
,
couponTotal
:
3
,
lastTotal
:
3
,
amountReceived
:
0
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32,26'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-24 00:00:00'
,
useEndTime
:
'2023-06-21 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
null
,
verificationType
:
false
,
createTime
:
'2023-05-24 17:00:06'
,
updateTime
:
null
,
couponStatus
:
false
,
parentId
:
null
,
peopleNumber
:
2
,
activityRole
:
'share'
,
beSharedCoupon
:
{
id
:
10000154
,
couponName
:
'列表优惠券测试小嗯嗯'
,
couponMoney
:
22
,
couponDiscount
:
null
,
isLimited
:
true
,
restrictedAccess
:
1
,
couponTotal
:
33
,
lastTotal
:
33
,
amountReceived
:
0
,
couponType
:
3
,
useType
:
2
,
minPrice
:
null
,
primaryKey
:
'32'
,
isFixedTime
:
0
,
useStartTime
:
'2023-05-24 00:00:00'
,
useEndTime
:
'2023-06-21 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
1
,
verificationType
:
false
,
createTime
:
'2023-05-24 17:00:06'
,
updateTime
:
null
,
couponStatus
:
false
,
parentId
:
10000153
,
peopleNumber
:
null
,
activityRole
:
'beShare'
,
beSharedCoupon
:
null
,
}
,
},
{
"id"
:
10000148
,
"couponName"
:
"裂变优惠券测试"
,
"couponMoney"
:
1000
,
"couponDiscount"
:
9
,
"isLimited"
:
true
,
"restrictedAccess"
:
null
,
"couponTotal"
:
3
,
"lastTotal"
:
3
,
"amountReceived"
:
0
,
"couponType"
:
1
,
"useType"
:
2
,
"minPrice"
:
4000
,
"primaryKey"
:
"31"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-04-23 00:00:00"
,
"useEndTime"
:
"2023-04-30 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-04-23 16:10:18"
,
"updateTime"
:
null
,
"couponStatus"
:
false
,
"parentId"
:
null
,
"peopleNumber"
:
2
,
"activityRole"
:
"share"
,
"beSharedCoupon"
:
{
"id"
:
10000149
,
"couponName"
:
"裂变优惠券测试"
,
"couponMoney"
:
1000
,
"couponDiscount"
:
9
,
"isLimited"
:
true
,
"restrictedAccess"
:
1
,
"couponTotal"
:
9
,
"lastTotal"
:
8
,
"amountReceived"
:
1
,
"couponType"
:
1
,
"useType"
:
2
,
"minPrice"
:
4000
,
"primaryKey"
:
"31"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-04-23 00:00:00"
,
"useEndTime"
:
"2023-04-30 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
1
,
"verificationType"
:
false
,
"createTime"
:
"2023-04-23 16:10:18"
,
"updateTime"
:
null
,
"couponStatus"
:
false
,
"parentId"
:
10000148
,
"peopleNumber"
:
null
,
"activityRole"
:
"beShare"
,
"beSharedCoupon"
:
null
}
id
:
10000148
,
couponName
:
'裂变优惠券测试'
,
couponMoney
:
1000
,
couponDiscount
:
9
,
isLimited
:
true
,
restrictedAccess
:
null
,
couponTotal
:
3
,
lastTotal
:
3
,
amountReceived
:
0
,
couponType
:
1
,
useType
:
2
,
minPrice
:
4000
,
primaryKey
:
'31'
,
isFixedTime
:
0
,
useStartTime
:
'2023-04-23 00:00:00'
,
useEndTime
:
'2023-04-30 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
null
,
verificationType
:
false
,
createTime
:
'2023-04-23 16:10:18'
,
updateTime
:
null
,
couponStatus
:
false
,
parentId
:
null
,
peopleNumber
:
2
,
activityRole
:
'share'
,
beSharedCoupon
:
{
id
:
10000149
,
couponName
:
'裂变优惠券测试'
,
couponMoney
:
1000
,
couponDiscount
:
9
,
isLimited
:
true
,
restrictedAccess
:
1
,
couponTotal
:
9
,
lastTotal
:
8
,
amountReceived
:
1
,
couponType
:
1
,
useType
:
2
,
minPrice
:
4000
,
primaryKey
:
'31'
,
isFixedTime
:
0
,
useStartTime
:
'2023-04-23 00:00:00'
,
useEndTime
:
'2023-04-30 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
1
,
verificationType
:
false
,
createTime
:
'2023-04-23 16:10:18'
,
updateTime
:
null
,
couponStatus
:
false
,
parentId
:
10000148
,
peopleNumber
:
null
,
activityRole
:
'beShare'
,
beSharedCoupon
:
null
,
}
,
},
{
"id"
:
10000141
,
"couponName"
:
"测试裂变"
,
"couponMoney"
:
800
,
"couponDiscount"
:
8
,
"isLimited"
:
false
,
"restrictedAccess"
:
null
,
"couponTotal"
:
10
,
"lastTotal"
:
11
,
"amountReceived"
:
-
1
,
"couponType"
:
1
,
"useType"
:
2
,
"minPrice"
:
10000
,
"primaryKey"
:
"31"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-04-19 00:00:00"
,
"useEndTime"
:
"2023-04-19 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-04-19 13:46:06"
,
"updateTime"
:
null
,
"couponStatus"
:
false
,
"parentId"
:
null
,
"peopleNumber"
:
2
,
"activityRole"
:
"share"
,
"beSharedCoupon"
:
{
"id"
:
10000142
,
"couponName"
:
"测试裂变"
,
"couponMoney"
:
500
,
"couponDiscount"
:
9
,
"isLimited"
:
true
,
"restrictedAccess"
:
1
,
"couponTotal"
:
100
,
"lastTotal"
:
97
,
"amountReceived"
:
3
,
"couponType"
:
1
,
"useType"
:
2
,
"minPrice"
:
10000
,
"primaryKey"
:
"31"
,
"isFixedTime"
:
0
,
"useStartTime"
:
"2023-04-19 00:00:00"
,
"useEndTime"
:
"2023-04-19 23:59:59"
,
"couponDay"
:
null
,
"getType"
:
4
,
"userTag"
:
null
,
"verificationType"
:
false
,
"createTime"
:
"2023-04-19 13:46:06"
,
"updateTime"
:
null
,
"couponStatus"
:
false
,
"parentId"
:
10000141
,
"peopleNumber"
:
null
,
"activityRole"
:
"beShare"
,
"beSharedCoupon"
:
null
}
}
])
id
:
10000141
,
couponName
:
'测试裂变'
,
couponMoney
:
800
,
couponDiscount
:
8
,
isLimited
:
false
,
restrictedAccess
:
null
,
couponTotal
:
10
,
lastTotal
:
11
,
amountReceived
:
-
1
,
couponType
:
1
,
useType
:
2
,
minPrice
:
10000
,
primaryKey
:
'31'
,
isFixedTime
:
0
,
useStartTime
:
'2023-04-19 00:00:00'
,
useEndTime
:
'2023-04-19 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
null
,
verificationType
:
false
,
createTime
:
'2023-04-19 13:46:06'
,
updateTime
:
null
,
couponStatus
:
false
,
parentId
:
null
,
peopleNumber
:
2
,
activityRole
:
'share'
,
beSharedCoupon
:
{
id
:
10000142
,
couponName
:
'测试裂变'
,
couponMoney
:
500
,
couponDiscount
:
9
,
isLimited
:
true
,
restrictedAccess
:
1
,
couponTotal
:
100
,
lastTotal
:
97
,
amountReceived
:
3
,
couponType
:
1
,
useType
:
2
,
minPrice
:
10000
,
primaryKey
:
'31'
,
isFixedTime
:
0
,
useStartTime
:
'2023-04-19 00:00:00'
,
useEndTime
:
'2023-04-19 23:59:59'
,
couponDay
:
null
,
getType
:
4
,
userTag
:
null
,
verificationType
:
false
,
createTime
:
'2023-04-19 13:46:06'
,
updateTime
:
null
,
couponStatus
:
false
,
parentId
:
10000141
,
peopleNumber
:
null
,
activityRole
:
'beShare'
,
beSharedCoupon
:
null
,
}
,
}
,
])
;
CouponManageAPI
.
getPageActivityList
(
data
).
then
(({
result
})
=>
{
if
(
result
.
list
)
{
const
couponList
=
result
.
list
.
reduce
(
...
...
@@ -480,7 +461,7 @@ const SplitCouponList: FC = () => {
}
return
pre
;
},
[]
[]
,
);
setLoading
(
false
);
setTableDataSource
(
couponList
);
...
...
@@ -500,20 +481,20 @@ const SplitCouponList: FC = () => {
// 新建
const
toAddOrDetailSplitCoupon
=
(
record
?:
SplitCouponItemType
)
=>
{
history
({
pathname
:
"/couponManage/addOrEditOrDetail"
,
pathname
:
'/couponManage/addOrEditOrDetail'
,
search
:
record
?
qs
.
stringify
({
id
:
record
.
id
,
})
:
""
,
:
''
,
});
};
const
getCouponTypeById
=
(
id
:
number
)
=>
{
return
splitCouponType
.
find
((
v
)
=>
v
.
val
===
id
)?.
label
||
""
;
return
splitCouponType
.
find
((
v
)
=>
v
.
val
===
id
)?.
label
||
''
;
};
const
getCouponUseTypeById
=
(
id
:
number
)
=>
{
return
splitCouponUseType
.
find
((
v
)
=>
v
.
val
===
id
)?.
label
||
""
;
return
splitCouponUseType
.
find
((
v
)
=>
v
.
val
===
id
)?.
label
||
''
;
};
// 裂变优惠券数据
const
dataModalClose
=
()
=>
{
...
...
@@ -526,11 +507,11 @@ const SplitCouponList: FC = () => {
// 结束
const
endSplitCoupon
=
(
record
:
SplitCouponItemType
)
=>
{
Modal
.
confirm
({
content
:
"确认结束后,将停止发放该券,已领的优惠券可继续使用"
,
content
:
'确认结束后,将停止发放该券,已领的优惠券可继续使用'
,
onOk
:
()
=>
{
CouponManageAPI
.
CouponShutDown
({
id
:
record
.
id
}).
then
(({
code
})
=>
{
if
(
code
===
"200"
)
{
message
.
success
(
"操作成功"
);
if
(
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
getSplitCoupon
({
...
queryData
,
pageNo
:
pagination
.
pageNo
,
...
...
@@ -551,13 +532,13 @@ const SplitCouponList: FC = () => {
},
[]);
return
(
<
div
className=
"split-coupon-list"
>
<
div
className=
'split-coupon-list'
>
<
SearchBox
search=
{
searchData
}
searchData=
{
searchSubmitEvent
}
sufFixBtn=
{
<
Button
type=
"primary"
type=
'primary'
icon=
{
<
PlusOutlined
/>
}
onClick=
{
()
=>
toAddOrDetailSplitCoupon
()
}
// disabled=
{!
isAddBtn
}
...
...
@@ -568,7 +549,7 @@ const SplitCouponList: FC = () => {
/>
<
Table
columns=
{
tableColumns
}
rowKey=
"id"
rowKey=
'id'
dataSource=
{
tableDataSource
}
loading=
{
loading
}
pagination=
{
{
...
...
@@ -577,17 +558,14 @@ const SplitCouponList: FC = () => {
current
:
pagination
.
pageNo
,
showSizeChanger
:
false
,
showQuickJumper
:
true
,
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
onChange
:
(
page
:
number
,
pageSize
:
number
)
=>
paginationChange
(
page
,
pageSize
),
showTotal
:
(
total
,
range
)
=>
`当前 ${Math.ceil(range[0] / 2)}-${range[1] / 2} 条记录 / 共 ${
total / 2
} 条数据`
,
`当前 ${Math.ceil(range[0] / 2)}-${range[1] / 2} 条记录 / 共 ${total / 2} 条数据`
,
}
}
/>
{
/* 优惠券数据 */
}
<
DataModal
title=
"裂变优惠券数据"
title=
'裂变优惠券数据'
open=
{
dataModalShow
}
closed=
{
dataModalClose
}
data=
{
splitCouponItem
}
...
...
src/pages/orderManage/equipmentOrder/comp/detailDelivery/index.tsx
0 → 100644
浏览文件 @
a38d7f4f
import
React
from
'react'
;
import
{
Image
}
from
'antd'
;
function
DetailDelivery
()
{
return
(
<
div
className=
{
'detail-delivery detail-half'
}
>
<
div
className=
{
'detail-title'
}
>
收货信息
</
div
>
<
div
className=
{
'detail-text'
}
>
收货人:测试
</
div
>
<
div
className=
{
'detail-text'
}
>
手机号:15889328503
</
div
>
<
div
className=
{
'detail-text'
}
>
收货地址:广东省深圳市南山区仙鼓路(南山区万科云城(仙鼓路西50米))
</
div
>
<
div
className=
{
'detail-title'
}
>
物流信息
</
div
>
<
div
className=
{
'detail-text'
}
>
物流单号:YT6732436785799
</
div
>
<
div
className=
{
'detail-text'
}
>
物流进度:--
</
div
>
<
div
className=
{
'detail-title'
}
>
验收信息
</
div
>
<
div
className=
{
'detail-text'
}
>
验收状态:已验收
</
div
>
<
div
className=
{
'detail-text'
}
>
验收凭证:
</
div
>
<
div
className=
{
'detail-image'
}
>
{
[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
].
map
((
i
,
j
)
=>
(
<
Image
key=
{
j
}
className=
{
'image'
}
src=
{
i
}
alt=
'付款凭证'
/>
))
}
</
div
>
</
div
>
);
}
export
default
DetailDelivery
;
src/pages/orderManage/equipmentOrder/comp/detailInformation/index.tsx
0 → 100644
浏览文件 @
a38d7f4f
import
{
useState
}
from
'react'
;
import
{
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
// 表格数据类型
type
TableType
=
any
;
function
DetailInformation
()
{
// 表格数据
const
[
tableData
]
=
useState
<
TableType
>
([{
id
:
1
}]);
// 表格结构
const
columns
:
ColumnsType
<
TableType
[
0
]
>
=
[
{
title
:
'商品'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'单价(元)'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'数量'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'订单状态'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'实收款'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
];
return
(
<
div
className=
{
'detail-information'
}
>
<
div
className=
{
'detail-title'
}
>
订单明细
</
div
>
<
div
className=
{
'detail-text'
}
>
<
span
className=
{
'item'
}
>
订单编号:UD202302181041156087
</
span
>
<
span
className=
{
'item'
}
>
创建时间:2023-02-18 10:41:16
</
span
>
<
span
className=
{
'item'
}
>
合同编号:UAV202334741131
</
span
>
</
div
>
<
Table
style=
{
{
margin
:
'20px auto'
,
width
:
'90%'
}
}
size=
'small'
dataSource=
{
tableData
}
columns=
{
columns
}
rowKey=
'id'
bordered
pagination=
{
false
}
// rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
/>
</
div
>
);
}
export
default
DetailInformation
;
src/pages/orderManage/equipmentOrder/comp/detailPurchaser/index.tsx
0 → 100644
浏览文件 @
a38d7f4f
import
React
from
'react'
;
import
{
Button
,
Image
}
from
'antd'
;
function
DetailPurchaser
()
{
return
(
<
div
className=
{
'detail-purchaser detail-half'
}
>
<
div
className=
{
'detail-title'
}
>
买家信息
</
div
>
<
div
className=
{
'detail-text'
}
>
UID: UID4460817
</
div
>
<
div
className=
{
'detail-text'
}
>
企业: 浙江科比特创新科技有限公司
</
div
>
<
div
className=
{
'detail-text'
}
>
备注: 测试单,不用管
</
div
>
<
div
className=
{
'detail-title'
}
>
合同信息
</
div
>
<
div
className=
{
'detail-text'
}
>
合同编号: UAV202334741131
</
div
>
<
div
className=
{
'detail-text'
}
>
合同状态: 已归档
</
div
>
<
div
className=
{
'detail-text'
}
>
合同操作:
<
Button
type=
{
'link'
}
>
平台签署
</
Button
>
<
Button
type=
{
'link'
}
>
查看
</
Button
>
<
Button
type=
{
'link'
}
>
下载
</
Button
>
</
div
>
<
div
className=
{
'detail-title'
}
>
付款凭证
</
div
>
<
div
className=
{
'detail-text'
}
>
预付款:
</
div
>
<
div
className=
{
'detail-image'
}
>
{
[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
].
map
((
i
,
j
)
=>
(
<
Image
key=
{
j
}
className=
{
'image'
}
src=
{
i
}
alt=
'付款凭证'
/>
))
}
</
div
>
<
div
className=
{
'detail-text'
}
>
尾款:
</
div
>
<
div
className=
{
'detail-image'
}
>
{
[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
].
map
((
i
,
j
)
=>
(
<
Image
key=
{
j
}
className=
{
'image'
}
src=
{
i
}
alt=
'付款凭证'
/>
))
}
</
div
>
<
div
className=
{
'detail-text'
}
>
全款:
</
div
>
<
div
className=
{
'detail-image'
}
>
{
[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
].
map
((
i
,
j
)
=>
(
<
Image
key=
{
j
}
className=
{
'image'
}
src=
{
i
}
alt=
'付款凭证'
/>
))
}
</
div
>
</
div
>
);
}
export
default
DetailPurchaser
;
src/pages/orderManage/equipmentOrder/detail/index.scss
0 → 100644
浏览文件 @
a38d7f4f
.order-detail
{
position
:
relative
;
box-sizing
:
border-box
;
.order-head
{
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
.head-text
{
font-size
:
13px
;
font-weight
:
600
;
color
:
#000000
;
div
{
margin-bottom
:
10px
;
span
{
margin-right
:
20px
;
}
}
}
}
.detail-wrap
{
position
:
relative
;
width
:
100%
;
display
:
flex
;
justify-content
:
flex-start
;
flex-wrap
:
wrap
;
margin-top
:
15px
;
padding-bottom
:
100px
;
.detail-information
{
margin-top
:
10px
;
width
:
100%
;
}
.detail-half
{
width
:
50%
;
}
.detail-title
{
font-size
:
13px
;
font-weight
:
600
;
color
:
#000000
;
margin-bottom
:
15px
;
margin-top
:
20px
;
}
.detail-title
:first-child
{
margin-top
:
0
;
}
.detail-text
{
margin-bottom
:
10px
;
.item
{
margin-right
:
20px
;
}
}
.detail-image
{
display
:
flex
;
justify-content
:
flex-start
;
margin-left
:
56px
;
margin-top
:
-20px
;
margin-bottom
:
10px
;
.image
{
width
:
68px
;
height
:
68px
;
//margin-right: 10px;
}
.ant-image
{
margin-right
:
10px
;
}
}
}
}
src/pages/orderManage/equipmentOrder/detail/index.tsx
0 → 100644
浏览文件 @
a38d7f4f
import
{
useEffect
}
from
'react'
;
import
{
useNavigate
,
useSearchParams
}
from
'react-router-dom'
;
import
{
Button
}
from
'antd'
;
import
'./index.scss'
;
import
DetailDelivery
from
'~/pages/orderManage/productOrder/comp/detailDelivery'
;
import
DetailPurchaser
from
'~/pages/orderManage/productOrder/comp/detailPurchaser'
;
import
DetailInformation
from
'~/pages/orderManage/productOrder/comp/detailInformation'
;
function
EquipmentOrderDetail
()
{
// 路由钩子
const
navigate
=
useNavigate
();
// 参数钩子
const
[
searchParams
]
=
useSearchParams
();
// 接收到的参数
const
id
=
searchParams
.
get
(
'id'
);
// 返回上一页
const
handleBack
=
()
=>
{
navigate
(
-
1
);
};
// componentDidMount
useEffect
(()
=>
{
console
.
log
(
'拿到的id是 --->'
,
id
);
},
[
id
]);
return
(
<
div
className=
{
'order-detail'
}
>
<
div
className=
{
'order-head'
}
>
<
div
className=
'head-text'
>
<
div
>
<
span
>
订单编号:R2023051916330461
</
span
>
<
span
>
合同编号:UAV202334741131
</
span
>
</
div
>
<
div
>
<
span
>
当前状态:交易完成
</
span
>
<
span
>
创建时间:2023-02-18 10:41:16
</
span
>
</
div
>
</
div
>
<
Button
type=
{
'primary'
}
onClick=
{
()
=>
handleBack
()
}
>
返回
</
Button
>
</
div
>
<
div
className=
{
'detail-wrap'
}
>
<
DetailPurchaser
/>
<
DetailDelivery
/>
<
DetailInformation
/>
</
div
>
</
div
>
);
}
export
default
EquipmentOrderDetail
;
src/pages/orderManage/equipmentOrder/index.tsx
浏览文件 @
a38d7f4f
import
React
from
'react'
;
import
{
useState
}
from
'react'
;
import
SearchBox
from
'~/components/search-box'
;
import
{
Button
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
qs
from
'query-string'
;
// 表格数据类型
type
TableType
=
any
;
// 订单状态搜索列表
const
statusCodeButtonList
=
[
{
value
:
-
1
,
label
:
'全部订单'
},
{
value
:
0
,
label
:
'沟通意向'
},
{
value
:
1
,
label
:
'签约付款'
},
{
value
:
2
,
label
:
'待发货'
},
{
value
:
3
,
label
:
'待收货'
},
{
value
:
4
,
label
:
'已完成'
},
{
value
:
5
,
label
:
'已关闭'
},
];
function
EquipmentOrderView
()
{
return
<
div
>
EquipmentOrderView
</
div
>;
// 路由钩子
const
navigate
=
useNavigate
();
// 当前选择的是第几个按钮
const
[
statusCodeButtonIndex
,
setStatusCodeButtonIndex
]
=
useState
<
number
>
(
0
);
// 表格分页配置
const
[
pagination
]
=
useState
({
total
:
0
,
pageSize
:
10
,
current
:
1
,
totalPage
:
0
,
});
// 表格数据
const
[
tableData
]
=
useState
<
TableType
>
([{
id
:
1
}]);
// 订单状态筛选
const
statusChangeEvent
=
(
i
:
number
)
=>
{
console
.
log
(
'订单状态筛选 --->'
,
i
);
setStatusCodeButtonIndex
(
i
);
};
// 跳转订单详情
const
handleDetail
=
(
record
:
TableType
[
0
])
=>
{
console
.
log
(
'跳转订单详情 --->'
,
record
.
id
);
navigate
(
`/orderManage/equipmentOrder/detail?
${
qs
.
stringify
({
id
:
record
.
id
})}
`
);
};
// 表格结构
const
columns
:
ColumnsType
<
TableType
[
0
]
>
=
[
{
title
:
'商品'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'单价(元)'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'数量'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'买家'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'订单状态'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'实收款'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'相关运营'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'推荐人'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'订单交期'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'备注'
,
dataIndex
:
'remark'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'操作'
,
dataIndex
:
'action'
,
align
:
'center'
,
fixed
:
'right'
,
render
:
(
_text
,
record
)
=>
(
<>
<
Button
type=
{
'link'
}
onClick=
{
()
=>
handleDetail
(
record
)
}
>
详情
</
Button
>
</>
),
},
];
return
(
<>
<
SearchBox
search=
{
[
{
label
:
'订单编号'
,
name
:
'keyword'
,
type
:
'input'
,
placeholder
:
'请输入订单编号'
,
},
{
label
:
'买家账号'
,
name
:
'keyword2'
,
type
:
'input'
,
placeholder
:
'请输入用户账号'
,
},
{
label
:
'相关销售'
,
name
:
'saleId'
,
type
:
'Select'
,
placeholder
:
'请选择相关销售'
,
options
:
[],
},
{
label
:
'时间'
,
name
:
'time'
,
type
:
'rangePicker'
,
placeholder
:
'请选择创建时间'
,
},
]
}
searchData=
{
(
e
:
any
)
=>
console
.
log
(
'提交数据 --->'
,
e
)
}
sufFixBtn=
{
<>
{
statusCodeButtonList
?.
map
((
i
,
j
)
=>
{
return
(
<
Button
key=
{
j
}
type=
{
j
===
statusCodeButtonIndex
?
'primary'
:
'default'
}
onClick=
{
()
=>
statusChangeEvent
(
j
)
}
style=
{
{
marginTop
:
'5px'
}
}
>
{
i
.
label
}
</
Button
>
);
})
}
</>
}
/>
<
Table
size=
'small'
dataSource=
{
tableData
}
columns=
{
columns
}
rowKey=
'id'
scroll=
{
{
x
:
1200
}
}
pagination=
{
{
total
:
pagination
.
total
,
pageSize
:
pagination
.
pageSize
,
current
:
pagination
.
current
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
// onChange: (page: number, pageSize: number) =>
// paginationChange(page, pageSize),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
// rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
/>
</>
);
}
export
default
EquipmentOrderView
;
src/pages/orderManage/serviceOrder/comp/detailDelivery/index.tsx
0 → 100644
浏览文件 @
a38d7f4f
import
React
from
'react'
;
import
{
Image
}
from
'antd'
;
function
DetailDelivery
()
{
return
(
<
div
className=
{
'detail-delivery detail-half'
}
>
<
div
className=
{
'detail-title'
}
>
收货信息
</
div
>
<
div
className=
{
'detail-text'
}
>
收货人:测试
</
div
>
<
div
className=
{
'detail-text'
}
>
手机号:15889328503
</
div
>
<
div
className=
{
'detail-text'
}
>
收货地址:广东省深圳市南山区仙鼓路(南山区万科云城(仙鼓路西50米))
</
div
>
<
div
className=
{
'detail-title'
}
>
物流信息
</
div
>
<
div
className=
{
'detail-text'
}
>
物流单号:YT6732436785799
</
div
>
<
div
className=
{
'detail-text'
}
>
物流进度:--
</
div
>
<
div
className=
{
'detail-title'
}
>
验收信息
</
div
>
<
div
className=
{
'detail-text'
}
>
验收状态:已验收
</
div
>
<
div
className=
{
'detail-text'
}
>
验收凭证:
</
div
>
<
div
className=
{
'detail-image'
}
>
{
[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
].
map
((
i
,
j
)
=>
(
<
Image
key=
{
j
}
className=
{
'image'
}
src=
{
i
}
alt=
'付款凭证'
/>
))
}
</
div
>
</
div
>
);
}
export
default
DetailDelivery
;
src/pages/orderManage/serviceOrder/comp/detailInformation/index.tsx
0 → 100644
浏览文件 @
a38d7f4f
import
{
useState
}
from
'react'
;
import
{
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
// 表格数据类型
type
TableType
=
any
;
function
DetailInformation
()
{
// 表格数据
const
[
tableData
]
=
useState
<
TableType
>
([{
id
:
1
}]);
// 表格结构
const
columns
:
ColumnsType
<
TableType
[
0
]
>
=
[
{
title
:
'商品'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'单价(元)'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'数量'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'订单状态'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'实收款'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
];
return
(
<
div
className=
{
'detail-information'
}
>
<
div
className=
{
'detail-title'
}
>
订单明细
</
div
>
<
div
className=
{
'detail-text'
}
>
<
span
className=
{
'item'
}
>
订单编号:UD202302181041156087
</
span
>
<
span
className=
{
'item'
}
>
创建时间:2023-02-18 10:41:16
</
span
>
<
span
className=
{
'item'
}
>
合同编号:UAV202334741131
</
span
>
</
div
>
<
Table
style=
{
{
margin
:
'20px auto'
,
width
:
'90%'
}
}
size=
'small'
dataSource=
{
tableData
}
columns=
{
columns
}
rowKey=
'id'
bordered
pagination=
{
false
}
// rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
/>
</
div
>
);
}
export
default
DetailInformation
;
src/pages/orderManage/serviceOrder/comp/detailPurchaser/index.tsx
0 → 100644
浏览文件 @
a38d7f4f
import
React
from
'react'
;
import
{
Button
,
Image
}
from
'antd'
;
function
DetailPurchaser
()
{
return
(
<
div
className=
{
'detail-purchaser detail-half'
}
>
<
div
className=
{
'detail-title'
}
>
买家信息
</
div
>
<
div
className=
{
'detail-text'
}
>
UID: UID4460817
</
div
>
<
div
className=
{
'detail-text'
}
>
企业: 浙江科比特创新科技有限公司
</
div
>
<
div
className=
{
'detail-text'
}
>
备注: 测试单,不用管
</
div
>
<
div
className=
{
'detail-title'
}
>
合同信息
</
div
>
<
div
className=
{
'detail-text'
}
>
合同编号: UAV202334741131
</
div
>
<
div
className=
{
'detail-text'
}
>
合同状态: 已归档
</
div
>
<
div
className=
{
'detail-text'
}
>
合同操作:
<
Button
type=
{
'link'
}
>
平台签署
</
Button
>
<
Button
type=
{
'link'
}
>
查看
</
Button
>
<
Button
type=
{
'link'
}
>
下载
</
Button
>
</
div
>
<
div
className=
{
'detail-title'
}
>
付款凭证
</
div
>
<
div
className=
{
'detail-text'
}
>
预付款:
</
div
>
<
div
className=
{
'detail-image'
}
>
{
[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
].
map
((
i
,
j
)
=>
(
<
Image
key=
{
j
}
className=
{
'image'
}
src=
{
i
}
alt=
'付款凭证'
/>
))
}
</
div
>
<
div
className=
{
'detail-text'
}
>
尾款:
</
div
>
<
div
className=
{
'detail-image'
}
>
{
[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
].
map
((
i
,
j
)
=>
(
<
Image
key=
{
j
}
className=
{
'image'
}
src=
{
i
}
alt=
'付款凭证'
/>
))
}
</
div
>
<
div
className=
{
'detail-text'
}
>
全款:
</
div
>
<
div
className=
{
'detail-image'
}
>
{
[
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
'https://pad-video-x.oss-cn-shenzhen.aliyuncs.com/file/infrastructure-05-05.png'
,
].
map
((
i
,
j
)
=>
(
<
Image
key=
{
j
}
className=
{
'image'
}
src=
{
i
}
alt=
'付款凭证'
/>
))
}
</
div
>
</
div
>
);
}
export
default
DetailPurchaser
;
src/pages/orderManage/serviceOrder/detail/index.scss
0 → 100644
浏览文件 @
a38d7f4f
.order-detail
{
position
:
relative
;
box-sizing
:
border-box
;
.order-head
{
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
.head-text
{
font-size
:
13px
;
font-weight
:
600
;
color
:
#000000
;
div
{
margin-bottom
:
10px
;
span
{
margin-right
:
20px
;
}
}
}
}
.detail-wrap
{
position
:
relative
;
width
:
100%
;
display
:
flex
;
justify-content
:
flex-start
;
flex-wrap
:
wrap
;
margin-top
:
15px
;
padding-bottom
:
100px
;
.detail-information
{
margin-top
:
10px
;
width
:
100%
;
}
.detail-half
{
width
:
50%
;
}
.detail-title
{
font-size
:
13px
;
font-weight
:
600
;
color
:
#000000
;
margin-bottom
:
15px
;
margin-top
:
20px
;
}
.detail-title
:first-child
{
margin-top
:
0
;
}
.detail-text
{
margin-bottom
:
10px
;
.item
{
margin-right
:
20px
;
}
}
.detail-image
{
display
:
flex
;
justify-content
:
flex-start
;
margin-left
:
56px
;
margin-top
:
-20px
;
margin-bottom
:
10px
;
.image
{
width
:
68px
;
height
:
68px
;
//margin-right: 10px;
}
.ant-image
{
margin-right
:
10px
;
}
}
}
}
src/pages/orderManage/serviceOrder/detail/index.tsx
0 → 100644
浏览文件 @
a38d7f4f
import
{
useEffect
}
from
'react'
;
import
{
useNavigate
,
useSearchParams
}
from
'react-router-dom'
;
import
{
Button
}
from
'antd'
;
import
'./index.scss'
;
import
DetailDelivery
from
'~/pages/orderManage/serviceOrder/comp/detailDelivery'
;
import
DetailPurchaser
from
'~/pages/orderManage/serviceOrder/comp/detailPurchaser'
;
import
DetailInformation
from
'~/pages/orderManage/serviceOrder/comp/detailInformation'
;
function
ServiceOrderDetail
()
{
// 路由钩子
const
navigate
=
useNavigate
();
// 参数钩子
const
[
searchParams
]
=
useSearchParams
();
// 接收到的参数
const
id
=
searchParams
.
get
(
'id'
);
// 返回上一页
const
handleBack
=
()
=>
{
navigate
(
-
1
);
};
// componentDidMount
useEffect
(()
=>
{
console
.
log
(
'拿到的id是 --->'
,
id
);
},
[
id
]);
return
(
<
div
className=
{
'order-detail'
}
>
<
div
className=
{
'order-head'
}
>
<
div
className=
'head-text'
>
<
div
>
<
span
>
订单编号:R2023051916330461
</
span
>
<
span
>
合同编号:UAV202334741131
</
span
>
</
div
>
<
div
>
<
span
>
当前状态:交易完成
</
span
>
<
span
>
创建时间:2023-02-18 10:41:16
</
span
>
</
div
>
</
div
>
<
Button
type=
{
'primary'
}
onClick=
{
()
=>
handleBack
()
}
>
返回
</
Button
>
</
div
>
<
div
className=
{
'detail-wrap'
}
>
<
DetailPurchaser
/>
<
DetailDelivery
/>
<
DetailInformation
/>
</
div
>
</
div
>
);
}
export
default
ServiceOrderDetail
;
src/pages/orderManage/serviceOrder/index.tsx
浏览文件 @
a38d7f4f
import
React
from
'react'
;
import
{
useState
}
from
'react'
;
import
SearchBox
from
'~/components/search-box'
;
import
{
Button
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
useNavigate
}
from
'react-router-dom'
;
import
qs
from
'query-string'
;
// 表格数据类型
type
TableType
=
any
;
// 订单状态搜索列表
const
statusCodeButtonList
=
[
{
value
:
-
1
,
label
:
'全部订单'
},
{
value
:
0
,
label
:
'沟通意向'
},
{
value
:
1
,
label
:
'签约付款'
},
{
value
:
2
,
label
:
'待发货'
},
{
value
:
3
,
label
:
'待收货'
},
{
value
:
4
,
label
:
'已完成'
},
{
value
:
5
,
label
:
'已关闭'
},
];
function
ServiceOrderView
()
{
return
<
div
>
ServiceOrderView
</
div
>;
// 路由钩子
const
navigate
=
useNavigate
();
// 当前选择的是第几个按钮
const
[
statusCodeButtonIndex
,
setStatusCodeButtonIndex
]
=
useState
<
number
>
(
0
);
// 表格分页配置
const
[
pagination
]
=
useState
({
total
:
0
,
pageSize
:
10
,
current
:
1
,
totalPage
:
0
,
});
// 表格数据
const
[
tableData
]
=
useState
<
TableType
>
([{
id
:
1
}]);
// 订单状态筛选
const
statusChangeEvent
=
(
i
:
number
)
=>
{
console
.
log
(
'订单状态筛选 --->'
,
i
);
setStatusCodeButtonIndex
(
i
);
};
// 跳转订单详情
const
handleDetail
=
(
record
:
TableType
[
0
])
=>
{
console
.
log
(
'跳转订单详情 --->'
,
record
.
id
);
navigate
(
`/orderManage/serviceOrder/detail?
${
qs
.
stringify
({
id
:
record
.
id
})}
`
);
};
// 表格结构
const
columns
:
ColumnsType
<
TableType
[
0
]
>
=
[
{
title
:
'商品'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'单价(元)'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'数量'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'买家'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'订单状态'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'实收款'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'相关运营'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'推荐人'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'订单交期'
,
dataIndex
:
'userName'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'备注'
,
dataIndex
:
'remark'
,
align
:
'center'
,
render
:
(
_text
,
_record
)
=>
`--`
,
},
{
title
:
'操作'
,
dataIndex
:
'action'
,
align
:
'center'
,
fixed
:
'right'
,
render
:
(
_text
,
record
)
=>
(
<>
<
Button
type=
{
'link'
}
onClick=
{
()
=>
handleDetail
(
record
)
}
>
详情
</
Button
>
</>
),
},
];
return
(
<>
<
SearchBox
search=
{
[
{
label
:
'订单编号'
,
name
:
'keyword'
,
type
:
'input'
,
placeholder
:
'请输入订单编号'
,
},
{
label
:
'买家账号'
,
name
:
'keyword2'
,
type
:
'input'
,
placeholder
:
'请输入用户账号'
,
},
{
label
:
'相关销售'
,
name
:
'saleId'
,
type
:
'Select'
,
placeholder
:
'请选择相关销售'
,
options
:
[],
},
{
label
:
'时间'
,
name
:
'time'
,
type
:
'rangePicker'
,
placeholder
:
'请选择创建时间'
,
},
]
}
searchData=
{
(
e
:
any
)
=>
console
.
log
(
'提交数据 --->'
,
e
)
}
sufFixBtn=
{
<>
{
statusCodeButtonList
?.
map
((
i
,
j
)
=>
{
return
(
<
Button
key=
{
j
}
type=
{
j
===
statusCodeButtonIndex
?
'primary'
:
'default'
}
onClick=
{
()
=>
statusChangeEvent
(
j
)
}
style=
{
{
marginTop
:
'5px'
}
}
>
{
i
.
label
}
</
Button
>
);
})
}
</>
}
/>
<
Table
size=
'small'
dataSource=
{
tableData
}
columns=
{
columns
}
rowKey=
'id'
scroll=
{
{
x
:
1200
}
}
pagination=
{
{
total
:
pagination
.
total
,
pageSize
:
pagination
.
pageSize
,
current
:
pagination
.
current
,
showSizeChanger
:
true
,
showQuickJumper
:
true
,
// onChange: (page: number, pageSize: number) =>
// paginationChange(page, pageSize),
showTotal
:
(
total
,
range
)
=>
`当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`
,
}
}
// rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
/>
</>
);
}
export
default
ServiceOrderView
;
src/pages/pointManage/divideOrder/comp/divideAddEditModal/index.tsx
浏览文件 @
a38d7f4f
import
{
Form
,
Input
,
message
,
Modal
,
Radio
,
Select
}
from
"antd"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
debounce
}
from
"lodash"
;
import
{
PointManageAPI
}
from
"@/api"
;
import
{
Form
,
Input
,
message
,
Modal
,
Radio
,
Select
}
from
'antd'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
debounce
}
from
'lodash'
;
import
{
PointManageAPI
}
from
'@/api'
;
// 传参类型
interface
propType
{
...
...
@@ -60,7 +60,7 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => {
pageSize
:
pagination
.
pageSize
,
...
value
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
const
{
list
,
pageNo
,
totalCount
,
pageSize
,
totalPage
}
=
res
.
result
;
// 解构
const
arr
=
list
?.
map
((
i
)
=>
({
value
:
i
.
id
,
...
...
@@ -111,17 +111,16 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => {
...
values
,
orderId
:
orderData
.
orderId
,
orderNO
:
orderData
.
orderNo
,
uid
:
mallUserList
.
find
((
i
)
=>
i
.
value
===
values
.
mallUserId
)?.
uid
||
""
,
userName
:
mallUserList
.
find
((
i
)
=>
i
.
value
===
values
.
mallUserId
)?.
userName
||
""
,
uid
:
mallUserList
.
find
((
i
)
=>
i
.
value
===
values
.
mallUserId
)?.
uid
||
''
,
userName
:
mallUserList
.
find
((
i
)
=>
i
.
value
===
values
.
mallUserId
)?.
userName
||
''
,
ruleType
:
1
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
push
({
...
data
,
...
res
?.
result
,
});
message
.
success
(
data
?.
id
?
"修改成功"
:
"添加成功"
).
then
();
message
.
success
(
data
?.
id
?
'修改成功'
:
'添加成功'
).
then
();
handleCancel
();
}
};
...
...
@@ -139,37 +138,31 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => {
setDivideMethod
(
data
.
proportionMode
);
},
[
open
]);
return
(
<
Modal
open=
{
open
}
title=
{
title
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
destroyOnClose
>
<
Modal
open=
{
open
}
title=
{
title
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
destroyOnClose
>
<
Form
name=
"addForm"
name=
'addForm'
form=
{
form
}
labelAlign=
"right"
labelAlign=
'right'
labelCol=
{
{
span
:
5
}
}
wrapperCol=
{
{
span
:
10
}
}
>
<
Form
.
Item
label=
"其它分成对象"
name=
"proportionObjName"
rules=
{
[{
required
:
true
,
message
:
"请输入其它分成对象"
}]
}
label=
'其它分成对象'
name=
'proportionObjName'
rules=
{
[{
required
:
true
,
message
:
'请输入其它分成对象'
}]
}
>
<
Input
placeholder=
"请输入其它分成对象"
maxLength=
{
20
}
/>
<
Input
placeholder=
'请输入其它分成对象'
maxLength=
{
20
}
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"分成方式"
name=
"proportionMode"
rules=
{
[{
required
:
true
,
message
:
"请选择分成方式"
}]
}
label=
'分成方式'
name=
'proportionMode'
rules=
{
[{
required
:
true
,
message
:
'请选择分成方式'
}]
}
initialValue=
{
divideMethod
}
>
<
Radio
.
Group
options=
{
[
{
label
:
"分成比例"
,
value
:
0
},
{
label
:
"差价分成"
,
value
:
1
,
disabled
:
true
},
{
label
:
'分成比例'
,
value
:
0
},
{
label
:
'差价分成'
,
value
:
1
,
disabled
:
true
},
]
}
onChange=
{
({
target
:
{
value
}
})
=>
setDivideMethod
(
value
)
}
/>
...
...
@@ -177,44 +170,39 @@ const DivideAddEditModal: React.FC<propType> = (props: propType) => {
{
divideMethod
===
0
&&
(
<>
<
Form
.
Item
label=
"分成参数"
name=
"proportionRate"
label=
'分成参数'
name=
'proportionRate'
rules=
{
[
{
required
:
true
,
message
:
"请输入分成额度百分比"
},
{
required
:
true
,
message
:
'请输入分成额度百分比'
},
// 只能输入0.1到100.0的一位小数,不能大于100.0
{
pattern
:
/^
(
100
(\.
0
)?
|
[
1-9
]?\d(\.\d)?)
$/
,
message
:
"只能输入0.1到100.0的一位小数"
,
message
:
'只能输入0.1到100.0的一位小数'
,
},
]
}
>
<
Input
placeholder=
"请输入分成额度百分比"
maxLength=
{
20
}
type=
"number"
suffix=
"%"
/>
<
Input
placeholder=
'请输入分成额度百分比'
maxLength=
{
20
}
type=
'number'
suffix=
'%'
/>
</
Form
.
Item
>
<
div
style=
{
{
margin
:
"0 0 10px 60px"
}
}
>
<
div
style=
{
{
margin
:
'0 0 10px 60px'
}
}
>
说明:分成比例基数以订单金额减去相关渠道利润的得数为基准
</
div
>
</>
)
}
<
Form
.
Item
label=
"分成用户"
name=
"mallUserId"
rules=
{
[{
required
:
true
,
message
:
"请选择分成用户"
}]
}
label=
'分成用户'
name=
'mallUserId'
rules=
{
[{
required
:
true
,
message
:
'请选择分成用户'
}]
}
wrapperCol=
{
{
span
:
14
}
}
>
<
Select
placeholder=
"请选择分成用户"
placeholder=
'请选择分成用户'
options=
{
mallUserList
}
allowClear
showSearch
filterOption=
{
(
input
,
option
)
=>
(
option
?.
label
??
""
).
toLowerCase
().
includes
(
input
.
toLowerCase
())
(
option
?.
label
??
''
).
toLowerCase
().
includes
(
input
.
toLowerCase
())
}
optionFilterProp=
"label"
optionFilterProp=
'label'
onPopupScroll=
{
handlePopupScroll
}
/>
</
Form
.
Item
>
...
...
src/pages/pointManage/divideOrder/comp/divideSetting/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Button
,
Form
,
message
,
Modal
,
Select
,
Table
}
from
"antd"
;
import
{
ColumnsType
}
from
"antd/es/table"
;
import
{
PlusOutlined
}
from
"@ant-design/icons"
;
import
DivideAddEditModal
from
"@/pages/pointManage/divideOrder/comp/divideAddEditModal"
;
import
{
PointManageAPI
}
from
"@/api"
;
import
{
OrderBonusListByOrderIdType
}
from
"@/api/interface/pointManageType"
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Button
,
Form
,
message
,
Modal
,
Select
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
DivideAddEditModal
from
'@/pages/pointManage/divideOrder/comp/divideAddEditModal'
;
import
{
PointManageAPI
}
from
'@/api'
;
import
{
OrderBonusListByOrderIdType
}
from
'@/api/interface/pointManageType'
;
// 传参类型
interface
propType
{
...
...
@@ -15,11 +15,9 @@ interface propType {
isEdit
:
boolean
;
}
// 列表的类型
type
TableType
=
(
ReturnType
<
OrderBonusListByOrderIdType
>
extends
Promise
<
infer
T
>
type
TableType
=
(
ReturnType
<
OrderBonusListByOrderIdType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
][
"defaultList"
];
:
never
)[
'result'
][
'defaultList'
];
export
const
DivideSetting
:
React
.
FC
<
propType
>
=
(
props
:
propType
)
=>
{
// 组件默认值
...
...
@@ -31,9 +29,7 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
// 表单钩子
const
[
form
]
=
Form
.
useForm
();
// 规则列表
const
[
ruleNameList
,
setRuleNameList
]
=
useState
<
{
label
:
string
;
value
:
number
}[]
>
([]);
const
[
ruleNameList
,
setRuleNameList
]
=
useState
<
{
label
:
string
;
value
:
number
}[]
>
([]);
// 默认表格数据
const
[
defaultTableData
,
setDefaultTableData
]
=
useState
<
TableType
>
([]);
// 扩展表格数据
...
...
@@ -72,14 +68,14 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
// 确定发放积分
const
handleConfirm
=
()
=>
{
Modal
.
confirm
({
title
:
"提示"
,
content
:
"确认一键发放积分给相关用户吗?操作不可逆,请谨慎操作"
,
title
:
'提示'
,
content
:
'确认一键发放积分给相关用户吗?操作不可逆,请谨慎操作'
,
onOk
:
async
()
=>
{
const
res
=
await
PointManageAPI
.
DistributeMallOrderBonus
({
orderId
:
data
.
orderId
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
message
.
success
(
"发放成功"
).
then
();
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'发放成功'
).
then
();
handleCancel
();
}
},
...
...
@@ -88,24 +84,22 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
// 删除数据
const
handleDelete
=
(
record
:
any
)
=>
{
Modal
.
confirm
({
title
:
"提示"
,
content
:
"删除后此数据将会丢失,确定删除吗?"
,
title
:
'提示'
,
content
:
'删除后此数据将会丢失,确定删除吗?'
,
onOk
:
()
=>
{
setExtendTableData
(
extendTableData
?.
filter
((
i
)
=>
i
.
index
!==
record
.
index
)
);
message
.
success
(
"操作成功"
).
then
();
setExtendTableData
(
extendTableData
?.
filter
((
i
)
=>
i
.
index
!==
record
.
index
));
message
.
success
(
'操作成功'
).
then
();
},
});
};
// 获取分成对象列表
const
getOrderBonusListRule
=
async
()
=>
{
const
res
=
await
PointManageAPI
.
OrderBonusListRule
();
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
setRuleNameList
(
res
.
result
?.
map
((
i
)
=>
{
return
{
label
:
i
.
ruleName
,
value
:
i
.
id
};
})
})
,
);
}
};
...
...
@@ -114,14 +108,14 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
const
res
=
await
PointManageAPI
.
OrderBonusListByOrderId
({
orderId
:
data
?.
orderId
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
const
{
bonusRuleDTO
,
extendList
}
=
res
.
result
;
// 设置扩展规则数据
setExtendTableData
(
extendList
?.
map
((
i
,
j
)
=>
({
...
i
,
index
:
j
})));
// 判断是否有默认规则
if
(
!
bonusRuleDTO
?.
id
)
return
;
// 设置规则名称回显
form
.
setFieldValue
(
"ruleName"
,
bonusRuleDTO
.
id
);
form
.
setFieldValue
(
'ruleName'
,
bonusRuleDTO
.
id
);
// 获取规则列表
await
getOrderBonusBuildMall
(
bonusRuleDTO
.
id
);
}
...
...
@@ -132,7 +126,7 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
proportionRuleId
,
orderId
:
data
?.
orderId
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
// 强行设置索引
setDefaultTableData
(
res
.
result
.
map
((
i
,
j
)
=>
({
...
i
,
index
:
j
})));
}
...
...
@@ -147,12 +141,10 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
return
val
;
}
return
i
;
})
})
,
);
}
else
{
setExtendTableData
(
[...
extendTableData
,
val
].
map
((
i
,
j
)
=>
({
...
i
,
index
:
j
}))
);
setExtendTableData
([...
extendTableData
,
val
].
map
((
i
,
j
)
=>
({
...
i
,
index
:
j
})));
}
};
// 提交数据
...
...
@@ -161,8 +153,8 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
...
defaultTableData
,
...
extendTableData
,
]);
if
(
res
&&
res
.
code
===
"200"
)
{
message
.
success
(
"操作成功"
).
then
();
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
).
then
();
handleCancel
();
}
};
...
...
@@ -178,63 +170,61 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
// 通用表格列
const
defaultColumns
:
ColumnsType
<
TableType
[
0
]
>
=
[
{
title
:
"分成对象"
,
dataIndex
:
"proportionObjName"
,
align
:
"center"
,
title
:
'分成对象'
,
dataIndex
:
'proportionObjName'
,
align
:
'center'
,
},
{
title
:
"分成方式"
,
dataIndex
:
"proportionMode"
,
align
:
"center"
,
render
:
(
text
)
=>
(
text
===
0
?
"比例分成"
:
"差额分成"
),
title
:
'分成方式'
,
dataIndex
:
'proportionMode'
,
align
:
'center'
,
render
:
(
text
)
=>
(
text
===
0
?
'比例分成'
:
'差额分成'
),
},
{
title
:
"分成参数"
,
dataIndex
:
"proportionRate"
,
align
:
"center"
,
title
:
'分成参数'
,
dataIndex
:
'proportionRate'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
record
.
proportionMode
===
0
?
`
${(
Number
(
text
)
*
100
).
toFixed
(
1
)}
%`
||
"/"
:
"/"
,
record
.
proportionMode
===
0
?
`
${(
Number
(
text
)
*
100
).
toFixed
(
1
)}
%`
||
'/'
:
'/'
,
},
{
title
:
"分成用户名称"
,
dataIndex
:
"userName"
,
align
:
"center"
,
title
:
'分成用户名称'
,
dataIndex
:
'userName'
,
align
:
'center'
,
},
{
title
:
"分成用户UID"
,
dataIndex
:
"uid"
,
align
:
"center"
,
title
:
'分成用户UID'
,
dataIndex
:
'uid'
,
align
:
'center'
,
},
{
title
:
"渠道等级"
,
dataIndex
:
"channelName"
,
align
:
"center"
,
render
:
(
text
)
=>
text
||
"无"
,
title
:
'渠道等级'
,
dataIndex
:
'channelName'
,
align
:
'center'
,
render
:
(
text
)
=>
text
||
'无'
,
},
{
title
:
"分成积分数额"
,
dataIndex
:
"scoreAmount"
,
align
:
"center"
,
title
:
'分成积分数额'
,
dataIndex
:
'scoreAmount'
,
align
:
'center'
,
},
];
// 扩展表格列
const
extendColumns
:
ColumnsType
<
TableType
[
0
]
>
=
[
{
title
:
"其它分成对象"
,
dataIndex
:
"proportionObjName"
,
align
:
"center"
,
title
:
'其它分成对象'
,
dataIndex
:
'proportionObjName'
,
align
:
'center'
,
},
...
defaultColumns
.
slice
(
1
,
5
),
...
defaultColumns
.
slice
(
6
),
{
title
:
"操作"
,
align
:
"center"
,
title
:
'操作'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
<
div
style=
{
{
display
:
"flex"
,
justifyContent
:
"center"
}
}
>
<
div
style=
{
{
display
:
'flex'
,
justifyContent
:
'center'
}
}
>
<
Button
type=
"link"
type=
'link'
onClick=
{
()
=>
{
setEditData
(
record
);
setAddEditVisible
(
true
);
...
...
@@ -242,7 +232,7 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
>
编辑
</
Button
>
<
Button
type=
"link"
onClick=
{
()
=>
handleDelete
(
record
)
}
>
<
Button
type=
'link'
onClick=
{
()
=>
handleDelete
(
record
)
}
>
删除
</
Button
>
</
div
>
...
...
@@ -258,25 +248,25 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
onOk=
{
handleOk
}
destroyOnClose
width=
{
768
}
wrapClassName=
"divide-setting-modal"
okText=
{
!
isEdit
?
"确定"
:
"确定一键发放积分"
}
wrapClassName=
'divide-setting-modal'
okText=
{
!
isEdit
?
'确定'
:
'确定一键发放积分'
}
>
<
Form
name=
"addForm"
name=
'addForm'
form=
{
form
}
labelAlign=
"right"
labelAlign=
'right'
disabled=
{
isEdit
}
// layout="inline"
>
<
div
className=
"divide-title"
>
一、通用规则
</
div
>
<
div
className=
'divide-title'
>
一、通用规则
</
div
>
<
Form
.
Item
label=
"规则名称"
name=
"ruleName"
rules=
{
[{
required
:
true
,
message
:
"请选择规则名称"
}]
}
label=
'规则名称'
name=
'ruleName'
rules=
{
[{
required
:
true
,
message
:
'请选择规则名称'
}]
}
wrapperCol=
{
{
span
:
6
}
}
>
<
Select
placeholder=
"请选择规则名称"
placeholder=
'请选择规则名称'
options=
{
ruleNameList
}
allowClear
onChange=
{
(
value
)
=>
{
...
...
@@ -289,35 +279,31 @@ export const DivideSetting: React.FC<propType> = (props: propType) => {
/>
</
Form
.
Item
>
<
Table
size=
"small"
size=
'small'
dataSource=
{
defaultTableData
}
columns=
{
defaultColumns
}
rowKey=
"index"
rowKey=
'index'
bordered
style=
{
{
marginBottom
:
"-40px"
}
}
style=
{
{
marginBottom
:
'-40px'
}
}
/>
<
div
className=
"divide-title"
>
二、扩展规则
</
div
>
<
div
className=
'divide-title'
>
二、扩展规则
</
div
>
{
!
isEdit
&&
(
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
"primary"
onClick=
{
()
=>
setAddEditVisible
(
true
)
}
>
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
'primary'
onClick=
{
()
=>
setAddEditVisible
(
true
)
}
>
添加分成对象
</
Button
>
)
}
<
Table
size=
"small"
size=
'small'
dataSource=
{
extendTableData
}
columns=
{
!
isEdit
?
extendColumns
:
extendColumns
.
slice
(
0
,
-
1
)
}
rowKey=
"index"
rowKey=
'index'
bordered
style=
{
{
marginTop
:
"10px"
}
}
style=
{
{
marginTop
:
'10px'
}
}
/>
</
Form
>
</
Modal
>
<
DivideAddEditModal
title=
{
editData
?
"编辑分成对象"
:
"添加分成对象"
}
title=
{
editData
?
'编辑分成对象'
:
'添加分成对象'
}
open=
{
addEditVisible
}
data=
{
editData
}
orderData=
{
data
}
...
...
src/pages/pointManage/divideOrder/index.scss
浏览文件 @
a38d7f4f
.divide-setting-modal
{
.divide-setting-modal
{
.divide-title
{
font-size
:
14px
;
margin-bottom
:
10px
;
...
...
src/pages/pointManage/divideRules/comp/divideAddEditModal/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Button
,
Form
,
Input
,
message
,
Modal
,
Select
,
Switch
,
Table
,
}
from
"antd"
;
import
{
ColumnsType
}
from
"antd/es/table"
;
import
{
PlusOutlined
}
from
"@ant-design/icons"
;
import
DivideAddEditObject
from
"../divideAddEditObject"
;
import
{
AddAndEditBonusRuleType
,
BonusRuleListQueryType
,
}
from
"@/api/interface/pointManageType"
;
import
{
PointManageAPI
}
from
"@/api"
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Button
,
Form
,
Input
,
message
,
Modal
,
Select
,
Switch
,
Table
}
from
'antd'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
DivideAddEditObject
from
'../divideAddEditObject'
;
import
{
AddAndEditBonusRuleType
,
BonusRuleListQueryType
}
from
'@/api/interface/pointManageType'
;
import
{
PointManageAPI
}
from
'@/api'
;
// 编辑的数据类型
type
DataType
=
(
ReturnType
<
BonusRuleListQueryType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
][
"list"
][
0
];
:
never
)[
'result'
][
'list'
][
0
];
type
ReqType
=
Parameters
<
AddAndEditBonusRuleType
>
[
0
];
// 传参类型
interface
propType
{
...
...
@@ -35,22 +23,20 @@ interface propType {
export
const
DivideAddEditModal
:
React
.
FC
<
propType
>
=
(
props
:
propType
)
=>
{
// 组件默认值
DivideAddEditModal
.
defaultProps
=
{
data
:
{
bonusSet
:
[],
id
:
undefined
,
ruleName
:
""
},
data
:
{
bonusSet
:
[],
id
:
undefined
,
ruleName
:
''
},
};
// 参数
const
{
title
,
open
,
closed
,
data
,
isEdit
}
=
props
;
// 表单钩子
const
[
form
]
=
Form
.
useForm
();
// 表格数据
const
[
tableData
,
setTableData
]
=
useState
<
DataType
[
"bonusSet"
]
>
([]);
const
[
tableData
,
setTableData
]
=
useState
<
DataType
[
'bonusSet'
]
>
([]);
// 需要编辑的数据
const
[
editData
,
setEditData
]
=
useState
<
any
>
();
// 添加编辑弹窗
const
[
addEditVisible
,
setAddEditVisible
]
=
useState
<
boolean
>
(
false
);
// 分成对象列表
const
[
propObjCode
,
setPropObjCode
]
=
useState
<
{
label
:
string
;
value
:
number
}[]
>
([]);
const
[
propObjCode
,
setPropObjCode
]
=
useState
<
{
label
:
string
;
value
:
number
}[]
>
([]);
// 关闭弹窗
const
handleCancel
=
()
=>
{
form
.
resetFields
();
...
...
@@ -59,28 +45,28 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
// 删除数据
const
handleDelete
=
(
record
:
any
)
=>
{
Modal
.
confirm
({
title
:
"提示"
,
content
:
"删除后此数据将会丢失,确定删除吗?"
,
title
:
'提示'
,
content
:
'删除后此数据将会丢失,确定删除吗?'
,
onOk
:
()
=>
{
// 删除数据
setTableData
(
tableData
.
filter
((
i
)
=>
i
.
id
!==
record
.
id
));
message
.
success
(
"操作成功"
).
then
();
message
.
success
(
'操作成功'
).
then
();
},
});
};
// 获取分成对象列表
const
getListProportionObject
=
async
()
=>
{
const
res
=
await
PointManageAPI
.
ListProportionObject
();
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
setPropObjCode
(
res
.
result
?.
map
((
i
)
=>
{
return
{
label
:
i
.
name
,
value
:
i
.
code
};
})
})
,
);
}
};
// 追加列表数据
const
handlePush
=
(
val
:
DataType
[
"bonusSet"
][
0
])
=>
{
const
handlePush
=
(
val
:
DataType
[
'bonusSet'
][
0
])
=>
{
// 原来列表中没有的数据就追加,有的话就替换
if
(
tableData
.
some
((
i
)
=>
val
?.
id
===
i
.
id
))
{
setTableData
(
...
...
@@ -89,7 +75,7 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
return
val
;
}
return
i
;
})
})
,
);
}
else
{
setTableData
([...
tableData
,
val
]);
...
...
@@ -120,44 +106,41 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
// 提交数据
const
handleSubmit
=
async
(
val
:
ReqType
)
=>
{
const
res
=
await
PointManageAPI
.
AddAndEditBonusRule
(
val
);
if
(
res
&&
res
.
code
===
"200"
)
{
message
.
success
(
"操作成功"
).
then
();
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
).
then
();
closed
();
}
};
// 通用表格列
const
defaultColumns
:
ColumnsType
<
DataType
[
"bonusSet"
][
0
]
>
=
[
const
defaultColumns
:
ColumnsType
<
DataType
[
'bonusSet'
][
0
]
>
=
[
{
title
:
"分成对象"
,
dataIndex
:
"propObjCode"
,
align
:
"center"
,
render
:
(
text
)
=>
propObjCode
.
find
((
i
)
=>
i
.
value
===
text
)?.
label
||
text
,
title
:
'分成对象'
,
dataIndex
:
'propObjCode'
,
align
:
'center'
,
render
:
(
text
)
=>
propObjCode
.
find
((
i
)
=>
i
.
value
===
text
)?.
label
||
text
,
},
{
title
:
"分成方式"
,
dataIndex
:
"proportionMode"
,
align
:
"center"
,
render
:
(
text
)
=>
(
text
===
0
?
"比例分成"
:
"差价分成"
),
title
:
'分成方式'
,
dataIndex
:
'proportionMode'
,
align
:
'center'
,
render
:
(
text
)
=>
(
text
===
0
?
'比例分成'
:
'差价分成'
),
},
{
title
:
"分成参数"
,
dataIndex
:
"proportionParam"
,
align
:
"center"
,
title
:
'分成参数'
,
dataIndex
:
'proportionParam'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
record
.
proportionMode
===
0
?
`
${(
Number
(
text
)
*
100
).
toFixed
(
1
)}
%`
||
"/"
:
"/"
,
record
.
proportionMode
===
0
?
`
${(
Number
(
text
)
*
100
).
toFixed
(
1
)}
%`
||
'/'
:
'/'
,
},
{
title
:
"操作"
,
dataIndex
:
"id"
,
align
:
"center"
,
title
:
'操作'
,
dataIndex
:
'id'
,
align
:
'center'
,
width
:
100
,
render
:
(
text
,
record
)
=>
(
<
div
style=
{
{
display
:
"flex"
,
justifyContent
:
"center"
}
}
>
<
div
style=
{
{
display
:
'flex'
,
justifyContent
:
'center'
}
}
>
<
Button
type=
"link"
type=
'link'
onClick=
{
()
=>
{
setEditData
(
record
);
setAddEditVisible
(
true
);
...
...
@@ -165,7 +148,7 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
>
编辑
</
Button
>
<
Button
type=
"link"
onClick=
{
()
=>
handleDelete
(
record
)
}
>
<
Button
type=
'link'
onClick=
{
()
=>
handleDelete
(
record
)
}
>
删除
</
Button
>
</
div
>
...
...
@@ -190,12 +173,12 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
// onOk={handleOk}
destroyOnClose
width=
{
768
}
wrapClassName=
"divide-setting-modal"
wrapClassName=
'divide-setting-modal'
footer=
{
!
isEdit
?
(
<>
<
Button
onClick=
{
handleCancel
}
>
取消
</
Button
>
<
Button
type=
"primary"
onClick=
{
handleOk
}
>
<
Button
type=
'primary'
onClick=
{
handleOk
}
>
确定
</
Button
>
</>
...
...
@@ -203,52 +186,48 @@ export const DivideAddEditModal: React.FC<propType> = (props: propType) => {
}
>
<
Form
name=
"addForm"
name=
'addForm'
form=
{
form
}
labelAlign=
"right"
labelAlign=
'right'
disabled=
{
isEdit
}
// layout="inline"
>
<
div
className=
"divide-title"
>
一、基本信息
</
div
>
<
div
className=
'divide-title'
>
一、基本信息
</
div
>
<
Form
.
Item
label=
"规则名称"
name=
"ruleName"
rules=
{
[{
required
:
true
,
message
:
"请输入规则名称"
}]
}
label=
'规则名称'
name=
'ruleName'
rules=
{
[{
required
:
true
,
message
:
'请输入规则名称'
}]
}
wrapperCol=
{
{
span
:
6
}
}
>
<
Input
placeholder=
"请输入规则名称"
maxLength=
{
20
}
allowClear
/>
<
Input
placeholder=
'请输入规则名称'
maxLength=
{
20
}
allowClear
/>
</
Form
.
Item
>
<
div
className=
"divide-title"
>
二、分成设置
</
div
>
<
div
className=
'divide-title'
>
二、分成设置
</
div
>
{
!
isEdit
&&
(
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
"primary"
onClick=
{
()
=>
setAddEditVisible
(
true
)
}
>
<
Button
icon=
{
<
PlusOutlined
/>
}
type=
'primary'
onClick=
{
()
=>
setAddEditVisible
(
true
)
}
>
添加分成对象
</
Button
>
)
}
<
Table
size=
"small"
size=
'small'
dataSource=
{
tableData
}
columns=
{
!
isEdit
?
defaultColumns
:
defaultColumns
.
slice
(
0
,
-
1
)
}
rowKey=
"id"
rowKey=
'id'
bordered
style=
{
{
margin
:
"10px 0 -40px 0"
}
}
style=
{
{
margin
:
'10px 0 -40px 0'
}
}
/>
<
Form
.
Item
label=
"是否默认规则"
name=
"defaultRule"
label=
'是否默认规则'
name=
'defaultRule'
wrapperCol=
{
{
span
:
6
}
}
valuePropName=
"checked"
valuePropName=
'checked'
initialValue=
{
false
}
>
<
Switch
checkedChildren=
"是"
unCheckedChildren=
"否"
/>
<
Switch
checkedChildren=
'是'
unCheckedChildren=
'否'
/>
</
Form
.
Item
>
</
Form
>
</
Modal
>
<
DivideAddEditObject
title=
{
editData
?
"编辑分成对象"
:
"添加分成对象"
}
title=
{
editData
?
'编辑分成对象'
:
'添加分成对象'
}
open=
{
addEditVisible
}
data=
{
editData
}
closed=
{
()
=>
{
...
...
src/pages/pointManage/divideRules/comp/divideAddEditObject/index.tsx
浏览文件 @
a38d7f4f
import
{
Form
,
Input
,
message
,
Modal
,
Radio
,
Select
}
from
"antd"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
BonusRuleListQueryType
}
from
"@/api/interface/pointManageType"
;
import
{
Form
,
Input
,
message
,
Modal
,
Radio
,
Select
}
from
'antd'
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
BonusRuleListQueryType
}
from
'@/api/interface/pointManageType'
;
// 编辑的数据类型
type
DataType
=
(
ReturnType
<
BonusRuleListQueryType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
][
"list"
][
0
];
:
never
)[
'result'
][
'list'
][
0
];
// 传参类型
interface
propType
{
...
...
@@ -15,7 +15,7 @@ interface propType {
push
:
any
;
data
?:
any
;
state
?:
{
propObjCode
?:
{
label
:
string
;
value
:
number
}[]
};
selected
:
DataType
[
"bonusSet"
];
selected
:
DataType
[
'bonusSet'
];
}
const
DivideAddEditObject
:
React
.
FC
<
propType
>
=
(
props
:
propType
)
=>
{
...
...
@@ -34,8 +34,8 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
const
[
proportionModeList
,
setProportionModeList
]
=
useState
<
{
label
:
string
;
value
:
number
;
disabled
?:
true
}[]
>
([
{
label
:
"分成比例"
,
value
:
0
},
{
label
:
"差价分成"
,
value
:
1
,
disabled
:
true
},
{
label
:
'分成比例'
,
value
:
0
},
{
label
:
'差价分成'
,
value
:
1
,
disabled
:
true
},
]);
// 关闭弹窗
const
handleCancel
=
()
=>
{
...
...
@@ -44,11 +44,11 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
// 重置分成方式
setDivideMethod
(
proportionModeList
[
0
].
value
);
// 重置分成对象
form
.
setFieldValue
(
"proportionMode"
,
0
);
form
.
setFieldValue
(
'proportionMode'
,
0
);
// 重置分成方式列表
setProportionModeList
([
{
label
:
"分成比例"
,
value
:
0
},
{
label
:
"差价分成"
,
value
:
1
,
disabled
:
true
},
{
label
:
'分成比例'
,
value
:
0
},
{
label
:
'差价分成'
,
value
:
1
,
disabled
:
true
},
]);
// 关闭弹窗
closed
();
...
...
@@ -80,24 +80,24 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
...
data
,
...
values
,
});
message
.
success
(
data
?.
id
?
"修改成功"
:
"添加成功"
).
then
();
message
.
success
(
data
?.
id
?
'修改成功'
:
'添加成功'
).
then
();
handleCancel
();
};
// 分成对象选择渠道监听
const
handleChange
=
(
e
:
number
)
=>
{
if
(
e
===
300
)
{
setProportionModeList
([
{
label
:
"分成比例"
,
value
:
0
,
disabled
:
true
},
{
label
:
"差价分成"
,
value
:
1
},
{
label
:
'分成比例'
,
value
:
0
,
disabled
:
true
},
{
label
:
'差价分成'
,
value
:
1
},
]);
form
.
setFieldValue
(
"proportionMode"
,
proportionModeList
[
1
].
value
);
form
.
setFieldValue
(
'proportionMode'
,
proportionModeList
[
1
].
value
);
setDivideMethod
(
proportionModeList
[
1
].
value
);
}
else
{
setProportionModeList
([
{
label
:
"分成比例"
,
value
:
0
},
{
label
:
"差价分成"
,
value
:
1
,
disabled
:
true
},
{
label
:
'分成比例'
,
value
:
0
},
{
label
:
'差价分成'
,
value
:
1
,
disabled
:
true
},
]);
form
.
setFieldValue
(
"proportionMode"
,
proportionModeList
[
0
].
value
);
form
.
setFieldValue
(
'proportionMode'
,
proportionModeList
[
0
].
value
);
setDivideMethod
(
proportionModeList
[
0
].
value
);
}
};
...
...
@@ -113,27 +113,21 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
setDivideMethod
(
data
.
proportionMode
);
},
[
open
]);
return
(
<
Modal
open=
{
open
}
title=
{
title
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
destroyOnClose
>
<
Modal
open=
{
open
}
title=
{
title
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
destroyOnClose
>
<
Form
name=
"addForm"
name=
'addForm'
form=
{
form
}
labelAlign=
"right"
labelAlign=
'right'
labelCol=
{
{
span
:
5
}
}
wrapperCol=
{
{
span
:
10
}
}
>
<
Form
.
Item
label=
"分成对象"
name=
"propObjCode"
rules=
{
[{
required
:
true
,
message
:
"请选择分成对象"
}]
}
label=
'分成对象'
name=
'propObjCode'
rules=
{
[{
required
:
true
,
message
:
'请选择分成对象'
}]
}
>
<
Select
placeholder=
"请选择分成对象"
placeholder=
'请选择分成对象'
options=
{
state
?.
propObjCode
?.
map
((
i
)
=>
({
label
:
i
.
label
,
value
:
i
.
value
,
...
...
@@ -143,9 +137,9 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"分成方式"
name=
"proportionMode"
rules=
{
[{
required
:
true
,
message
:
"请选择分成方式"
}]
}
label=
'分成方式'
name=
'proportionMode'
rules=
{
[{
required
:
true
,
message
:
'请选择分成方式'
}]
}
initialValue=
{
divideMethod
}
>
<
Radio
.
Group
...
...
@@ -156,25 +150,20 @@ const DivideAddEditObject: React.FC<propType> = (props: propType) => {
{
divideMethod
===
0
&&
(
<>
<
Form
.
Item
label=
"分成参数"
name=
"proportionParam"
label=
'分成参数'
name=
'proportionParam'
rules=
{
[
{
required
:
true
,
message
:
"请输入分成额度百分比"
},
{
required
:
true
,
message
:
'请输入分成额度百分比'
},
// 只能输入0.1到100.0的一位小数,不能大于100.0
{
pattern
:
/^
(
100
(\.
0
)?
|
[
1-9
]?\d(\.\d)?)
$/
,
message
:
"只能输入0.1到100.0的一位小数"
,
message
:
'只能输入0.1到100.0的一位小数'
,
},
]
}
>
<
Input
placeholder=
"请输入分成额度百分比"
maxLength=
{
10
}
type=
"number"
suffix=
"%"
/>
<
Input
placeholder=
'请输入分成额度百分比'
maxLength=
{
10
}
type=
'number'
suffix=
'%'
/>
</
Form
.
Item
>
<
div
style=
{
{
margin
:
"0 0 10px 60px"
}
}
>
<
div
style=
{
{
margin
:
'0 0 10px 60px'
}
}
>
说明:分成比例基数以订单金额减去相关渠道利润的得数为基准
</
div
>
</>
...
...
src/pages/pointManage/pointDetail/comp/bankCardModal/index.tsx
浏览文件 @
a38d7f4f
import
{
Descriptions
,
Modal
}
from
"antd"
;
import
React
from
"react"
;
import
{
GetScoreListType
}
from
"@/api/interface/pointManageType"
;
import
{
Descriptions
,
Modal
}
from
'antd'
;
import
React
from
'react'
;
import
{
GetScoreListType
}
from
'@/api/interface/pointManageType'
;
// 列表的类型
type
TableType
=
(
ReturnType
<
GetScoreListType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
][
"list"
];
:
never
)[
'result'
][
'list'
];
// 传参类型
interface
propType
{
title
:
string
;
...
...
@@ -32,17 +32,11 @@ const BankCardModal: React.FC<propType> = (props) => {
footer=
{
null
}
destroyOnClose
>
<
Descriptions
bordered
column=
{
1
}
size=
"small"
>
<
Descriptions
.
Item
label=
"银行卡号"
>
{
data
?.
bankCardNumber
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"开户银行"
>
{
data
?.
accountBank
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"支行"
>
{
data
?.
branch
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
"开户姓名"
>
{
data
?.
accountName
}
</
Descriptions
.
Item
>
<
Descriptions
bordered
column=
{
1
}
size=
'small'
>
<
Descriptions
.
Item
label=
'银行卡号'
>
{
data
?.
bankCardNumber
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'开户银行'
>
{
data
?.
accountBank
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'支行'
>
{
data
?.
branch
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'开户姓名'
>
{
data
?.
accountName
}
</
Descriptions
.
Item
>
</
Descriptions
>
</
Modal
>
);
...
...
src/pages/pointManage/pointList/comp/approveModal/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Descriptions
,
Form
,
Input
,
InputNumber
,
message
,
Modal
,
Select
,
Space
,
}
from
"antd"
;
import
{
GetUserScoreDetailsType
,
UserScoreDetailsListType
,
}
from
"@/api/interface/pointManageType"
;
import
{
PointManageAPI
}
from
"@/api"
;
import
{
phoneNumber
}
from
"@/utils/validateUtils"
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Descriptions
,
Form
,
Input
,
InputNumber
,
message
,
Modal
,
Select
,
Space
}
from
'antd'
;
import
{
GetUserScoreDetailsType
,
UserScoreDetailsListType
}
from
'@/api/interface/pointManageType'
;
import
{
PointManageAPI
}
from
'@/api'
;
import
{
phoneNumber
}
from
'@/utils/validateUtils'
;
// 列表的类型
type
TableType
=
(
ReturnType
<
UserScoreDetailsListType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
][
"list"
][
"userScoreList"
];
:
never
)[
'result'
][
'list'
][
'userScoreList'
];
// 传参类型
interface
propType
{
title
:
string
;
...
...
@@ -29,9 +17,9 @@ interface propType {
}
// 状态类型
const
statusList
=
[
{
value
:
0
,
label
:
"提现中"
},
{
value
:
1
,
label
:
"提现成功"
},
{
value
:
2
,
label
:
"提现失败"
},
{
value
:
0
,
label
:
'提现中'
},
{
value
:
1
,
label
:
'提现成功'
},
{
value
:
2
,
label
:
'提现失败'
},
];
export
const
ApproveModal
:
React
.
FC
<
propType
>
=
(
props
)
=>
{
...
...
@@ -68,8 +56,8 @@ export const ApproveModal: React.FC<propType> = (props) => {
withdrawDetailsId
:
data
?.
withdrawId
,
flag
:
values
.
flag
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
message
.
success
(
"操作成功"
);
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
handleCancel
();
}
else
{
message
.
warning
(
res
.
message
);
...
...
@@ -89,25 +77,25 @@ export const ApproveModal: React.FC<propType> = (props) => {
width=
{
400
}
>
<
Form
name=
"addForm"
name=
'addForm'
form=
{
form
}
labelAlign=
"right"
labelAlign=
'right'
labelCol=
{
{
span
:
8
}
}
// layout="inline"
>
<
Form
.
Item
label=
"当前状态"
>
<
Form
.
Item
label=
'当前状态'
>
<
div
>
{
transStatus
(
data
?.
status
as
number
)
}
</
div
>
</
Form
.
Item
>
<
Form
.
Item
label=
"审批结果"
name=
"flag"
rules=
{
[{
required
:
true
,
message
:
"请选择审批结果"
}]
}
label=
'审批结果'
name=
'flag'
rules=
{
[{
required
:
true
,
message
:
'请选择审批结果'
}]
}
>
<
Select
placeholder=
"请选择审批结果"
placeholder=
'请选择审批结果'
options=
{
[
{
value
:
true
,
label
:
"通过"
},
{
value
:
false
,
label
:
"不通过"
},
{
value
:
true
,
label
:
'通过'
},
{
value
:
false
,
label
:
'不通过'
},
]
}
allowClear
/>
...
...
src/pages/pointManage/pointList/comp/detailModal/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Descriptions
,
Modal
}
from
"antd"
;
import
{
GetUserScoreDetailsType
,
UserScoreDetailsListType
,
}
from
"@/api/interface/pointManageType"
;
import
{
PointManageAPI
}
from
"@/api"
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Descriptions
,
Modal
}
from
'antd'
;
import
{
GetUserScoreDetailsType
,
UserScoreDetailsListType
}
from
'@/api/interface/pointManageType'
;
import
{
PointManageAPI
}
from
'@/api'
;
// 列表的类型
type
TableType
=
(
ReturnType
<
UserScoreDetailsListType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
][
"list"
][
"userScoreList"
];
:
never
)[
'result'
][
'list'
][
'userScoreList'
];
type
DetailType
=
(
ReturnType
<
GetUserScoreDetailsType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
];
:
never
)[
'result'
];
// 传参类型
interface
propType
{
title
:
string
;
...
...
@@ -21,12 +18,12 @@ interface propType {
data
?:
TableType
[
0
];
}
const
contentStyle
=
{
width
:
"180px"
};
const
contentStyle
=
{
width
:
'180px'
};
// 状态
const
statusList
=
[
{
value
:
0
,
label
:
"提现中"
},
{
value
:
1
,
label
:
"提现成功"
},
{
value
:
2
,
label
:
"提现失败"
},
{
value
:
0
,
label
:
'提现中'
},
{
value
:
1
,
label
:
'提现成功'
},
{
value
:
2
,
label
:
'提现失败'
},
];
export
const
DetailModal
:
React
.
FC
<
propType
>
=
(
props
)
=>
{
...
...
@@ -50,31 +47,31 @@ export const DetailModal: React.FC<propType> = (props) => {
const
res
=
await
PointManageAPI
.
GetUserScoreDetails
({
id
:
Number
(
data
?.
id
),
});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
setDetailData
(
res
.
result
);
// console.log(res.result);
}
};
// 获取使用时间
const
getUseTime
=
(
record
:
DetailType
)
=>
{
if
(
detailData
?.
type
===
"积分提现"
&&
detailData
?.
status
===
0
)
{
return
""
;
if
(
detailData
?.
type
===
'积分提现'
&&
detailData
?.
status
===
0
)
{
return
''
;
}
if
(
detailData
?.
type
===
"积分提现"
&&
detailData
?.
status
===
2
)
{
return
""
;
if
(
detailData
?.
type
===
'积分提现'
&&
detailData
?.
status
===
2
)
{
return
''
;
}
if
(
detailData
?.
type
===
"积分提现"
&&
detailData
?.
status
===
1
)
{
if
(
detailData
?.
type
===
'积分提现'
&&
detailData
?.
status
===
1
)
{
return
record
?.
approvalTime
;
}
return
record
?.
useTime
;
};
// 获取申请提现时间
const
getApplyTime
=
(
record
:
DetailType
)
=>
{
if
(
detailData
?.
type
===
"积分提现"
&&
detailData
?.
status
===
0
)
{
if
(
detailData
?.
type
===
'积分提现'
&&
detailData
?.
status
===
0
)
{
return
record
?.
useTime
;
}
if
([
"积分转赠"
,
"积分兑换"
].
includes
(
detailData
?.
type
||
""
))
{
return
""
;
if
([
'积分转赠'
,
'积分兑换'
].
includes
(
detailData
?.
type
||
''
))
{
return
''
;
}
return
record
?.
useTime
;
};
...
...
@@ -93,38 +90,36 @@ export const DetailModal: React.FC<propType> = (props) => {
destroyOnClose
width=
{
650
}
>
<
Descriptions
column=
{
2
}
bordered
size=
"small"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"积分数值"
>
<
Descriptions
column=
{
2
}
bordered
size=
'small'
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'积分数值'
>
{
detailData
?.
scoreNum
&&
(
detailData
?.
scoreNum
>
0
?
`+${detailData?.scoreNum}`
:
detailData
?.
scoreNum
)
}
(
detailData
?.
scoreNum
>
0
?
`+${detailData?.scoreNum}`
:
detailData
?.
scoreNum
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"流通方式"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'流通方式'
>
{
detailData
?.
type
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"订单编号"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'订单编号'
>
{
detailData
?.
orderNo
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"兑换比例"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'兑换比例'
>
{
detailData
?.
convertRatio
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"领取时间"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'领取时间'
>
{
detailData
?.
getTime
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"使用时间"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'使用时间'
>
{
detailData
&&
getUseTime
(
detailData
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"状态"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'状态'
>
{
transStatus
(
detailData
?.
status
as
number
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"申请提现时间"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'申请提现时间'
>
{
detailData
&&
getApplyTime
(
detailData
)
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"获赠方UID"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'获赠方UID'
>
{
detailData
?.
giveAwayToUid
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
"转赠方UID"
>
<
Descriptions
.
Item
contentStyle=
{
contentStyle
}
label=
'转赠方UID'
>
{
detailData
?.
gainFormUid
}
</
Descriptions
.
Item
>
</
Descriptions
>
...
...
src/pages/pointManage/pointList/comp/distributionModal/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Descriptions
,
Form
,
Input
,
InputNumber
,
message
,
Modal
,
Select
,
Space
,
}
from
"antd"
;
import
{
UserScoreDetailsListType
}
from
"@/api/interface/pointManageType"
;
import
{
PointManageAPI
}
from
"@/api"
;
import
{
maxLength9
,
noSpaceFront
}
from
"@/utils/validateUtils"
;
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Descriptions
,
Form
,
Input
,
InputNumber
,
message
,
Modal
,
Select
,
Space
}
from
'antd'
;
import
{
UserScoreDetailsListType
}
from
'@/api/interface/pointManageType'
;
import
{
PointManageAPI
}
from
'@/api'
;
import
{
maxLength9
,
noSpaceFront
}
from
'@/utils/validateUtils'
;
// 列表的类型
type
DetailType
=
(
ReturnType
<
UserScoreDetailsListType
>
extends
Promise
<
infer
T
>
?
T
:
never
)[
"result"
][
"list"
];
:
never
)[
'result'
][
'list'
];
// 传参类型
interface
propType
{
title
:
string
;
...
...
@@ -36,8 +27,7 @@ export const DistributionModal: React.FC<propType> = (props) => {
// 流通方式选择
const
[
circulateId
,
setCirculateId
]
=
useState
<
number
>
();
// 流通方式列表
const
[
circulateIdList
,
setCirculateIdList
]
=
useState
<
{
label
:
string
;
value
:
number
}[]
>
();
const
[
circulateIdList
,
setCirculateIdList
]
=
useState
<
{
label
:
string
;
value
:
number
}[]
>
();
// 关闭弹窗
const
handleCancel
=
()
=>
{
form
.
resetFields
();
...
...
@@ -50,17 +40,17 @@ export const DistributionModal: React.FC<propType> = (props) => {
.
validateFields
()
.
then
(
async
(
values
)
=>
{
if
(
Number
(
values
.
score
)
===
0
)
{
return
message
.
warning
(
"积分数值不能为0"
);
return
message
.
warning
(
'积分数值不能为0'
);
}
if
(
values
.
orderNo
)
{
// 从订单列表查询订单
const
res
=
await
PointManageAPI
.
GetOrderInfoByOrderNo
({
orderNo
:
values
.
orderNo
,
});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
const
{
id
}
=
res
.
result
;
if
(
!
id
)
{
return
message
.
warning
(
"订单编号不存在"
);
return
message
.
warning
(
'订单编号不存在'
);
}
await
handleSubmit
({
...
values
,
...
...
@@ -88,8 +78,8 @@ export const DistributionModal: React.FC<propType> = (props) => {
orderId
:
values
.
orderId
,
score
:
Number
(
`
${
values
.
symbol
}${
values
.
score
}
`
),
});
if
(
res
&&
res
.
code
===
"200"
)
{
message
.
success
(
"操作成功"
);
if
(
res
&&
res
.
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
handleCancel
();
}
else
{
message
.
warning
(
res
.
message
);
...
...
@@ -98,13 +88,13 @@ export const DistributionModal: React.FC<propType> = (props) => {
// 获取流通数据列表
const
getListCirculateInfo
=
async
()
=>
{
const
res
=
await
PointManageAPI
.
ListCirculateInfo
({});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
setCirculateIdList
(
res
.
result
.
map
((
i
)
=>
{
return
{
label
:
i
.
type
,
value
:
i
.
id
};
})
.
filter
((
i
)
=>
[
5
,
7
].
includes
(
i
.
value
))
.
filter
((
i
)
=>
[
5
,
7
].
includes
(
i
.
value
))
,
);
}
};
...
...
@@ -129,40 +119,40 @@ export const DistributionModal: React.FC<propType> = (props) => {
width=
{
400
}
>
<
Form
name=
"addForm"
name=
'addForm'
form=
{
form
}
labelAlign=
"right"
labelAlign=
'right'
labelCol=
{
{
span
:
8
}
}
// layout="inline"
>
<
Form
.
Item
label=
"发放积分数值"
required
>
<
Space
.
Compact
style=
{
{
width
:
"100%"
}
}
>
<
Form
.
Item
name=
"symbol"
noStyle
initialValue=
"+"
>
<
Form
.
Item
label=
'发放积分数值'
required
>
<
Space
.
Compact
style=
{
{
width
:
'100%'
}
}
>
<
Form
.
Item
name=
'symbol'
noStyle
initialValue=
'+'
>
<
Select
>
<
Select
.
Option
value=
"+"
>
+
</
Select
.
Option
>
<
Select
.
Option
value=
"-"
>
-
</
Select
.
Option
>
<
Select
.
Option
value=
'+'
>
+
</
Select
.
Option
>
<
Select
.
Option
value=
'-'
>
-
</
Select
.
Option
>
</
Select
>
</
Form
.
Item
>
<
Form
.
Item
name=
"score"
name=
'score'
noStyle
rules=
{
[{
required
:
true
,
message
:
"请输入发放积分数值"
}]
}
rules=
{
[{
required
:
true
,
message
:
'请输入发放积分数值'
}]
}
>
<
Input
style=
{
{
width
:
"250%"
}
}
placeholder=
"请输入发放积分数值"
style=
{
{
width
:
'250%'
}
}
placeholder=
'请输入发放积分数值'
onInput=
{
maxLength9
}
/>
</
Form
.
Item
>
</
Space
.
Compact
>
</
Form
.
Item
>
<
Form
.
Item
label=
"流通方式"
name=
"circulateId"
rules=
{
[{
required
:
true
,
message
:
"请选择流通方式"
}]
}
label=
'流通方式'
name=
'circulateId'
rules=
{
[{
required
:
true
,
message
:
'请选择流通方式'
}]
}
>
<
Select
placeholder=
"请选择流通方式"
placeholder=
'请选择流通方式'
options=
{
circulateIdList
}
allowClear
value=
{
circulateId
}
...
...
@@ -171,16 +161,11 @@ export const DistributionModal: React.FC<propType> = (props) => {
</
Form
.
Item
>
{
circulateId
===
5
&&
(
<
Form
.
Item
label=
"订单编号"
name=
"orderNo"
rules=
{
[{
required
:
true
,
message
:
"请输入订单编号"
}]
}
label=
'订单编号'
name=
'orderNo'
rules=
{
[{
required
:
true
,
message
:
'请输入订单编号'
}]
}
>
<
Input
placeholder=
"请输入订单编号"
maxLength=
{
20
}
allowClear
onInput=
{
noSpaceFront
}
/>
<
Input
placeholder=
'请输入订单编号'
maxLength=
{
20
}
allowClear
onInput=
{
noSpaceFront
}
/>
</
Form
.
Item
>
)
}
</
Form
>
...
...
src/pages/pointManage/pointRules/comp/addEditModal/index.tsx
浏览文件 @
a38d7f4f
import
React
,
{
useState
}
from
"react"
;
import
{
DatePicker
,
Form
,
Input
,
message
,
Modal
,
Radio
}
from
"antd"
;
import
moment
from
"dayjs"
;
import
{
PointManageAPI
}
from
"@/api"
;
import
{
maxLength8
,
maxString8
}
from
"@/utils/validateUtils"
;
import
React
,
{
useState
}
from
'react'
;
import
{
DatePicker
,
Form
,
Input
,
message
,
Modal
,
Radio
}
from
'antd'
;
import
moment
from
'dayjs'
;
import
{
PointManageAPI
}
from
'@/api'
;
import
{
maxLength8
,
maxString8
}
from
'@/utils/validateUtils'
;
// 传参类型
interface
propType
{
...
...
@@ -50,83 +50,69 @@ export const AddEditModal: React.FC<propType> = (props: propType) => {
coupon
:
Number
(
values
.
coupon
),
entryIntoForceTime
:
values
.
ruleSetting
===
1
?
moment
(
values
.
entryIntoForceTime
.
$d
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
?
moment
(
values
.
entryIntoForceTime
.
$d
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
,
ruleName
:
values
.
ruleName
,
score
:
Number
(
values
.
score
),
});
if
(
res
&&
res
.
code
===
"200"
)
{
if
(
res
&&
res
.
code
===
'200'
)
{
handleCancel
();
}
};
return
(
<
Modal
open=
{
open
}
title=
{
title
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
destroyOnClose
>
<
Modal
open=
{
open
}
title=
{
title
}
onCancel=
{
handleCancel
}
onOk=
{
handleOk
}
destroyOnClose
>
<
Form
name=
"addForm"
name=
'addForm'
form=
{
form
}
labelAlign=
"right"
labelAlign=
'right'
// layout="inline"
>
<
Form
.
Item
label=
"规则名称"
name=
"ruleName"
rules=
{
[{
required
:
true
,
message
:
"请输入规则名称"
}]
}
label=
'规则名称'
name=
'ruleName'
rules=
{
[{
required
:
true
,
message
:
'请输入规则名称'
}]
}
>
<
Input
placeholder=
"请输入规则名称"
maxLength=
{
15
}
allowClear
/>
<
Input
placeholder=
'请输入规则名称'
maxLength=
{
15
}
allowClear
/>
</
Form
.
Item
>
<
Form
.
Item
label=
"兑换比例(积分:券额)"
required
>
<
Form
.
Item
label=
'兑换比例(积分:券额)'
required
>
<
Form
.
Item
name=
"score"
rules=
{
[{
required
:
true
,
message
:
"请输入积分比例"
}]
}
style=
{
{
display
:
"inline-block"
,
width
:
"calc(50% - 8px)"
}
}
name=
'score'
rules=
{
[{
required
:
true
,
message
:
'请输入积分比例'
}]
}
style=
{
{
display
:
'inline-block'
,
width
:
'calc(50% - 8px)'
}
}
>
<
Input
placeholder=
"请输入积分比例"
type=
"number"
onInput=
{
maxLength8
}
/>
<
Input
placeholder=
'请输入积分比例'
type=
'number'
onInput=
{
maxLength8
}
/>
</
Form
.
Item
>
<
Form
.
Item
name=
"coupon"
name=
'coupon'
rules=
{
[
{
required
:
true
,
message
:
"请输入券额比例"
},
{
required
:
true
,
message
:
'请输入券额比例'
},
{
pattern
:
/^
(\d
|
[
1-9
]\d
+
)(\.\d
{1,2}
)?
$/
,
message
:
"只能输入两位小数"
,
message
:
'只能输入两位小数'
,
},
]
}
style=
{
{
display
:
"inline-block"
,
width
:
"calc(50% - 8px)"
,
margin
:
"0 8px"
,
display
:
'inline-block'
,
width
:
'calc(50% - 8px)'
,
margin
:
'0 8px'
,
}
}
>
<
Input
placeholder=
"请输入券额比例"
type=
"number"
onInput=
{
maxString8
}
/>
<
Input
placeholder=
'请输入券额比例'
type=
'number'
onInput=
{
maxString8
}
/>
</
Form
.
Item
>
</
Form
.
Item
>
<
div
style=
{
{
transform
:
"translateY(-10px)"
}
}
>
<
div
style=
{
{
transform
:
'translateY(-10px)'
}
}
>
说明:若兑换比例为1:20,则1积分可兑20元VIP优惠券,且为无门槛优惠券
</
div
>
<
Form
.
Item
label=
"生效时间"
name=
"ruleSetting"
rules=
{
[{
required
:
true
,
message
:
"请选择生效时间"
}]
}
label=
'生效时间'
name=
'ruleSetting'
rules=
{
[{
required
:
true
,
message
:
'请选择生效时间'
}]
}
initialValue=
{
0
}
>
<
Radio
.
Group
options=
{
[
{
label
:
"立即生效"
,
value
:
0
},
{
label
:
"手动设置"
,
value
:
1
},
{
label
:
'立即生效'
,
value
:
0
},
{
label
:
'手动设置'
,
value
:
1
},
]
}
value=
{
radioValue
}
onChange=
{
({
target
:
{
value
}
})
=>
{
...
...
@@ -136,16 +122,16 @@ export const AddEditModal: React.FC<propType> = (props: propType) => {
</
Form
.
Item
>
{
radioValue
===
1
&&
(
<
Form
.
Item
label=
"生效时间"
name=
"entryIntoForceTime"
rules=
{
[{
required
:
radioValue
===
1
,
message
:
"请设置生效时间"
}]
}
label=
'生效时间'
name=
'entryIntoForceTime'
rules=
{
[{
required
:
radioValue
===
1
,
message
:
'请设置生效时间'
}]
}
>
<
DatePicker
placeholder=
"请选择生效时间"
placeholder=
'请选择生效时间'
allowClear
showTime=
{
{
format
:
"HH:mm:ss"
}
}
format=
"YYYY-MM-DD HH:mm:ss"
style=
{
{
width
:
"100%"
}
}
showTime=
{
{
format
:
'HH:mm:ss'
}
}
format=
'YYYY-MM-DD HH:mm:ss'
style=
{
{
width
:
'100%'
}
}
disabledDate=
{
(
current
)
=>
{
// 限制时间不可早于当日
return
current
&&
current
<=
moment
();
...
...
src/router/router.tsx
浏览文件 @
a38d7f4f
...
...
@@ -5,12 +5,13 @@ import LayoutView from '~/components/layout';
import
{
AccountBookOutlined
,
MacCommandOutlined
,
GiftOutlined
,
PayCircleOutlined
,
GiftOutlined
,
PayCircleOutlined
,
BarsOutlined
,
ShoppingOutlined
,
ShopOutlined
,
CreditCardOutlined
}
from
'@ant-design/icons'
;
CreditCardOutlined
,
}
from
'@ant-design/icons'
;
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import
{
AgnosticIndexRouteObject
}
from
'@remix-run/router'
;
...
...
@@ -23,16 +24,20 @@ import DivideOrder from '~/pages/pointManage/divideOrder';
import
DivideRules
from
'~/pages/pointManage/divideRules'
;
import
LoginView
from
'~/pages/common/login'
;
import
ProductOrderDetail
from
'~/pages/orderManage/productOrder/detail'
;
import
ServiceOrderDetail
from
'~/pages/orderManage/serviceOrder/detail'
;
import
EquipmentOrderDetail
from
'~/pages/orderManage/equipmentOrder/detail'
;
const
ActivityList
=
React
.
lazy
(()
=>
import
(
'src/pages/activityManage/activityList'
));
//活动管理
const
ActivityList
=
React
.
lazy
(()
=>
import
(
'src/pages/activityManage/activityList'
));
//活动管理
const
ProductOrderView
=
React
.
lazy
(()
=>
import
(
'src/pages/orderManage/productOrder'
));
//销售订单
const
EquipmentOrderView
=
React
.
lazy
(()
=>
import
(
'src/pages/orderManage/equipmentOrder'
));
//设备订单
const
ServiceOrderView
=
React
.
lazy
(()
=>
import
(
'src/pages/orderManage/serviceOrder'
));
//服务订单
const
CouponList
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/couponList'
));
//优惠券管理
const
CouponDetail
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/couponList/detail'
));
//优惠券明细
const
SplitCouponList
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/splitCouponList'
));
//裂变优惠券
const
SplitCouponOperate
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/splitCouponList/addOrEditOrDetail'
));
//裂变优惠券操作
const
CouponDetailed
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/couponDetailed'
));
//优惠券明细
const
CouponList
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/couponList'
));
//优惠券管理
const
CouponDetail
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/couponList/detail'
));
//优惠券明细
const
SplitCouponList
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/splitCouponList'
));
//裂变优惠券
const
SplitCouponOperate
=
React
.
lazy
(
()
=>
import
(
'src/pages/couponManage/splitCouponList/addOrEditOrDetail'
),
);
//裂变优惠券操作
const
CouponDetailed
=
React
.
lazy
(()
=>
import
(
'src/pages/couponManage/couponDetailed'
));
//优惠券明细
export
interface
RouteObjectType
{
path
:
AgnosticIndexRouteObject
[
'path'
];
element
:
any
;
...
...
@@ -121,6 +126,16 @@ export const routerList: Array<RouteObjectType> = [
},
},
{
path
:
'/orderManage/equipmentOrder/detail'
,
element
:
withLoadingComponent
(<
EquipmentOrderDetail
/>),
meta
:
{
id
:
10020
,
title
:
'租赁订单 / 详情'
,
icon
:
<
ShopOutlined
/>,
hidden
:
true
,
},
},
{
path
:
'/orderManage/serviceOrder'
,
element
:
withLoadingComponent
(<
ServiceOrderView
/>),
meta
:
{
...
...
@@ -129,6 +144,16 @@ export const routerList: Array<RouteObjectType> = [
icon
:
<
CreditCardOutlined
/>,
},
},
{
path
:
'/orderManage/serviceOrder/detail'
,
element
:
withLoadingComponent
(<
ServiceOrderDetail
/>),
meta
:
{
id
:
10010
,
title
:
'服务订单 / 详情'
,
icon
:
<
CreditCardOutlined
/>,
hidden
:
true
,
},
},
],
},
{
...
...
@@ -152,9 +177,13 @@ export const routerList: Array<RouteObjectType> = [
},
{
path
:
'/pointManage/pointList/detail'
,
element
:
withLoadingComponent
(<
PointDetail
location=
{
{
search
:
''
}
}
/>),
element
:
withLoadingComponent
(
<
PointDetail
location=
{
{
search
:
''
,
}
}
/>,
),
meta
:
{
id
:
25100
,
title
:
'个人积分明细'
,
...
...
@@ -173,9 +202,13 @@ export const routerList: Array<RouteObjectType> = [
},
{
path
:
'/pointManage/pointList/list'
,
element
:
withLoadingComponent
(<
PointDetailList
location=
{
{
search
:
''
}
}
/>),
element
:
withLoadingComponent
(
<
PointDetailList
location=
{
{
search
:
''
,
}
}
/>,
),
meta
:
{
id
:
25100
,
title
:
'积分明细'
,
...
...
@@ -225,14 +258,18 @@ export const routerList: Array<RouteObjectType> = [
},
{
path
:
'/couponManage/couponList/detail'
,
element
:
withLoadingComponent
(<
CouponDetail
location=
{
{
search
:
''
}
}
/>),
element
:
withLoadingComponent
(
<
CouponDetail
location=
{
{
search
:
''
,
}
}
/>,
),
meta
:
{
id
:
26100
,
title
:
'活动优惠券操作'
,
icon
:
<
PayCircleOutlined
/>,
hidden
:
true
,
hidden
:
true
,
},
},
{
...
...
@@ -251,7 +288,7 @@ export const routerList: Array<RouteObjectType> = [
id
:
26200
,
title
:
'裂变优惠券操作'
,
icon
:
<
PayCircleOutlined
/>,
hidden
:
true
,
hidden
:
true
,
},
},
{
...
...
src/store/hook/index.ts
浏览文件 @
a38d7f4f
import
{
useSelector
,
useDispatch
,
TypedUseSelectorHook
}
from
"react-redux"
;
import
type
{
RootState
,
AppDispatch
}
from
"../index"
;
import
{
useSelector
,
useDispatch
,
TypedUseSelectorHook
}
from
'react-redux'
;
import
type
{
RootState
,
AppDispatch
}
from
'../index'
;
export
const
useAppDispatch
=
()
=>
useDispatch
<
AppDispatch
>
();
export
const
useAppSelector
:
TypedUseSelectorHook
<
RootState
>
=
useSelector
;
src/store/index.ts
浏览文件 @
a38d7f4f
import
{
configureStore
}
from
"@reduxjs/toolkit"
;
import
stateSlice
from
"@/store/slice"
;
import
{
configureStore
}
from
'@reduxjs/toolkit'
;
import
stateSlice
from
'@/store/slice'
;
const
store
=
configureStore
({
reducer
:
{
...
...
src/store/slice/index.ts
浏览文件 @
a38d7f4f
import
{
createSlice
,
createAsyncThunk
,
PayloadAction
}
from
"@reduxjs/toolkit"
;
import
{
createSlice
,
createAsyncThunk
,
PayloadAction
}
from
'@reduxjs/toolkit'
;
const
stateSlice
=
createSlice
({
name
:
"ghj"
,
name
:
'ghj'
,
initialState
:
{
num
:
1
,
},
...
...
src/utils/auth.ts
浏览文件 @
a38d7f4f
const
TOKENKEY
=
"mmc-token"
;
const
USERKEY
=
"mmc-custManage"
;
const
TOKENKEY
=
'mmc-token'
;
const
USERKEY
=
'mmc-custManage'
;
const
getToken
=
()
=>
{
return
localStorage
.
getItem
(
TOKENKEY
);
...
...
src/utils/dictionary.ts
浏览文件 @
a38d7f4f
// 合同状态
export
const
signStatusList
=
[
{
val
:
0
,
label
:
"待用户签署合同"
},
{
val
:
1
,
label
:
"用户签署失败"
},
{
val
:
2
,
label
:
"待平台签署合同"
},
{
val
:
3
,
label
:
"平台签署失败"
},
{
val
:
4
,
label
:
"平台签署成功"
},
{
val
:
5
,
label
:
"合同归档完成"
},
{
val
:
0
,
label
:
'待用户签署合同'
},
{
val
:
1
,
label
:
'用户签署失败'
},
{
val
:
2
,
label
:
'待平台签署合同'
},
{
val
:
3
,
label
:
'平台签署失败'
},
{
val
:
4
,
label
:
'平台签署成功'
},
{
val
:
5
,
label
:
'合同归档完成'
},
];
// 裂变优惠券门槛
export
const
splitCouponType
=
[
{
val
:
1
,
label
:
"有门槛"
,
label
:
'有门槛'
,
},
{
val
:
2
,
label
:
"减免券"
,
label
:
'减免券'
,
},
{
val
:
3
,
label
:
"无门槛"
,
label
:
'无门槛'
,
},
];
// 裂变优惠券使用类型
export
const
splitCouponUseType
=
[
{
val
:
2
,
label
:
"品牌券"
,
label
:
'品牌券'
,
},
{
val
:
1
,
label
:
"商品券"
,
label
:
'商品券'
,
},
{
val
:
3
,
label
:
"店铺券"
,
label
:
'店铺券'
,
},
];
src/utils/index.ts
浏览文件 @
a38d7f4f
export
const
base64ToFile
=
(
dataUrl
:
string
,
name
?:
string
)
=>
{
const
arr
:
string
[]
=
dataUrl
.
split
(
","
);
const
arr
:
string
[]
=
dataUrl
.
split
(
','
);
// const mime = arr[0].match(/:(.*?);/)[1];
const
bstr
:
string
=
atob
(
arr
[
1
]);
let
n
=
bstr
.
length
;
...
...
@@ -7,7 +7,7 @@ export const base64ToFile = (dataUrl: string, name?: string) => {
while
(
n
--
)
{
u8arr
[
n
]
=
bstr
.
charCodeAt
(
n
);
}
return
new
File
([
u8arr
],
`
${
name
}
.png`
,
{
type
:
"image/png"
});
return
new
File
([
u8arr
],
`
${
name
}
.png`
,
{
type
:
'image/png'
});
};
export
const
urlToBase64
=
(
url
:
string
)
=>
{
return
new
Promise
((
resolve
)
=>
{
...
...
@@ -17,17 +17,17 @@ export const urlToBase64 = (url: string) => {
// 处理缓存,fix缓存bug,有缓存,浏览器会报错;
Img
.
src
=
`
${
url
}
?
${
timeStamp
}
`
;
// 解决控制台跨域报错的问题
Img
.
crossOrigin
=
"Anonymous"
;
Img
.
crossOrigin
=
'Anonymous'
;
// 获取后缀
const
ext
=
Img
.
src
.
substring
(
Img
.
src
.
lastIndexOf
(
"."
)
+
1
).
toLowerCase
();
const
ext
=
Img
.
src
.
substring
(
Img
.
src
.
lastIndexOf
(
'.'
)
+
1
).
toLowerCase
();
Img
.
onload
=
()
=>
{
// 要先确保图片完整获取到,这是个异步事件
const
canvas
:
any
=
document
.
createElement
(
"canvas"
);
// 创建canvas元素
const
canvas
:
any
=
document
.
createElement
(
'canvas'
);
// 创建canvas元素
// 确保canvas的尺寸和图片一样
canvas
.
width
=
Img
.
width
;
canvas
.
height
=
Img
.
height
;
// 将图片绘制到canvas中
canvas
.
getContext
(
"2d"
).
drawImage
(
Img
,
0
,
0
,
Img
.
width
,
Img
.
height
);
canvas
.
getContext
(
'2d'
).
drawImage
(
Img
,
0
,
0
,
Img
.
width
,
Img
.
height
);
// 转换图片为dataURL
resolve
(
canvas
.
toDataURL
(
`image/
${
ext
}
`
));
};
...
...
src/utils/isRoute.ts
浏览文件 @
a38d7f4f
// 过滤路由
import
{
limitEntity
}
from
"@/api/modules/role"
;
import
{
limitEntity
}
from
'@/api/modules/role'
;
export
const
filterRouter
=
(
list
:
any
,
routeList
:
limitEntity
[])
=>
{
return
list
.
reduce
((
pre
:
any
,
cur
:
any
)
=>
{
...
...
@@ -19,6 +19,6 @@ export const isRoute = (list: any, pathname: string) => {
(
v
:
any
)
=>
v
.
path
===
pathname
||
(
v
.
alias
&&
pathname
.
includes
(
v
.
alias
))
||
(
v
.
children
&&
isRoute
(
v
.
children
,
pathname
))
(
v
.
children
&&
isRoute
(
v
.
children
,
pathname
))
,
);
};
src/utils/money.ts
浏览文件 @
a38d7f4f
// 格式化千分位并补零
export
const
moneyFormat
=
(
num
:
number
)
=>
{
if
(
Number
(
num
).
toString
()
!==
"NaN"
)
{
if
(
Number
(
num
).
toString
()
!==
'NaN'
)
{
// 添加千分符
let
_n
=
Number
(
num
).
toLocaleString
();
if
(
_n
.
indexOf
(
"."
)
!==
-
1
)
{
_n
+=
"00"
;
if
(
_n
.
indexOf
(
'.'
)
!==
-
1
)
{
_n
+=
'00'
;
}
else
{
_n
+=
".00"
;
_n
+=
'.00'
;
}
// 因为有千分符所以,返回数据为字符串格式,无法做运算操作,适合做直接显示使用
return
_n
.
substring
(
0
,
_n
.
indexOf
(
"."
)
+
3
);
return
_n
.
substring
(
0
,
_n
.
indexOf
(
'.'
)
+
3
);
}
};
src/utils/order.ts
浏览文件 @
a38d7f4f
// 是否允许操作
const
isAllowOption
=
(
record
:
any
)
=>
{
const
userInfo
=
JSON
.
parse
(
localStorage
.
getItem
(
"user_info"
)
as
string
);
const
userInfo
=
JSON
.
parse
(
localStorage
.
getItem
(
'user_info'
)
as
string
);
return
(
userInfo
.
userAccountId
===
record
.
operationId
||
(
userInfo
.
roleInfo
.
pmc
&&
(
record
.
statusCode
===
710
||
record
.
statusCode
===
500
))
(
userInfo
.
roleInfo
.
pmc
&&
(
record
.
statusCode
===
710
||
record
.
statusCode
===
500
))
);
};
// 设置状态
export
const
setStatus
=
(
record
:
any
,
deliverBtn
:
boolean
)
=>
{
if
(
record
.
statusCode
!==
50
&&
!
isAllowOption
(
record
))
{
return
""
;
return
''
;
}
// 新版
if
(
record
.
statusCode
===
200
)
{
return
record
.
signStatus
===
2
?
"合同签署"
:
""
;
return
record
.
signStatus
===
2
?
'合同签署'
:
''
;
}
switch
(
record
.
statusCode
)
{
case
50
:
return
JSON
.
parse
(
localStorage
.
getItem
(
"user_info"
)
as
string
).
roleInfo
.
admin
?
"分配订单"
:
""
;
return
JSON
.
parse
(
localStorage
.
getItem
(
'user_info'
)
as
string
).
roleInfo
.
admin
?
'分配订单'
:
''
;
case
100
:
return
"确认订单"
;
return
'确认订单'
;
case
300
:
return
"确认付款"
;
return
'确认付款'
;
case
400
:
return
"确认库存"
;
return
'确认库存'
;
case
710
:
case
500
:
return
deliverBtn
?
"发货"
:
""
;
return
deliverBtn
?
'发货'
:
''
;
case
660
:
return
"确认尾款"
;
return
'确认尾款'
;
default
:
return
null
;
}
...
...
src/utils/validateUtils.ts
浏览文件 @
a38d7f4f
// 不能输入数字,其他可惜输入
export
const
exceptNumber
=
(
val
:
any
)
=>
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/1
?(\d
|
([
1-9
]\d
+
))(
.
\d
+
)?
$/g
,
""
)
.
replace
(
/
\s
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/1
?(\d
|
([
1-9
]\d
+
))(
.
\d
+
)?
$/g
,
''
).
replace
(
/
\s
/g
,
''
);
};
// 只能输入正整数
export
const
onlyNumberPositive
=
(
val
:
any
)
=>
{
// eslint-disable-next-line eqeqeq
if
(
val
.
target
.
value
==
0
)
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/0/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/0/g
,
''
);
}
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
''
);
};
// 不能输入汉字,其他可输入
export
const
exceptChinese
=
(
val
:
any
)
=>
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
[\u
4E00-
\u
9FA5
]
|
[\u
FE30-
\u
FFA0
]
/g
,
""
)
.
replace
(
/
\s
/g
,
""
);
.
replace
(
/
[\u
4E00-
\u
9FA5
]
|
[\u
FE30-
\u
FFA0
]
/g
,
''
)
.
replace
(
/
\s
/g
,
''
);
};
// 只能输入字母和中文,不能输入数字和符号
export
const
onlyCharacter
=
(
val
:
any
)
=>
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
[^
a-zA-Z
\u
4E00-
\u
9FA5
]
/g
,
""
)
.
replace
(
/
\s
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
[^
a-zA-Z
\u
4E00-
\u
9FA5
]
/g
,
''
).
replace
(
/
\s
/g
,
''
);
};
// 手机号输入,限制11位
...
...
@@ -33,13 +29,13 @@ export const phoneNumber = (val: any) => {
if
(
val
.
target
.
value
.
length
>
11
)
{
val
.
target
.
value
=
val
.
target
.
value
.
slice
(
0
,
11
);
}
else
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
''
);
}
};
// 开头不能输入空格
export
const
noSpaceFront
=
(
val
:
any
)
=>
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/^
\s
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/^
\s
/g
,
''
);
};
// 数字限制长度
...
...
@@ -47,7 +43,7 @@ export const maxLength = (val: any) => {
if
(
val
.
target
.
value
.
length
>
10
)
{
val
.
target
.
value
=
val
.
target
.
value
.
slice
(
0
,
10
);
}
else
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
''
);
}
};
...
...
@@ -63,7 +59,7 @@ export const maxNumber = (val: any) => {
if
(
val
.
target
.
value
>
100000
)
{
val
.
target
.
value
=
100000
;
}
else
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
''
);
}
};
...
...
@@ -79,7 +75,7 @@ export const maxLength8 = (val: any) => {
if
(
val
.
target
.
value
.
length
>
8
)
{
val
.
target
.
value
=
val
.
target
.
value
.
slice
(
0
,
8
);
}
else
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
''
);
}
};
...
...
@@ -88,7 +84,7 @@ export const maxLength9 = (val: any) => {
if
(
val
.
target
.
value
.
length
>
9
)
{
val
.
target
.
value
=
val
.
target
.
value
.
slice
(
0
,
9
);
}
else
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
''
);
}
};
...
...
@@ -97,7 +93,7 @@ export const maxLength7 = (val: any) => {
if
(
val
.
target
.
value
.
length
>
7
)
{
val
.
target
.
value
=
val
.
target
.
value
.
slice
(
0
,
7
);
}
else
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
''
);
}
};
...
...
@@ -106,6 +102,6 @@ export const maxLength6 = (val: any) => {
if
(
val
.
target
.
value
.
length
>
6
)
{
val
.
target
.
value
=
val
.
target
.
value
.
slice
(
0
,
6
);
}
else
{
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
""
);
val
.
target
.
value
=
val
.
target
.
value
.
replace
(
/
\D
/g
,
''
);
}
};
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论