Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f6580a64
authored
Dec 03, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
temp1
parent
aed60613
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
16 deletions
app/Http/Controllers/AddOrderController.php
app/Http/Controllers/OrderController.php
public/js/add_order.js
app/Http/Controllers/AddOrderController.php
View file @
f6580a64
...
...
@@ -597,15 +597,28 @@ Class AddOrderController extends Controller
// 商品批量导入
public
function
batchGoodsImport
(
Request
$request
)
{
echo
'<pre>'
;
print_r
(
$_FILES
);
print_r
(
$request
->
input
());
die
;
$filePath
=
'storage/exports/'
.
iconv
(
'UTF-8'
,
'GBK'
,
'学生成绩'
)
.
'.xls'
;
Excel
::
load
(
$filePath
,
function
(
$reader
)
{
$data
=
$reader
->
all
();
dd
(
$data
);
$file
=
$_FILES
[
'file'
];
// $request->file('file')
$type
=
$request
->
input
(
'type'
);
// 1.联营 2.自营
$filePath
=
$file
[
'tmp_name'
];
// 临时路径
$excel
=
[];
Excel
::
load
(
$filePath
,
function
(
$reader
)
use
(
&
$excel
){
$data
=
$reader
->
getSheet
(
0
);
$excel
=
$data
->
toArray
();
});
return
$this
->
excelValid
(
$excel
,
$type
);
}
// 验证导入excel
public
function
excelValid
(
$excel
,
$type
)
{
$count
=
count
(
$excel
);
if
(
$count
==
1
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未填写物料信息'
];
// if ($type)
}
}
\ No newline at end of file
app/Http/Controllers/OrderController.php
View file @
f6580a64
...
...
@@ -609,6 +609,8 @@ Class OrderController extends Controller
{
$shipping
=
DB
::
connection
(
'order'
)
->
table
(
'lie_shipping'
)
->
select
(
'shipping_id'
,
'shipping_name'
)
->
get
();
$info
[
'shippings'
]
=
[];
if
(
$shipping
)
{
foreach
(
$shipping
as
$v
)
{
$shippingInfo
[
$v
->
shipping_id
]
=
$v
->
shipping_name
;
...
...
public/js/add_order.js
View file @
f6580a64
...
...
@@ -515,22 +515,23 @@
// 批量导入物料
$
(
'.goods_import'
).
click
(
function
()
{
var
form
=
$
(
'<form id="formUpload" enctype="multipart/form-data">\
<input type="file" name="upload" accept="application/vnd.ms-excel, application/x-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">\
var
form
=
$
(
'<form id="formUpload"
method="post"
enctype="multipart/form-data">\
<input type="file" name="upload"
id="fileInput"
accept="application/vnd.ms-excel, application/x-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">\
</form>'
);
var
type
=
$
(
this
).
data
(
'type'
);
// 1-联营模板,2-自营模板
console
.
log
(
form
);
form
.
find
(
'input'
).
change
(
function
(){
console
.
log
(
$
(
'#formUpload'
))
console
.
log
(
$
(
'#formUpload'
)[
0
])
var
formData
=
new
FormData
(
$
(
'#formUpload'
)[
0
]);
var
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
files
[
0
]);
formData
.
append
(
'type'
,
type
);
console
.
log
(
formData
);
console
.
log
(
formData
)
$
.
ajax
({
type
:
"POST"
,
url
:
'/ajax/batchGoodsImport'
,
data
:
formData
,
cache
:
false
,
dataType
:
'json'
,
cache
:
false
,
processData
:
false
,
contentType
:
false
,
success
:
function
(
resp
){
...
...
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