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
89258934
authored
Aug 22, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整新增自营线下订单
parent
ad976e08
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
143 additions
and
26 deletions
app/Http/Controllers/AddOrderController.php
public/js/add_order.js
public/js/order.js
resources/views/addOffline/content.blade.php
resources/views/addOffline/success.blade.php
resources/views/detail/content.blade.php
app/Http/Controllers/AddOrderController.php
View file @
89258934
...
...
@@ -9,6 +9,7 @@ use DB;
use
Cookie
;
use
App\Http\Page
;
use
App\Http\Controllers\PermController
;
use
App\Http\Error
;
function
CheckActive
(
$menus
,
&
$arr
,
$url
)
{
...
...
@@ -319,9 +320,80 @@ Class AddOrderController extends Controller
{
if
(
$request
->
isMethod
(
'post'
))
{
$order_id
=
$request
->
input
(
'order_id'
);
$status
=
$request
->
input
(
'status'
);
// 审核通过推到WMS
if
(
$status
==
4
)
{
$data
[
'order_id'
]
=
$order_id
;
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$url
=
Config
(
'website.api_domain'
)
.
'order/wmsOrder'
;
$response
=
json_decode
(
curlApi
(
$url
,
$data
),
true
);
if
(
$response
[
'err_code'
]
==
0
)
{
$orderInfo
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
where
(
'order_id'
,
$order_id
)
->
first
();
DB
::
beginTransaction
();
try
{
// 待发货状态
$update
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
where
(
'order_id'
,
$order_id
)
->
update
([
'status'
=>
$status
]);
// 插入到order_price
$price
[
'order_id'
]
=
$order_id
;
$price
[
'order_sn'
]
=
$orderInfo
->
order_sn
;
$price
[
'price_type'
]
=
-
1
;
$price
[
'price'
]
=
'-'
.
$orderInfo
->
order_amount
;
$price
[
'create_time'
]
=
time
();
$priceAdd
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order_price'
)
->
insert
(
$price
);
// 添加付款记录
$pay
[
'user_id'
]
=
$orderInfo
->
user_id
;
$pay
[
'order_id'
]
=
$order_id
;
$pay
[
'order_sn'
]
=
$orderInfo
->
order_sn
;
$pay
[
'pay_id'
]
=
0
;
// 支付方式ID
$pay
[
'pay_name'
]
=
'交通银行'
;
// 支付方式名
$pay
[
'pay_type'
]
=
1
;
$pay
[
'pay_amount'
]
=
$orderInfo
->
order_amount
;
$pay
[
'is_paid'
]
=
1
;
$pay
[
'create_time'
]
=
time
();
$pay
[
'pay_time'
]
=
time
();
$payLog
=
DB
::
connection
(
'order'
)
->
table
(
'lie_pay_log'
)
->
insert
(
$pay
);
if
(
$update
&&
$priceAdd
&&
$payLog
)
{
DB
::
commit
();
}
}
catch
(
Exception
$e
)
{
DB
::
rollBack
();
}
}
else
{
return
[
'errcode'
=>
$response
[
'err_code'
],
'errmsg'
=>
$response
[
'err_msg'
]];
}
$event
=
'自营线下订单审核通过'
;
}
else
{
$update
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
where
(
'order_id'
,
$order_id
)
->
update
([
'status'
=>
$status
]);
// 订单取消状态
$update
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
where
(
'order_id'
,
$order_id
)
->
update
([
'status'
=>
4
]);
// 待发货状态
$event
=
'自营线下订单审核不通过'
;
}
// 操作记录
$log
[
'order_id'
]
=
$order_id
;
$log
[
'operator_id'
]
=
$request
->
user
->
userId
;
$log
[
'operator_type'
]
=
2
;
$log
[
'event'
]
=
$event
;
$log
[
'ip'
]
=
get_client_ip
();
$log
[
'create_time'
]
=
time
();
$actionLog
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order_action_log'
)
->
insert
(
$log
);
if
(
!
$actionLog
){
errorLog
(
Error
::
E_ADD_FAILED
,
'添加操作记录失败'
);
return
[
'errcode'
=>
Error
::
E_ADD_FAILED
,
'errmsg'
=>
'添加操作记录失败'
];
}
if
(
!
empty
(
$update
))
{
return
[
'errcode'
=>
0
,
'errmsg'
=>
'审核成功'
];
}
else
{
...
...
public/js/add_order.js
View file @
89258934
...
...
@@ -31,30 +31,43 @@
$
(
'.sku-info'
).
show
();
var
data
=
resp
.
data
;
var
status_val
=
''
;
$
(
'.goods_name'
).
text
(
data
.
goods_name
);
$
(
'.brand_name'
).
text
(
data
.
brand_name
);
$
(
'.supplier_name'
).
text
(
data
.
supplier_name
);
$
(
'.stock'
).
text
(
data
.
stock
);
$
(
'.moq'
).
text
(
data
.
moq
);
$
(
'.mpq'
).
text
(
data
.
mpq
);
switch
(
data
.
status
)
{
case
0
:
status_val
=
'待入库'
;
break
;
case
1
:
status_val
=
'审核通过(上架)'
;
break
;
case
3
:
status_val
=
'下架'
;
break
;
case
4
:
status_val
=
'删除'
;
break
;
}
$
(
'.status'
).
text
(
status_val
);
$
(
'.goods_id'
).
val
(
data
.
goods_id
);
//阶梯价格
var
len
=
data
.
ladder_price
.
length
;
if
(
len
>
0
)
{
var
html
=
''
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
if
(
i
==
0
)
{
html
+=
'<tr><td><span class="goods-min-num">'
+
data
.
ladder_price
[
i
][
'purchases'
]
+
'</span></td><td>¥<span class="goods-min-price">'
+
data
.
ladder_price
[
i
][
'price_cn'
]
+
'</span></td></tr>'
;
}
else
{
html
+=
'<tr><td><span>'
+
data
.
ladder_price
[
i
][
'purchases'
]
+
'</span></td><td>¥<span>'
+
data
.
ladder_price
[
i
][
'price_cn'
]
+
'</span></td></tr>'
;
}
if
(
data
.
ladder_price
!=
null
)
{
var
len
=
data
.
ladder_price
.
length
;
if
(
len
>
0
)
{
var
html
=
''
;
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
if
(
i
==
0
)
{
html
+=
'<tr><td><span class="goods-min-num">'
+
data
.
ladder_price
[
i
][
'purchases'
]
+
'</span></td><td>¥<span class="goods-min-price">'
+
data
.
ladder_price
[
i
][
'price_cn'
]
+
'</span></td></tr>'
;
}
else
{
html
+=
'<tr><td><span>'
+
data
.
ladder_price
[
i
][
'purchases'
]
+
'</span></td><td>¥<span>'
+
data
.
ladder_price
[
i
][
'price_cn'
]
+
'</span></td></tr>'
;
}
}
$
(
'.ladder_price_table tr:gt(0)'
).
remove
();
$
(
'.ladder_price_table'
).
append
(
html
);
}
$
(
'.ladder_price_table tr:gt(0)'
).
remove
();
$
(
'.ladder_price_table'
).
append
(
html
);
}
}
}
})
})
...
...
@@ -204,6 +217,7 @@
if
(
len
>
0
)
{
for
(
var
i
=
0
;
i
<
len
;
i
++
)
{
html
+=
'<tr data-cid="'
+
list
[
i
].
cart_id
+
'">'
+
'<td>'
+
list
[
i
].
goods_id
+
'</td>'
+
'<td>'
+
list
[
i
].
goods_name
+
'</td>'
+
'<td>'
+
list
[
i
].
brand_name
+
'</td>'
+
'<td><input type="text" class="goods_num" name="goods_num" value="'
+
list
[
i
].
goods_number
+
'"></td>'
+
...
...
@@ -231,6 +245,9 @@
$
(
'.amount-section'
).
show
();
$
(
'.order_amount'
).
empty
().
text
(
order_amount
);
}
}
else
{
$
(
'.shop-lists'
).
hide
();
$
(
'.amount-section'
).
hide
();
}
},
});
...
...
public/js/order.js
View file @
89258934
...
...
@@ -1498,15 +1498,33 @@
layer
.
open
({
title
:
'审核自营线下订单'
,
content
:
'确定审核通过吗?'
,
btn
:[
'取消'
,
'确定'
],
yes
:
function
(
index
,
layero
){
layer
.
close
(
index
);
btn
:[
'通过'
,
'不通过'
],
yes
:
function
(
index
,
layero
){
$
.
ajax
({
url
:
'/ajax/selfCheck'
,
type
:
'post'
,
data
:
{
order_id
:
order_id
,
status
:
4
},
dataType
:
'json'
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
===
0
){
layer
.
msg
(
resp
.
errmsg
||
'操作成功'
);
setTimeout
(
function
(){
location
.
reload
();
},
1000
);
}
else
{
layer
.
alert
(
resp
.
errmsg
||
'网络异常'
);
}
},
error
:
function
(
err
)
{
console
.
log
(
err
)
}
})
},
btn2
:
function
(
index
,
layero
){
btn2
:
function
(
index
,
layero
){
// 不通过--取消订单
$
.
ajax
({
url
:
'/ajax/selfCheck'
,
type
:
'post'
,
data
:
{
order_id
:
order_id
},
data
:
{
order_id
:
order_id
,
status
:
-
1
},
dataType
:
'json'
,
success
:
function
(
resp
)
{
if
(
resp
.
errcode
===
0
){
...
...
resources/views/addOffline/content.blade.php
View file @
89258934
...
...
@@ -152,6 +152,15 @@
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"form-group"
>
<span>
状态:
</span>
<span
class=
"status"
></span>
</div>
</div>
</div>
</div>
<div
class=
"sku-info-right"
>
...
...
@@ -175,14 +184,15 @@
<table
class=
"table table-bordered table-hover shop-table"
>
<thead>
<tr>
<th
width=
"15%"
>
商品型号
</th>
<th
width=
"15%"
>
制造商
</th>
<th
width=
"15%"
>
SKUID
</th>
<th
width=
"20%"
>
商品名称
</th>
<th
width=
"10%"
>
制造商
</th>
<th
width=
"10%"
>
采购数量
</th>
<th
width=
"10%"
>
采购单价
</th>
<th
width=
"10%"
>
小计
</th>
<th
width=
"1
5
%"
>
货期
</th>
<th
width=
"1
5
%"
>
供应商
</th>
<th
width=
"
10
%"
>
操作
</th>
<th
width=
"1
0
%"
>
货期
</th>
<th
width=
"1
0
%"
>
供应商
</th>
<th
width=
"
5
%"
>
操作
</th>
</tr>
</thead>
<tbody></tbody>
...
...
resources/views/addOffline/success.blade.php
deleted
100644 → 0
View file @
ad976e08
This diff is collapsed.
Click to expand it.
resources/views/detail/content.blade.php
View file @
89258934
...
...
@@ -245,7 +245,7 @@
@if($order_info['status']
<
10
&&
$
order_invoice_info
['
invoice_status
']
<
2
&&
in_array
('
update_invoice
',
$
userPerms
))
<
a
href=
"/changeInvoice/{{$order_info['order_id']}}"
class=
"btn btn-success btn-sm changeBtn"
>
更改发票
</a>
@endif
@elseif (isset($_REQUEST['tags'])
&&
$_REQUEST['tags'] == 'self')
@elseif (isset($_REQUEST['tags'])
&&
$_REQUEST['tags'] == 'self'
&&
$user_mobile != Config('website.internal-account')
)
@if($order_info['status']
<
10
&&
$
order_invoice_info
['
invoice_status
']
<
2
&&
in_array
('
self_order_update_invoice
',
$
userPerms
))
<
a
href=
"/changeInvoice/{{$order_info['order_id']}}?tags={{$_REQUEST['tags']}}"
class=
"btn btn-success btn-sm changeBtn"
>
更改发票
</a>
@endif
...
...
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