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
4fa4773c
authored
Dec 06, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
1377e346
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
236 additions
and
31 deletions
app/Http/Controllers/AddOrderController.php
app/Http/Controllers/OrderController.php
config/params.php
public/css/detail.css
public/js/add_order.js
resources/views/addOffline/content.blade.php
resources/views/addOnline/content.blade.php
resources/views/addOrder/content.blade.php
resources/views/detail/content.blade.php
app/Http/Controllers/AddOrderController.php
View file @
4fa4773c
...
...
@@ -10,6 +10,7 @@ use Cookie;
use
App\Http\Page
;
use
App\Http\Controllers\PermController
;
use
App\Http\Error
;
use
Excel
;
Class
AddOrderController
extends
Controller
{
...
...
@@ -317,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
);
...
...
@@ -593,4 +600,106 @@ Class AddOrderController extends Controller
}
}
// 商品批量导入
public
function
batchGoodsImport
(
Request
$request
)
{
$file
=
$_FILES
[
'file'
];
// $request->file('file')
$filePath
=
$file
[
'tmp_name'
];
// 临时路径
// 获取导入内容
$excel
=
[];
Excel
::
load
(
$filePath
,
function
(
$reader
)
use
(
&
$excel
){
$data
=
$reader
->
getSheet
(
0
);
$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
);
if
(
$valid
[
'errcode'
]
!=
0
)
{
return
$valid
;
}
array_shift
(
$excel
);
// 删除第一行
$goods_info
=
$this
->
handleData
(
$excel
,
$map
);
// 处理数据
// 推送到API
$data
[
'data'
]
=
$goods_info
;
$data
[
'operator_id'
]
=
$request
->
user
->
userId
;
$data
[
'type'
]
=
3
;
// 后台批量添加标记
$data
[
'uid'
]
=
$request
->
input
(
'user_id'
);
$data
[
'delivery_place'
]
=
$request
->
input
(
'delivery_place'
);
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'
);
$temp
=
json_decode
(
curlApi
(
$url
,
$data
,
"POST"
),
true
);
return
[
'errcode'
=>
$temp
[
'err_code'
],
'errmsg'
=>
$temp
[
'err_msg'
]];
}
// 验证导入excel
public
function
excelValid
(
$excel
)
{
$count
=
count
(
$excel
);
if
(
$count
==
1
)
return
[
'errcode'
=>
1
,
'errmsg'
=>
'未填写物料信息'
];
// 获取excel菜单栏必填项
$required
=
array_filter
(
$excel
[
0
],
function
(
$v
)
{
return
strpos
(
$v
,
'*'
)
===
false
?
false
:
true
;
});
$required_keys
=
array_keys
(
$required
);
// 必填项keys
$err
=
[
'errcode'
=>
0
,
'errmsg'
=>
'验证成功'
];
// 提示信息
array_walk
(
$excel
,
function
(
$val
,
$key
)
use
(
$required
,
$required_keys
,
&
$err
)
{
// 跳过第一条
if
(
$key
!=
0
)
{
foreach
(
$val
as
$k
=>
$v
)
{
if
(
in_array
(
$k
,
$required_keys
))
{
if
(
empty
(
$v
))
{
// 若必填项值为空,返回提示信息
$err
=
[
'errcode'
=>
1
,
'errmsg'
=>
$required
[
$k
]
.
'列,第'
.
$key
.
'行不能为空'
];
break
;
}
}
}
}
});
return
$err
;
}
// 处理导入内容---赋上字段
public
function
handleData
(
$excel
,
$map
)
{
$goods_info
=
array_map
(
function
(
$val
)
use
(
$map
)
{
foreach
(
$val
as
$k
=>
$v
)
{
$tmp
[
$map
[
$k
]]
=
$v
;
}
return
$tmp
;
},
$excel
);
return
$goods_info
;
}
}
\ No newline at end of file
app/Http/Controllers/OrderController.php
View file @
4fa4773c
...
...
@@ -567,6 +567,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
;
...
...
config/params.php
View file @
4fa4773c
...
...
@@ -3,4 +3,21 @@
'joint_addr'
=>
'深圳市龙岗区坂田五和大道南2号万科星火online六栋三楼猎芯科技'
,
// 联营自提地址
'self_addr'
=>
'深圳市光明新区新湖街道楼村社区荔都路32号A栋三楼'
,
// 自营自提地址
// 批量导入物料
'joint_map'
=>
[
0
=>
'goods_name'
,
1
=>
'brand_name'
,
2
=>
'num'
,
3
=>
'goods_price'
,
4
=>
'delivery_time'
,
5
=>
'supplier_name'
,
],
'self_map'
=>
[
0
=>
'id'
,
1
=>
'goods_name'
,
2
=>
'brand_name'
,
3
=>
'num'
,
],
];
\ No newline at end of file
public/css/detail.css
View file @
4fa4773c
...
...
@@ -95,6 +95,21 @@ li {
border-radius
:
3px
;
}
.search-user
,
.search-sku
{
width
:
240px
!important
;
}
.label-prompt
{
padding
:
6px
6px
;
}
.get-user
,
.get-sku
{
padding
:
3px
6px
;
margin-right
:
20px
;
}
.batch-btn
{
float
:
right
;
}
.order-invoice
select
{
width
:
150px
!important
;
}
...
...
@@ -103,7 +118,7 @@ li {
resize
:
none
;
}
/*
新增订单
*/
/*
后台新增订单 start
*/
.user-info
,
.address-content
,
.invoice-content
,
.order-info
{
display
:
none
;
}
...
...
@@ -193,6 +208,8 @@ li {
.con-val
{
float
:
left
;
}
/* END */
.other-infos
,
.click-up
{
display
:
none
;
...
...
@@ -207,7 +224,7 @@ li {
}
.payment-status
{
width
:
420px
;
width
:
420px
!important
;
}
/* 响应式 */
...
...
@@ -230,7 +247,7 @@ li {
.show-list-info
{
display
:
none
;
}
.payment-status
{
width
:
220px
;
}
.payment-status
{
width
:
220px
!important
;
}
}
@media
screen
and
(
max-width
:
460px
)
{
...
...
public/js/add_order.js
View file @
4fa4773c
...
...
@@ -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
)
{
...
...
@@ -513,6 +519,59 @@
}
})
// 批量导入物料
$
(
'.goods_import'
).
click
(
function
()
{
var
user_id
=
$
(
'.user_id'
).
val
();
var
delivery_place
=
1
;
// 1.大陆,2.香港 自营默认是大陆
user_id
=
internal_uid
?
internal_uid
:
user_id
;
// 若是内部下单则使用内部用户ID
if
(
!
user_id
)
{
layer
.
msg
(
'请先选择用户'
);
return
false
;
}
if
(
goods_type
==
1
)
{
delivery_place
=
$
(
'input[name=delivery_place]:checked'
).
val
();
}
// 上传文件
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-自营模板
form
.
find
(
'input'
).
change
(
function
(){
var
formData
=
new
FormData
();
formData
.
append
(
'file'
,
this
.
files
[
0
]);
formData
.
append
(
'type'
,
type
);
formData
.
append
(
'user_id'
,
user_id
);
formData
.
append
(
'delivery_place'
,
delivery_place
);
$
.
ajax
({
type
:
"POST"
,
url
:
'/ajax/batchGoodsImport'
,
data
:
formData
,
dataType
:
'json'
,
cache
:
false
,
processData
:
false
,
contentType
:
false
,
success
:
function
(
resp
){
if
(
resp
.
errcode
==
0
)
{
layer
.
msg
(
resp
.
errmsg
);
loading
.
lists
(
user_id
,
goods_type
,
is_online
);
// 加载购物车列表
return
false
;
}
layer
.
msg
(
resp
.
errmsg
);
},
})
})
form
.
find
(
'input[type="file"]'
).
trigger
(
'click'
);
})
// 提交订单
$
(
'.submit-order'
).
click
(
function
()
{
var
address_id
=
$
(
'input[name=address_id]'
).
val
();
...
...
@@ -655,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 @
4fa4773c
...
...
@@ -85,11 +85,16 @@
.label-prompt
{
padding
:
6px
6px
;}
.get-sku
{
padding
:
3px
6px
;
margin-right
:
20px
;}
</style>
<div
class=
"col-sm-
6
"
>
<div
class=
"col-sm-
12
"
>
<input
type=
"text"
class=
"search-sku"
name=
"sku_id"
value=
""
placeholder=
"请输入SKUID"
>
<a
class=
"btn btn-info get-sku"
>
获取SKU信息
</a>
<span>
快捷入口:
<a
href=
"{{Config('website.search-sku-url-2')}}"
target=
"_blank"
>
查询SKU
</a></span>
<div
class=
"batch-btn"
>
<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>
</div>
</div>
</div>
...
...
@@ -177,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 @
4fa4773c
...
...
@@ -5,11 +5,6 @@
<div
class=
"ibox-content"
>
<div
class=
"row"
style=
"margin-bottom: 30px;"
>
<style>
.search-user
{
width
:
240px
!important
;}
.label-prompt
{
padding
:
6px
6px
;}
.get-user
{
padding
:
3px
6px
;
margin-right
:
20px
;}
</style>
<div
class=
"col-sm-12"
>
<input
type=
"text"
class=
"search-user"
name=
"user-mobile"
value=
""
placeholder=
"请输入会员账号"
>
<a
class=
"btn btn-info get-user"
>
获取用户信息
</a>
...
...
@@ -223,11 +218,6 @@
<div
class=
"ibox-content"
>
<div
class=
"row"
>
<style>
.search-sku
{
width
:
240px
!important
;}
.label-prompt
{
padding
:
6px
6px
;}
.get-sku
{
padding
:
3px
6px
;
margin-right
:
20px
;}
</style>
<div
class=
"col-sm-12"
>
<input
type=
"text"
class=
"search-sku"
name=
"sku_id"
value=
""
placeholder=
"请输入SKUID"
>
<a
class=
"btn btn-info get-sku"
>
获取SKU信息
</a>
...
...
@@ -235,6 +225,11 @@
<span>
快捷入口:
<a
href=
"{{Config('website.search-sku-url-2')}}"
target=
"_blank"
>
查询SKU
</a>
</span>
<div
class=
"batch-btn"
>
<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>
</div>
</div>
</div>
...
...
@@ -323,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 @
4fa4773c
...
...
@@ -5,11 +5,6 @@
<div
class=
"ibox-content"
>
<div
class=
"row"
style=
"margin-bottom: 30px;"
>
<style>
.search-user
{
width
:
240px
!important
;}
.label-prompt
{
padding
:
6px
6px
;}
.get-user
{
padding
:
3px
6px
;
margin-right
:
20px
;}
</style>
<div
class=
"col-sm-12"
>
<input
type=
"text"
class=
"search-user"
name=
"user-mobile"
value=
""
placeholder=
"请输入会员账号"
>
<a
class=
"btn btn-info get-user"
>
获取用户信息
</a>
...
...
@@ -241,11 +236,6 @@
<div
class=
"ibox-content"
>
<div
class=
"row"
>
<style>
.search-sku
{
width
:
240px
!important
;}
.label-prompt
{
padding
:
6px
6px
;}
.get-sku
{
padding
:
3px
6px
;
margin-right
:
20px
;}
</style>
<div
class=
"col-sm-12"
>
<input
type=
"text"
class=
"search-sku"
name=
"sku_id"
value=
""
placeholder=
"请输入SKUID"
>
<a
class=
"btn btn-info get-sku"
>
获取SKU信息
</a>
...
...
@@ -254,6 +244,11 @@
<a
href=
"{{Config('website.add-sku-url')}}"
target=
"_blank"
style=
"margin-right: 10px;"
>
+新增SKU
</a>
<a
href=
"{{Config('website.search-sku-url-1')}}"
target=
"_blank"
>
查询SKU
</a>
</span>
<div
class=
"batch-btn"
>
<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>
</div>
</div>
</div>
...
...
@@ -343,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>
...
...
resources/views/detail/content.blade.php
View file @
4fa4773c
...
...
@@ -443,7 +443,7 @@
<td>
{{$v['delivery_time']}}
</td>
<td>
{{$v['supplier_name']}}
</td>
@if ($action_name == 'changeOrder'
&&
count($order_items_info) > 1
&&
$order_info['status'] == 1
)
@if ($action_name == 'changeOrder'
&&
count($order_items_info) > 1
&&
in_array($order_info['status'], [1, 2])
)
<td><a
class=
"btn btn-danger deletegoods"
href=
"javascript:;"
data-id=
"{{$v['rec_id']}}"
>
删除
</a></td>
@endif
</tr>
...
...
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