Commit 1c848c9b by 朱继来

延长待付款时间

parent def0c650
...@@ -1335,4 +1335,27 @@ Class OrderController extends Controller ...@@ -1335,4 +1335,27 @@ Class OrderController extends Controller
} }
} }
// 延长付款时间
public function ajaxDelayTime(Request $request)
{
if ($request->isMethod('post')) {
$order_id = $request->input('order_id', '');
$delay_time = $request->input('delay_time', '');
}
if (empty($order_id) || empty($delay_time)) return ['errcode'=>10003, 'errmsg'=>'参数不存在'];
$order = DB::connection('order')->table('lie_order')->where('order_id', '=', $order_id)->select('pay_time')->first();
$delay_time = $order->pay_time + $delay_time * 86400;
$update = DB::connection('order')->table('lie_order')->where('order_id', '=', $order_id)->update(['pay_time'=>$delay_time]);
if (!$update) {
return ['errcode'=>0, 'errmsg'=>'延长失败'];
}
return ['errcode'=>0, 'errmsg'=>'延长成功'];
}
} }
\ No newline at end of file
...@@ -59,6 +59,8 @@ Route::group(['middleware' => 'web'], function () { ...@@ -59,6 +59,8 @@ Route::group(['middleware' => 'web'], function () {
Route::get('/count', 'OrderCountController@count'); Route::get('/count', 'OrderCountController@count');
Route::get('/amount', 'OrderCountController@amount'); Route::get('/amount', 'OrderCountController@amount');
Route::match('post', '/ajaxDelayTime', 'OrderController@ajaxDelayTime');
}); });
// 不需要登陆态 // 不需要登陆态
......
...@@ -268,7 +268,7 @@ input[type="color"], ...@@ -268,7 +268,7 @@ input[type="color"],
margin-bottom: 0; margin-bottom: 0;
} }
#payTime { .payTime {
float: left; float: left;
margin-right: 20px; margin-right: 20px;
} }
...@@ -289,9 +289,19 @@ input[type="color"], ...@@ -289,9 +289,19 @@ input[type="color"],
.checked_right { .checked_right {
position: absolute; position: absolute;
right: 0; right: 0;
line-height: 60px; line-height: 10px;
} }
.count_time { .count_time {
color: red; color: red;
font-size: 20px; font-size: 20px;
}
.delay_time_title{
float:left;
}
.showtime {
height: 30px;
line-height: 30px;
}
.delay_confirm {
margin-bottom: 5px;
} }
\ No newline at end of file
...@@ -1137,10 +1137,10 @@ ...@@ -1137,10 +1137,10 @@
}) })
// 选择付款时间 // 选择付款时间
$('#payTime').change(function(){ $('.payTime').change(function(){
var val = $(this).val(); var val = $(this).val();
if (val == 0) { if (val == 'other') {
$('.customArea').show(); $('.customArea').show();
} else { } else {
$('.customArea').hide(); $('.customArea').hide();
...@@ -1152,8 +1152,8 @@ ...@@ -1152,8 +1152,8 @@
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 payTime = $('.payTime').val();
var payTimeOther = $('#payTimeOther').val(); var payTimeOther = $('.payTimeOther').val();
if (sale_id == null) { if (sale_id == null) {
layer.msg('请选择业务员!'); layer.msg('请选择业务员!');
...@@ -1211,7 +1211,7 @@ ...@@ -1211,7 +1211,7 @@
return false; return false;
} }
if (payTime == 0 && payTimeOther == '') { if (payTime == 'other' && payTimeOther == '') {
layer.msg('请填写自定义时间'); layer.msg('请填写自定义时间');
return false; return false;
} }
......
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
<tr> <tr>
<th>选择付款时间</th> <th>选择付款时间</th>
<td> <td>
<select name="payTime" id="payTime"> <select name="payTime" class="payTime">
<option value="">请选择</option> <option value="">请选择</option>
<option value="1">1天</option> <option value="1">1天</option>
<option value="3">3天</option> <option value="3">3天</option>
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
</select> </select>
<div class="customArea"> <div class="customArea">
<input type="text" name="payTimeOther" id="payTimeOther" value="" style="width: 50px;">&nbsp;<span class="error">(自定义天数,限制1~30)</span> <input type="text" name="payTimeOther" class="payTimeOther" value="" style="width: 50px;">&nbsp;<span class="error">(自定义天数,限制1~30)</span>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -189,13 +189,32 @@ ...@@ -189,13 +189,32 @@
</div> </div>
<div class="checked_right"> <div class="checked_right">
<p> <p class="showtime">
<span class="error">剩余付款时间:</span> <span class="error">剩余付款时间:</span>
<span class="count_time count_day"></span> <span class="count_time count_day"></span>
<span class="count_time count_hour"></span> <span class="count_time count_hour"></span>
<span class="count_time count_min"></span> <span class="count_time count_min"></span>
<span class="count_time count_sec"></span> <span class="count_time count_sec"></span>
</p> </p>
<div class="showtime delay_time">
<span class="delay_time_title">延长付款时间:</span>
<select name="payTime" class="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="other">其他</option>
</select>
<div class="customArea">
<input type="text" name="payTimeOther" class="payTimeOther" value="" style="width: 50px;">&nbsp;<span class="error">(自定义天数,限制1~30)</span>
</div>
<button class="btn btn-info btn-xs delay_confirm">确认</button>
</div>
</div> </div>
</div> </div>
@endif @endif
...@@ -257,4 +276,73 @@ ...@@ -257,4 +276,73 @@
clearInterval(timer); clearInterval(timer);
} }
} }
// 延长付款时间
$('.delay_confirm').click(function(){
var order_id = "{{$order_info['order_id']}}";
var payTime = $('.payTime').val();
var payTimeOther = $('.payTimeOther').val();
var delay_time;
if (payTime == '') {
layer.msg('请选择付款时间');
return false;
}
if (payTime == 'other' && payTimeOther == '') {
layer.msg('请填写自定义时间');
return false;
}
if (payTimeOther) {
var reg = /\d/;
if (!reg.test(payTimeOther)) {
layer.msg('格式错误');
return false;
}
if (payTimeOther < 0 || payTimeOther > 30) {
layer.msg('自定义时间限制在1-30天');
return false;
}
}
if (payTime != '' && payTime != 'other') {
payTimeOther = '';
}
delay_time = payTimeOther ? payTimeOther : payTime;
// 弹出提示
layer.open({
title: '提示信息',
content: '确定延长付款时间吗?',
btn:['取消','确定'],
yes: function(index, layero){
layer.close(index);
},
btn2: function(index, layero){
$.ajax({
url : '/ajaxDelayTime',
type: 'post',
data: {order_id:order_id, delay_time:delay_time},
dataType: 'json',
success: function (resp) {console.log(resp)
if(resp.errcode === 0){
layer.msg(resp.errmsg || '操作成功');
setTimeout(function(){
location.reload();
}, 1000);
} else {
layer.alert(resp.errmsg || '网络异常');
}
},
error: function (res) {
console.log(res);
}
})
}
});
})
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment