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
2242d556
authored
Oct 17, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整自营下单提示信息
parent
9e736fdd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
app/Http/Controllers/AddOrderController.php
public/js/add_order.js
app/Http/Controllers/AddOrderController.php
View file @
2242d556
...
...
@@ -449,20 +449,23 @@ Class AddOrderController extends Controller
$url
=
Config
(
'website.api_domain'
)
.
'goods/detail'
;
$
err_name
=
array
();
$
warning_arr
=
array
();
foreach
(
$cart_info
as
$k
=>
$v
)
{
$data
[
'id'
]
=
$v
[
'gid'
];
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
// 判断下单数量是否小于库存,若小于则弹出提示信息
if
(
$v
[
'num'
]
<
$response
[
'data'
][
'goods_number'
])
{
$err_name
[]
=
$response
[
'data'
][
'goods_name'
];
$temp
[
'goods_name'
]
=
$response
[
'data'
][
'goods_name'
];
// 型号
$temp
[
'stock'
]
=
$response
[
'data'
][
'goods_number'
];
// 可用库存
$warning_arr
[]
=
$temp
;
}
}
if
(
!
empty
(
$
err_name
))
{
return
[
'errcode'
=>
-
1
,
'errmsg'
=>
'所购商品数量小于可用库存'
,
'data'
=>
$err_name
];
if
(
!
empty
(
$
warning_arr
))
{
return
[
'errcode'
=>
-
1
,
'errmsg'
=>
'所购商品数量小于可用库存'
,
'data'
=>
json_encode
(
$warning_arr
)
];
}
return
[
'errcode'
=>
0
,
'errmsg'
=>
''
];
...
...
public/js/add_order.js
View file @
2242d556
...
...
@@ -560,11 +560,11 @@
dataType
:
"json"
,
success
:
function
(
resp
){
if
(
resp
.
errcode
==
-
1
)
{
var
data
=
resp
.
data
;
var
data
=
eval
(
resp
.
data
)
;
var
content
=
'<p>确定设置以下型号为期货吗?</p>'
;
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
content
+=
'<p><span>'
+
(
i
+
1
)
+
'、</span>'
+
data
[
i
]
+
'</p>'
;
content
+=
'<p><span>'
+
(
i
+
1
)
+
'、</span>'
+
data
[
i
]
[
'goods_name'
]
+
',可用库存:'
+
data
[
i
][
'stock'
]
+
'</p>'
;
}
// 弹出提示
...
...
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