Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
account
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 54da19d1
authored
Nov 20, 2023
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
push代码
1 parent
8b96663b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
20 deletions
html/merchant/edit.html
html/merchant/index.html
js/request.js
html/merchant/edit.html
View file @
54da19d
This diff is collapsed.
Click to expand it.
html/merchant/index.html
View file @
54da19d
...
@@ -723,6 +723,7 @@
...
@@ -723,6 +723,7 @@
})
})
//批量创建商户
//批量创建商户
var
_uploadMerchantUrl
$
(
'#batchCreate'
).
on
(
'click'
,
function
(
e
){
$
(
'#batchCreate'
).
on
(
'click'
,
function
(
e
){
e
.
preventDefault
();
// 阻止按钮默认行为
e
.
preventDefault
();
// 阻止按钮默认行为
...
@@ -752,10 +753,27 @@
...
@@ -752,10 +753,27 @@
var
fileExt
=
fileName
.
split
(
'.'
).
pop
().
toLowerCase
();
var
fileExt
=
fileName
.
split
(
'.'
).
pop
().
toLowerCase
();
if
(
fileExt
===
'xlsx'
||
fileExt
===
'xls'
){
if
(
fileExt
===
'xlsx'
||
fileExt
===
'xls'
){
$
(
layero
).
find
(
'#fileName'
).
val
(
fileName
);
$
(
layero
).
find
(
'#fileName'
).
val
(
fileName
);
}
else
{
// 获取url
layer
.
msg
(
'请选择Excel格式的文件'
);
const
reader
=
new
FileReader
();
$
(
this
).
val
(
''
);
// 清除不正确的文件
reader
.
readAsDataURL
(
file
);
$
(
layero
).
find
(
'#fileName'
).
val
(
''
);
reader
.
onload
=
(
event
)
=>
{
const
base64
=
event
.
target
.
result
.
split
(
','
)[
1
];
const
fileType
=
file
.
name
.
split
(
'.'
).
pop
();
const
fileUrl
=
fileType
+
'@'
+
base64
const
params
=
{
method
:
'glsx.accounts.biz.common.pictureUpload'
,
file
:
fileUrl
}
console
.
log
(
params
)
const
result
=
request
(
params
,
function
(
res
){
if
(
res
.
data
){
_uploadMerchantUrl
=
res
.
data
console
.
log
(
_uploadMerchantUrl
)
}
else
{
layer
.
msg
(
'上传文件失败'
);
}
},
''
,
[
'file'
],
true
)
}
}
}
}
}
});
});
...
@@ -766,29 +784,32 @@
...
@@ -766,29 +784,32 @@
layer
.
msg
(
'请选择文件'
);
layer
.
msg
(
'请选择文件'
);
return
;
return
;
}
}
// 显示loading文案
// 显示loading文案
$
(
layero
).
find
(
'#loadingText'
).
show
();
$
(
layero
).
find
(
'#loadingText'
).
show
();
// 显示loading效果
// 显示loading效果
var
loadingIndex
=
layer
.
load
(
1
,
{
shade
:
0.5
});
var
loadingIndex
=
layer
.
load
(
1
,
{
shade
:
0.5
});
// TODO: 添加您的文件上传逻辑
console
.
log
(
_uploadMerchantUrl
)
// 模拟文件上传和处理请求
var
params
=
{
setTimeout
(
function
()
{
method
:
'merchants.api.merchant.import'
,
url
:
_uploadMerchantUrl
}
request
(
params
,
function
(
res
)
{
// 关闭loading效果
layer
.
close
(
loadingIndex
);
layer
.
close
(
loadingIndex
);
$
(
layero
).
find
(
'#loadingText'
).
hide
();
if
(
res
.
code
==
0
){
var
isSuccess
=
true
;
// 假设成功,您需要根据实际上传结果替换
layer
.
msg
(
'处理成功,系统已自动创建商户,可返回列表查看'
);
if
(
isSuccess
)
{
layer
.
close
(
index
);
// 可以选择是否关闭弹出层
layer
.
msg
(
'处理成功,系统已自动创建商户,可返回列表查看'
);
}
else
{
layer
.
close
(
index
);
// 如果返回的code不是0,表示出错,可以给出错误提示
}
else
{
layer
.
msg
(
'处理失败,可点击 下载失败模版 查看失败原因'
);
$
(
layero
).
find
(
'#templateLink'
).
show
().
text
(
'下载失败模板'
).
attr
(
'href'
,
'失败模板下载URL'
);
}
layer
.
msg
(
'处理失败,可点击 下载失败模板 查看失败原因'
);
}
}
},
60000
);
// 假设上传和处理需要60秒
)
// TODO: 添加您的文件上传逻辑
},
},
btn2
:
function
(
index
,
layero
){
btn2
:
function
(
index
,
layero
){
layer
.
close
(
index
);
layer
.
close
(
index
);
...
...
js/request.js
View file @
54da19d
...
@@ -72,6 +72,7 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
...
@@ -72,6 +72,7 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
delete
settings
.
beforeSend
delete
settings
.
beforeSend
delete
data
.
appKey
delete
data
.
appKey
}
}
console
.
log
(
isOtherUrl
)
data
.
sign
=
sign
(
data
,
common
.
secret
,
noSignAttr
,
isOtherUrl
)
data
.
sign
=
sign
(
data
,
common
.
secret
,
noSignAttr
,
isOtherUrl
)
settings
.
url
=
isOtherUrl
?
common
.
fileUploadURL
+
'?method='
+
params
.
method
:
common
.
baseURL
settings
.
url
=
isOtherUrl
?
common
.
fileUploadURL
+
'?method='
+
params
.
method
:
common
.
baseURL
settings
.
data
=
data
settings
.
data
=
data
...
@@ -96,7 +97,6 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
...
@@ -96,7 +97,6 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
settings
.
contentType
=
false
settings
.
contentType
=
false
}
}
if
(
config
.
isDjUrl
)
{
if
(
config
.
isDjUrl
)
{
console
.
log
(
common
)
settings
.
url
=
common
.
otherRequest
+
'?method='
+
params
.
method
settings
.
url
=
common
.
otherRequest
+
'?method='
+
params
.
method
settings
.
beforeSend
=
function
(
request
)
{
settings
.
beforeSend
=
function
(
request
)
{
var
token
=
store
.
get
(
'token'
)
var
token
=
store
.
get
(
'token'
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment