切换导航条
此项目
正在载入...
登录
李忠强
/
temporaryfood
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
李忠强
3 years ago
提交
a98b666c8302028ea68915d9eef778d7dd474852
1 个父辈
376ca93e
更新
隐藏空白字符变更
内嵌
并排对比
正在显示
13 个修改的文件
包含
447 行增加
和
2 行删除
application/admin/controller/LitestoreRiderRule.php
application/admin/controller/litestore/Litestorefreight.php
application/admin/lang/zh-cn/litestore_rider_rule.php
application/admin/model/LitestoreRiderRule.php
application/admin/validate/LitestoreRiderRule.php
application/admin/view/litestore/litestorefreight/edit.html
application/admin/view/litestore_rider_rule/add.html
application/admin/view/litestore_rider_rule/edit.html
application/admin/view/litestore_rider_rule/index.html
application/api/controller/Order.php
application/api/controller/Rider.php
application/api/model/RiderOrder.php
public/assets/js/backend/litestore_rider_rule.js
application/admin/controller/LitestoreRiderRule.php
0 → 100644
查看文件 @
a98b666
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
/**
* 运费规则
*
* @icon fa fa-circle-o
*/
class
LitestoreRiderRule
extends
Backend
{
/**
* LitestoreRiderRule模型对象
* @var \app\admin\model\LitestoreRiderRule
*/
protected
$model
=
null
;
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
model
=
new
\app\admin\model\LitestoreRiderRule
;
}
public
function
import
()
{
parent
::
import
();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}
...
...
application/admin/controller/litestore/Litestorefreight.php
查看文件 @
a98b666
...
...
@@ -14,7 +14,7 @@ class Litestorefreight extends Backend
/**
* Litestore_freight模型对象
* @var \app\admin\model\Litestorefreight
* @var \app\admin\model\
litestore\
Litestorefreight
*/
protected
$model
=
null
;
...
...
application/admin/lang/zh-cn/litestore_rider_rule.php
0 → 100644
查看文件 @
a98b666
<?php
return
[
'First'
=>
'首公里'
,
'First_fee'
=>
'运费(元)'
,
'Additional'
=>
'续公里'
,
'Additional_fee'
=>
'运费(元)'
];
...
...
application/admin/model/LitestoreRiderRule.php
0 → 100644
查看文件 @
a98b666
<?php
namespace
app\admin\model
;
use
think\Model
;
class
LitestoreRiderRule
extends
Model
{
// 表名
protected
$name
=
'litestore_rider_rule'
;
// 自动写入时间戳字段
protected
$autoWriteTimestamp
=
false
;
// 定义时间戳字段名
protected
$createTime
=
false
;
protected
$updateTime
=
false
;
protected
$deleteTime
=
false
;
// 追加属性
protected
$append
=
[
'create_time_text'
];
public
function
getCreateTimeTextAttr
(
$value
,
$data
)
{
$value
=
$value
?
$value
:
(
isset
(
$data
[
'create_time'
])
?
$data
[
'create_time'
]
:
''
);
return
is_numeric
(
$value
)
?
date
(
"Y-m-d H:i:s"
,
$value
)
:
$value
;
}
protected
function
setCreateTimeAttr
(
$value
)
{
return
$value
===
''
?
null
:
(
$value
&&
!
is_numeric
(
$value
)
?
strtotime
(
$value
)
:
$value
);
}
}
...
...
application/admin/validate/LitestoreRiderRule.php
0 → 100644
查看文件 @
a98b666
<?php
namespace
app\admin\validate
;
use
think\Validate
;
class
LitestoreRiderRule
extends
Validate
{
/**
* 验证规则
*/
protected
$rule
=
[
];
/**
* 提示消息
*/
protected
$message
=
[
];
/**
* 验证场景
*/
protected
$scene
=
[
'add'
=>
[],
'edit'
=>
[],
];
}
...
...
application/admin/view/litestore/litestorefreight/edit.html
查看文件 @
a98b666
...
...
@@ -9,7 +9,7 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Method')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<select
id=
"c-method"
data-rule=
"required"
class=
"form-control selectpicker"
name=
"row[method]"
>
{foreach name="methodList" item="vo"}
<option
value=
"{$key}"
{
in
name=
"key"
value=
"$row.method"
}
selected
{/
in
}
>
{$vo}
</option>
...
...
application/admin/view/litestore_rider_rule/add.html
0 → 100644
查看文件 @
a98b666
<form
id=
"add-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('First')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-first"
data-rule=
"required"
min=
"0"
class=
"form-control"
name=
"row[first]"
type=
"number"
value=
"0"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('First_fee')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-first_fee"
data-rule=
"required"
min=
"0"
class=
"form-control"
step=
"0.01"
name=
"row[first_fee]"
type=
"number"
value=
"0.00"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Additional')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-additional"
data-rule=
"required"
min=
"0"
class=
"form-control"
name=
"row[additional]"
type=
"number"
value=
"0"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Additional_fee')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-additional_fee"
data-rule=
"required"
min=
"0"
class=
"form-control"
step=
"0.01"
name=
"row[additional_fee]"
type=
"number"
value=
"0.00"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Create_time')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-create_time"
data-rule=
"required"
min=
"0"
class=
"form-control datetimepicker"
data-date-format=
"YYYY-MM-DD HH:mm:ss"
data-use-current=
"true"
name=
"row[create_time]"
type=
"text"
value=
"{:date('Y-m-d H:i:s')}"
>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
...
...
application/admin/view/litestore_rider_rule/edit.html
0 → 100644
查看文件 @
a98b666
<form
id=
"edit-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('First')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-first"
data-rule=
"required"
min=
"0"
class=
"form-control"
name=
"row[first]"
type=
"number"
value=
"{$row.first|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('First_fee')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-first_fee"
data-rule=
"required"
min=
"0"
class=
"form-control"
step=
"0.01"
name=
"row[first_fee]"
type=
"number"
value=
"{$row.first_fee|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Additional')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-additional"
data-rule=
"required"
min=
"0"
class=
"form-control"
name=
"row[additional]"
type=
"number"
value=
"{$row.additional|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Additional_fee')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-additional_fee"
data-rule=
"required"
min=
"0"
class=
"form-control"
step=
"0.01"
name=
"row[additional_fee]"
type=
"number"
value=
"{$row.additional_fee|htmlentities}"
>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
...
...
application/admin/view/litestore_rider_rule/index.html
0 → 100644
查看文件 @
a98b666
<div
class=
"panel panel-default panel-intro"
>
{:build_heading()}
<div
class=
"panel-body"
>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade active in"
id=
"one"
>
<div
class=
"widget-body no-padding"
>
<div
id=
"toolbar"
class=
"toolbar"
>
<a
href=
"javascript:;"
class=
"btn btn-primary btn-refresh"
title=
"{:__('Refresh')}"
><i
class=
"fa fa-refresh"
></i>
</a>
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('litestore_rider_rule/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<a
href=
"javascript:;"
class=
"btn btn-success btn-edit btn-disabled disabled {:$auth->check('litestore_rider_rule/edit')?'':'hide'}"
title=
"{:__('Edit')}"
><i
class=
"fa fa-pencil"
></i>
{:__('Edit')}
</a>
<!-- <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('litestore_rider_rule/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<!-- <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('litestore_rider_rule/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
<!-- <div class="dropdown btn-group {:$auth->check('litestore_rider_rule/multi')?'':'hide'}">-->
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!-- <ul class="dropdown-menu text-left" role="menu">-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
<!-- </ul>-->
<!-- </div>-->
</div>
<table
id=
"table"
class=
"table table-striped table-bordered table-hover table-nowrap"
data-operate-edit=
"{:$auth->check('litestore_rider_rule/edit')}"
data-operate-del=
"{:$auth->check('litestore_rider_rule/del')}"
width=
"100%"
>
</table>
</div>
</div>
</div>
</div>
</div>
...
...
application/api/controller/Order.php
查看文件 @
a98b666
...
...
@@ -6,6 +6,7 @@ namespace app\api\controller;
use
app\api\model\GoodsSpec
;
use
app\api\model\SpecValue
;
use
app\api\model\UserCoupon
;
use
app\common\controller\Api
;
use
think\Db
;
use
think\exception\PDOException
;
...
...
@@ -207,6 +208,62 @@ class Order extends Api
$this
->
success
(
'下单页详情'
,[
'list'
=>
$goods_array
,
'price'
=>
$sum_price
]);
}
/**
* @ApiTitle (计算运费)
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="address_id", type="integer", required=true, description="地址id")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
'data':
"price": "37574.00" 总价
})
*/
public
function
freightCalculation
()
{
$address_id
=
$this
->
request
->
post
(
'address_id'
);
if
(
!
$address_id
)
$this
->
error
(
'请选择地址'
);
$this
->
success
(
'下单页详情'
,[
'price'
=>
$sum_price
]);
}
/**
* @ApiTitle (选择优惠券)
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="price", type="float", required=true, description="订单价格")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
"data": [
{
"id": 1,
"user_id": 1,
"coupon_id": 1,
"name": "手动阀手动阀",
"price": "1.00", 优惠券金额
"full_price": "10.00", 满减金额
"createtime": 111122244,
"endtime": 1641869388,
"status": "0",
"endtime_text": "2022年01月11日到期"
}
]
})
*/
public
function
chooseCoupon
()
{
$price
=
$this
->
request
->
post
(
'price'
);
if
(
!
is_numeric
(
$price
))
$this
->
error
(
'订单价格不合法'
);
$model
=
new
UserCoupon
();
$list
=
$model
->
where
(
'status'
,
'0'
)
->
where
(
'user_id'
,
$this
->
auth
->
id
)
->
where
(
'full_price'
,
'<'
,
$price
)
->
select
();
$this
->
success
(
'用户优惠券列表'
,
$list
);
}
/**
* @ApiTitle (下单)
...
...
application/api/controller/Rider.php
0 → 100644
查看文件 @
a98b666
<?php
namespace
app\api\controller
;
use
app\api\model\RiderOrder
;
use
app\common\controller\Api
;
class
Rider
extends
Api
{
protected
$noNeedRight
=
[
'*'
];
protected
$noNeedLogin
=
[
'*'
];
/**
* @ApiTitle (骑手订单页)
* @ApiMethod (POST)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name=page, type=integer, required=true, description="页数")
* @ApiParams (name=lat, type=integer, required=true, description="骑手纬度")
* @ApiParams (name=lng, type=integer, required=true, description="骑手经度")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
'data':
"total": 2,
"per_page": 5,
"current_page": 1,
"last_page": 1,
"data": [
{
"id": 1,
"distance": 111.263, 距离
"address": {
"name": "1", 收件人
"phone": "13549059988", 电话号码
"detail": "阿松大", 地址
"address": "阿松大", 门牌号
},
"orderdetail": {
"order_no": "LQ-16420622494781", 订单编号
"createtime_text": ""
}
}
]
})
*/
public
function
index
()
{
$page
=
$this
->
request
->
post
(
'page'
,
1
);
$lat
=
$this
->
request
->
post
(
'lat'
);
$lng
=
$this
->
request
->
post
(
'lng'
);
if
(
!
is_numeric
(
$page
))
$this
->
error
(
'页数不合法'
);
if
(
!
is_numeric
(
$lat
))
$this
->
error
(
'纬度不合法'
);
if
(
!
is_numeric
(
$lng
))
$this
->
error
(
'经度不合法'
);
$model
=
new
RiderOrder
();
$EARTH
=
6378.137
;
//地球半径
$PI
=
3.14
;
//PI值 圆周率
$list
=
$model
->
with
([
'address'
,
'orderdetail'
])
->
where
(
'fa_rider_order.user_id'
,
$this
->
auth
->
id
)
->
where
(
'fa_rider_order.status'
,
'1'
)
->
field
(
'Round((2 * '
.
$EARTH
.
'* ASIN(SQRT(POW(SIN('
.
$PI
.
'*('
.
$lat
.
'-lat)/360),2)
+COS('
.
$PI
.
'*'
.
$lat
.
'/180)* COS(lat * '
.
$PI
.
'/180)
*POW(SIN('
.
$PI
.
'*('
.
$lng
.
'-lng)/360),2)))),3) as distance'
)
->
order
(
'distance'
)
->
paginate
(
5
,
false
,[
'page'
=>
$page
])
->
each
(
function
(
$item
,
$key
){
$item
->
getRelation
(
'orderdetail'
)
->
visible
([
'order_no'
]);
$item
->
getRelation
(
'address'
)
->
visible
([
'name'
,
'phone'
,
'address'
,
'detail'
]);
$item
->
visible
([
'orderdetail'
,
'address'
,
'distance'
,
'id'
]);
});
$this
->
success
(
'订单列表'
,
$list
);
}
}
\ No newline at end of file
...
...
application/api/model/RiderOrder.php
0 → 100644
查看文件 @
a98b666
<?php
namespace
app\api\model
;
use
think\Model
;
class
RiderOrder
extends
Model
{
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
''
;
public
function
address
()
{
return
$this
->
belongsTo
(
'OrderAddress'
,
'address_id'
,
'id'
)
->
setEagerlyType
(
0
);
}
public
function
orderdetail
()
{
return
$this
->
belongsTo
(
'Order'
,
'order_id'
,
'id'
);
}
}
\ No newline at end of file
...
...
public/assets/js/backend/litestore_rider_rule.js
0 → 100644
查看文件 @
a98b666
define
([
'jquery'
,
'bootstrap'
,
'backend'
,
'table'
,
'form'
],
function
(
$
,
undefined
,
Backend
,
Table
,
Form
)
{
var
Controller
=
{
index
:
function
()
{
// 初始化表格参数配置
Table
.
api
.
init
({
extend
:
{
index_url
:
'litestore_rider_rule/index'
+
location
.
search
,
add_url
:
'litestore_rider_rule/add'
,
edit_url
:
'litestore_rider_rule/edit'
,
del_url
:
'litestore_rider_rule/del'
,
multi_url
:
'litestore_rider_rule/multi'
,
import_url
:
'litestore_rider_rule/import'
,
table
:
'litestore_rider_rule'
,
}
});
var
table
=
$
(
"#table"
);
// 初始化表格
table
.
bootstrapTable
({
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
pk
:
'id'
,
sortName
:
'id'
,
search
:
false
,
showSearch
:
false
,
showExport
:
false
,
columns
:
[
[
{
checkbox
:
true
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'first'
,
title
:
__
(
'First'
),
operate
:
'BETWEEN'
},
{
field
:
'first_fee'
,
title
:
__
(
'First_fee'
),
operate
:
'BETWEEN'
},
{
field
:
'additional'
,
title
:
__
(
'Additional'
),
operate
:
'BETWEEN'
},
{
field
:
'additional_fee'
,
title
:
__
(
'Additional_fee'
),
operate
:
'BETWEEN'
},
// {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
]
]
});
// 为表格绑定事件
Table
.
api
.
bindevent
(
table
);
},
add
:
function
()
{
Controller
.
api
.
bindevent
();
},
edit
:
function
()
{
Controller
.
api
.
bindevent
();
},
api
:
{
bindevent
:
function
()
{
Form
.
api
.
bindevent
(
$
(
"form[role=form]"
));
}
}
};
return
Controller
;
});
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论