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
c95f35bb
authored
Apr 18, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
批量下单替换为CSV模板
parent
a3a660e6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
8 deletions
app/Http/Controllers/AddOrderController.php
public/js/add_order.js
resources/views/addOffline/content.blade.php
resources/views/addOnline/content.blade.php
resources/views/addOrder/content.blade.php
app/Http/Controllers/AddOrderController.php
View file @
c95f35bb
...
@@ -632,7 +632,7 @@ Class AddOrderController extends Controller
...
@@ -632,7 +632,7 @@ Class AddOrderController extends Controller
Excel
::
load
(
$filePath
,
function
(
$reader
)
use
(
&
$excel
){
Excel
::
load
(
$filePath
,
function
(
$reader
)
use
(
&
$excel
){
$data
=
$reader
->
getSheet
(
0
);
$data
=
$reader
->
getSheet
(
0
);
$excel
=
$data
->
toArray
();
$excel
=
$data
->
toArray
();
});
}
,
'GBK'
);
if
(
empty
(
$excel
))
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未获取到模板内容,请检查模板内容数据格式'
];
if
(
empty
(
$excel
))
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未获取到模板内容,请检查模板内容数据格式'
];
...
@@ -651,6 +651,8 @@ Class AddOrderController extends Controller
...
@@ -651,6 +651,8 @@ Class AddOrderController extends Controller
return
[
'errcode'
=>
1
,
'errmsg'
=>
'导入模板错误,需导入'
.
$type_val
.
'模板'
];
return
[
'errcode'
=>
1
,
'errmsg'
=>
'导入模板错误,需导入'
.
$type_val
.
'模板'
];
}
}
$excel
=
$this
->
handleData
(
$excel
,
$map
);
// 处理数据
// 验证excel内容
// 验证excel内容
$valid
=
$this
->
excelValid
(
$excel
);
$valid
=
$this
->
excelValid
(
$excel
);
...
@@ -661,10 +663,8 @@ Class AddOrderController extends Controller
...
@@ -661,10 +663,8 @@ Class AddOrderController extends Controller
array_shift
(
$excel
);
// 删除第一行
array_shift
(
$excel
);
// 删除第一行
$goods_info
=
$this
->
handleData
(
$excel
,
$map
);
// 处理数据
// 推送到API
// 推送到API
$data
[
'data'
]
=
$
goods_info
;
$data
[
'data'
]
=
$
excel
;
$data
[
'operator_id'
]
=
$request
->
user
->
userId
;
$data
[
'operator_id'
]
=
$request
->
user
->
userId
;
$data
[
'type'
]
=
3
;
// 后台批量添加标记
$data
[
'type'
]
=
3
;
// 后台批量添加标记
$data
[
'uid'
]
=
$request
->
input
(
'user_id'
);
$data
[
'uid'
]
=
$request
->
input
(
'user_id'
);
...
@@ -709,6 +709,14 @@ Class AddOrderController extends Controller
...
@@ -709,6 +709,14 @@ Class AddOrderController extends Controller
break
;
break
;
}
}
}
}
// 自营ID、采购数量和单价为数字类型
if
(
$k
==
'id'
||
$k
==
'num'
||
$k
==
'goods_price'
)
{
if
(
!
preg_match
(
'/\d/'
,
$v
))
{
$err
=
[
'errcode'
=>
2
,
'errmsg'
=>
$required
[
$k
]
.
'列,第'
.
$key
.
'行格式错误'
];
break
;
}
}
}
}
}
}
});
});
...
...
public/js/add_order.js
View file @
c95f35bb
...
@@ -582,7 +582,7 @@
...
@@ -582,7 +582,7 @@
// 上传文件
// 上传文件
var
form
=
$
(
'<form id="formUpload" method="post" enctype="multipart/form-data">\
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">\
<input type="file" name="upload" id="fileInput" accept="application/vnd.ms-excel, application/x-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
, .csv
">\
</form>'
);
</form>'
);
var
type
=
$
(
this
).
data
(
'type'
);
// 1-联营模板,2-自营模板
var
type
=
$
(
this
).
data
(
'type'
);
// 1-联营模板,2-自营模板
...
...
resources/views/addOffline/content.blade.php
View file @
c95f35bb
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
<div
class=
"batch-btn"
>
<div
class=
"batch-btn"
>
<a
class=
"btn btn-success goods_import"
data-type=
"2"
>
批量导入物料
</a>
<a
class=
"btn btn-success goods_import"
data-type=
"2"
>
批量导入物料
</a>
<a
class=
"btn btn-info"
href=
"http://img.ichunt.com/doc/excel/template/%E8%87%AA%E8%90%A5%E8%AE%A2%E5%8D%95%E6%89%B9%E9%87%8F%E6%B7%BB%E5%8A%A0%E6%A8%A1%E6%9D%BF.
xlsx
"
>
自营物料模板下载
</a>
<a
class=
"btn btn-info"
href=
"http://img.ichunt.com/doc/excel/template/%E8%87%AA%E8%90%A5%E8%AE%A2%E5%8D%95%E6%89%B9%E9%87%8F%E6%B7%BB%E5%8A%A0%E6%A8%A1%E6%9D%BF.
csv
"
>
自营物料模板下载
</a>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
resources/views/addOnline/content.blade.php
View file @
c95f35bb
...
@@ -228,7 +228,7 @@
...
@@ -228,7 +228,7 @@
<div
class=
"batch-btn"
>
<div
class=
"batch-btn"
>
<a
class=
"btn btn-success goods_import"
data-type=
"2"
>
批量导入物料
</a>
<a
class=
"btn btn-success goods_import"
data-type=
"2"
>
批量导入物料
</a>
<a
class=
"btn btn-info"
href=
"http://img.ichunt.com/doc/excel/template/%E8%87%AA%E8%90%A5%E8%AE%A2%E5%8D%95%E6%89%B9%E9%87%8F%E6%B7%BB%E5%8A%A0%E6%A8%A1%E6%9D%BF.
xlsx
"
>
自营物料模板下载
</a>
<a
class=
"btn btn-info"
href=
"http://img.ichunt.com/doc/excel/template/%E8%87%AA%E8%90%A5%E8%AE%A2%E5%8D%95%E6%89%B9%E9%87%8F%E6%B7%BB%E5%8A%A0%E6%A8%A1%E6%9D%BF.
csv
"
>
自营物料模板下载
</a>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
resources/views/addOrder/content.blade.php
View file @
c95f35bb
...
@@ -247,7 +247,7 @@
...
@@ -247,7 +247,7 @@
<div
class=
"batch-btn"
>
<div
class=
"batch-btn"
>
<a
class=
"btn btn-success goods_import"
data-type=
"1"
>
批量导入物料
</a>
<a
class=
"btn btn-success goods_import"
data-type=
"1"
>
批量导入物料
</a>
<a
class=
"btn btn-info"
href=
"http://img.ichunt.com/doc/excel/template/%E8%81%94%E8%90%A5%E8%AE%A2%E5%8D%95%E6%89%B9%E9%87%8F%E6%B7%BB%E5%8A%A0%E6%A8%A1%E6%9D%BF.
xlsx
"
>
联营物料模板下载
</a>
<a
class=
"btn btn-info"
href=
"http://img.ichunt.com/doc/excel/template/%E8%81%94%E8%90%A5%E8%AE%A2%E5%8D%95%E6%89%B9%E9%87%8F%E6%B7%BB%E5%8A%A0%E6%A8%A1%E6%9D%BF.
csv
"
>
联营物料模板下载
</a>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
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