Commit 30da12e8 by 朱继来

添加快递配置

parent 6cad6d9f
......@@ -9,6 +9,7 @@ use DB;
use Cookie;
use App\Http\Page;
use App\Http\Controllers\PermController;
use Illuminate\Support\Facades\Redis;
function CheckActive($menus, &$arr, $url)
{
......@@ -1475,6 +1476,36 @@ Class OrderController extends Controller
}
return $res;
}
// 快递配置
public function expressSet(Request $request)
{
$key = Config('website.express_fee_key');
$express_fee = Config('website.express_fee');
if ($request->isMethod('post')) {
$data['sz_inside'] = $request->input('sz_inside');
$data['gd_inside'] = $request->input('gd_inside');
$data['gd_outside'] = $request->input('gd_outside');
Redis::set($key, json_encode($data));
return ['errcode'=>0, 'errmsg'=>'修改成功'];
}
$info = $this->getPageInfo($request);
$express = Redis::get($key);
if (!$express) {
Redis::set($key, json_encode($express_fee));
$info['express_fee'] = $express_fee;
} else {
$info['express_fee'] = json_decode($express, true);
}
return view('express_set', $info);
}
/**
* 定时任务:提前一天上午10点
......
......@@ -70,6 +70,8 @@ Route::group(['middleware' => 'web'], function () {
Route::match('post', '/ajaxRejected', 'OrderController@ajaxRejected');
Route::match(['get', 'post'], '/express_set', 'OrderController@expressSet');
});
// 不需要登陆态
......
......@@ -29,4 +29,13 @@ return [
//中间服务秘钥
'SERVICE_KEY' => 'j9q##VRhaXBEtznIEeDiR@1Hvy0sW3wp',
// 快递配置
'express_fee_key' => 'express_fee',
'express_fee' => [
'sz_inside' => 10,
'gd_inside' => 10,
'gd_outside' => 15,
],
];
+(function($){
$.lie = $.lie || {version: "v1.0.0"};
$.extend($.lie, {
express:{
index:function(){
// 快递配置
$('.update_express').click(function(){
var content = '<div class="form-group">'+
'<label>深圳市内:</label>'+
'<input type="text" name="sz_inside" class="sz_inside" value="" placeholder="输入快递费用,如20.00" style="width:70%;">'+
'</div>'+
'<div class="form-group">'+
'<label>广东省内:</label>'+
'<input type="text" name="gd_inside" class="gd_inside" value="" placeholder="输入快递费用,如20.00" style="width:70%;">'+
'</div>'+
'<div class="form-group">'+
'<label>广东省外:</label>'+
'<input type="text" name="gd_outside" class="gd_outside" value="" placeholder="输入快递费用,如20.00" style="width:70%;">'+
'</div>';
layer.open({
title: '快递配置'
,area: ['350px', '270px']
,content: content
,btn:['取消','确定']
,yes: function(index, layero){
layer.close(index);
}
,btn2: function(index, layero){
var sz_inside = $('.sz_inside').val();
var gd_inside = $('.gd_inside').val();
var gd_outside = $('.gd_outside').val();
var reg = /\d+/;
if(!sz_inside){
layer.tips('请输入费用',$('.sz_inside'));
return false;
}
if(!reg.test(sz_inside)){
layer.tips('格式错误',$('.sz_inside'));
return false;
}
if(!gd_inside){
layer.tips('请输入费用',$('.gd_inside'));
return false;
}
if(!reg.test(gd_inside)){
layer.tips('格式错误',$('.gd_inside'));
return false;
}
if(!gd_outside){
layer.tips('请输入费用',$('.gd_outside'));
return false;
}
if(!reg.test(gd_outside)){
layer.tips('格式错误',$('.gd_outside'));
return false;
}
$.ajax({
url: '/express_set',
type: 'post',
data: {sz_inside:sz_inside, gd_inside:gd_inside, gd_outside:gd_outside},
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)
}
})
}
});
})
}
}
});
})(jQuery)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单管理后台 | 订单统计</title>
<script>document.domain="{{ Config::get('website.domain') }}";</script>
@include('express_set.css')
@include('express_set.js')
</head>
<body class="">
<div id="wrapper">
<!-- layouts.navigation -->
@include('layouts.navigation')
<div id="page-wrapper" class="gray-bg">
<div class="row">
@include('express_set.content')
</div>
</div>
</div>
</body>
<div class="page-content">
<ul class="nav nav-tabs">
<li class="active"><a href="javascript:;">自营快递配置</a></li>
</ul>
<div class="tabs-box">
<div class="row-fluid">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>配置名称</th>
<th>描述</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>自营快递价格</td>
<td>深圳市:¥{{$express_fee['sz_inside']}}, 广东省内:¥{{$express_fee['gd_inside']}}, 广东省外:¥{{$express_fee['gd_outside']}}</td>
<td>
<button class="btn btn-info btn-xs update_express">修改</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script>
$.lie.express.index();
</script>
\ No newline at end of file
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/bootstrap-select.min.css" rel="stylesheet">
<link href="/font-awesome/css/font-awesome.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet">
<link href="/layer/skin/layer.css" rel="stylesheet">
<link href="/css/order.css" rel="stylesheet">
<link href="/css/detail.css" rel="stylesheet">
\ No newline at end of file
<script src="/js/jquery-2.2.1.js"></script>
<script src="/js/jquery.form.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/bootstrap-select.min.js"></script>
<script src="/layer/layer.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/inspinia.min.js"></script>
<script src="/js/common.js"></script>
<script src="/js/express.js"></script>
<script src="/js/plugins/DatePicker/WdatePicker.js"></script>
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