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
711d4fd2
authored
Apr 17, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'zjl_order_msg_20180402' into 'master'
订单审核消息推送 See merge request
!27
parents
11573682
52a6dd77
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
250 additions
and
3 deletions
app/Http/Controllers/OrderController.php
app/Http/routes.php
public/css/order.css
public/js/order.js
resources/views/detail/changeOrder.blade.php
resources/views/detail/content.blade.php
app/Http/Controllers/OrderController.php
View file @
711d4fd2
...
@@ -752,6 +752,8 @@ Class OrderController extends Controller
...
@@ -752,6 +752,8 @@ Class OrderController extends Controller
"order_amount"
=>
$request
->
input
(
'order_amount'
,
''
),
"order_amount"
=>
$request
->
input
(
'order_amount'
,
''
),
"extra_fee"
=>
$request
->
input
(
'extra_fee'
,
''
),
"extra_fee"
=>
$request
->
input
(
'extra_fee'
,
''
),
"change_info"
=>
$request
->
input
(
'change_info'
,
''
),
"change_info"
=>
$request
->
input
(
'change_info'
,
''
),
"payTime"
=>
$request
->
input
(
'payTime'
,
''
),
"payTimeOther"
=>
$request
->
input
(
'payTimeOther'
,
''
),
"order_id"
=>
$order_id
,
"order_id"
=>
$order_id
,
"pf"
=>
1
,
"pf"
=>
1
,
"k1"
=>
$check
[
'k1'
],
"k1"
=>
$check
[
'k1'
],
...
@@ -1235,4 +1237,95 @@ Class OrderController extends Controller
...
@@ -1235,4 +1237,95 @@ Class OrderController extends Controller
return
$response
;
return
$response
;
}
}
/**
* 定时任务:提前一天上午10点
* 检查订单付款时间
* 过滤条件:状态、测试人员、是否是真实数据、付款时间大于当前时间
* @return [type] [description]
*/
public
function
checkOrderSendSms
()
{
$order
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
whereIn
(
'status'
,
[
'2'
,
'3'
])
->
whereNotIn
(
'user_id'
,
$this
->
testMobile
())
->
where
(
'is_type'
,
'='
,
0
)
->
where
(
'pay_time'
,
'>'
,
time
())
->
select
(
'order_id'
,
'order_sn'
,
'user_id'
,
'order_amount'
,
'currency'
,
'pay_time'
)
->
orderBy
(
'create_time'
,
'DESC'
)
->
get
();
//调用消息接口
$url
=
Config
(
'website.api_domain'
)
.
'msg/sendmessagebyauto'
;
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$keyword
=
'order-pay-time-remind'
;
if
(
!
empty
(
$order
))
{
foreach
(
$order
as
$v
)
{
// 提前一天推送消息
$diff
=
$v
->
pay_time
-
time
();
if
(
$diff
<=
86400
)
{
$currency
=
$v
->
currency
==
1
?
'¥'
:
'$'
;
$orderInfo
[
'data'
][
'order_sn'
]
=
$v
->
order_sn
;
$orderInfo
[
'data'
][
'order_amount'
]
=
$currency
.
$v
->
order_amount
;
$orderInfo
=
json_encode
(
$orderInfo
[
'data'
],
JSON_UNESCAPED_UNICODE
);
$orderData
=
[
"keyword"
=>
$keyword
,
"pf"
=>
1
,
"k1"
=>
$data
[
'k1'
],
"k2"
=>
$data
[
'k2'
],
'touser'
=>
json_encode
(
$v
->
user_id
),
'data'
=>
$orderInfo
,
];
$temp
=
json_decode
(
curlApi
(
$url
,
$orderData
,
"POST"
),
true
);
if
(
$temp
[
'err_code'
]
==
0
)
{
continue
;
}
}
}
}
}
// 定时任务:每5分钟
// 付款时间到达后自动取消订单
public
function
checkOrderCancel
()
{
$time
=
strtotime
(
date
(
'Y-m-d'
,
time
()));
// 当天0点
$order
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
whereIn
(
'status'
,
[
'2'
,
'3'
])
->
whereNotIn
(
'user_id'
,
$this
->
testMobile
())
->
where
(
'is_type'
,
'='
,
0
)
->
where
(
'pay_time'
,
'>='
,
$time
)
->
select
(
'order_id'
,
'pay_time'
)
->
orderBy
(
'create_time'
,
'DESC'
)
->
get
();
if
(
!
empty
(
$order
))
{
foreach
(
$order
as
$v
)
{
// 到达付款时间后自动取消订单
if
(
$v
->
pay_time
<=
time
())
{
$update
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
where
(
'order_id'
,
'='
,
$v
->
order_id
)
->
update
([
'status'
=>
-
1
,
'pay_time'
=>
0
]);
if
(
$update
)
{
continue
;
}
}
}
}
}
}
}
\ No newline at end of file
app/Http/routes.php
View file @
711d4fd2
...
@@ -61,3 +61,9 @@ Route::group(['middleware' => 'web'], function () {
...
@@ -61,3 +61,9 @@ Route::group(['middleware' => 'web'], function () {
});
});
// 不需要登陆态
Route
::
group
([
'middleware'
=>
'api'
],
function
()
{
Route
::
get
(
'/api/check/sendsms'
,
'OrderController@checkOrderSendSms'
);
Route
::
get
(
'/api/check/cancelorder'
,
'OrderController@checkOrderCancel'
);
});
public/css/order.css
View file @
711d4fd2
...
@@ -267,3 +267,31 @@ input[type="color"],
...
@@ -267,3 +267,31 @@ input[type="color"],
text-overflow
:
ellipsis
;
text-overflow
:
ellipsis
;
margin-bottom
:
0
;
margin-bottom
:
0
;
}
}
#payTime
{
float
:
left
;
margin-right
:
20px
;
}
.customArea
{
float
:
left
;
display
:
none
;
}
/* 付款时间 */
.checked_section
{
position
:
relative
;
height
:
60px
;
}
.checked_left
{
position
:
absolute
;
left
:
0
;
}
.checked_right
{
position
:
absolute
;
right
:
0
;
line-height
:
60px
;
}
.count_time
{
color
:
red
;
font-size
:
20px
;
}
\ No newline at end of file
public/js/order.js
View file @
711d4fd2
...
@@ -1136,11 +1136,24 @@
...
@@ -1136,11 +1136,24 @@
}
}
})
})
// 选择付款时间
$
(
'#payTime'
).
change
(
function
(){
var
val
=
$
(
this
).
val
();
if
(
val
==
0
)
{
$
(
'.customArea'
).
show
();
}
else
{
$
(
'.customArea'
).
hide
();
}
})
// 提交表单
// 提交表单
$
(
'.checkOrder'
).
click
(
function
(){
$
(
'.checkOrder'
).
click
(
function
(){
var
sale_id
=
$
(
'input[name=sale_id]:checked'
).
val
();
var
sale_id
=
$
(
'input[name=sale_id]:checked'
).
val
();
var
order_status
=
$
(
'input[name=order_status]:checked'
).
val
();
var
order_status
=
$
(
'input[name=order_status]:checked'
).
val
();
var
reason
=
$
(
'input[name=reason]:checked'
).
val
();
var
reason
=
$
(
'input[name=reason]:checked'
).
val
();
var
payTime
=
$
(
'#payTime'
).
val
();
var
payTimeOther
=
$
(
'#payTimeOther'
).
val
();
if
(
sale_id
==
null
)
{
if
(
sale_id
==
null
)
{
layer
.
msg
(
'请选择业务员!'
);
layer
.
msg
(
'请选择业务员!'
);
...
@@ -1193,6 +1206,27 @@
...
@@ -1193,6 +1206,27 @@
return
false
;
return
false
;
}
}
if
(
payTime
==
''
)
{
layer
.
msg
(
'请选择付款时间'
);
return
false
;
}
if
(
payTime
==
0
&&
payTimeOther
==
''
)
{
layer
.
msg
(
'请填写自定义时间'
);
return
false
;
}
var
reg
=
/
\d
/
;
if
(
!
reg
.
test
(
payTimeOther
))
{
layer
.
msg
(
'格式错误'
);
return
false
;
}
if
(
payTimeOther
<
0
||
payTimeOther
>
30
)
{
layer
.
msg
(
'自定义时间限制在1-30天'
);
return
false
;
}
var
currencySign
=
currency
==
1
?
'¥'
:
'$'
;
var
currencySign
=
currency
==
1
?
'¥'
:
'$'
;
var
goods_amount
=
currencySign
+
$
(
'input[name=goods_amount]'
).
val
();
var
goods_amount
=
currencySign
+
$
(
'input[name=goods_amount]'
).
val
();
var
order_amount
=
currencySign
+
$
(
'input[name=order_amount]'
).
val
();
var
order_amount
=
currencySign
+
$
(
'input[name=order_amount]'
).
val
();
...
...
resources/views/detail/changeOrder.blade.php
View file @
711d4fd2
...
@@ -73,6 +73,7 @@
...
@@ -73,6 +73,7 @@
</tr>
</tr>
</table>
</table>
<hr/>
<!-- 调价 -->
<!-- 调价 -->
<p>
调价
</p>
<p>
调价
</p>
<table
class=
"table table-bordered table-hover order-change-table change-table"
>
<table
class=
"table table-bordered table-hover order-change-table change-table"
>
...
@@ -126,6 +127,7 @@
...
@@ -126,6 +127,7 @@
</table>
</table>
<div
class=
"show-advance-pay"
>
<div
class=
"show-advance-pay"
>
<hr/>
<p>
定金调整
</p>
<p>
定金调整
</p>
<table
class=
"table table-bordered table-hover change-table"
>
<table
class=
"table table-bordered table-hover change-table"
>
<tr>
<tr>
...
@@ -147,16 +149,55 @@
...
@@ -147,16 +149,55 @@
</table>
</table>
</div>
</div>
<p>
付款时间
</p>
<table
class=
"table table-bordered table-hover change-table"
>
<tr>
<th>
选择付款时间
</th>
<td>
<select
name=
"payTime"
id=
"payTime"
>
<option
value=
""
>
请选择
</option>
<option
value=
"1"
>
1天
</option>
<option
value=
"3"
>
3天
</option>
<option
value=
"7"
>
7天
</option>
<option
value=
"15"
>
15天
</option>
<option
value=
"0"
>
其他
</option>
</select>
<div
class=
"customArea"
>
<input
type=
"text"
name=
"payTimeOther"
id=
"payTimeOther"
value=
""
style=
"width: 50px;"
>
天
<span
class=
"error"
>
(自定义天数,限制1~30)
</span>
</div>
</td>
</tr>
</table>
<a
class=
"btn btn-primary checkOrder"
>
提交
</a>
<a
class=
"btn btn-primary checkOrder"
>
提交
</a>
</form>
</form>
@endif
@endif
@if ($order_info['status'] == 2)
@if ($order_info['status'] == 2)
<p>
交易状态:
审核通过,请联系客户及时付款!
</p>
<div
class=
"checked_section"
>
<div
class=
"checked_left"
>
<p>
交易状态:
审核通过,请联系客户及时付款!
@if ($order_info['pay_time'])
<span>
订单付款时间截止至:{{date('Y-m-d H:i:s', $order_info['pay_time'])}}
</span>
@endif
</p>
@if ($order_info['adjust_count']
<
2
)
@if ($order_info['adjust_count']
<
2
)
<
a
class=
"btn btn-default"
href=
"{{URL('adjustPrice', ['order_id'=>$order_info['order_id']])}}"
>
再次调价
</a><span
class=
"warn-tip"
>
每笔订单仅有一次“再次调价”机会
</span>
<
a
class=
"btn btn-default"
href=
"{{URL('adjustPrice', ['order_id'=>$order_info['order_id']])}}"
>
再次调价
</a><span
class=
"warn-tip"
>
每笔订单仅有一次“再次调价”机会
</span>
@endif
@endif
</div>
<div
class=
"checked_right"
>
<p>
<span
class=
"error"
>
剩余付款时间:
</span>
<span
class=
"count_time count_day"
></span>
天
<span
class=
"count_time count_hour"
></span>
时
<span
class=
"count_time count_min"
></span>
分
<span
class=
"count_time count_sec"
></span>
秒
</p>
</div>
</div>
@endif
@endif
@if ($order_info['status'] == -1)
@if ($order_info['status'] == -1)
...
@@ -174,4 +215,46 @@
...
@@ -174,4 +215,46 @@
var
order_amount
=
"{{$order_info['order_amount']}}"
;
var
order_amount
=
"{{$order_info['order_amount']}}"
;
var
currency
=
"{{$order_info['currency']}}"
;
var
currency
=
"{{$order_info['currency']}}"
;
var
order_pay_type
=
"{{$order_info['order_pay_type']}}"
;
var
order_pay_type
=
"{{$order_info['order_pay_type']}}"
;
var
rest_time
=
"{{$order_info['pay_time'] ? $order_info['pay_time'] - time() : NULL}}"
;
if
(
rest_time
)
{
countDown
(
rest_time
);
}
else
{
$
(
'.checked_right'
).
hide
();
}
// 倒计时
function
countDown
(
times
){
var
timer
=
null
;
timer
=
setInterval
(
function
(){
var
day
=
0
,
hour
=
0
,
minute
=
0
,
second
=
0
;
//时间默认值
if
(
times
>
0
)
{
day
=
Math
.
floor
(
times
/
(
60
*
60
*
24
));
hour
=
Math
.
floor
(
times
/
(
60
*
60
))
-
(
day
*
24
);
minute
=
Math
.
floor
(
times
/
60
)
-
(
day
*
24
*
60
)
-
(
hour
*
60
);
second
=
Math
.
floor
(
times
)
-
(
day
*
24
*
60
*
60
)
-
(
hour
*
60
*
60
)
-
(
minute
*
60
);
}
if
(
day
<=
9
)
day
=
'0'
+
day
;
if
(
hour
<=
9
)
hour
=
'0'
+
hour
;
if
(
minute
<=
9
)
minute
=
'0'
+
minute
;
if
(
second
<=
9
)
second
=
'0'
+
second
;
$
(
'.count_day'
).
text
(
day
);
$
(
'.count_hour'
).
text
(
hour
);
$
(
'.count_min'
).
text
(
minute
);
$
(
'.count_sec'
).
text
(
second
);
times
--
;
},
1000
);
if
(
times
<=
0
)
{
clearInterval
(
timer
);
}
}
</script>
</script>
\ No newline at end of file
resources/views/detail/content.blade.php
View file @
711d4fd2
...
@@ -312,7 +312,7 @@
...
@@ -312,7 +312,7 @@
<th>
供应商
</th>
<th>
供应商
</th>
<?php
<?php
if
(
$action_name
==
'changeOrder'
&&
count
(
$order_items_info
)
>
1
)
{
if
(
$action_name
==
'changeOrder'
&&
count
(
$order_items_info
)
>
1
&&
$order_info
[
'status'
]
==
1
)
{
echo
'<th>操作</th>'
;
echo
'<th>操作</th>'
;
}
}
?>
?>
...
@@ -335,7 +335,7 @@
...
@@ -335,7 +335,7 @@
<td>
{{$v['delivery_time']}}
</td>
<td>
{{$v['delivery_time']}}
</td>
<td>
{{$v['supplier_name']}}
</td>
<td>
{{$v['supplier_name']}}
</td>
@if ($action_name == 'changeOrder'
&&
count($order_items_info) > 1)
@if ($action_name == 'changeOrder'
&&
count($order_items_info) > 1
&&
$order_info['status'] == 1
)
<td><a
class=
"btn btn-danger deletegoods"
href=
"javascript:;"
data-id=
"{{$v['rec_id']}}"
>
删除
</a></td>
<td><a
class=
"btn btn-danger deletegoods"
href=
"javascript:;"
data-id=
"{{$v['rec_id']}}"
>
删除
</a></td>
@endif
@endif
</tr>
</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