Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
merchant-manage-ui
Commits
4eda831e
Commit
4eda831e
authored
Aug 29, 2023
by
guang.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 审核品牌
parent
dbb6e05c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
176 additions
and
39 deletions
+176
-39
bll.js
src/pages/BrandManage/bll.js
+39
-0
BrandInfo.jsx
src/pages/BrandManage/components/BrandInfo.jsx
+30
-6
index.jsx
src/pages/BrandManage/index.jsx
+7
-2
services.js
src/pages/BrandManage/services.js
+30
-10
staticData.js
src/pages/BrandManage/staticData.js
+64
-18
request.js
src/utils/request.js
+6
-3
No files found.
src/pages/BrandManage/bll.js
0 → 100644
View file @
4eda831e
/**
* 数据模型转换-接口获取数据转换为表单数据
*/
export
const
transformVOToFormData
=
data
=>
{
const
params
=
{
...
data
};
if
(
params
.
authorizationUrl
)
{
params
.
authorizationUrl
=
[
params
.
authorizationUrl
];
}
if
(
params
.
horizontalLogo
)
{
params
.
horizontalLogo
=
[
params
.
horizontalLogo
];
}
if
(
params
.
logo
)
{
params
.
logo
=
[
params
.
logo
];
}
if
(
params
.
qualifyUrl
)
{
params
.
qualifyUrl
=
[
params
.
qualifyUrl
];
}
return
params
;
};
/*
* 表单数据转换-表单数据转换为接口数据
*/
export
const
transformFormDataToDTO
=
res
=>
{
const
params
=
{
...
res
};
if
(
params
.
authorizationUrl
?.
length
)
{
params
.
authorizationUrl
=
params
.
authorizationUrl
.
join
(
'
,
'
);
}
if
(
params
.
horizontalLogo
?.
length
)
{
params
.
horizontalLogo
=
params
.
horizontalLogo
.
join
(
'
,
'
);
}
if
(
params
.
logo
?.
length
)
{
params
.
logo
=
params
.
logo
.
join
(
'
,
'
);
}
if
(
params
.
qualifyUrl
?.
length
)
{
params
.
qualifyUrl
=
params
.
qualifyUrl
.
join
(
'
,
'
);
}
return
params
;
};
src/pages/BrandManage/components/BrandInfo.jsx
View file @
4eda831e
...
...
@@ -2,21 +2,45 @@ import React from 'react';
import
{
BetaSchemaForm
}
from
'
@ant-design/pro-components
'
;
import
{
brandInfoColumn
}
from
'
../staticData.js
'
;
import
{
layout
}
from
'
@/utils/bll
'
;
import
{
apiBrandDetail
,
apiCreateBrand
,
apiEditBrand
,
apiAppendQualifyBrand
}
from
'
../services
'
;
import
{
transformVOToFormData
,
transformFormDataToDTO
}
from
'
../bll.js
'
;
const
BrandInfo
=
props
=>
{
const
refForm
=
React
.
useRef
();
const
{
actionStatus
,
brandId
}
=
props
;
const
closeModal
=
v
=>
{
!
v
&&
props
.
onClose
();
!
v
&&
props
.
onClose
(
false
);
};
const
getAPI
=
()
=>
{
switch
(
actionStatus
)
{
case
'
edit
'
:
return
apiEditBrand
;
case
'
supplement
'
:
return
apiAppendQualifyBrand
;
default
:
return
apiCreateBrand
;
}
};
const
submitForm
=
async
values
=>
{
console
.
log
(
values
);
const
params
=
transformFormDataToDTO
(
values
);
params
.
brandId
=
brandId
;
params
.
id
=
brandId
;
const
api
=
getAPI
();
const
res
=
api
(
params
);
if
(
res
)
{
props
.
onClose
(
true
);
}
};
const
getInfo
=
()
=>
Promise
.
resolve
({
imageList
:
[
'
https://img.yzcdn.cn/vant/cat.jpeg
'
,
'
https://img.yzcdn.cn/vant/cat.jpeg
'
],
});
const
getInfo
=
async
()
=>
{
if
(
brandId
)
{
const
res
=
await
apiBrandDetail
({
brandId
});
if
(
res
?.
data
)
{
return
transformVOToFormData
(
res
.
data
);
}
}
return
{};
};
const
config
=
{
actionStatus
};
...
...
src/pages/BrandManage/index.jsx
View file @
4eda831e
...
...
@@ -21,6 +21,11 @@ const BrandManage = () => {
setVisible
(
!
0
);
};
const
onClose
=
refresh
=>
{
setVisible
(
false
);
refresh
&&
refTable
.
current
.
reload
();
};
return
(
<>
<
ProTable
...
...
@@ -50,7 +55,7 @@ const BrandManage = () => {
添加
</
Button
>,
]
}
rowKey=
{
r
=>
r
.
i
d
}
rowKey=
{
r
=>
r
.
brandI
d
}
bordered
options=
{
false
}
/>
...
...
@@ -58,7 +63,7 @@ const BrandManage = () => {
visible=
{
visible
}
actionStatus=
{
actionStatus
}
brandId=
{
id
}
onClose=
{
()
=>
setVisible
(
false
)
}
onClose=
{
onClose
}
id=
{
id
}
/>
</>
...
...
src/pages/BrandManage/services.js
View file @
4eda831e
import
qs
from
'
qs
'
;
import
request
from
'
@/utils/request
'
;
import
config
from
'
@/../config/env.config
'
;
...
...
@@ -12,13 +13,13 @@ export async function apiBrandList(params) {
...
params
,
pageNo
:
params
.
current
,
};
const
[
data
]
=
await
request
.
post
(
`
${
goodsApi
}
/api/merchants/brands/list`
,
param
,
{
emulateJSON
:
true
,
const
res
=
await
request
.
get
(
`/api/merchants/brands/list?
${
qs
.
stringify
(
param
)}
`
,
{
prefix
:
kdspApi
,
});
if
(
data
)
{
if
(
res
?.
data
)
{
return
{
total
:
data
.
total
,
data
:
data
.
records
,
total
:
res
.
data
.
total
,
data
:
res
.
data
.
records
,
};
}
return
{
...
...
@@ -31,16 +32,33 @@ export async function apiBrandList(params) {
* 添加品牌
* http://yapi.quantgroups.com/project/389/interface/api/66389
* */
export
async
function
apiCreateBrand
(
params
)
{
return
request
.
post
(
`
${
goodsApi
}
/api/merchants/brands/add`
,
params
);
export
async
function
apiCreateBrand
(
data
)
{
return
request
.
post
(
'
/api/merchants/brands/add
'
,
{
data
,
prefix
:
kdspApi
,
});
}
/**
* 编辑品牌
* http://yapi.quantgroups.com/project/389/interface/api/66394
*/
export
async
function
apiEditBrand
(
params
)
{
return
request
.
post
(
`
${
goodsApi
}
/api/merchants/brands/edit`
,
params
);
export
async
function
apiEditBrand
(
data
)
{
return
request
.
post
(
'
/api/merchants/brands/edit
'
,
{
data
,
prefix
:
kdspApi
,
});
}
/**
* 补充资质
* http://yapi.quantgroups.com/project/389/interface/api/66399
*/
export
async
function
apiAppendQualifyBrand
(
data
)
{
return
request
.
post
(
'
/api/merchants/brands/qualify/add
'
,
{
data
,
prefix
:
kdspApi
,
});
}
/**
...
...
@@ -48,5 +66,7 @@ export async function apiEditBrand(params) {
* http://yapi.quantgroups.com/project/389/interface/api/66409
* */
export
async
function
apiBrandDetail
(
params
)
{
return
request
.
get
(
`
${
goodsApi
}
/api/merchants/brands/detail`
,
params
);
return
request
.
get
(
`/api/merchants/brands/detail?
${
qs
.
stringify
(
params
)}
`
,
{
prefix
:
kdspApi
,
});
}
src/pages/BrandManage/staticData.js
View file @
4eda831e
...
...
@@ -2,28 +2,62 @@ import React from 'react';
import
{
Button
}
from
'
antd
'
;
import
UploadImage
from
'
@/components/UploadImg/index.jsx
'
;
// 品牌审核状态 0待审核 1审核通过 2驳回
// 品牌审核状态
/**
* @description: 品牌审核状态 1-待审核
*/
export
const
auditStatusWait
=
1
;
/**
* @description: 品牌审核状态 2-审核通过
*/
export
const
auditStatusPass
=
2
;
/**
* @description: 品牌审核状态 3-审核拒绝
*/
export
const
auditStatusReject
=
3
;
/**
* @description: 品牌审核状态枚举 0-无 1-待审核,2-审核通过,3-审核拒绝
*/
export
const
brandStatusEnum
=
{
0
:
'
待审核
'
,
1
:
'
审核通过
'
,
2
:
'
驳回
'
,
0
:
'
-
'
,
[
auditStatusWait
]:
'
待审核
'
,
[
auditStatusPass
]:
'
审核通过
'
,
[
auditStatusReject
]:
'
驳回
'
,
};
// 品牌审核 1审核通过 2驳回
/**
* @description: 品牌审核 2审核通过 3驳回
*/
export
const
brandAuditEnum
=
{
1
:
'
审核通过
'
,
2
:
'
驳回
'
,
[
auditStatusPass
]
:
'
审核通过
'
,
[
auditStatusReject
]
:
'
驳回
'
,
};
// 操作状态 查看、修改、添加、补充资质
/**
* @description: 品牌操作状态 查看
*/
export
const
brandActionFind
=
'
find
'
;
/**
* @description: 品牌操作状态 修改
*/
export
const
brandActionEdit
=
'
edit
'
;
/**
* @description: 品牌操作状态 添加
*/
export
const
brandActionAdd
=
'
add
'
;
/**
* @description: 品牌操作状态 补充资质
*/
export
const
brandActionSupplement
=
'
supplement
'
;
/**
* @description: 列表基础字段
*/
export
const
brandBaseColumn
=
[
{
title
:
'
品牌名称
'
,
dataIndex
:
'
brandN
ame
'
,
key
:
'
brandN
ame
'
,
dataIndex
:
'
n
ame
'
,
key
:
'
n
ame
'
,
},
{
title
:
'
中文名称
'
,
...
...
@@ -60,6 +94,12 @@ export const brandColumn = config => {
align
:
'
center
'
,
valueEnum
:
brandStatusEnum
,
},
{
title
:
'
驳回原因
'
,
key
:
'
rejectReason
'
,
dataIndex
:
'
rejectReason
'
,
align
:
'
center
'
,
},
{
title
:
'
操作
'
,
hideInSearch
:
true
,
...
...
@@ -67,12 +107,18 @@ export const brandColumn = config => {
align
:
'
center
'
,
width
:
200
,
render
:
(
_
,
r
)
=>
[
<
Button
key
=
"
check
"
type
=
"
primary
"
onClick
=
{()
=>
onAction
(
r
,
'
edit
'
)}
>
修改
<
/Button>
,
<
Button
key
=
"
update
"
type
=
"
primary
"
ghost
onClick
=
{()
=>
onAction
(
r
,
'
supplement
'
)}
>
补充资质
<
/Button>
,
(
r
.
modifiable
&&
(
<
Button
key
=
"
check
"
type
=
"
primary
"
onClick
=
{()
=>
onAction
(
r
,
'
edit
'
)}
>
修改
<
/Button
>
))
||
''
,
([
null
,
auditStatusReject
].
includes
(
r
.
status
)
&&
(
<
Button
key
=
"
supplement
"
type
=
"
primary
"
ghost
onClick
=
{()
=>
onAction
(
r
,
'
supplement
'
)}
>
补充资质
<
/Button
>
))
||
''
,
],
},
];
...
...
@@ -81,7 +127,7 @@ export const brandColumn = config => {
// 品牌信息字段
export
const
brandInfoColumn
=
config
=>
{
const
{
actionStatus
}
=
config
;
const
disabled
=
brandAction
Edit
!
==
actionStatus
;
const
disabled
=
brandAction
Supplement
=
==
actionStatus
;
const
baseInfo
=
[
{
title
:
'
资质证书
'
,
...
...
@@ -154,7 +200,7 @@ export const brandInfoColumn = config => {
fieldProps
:
{
disabled
,
},
renderFormItem
:
()
=>
<
UploadImage
limit
=
{
1
}
width
=
{
219
}
height
=
{
72
}
/>
,
renderFormItem
:
()
=>
<
UploadImage
limit
=
{
1
}
disabled
=
{
disabled
}
width
=
{
219
}
height
=
{
72
}
/>
,
},
{
title
:
'
LOGO上传
'
,
...
...
@@ -166,7 +212,7 @@ export const brandInfoColumn = config => {
fieldProps
:
{
disabled
,
},
renderFormItem
:
()
=>
<
UploadImage
limit
=
{
1
}
width
=
{
192
}
height
=
{
192
}
/>
,
renderFormItem
:
()
=>
<
UploadImage
limit
=
{
1
}
disabled
=
{
disabled
}
width
=
{
192
}
height
=
{
192
}
/>
,
},
];
return
baseInfo
;
...
...
src/utils/request.js
View file @
4eda831e
...
...
@@ -12,7 +12,7 @@ import config from '../../config/env.config';
import
IframeBridge
from
'
./iframeBridge
'
;
let
isRefreshing
=
true
;
le
t
subscriber
=
[];
cons
t
subscriber
=
[];
const
codeMessage
=
{
200
:
'
服务器成功返回请求的数据。
'
,
...
...
@@ -55,10 +55,12 @@ const request = extend({
const
addSubscriber
=
callback
=>
subscriber
.
push
(
callback
);
const
wait
=
async
seconds
=>
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
seconds
));
const
onAccessTokenFetched
=
()
=>
{
console
.
log
(
'
subscriber :>>
'
,
subscriber
);
subscriber
.
forEach
(
callback
=>
callback
());
subscriber
=
[];
//
subscriber = [];
};
const
refreshRequest
=
async
(
url
,
options
)
=>
{
console
.
log
(
'
url, options :>>
'
,
url
,
options
);
const
promise
=
new
Promise
(
resolve
=>
addSubscriber
(()
=>
resolve
(
request
(
url
,
options
))));
if
(
isRefreshing
)
{
isRefreshing
=
false
;
...
...
@@ -67,6 +69,7 @@ const refreshRequest = async (url, options) => {
if
(
data
.
code
===
2000
)
{
localStorage
.
set
(
'
token
'
,
data
.
data
.
accessToken
);
}
console
.
log
(
'
1111111 :>>
'
,
subscriber
.
length
);
onAccessTokenFetched
();
isRefreshing
=
true
;
}
...
...
@@ -115,7 +118,7 @@ request.interceptors.response.use(async (response, options) => {
});
}
// token过期
const
url
=
response
.
url
.
split
(
config
.
api
)[
1
]
;
const
url
=
response
.
url
.
replace
(
options
.
prefix
,
''
)
;
return
refreshRequest
(
url
,
options
);
}
if
(
data
.
code
===
4011
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment