Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a319d090
authored
Apr 02, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REVIEW 支付商户
parent
aea1270d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
107 deletions
+111
-107
src/api/pay/merchant/index.ts
+9
-8
src/views/pay/merchant/MerchantForm.vue
+17
-17
src/views/pay/merchant/index.vue
+82
-79
src/views/system/notice/index.vue
+3
-3
No files found.
src/api/pay/merchant/index.ts
View file @
a319d090
...
...
@@ -29,17 +29,17 @@ export interface MerchantExportReqVO {
}
// 查询列表支付商户
export
const
getMerchantPage
Api
=
(
params
:
MerchantPageReqVO
)
=>
{
export
const
getMerchantPage
=
(
params
:
MerchantPageReqVO
)
=>
{
return
request
.
get
({
url
:
'/pay/merchant/page'
,
params
})
}
// 查询详情支付商户
export
const
getMerchant
Api
=
(
id
:
number
)
=>
{
export
const
getMerchant
=
(
id
:
number
)
=>
{
return
request
.
get
({
url
:
'/pay/merchant/get?id='
+
id
})
}
// 根据商户名称搜索商户列表
export
const
getMerchantListByName
Api
=
(
name
:
string
)
=>
{
export
const
getMerchantListByName
=
(
name
:
string
)
=>
{
return
request
.
get
({
url
:
'/pay/merchant/list-by-name?id='
,
params
:
{
...
...
@@ -49,26 +49,27 @@ export const getMerchantListByNameApi = (name: string) => {
}
// 新增支付商户
export
const
createMerchant
Api
=
(
data
:
MerchantVO
)
=>
{
export
const
createMerchant
=
(
data
:
MerchantVO
)
=>
{
return
request
.
post
({
url
:
'/pay/merchant/create'
,
data
})
}
// 修改支付商户
export
const
updateMerchant
Api
=
(
data
:
MerchantVO
)
=>
{
export
const
updateMerchant
=
(
data
:
MerchantVO
)
=>
{
return
request
.
put
({
url
:
'/pay/merchant/update'
,
data
})
}
// 删除支付商户
export
const
deleteMerchant
Api
=
(
id
:
number
)
=>
{
export
const
deleteMerchant
=
(
id
:
number
)
=>
{
return
request
.
delete
({
url
:
'/pay/merchant/delete?id='
+
id
})
}
// 导出支付商户
export
const
exportMerchant
Api
=
(
params
:
MerchantExportReqVO
)
=>
{
export
const
exportMerchant
=
(
params
:
MerchantExportReqVO
)
=>
{
return
request
.
download
({
url
:
'/pay/merchant/export-excel'
,
params
})
}
// 支付商户状态修改
export
const
changeMerchantStatusApi
=
(
id
:
number
,
status
:
number
)
=>
{
export
const
updateMerchantStatus
=
(
id
:
number
,
status
:
number
)
=>
{
const
data
=
{
id
,
status
...
...
src/views/pay/merchant/
f
orm.vue
→
src/views/pay/merchant/
MerchantF
orm.vue
View file @
a319d090
<
template
>
<Dialog
:title=
"modelTitle"
v-model=
"modelVisible"
width=
"800"
>
<!-- 对话框(添加 / 修改) -->
<el-form
ref=
"formRef"
:model=
"form"
:rules=
"formRules"
label-width=
"80px"
>
<Dialog
:title=
"modelTitle"
v-model=
"modelVisible"
>
<el-form
ref=
"formRef"
:model=
"formData"
:rules=
"formRules"
label-width=
"80px"
>
<el-form-item
label=
"商户全称"
prop=
"name"
>
<el-input
v-model=
"form.name"
placeholder=
"请输入商户全称"
/>
<el-input
v-model=
"form
Data
.name"
placeholder=
"请输入商户全称"
/>
</el-form-item>
<el-form-item
label=
"商户简称"
prop=
"shortName"
>
<el-input
v-model=
"form.shortName"
placeholder=
"请输入商户简称"
/>
<el-input
v-model=
"form
Data
.shortName"
placeholder=
"请输入商户简称"
/>
</el-form-item>
<el-form-item
label=
"开启状态"
prop=
"status"
>
<el-select
v-model=
"form.status"
placeholder=
"请选择状态"
clearable
>
<el-select
v-model=
"form
Data
.status"
placeholder=
"请选择状态"
clearable
>
<el-option
v-for=
"dict in getIntDictOptions(DICT_TYPE.COMMON_STATUS)"
:key=
"dict.value"
...
...
@@ -19,7 +18,7 @@
</el-select>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model=
"form
.remark"
placeholder=
"请输入备注"
/>
<el-input
type=
"textarea"
v-model=
"formData
.remark"
placeholder=
"请输入备注"
/>
</el-form-item>
</el-form>
<template
#
footer
>
...
...
@@ -31,6 +30,7 @@
<
script
setup
lang=
"ts"
>
import
*
as
MerchantApi
from
'@/api/pay/merchant'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
const
{
t
}
=
useI18n
()
// 国际化
const
message
=
useMessage
()
// 消息弹窗
...
...
@@ -38,11 +38,11 @@ const modelVisible = ref(false) // 弹窗的是否展示
const
modelTitle
=
ref
(
''
)
// 弹窗的标题
const
formLoading
=
ref
(
false
)
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const
formType
=
ref
(
''
)
// 表单的类型:create - 新增;update - 修改
const
form
=
ref
({
const
form
Data
=
ref
({
id
:
undefined
,
name
:
''
,
shortName
:
''
,
status
:
undefined
,
status
:
CommonStatusEnum
.
ENABLE
,
remark
:
''
})
const
formRules
=
reactive
({
...
...
@@ -53,7 +53,7 @@ const formRules = reactive({
const
formRef
=
ref
()
// 表单 Ref
/** 打开弹窗 */
const
open
Modal
=
async
(
type
:
string
,
id
?:
number
)
=>
{
const
open
=
async
(
type
:
string
,
id
?:
number
)
=>
{
modelVisible
.
value
=
true
modelTitle
.
value
=
t
(
'action.'
+
type
)
formType
.
value
=
type
...
...
@@ -62,13 +62,13 @@ const openModal = async (type: string, id?: number) => {
if
(
id
)
{
formLoading
.
value
=
true
try
{
form
.
value
=
await
MerchantApi
.
getMerchantApi
(
id
)
form
Data
.
value
=
await
MerchantApi
.
getMerchant
(
id
)
}
finally
{
formLoading
.
value
=
false
}
}
}
defineExpose
({
open
Modal
})
// 提供 openModal
方法,用于打开弹窗
defineExpose
({
open
})
// 提供 open
方法,用于打开弹窗
/** 提交表单 */
const
emit
=
defineEmits
([
'success'
])
// 定义 success 事件,用于操作成功后的回调
...
...
@@ -80,12 +80,12 @@ const submitForm = async () => {
// 提交请求
formLoading
.
value
=
true
try
{
const
data
=
form
.
value
as
unknown
as
MerchantApi
.
MerchantVO
const
data
=
form
Data
.
value
as
unknown
as
MerchantApi
.
MerchantVO
if
(
formType
.
value
===
'create'
)
{
await
MerchantApi
.
createMerchant
Api
(
data
)
await
MerchantApi
.
createMerchant
(
data
)
message
.
success
(
t
(
'common.createSuccess'
))
}
else
{
await
MerchantApi
.
updateMerchant
Api
(
data
)
await
MerchantApi
.
updateMerchant
(
data
)
message
.
success
(
t
(
'common.updateSuccess'
))
}
modelVisible
.
value
=
false
...
...
@@ -98,11 +98,11 @@ const submitForm = async () => {
/** 重置表单 */
const
resetForm
=
()
=>
{
form
.
value
=
{
form
Data
.
value
=
{
id
:
undefined
,
name
:
''
,
shortName
:
''
,
status
:
undefined
,
status
:
CommonStatusEnum
.
ENABLE
,
remark
:
''
}
formRef
.
value
?.
resetFields
()
...
...
src/views/pay/merchant/index.vue
View file @
a319d090
<
template
>
<content-wrap>
<!-- 搜索工作栏 -->
<el-form
class=
"-mb-15px"
:model=
"queryParams"
ref=
"queryFormRef"
:inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
><el-form-item
label=
"商户号"
prop=
"no"
>
<el-input
v-model=
"queryParams.no"
placeholder=
"请输入商户号"
clearable
/>
>
<el-form-item
label=
"商户号"
prop=
"no"
>
<el-input
v-model=
"queryParams.no"
placeholder=
"请输入商户号"
clearable
class=
"!w-240px"
/>
</el-form-item>
<el-form-item
label=
"商户全称"
prop=
"name"
>
<el-input
v-model=
"queryParams.name"
placeholder=
"请输入商户全称"
clearable
/>
<el-input
v-model=
"queryParams.name"
placeholder=
"请输入商户全称"
clearable
class=
"!w-240px"
/>
</el-form-item>
<el-form-item
label=
"商户简称"
prop=
"shortName"
>
<el-input
v-model=
"queryParams.shortName"
placeholder=
"请输入商户简称"
clearable
/>
<el-input
v-model=
"queryParams.shortName"
placeholder=
"请输入商户简称"
clearable
class=
"!w-240px"
/>
</el-form-item>
<el-form-item
label=
"开启状态"
prop=
"status"
>
<el-select
v-model=
"queryParams.status"
placeholder=
"字典状态"
clearable
class=
"!w-240px"
>
<el-option
v-for=
"dict in getDictOptions(DICT_TYPE.COMMON_STATUS)"
:key=
"
parseInt(dict.value)
"
v-for=
"dict in get
Int
DictOptions(DICT_TYPE.COMMON_STATUS)"
:key=
"
dict.value
"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model=
"queryParams.remark"
placeholder=
"请输入备注"
clearable
/>
<el-input
v-model=
"queryParams.remark"
placeholder=
"请输入备注"
clearable
class=
"!w-240px"
/>
</el-form-item>
<el-form-item
label=
"创建时间"
prop=
"createTime"
>
<el-date-picker
v-model=
"queryParams.createTime"
style=
"width: 240px"
value-format=
"YYYY-MM-DD HH:mm:ss"
type=
"datetimerange"
range-separator=
"-"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
class=
"!w-240px"
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
@
click=
"handleQuery"
><Icon
icon=
"ep:search"
class=
"mr-5px"
/>
搜索
</el-button>
<el-button
@
click=
"resetQuery"
><Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
重置
</el-button>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"small"
@
click=
"openModal('create')"
type=
"primary"
@
click=
"openForm('create')"
v-hasPermi=
"['pay:merchant:create']"
>
新增
</el-button
>
</el-col>
<el-col
:span=
"1.5"
>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新增
</el-button
>
<el-button
type=
"
warning
"
type=
"
success
"
plain
icon=
"el-icon-download"
size=
"small"
:loading=
"exportLoading"
@
click=
"handleExport"
:loading=
"exportLoading"
v-hasPermi=
"['pay:merchant:export']"
>
导出
</el-button
>
</el-col>
</el-row>
<Icon
icon=
"ep:download"
class=
"mr-5px"
/>
导出
</el-button>
</el-form-item>
</el-form>
</content-wrap>
<!-- 列表 -->
<content-wrap>
<!-- 列表 -->
<el-table
v-loading=
"loading"
:data=
"list"
>
<el-table-column
label=
"商户编号"
align=
"center"
prop=
"id"
/>
<el-table-column
label=
"商户号"
align=
"center"
prop=
"no"
/>
...
...
@@ -92,52 +99,51 @@
<el-table-column
label=
"备注"
align=
"center"
prop=
"remark"
/>
<el-table-column
label=
"创建时间"
:formatter=
"dateFormatter"
align=
"center"
prop=
"createTime"
:formatter=
"dateFormatter"
width=
"180"
/>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<el-table-column
label=
"操作"
align=
"center"
>
<
template
#
default=
"scope"
>
<el-button
link
type=
"primary"
icon=
"el-icon-edit"
@
click=
"openModal('update', scope.row.id)"
@
click=
"openForm('update', scope.row.id)"
v-hasPermi=
"['pay:merchant:update']"
>
修改
</el-button
>
修改
</el-button>
<el-button
link
type=
"danger"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row.id)"
v-hasPermi=
"['pay:merchant:delete']"
>
删除
</el-button
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination
v-show=
"total > 0"
<!-- 分页 -->
<Pagination
:total=
"total"
v-model:page=
"queryParams.pageNo"
v-model:limit=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<!-- 表单弹窗:添加/修改 -->
<MerchantForm
ref=
"modalRef"
@
success=
"getList"
/>
</content-wrap>
</template>
<!-- 表单弹窗:添加/修改 -->
<MerchantForm
ref=
"formRef"
@
success=
"getList"
/>
</template>
<
script
setup
lang=
"ts"
name=
"Merchant"
>
import
{
DICT_TYPE
,
getDictOptions
}
from
'@/utils/dict'
import
*
as
MerchantApi
from
'@/api/pay/merchant'
import
MerchantForm
from
'./form.vue'
import
download
from
'@/utils/download'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
CommonStatusEnum
}
from
'@/utils/constants'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
download
from
'@/utils/download'
import
*
as
MerchantApi
from
'@/api/pay/merchant'
import
MerchantForm
from
'./MerchantForm.vue'
const
message
=
useMessage
()
// 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
...
...
@@ -145,21 +151,20 @@ const loading = ref(true) // 列表的加载中
const
total
=
ref
(
0
)
// 列表的总页数
const
list
=
ref
([])
// 列表的数据
const
queryParams
=
reactive
({
pageNo
:
1
,
pageSize
:
10
,
name
:
''
,
shortName
:
''
,
status
:
undefined
,
pageNo
:
1
,
pageSize
:
100
status
:
undefined
})
const
queryFormRef
=
ref
()
// 搜索的表单
const
showSearch
=
ref
(
true
)
const
exportLoading
=
ref
(
false
)
// 导出的加载中
/** 查询列表 */
const
getList
=
async
()
=>
{
loading
.
value
=
true
try
{
const
data
=
await
MerchantApi
.
getMerchantPageApi
(
queryParams
)
const
data
=
await
MerchantApi
.
getMerchantPage
(
queryParams
)
list
.
value
=
data
.
list
total
.
value
=
data
.
total
}
finally
{
...
...
@@ -180,9 +185,9 @@ const resetQuery = () => {
}
/** 添加/修改操作 */
const
modal
Ref
=
ref
()
const
open
Modal
=
(
type
:
string
,
id
?:
number
)
=>
{
modalRef
.
value
.
openModal
(
type
,
id
)
const
form
Ref
=
ref
()
const
open
Form
=
(
type
:
string
,
id
?:
number
)
=>
{
formRef
.
value
.
open
(
type
,
id
)
}
/** 删除按钮操作 */
...
...
@@ -191,30 +196,28 @@ const handleDelete = async (id: number) => {
// 删除的二次确认
await
message
.
delConfirm
()
// 发起删除
await
MerchantApi
.
deleteMerchant
Api
(
id
)
await
MerchantApi
.
deleteMerchant
(
id
)
message
.
success
(
t
(
'common.delSuccess'
))
// 刷新列表
await
getList
()
}
catch
{}
}
// 启用状态修改
const
handleStatusChange
=
(
row
:
MerchantApi
.
MerchantVO
)
=>
{
let
info
=
row
.
status
===
CommonStatusEnum
.
ENABLE
?
'启用'
:
'停用'
message
.
confirm
(
'确认要"'
+
info
+
'""'
+
row
.
name
+
'"商户吗?'
,
t
(
'common.reminder'
))
.
then
(
async
()
=>
{
row
.
status
=
row
.
status
===
CommonStatusEnum
.
ENABLE
?
CommonStatusEnum
.
ENABLE
:
CommonStatusEnum
.
DISABLE
await
MerchantApi
.
updateMerchantApi
(
row
)
message
.
success
(
info
+
'成功'
)
// 刷新列表
getList
()
})
.
catch
(()
=>
{
row
.
status
=
row
.
status
===
CommonStatusEnum
.
ENABLE
?
CommonStatusEnum
.
DISABLE
:
CommonStatusEnum
.
ENABLE
})
/** 修改状态操作 */
const
handleStatusChange
=
async
(
row
:
MerchantApi
.
MerchantVO
)
=>
{
try
{
// 修改状态的二次确认
const
text
=
row
.
status
===
CommonStatusEnum
.
ENABLE
?
'启用'
:
'停用'
await
message
.
confirm
(
'确认要"'
+
text
+
'""'
+
row
.
name
+
'"商户吗?'
,
t
(
'common.reminder'
))
// 发起修改状态
await
MerchantApi
.
updateMerchantStatus
(
row
.
id
,
row
.
status
)
// 刷新列表
await
getList
()
}
catch
{
// 取消后,进行恢复按钮
row
.
status
=
row
.
status
===
CommonStatusEnum
.
ENABLE
?
CommonStatusEnum
.
DISABLE
:
CommonStatusEnum
.
ENABLE
}
}
/** 导出按钮操作 */
...
...
@@ -224,7 +227,7 @@ const handleExport = async () => {
await
message
.
exportConfirm
()
// 发起导出
exportLoading
.
value
=
true
const
data
=
await
MerchantApi
.
exportMerchant
Api
(
queryParams
)
const
data
=
await
MerchantApi
.
exportMerchant
(
queryParams
)
download
.
excel
(
data
,
'商户信息.xls'
)
}
catch
{
}
finally
{
...
...
src/views/system/notice/index.vue
View file @
a319d090
...
...
@@ -114,11 +114,11 @@ const loading = ref(true) // 列表的加载中
const
total
=
ref
(
0
)
// 列表的总页数
const
list
=
ref
([])
// 列表的数据
const
queryParams
=
reactive
({
pageNo
:
1
,
pageSize
:
10
,
title
:
''
,
type
:
undefined
,
status
:
undefined
,
pageNo
:
1
,
pageSize
:
100
status
:
undefined
})
const
queryFormRef
=
ref
()
// 搜索的表单
...
...
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