Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
admin-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
admin-ci-test
Commits
a8f737ae
提交
a8f737ae
authored
7月 06, 2023
作者:
龚洪江
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复:产品价格配置
上级
267240fc
隐藏空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
649 行增加
和
422 行删除
+649
-422
categoryManage.ts
src/api/interface/categoryManage.ts
+7
-10
goodsType.ts
src/api/interface/goodsType.ts
+3
-0
mallManageType.ts
src/api/interface/mallManageType.ts
+3
-0
produceManageType.ts
src/api/interface/produceManageType.ts
+1
-1
categoryManage.ts
src/api/modules/categoryManage.ts
+17
-34
goodsAPI.ts
src/api/modules/goodsAPI.ts
+5
-0
mallManage.ts
src/api/modules/mallManage.ts
+4
-0
index.tsx
...ponents/goods/commonAddOrEdit/addOrEditSkuModal/index.tsx
+3
-3
index.tsx
src/components/goods/commonAddOrEdit/stockSku/index.tsx
+0
-6
index.tsx
src/pages/categoryManage/category/detail/index.tsx
+88
-263
index.tsx
src/pages/categoryManage/directoryManage/index.tsx
+11
-24
index.tsx
...ges/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
+0
-1
index.tsx
src/pages/mallManage/mallGoods/goodsList/index.tsx
+123
-10
index.tsx
...duceDetail/components/addOrEditProduceSpecModal/index.tsx
+3
-0
index.tsx
...oduceDetail/components/setProduceSpecPriceModal/index.tsx
+134
-50
index.tsx
src/pages/mallManage/produceManage/produceDetail/index.tsx
+1
-0
index.tsx
...ages/mallManage/rentGoods/rentAddOrEditOrDetail/index.tsx
+0
-1
index.tsx
src/pages/mallManage/rentGoods/rentList/index.tsx
+124
-10
index.tsx
src/pages/mallManage/serviceManage/serviceList/index.tsx
+122
-9
没有找到文件。
src/api/interface/categoryManage.ts
浏览文件 @
a8f737ae
// 分类详情
import
{
InterFunction
,
InterItemFunction
}
from
'~/api/interface'
;
import
{
InterFunction
,
InterItemFunction
}
from
'~/api/interface'
;
export
interface
GoodsInfo
{
goodsId
:
number
;
goodsImg
:
string
;
goodsName
:
string
;
shelfStatus
:
number
;
showCode
:
number
;
}
// 分类列表
// 分类列表
export
interface
categoryEntity
{
export
interface
categoryEntity
{
id
:
number
;
id
:
number
;
...
@@ -75,3 +65,10 @@ export type directoryProductType = InterFunction<
...
@@ -75,3 +65,10 @@ export type directoryProductType = InterFunction<
type
:
number
;
type
:
number
;
}[]
}[]
>
;
>
;
//分类-详情
export
type
categoryDetailsType
=
InterFunction
<
{
id
:
number
},
{
classifyName
:
string
;
description
:
string
;
icon
:
string
;
id
:
number
;
remark
:
string
}
>
;
//分类-关联列表
export
type
categoryRelevantType
=
InterFunction
<
{
id
:
number
;
type
:
number
},
any
>
;
src/api/interface/goodsType.ts
浏览文件 @
a8f737ae
...
@@ -21,6 +21,7 @@ export type listGoodsType = InterItemFunction<
...
@@ -21,6 +21,7 @@ export type listGoodsType = InterItemFunction<
imgUrl
:
string
;
imgUrl
:
string
;
isCoupons
:
number
;
isCoupons
:
number
;
status
:
number
;
status
:
number
;
id
:
number
;
}[]
}[]
>
;
>
;
//商品-新增
//商品-新增
...
@@ -100,3 +101,5 @@ export type skuUnitType = InterFunction<any, { id: number; unitName: string }[]>
...
@@ -100,3 +101,5 @@ export type skuUnitType = InterFunction<any, { id: number; unitName: string }[]>
export
type
batchOnShelfOrTakeDownType
=
InterFunction
<
{
goodsIds
:
number
[];
status
:
number
},
any
>
;
export
type
batchOnShelfOrTakeDownType
=
InterFunction
<
{
goodsIds
:
number
[];
status
:
number
},
any
>
;
//商品批量删除
//商品批量删除
export
type
batchRemoveWareInfoType
=
InterFunction
<
number
[],
any
>
;
export
type
batchRemoveWareInfoType
=
InterFunction
<
number
[],
any
>
;
//商品-上下移动
export
type
exchangeGoodsInfoType
=
InterFunction
<
{
firstId
:
number
;
secondId
:
number
},
any
>
;
src/api/interface/mallManageType.ts
浏览文件 @
a8f737ae
...
@@ -144,6 +144,7 @@ export type serviceType = InterItemFunction<
...
@@ -144,6 +144,7 @@ export type serviceType = InterItemFunction<
industryId
:
number
;
industryId
:
number
;
id
:
number
;
id
:
number
;
companyId
:
number
;
companyId
:
number
;
sort
:
number
;
}[]
}[]
>
;
>
;
//服务-上下架-批量
//服务-上下架-批量
...
@@ -171,3 +172,5 @@ export type serviceDetailType = InterFunction<
...
@@ -171,3 +172,5 @@ export type serviceDetailType = InterFunction<
companyName
:
string
;
companyName
:
string
;
}
}
>
;
>
;
//服务-上下移动
export
type
exChangeServiceType
=
InterFunction
<
{
id
:
number
;
sort
:
number
}[],
any
>
;
src/api/interface/produceManageType.ts
浏览文件 @
a8f737ae
...
@@ -140,7 +140,7 @@ export type editProductSpecPriceType = InterFunction<
...
@@ -140,7 +140,7 @@ export type editProductSpecPriceType = InterFunction<
productSpecId
?:
number
;
productSpecId
?:
number
;
specPrice
:
{
cooperationTag
:
number
;
price
:
number
}[];
specPrice
:
{
cooperationTag
:
number
;
price
:
number
}[];
type
:
number
;
type
:
number
;
},
}
[]
,
null
null
>
;
>
;
//加盟标签-列表
//加盟标签-列表
...
...
src/api/modules/categoryManage.ts
浏览文件 @
a8f737ae
import
axios
from
'../request'
;
import
axios
from
'../request'
;
import
{
import
{
categoryDetailsType
,
categoryListType
,
categoryListType
,
categoryRelevantType
,
directoryListType
,
directoryListType
,
directoryPageListType
,
directoryPageListType
,
GoodsInfo
,
}
from
'~/api/interface/categoryManage'
;
}
from
'~/api/interface/categoryManage'
;
export
class
CategoryManageAPI
{
export
class
CategoryManageAPI
{
...
@@ -24,9 +25,12 @@ export class CategoryManageAPI {
...
@@ -24,9 +25,12 @@ export class CategoryManageAPI {
return
axios
.
get
(
'/pms/classify/getDirectoryList'
,
{
params
});
return
axios
.
get
(
'/pms/classify/getDirectoryList'
,
{
params
});
};
};
// 新增或编辑目录
// 新增或编辑目录
static
addOrEditDirectory
=
(
static
addOrEditDirectory
=
(
data
:
{
data
:
{
id
?:
number
;
directoryName
:
string
;
type
:
number
;
show
:
number
[]
},
id
?:
number
;
)
=>
{
directoryName
:
string
;
type
:
number
;
show
:
number
[];
})
=>
{
return
axios
.
post
(
'/pms/classify/addOrEditDirectory'
,
data
);
return
axios
.
post
(
'/pms/classify/addOrEditDirectory'
,
data
);
};
};
...
@@ -49,16 +53,6 @@ export class CategoryManageAPI {
...
@@ -49,16 +53,6 @@ export class CategoryManageAPI {
return
axios
.
post
(
'/pms/classify/getClassificationList'
,
data
);
return
axios
.
post
(
'/pms/classify/getClassificationList'
,
data
);
};
};
// PC端-根据分类信息新增自定义规格-下拉选项 (只查产品类型)
static
getProductTypeInfoList
=
():
any
=>
{
return
axios
.
get
(
'uavgoods/mgoods/getGoodsTypeInfoList'
);
};
// 所有分类信息
static
getGoodsTypeListByOneLevel
=
():
any
=>
{
return
axios
.
get
(
'uavgoods/mgoods/listGoodsTypeListByOneLevel'
);
};
// 分类修改
// 分类修改
static
updateClassification
=
(
data
:
object
):
any
=>
{
static
updateClassification
=
(
data
:
object
):
any
=>
{
return
axios
.
post
(
'/pms/classify/updateClassification'
,
data
);
return
axios
.
post
(
'/pms/classify/updateClassification'
,
data
);
...
@@ -69,35 +63,20 @@ export class CategoryManageAPI {
...
@@ -69,35 +63,20 @@ export class CategoryManageAPI {
return
axios
.
get
(
'/pms/classify/deleteRelevantBusiness'
,
{
params
});
return
axios
.
get
(
'/pms/classify/deleteRelevantBusiness'
,
{
params
});
};
};
// 删除子分类
static
deleteGoodsTypeByChildren
=
(
params
:
object
):
any
=>
{
return
axios
.
get
(
'uavgoods/mgoods/deleteGoodsTypeByChildren'
,
{
params
});
};
// 查询二级分类
static
listGoodsTypeListByTwoLevel
=
(
params
:
object
):
any
=>
{
return
axios
.
get
(
'uavgoods/mgoods/listGoodsTypeListByTwoLevel'
,
{
params
});
};
// 查询其它服务
static
listOtherService
=
():
any
=>
{
return
axios
.
get
(
'uavgoods/mgoods/listOtherService'
);
};
// 分类上下移动
// 分类上下移动
static
exchangeSortType
=
(
params
:
object
):
any
=>
{
static
exchangeSortType
=
(
params
:
object
):
any
=>
{
return
axios
.
get
(
'/pms/classify/exchangeSortType'
,
{
params
});
return
axios
.
get
(
'/pms/classify/exchangeSortType'
,
{
params
});
};
};
// 分类详情
// 分类详情
static
getGoodsTypeDetail
=
(
obj
:
{
id
:
number
}
)
=>
{
static
getGoodsTypeDetail
:
categoryDetailsType
=
(
params
)
=>
{
return
axios
.
get
(
'/pms/classify/getClassifyDetails'
,
{
params
:
obj
});
return
axios
.
get
(
'/pms/classify/getClassifyDetails'
,
{
params
});
};
};
// 分类详情-安全编码开发修改
// 分类详情-安全编码开发修改
static
updateIsShowCode
=
(
params
:
Pick
<
GoodsInfo
,
'goodsId'
|
'showCode'
>
)
=>
{
//
static updateIsShowCode = (params: Pick<GoodsInfo, 'goodsId' | 'showCode'>) => {
return
axios
.
get
(
'uavgoods/appgoods/updateIsShowCode'
,
{
params
});
//
return axios.get('uavgoods/appgoods/updateIsShowCode', { params });
};
//
};
// 分类详情-商品排序
// 分类详情-商品排序
static
exchangeGoodsInfo
=
(
firstId
:
number
,
secondId
:
number
)
=>
{
static
exchangeGoodsInfo
=
(
firstId
:
number
,
secondId
:
number
)
=>
{
...
@@ -114,4 +93,8 @@ export class CategoryManageAPI {
...
@@ -114,4 +93,8 @@ export class CategoryManageAPI {
static
getAppletQRCode
(
params
:
{
page
:
string
;
scene
:
string
})
{
static
getAppletQRCode
(
params
:
{
page
:
string
;
scene
:
string
})
{
return
axios
.
get
(
'malluser/wechat/getAppletQRCode'
,
{
params
});
return
axios
.
get
(
'malluser/wechat/getAppletQRCode'
,
{
params
});
}
}
// 分类关联列表
static
getRelevantBusiness
:
categoryRelevantType
=
(
params
)
=>
{
return
axios
.
get
(
'/pms/classify/queryRelevantBusiness'
,
{
params
});
};
}
}
src/api/modules/goodsAPI.ts
浏览文件 @
a8f737ae
...
@@ -4,6 +4,7 @@ import {
...
@@ -4,6 +4,7 @@ import {
batchRemoveWareInfoType
,
batchRemoveWareInfoType
,
detailGoodsType
,
detailGoodsType
,
editGoodsType
,
editGoodsType
,
exchangeGoodsInfoType
,
listGoodsType
,
listGoodsType
,
otherServiceType
,
otherServiceType
,
skuUnitType
,
skuUnitType
,
...
@@ -43,5 +44,9 @@ class GoodsAPI {
...
@@ -43,5 +44,9 @@ class GoodsAPI {
static
batchRemoveWareInfo
:
batchRemoveWareInfoType
=
(
data
)
=>
{
static
batchRemoveWareInfo
:
batchRemoveWareInfoType
=
(
data
)
=>
{
return
axios
.
post
(
'/pms/goods/batchRemoveWareInfo'
,
data
);
return
axios
.
post
(
'/pms/goods/batchRemoveWareInfo'
,
data
);
};
};
// 商品-上下移动
static
exchangeGoodsInfo
:
exchangeGoodsInfoType
=
(
params
)
=>
{
return
axios
.
get
(
'/pms/goods/exchangeGoodsInfo'
,
{
params
});
};
}
}
export
default
GoodsAPI
;
export
default
GoodsAPI
;
src/api/modules/mallManage.ts
浏览文件 @
a8f737ae
...
@@ -12,6 +12,7 @@ import {
...
@@ -12,6 +12,7 @@ import {
batchUpAndDownWorkServiceType
,
batchUpAndDownWorkServiceType
,
deleteServiceType
,
deleteServiceType
,
serviceDetailType
,
serviceDetailType
,
exChangeServiceType
,
}
from
'~/api/interface/mallManageType'
;
}
from
'~/api/interface/mallManageType'
;
export
class
MallManageAPI
{
export
class
MallManageAPI
{
...
@@ -52,4 +53,7 @@ export class MallManageAPI {
...
@@ -52,4 +53,7 @@ export class MallManageAPI {
// 服务-详情
// 服务-详情
static
getServiceDetail
:
serviceDetailType
=
(
params
)
=>
static
getServiceDetail
:
serviceDetailType
=
(
params
)
=>
axios
.
get
(
'/pms/backstage/work/queryWorkService'
,
{
params
});
axios
.
get
(
'/pms/backstage/work/queryWorkService'
,
{
params
});
// 服务-上下移
static
exChangeService
:
exChangeServiceType
=
(
data
)
=>
axios
.
post
(
'/pms/backstage/work/exchange'
,
data
);
}
}
src/components/goods/commonAddOrEdit/addOrEditSkuModal/index.tsx
浏览文件 @
a8f737ae
...
@@ -206,11 +206,11 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
...
@@ -206,11 +206,11 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
);
);
};
};
//产品-规格
//产品-规格
const
getProductSpecList
=
(
productSkuId
:
number
)
=>
{
const
getProductSpecList
=
(
productSkuId
:
number
,
isDetail
?:
boolean
)
=>
{
ProduceManageAPI
.
listPageProductSpec
({
pageNo
:
1
,
pageSize
:
9999
,
productSkuId
}).
then
(
ProduceManageAPI
.
listPageProductSpec
({
pageNo
:
1
,
pageSize
:
9999
,
productSkuId
}).
then
(
({
result
})
=>
{
({
result
})
=>
{
setProductSpecList
(
result
.
list
||
[]);
setProductSpecList
(
result
.
list
||
[]);
if
(
result
.
list
)
{
if
(
result
.
list
&&
!
isDetail
)
{
const
ids
:
number
[]
=
result
.
list
.
reduce
((
pre
:
number
[],
cur
)
=>
{
const
ids
:
number
[]
=
result
.
list
.
reduce
((
pre
:
number
[],
cur
)
=>
{
return
cur
.
priceList
||
goodsType
===
1
?
[...
pre
,
cur
.
id
]
:
pre
;
return
cur
.
priceList
||
goodsType
===
1
?
[...
pre
,
cur
.
id
]
:
pre
;
},
[]);
},
[]);
...
@@ -380,7 +380,7 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
...
@@ -380,7 +380,7 @@ const AddOrEditSkuModal: React.FC<ModalProps & selfProps> = ({
if
(
Object
.
keys
(
curtRowData
).
length
!==
0
)
{
if
(
Object
.
keys
(
curtRowData
).
length
!==
0
)
{
setDialogTitle
(
'编辑'
);
setDialogTitle
(
'编辑'
);
if
(
!
curtRowData
.
flag
)
{
if
(
!
curtRowData
.
flag
)
{
getProductSpecList
(
curtRowData
.
skuId
as
number
);
getProductSpecList
(
curtRowData
.
skuId
as
number
,
true
);
}
}
const
specIds
:
number
[]
=
const
specIds
:
number
[]
=
curtRowData
.
specIds
&&
curtRowData
.
specIds
.
map
((
i
:
any
)
=>
i
.
mallSpecId
);
curtRowData
.
specIds
&&
curtRowData
.
specIds
.
map
((
i
:
any
)
=>
i
.
mallSpecId
);
...
...
src/components/goods/commonAddOrEdit/stockSku/index.tsx
浏览文件 @
a8f737ae
...
@@ -5,10 +5,6 @@ import './index.scss';
...
@@ -5,10 +5,6 @@ import './index.scss';
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
ColumnsType
}
from
'antd/es/table'
;
import
{
customizeEntity
,
skuUnitType
,
specEntity
}
from
'~/api/interface/goodsType'
;
import
{
customizeEntity
,
skuUnitType
,
specEntity
}
from
'~/api/interface/goodsType'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
categoryListType
}
from
'~/api/interface/categoryManage'
;
//分类返回类型
type
categoryType
=
InterDataType
<
categoryListType
>
[
'list'
];
//产品-规格单位返回类型
//产品-规格单位返回类型
type
unitType
=
InterDataType
<
skuUnitType
>
;
type
unitType
=
InterDataType
<
skuUnitType
>
;
...
@@ -16,7 +12,6 @@ type unitType = InterDataType<skuUnitType>;
...
@@ -16,7 +12,6 @@ type unitType = InterDataType<skuUnitType>;
interface
selfProps
{
interface
selfProps
{
addOrEditSku
:
(
record
?:
specEntity
)
=>
void
;
addOrEditSku
:
(
record
?:
specEntity
)
=>
void
;
specData
:
specEntity
[];
specData
:
specEntity
[];
categoryList
:
categoryType
;
skuUnitList
:
unitType
;
skuUnitList
:
unitType
;
deleteSku
:
(
record
:
specEntity
)
=>
void
;
deleteSku
:
(
record
:
specEntity
)
=>
void
;
isDetail
:
boolean
;
isDetail
:
boolean
;
...
@@ -25,7 +20,6 @@ interface selfProps {
...
@@ -25,7 +20,6 @@ interface selfProps {
const
StockSku
:
React
.
FC
<
selfProps
>
=
({
const
StockSku
:
React
.
FC
<
selfProps
>
=
({
addOrEditSku
,
addOrEditSku
,
specData
,
specData
,
categoryList
,
skuUnitList
,
skuUnitList
,
deleteSku
,
deleteSku
,
isDetail
,
isDetail
,
...
...
src/pages/categoryManage/category/detail/index.tsx
浏览文件 @
a8f737ae
/*
import
{
useState
,
useEffect
}
from
'react'
;
* ~Author: 龚洪江
import
{
Form
,
Upload
,
Button
,
Table
,
Input
,
message
}
from
'antd'
;
* ~Date: 2022-07-22 15:13:52
* ~LastEditors: 龚洪江
* ~LastEditTime: 2022-08-12 10:29:36
* ~FilePath: \code\mmc-store\src\pages\goodsManage\children\category\detail\index.tsx
* ~Description:
*
* Copyright (c) 2022 by 龚洪江 2238959530~qq.com, All Rights Reserved.
*/
import
{
FC
,
useState
,
useEffect
}
from
'react'
;
import
{
Form
,
Upload
,
Button
,
Table
,
Modal
,
Input
,
Switch
,
message
}
from
'antd'
;
import
type
{
UploadFile
}
from
'antd/es/upload/interface'
;
import
type
{
UploadFile
}
from
'antd/es/upload/interface'
;
import
type
{
ColumnsType
,
ColumnType
}
from
'antd/es/table'
;
import
type
{
ColumnsType
}
from
'antd/es/table'
;
import
type
{
TableRowSelection
}
from
'antd/es/table/interface'
;
import
type
{
TableRowSelection
}
from
'antd/es/table/interface'
;
import
{
ArrowUpOutlined
,
ArrowDownOutlined
,
SearchOutlined
}
from
'@ant-design/icons'
;
import
{
ArrowUpOutlined
,
ArrowDownOutlined
}
from
'@ant-design/icons'
;
import
qs
from
'query-string'
;
import
Viewer
from
'~/components/viewer'
;
import
{
PaginationEntity
}
from
'~/common/interface/PaginationEntity'
;
import
{
PaginationEntity
}
from
'~/common/interface/PaginationEntity'
;
import
{
categoryDetailEntity
,
GoodsInfo
}
from
'~/api/modules/goods'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
import
useOption
from
'~/common/hook/optionHook'
;
import
'./index.scss'
;
import
'./index.scss'
;
import
{
useLocation
,
useParams
,
useNavigate
}
from
'react-router-dom'
;
import
{
useParams
,
useNavigate
,
useSearchParams
}
from
'react-router-dom'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
categoryDetailsType
}
from
'~/api/interface/categoryManage'
;
const
CategoryDetail
:
FC
=
(
props
:
any
)
=>
{
//分类详情返回类型
type
detailType
=
InterDataType
<
categoryDetailsType
>
;
const
CategoryDetail
=
()
=>
{
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
React
.
Key
[]
>
([]);
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
React
.
Key
[]
>
([]);
const
[
addModalVisible
,
setModalVisible
]
=
useState
<
boolean
>
(
false
);
// 分页数据
// 分页数据
const
[
detailData
,
setDetailData
]
=
useState
<
categoryDetailEntity
>
(
null
!
);
const
[
detailData
,
setDetailData
]
=
useState
<
detailType
>
(
null
!
);
// 全部商品数据
// 全部商品数据
const
[
allGoodsInfo
,
setAllGoodsInfo
]
=
useState
<
GoodsInfo
[]
>
([]);
const
[
allGoodsInfo
,
setAllGoodsInfo
]
=
useState
<
any
>
([]);
const
[
categoryId
,
setCategoryId
]
=
useState
<
number
>
(
0
);
const
[
categoryId
,
setCategoryId
]
=
useState
<
number
>
(
0
);
const
[
isEdit
,
setIsEdit
]
=
useState
<
boolean
>
(
false
);
const
[
isEdit
,
setIsEdit
]
=
useState
<
boolean
>
(
false
);
const
[
detailForm
]
=
const
[
detailForm
]
=
Form
.
useForm
<
any
>
();
Form
.
useForm
<
Pick
<
categoryDetailEntity
,
'description'
|
'classifyName'
|
'icon'
>>
();
const
[
fileList
,
setFileList
]
=
useState
<
any
>
([]);
const
[
fileList
,
setFileList
]
=
useState
<
any
>
([]);
const
[
goodsInfo
,
setGoodsInfo
]
=
useState
<
GoodsInfo
[]
>
([]);
const
[
goodsInfo
,
setGoodsInfo
]
=
useState
<
any
>
([]);
const
[
viewerVisible
,
setViewerVisible
]
=
useState
<
boolean
>
(
false
);
const
[
pagination
,
setPagination
]
=
useState
<
Pick
<
PaginationEntity
,
'pageNo'
|
'pageSize'
>>
({
const
[
pagination
,
setPagination
]
=
useState
<
Pick
<
PaginationEntity
,
'pageNo'
|
'pageSize'
>>
({
pageNo
:
1
,
pageNo
:
1
,
pageSize
:
10
,
pageSize
:
10
,
});
});
const
[
total
,
setTotal
]
=
useState
<
number
>
(
0
);
const
[
total
,
setTotal
]
=
useState
<
number
>
(
0
);
// 当前放大图片
const
[
currentImgList
,
setcurrentImgList
]:
any
=
useState
([]);
const
[
sortTypeId
,
setSortTypeId
]
=
useState
<
number
>
(
-
1
);
const
[
sortTypeId
,
setSortTypeId
]
=
useState
<
number
>
(
-
1
);
const
[
pid
,
setPid
]
=
useState
<
number
>
(
-
1
);
const
[
pid
,
setPid
]
=
useState
<
number
>
(
-
1
);
const
{
id
}
=
useParams
();
const
params
=
useParams
();
const
_id
=
Number
(
id
);
const
[
searchParams
]
=
useSearchParams
();
const
location
=
useLocation
();
const
searchParams
:
any
=
new
URLSearchParams
(
location
.
search
);
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
const
columns
:
ColumnsType
<
GoodsInfo
>
=
[
const
columns
:
ColumnsType
<
any
>
=
[
{
{
title
:
'序号'
,
title
:
'序号'
,
align
:
'center'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
GoodsInfo
,
index
:
number
)
=>
{
render
:
(
_text
:
string
,
_record
,
index
:
number
)
=>
{
return
(
pagination
.
pageNo
-
1
)
*
pagination
.
pageSize
+
index
+
1
;
return
(
pagination
.
pageNo
-
1
)
*
pagination
.
pageSize
+
index
+
1
;
},
},
},
},
...
@@ -68,100 +52,54 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -68,100 +52,54 @@ const CategoryDetail: FC = (props: any) => {
{
{
title
:
'商品图片'
,
title
:
'商品图片'
,
align
:
'center'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
GoodsInfo
,
index
:
number
)
=>
{
render
:
(
text
:
string
,
record
,
index
:
number
)
=>
{
return
(
return
<
img
className=
'goods-img'
src=
{
record
.
goodsImg
}
/>;
<
img
className=
'goods-img'
src=
{
record
.
goodsImg
}
onClick=
{
()
=>
showViewerEvent
(
record
.
goodsImg
)
}
/>
);
},
},
},
},
{
{
title
:
'状态'
,
title
:
'状态'
,
align
:
'center'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
GoodsInfo
,
index
:
number
)
=>
{
render
:
(
text
:
string
,
record
,
index
:
number
)
=>
{
return
<
div
>
{
record
.
shelfStatus
?
'上架'
:
'下架'
}
</
div
>;
return
<
div
>
{
record
.
shelfStatus
?
'上架'
:
'下架'
}
</
div
>;
},
},
},
},
{
title
:
'安全编码开关'
,
align
:
'center'
,
render
:
(
text
:
string
,
record
:
GoodsInfo
,
index
:
number
)
=>
{
return
(
btnCode
&&
(
<
Switch
checked=
{
!!
record
.
showCode
}
onChange=
{
(
checked
,
e
)
=>
switchChangeEvent
(
checked
,
e
,
record
,
index
)
}
/>
)
);
},
},
// {
// title: "操作",
// align: "center",
// filterDropdownVisible:false,
// render: (text: string, record: GoodsInfo, index: number) => {
// return (
// <Button type="link" danger onClick={() => deleteGoods(record)}>
// 删除
// </Button>
// );
// },
// },
];
];
// 按钮权限
const
btnUpperDown
=
useOption
(
22109
);
const
btnChange
=
useOption
(
22110
);
const
btnCode
=
useOption
(
22111
);
useEffect
(()
=>
{
// 分页数据
getGoodsTypeDetail
(
_id
);
},
[
pagination
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
// 全部数据
// 全部数据
getAllGoodsTypeDetail
(
_id
);
// getAllGoodsTypeDetail(_id);
setSortTypeId
(
Number
(
searchParams
.
directoryId
));
getGoodsTypeDetail
(
Number
(
params
.
id
));
setPid
(
Number
(
searchParams
.
pid
));
setSortTypeId
(
Number
(
searchParams
.
get
(
'directoryId'
)));
setCategoryId
(
_id
);
setPid
(
Number
(
searchParams
.
get
(
'pid'
)));
setCategoryId
(
Number
(
params
.
id
));
},
[]);
},
[]);
const
backRoute
=
()
=>
{
const
backRoute
=
()
=>
{
navigate
(
-
1
);
navigate
(
-
1
);
};
};
// 关联商品新增
// 分类详情数据
const
addModalShowEvent
=
()
=>
{
const
getGoodsTypeDetail
=
(
id
:
number
)
=>
{
setModalVisible
(
true
);
CategoryManageAPI
.
getGoodsTypeDetail
({
id
,
...
pagination
}).
then
(({
result
})
=>
{
};
detailForm
.
setFieldsValue
({
const
addConnectGoods
=
()
=>
{
classifyName
:
result
.
classifyName
||
undefined
,
setModalVisible
(
false
);
description
:
result
.
description
||
undefined
,
};
icon
:
result
.
icon
||
''
,
const
cancelHandle
=
()
=>
{
});
setModalVisible
(
false
);
if
(
result
.
icon
)
{
};
setFileList
([
// 分页数据
{
const
getGoodsTypeDetail
=
async
(
id
:
number
)
=>
{
id
:
new
Date
().
getTime
(),
const
res
:
any
=
await
CategoryManageAPI
.
getGoodsTypeDetail
({
id
,
...
pagination
});
status
:
'done'
,
detailForm
.
setFieldsValue
({
url
:
result
.
icon
,
classifyName
:
res
.
result
.
classifyName
?
res
.
result
.
classifyName
:
undefined
,
},
description
:
res
.
result
.
description
?
res
.
result
.
description
:
undefined
,
]);
icon
:
res
.
result
.
icon
?
res
.
result
.
icon
:
''
,
}
setDetailData
(
result
);
});
});
if
(
res
.
result
.
icon
)
{
};
setFileList
([
//分类关联-数据
{
const
getRelevantBusiness
=
(
id
:
number
,
type
:
number
)
=>
{
id
:
new
Date
().
getTime
(),
CategoryManageAPI
.
getRelevantBusiness
({
id
,
type
});
status
:
'done'
,
url
:
res
.
result
.
icon
,
},
]);
}
setDetailData
(
res
.
result
);
setGoodsInfo
(
res
.
result
.
goodsInfo
||
[]);
setTotal
(
res
.
result
.
totalCount
);
};
};
// 全部数据
// 全部数据
const
getAllGoodsTypeDetail
=
async
(
id
:
number
)
=>
{
const
getAllGoodsTypeDetail
=
async
(
id
:
number
)
=>
{
...
@@ -212,64 +150,26 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -212,64 +150,26 @@ const CategoryDetail: FC = (props: any) => {
return
true
;
return
true
;
};
};
// const iconValidator=(rule:any,value:any)=>{
// console.log('数据--->',value)
// }
const
onPreview
=
(
file
:
UploadFile
)
=>
{
showViewerEvent
(
file
.
url
as
string
);
};
// 安全编码
const
switchChangeEvent
=
async
(
checked
:
boolean
,
e
:
React
.
MouseEvent
<
HTMLButtonElement
>
,
record
:
GoodsInfo
,
index
:
number
,
)
=>
{
record
.
showCode
=
checked
?
1
:
0
;
// goodsInfo.splice(index, 1, record);
// setDetailData({ ...detailData });
// setGoodsInfo([...goodsInfo]);
const
res
:
any
=
await
CategoryManageAPI
.
updateIsShowCode
({
goodsId
:
record
.
goodsId
,
showCode
:
record
.
showCode
,
});
if
(
res
.
code
===
'200'
)
{
message
.
success
(
'修改成功'
);
getGoodsTypeDetail
(
_id
);
}
};
// 商品删除
const
deleteGoods
=
(
record
:
GoodsInfo
)
=>
{};
// 修改详情
// 修改详情
const
changeDetailInfo
=
()
=>
{
const
changeDetailInfo
=
()
=>
{
setIsEdit
(
true
);
setIsEdit
(
true
);
};
};
const
sureChangeDetailInfo
=
()
=>
{
const
sureChangeDetailInfo
=
()
=>
{
detailForm
detailForm
.
validateFields
().
then
(
async
(
value
:
any
)
=>
{
.
validateFields
()
const
res
=
await
CategoryManageAPI
.
updateClassification
({
.
then
(
async
(
value
:
Pick
<
categoryDetailEntity
,
'description'
|
'classifyName'
|
'icon'
>
)
=>
{
...
value
,
// console.log("数据--->", value);
sortTypeId
,
const
res
=
await
CategoryManageAPI
.
updateClassification
({
pid
,
// description:value.description,
id
:
categoryId
,
// classifyName:value.classifyName,
// icon:fileList.length?fileList[0].url:'',
...
value
,
sortTypeId
,
pid
,
id
:
categoryId
,
});
if
(
res
.
code
===
'200'
)
{
message
.
success
(
'修改成功'
);
getGoodsTypeDetail
(
categoryId
);
setIsEdit
(
false
);
}
else
{
message
.
error
(
res
.
message
);
}
});
});
if
(
res
.
code
===
'200'
)
{
message
.
success
(
'修改成功'
);
getGoodsTypeDetail
(
categoryId
);
setIsEdit
(
false
);
}
else
{
message
.
error
(
res
.
message
);
}
});
};
};
// 上移
// 上移
const
shiftGoods
=
async
()
=>
{
const
shiftGoods
=
async
()
=>
{
...
@@ -277,11 +177,9 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -277,11 +177,9 @@ const CategoryDetail: FC = (props: any) => {
message
.
warning
(
'请先选择商品'
);
message
.
warning
(
'请先选择商品'
);
}
else
{
}
else
{
const
allIndex
:
number
=
allGoodsInfo
.
findIndex
(
const
allIndex
:
number
=
allGoodsInfo
.
findIndex
(
(
item
:
GoodsInfo
)
=>
item
.
goodsId
===
selectedRowKeys
[
0
],
(
item
:
any
)
=>
item
.
goodsId
===
selectedRowKeys
[
0
],
);
const
index
:
number
=
goodsInfo
.
findIndex
(
(
item
:
GoodsInfo
)
=>
item
.
goodsId
===
selectedRowKeys
[
0
],
);
);
const
index
:
number
=
goodsInfo
.
findIndex
((
item
:
any
)
=>
item
.
goodsId
===
selectedRowKeys
[
0
]);
if
(
index
===
0
&&
pagination
.
pageNo
===
1
)
{
if
(
index
===
0
&&
pagination
.
pageNo
===
1
)
{
message
.
warning
(
'已经到最上面了!'
);
message
.
warning
(
'已经到最上面了!'
);
}
else
{
}
else
{
...
@@ -296,10 +194,6 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -296,10 +194,6 @@ const CategoryDetail: FC = (props: any) => {
}
}
setPagination
({
...
pagination
});
setPagination
({
...
pagination
});
getAllGoodsTypeDetail
(
categoryId
);
getAllGoodsTypeDetail
(
categoryId
);
// let obj: GoodsInfo = goodsInfo[index];
// goodsInfo.splice(index, 1, goodsInfo[index - 1]);
// goodsInfo.splice(index - 1, 1, obj);
// setGoodsInfo([...goodsInfo]);
}
}
}
}
}
}
...
@@ -310,11 +204,9 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -310,11 +204,9 @@ const CategoryDetail: FC = (props: any) => {
message
.
warning
(
'请先选择商品'
);
message
.
warning
(
'请先选择商品'
);
}
else
{
}
else
{
const
allIndex
:
number
=
allGoodsInfo
.
findIndex
(
const
allIndex
:
number
=
allGoodsInfo
.
findIndex
(
(
item
:
GoodsInfo
)
=>
item
.
goodsId
===
selectedRowKeys
[
0
],
(
item
:
any
)
=>
item
.
goodsId
===
selectedRowKeys
[
0
],
);
const
index
:
number
=
goodsInfo
.
findIndex
(
(
item
:
GoodsInfo
)
=>
item
.
goodsId
===
selectedRowKeys
[
0
],
);
);
const
index
:
number
=
goodsInfo
.
findIndex
((
item
:
any
)
=>
item
.
goodsId
===
selectedRowKeys
[
0
]);
if
(
allIndex
===
allGoodsInfo
.
length
-
1
)
{
if
(
allIndex
===
allGoodsInfo
.
length
-
1
)
{
message
.
warning
(
'已经到最下面了!'
);
message
.
warning
(
'已经到最下面了!'
);
}
else
{
}
else
{
...
@@ -329,10 +221,6 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -329,10 +221,6 @@ const CategoryDetail: FC = (props: any) => {
}
}
setPagination
({
...
pagination
});
setPagination
({
...
pagination
});
getAllGoodsTypeDetail
(
categoryId
);
getAllGoodsTypeDetail
(
categoryId
);
// let obj: GoodsInfo = goodsInfo[index];
// goodsInfo.splice(index, 1, goodsInfo[index + 1]);
// goodsInfo.splice(index + 1, 1, obj);
// setGoodsInfo([...goodsInfo]);
}
}
}
}
}
}
...
@@ -341,17 +229,10 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -341,17 +229,10 @@ const CategoryDetail: FC = (props: any) => {
const
paginationChange
=
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
const
paginationChange
=
(
pageNo
:
number
,
pageSize
:
number
)
=>
{
setPagination
({
pageNo
,
pageSize
});
setPagination
({
pageNo
,
pageSize
});
};
};
const
showViewerEvent
=
(
src
:
string
)
=>
{
setcurrentImgList
([{
src
}]);
setViewerVisible
(
true
);
};
const
setVisibleEvent
=
()
=>
{
setViewerVisible
(
false
);
};
const
onSelectChange
=
(
newSelectedRowKeys
:
React
.
Key
[])
=>
{
const
onSelectChange
=
(
newSelectedRowKeys
:
React
.
Key
[])
=>
{
setSelectedRowKeys
(
newSelectedRowKeys
);
setSelectedRowKeys
(
newSelectedRowKeys
);
};
};
const
rowSelection
:
TableRowSelection
<
GoodsInfo
>
=
{
const
rowSelection
:
TableRowSelection
<
any
>
=
{
selectedRowKeys
,
selectedRowKeys
,
onChange
:
onSelectChange
,
onChange
:
onSelectChange
,
type
:
'radio'
,
type
:
'radio'
,
...
@@ -362,18 +243,12 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -362,18 +243,12 @@ const CategoryDetail: FC = (props: any) => {
<
div
className=
'category-detail-head'
>
<
div
className=
'category-detail-head'
>
<
div
className=
'category-detail-title'
>
一、基本信息
</
div
>
<
div
className=
'category-detail-title'
>
一、基本信息
</
div
>
<
div
className=
'category-detail-head-option'
>
<
div
className=
'category-detail-head-option'
>
{
isEdit
?
(
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
onClick=
{
sureChangeDetailInfo
}
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
onClick=
{
sureChangeDetailInfo
}
>
保存
保存
</
Button
>
</
Button
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
onClick=
{
changeDetailInfo
}
>
)
:
btnChange
?
(
修改
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
onClick=
{
changeDetailInfo
}
>
</
Button
>
修改
</
Button
>
)
:
(
''
)
}
<
Button
type=
'primary'
onClick=
{
backRoute
}
>
<
Button
type=
'primary'
onClick=
{
backRoute
}
>
返回
返回
</
Button
>
</
Button
>
...
@@ -396,7 +271,7 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -396,7 +271,7 @@ const CategoryDetail: FC = (props: any) => {
{
isEdit
?
(
{
isEdit
?
(
<
Input
placeholder=
'请输入分类描述'
disabled=
{
!
isEdit
}
maxLength=
{
70
}
/>
<
Input
placeholder=
'请输入分类描述'
disabled=
{
!
isEdit
}
maxLength=
{
70
}
/>
)
:
(
)
:
(
<
span
>
{
detailData
?.
description
}
</
span
>
<
span
>
{
detailData
?.
description
||
'暂无'
}
</
span
>
)
}
)
}
</
Form
.
Item
>
</
Form
.
Item
>
{
detailData
?.
icon
?
(
{
detailData
?.
icon
?
(
...
@@ -412,7 +287,6 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -412,7 +287,6 @@ const CategoryDetail: FC = (props: any) => {
fileList=
{
fileList
}
fileList=
{
fileList
}
customRequest=
{
selfUploadRequest
}
customRequest=
{
selfUploadRequest
}
onRemove=
{
onRemove
}
onRemove=
{
onRemove
}
onPreview=
{
onPreview
}
maxCount=
{
1
}
maxCount=
{
1
}
accept=
'image/*'
accept=
'image/*'
beforeUpload=
{
beforeUpload
}
beforeUpload=
{
beforeUpload
}
...
@@ -430,37 +304,23 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -430,37 +304,23 @@ const CategoryDetail: FC = (props: any) => {
二、关联商品
二、关联商品
</
div
>
</
div
>
<
div
className=
'category-detail-option'
>
<
div
className=
'category-detail-option'
>
{
btnUpperDown
?
(
<
Button
<>
icon=
{
<
ArrowUpOutlined
/>
}
<
Button
type=
'primary'
icon=
{
<
ArrowUpOutlined
/>
}
style=
{
{
marginRight
:
'10px'
}
}
type=
'primary'
onClick=
{
shiftGoods
}
style=
{
{
marginRight
:
'10px'
}
}
/>
onClick=
{
shiftGoods
}
<
Button
/>
icon=
{
<
ArrowDownOutlined
/>
}
<
Button
type=
'primary'
icon=
{
<
ArrowDownOutlined
/>
}
style=
{
{
marginRight
:
'10px'
}
}
type=
'primary'
onClick=
{
downGoods
}
style=
{
{
marginRight
:
'10px'
}
}
/>
onClick=
{
downGoods
}
/>
</>
)
:
(
''
)
}
{
/* <Button type="primary" onClick={addModalShowEvent}>
添加
</Button> */
}
</
div
>
</
div
>
<
div
className=
'category-detail-table'
>
<
div
className=
'category-detail-table'
>
<
Table
<
Table
size=
'small'
size=
'small'
columns=
{
columns=
{
columns
}
Number
(
searchParams
.
directoryId
)
===
1
?
columns
.
filter
((
item
:
ColumnType
<
GoodsInfo
>
)
=>
item
.
title
!=
'安全编码开关'
)
:
columns
}
dataSource=
{
goodsInfo
}
dataSource=
{
goodsInfo
}
pagination=
{
{
pagination=
{
{
total
,
total
,
...
@@ -475,41 +335,6 @@ const CategoryDetail: FC = (props: any) => {
...
@@ -475,41 +335,6 @@ const CategoryDetail: FC = (props: any) => {
rowSelection=
{
rowSelection
}
rowSelection=
{
rowSelection
}
/>
/>
</
div
>
</
div
>
<
Modal
visible=
{
addModalVisible
}
title=
'关联商品新增'
onOk=
{
addConnectGoods
}
onCancel=
{
cancelHandle
}
>
{
/* <Form form={connectForm}>
<Form.Item label="商品">
<Select placeholder="请选择商品" mode="multiple">
<Select.Option value={1}>{1}</Select.Option>
<Select.Option value={2}>{2}</Select.Option>
</Select>
</Form.Item>
</Form> */
}
<
div
className=
'add-goods'
>
<
div
>
<
Input
suffix=
{
<
SearchOutlined
/>
}
placeholder=
'请输入商品名称'
/>
</
div
>
<
div
className=
'add-goods-select'
>
<
div
className=
'add-goods-select-value'
>
<
div
className=
'label'
>
您选择的商品是:
</
div
>
<
div
className=
'select-value'
/>
</
div
>
<
div
className=
'add-goods-select-list'
/>
</
div
>
</
div
>
</
Modal
>
{
/* 图片放大 */
}
<
Viewer
visible=
{
viewerVisible
}
currentImgList=
{
currentImgList
}
activeViewerIndex=
{
0
}
setVisible=
{
setVisibleEvent
}
/>
</
div
>
</
div
>
);
);
};
};
...
...
src/pages/categoryManage/directoryManage/index.tsx
浏览文件 @
a8f737ae
import
{
DeleteOutlined
,
EditOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
DeleteOutlined
,
EditOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
Tag
,
Space
,
Button
,
Table
,
Pagination
,
message
,
Modal
}
from
'antd'
;
import
{
Space
,
Button
,
Table
,
message
,
Modal
}
from
'antd'
;
import
{
ColumnsType
,
TablePaginationConfig
}
from
'antd/es/table'
;
import
{
ColumnsType
,
TablePaginationConfig
}
from
'antd/es/table'
;
import
type
{
FilterValue
,
SorterResult
}
from
'antd/es/table/interface'
;
import
{
useEffect
,
useState
}
from
'react'
;
import
{
FC
,
useEffect
,
useState
}
from
'react'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
import
{
CategoryManageAPI
}
from
'~/api'
;
import
{
category
Entity
,
category
Dec
}
from
'~/api/interface/categoryManage'
;
import
{
categoryDec
}
from
'~/api/interface/categoryManage'
;
import
AddOrEditDec
from
'./components/addOrEditDec'
;
import
AddOrEditDec
from
'./components/addOrEditDec'
;
interface
DataType
{
title
:
string
;
dataIndex
:
string
;
key
:
string
;
align
:
string
;
}
const
typeOptions
=
[
const
typeOptions
=
[
{
{
value
:
0
,
value
:
0
,
...
@@ -29,7 +21,7 @@ const typeOptions = [
...
@@ -29,7 +21,7 @@ const typeOptions = [
},
},
{
{
value
:
3
,
value
:
3
,
label
:
'飞手
服务
分类'
,
label
:
'飞手
培训
分类'
,
},
},
{
{
value
:
4
,
value
:
4
,
...
@@ -37,7 +29,7 @@ const typeOptions = [
...
@@ -37,7 +29,7 @@ const typeOptions = [
},
},
];
];
const
DirectoryManage
:
FC
=
(
props
:
any
)
=>
{
const
DirectoryManage
=
(
)
=>
{
const
[
data
,
setData
]
=
useState
<
categoryDec
[]
>
();
//table数据
const
[
data
,
setData
]
=
useState
<
categoryDec
[]
>
();
//table数据
const
[
loading
,
setLoading
]
=
useState
(
false
);
//table获取数据的loading
const
[
loading
,
setLoading
]
=
useState
(
false
);
//table获取数据的loading
const
[
pagination
,
setPagination
]
=
useState
<
TablePaginationConfig
>
({
const
[
pagination
,
setPagination
]
=
useState
<
TablePaginationConfig
>
({
...
@@ -52,7 +44,7 @@ const DirectoryManage: FC = (props: any) => {
...
@@ -52,7 +44,7 @@ const DirectoryManage: FC = (props: any) => {
const
[
isAddOrEditDecModal
,
setIsAddOrEditDecModal
]
=
useState
<
boolean
>
(
false
);
const
[
isAddOrEditDecModal
,
setIsAddOrEditDecModal
]
=
useState
<
boolean
>
(
false
);
const
[
editData
,
setEditData
]
=
useState
<
categoryDec
|
null
>
(
null
);
const
[
editData
,
setEditData
]
=
useState
<
categoryDec
|
null
>
(
null
);
const
columns
:
ColumnsType
<
DataType
>
=
[
const
columns
:
ColumnsType
<
categoryDec
>
=
[
{
{
title
:
'目录名称'
,
title
:
'目录名称'
,
dataIndex
:
'directoryName'
,
dataIndex
:
'directoryName'
,
...
@@ -70,7 +62,7 @@ const DirectoryManage: FC = (props: any) => {
...
@@ -70,7 +62,7 @@ const DirectoryManage: FC = (props: any) => {
});
});
return
<
div
>
{
find
?.
label
}
</
div
>;
return
<
div
>
{
find
?.
label
}
</
div
>;
},
},
}
/*
}
/*
{
{
title: '目录类型',
title: '目录类型',
dataIndex: 'directoryType',
dataIndex: 'directoryType',
...
@@ -132,7 +124,7 @@ const DirectoryManage: FC = (props: any) => {
...
@@ -132,7 +124,7 @@ const DirectoryManage: FC = (props: any) => {
pageNo
:
pagination
!
.
current
!
,
pageNo
:
pagination
!
.
current
!
,
pageSize
:
pagination
!
.
pageSize
!
,
pageSize
:
pagination
!
.
pageSize
!
,
})
})
.
then
((
res
)
=>
{
.
then
((
res
:
any
)
=>
{
setData
(
setData
(
res
.
result
?.
list
.
map
((
item
:
categoryDec
)
=>
{
res
.
result
?.
list
.
map
((
item
:
categoryDec
)
=>
{
if
(
item
.
pid
)
{
if
(
item
.
pid
)
{
...
@@ -151,7 +143,7 @@ const DirectoryManage: FC = (props: any) => {
...
@@ -151,7 +143,7 @@ const DirectoryManage: FC = (props: any) => {
total
:
res
.
result
.
totalCount
,
total
:
res
.
result
.
totalCount
,
});
});
})
})
.
catch
((
err
)
=>
{
.
catch
(()
=>
{
setData
([]);
setData
([]);
setLoading
(
false
);
setLoading
(
false
);
});
});
...
@@ -163,7 +155,7 @@ const DirectoryManage: FC = (props: any) => {
...
@@ -163,7 +155,7 @@ const DirectoryManage: FC = (props: any) => {
title
:
'目录删除'
,
title
:
'目录删除'
,
content
:
'确认删除该目录?'
,
content
:
'确认删除该目录?'
,
onOk
()
{
onOk
()
{
CategoryManageAPI
.
removeDirectory
(
id
).
then
((
res
)
=>
{
CategoryManageAPI
.
removeDirectory
(
id
).
then
((
res
:
any
)
=>
{
if
(
res
.
code
==
200
)
{
if
(
res
.
code
==
200
)
{
message
.
success
(
'删除成功'
);
message
.
success
(
'删除成功'
);
getDirectoryList
();
getDirectoryList
();
...
@@ -175,13 +167,8 @@ const DirectoryManage: FC = (props: any) => {
...
@@ -175,13 +167,8 @@ const DirectoryManage: FC = (props: any) => {
});
});
};
};
const
handleTableChange
=
(
const
handleTableChange
=
(
pagination
:
TablePaginationConfig
)
=>
{
pagination
:
TablePaginationConfig
,
filters
:
Record
<
string
,
FilterValue
>
,
sorter
:
SorterResult
<
DataType
>
,
)
=>
{
setPagination
(
pagination
);
setPagination
(
pagination
);
// `dataSource` is useless since `pageSize` changed
// `dataSource` is useless since `pageSize` changed
if
(
pagination
.
pageSize
!==
pagination
?.
pageSize
)
{
if
(
pagination
.
pageSize
!==
pagination
?.
pageSize
)
{
setData
([]);
setData
([]);
...
...
src/pages/mallManage/mallGoods/goodsAddOrEditOrDetail/index.tsx
浏览文件 @
a8f737ae
...
@@ -271,7 +271,6 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -271,7 +271,6 @@ const GoodsAddOrEditOrDetail = () => {
<
StockSku
<
StockSku
addOrEditSku=
{
addOrEditSkuShowEvent
}
addOrEditSku=
{
addOrEditSkuShowEvent
}
specData=
{
specData
}
specData=
{
specData
}
categoryList=
{
categoryList
}
skuUnitList=
{
skuUnitList
}
skuUnitList=
{
skuUnitList
}
deleteSku=
{
deleteSkuEvent
}
deleteSku=
{
deleteSkuEvent
}
isDetail=
{
isDetail
}
isDetail=
{
isDetail
}
...
...
src/pages/mallManage/mallGoods/goodsList/index.tsx
浏览文件 @
a8f737ae
...
@@ -19,7 +19,7 @@ import qs from 'query-string';
...
@@ -19,7 +19,7 @@ import qs from 'query-string';
//商品返回类型
//商品返回类型
type
goodsType
=
InterDataType
<
listGoodsType
>
[
'list'
];
type
goodsType
=
InterDataType
<
listGoodsType
>
[
'list'
];
//商品列表筛选类型
//商品列表筛选类型
type
goodsSearchParameters
=
Omit
<
InterReqType
<
listGoodsType
>
,
'
pageNo'
|
'pageSize'
|
'
goodsType'
>
;
type
goodsSearchParameters
=
Omit
<
InterReqType
<
listGoodsType
>
,
'goodsType'
>
;
const
GoodsList
=
()
=>
{
const
GoodsList
=
()
=>
{
//筛选ref
//筛选ref
...
@@ -101,12 +101,16 @@ const GoodsList = () => {
...
@@ -101,12 +101,16 @@ const GoodsList = () => {
},
},
];
];
const
[
tableData
,
setTableData
]
=
useState
<
goodsType
>
([]);
const
[
tableData
,
setTableData
]
=
useState
<
goodsType
>
([]);
const
[
allGoods
,
setAllGoods
]
=
useState
<
goodsType
>
([]);
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
//分页
//分页
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
}
>
({
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
;
totalPage
:
number
}
>
({
pageNo
:
1
,
pageNo
:
1
,
pageSize
:
10
,
pageSize
:
10
,
totalCount
:
0
,
totalCount
:
0
,
totalPage
:
1
,
});
});
//筛选
//筛选
const
[
query
,
setQuery
]
=
useState
<
goodsSearchParameters
>
({
status
:
undefined
});
const
[
query
,
setQuery
]
=
useState
<
goodsSearchParameters
>
({
status
:
undefined
});
...
@@ -126,6 +130,7 @@ const GoodsList = () => {
...
@@ -126,6 +130,7 @@ const GoodsList = () => {
}),
}),
);
);
getGoodsList
(
query
);
getGoodsList
(
query
);
getGoodsList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
setQuery
(
query
);
setQuery
(
query
);
setActiveTabKey
(
key
);
setActiveTabKey
(
key
);
};
};
...
@@ -141,6 +146,7 @@ const GoodsList = () => {
...
@@ -141,6 +146,7 @@ const GoodsList = () => {
}),
}),
);
);
getGoodsList
(
query
);
getGoodsList
(
query
);
getGoodsList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
};
};
//筛选
//筛选
const
searchSuccess
=
(
data
:
any
)
=>
{
const
searchSuccess
=
(
data
:
any
)
=>
{
...
@@ -148,6 +154,10 @@ const GoodsList = () => {
...
@@ -148,6 +154,10 @@ const GoodsList = () => {
pagination
.
pageSize
=
10
;
pagination
.
pageSize
=
10
;
setQuery
({
...
filterObjAttr
(
data
,
[
'time'
]),
status
:
query
.
status
});
setQuery
({
...
filterObjAttr
(
data
,
[
'time'
]),
status
:
query
.
status
});
getGoodsList
({
...
filterObjAttr
(
data
,
[
'time'
]),
status
:
query
.
status
});
getGoodsList
({
...
filterObjAttr
(
data
,
[
'time'
]),
status
:
query
.
status
});
getGoodsList
(
{
...
filterObjAttr
(
data
,
[
'time'
]),
status
:
query
.
status
,
pageSize
:
9999
,
pageNo
:
1
},
true
,
);
setSearchParams
(
setSearchParams
(
qs
.
stringify
({
qs
.
stringify
({
pageNo
:
1
,
pageNo
:
1
,
...
@@ -158,7 +168,7 @@ const GoodsList = () => {
...
@@ -158,7 +168,7 @@ const GoodsList = () => {
);
);
};
};
//商品列表
//商品列表
const
getGoodsList
=
(
query
?:
goodsSearchParameters
)
=>
{
const
getGoodsList
=
(
query
?:
goodsSearchParameters
,
isAll
?:
boolean
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
GoodsAPI
.
getGoodsList
({
GoodsAPI
.
getGoodsList
({
pageNo
:
pagination
.
pageNo
,
pageNo
:
pagination
.
pageNo
,
...
@@ -167,9 +177,14 @@ const GoodsList = () => {
...
@@ -167,9 +177,14 @@ const GoodsList = () => {
...
query
,
...
query
,
}).
then
(({
result
})
=>
{
}).
then
(({
result
})
=>
{
setLoading
(
false
);
setLoading
(
false
);
setTableData
(
result
.
list
||
[]);
if
(
isAll
)
{
pagination
.
totalCount
=
result
.
totalCount
;
setAllGoods
(
result
.
list
||
[]);
setPagination
(
pagination
);
}
else
{
setTableData
(
result
.
list
||
[]);
pagination
.
totalCount
=
result
.
totalCount
;
pagination
.
totalPage
=
result
.
totalPage
;
setPagination
(
pagination
);
}
});
});
};
};
//新增商品
//新增商品
...
@@ -241,11 +256,97 @@ const GoodsList = () => {
...
@@ -241,11 +256,97 @@ const GoodsList = () => {
},
},
});
});
};
};
//上移
const
upGoodsClick
=
()
=>
{
if
(
selectedRowKeys
.
length
===
0
)
{
message
.
warning
(
'请选择商品'
);
}
else
if
(
selectedRowKeys
.
length
>
1
)
{
message
.
warning
(
'最多选择一个商品'
);
}
else
{
const
index
=
tableData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
allIndex
=
allGoods
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
if
(
index
===
0
&&
pagination
.
pageNo
===
1
)
{
message
.
warning
(
'位置已到最前列,无法上移'
);
}
else
{
const
exReqData
=
index
===
0
?
allGoods
.
filter
((
_v
,
index
)
=>
index
===
allIndex
-
1
||
index
===
allIndex
)
.
map
((
v
)
=>
({
id
:
v
.
id
}))
:
tableData
.
filter
((
_v
,
i
)
=>
index
-
1
===
i
||
index
===
i
)
.
map
((
v
)
=>
({
id
:
v
.
id
}));
GoodsAPI
.
exchangeGoodsInfo
({
firstId
:
exReqData
[
0
].
id
,
secondId
:
exReqData
[
1
].
id
}).
then
(
({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'上移成功'
);
if
(
index
===
0
&&
pagination
.
pageNo
!==
1
)
{
pagination
.
pageNo
-=
1
;
setSearchParams
(
qs
.
stringify
({
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
...
query
,
status
:
query
.
status
===
undefined
?
'all'
:
query
.
status
,
}),
);
}
getGoodsList
(
query
);
getGoodsList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
}
},
);
}
}
};
//下移
const
downGoodsClick
=
()
=>
{
if
(
selectedRowKeys
.
length
===
0
)
{
message
.
warning
(
'请选择商品'
);
}
else
if
(
selectedRowKeys
.
length
>
1
)
{
message
.
warning
(
'最多选择一个商品'
);
}
else
{
const
index
=
tableData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
allIndex
=
allGoods
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
if
(
index
===
tableData
.
length
-
1
&&
pagination
.
pageNo
===
pagination
.
totalPage
)
{
message
.
warning
(
'位置已到最后,无法下移'
);
}
else
{
const
exReqData
=
index
===
tableData
.
length
-
1
?
allGoods
.
filter
((
_v
,
index
)
=>
index
===
allIndex
+
1
||
index
===
allIndex
)
.
map
((
v
)
=>
({
id
:
v
.
id
}))
:
tableData
.
filter
((
_v
,
i
)
=>
index
+
1
===
i
||
index
===
i
)
.
map
((
v
)
=>
({
id
:
v
.
id
}));
GoodsAPI
.
exchangeGoodsInfo
({
firstId
:
exReqData
[
0
].
id
,
secondId
:
exReqData
[
1
].
id
}).
then
(
({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'下移成功'
);
if
(
index
===
tableData
.
length
-
1
&&
pagination
.
pageNo
!==
pagination
.
totalPage
)
{
pagination
.
pageNo
+=
1
;
setSearchParams
(
qs
.
stringify
({
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
...
query
,
status
:
query
.
status
===
undefined
?
'all'
:
query
.
status
,
}),
);
}
getGoodsList
(
query
);
getGoodsList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
}
},
);
}
}
};
useEffect
(()
=>
{
useEffect
(()
=>
{
getDirectoryList
();
getDirectoryList
();
pagination
.
pageNo
=
Number
(
searchParams
.
get
(
'pageNo'
)
||
1
);
pagination
.
pageNo
=
Number
(
searchParams
.
get
(
'pageNo'
)
||
1
);
pagination
.
pageSize
=
Number
(
searchParams
.
get
(
'pageSize'
)
||
10
);
pagination
.
pageSize
=
Number
(
searchParams
.
get
(
'pageSize'
)
||
10
);
getGoodsList
(
{
const
queryObj
=
{
goodsName
:
searchParams
.
get
(
'goodsName'
)
||
undefined
,
goodsName
:
searchParams
.
get
(
'goodsName'
)
||
undefined
,
directoryId
:
searchParams
.
get
(
'directoryId'
)
directoryId
:
searchParams
.
get
(
'directoryId'
)
?
Number
(
searchParams
.
get
(
'directoryId'
))
?
Number
(
searchParams
.
get
(
'directoryId'
))
...
@@ -256,7 +357,9 @@ const GoodsList = () => {
...
@@ -256,7 +357,9 @@ const GoodsList = () => {
searchParams
.
get
(
'status'
)
===
'all'
||
searchParams
.
get
(
'status'
)
===
null
searchParams
.
get
(
'status'
)
===
'all'
||
searchParams
.
get
(
'status'
)
===
null
?
undefined
?
undefined
:
Number
(
searchParams
.
get
(
'status'
)),
:
Number
(
searchParams
.
get
(
'status'
)),
});
};
getGoodsList
(
queryObj
);
getGoodsList
({
...
queryObj
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
setActiveTabKey
(
setActiveTabKey
(
searchParams
.
get
(
'status'
)
===
'all'
||
searchParams
.
get
(
'status'
)
===
null
searchParams
.
get
(
'status'
)
===
'all'
||
searchParams
.
get
(
'status'
)
===
null
?
'1'
?
'1'
...
@@ -288,10 +391,20 @@ const GoodsList = () => {
...
@@ -288,10 +391,20 @@ const GoodsList = () => {
/>
/>
<
Card
tabList=
{
tabList
}
activeTabKey=
{
activeTabKey
}
onTabChange=
{
onTabChange
}
>
<
Card
tabList=
{
tabList
}
activeTabKey=
{
activeTabKey
}
onTabChange=
{
onTabChange
}
>
<
div
className=
'header-operate'
style=
{
{
marginBottom
:
'10px'
}
}
>
<
div
className=
'header-operate'
style=
{
{
marginBottom
:
'10px'
}
}
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowUpOutlined
/>
}
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowUpOutlined
/>
}
onClick=
{
upGoodsClick
}
>
上移
上移
</
Button
>
</
Button
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowDownOutlined
/>
}
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowDownOutlined
/>
}
onClick=
{
downGoodsClick
}
>
下移
下移
</
Button
>
</
Button
>
{
activeTabKey
!==
'2'
&&
(
{
activeTabKey
!==
'2'
&&
(
...
...
src/pages/mallManage/produceManage/produceDetail/components/addOrEditProduceSpecModal/index.tsx
浏览文件 @
a8f737ae
...
@@ -86,6 +86,9 @@ const AddOrEditProduceSpecModal: FC<ModalProps & PropsType> = ({
...
@@ -86,6 +86,9 @@ const AddOrEditProduceSpecModal: FC<ModalProps & PropsType> = ({
url
:
data
.
specImage
,
url
:
data
.
specImage
,
},
},
]);
]);
}
else
{
form
.
resetFields
();
setFileList
([]);
}
}
},
[
data
]);
},
[
data
]);
return
(
return
(
...
...
src/pages/mallManage/produceManage/produceDetail/components/setProduceSpecPriceModal/index.tsx
浏览文件 @
a8f737ae
import
React
,
{
FC
,
useEffect
,
useState
}
from
'react'
;
import
React
,
{
FC
,
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Input
,
message
,
Modal
,
Select
,
Row
,
Col
,
Button
,
ModalProps
}
from
'antd'
;
import
{
Form
,
Input
,
message
,
Modal
,
Select
,
Row
,
Col
,
Button
,
ModalProps
}
from
'antd'
;
import
{
ProduceManageAPI
}
from
'~/api'
;
import
{
ProduceManageAPI
}
from
'~/api'
;
import
{
InterDataType
}
from
'~/api/interface'
;
import
{
InterDataType
,
InterReqType
}
from
'~/api/interface'
;
import
{
cooperationTagType
,
ProductSpecListType
}
from
'~/api/interface/produceManageType'
;
import
{
import
{
filterObjAttr
}
from
'~/utils'
;
cooperationTagType
,
editProductSpecPriceType
,
ProductSpecListType
,
}
from
'~/api/interface/produceManageType'
;
import
_
from
'lodash'
;
//加盟标签返回类型
//加盟标签返回类型
type
cooperationTagResponseType
=
InterDataType
<
cooperationTagType
>
;
type
cooperationTagResponseType
=
InterDataType
<
cooperationTagType
>
;
//产品规格返回类型
//产品规格返回类型
type
specType
=
InterDataType
<
ProductSpecListType
>
[
'list'
][
0
];
type
specType
=
InterDataType
<
ProductSpecListType
>
[
'list'
][
0
];
//配置价格参数类型
type
setPriceParametersType
=
InterReqType
<
editProductSpecPriceType
>
;
interface
PropsType
{
interface
PropsType
{
onCancel
:
()
=>
void
;
onCancel
:
()
=>
void
;
...
@@ -16,6 +22,25 @@ interface PropsType {
...
@@ -16,6 +22,25 @@ interface PropsType {
type
:
number
;
//产品所属类型
type
:
number
;
//产品所属类型
}
}
const
rentDateData
=
[
{
value
:
0
,
label
:
'1-7天'
,
},
{
value
:
1
,
label
:
'8-15天'
,
},
{
value
:
2
,
label
:
'16-30天'
,
},
{
value
:
3
,
label
:
'31天以上'
,
},
];
const
{
Option
}
=
Select
;
const
{
Option
}
=
Select
;
const
SetProduceSpecPriceModal
:
FC
<
ModalProps
&
PropsType
>
=
({
open
,
onCancel
,
data
,
type
})
=>
{
const
SetProduceSpecPriceModal
:
FC
<
ModalProps
&
PropsType
>
=
({
open
,
onCancel
,
data
,
type
})
=>
{
...
@@ -25,42 +50,50 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
...
@@ -25,42 +50,50 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
const
[
tagInfoList
,
setTagInfoList
]
=
useState
<
cooperationTagResponseType
>
([]);
const
[
tagInfoList
,
setTagInfoList
]
=
useState
<
cooperationTagResponseType
>
([]);
// 选择的列表
// 选择的列表
const
[
selectList
,
setSelectList
]
=
useState
<
number
[]
>
([]);
const
[
selectList
,
setSelectList
]
=
useState
<
number
[]
>
([]);
//是否编辑
//配置价格参数
const
[
isEdit
,
setIsEdit
]
=
useState
<
boolean
>
(
false
);
const
[
priceParameters
,
setPriceParameters
]
=
useState
<
setPriceParametersType
>
([]);
//当前租期
const
[
currentLeaseTerm
,
setCurrentLeaseTerm
]
=
useState
<
number
>
(
0
);
// 获取当前规格的价格
// 获取当前规格的价格
const
getProductSpecPrice
=
(
type
:
number
,
productSpecId
?:
number
,
leaseTerm
?:
number
)
=>
{
const
getProductSpecPrice
=
(
type
:
number
,
productSpecId
?:
number
,
leaseTerm
?:
number
)
=>
{
ProduceManageAPI
.
getProductSpecPrice
({
type
,
productSpecId
,
leaseTerm
}).
then
(({
result
})
=>
{
ProduceManageAPI
.
getProductSpecPrice
({
type
,
productSpecId
,
leaseTerm
}).
then
(({
result
})
=>
{
setIsEdit
(
!!
result
.
length
);
const
priceInfoList
=
const
levelNumber
:
number
[]
=
result
type
===
1
?
//租赁
rentDateData
.
map
((
v
)
=>
{
const
specPrice
=
result
.
filter
((
i
)
=>
i
.
leaseTerm
===
v
.
value
)
//type 判断商城商品
.
map
((
v
)
=>
({
cooperationTag
:
v
.
cooperationTag
,
id
:
v
.
id
,
price
:
v
.
price
}));
return
{
leaseTerm
:
v
.
value
,
productSpecId
:
data
?.
id
,
specPrice
,
type
:
type
,
};
})
:
//销售商品
[
{
productSpecId
:
data
?.
id
,
specPrice
:
result
.
map
((
v
)
=>
({
cooperationTag
:
v
.
cooperationTag
,
id
:
v
.
id
,
price
:
v
.
price
,
})),
type
:
type
,
},
];
setPriceParameters
(
priceInfoList
);
const
levelNumber
:
number
[]
=
priceInfoList
[
0
].
specPrice
.
filter
((
v
)
=>
v
.
cooperationTag
!=
0
)
.
filter
((
v
)
=>
v
.
cooperationTag
!=
0
)
.
map
((
v
)
=>
v
.
cooperationTag
);
.
map
((
v
)
=>
v
.
cooperationTag
);
const
Obj
:
any
=
result
.
reduce
((
pre
:
any
,
cur
)
=>
{
const
Obj
:
any
=
priceInfoList
[
0
].
specPrice
.
reduce
((
pre
:
any
,
cur
)
=>
{
pre
[
cur
.
cooperationTag
]
=
cur
.
price
;
pre
[
cur
.
cooperationTag
]
=
cur
.
price
;
return
{
...
pre
};
return
{
...
pre
};
},
{});
},
{});
if
(
result
.
length
)
{
form
.
setFieldsValue
({
...
Obj
,
level
:
levelNumber
});
//没有设置价格的清空
const
arr
=
priceInfoList
[
0
].
specPrice
const
setDefaultObj
=
tagInfoList
.
reduce
((
pre
:
any
,
cur
)
=>
{
if
(
!
Object
.
keys
(
Obj
).
includes
(
cur
.
id
.
toString
()))
{
pre
[
cur
.
id
]
=
undefined
;
}
return
pre
;
},
{});
form
.
setFieldsValue
({
...
Obj
,
level
:
levelNumber
,
...
setDefaultObj
});
}
else
{
//如果没有返回价格,清楚上一次选择的租期价格
const
defaultObj
=
tagInfoList
.
reduce
((
pre
:
any
,
cur
)
=>
{
pre
[
cur
.
id
]
=
undefined
;
return
pre
;
},
{});
form
.
setFieldsValue
({
0
:
undefined
,
level
:
undefined
,
...
defaultObj
,
});
}
const
arr
=
result
.
map
((
i
)
=>
{
.
map
((
i
)
=>
{
return
i
.
cooperationTag
;
return
i
.
cooperationTag
;
})
})
...
@@ -94,23 +127,29 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
...
@@ -94,23 +127,29 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
form
form
.
validateFields
()
.
validateFields
()
.
then
(
async
(
values
)
=>
{
.
then
(
async
(
values
)
=>
{
const
specPrice
=
Object
.
keys
(
filterObjAttr
(
values
,
[
'leaseTerm'
,
'level'
])).
reduce
(
const
specPrice
=
Object
.
getOwnPropertyNames
(
values
)
(
pre
:
any
,
cur
:
string
)
=>
{
.
filter
((
v
)
=>
!
[
'leaseTerm'
,
'level'
].
includes
(
v
))
.
reduce
((
pre
:
any
,
cur
:
string
)
=>
{
return
[...
pre
,
{
price
:
values
[
cur
],
cooperationTag
:
Number
(
cur
)
}];
return
[...
pre
,
{
price
:
values
[
cur
],
cooperationTag
:
Number
(
cur
)
}];
},
},
[]);
[],
if
(
priceParameters
)
{
);
priceParameters
[
currentLeaseTerm
].
specPrice
=
specPrice
;
ProduceManageAPI
[
isEdit
?
'editProductSpecPrice'
:
'setProductSpecPrice'
]({
const
obj
=
priceParameters
specPrice
,
.
filter
((
v
)
=>
v
.
specPrice
.
length
)
productSpecId
:
data
?.
id
,
.
find
((
v
)
=>
v
.
specPrice
.
some
((
v
)
=>
v
.
price
===
undefined
));
type
:
type
,
if
(
obj
&&
!
_
.
isNull
(
obj
.
leaseTerm
))
{
leaseTerm
:
values
.
leaseTerm
,
return
message
.
warning
(
`
${
rentDateData
[
obj
.
leaseTerm
!
].
label
}
存在价格未配置`
);
}).
then
(({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
handleClosed
();
}
}
});
setPriceParameters
([...
priceParameters
]);
ProduceManageAPI
[
'editProductSpecPrice'
](
priceParameters
.
filter
((
v
)
=>
v
.
specPrice
.
length
),
).
then
(({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'操作成功'
);
handleClosed
();
}
});
}
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
message
.
warning
(
err
.
errorFields
[
0
].
errors
[
0
]).
then
();
message
.
warning
(
err
.
errorFields
[
0
].
errors
[
0
]).
then
();
...
@@ -132,7 +171,51 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
...
@@ -132,7 +171,51 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
};
};
//租期选择
//租期选择
const
rentDateChange
=
(
value
:
string
)
=>
{
const
rentDateChange
=
(
value
:
string
)
=>
{
getProductSpecPrice
(
type
,
data
?.
id
,
Number
(
value
));
const
values
=
form
.
getFieldsValue
();
const
specPrice
=
Object
.
getOwnPropertyNames
(
values
)
.
filter
((
v
)
=>
!
[
'leaseTerm'
,
'level'
].
includes
(
v
))
.
reduce
((
pre
:
any
,
cur
:
string
)
=>
{
return
[...
pre
,
{
price
:
values
[
cur
],
cooperationTag
:
Number
(
cur
)
}];
},
[]);
if
(
priceParameters
)
{
priceParameters
[
currentLeaseTerm
].
specPrice
=
specPrice
;
setPriceParameters
([...
priceParameters
]);
}
setCurrentLeaseTerm
(
Number
(
value
));
if
(
priceParameters
&&
priceParameters
[
Number
(
value
)].
specPrice
.
length
)
{
const
Obj
:
any
=
priceParameters
[
Number
(
value
)].
specPrice
.
reduce
((
pre
:
any
,
cur
)
=>
{
pre
[
cur
.
cooperationTag
]
=
cur
.
price
;
return
{
...
pre
};
},
{});
const
levelNumber
:
number
[]
=
priceParameters
[
Number
(
value
)].
specPrice
.
filter
((
v
)
=>
v
.
cooperationTag
!=
0
)
.
map
((
v
)
=>
v
.
cooperationTag
);
//没有设置价格的清空
const
setDefaultObj
=
tagInfoList
.
reduce
((
pre
:
any
,
cur
)
=>
{
if
(
!
Object
.
keys
(
Obj
).
includes
(
cur
.
id
.
toString
()))
{
pre
[
cur
.
id
]
=
undefined
;
}
return
pre
;
},
{});
form
.
setFieldsValue
({
...
Obj
,
level
:
levelNumber
,
...
setDefaultObj
});
const
arr
=
priceParameters
[
Number
(
value
)].
specPrice
.
map
((
i
)
=>
{
return
i
.
cooperationTag
;
})
.
filter
((
i
:
number
)
=>
i
!==
0
);
setSelectList
(
arr
);
}
else
{
const
defaultObj
=
tagInfoList
.
reduce
((
pre
:
any
,
cur
)
=>
{
pre
[
cur
.
id
]
=
undefined
;
return
pre
;
},
{});
form
.
setFieldsValue
({
0
:
undefined
,
level
:
undefined
,
...
defaultObj
,
});
setSelectList
([]);
}
};
};
// componentsDidMounted
// componentsDidMounted
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -167,10 +250,11 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
...
@@ -167,10 +250,11 @@ const SetProduceSpecPriceModal: FC<ModalProps & PropsType> = ({ open, onCancel,
rules=
{
[{
required
:
true
,
message
:
'请选择租期'
}]
}
rules=
{
[{
required
:
true
,
message
:
'请选择租期'
}]
}
>
>
<
Select
onChange=
{
rentDateChange
}
>
<
Select
onChange=
{
rentDateChange
}
>
<
Select
.
Option
value=
{
0
}
>
1-7天
</
Select
.
Option
>
{
rentDateData
.
map
((
v
)
=>
(
<
Select
.
Option
value=
{
1
}
>
8-15天
</
Select
.
Option
>
<
Select
.
Option
value=
{
v
.
value
}
key=
{
v
.
value
}
>
<
Select
.
Option
value=
{
2
}
>
16-30天
</
Select
.
Option
>
{
v
.
label
}
<
Select
.
Option
value=
{
3
}
>
31天以上
</
Select
.
Option
>
</
Select
.
Option
>
))
}
</
Select
>
</
Select
>
</
Form
.
Item
>
</
Form
.
Item
>
)
}
)
}
...
...
src/pages/mallManage/produceManage/produceDetail/index.tsx
浏览文件 @
a8f737ae
...
@@ -163,6 +163,7 @@ function ProduceDetail() {
...
@@ -163,6 +163,7 @@ function ProduceDetail() {
};
};
const
produceSpecPriceModalCancel
=
()
=>
{
const
produceSpecPriceModalCancel
=
()
=>
{
setProduceSpecPriceModalShow
(
false
);
setProduceSpecPriceModalShow
(
false
);
setAddEditData
(
undefined
);
};
};
// 返回上一页
// 返回上一页
const
handleBack
=
()
=>
{
const
handleBack
=
()
=>
{
...
...
src/pages/mallManage/rentGoods/rentAddOrEditOrDetail/index.tsx
浏览文件 @
a8f737ae
...
@@ -271,7 +271,6 @@ const GoodsAddOrEditOrDetail = () => {
...
@@ -271,7 +271,6 @@ const GoodsAddOrEditOrDetail = () => {
<
StockSku
<
StockSku
addOrEditSku=
{
addOrEditSkuShowEvent
}
addOrEditSku=
{
addOrEditSkuShowEvent
}
specData=
{
specData
}
specData=
{
specData
}
categoryList=
{
categoryList
}
skuUnitList=
{
skuUnitList
}
skuUnitList=
{
skuUnitList
}
deleteSku=
{
deleteSkuEvent
}
deleteSku=
{
deleteSkuEvent
}
isDetail=
{
isDetail
}
isDetail=
{
isDetail
}
...
...
src/pages/mallManage/rentGoods/rentList/index.tsx
浏览文件 @
a8f737ae
...
@@ -19,7 +19,7 @@ import qs from 'query-string';
...
@@ -19,7 +19,7 @@ import qs from 'query-string';
//商品返回类型
//商品返回类型
type
goodsType
=
InterDataType
<
listGoodsType
>
[
'list'
];
type
goodsType
=
InterDataType
<
listGoodsType
>
[
'list'
];
//商品列表筛选类型
//商品列表筛选类型
type
goodsSearchParameters
=
Omit
<
InterReqType
<
listGoodsType
>
,
'
pageNo'
|
'pageSize'
|
'
goodsType'
>
;
type
goodsSearchParameters
=
Omit
<
InterReqType
<
listGoodsType
>
,
'goodsType'
>
;
const
RentList
=
()
=>
{
const
RentList
=
()
=>
{
//筛选ref
//筛选ref
const
searchRef
=
useRef
();
const
searchRef
=
useRef
();
...
@@ -100,12 +100,16 @@ const RentList = () => {
...
@@ -100,12 +100,16 @@ const RentList = () => {
},
},
];
];
const
[
tableData
,
setTableData
]
=
useState
<
goodsType
>
([]);
const
[
tableData
,
setTableData
]
=
useState
<
goodsType
>
([]);
const
[
allRentGoods
,
setAllRentGoods
]
=
useState
<
goodsType
>
([]);
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
//分页
//分页
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
}
>
({
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
;
totalPage
:
number
}
>
({
pageNo
:
1
,
pageNo
:
1
,
pageSize
:
10
,
pageSize
:
10
,
totalCount
:
0
,
totalCount
:
0
,
totalPage
:
1
,
});
});
//筛选
//筛选
const
[
query
,
setQuery
]
=
useState
<
goodsSearchParameters
>
({
status
:
undefined
});
const
[
query
,
setQuery
]
=
useState
<
goodsSearchParameters
>
({
status
:
undefined
});
...
@@ -125,6 +129,7 @@ const RentList = () => {
...
@@ -125,6 +129,7 @@ const RentList = () => {
}),
}),
);
);
getGoodsList
(
query
);
getGoodsList
(
query
);
getGoodsList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
setQuery
(
query
);
setQuery
(
query
);
setActiveTabKey
(
key
);
setActiveTabKey
(
key
);
};
};
...
@@ -140,6 +145,7 @@ const RentList = () => {
...
@@ -140,6 +145,7 @@ const RentList = () => {
}),
}),
);
);
getGoodsList
(
query
);
getGoodsList
(
query
);
getGoodsList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
};
};
//筛选
//筛选
const
searchSuccess
=
(
data
:
any
)
=>
{
const
searchSuccess
=
(
data
:
any
)
=>
{
...
@@ -147,6 +153,10 @@ const RentList = () => {
...
@@ -147,6 +153,10 @@ const RentList = () => {
pagination
.
pageSize
=
10
;
pagination
.
pageSize
=
10
;
setQuery
({
...
filterObjAttr
(
data
,
[
'time'
]),
status
:
query
.
status
});
setQuery
({
...
filterObjAttr
(
data
,
[
'time'
]),
status
:
query
.
status
});
getGoodsList
({
...
filterObjAttr
(
data
,
[
'time'
]),
status
:
query
.
status
});
getGoodsList
({
...
filterObjAttr
(
data
,
[
'time'
]),
status
:
query
.
status
});
getGoodsList
(
{
...
filterObjAttr
(
data
,
[
'time'
]),
status
:
query
.
status
,
pageNo
:
1
,
pageSize
:
9999
},
true
,
);
setSearchParams
(
setSearchParams
(
qs
.
stringify
({
qs
.
stringify
({
pageNo
:
1
,
pageNo
:
1
,
...
@@ -157,7 +167,7 @@ const RentList = () => {
...
@@ -157,7 +167,7 @@ const RentList = () => {
);
);
};
};
//商品列表
//商品列表
const
getGoodsList
=
(
query
?:
goodsSearchParameters
)
=>
{
const
getGoodsList
=
(
query
?:
goodsSearchParameters
,
isAll
?:
boolean
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
GoodsAPI
.
getGoodsList
({
GoodsAPI
.
getGoodsList
({
pageNo
:
pagination
.
pageNo
,
pageNo
:
pagination
.
pageNo
,
...
@@ -166,9 +176,14 @@ const RentList = () => {
...
@@ -166,9 +176,14 @@ const RentList = () => {
...
query
,
...
query
,
}).
then
(({
result
})
=>
{
}).
then
(({
result
})
=>
{
setLoading
(
false
);
setLoading
(
false
);
setTableData
(
result
.
list
||
[]);
if
(
isAll
)
{
pagination
.
totalCount
=
result
.
totalCount
;
setAllRentGoods
(
result
.
list
||
[]);
setPagination
(
pagination
);
}
else
{
setTableData
(
result
.
list
||
[]);
pagination
.
totalCount
=
result
.
totalCount
;
pagination
.
totalPage
=
result
.
totalPage
;
setPagination
(
pagination
);
}
});
});
};
};
//新增商品
//新增商品
...
@@ -238,11 +253,98 @@ const RentList = () => {
...
@@ -238,11 +253,98 @@ const RentList = () => {
},
},
});
});
};
};
//上移
const
upGoodsRentClick
=
()
=>
{
if
(
selectedRowKeys
.
length
===
0
)
{
message
.
warning
(
'请选择商品'
);
}
else
if
(
selectedRowKeys
.
length
>
1
)
{
message
.
warning
(
'最多选择一个商品'
);
}
else
{
const
index
=
tableData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
allIndex
=
allRentGoods
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
if
(
index
===
0
&&
pagination
.
pageNo
===
1
)
{
message
.
warning
(
'位置已到最前列,无法上移'
);
}
else
{
const
exReqData
=
index
===
0
?
allRentGoods
.
filter
((
_v
,
index
)
=>
index
===
allIndex
-
1
||
index
===
allIndex
)
.
map
((
v
)
=>
({
id
:
v
.
id
}))
:
tableData
.
filter
((
_v
,
i
)
=>
index
-
1
===
i
||
index
===
i
)
.
map
((
v
)
=>
({
id
:
v
.
id
}));
GoodsAPI
.
exchangeGoodsInfo
({
firstId
:
exReqData
[
0
].
id
,
secondId
:
exReqData
[
1
].
id
}).
then
(
({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'上移成功'
);
if
(
index
===
0
&&
pagination
.
pageNo
!==
1
)
{
pagination
.
pageNo
-=
1
;
setSearchParams
(
qs
.
stringify
({
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
...
query
,
status
:
query
.
status
===
undefined
?
'all'
:
query
.
status
,
}),
);
}
getGoodsList
(
query
);
getGoodsList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
}
},
);
}
}
};
//下移
const
downRentGoodsClick
=
()
=>
{
if
(
selectedRowKeys
.
length
===
0
)
{
message
.
warning
(
'请选择商品'
);
}
else
if
(
selectedRowKeys
.
length
>
1
)
{
message
.
warning
(
'最多选择一个商品'
);
}
else
{
const
index
=
tableData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
allIndex
=
allRentGoods
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
if
(
index
===
tableData
.
length
-
1
&&
pagination
.
pageNo
===
pagination
.
totalPage
)
{
message
.
warning
(
'位置已到最后,无法下移'
);
}
else
{
const
exReqData
=
index
===
tableData
.
length
-
1
?
allRentGoods
.
filter
((
_v
,
index
)
=>
index
===
allIndex
+
1
||
index
===
allIndex
)
.
map
((
v
)
=>
({
id
:
v
.
id
}))
:
tableData
.
filter
((
_v
,
i
)
=>
index
+
1
===
i
||
index
===
i
)
.
map
((
v
)
=>
({
id
:
v
.
id
}));
GoodsAPI
.
exchangeGoodsInfo
({
firstId
:
exReqData
[
0
].
id
,
secondId
:
exReqData
[
1
].
id
}).
then
(
({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'下移成功'
);
if
(
index
===
tableData
.
length
-
1
&&
pagination
.
pageNo
!==
pagination
.
totalPage
)
{
pagination
.
pageNo
+=
1
;
setSearchParams
(
qs
.
stringify
({
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
...
query
,
status
:
query
.
status
===
undefined
?
'all'
:
query
.
status
,
}),
);
}
getGoodsList
(
query
);
getGoodsList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
}
},
);
}
}
};
useEffect
(()
=>
{
useEffect
(()
=>
{
getDirectoryList
();
getDirectoryList
();
pagination
.
pageNo
=
Number
(
searchParams
.
get
(
'pageNo'
)
||
1
);
pagination
.
pageNo
=
Number
(
searchParams
.
get
(
'pageNo'
)
||
1
);
pagination
.
pageSize
=
Number
(
searchParams
.
get
(
'pageSize'
)
||
10
);
pagination
.
pageSize
=
Number
(
searchParams
.
get
(
'pageSize'
)
||
10
);
getGoodsList
(
{
const
queryObj
=
{
goodsName
:
searchParams
.
get
(
'goodsName'
)
||
undefined
,
goodsName
:
searchParams
.
get
(
'goodsName'
)
||
undefined
,
directoryId
:
searchParams
.
get
(
'directoryId'
)
directoryId
:
searchParams
.
get
(
'directoryId'
)
?
Number
(
searchParams
.
get
(
'directoryId'
))
?
Number
(
searchParams
.
get
(
'directoryId'
))
...
@@ -253,7 +355,9 @@ const RentList = () => {
...
@@ -253,7 +355,9 @@ const RentList = () => {
searchParams
.
get
(
'status'
)
===
'all'
||
searchParams
.
get
(
'status'
)
===
null
searchParams
.
get
(
'status'
)
===
'all'
||
searchParams
.
get
(
'status'
)
===
null
?
undefined
?
undefined
:
Number
(
searchParams
.
get
(
'status'
)),
:
Number
(
searchParams
.
get
(
'status'
)),
});
};
getGoodsList
(
queryObj
);
getGoodsList
({
...
queryObj
,
pageSize
:
9999
,
pageNo
:
1
},
true
);
setActiveTabKey
(
setActiveTabKey
(
searchParams
.
get
(
'status'
)
===
'all'
||
searchParams
.
get
(
'status'
)
===
null
searchParams
.
get
(
'status'
)
===
'all'
||
searchParams
.
get
(
'status'
)
===
null
?
'1'
?
'1'
...
@@ -285,10 +389,20 @@ const RentList = () => {
...
@@ -285,10 +389,20 @@ const RentList = () => {
/>
/>
<
Card
tabList=
{
tabList
}
activeTabKey=
{
activeTabKey
}
onTabChange=
{
onTabChange
}
>
<
Card
tabList=
{
tabList
}
activeTabKey=
{
activeTabKey
}
onTabChange=
{
onTabChange
}
>
<
div
className=
'header-operate'
style=
{
{
marginBottom
:
'10px'
}
}
>
<
div
className=
'header-operate'
style=
{
{
marginBottom
:
'10px'
}
}
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowUpOutlined
/>
}
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowUpOutlined
/>
}
onClick=
{
upGoodsRentClick
}
>
上移
上移
</
Button
>
</
Button
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowDownOutlined
/>
}
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowDownOutlined
/>
}
onClick=
{
downRentGoodsClick
}
>
下移
下移
</
Button
>
</
Button
>
{
activeTabKey
!==
'2'
&&
(
{
activeTabKey
!==
'2'
&&
(
...
...
src/pages/mallManage/serviceManage/serviceList/index.tsx
浏览文件 @
a8f737ae
...
@@ -23,7 +23,7 @@ type categoryType = InterDataType<categoryListType>['list'];
...
@@ -23,7 +23,7 @@ type categoryType = InterDataType<categoryListType>['list'];
//服务返回类型
//服务返回类型
type
serviceListType
=
InterDataType
<
serviceType
>
[
'list'
];
type
serviceListType
=
InterDataType
<
serviceType
>
[
'list'
];
//服务列表请求类型
//服务列表请求类型
type
serviceParametersType
=
Omit
<
InterReqType
<
serviceType
>
,
'pageSize'
|
'pageNo'
>
;
type
serviceParametersType
=
InterReqType
<
serviceType
>
;
const
ServiceList
:
FC
<
any
>
=
()
=>
{
const
ServiceList
:
FC
<
any
>
=
()
=>
{
const
searchRef
=
useRef
<
any
>
();
const
searchRef
=
useRef
<
any
>
();
...
@@ -133,14 +133,18 @@ const ServiceList: FC<any> = () => {
...
@@ -133,14 +133,18 @@ const ServiceList: FC<any> = () => {
},
},
];
];
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
loading
,
setLoading
]
=
useState
<
boolean
>
(
false
);
const
[
tableData
,
setTableData
]
=
useState
<
serviceListType
>
([]);
const
[
tableData
,
setTableData
]
=
useState
<
serviceListType
>
([]);
//表格数据
const
[
allServiceData
,
setAllServiceData
]
=
useState
<
serviceListType
>
([]);
const
[
currentServiceData
,
setCurrentServiceData
]
=
useState
<
serviceListType
[
0
]
>
();
const
[
currentServiceData
,
setCurrentServiceData
]
=
useState
<
serviceListType
[
0
]
>
();
// 表格多选
// 表格多选
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
React
.
Key
[]
>
([]);
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
React
.
Key
[]
>
([]);
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
}
>
({
const
[
pagination
,
setPagination
]
=
useState
<
PaginationProps
&
{
totalCount
:
number
;
totalPage
:
number
}
>
({
pageNo
:
1
,
pageNo
:
1
,
pageSize
:
10
,
pageSize
:
10
,
totalCount
:
0
,
totalCount
:
0
,
totalPage
:
1
,
});
});
//筛选
//筛选
const
[
query
,
setQuery
]
=
useState
<
serviceParametersType
>
({
const
[
query
,
setQuery
]
=
useState
<
serviceParametersType
>
({
...
@@ -166,6 +170,15 @@ const ServiceList: FC<any> = () => {
...
@@ -166,6 +170,15 @@ const ServiceList: FC<any> = () => {
);
);
setActiveTabKey
(
key
);
setActiveTabKey
(
key
);
getServiceList
({
...
query
,
displayState
:
key
===
'1'
?
undefined
:
key
===
'2'
?
0
:
1
});
getServiceList
({
...
query
,
displayState
:
key
===
'1'
?
undefined
:
key
===
'2'
?
0
:
1
});
getServiceList
(
{
...
query
,
displayState
:
key
===
'1'
?
undefined
:
key
===
'2'
?
0
:
1
,
pageNo
:
1
,
pageSize
:
9999
,
},
true
,
);
};
};
//新增服务
//新增服务
const
addOrEditServiceModalShow
=
(
record
?:
serviceListType
[
0
])
=>
{
const
addOrEditServiceModalShow
=
(
record
?:
serviceListType
[
0
])
=>
{
...
@@ -182,7 +195,7 @@ const ServiceList: FC<any> = () => {
...
@@ -182,7 +195,7 @@ const ServiceList: FC<any> = () => {
getServiceList
(
query
);
getServiceList
(
query
);
};
};
//服务-列表
//服务-列表
const
getServiceList
=
(
query
?:
serviceParametersType
)
=>
{
const
getServiceList
=
(
query
?:
serviceParametersType
,
isAll
?:
boolean
)
=>
{
setLoading
(
true
);
setLoading
(
true
);
MallManageAPI
.
getServiceList
({
MallManageAPI
.
getServiceList
({
pageNo
:
pagination
.
pageNo
,
pageNo
:
pagination
.
pageNo
,
...
@@ -190,9 +203,14 @@ const ServiceList: FC<any> = () => {
...
@@ -190,9 +203,14 @@ const ServiceList: FC<any> = () => {
...
query
,
...
query
,
}).
then
(({
result
})
=>
{
}).
then
(({
result
})
=>
{
setLoading
(
false
);
setLoading
(
false
);
setTableData
(
result
.
list
||
[]);
if
(
isAll
)
{
pagination
.
totalCount
=
result
.
totalCount
;
setAllServiceData
(
result
.
list
||
[]);
setPagination
(
pagination
);
}
else
{
setTableData
(
result
.
list
||
[]);
pagination
.
totalCount
=
result
.
totalCount
;
pagination
.
totalPage
=
result
.
totalPage
;
setPagination
(
pagination
);
}
});
});
};
};
//行业分类列表
//行业分类列表
...
@@ -283,6 +301,7 @@ const ServiceList: FC<any> = () => {
...
@@ -283,6 +301,7 @@ const ServiceList: FC<any> = () => {
}),
}),
);
);
getServiceList
(
query
);
getServiceList
(
query
);
getServiceList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
};
};
// 表格多选事件
// 表格多选事件
const
onSelectChange
=
(
newSelectedRowKeys
:
React
.
Key
[])
=>
{
const
onSelectChange
=
(
newSelectedRowKeys
:
React
.
Key
[])
=>
{
...
@@ -302,6 +321,7 @@ const ServiceList: FC<any> = () => {
...
@@ -302,6 +321,7 @@ const ServiceList: FC<any> = () => {
);
);
setQuery
(
data
);
setQuery
(
data
);
getServiceList
(
data
);
getServiceList
(
data
);
getServiceList
({
...
data
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
};
};
//预览视频
//预览视频
const
previewVideo
=
(
url
:
string
)
=>
{
const
previewVideo
=
(
url
:
string
)
=>
{
...
@@ -311,6 +331,88 @@ const ServiceList: FC<any> = () => {
...
@@ -311,6 +331,88 @@ const ServiceList: FC<any> = () => {
const
previewCancel
=
()
=>
{
const
previewCancel
=
()
=>
{
setPreviewShow
(
false
);
setPreviewShow
(
false
);
};
};
//上移
const
upServiceClick
=
()
=>
{
if
(
selectedRowKeys
.
length
===
0
)
{
message
.
warning
(
'请选择服务'
);
}
else
if
(
selectedRowKeys
.
length
>
1
)
{
message
.
warning
(
'最多选择一个服务'
);
}
else
{
const
index
=
tableData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
allIndex
=
allServiceData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
if
(
index
===
0
&&
pagination
.
pageNo
===
1
)
{
message
.
warning
(
'位置已到最前列,无法上移'
);
}
else
{
const
exReqData
=
index
===
0
?
allServiceData
.
filter
((
_v
,
index
)
=>
index
===
allIndex
-
1
||
index
===
allIndex
)
.
map
((
v
)
=>
({
id
:
v
.
id
,
sort
:
v
.
sort
}))
:
tableData
.
filter
((
_v
,
i
)
=>
index
-
1
===
i
||
index
===
i
)
.
map
((
v
)
=>
({
id
:
v
.
id
,
sort
:
v
.
sort
}));
MallManageAPI
.
exChangeService
(
exReqData
).
then
(({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'上移成功'
);
if
(
index
===
0
&&
pagination
.
pageNo
!==
1
)
{
pagination
.
pageNo
-=
1
;
setSearchParams
(
qs
.
stringify
({
...
query
,
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
displayState
:
query
.
displayState
===
undefined
?
'all'
:
query
.
displayState
,
}),
);
}
getServiceList
(
query
);
getServiceList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
}
});
}
}
};
//下移
const
downServiceClick
=
()
=>
{
if
(
selectedRowKeys
.
length
===
0
)
{
message
.
warning
(
'请选择服务'
);
}
else
if
(
selectedRowKeys
.
length
>
1
)
{
message
.
warning
(
'最多选择一个服务'
);
}
else
{
const
index
=
tableData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
const
allIndex
=
allServiceData
.
findIndex
((
v
)
=>
v
.
id
===
selectedRowKeys
[
0
]);
if
(
index
===
tableData
.
length
-
1
&&
pagination
.
pageNo
===
pagination
.
totalPage
)
{
message
.
warning
(
'位置已到最后,无法下移'
);
}
else
{
const
exReqData
=
index
===
tableData
.
length
-
1
?
allServiceData
.
filter
((
_v
,
index
)
=>
index
===
allIndex
+
1
||
index
===
allIndex
)
.
map
((
v
)
=>
({
id
:
v
.
id
,
sort
:
v
.
sort
}))
:
tableData
.
filter
((
_v
,
i
)
=>
index
+
1
===
i
||
index
===
i
)
.
map
((
v
)
=>
({
id
:
v
.
id
,
sort
:
v
.
sort
}));
MallManageAPI
.
exChangeService
(
exReqData
).
then
(({
code
})
=>
{
if
(
code
===
'200'
)
{
message
.
success
(
'下移成功'
);
if
(
index
===
tableData
.
length
-
1
&&
pagination
.
pageNo
!==
pagination
.
totalPage
)
{
pagination
.
pageNo
+=
1
;
setSearchParams
(
qs
.
stringify
({
...
query
,
pageNo
:
pagination
.
pageNo
,
pageSize
:
pagination
.
pageSize
,
displayState
:
query
.
displayState
===
undefined
?
'all'
:
query
.
displayState
,
}),
);
}
getServiceList
(
query
);
getServiceList
({
...
query
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
}
});
}
}
};
useEffect
(()
=>
{
useEffect
(()
=>
{
pagination
.
pageNo
=
Number
(
searchParams
.
get
(
'pageNo'
)
||
1
);
pagination
.
pageNo
=
Number
(
searchParams
.
get
(
'pageNo'
)
||
1
);
pagination
.
pageSize
=
Number
(
searchParams
.
get
(
'pageSize'
)
||
10
);
pagination
.
pageSize
=
Number
(
searchParams
.
get
(
'pageSize'
)
||
10
);
...
@@ -345,6 +447,7 @@ const ServiceList: FC<any> = () => {
...
@@ -345,6 +447,7 @@ const ServiceList: FC<any> = () => {
:
'3'
,
:
'3'
,
);
);
getServiceList
(
queryObj
);
getServiceList
(
queryObj
);
getServiceList
({
...
queryObj
,
pageNo
:
1
,
pageSize
:
9999
},
true
);
getIndustryCategoryList
();
getIndustryCategoryList
();
getApplicationCategoryList
();
getApplicationCategoryList
();
},
[]);
},
[]);
...
@@ -367,10 +470,20 @@ const ServiceList: FC<any> = () => {
...
@@ -367,10 +470,20 @@ const ServiceList: FC<any> = () => {
/>
/>
<
Card
tabList=
{
tabList
}
activeTabKey=
{
activeTabKey
}
onTabChange=
{
onTabChange
}
>
<
Card
tabList=
{
tabList
}
activeTabKey=
{
activeTabKey
}
onTabChange=
{
onTabChange
}
>
<
div
className=
'header-operate'
style=
{
{
marginBottom
:
'10px'
}
}
>
<
div
className=
'header-operate'
style=
{
{
marginBottom
:
'10px'
}
}
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowUpOutlined
/>
}
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowUpOutlined
/>
}
onClick=
{
upServiceClick
}
>
上移
上移
</
Button
>
</
Button
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowDownOutlined
/>
}
>
<
Button
type=
'primary'
style=
{
{
marginRight
:
'10px'
}
}
icon=
{
<
ArrowDownOutlined
/>
}
onClick=
{
downServiceClick
}
>
下移
下移
</
Button
>
</
Button
>
{
activeTabKey
!==
'2'
?
(
{
activeTabKey
!==
'2'
?
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论