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
698861e8
authored
Dec 06, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
批量添加物料
parent
45cce3dc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
21 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 @
698861e8
...
...
@@ -318,11 +318,17 @@ Class AddOrderController extends Controller
$data
[
'uid'
]
=
$request
->
input
(
'uid'
);
$data
[
'num'
]
=
$request
->
input
(
'num'
);
$data
[
'cart_id'
]
=
$request
->
input
(
'cart_id'
);
$type
=
$request
->
input
(
'type'
);
// 3-批量添加的商品
$goods_type
=
$request
->
input
(
'goods_type'
);
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$url
=
Config
(
'website.api_domain'
)
.
'cart/changeNumByOrderSystem'
;
if
(
$type
==
3
&&
$goods_type
==
1
)
{
// 联营批量添加
$url
=
Config
(
'website.api_domain'
)
.
'cart/changeNumForJoint'
;
}
else
{
$url
=
Config
(
'website.api_domain'
)
.
'cart/changeNumByOrderSystem'
;
}
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
...
...
@@ -607,6 +613,18 @@ Class AddOrderController extends Controller
$excel
=
$data
->
toArray
();
});
$type
=
$request
->
input
(
'type'
);
// 1.联营 2.自营
if
(
$type
==
1
)
{
$map
=
Config
(
'params.joint_map'
);
$type_val
=
'联营'
;
}
else
{
$map
=
Config
(
'params.self_map'
);
$type_val
=
'自营'
;
}
if
(
count
(
$map
)
!=
count
(
$excel
[
0
]))
return
[
'errcode'
=>
1
,
'errmsg'
=>
'导入模板错误,需导入'
.
$type_val
.
'模板'
];
// 验证excel内容
$valid
=
$this
->
excelValid
(
$excel
);
...
...
@@ -616,22 +634,24 @@ Class AddOrderController extends Controller
array_shift
(
$excel
);
// 删除第一行
$type
=
$request
->
input
(
'type'
);
// 1.联营 2.自营
$goods_info
=
$this
->
handleData
(
$excel
,
$type
);
$goods_info
=
$this
->
handleData
(
$excel
,
$map
);
// 处理数据
// 推送到API
$data
[
'
goods_info
'
]
=
$goods_info
;
$data
[
'
data
'
]
=
$goods_info
;
$data
[
'operator_id'
]
=
$request
->
user
->
userId
;
$data
[
'type'
]
=
$type
;
$data
[
'type'
]
=
3
;
// 后台批量添加标记
$data
[
'uid'
]
=
$request
->
input
(
'user_id'
);
$data
[
'delivery_place'
]
=
$request
->
input
(
'delivery_place'
);
$url
=
Config
(
'website.api_domain'
)
.
'cart/addBatchFromOrder'
;
if
(
$type
==
1
)
{
// 联营
$url
=
Config
(
'website.api_domain'
)
.
'cart/addBatchByOrderSystem'
;
}
else
{
$url
=
Config
(
'website.api_domain'
)
.
'cart/addBatch'
;
}
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
echo
'<pre>'
;
print_r
(
curlApi
(
$url
,
$data
,
"POST"
));
die
;
$temp
=
json_decode
(
curlApi
(
$url
,
$data
,
"POST"
),
true
);
return
[
'errcode'
=>
$temp
[
'err_code'
],
'errmsg'
=>
$temp
[
'err_msg'
]];
...
...
@@ -670,14 +690,8 @@ print_r(curlApi($url, $data, "POST"));die;
}
// 处理导入内容---赋上字段
public
function
handleData
(
$excel
,
$
type
)
public
function
handleData
(
$excel
,
$
map
)
{
if
(
$type
==
1
)
{
$map
=
Config
(
'params.joint_map'
);
}
else
{
$map
=
Config
(
'params.self_map'
);
}
$goods_info
=
array_map
(
function
(
$val
)
use
(
$map
)
{
foreach
(
$val
as
$k
=>
$v
)
{
$tmp
[
$map
[
$k
]]
=
$v
;
...
...
public/js/add_order.js
View file @
698861e8
...
...
@@ -267,10 +267,15 @@
html
+=
'<tr><th>阶梯</th><th>RMB价格</th>'
;
if
(
data
.
ac_type
==
1
)
{
html
+=
'<th>活动价</th>'
;
if
(
data
.
ac_type
)
{
switch
(
data
.
ac_type
)
{
case
1
:
html
+=
'<th>限时限量</th>'
;
break
;
case
2
:
html
+=
'<th>活动价</th>'
;
break
;
case
3
:
html
+=
'<th>会员价</th>'
;
break
;
default
:
html
+=
''
;
break
;
}
}
if
(
goods_type
==
1
)
{
html
+=
'<th>USD价格</th>'
;
}
...
...
@@ -400,6 +405,7 @@
var
self
=
$
(
this
);
var
num
=
self
.
val
();
var
cart_id
=
self
.
parents
(
'tr'
).
data
(
'cid'
);
var
type
=
self
.
parents
(
'tr'
).
data
(
'type'
);
var
user_id
=
0
;
if
(
is_online
)
{
...
...
@@ -411,7 +417,7 @@
$
.
ajax
({
type
:
"POST"
,
url
:
'/ajax/changeNum'
,
data
:
{
uid
:
user_id
,
num
:
num
,
cart_id
:
cart_id
},
data
:
{
uid
:
user_id
,
num
:
num
,
cart_id
:
cart_id
,
type
:
type
,
goods_type
:
goods_type
},
dataType
:
"json"
,
success
:
function
(
resp
){
if
(
resp
.
errcode
==
0
)
{
...
...
@@ -553,6 +559,7 @@
success
:
function
(
resp
){
if
(
resp
.
errcode
==
0
)
{
layer
.
msg
(
resp
.
errmsg
);
loading
.
lists
(
user_id
,
goods_type
,
is_online
);
// 加载购物车列表
return
false
;
}
...
...
@@ -707,7 +714,8 @@
if
(
len
>
0
)
{
// 购物车列表
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
html
+=
'<tr data-cid="'
+
list
[
i
].
cart_id
+
'">'
+
html
+=
'<tr data-cid="'
+
list
[
i
].
cart_id
+
'" data-type="'
+
list
[
i
].
type
+
'">'
+
'<td>'
+
(
i
+
1
)
+
'</td>'
+
'<td class="goods_id">'
+
list
[
i
].
goods_id
+
'</td>'
+
'<td>'
+
list
[
i
].
goods_name
+
'</td>'
+
'<td>'
+
list
[
i
].
brand_name
+
'</td>'
+
...
...
resources/views/addOffline/content.blade.php
View file @
698861e8
...
...
@@ -182,6 +182,7 @@
<table
class=
"table table-bordered table-hover shop-table"
>
<thead>
<tr>
<th
width=
"5%"
>
序号
</th>
<th
width=
"15%"
>
SKUID
</th>
<th
width=
"20%"
>
商品名称
</th>
<th
width=
"10%"
>
制造商
</th>
...
...
resources/views/addOnline/content.blade.php
View file @
698861e8
...
...
@@ -318,6 +318,7 @@
<table
class=
"table table-bordered table-hover shop-table"
>
<thead>
<tr>
<th
width=
"5%"
>
序号
</th>
<th
width=
"15%"
>
SKUID
</th>
<th
width=
"20%"
>
商品名称
</th>
<th
width=
"10%"
>
制造商
</th>
...
...
resources/views/addOrder/content.blade.php
View file @
698861e8
...
...
@@ -338,6 +338,7 @@
<table
class=
"table table-bordered table-hover shop-table"
>
<thead>
<tr>
<th
width=
"5%"
>
序号
</th>
<th
width=
"15%"
>
SKUID
</th>
<th
width=
"20%"
>
商品名称
</th>
<th
width=
"10%"
>
制造商
</th>
...
...
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