Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
飞鱼0526
ShopXO
提交
2e8825e8
ShopXO
项目概览
飞鱼0526
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2e8825e8
编写于
6月 08, 2020
作者:
D
devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
订单列表
上级
b081167d
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
653 addition
and
636 deletion
+653
-636
application/admin/form/Goods.php
application/admin/form/Goods.php
+1
-1
application/admin/form/Order.php
application/admin/form/Order.php
+334
-0
application/admin/view/default/order/index.html
application/admin/view/default/order/index.html
+2
-483
application/admin/view/default/order/module/address.html
application/admin/view/default/order/module/address.html
+13
-0
application/admin/view/default/order/module/aftersale.html
application/admin/view/default/order/module/aftersale.html
+8
-0
application/admin/view/default/order/module/express.html
application/admin/view/default/order/module/express.html
+5
-0
application/admin/view/default/order/module/extension.html
application/admin/view/default/order/module/extension.html
+6
-0
application/admin/view/default/order/module/info.html
application/admin/view/default/order/module/info.html
+26
-0
application/admin/view/default/order/module/operate.html
application/admin/view/default/order/module/operate.html
+48
-0
application/admin/view/default/order/module/pay_status.html
application/admin/view/default/order/module/pay_status.html
+13
-0
application/admin/view/default/order/module/status.html
application/admin/view/default/order/module/status.html
+7
-0
application/admin/view/default/order/module/take.html
application/admin/view/default/order/module/take.html
+16
-0
application/admin/view/default/order/module/user.html
application/admin/view/default/order/module/user.html
+14
-0
application/module/FormHandleModule.php
application/module/FormHandleModule.php
+160
-152
未找到文件。
application/admin/form/Goods.php
浏览文件 @
2e8825e8
...
...
@@ -66,7 +66,7 @@ class Goods
'label'
=>
'商品ID'
,
'view_type'
=>
'field'
,
'view_key'
=>
'id'
,
'width'
=>
1
20
,
'width'
=>
1
05
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'id'
,
...
...
application/admin/form/Order.php
0 → 100644
浏览文件 @
2e8825e8
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\admin\form
;
use
think\Db
;
use
app\service\GoodsService
;
use
app\service\RegionService
;
use
app\service\BrandService
;
use
app\service\PaymentService
;
/**
* 订单动态表单
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-05-16
* @desc description
*/
class
Order
{
// 基础条件
public
$condition_base
=
[
[
'is_delete_time'
,
'='
,
0
],
];
/**
* 入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-05-16
* @desc description
* @param [array] $params [输入参数]
*/
public
function
Run
(
$params
=
[])
{
return
[
// 基础配置
'base'
=>
[
'key_field'
=>
'id'
,
'status_field'
=>
'is_shelves'
,
'is_search'
=>
1
,
'search_url'
=>
MyUrl
(
'admin/order/index'
),
],
// 表单配置
'form'
=>
[
[
'label'
=>
'订单ID'
,
'view_type'
=>
'field'
,
'view_key'
=>
'id'
,
'width'
=>
105
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'where_type'
=>
'='
,
],
],
[
'label'
=>
'订单号'
,
'view_type'
=>
'field'
,
'view_key'
=>
'order_no'
,
'width'
=>
170
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'where_type'
=>
'='
,
],
],
[
'label'
=>
'基础信息'
,
'view_type'
=>
'module'
,
'view_key'
=>
'order/module/info'
,
'grid_size'
=>
'lg'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'id'
,
'where_type'
=>
'in'
,
'placeholder'
=>
'请输入商品名称/型号'
,
'where_custom'
=>
'WhereValueBaseInfo'
,
],
],
[
'label'
=>
'用户信息'
,
'view_type'
=>
'module'
,
'view_key'
=>
'order/module/user'
,
'grid_size'
=>
'sm'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'user_id'
,
'where_type'
=>
'in'
,
'placeholder'
=>
'请输入用户名/昵称/手机/邮箱'
,
'where_custom'
=>
'WhereValueUserInfo'
,
],
],
[
'label'
=>
'地址信息'
,
'view_type'
=>
'module'
,
'view_key'
=>
'order/module/address'
,
'grid_size'
=>
'sm'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'user_id'
,
'where_type'
=>
'in'
,
'placeholder'
=>
'请输入收件姓名/电话/地址'
,
'where_custom'
=>
'WhereValueAddressInfo'
,
],
],
[
'label'
=>
'取货信息'
,
'view_type'
=>
'module'
,
'view_key'
=>
'order/module/take'
,
'width'
=>
120
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'id'
,
'where_type'
=>
'='
,
'placeholder'
=>
'请输入取货码'
,
'where_custom'
=>
'WhereValueAddressInfo'
,
],
],
[
'label'
=>
'订单状态'
,
'view_type'
=>
'module'
,
'view_key'
=>
'order/module/status'
,
'width'
=>
120
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'form_name'
=>
'status'
,
'where_type'
=>
'in'
,
'data'
=>
lang
(
'common_order_admin_status'
),
'data_key'
=>
'id'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'支付状态'
,
'view_type'
=>
'module'
,
'view_key'
=>
'order/module/pay_status'
,
'width'
=>
120
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'form_name'
=>
'pay_status'
,
'where_type'
=>
'in'
,
'data'
=>
lang
(
'common_order_pay_status'
),
'data_key'
=>
'id'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'订单模式'
,
'view_type'
=>
'field'
,
'view_key'
=>
'order_model_name'
,
'width'
=>
120
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'form_name'
=>
'order_model'
,
'where_type'
=>
'in'
,
'data'
=>
lang
(
'common_site_type_list'
),
'data_key'
=>
'id'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'来源'
,
'view_type'
=>
'field'
,
'view_key'
=>
'client_type_name'
,
'width'
=>
120
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'form_name'
=>
'client_type'
,
'where_type'
=>
'in'
,
'data'
=>
lang
(
'common_platform_type'
),
'data_key'
=>
'id'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'单价(元)'
,
'view_type'
=>
'field'
,
'view_key'
=>
'price'
,
'search_config'
=>
[
'form_type'
=>
'section'
,
'is_point'
=>
1
,
],
],
[
'label'
=>
'总价(元)'
,
'view_type'
=>
'field'
,
'view_key'
=>
'total_price'
,
'search_config'
=>
[
'form_type'
=>
'section'
,
'is_point'
=>
1
,
],
],
[
'label'
=>
'支付金额(元)'
,
'view_type'
=>
'field'
,
'view_key'
=>
'pay_price'
,
'search_config'
=>
[
'form_type'
=>
'section'
,
'is_point'
=>
1
,
],
],
[
'label'
=>
'退款金额(元)'
,
'view_type'
=>
'field'
,
'view_key'
=>
'refund_price'
,
'search_config'
=>
[
'form_type'
=>
'section'
,
'is_point'
=>
1
,
],
],
[
'label'
=>
'退货数量'
,
'view_type'
=>
'field'
,
'view_key'
=>
'returned_quantity'
,
'search_config'
=>
[
'form_type'
=>
'section'
,
],
],
[
'label'
=>
'增加金额(元)'
,
'view_type'
=>
'field'
,
'view_key'
=>
'increase_price'
,
'search_config'
=>
[
'form_type'
=>
'section'
,
'is_point'
=>
1
,
],
],
[
'label'
=>
'优惠金额(元)'
,
'view_type'
=>
'field'
,
'view_key'
=>
'preferential_price'
,
'search_config'
=>
[
'form_type'
=>
'section'
,
'is_point'
=>
1
,
],
],
[
'label'
=>
'支付方式'
,
'view_type'
=>
'field'
,
'view_key'
=>
'payment_name'
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'form_name'
=>
'payment_id'
,
'where_type'
=>
'in'
,
'data'
=>
PaymentService
::
PaymentList
(),
'data_key'
=>
'id'
,
'data_name'
=>
'name'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'扩展信息'
,
'view_type'
=>
'module'
,
'view_key'
=>
'order/module/extension'
,
'grid_size'
=>
'sm'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'extension_data'
,
'where_type'
=>
'like'
,
],
],
[
'label'
=>
'快递信息'
,
'view_type'
=>
'module'
,
'view_key'
=>
'order/module/express'
,
'grid_size'
=>
'sm'
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'express_number'
,
'where_type'
=>
'like'
,
'placeholder'
=>
'请输入快递单号'
,
],
],
[
'label'
=>
'最新售后'
,
'view_type'
=>
'module'
,
'view_key'
=>
'order/module/aftersale'
,
'grid_size'
=>
'sm'
,
],
[
'label'
=>
'操作'
,
'view_type'
=>
'operate'
,
'view_key'
=>
'order/module/operate'
,
'align'
=>
'center'
,
'fixed'
=>
'right'
,
],
],
];
}
/**
* 商品分类条件处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-03
* @desc description
* @param [string] $name [字段名称]
* @param [array] $params [输入参数]
*/
public
function
WhereValueGoodsCategory
(
$value
,
$params
=
[])
{
if
(
!
empty
(
$value
))
{
// 是否为数组
if
(
!
is_array
(
$value
))
{
$value
=
[
$value
];
}
// 获取分类下的所有分类 id
$category_ids
=
GoodsService
::
GoodsCategoryItemsIds
(
$value
,
1
);
// 获取商品 id
$goods_ids
=
Db
::
name
(
'GoodsCategoryJoin'
)
->
where
([
'category_id'
=>
$category_ids
])
->
column
(
'goods_id'
);
// 避免空条件造成无效的错觉
return
empty
(
$goods_ids
)
?
[
0
]
:
$goods_ids
;
}
return
$value
;
}
}
\ No newline at end of file
application/admin/view/default/order/index.html
浏览文件 @
2e8825e8
此差异已折叠。
点击以展开。
application/admin/view/default/order/module/address.html
0 → 100644
浏览文件 @
2e8825e8
<!-- 地址信息 -->
{{if !empty($module_data)}}
{{if in_array($module_data['order_model'], [0,2]) and !empty($module_data['address_data'])}}
{{$module_data.address_data.name}}
<br
/>
{{$module_data.address_data.tel}}
<br
/>
{{$module_data.address_data.province_name}}
<br
/>
{{$module_data.address_data.city_name}}
<br
/>
{{$module_data.address_data.county_name}}
<br
/>
{{$module_data.address_data.address}}
{{else /}}
<span
class=
"cr-ddd"
>
无信息
</span>
{{/if}}
{{/if}}
\ No newline at end of file
application/admin/view/default/order/module/aftersale.html
0 → 100644
浏览文件 @
2e8825e8
<!-- 最新售后信息 -->
{{if !empty($module_data) and !empty($module_data['aftersale_first'])}}
<p>
状态:{{$module_data.aftersale_first.status_text}}
</p>
<p>
类型:{{$module_data.aftersale_first.type_text}}
</p>
<p>
金额:
<strong
class=
"am-text-danger"
>
{{$module_data.aftersale_first.price}}
</strong></p>
<p>
数量:{{$module_data.aftersale_first.number}}
</p>
<p>
原因:{{$module_data.aftersale_first.reason}}
</p>
{{/if}}
\ No newline at end of file
application/admin/view/default/order/module/express.html
0 → 100644
浏览文件 @
2e8825e8
<!-- 快递信息 -->
{{if !empty($module_data) and !empty($module_data['express_name'])}}
<p>
快递:{{$module_data.express_name}}
</p>
<p>
单号:{{$module_data.express_number}}
</p>
{{/if}}
\ No newline at end of file
application/admin/view/default/order/module/extension.html
0 → 100644
浏览文件 @
2e8825e8
<!-- 扩展信息 -->
{{if !empty($module_data) and !empty($module_data['extension_data'])}}
{{foreach $v.extension_data as $extk=>$ext}}
<p>
{{$ext.name}} [{{$ext.tips}}]
</p>
{{/foreach}}
{{/if}}
\ No newline at end of file
application/admin/view/default/order/module/info.html
0 → 100644
浏览文件 @
2e8825e8
<!-- 订单基础信息 -->
{{if !empty($module_data) and !empty($module_data['items'])}}
{{foreach $module_data.items as $item}}
<div
class=
"am-nbfc am-padding-vertical-xs"
>
<div
class=
"base am-nbfc"
>
<a
href=
"{{:MyUrl('index/goods/index', ['id'=>$item['goods_id']])}}"
target=
"_blank"
title=
"{{$item.title}}"
>
<img
src=
"{{$item['images']}}"
class=
"am-img-thumbnail am-radius am-margin-right-xs am-fl"
width=
"60"
height=
"60"
/>
</a>
<a
href=
"{{:MyUrl('index/goods/index', ['id'=>$item['goods_id']])}}"
target=
"_blank"
title=
"{{$item.title}}"
{{
if
!
empty
($
item
['
title_color
'])}}
style=
"color:{{$item.title_color}};"
{{/
if
}}
class=
"am-nowrap-initial"
>
{{$item.title}}
</a>
</div>
<div
class=
"other am-nbfc"
>
<span
class=
"am-fl am-text-xs am-nowrap-initial"
>
{{if !empty($item.spec_text)}}
{{$item.spec_text}}
{{/if}}
</span>
<span
class=
"am-fr"
>
{{$item.price}}x{{$item.buy_number}}
</span>
{{if $item['returned_quantity'] gt 0 or $item['refund_price'] gt 0}}
<span
class=
"am-text-danger am-fr am-margin-right-lg"
>
已退 {{$item.returned_quantity}} / {{$item.refund_price}}
</span>
{{/if}}
</div>
</div>
<hr
data-am-widget=
"divider"
class=
"am-divider am-divider-dashed am-margin-vertical-0"
/>
{{/foreach}}
<div
class=
"am-margin-top-sm"
>
{{$module_data.describe}}
</div>
{{/if}}
\ No newline at end of file
application/admin/view/default/order/module/operate.html
0 → 100644
浏览文件 @
2e8825e8
<!-- 操作栏 -->
<button
type=
"button"
class=
"am-btn am-btn-default am-btn-xs am-radius am-btn-block submit-popup"
data-url=
"{{:MyUrl('admin/order/detail', ['id'=>$module_data['id']])}}"
>
<i
class=
"am-icon-eye"
></i>
<span>
详情
</span>
</button>
{{if in_array($module_data['status'], [0])}}
<button
type=
"button"
class=
"am-btn am-btn-primary am-btn-xs am-radius am-btn-block submit-ajax"
data-url=
"{{:MyUrl('admin/order/confirm')}}"
data-id=
"{{$module_data.id}}"
data-value=
"{{$module_data.user_id}}"
data-view=
"reload"
data-msg=
"是否操作收货,操作后不可恢复!"
>
<i
class=
"am-icon-check-circle-o"
></i>
<span>
确认
</span>
</button>
{{/if}}
{{if in_array($module_data['status'], [0,1])}}
<button
type=
"button"
class=
"am-btn am-btn-warning am-btn-xs am-radius am-btn-block submit-ajax"
data-url=
"{{:MyUrl('admin/order/cancel')}}"
data-id=
"{{$module_data.id}}"
data-value=
"{{$module_data.user_id}}"
data-view=
"reload"
data-msg=
"取消后无法恢复,确定继续吗?"
>
<i
class=
"am-icon-paint-brush"
></i>
<span>
取消
</span>
</button>
{{if in_array($module_data['status'], [1])}}
<button
type=
"button"
class=
"am-btn am-btn-success am-btn-xs am-radius am-btn-block submit-pay"
data-id=
"{{$module_data.id}}"
data-payment-id=
"{{$module_data.payment_id}}"
data-am-modal=
"{target: '#order-pay-popup'}"
>
<i
class=
"am-icon-paypal"
></i>
<span>
支付
</span>
</button>
{{/if}}
{{/if}}
{{if $module_data['status'] eq 2}}
{{if $module_data['order_model'] eq 2}}
<button
type=
"button"
class=
"am-btn am-btn-secondary am-btn-xs am-radius am-btn-block submit-take"
data-id=
"{{$module_data.id}}"
data-user-id=
"{{$module_data.user_id}}"
data-am-modal=
"{target: '#order-take-modal', closeViaDimmer: 0, width: 200, height: 160}"
>
<i
class=
"am-icon-check"
></i>
<span>
取货
</span>
</button>
{{else /}}
<button
type=
"button"
class=
"am-btn am-btn-secondary am-btn-xs am-radius am-btn-block submit-delivery"
data-url=
"{{:MyUrl('admin/order/delivery')}}"
data-id=
"{{$module_data.id}}"
data-user-id=
"{{$module_data.user_id}}"
data-express-id=
"{{$module_data.express_id}}"
data-am-modal=
"{target: '#order-delivery-popup'}"
>
<i
class=
"am-icon-send-o"
></i>
<span>
发货
</span>
</button>
{{/if}}
{{/if}}
{{if $module_data['status'] eq 3}}
<button
type=
"button"
class=
"am-btn am-btn-success am-btn-xs am-radius am-btn-block submit-ajax"
data-url=
"{{:MyUrl('admin/order/collect')}}"
data-id=
"{{$module_data.id}}"
data-value=
"{{$module_data.user_id}}"
data-view=
"reload"
data-msg=
"是否操作收货,操作后不可恢复!"
>
<i
class=
"am-icon-check-circle-o"
></i>
<span>
收货
</span>
</button>
{{/if}}
{{if in_array($module_data['status'], [5,6])}}
<button
type=
"button"
class=
"am-btn am-btn-danger am-btn-xs am-radius am-btn-block submit-ajax"
data-url=
"{{:MyUrl('admin/order/delete')}}"
data-id=
"{{$module_data.id}}"
data-value=
"{{$module_data.user_id}}"
data-view=
"delete"
data-msg=
"删除后无法恢复,确定继续吗?"
>
<i
class=
"am-icon-trash-o"
></i>
<span>
删除
</span>
</button>
{{/if}}
\ No newline at end of file
application/admin/view/default/order/module/pay_status.html
0 → 100644
浏览文件 @
2e8825e8
<!-- 支付状态 -->
{{if !empty($module_data)}}
{{if $module_data['pay_status'] eq 1}}
<p
class=
"am-text-success"
>
{{$module_data.pay_status_name}}
</p>
{{elseif $module_data['pay_status'] gt 1 /}}
<p
class=
"am-text-danger"
>
{{$module_data.pay_status_name}}
</p>
{{else /}}
<p>
{{$module_data.pay_status_name}}
</p>
{{/if}}
{{if !empty($module_data['is_under_line_text'])}}
<p
class=
"am-text-warning"
>
{{$module_data.is_under_line_text}}
</p>
{{/if}}
{{/if}}
\ No newline at end of file
application/admin/view/default/order/module/status.html
0 → 100644
浏览文件 @
2e8825e8
<!-- 订单状态 -->
{{if !empty($module_data)}}
<p>
{{$module_data.status_name}}
</p>
{{if $module_data['user_is_delete_time'] neq 0}}
<p
class=
"am-text-warning"
>
用户已删除
</p>
{{/if}}
{{/if}}
\ No newline at end of file
application/admin/view/default/order/module/take.html
0 → 100644
浏览文件 @
2e8825e8
<!-- 取货信息 -->
{{if !empty($module_data) and !empty($module_data['extraction_data'])}}
<p>
<span>
取货码:
</span>
{{if empty($module_data['extraction_data']['code'])}}
<span
class=
"am-text-danger"
>
取货码不存在、请联系管理员
</span>
{{else /}}
<span
class=
"am-badge am-badge-success am-radius"
>
{{$module_data.extraction_data.code}}
</span>
{{/if}}
</p>
{{if !empty($module_data['extraction_data']['images'])}}
<p
class=
"am-margin-top-xs"
>
<img
class=
"am-img-thumbnail"
src=
"{{$module_data.extraction_data.images}}"
alt=
"取货码"
width=
"100"
height=
"100"
/>
</p>
{{/if}}
{{/if}}
\ No newline at end of file
application/admin/view/default/order/module/user.html
0 → 100644
浏览文件 @
2e8825e8
<!-- 用户信息 -->
{{if !empty($module_data)}}
{{if !empty($module_data['user'])}}
<img
src=
"{{$module_data.user.avatar}}"
alt=
"{{$module_data.user.user_name_view}}"
class=
"am-img-thumbnail am-radius am-align-left am-margin-right-xs am-margin-bottom-0"
width=
"35"
height=
"35"
/>
<ul
class=
"user-base"
>
<li>
名称:{{if empty($module_data['user']['username'])}}
<span
class=
"cr-ccc"
>
未填写
</span>
{{else /}}{{$module_data.user.username}}{{/if}}
</li>
<li>
昵称:{{if empty($module_data['user']['nickname'])}}
<span
class=
"cr-ccc"
>
未填写
</span>
{{else /}}{{$module_data.user.nickname}}{{/if}}
</li>
<li>
手机:{{if empty($module_data['user']['mobile'])}}
<span
class=
"cr-ccc"
>
未填写
</span>
{{else /}}{{$module_data.user.mobile}}{{/if}}
</li>
<li>
邮箱:{{if empty($module_data['user']['email'])}}
<span
class=
"cr-ccc"
>
未填写
</span>
{{else /}}{{$module_data.user.email}}{{/if}}
</li>
</ul>
{{else /}}
用户信息异常
{{/if}}
{{/if}}
\ No newline at end of file
application/module/FormHandleModule.php
浏览文件 @
2e8825e8
...
...
@@ -164,181 +164,189 @@ class FormHandleModule
break
;
}
}
// 条件处理
if
(
!
empty
(
$v
[
'search_config'
])
&&
!
empty
(
$v
[
'search_config'
][
'form_type'
])
&&
!
empty
(
$v
[
'search_config'
][
'form_name'
])
)
if
(
!
empty
(
$v
[
'search_config'
])
&&
!
empty
(
$v
[
'search_config'
][
'form_type'
]))
{
// 基础数据处理
// 显示名称
$label
=
empty
(
$v
[
'label'
])
?
''
:
$v
[
'label'
];
// 唯一 formkey
$form_key
=
'fp'
.
$k
;
$v
[
'form_key'
]
=
$form_key
;
// 根据组件类型处理
switch
(
$v
[
'search_config'
][
'form_type'
])
// 搜索 key 未指定则使用显示数据的字段名称
if
(
empty
(
$v
[
'search_config'
][
'form_name'
]))
{
// 单个输入
case
'input'
:
// 提示信息处理
if
(
empty
(
$v
[
'search_config'
][
'placeholder'
]))
{
$v
[
'search_config'
][
'placeholder'
]
=
'请输入'
.
$label
;
}
break
;
// 选择
case
'select'
:
// 提示信息处理
if
(
empty
(
$v
[
'search_config'
][
'placeholder'
]))
{
$v
[
'search_config'
][
'placeholder'
]
=
'请选择'
.
$label
;
}
// 选择数据 key=>name
if
(
empty
(
$v
[
'search_config'
][
'data_key'
]))
{
$v
[
'search_config'
][
'data_key'
]
=
'id'
;
}
if
(
empty
(
$v
[
'search_config'
][
'data_name'
]))
{
$v
[
'search_config'
][
'data_key'
]
=
'name'
;
}
break
;
// 区间
case
'section'
:
// 提示信息处理
if
(
empty
(
$v
[
'search_config'
][
'placeholder_min'
]))
{
$v
[
'search_config'
][
'placeholder_min'
]
=
'最小值'
;
}
if
(
empty
(
$v
[
'search_config'
][
'placeholder_max'
]))
{
$v
[
'search_config'
][
'placeholder_max'
]
=
'最大值'
;
}
break
;
// 时间
case
'datetime'
:
case
'date'
:
// 提示信息处理
if
(
empty
(
$v
[
'search_config'
][
'placeholder_start'
]))
{
$v
[
'search_config'
][
'placeholder_start'
]
=
'开始'
;
}
if
(
empty
(
$v
[
'search_config'
][
'placeholder_end'
]))
{
$v
[
'search_config'
][
'placeholder_end'
]
=
'结束'
;
}
break
;
$v
[
'search_config'
][
'form_name'
]
=
isset
(
$v
[
'view_key'
])
?
$v
[
'view_key'
]
:
''
;
}
// 搜索条件数据处理
// 表单字段名称
$name
=
$v
[
'search_config'
][
'form_name'
];
// 条件类型
$type
=
isset
(
$v
[
'search_config'
][
'where_type'
])
?
$v
[
'search_config'
][
'where_type'
]
:
$v
[
'search_config'
][
'form_type'
];
// 是否自定义条件处理方法
$custom
=
isset
(
$v
[
'search_config'
][
'where_custom'
])
?
$v
[
'search_config'
][
'where_custom'
]
:
''
;
// 根据条件类型处理
switch
(
$type
)
// 基础数据处理
if
(
!
empty
(
$v
[
'search_config'
][
'form_name'
]))
{
// 单个值
case
'='
:
case
'<'
:
case
'>'
:
case
'<='
:
case
'>='
:
case
'like'
:
if
(
array_key_exists
(
$form_key
,
$this
->
out_params
)
&&
$this
->
out_params
[
$form_key
]
!==
null
&&
$this
->
out_params
[
$form_key
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$form_key
]);
$this
->
where_params
[
$form_key
]
=
$value
;
// 显示名称
$label
=
empty
(
$v
[
'label'
])
?
''
:
$v
[
'label'
];
// 条件值处理
$value
=
$this
->
WhereValueHandle
(
$value
,
$custom
);
// 唯一 formkey
$form_key
=
'fp'
.
$k
;
$v
[
'form_key'
]
=
$form_key
;
// 是否 like 条件
if
(
$type
==
'like'
)
// 根据组件类型处理
switch
(
$v
[
'search_config'
][
'form_type'
])
{
// 单个输入
case
'input'
:
// 提示信息处理
if
(
empty
(
$v
[
'search_config'
][
'placeholder'
]))
{
$v
alue
=
'%'
.
$value
.
'%'
;
$v
[
'search_config'
][
'placeholder'
]
=
'请输入'
.
$label
;
}
break
;
// 条件
$this
->
where
[]
=
[
$name
,
$type
,
$value
];
}
break
;
// 选择
case
'select'
:
// 提示信息处理
if
(
empty
(
$v
[
'search_config'
][
'placeholder'
]))
{
$v
[
'search_config'
][
'placeholder'
]
=
'请选择'
.
$label
;
}
// in
case
'in'
:
if
(
array_key_exists
(
$form_key
,
$this
->
out_params
)
&&
$this
->
out_params
[
$form_key
]
!==
null
&&
$this
->
out_params
[
$form_key
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$form_key
]);
if
(
!
is_array
(
$value
))
// 选择数据 key=>name
if
(
empty
(
$v
[
'search_config'
][
'data_key'
]))
{
$v
alue
=
explode
(
','
,
$value
)
;
$v
[
'search_config'
][
'data_key'
]
=
'id'
;
}
$this
->
where_params
[
$form_key
]
=
$value
;
if
(
empty
(
$v
[
'search_config'
][
'data_name'
]))
{
$v
[
'search_config'
][
'data_key'
]
=
'name'
;
}
break
;
// 条件
$this
->
where
[]
=
[
$name
,
$type
,
$this
->
WhereValueHandle
(
$value
,
$custom
)];
}
break
;
// 区间
case
'section'
:
// 提示信息处理
if
(
empty
(
$v
[
'search_config'
][
'placeholder_min'
]))
{
$v
[
'search_config'
][
'placeholder_min'
]
=
'最小值'
;
}
if
(
empty
(
$v
[
'search_config'
][
'placeholder_max'
]))
{
$v
[
'search_config'
][
'placeholder_max'
]
=
'最大值'
;
}
break
;
// 区间值
case
'section'
:
$key_min
=
$form_key
.
'_min'
;
$key_max
=
$form_key
.
'_max'
;
if
(
array_key_exists
(
$key_min
,
$this
->
out_params
)
&&
$this
->
out_params
[
$key_min
]
!==
null
&&
$this
->
out_params
[
$key_min
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$key_min
]);
$this
->
where_params
[
$key_min
]
=
$value
;
// 时间
case
'datetime'
:
case
'date'
:
// 提示信息处理
if
(
empty
(
$v
[
'search_config'
][
'placeholder_start'
]))
{
$v
[
'search_config'
][
'placeholder_start'
]
=
'开始'
;
}
if
(
empty
(
$v
[
'search_config'
][
'placeholder_end'
]))
{
$v
[
'search_config'
][
'placeholder_end'
]
=
'结束'
;
}
break
;
}
// 条件
$this
->
where
[]
=
[
$name
,
'>='
,
$this
->
WhereValueHandle
(
$value
,
$custom
,
[
'is_min'
=>
1
])];
}
if
(
array_key_exists
(
$key_max
,
$this
->
out_params
)
&&
$this
->
out_params
[
$key_max
]
!==
null
&&
$this
->
out_params
[
$key_max
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$key_max
]);
$this
->
where_params
[
$key_max
]
=
$value
;
// 搜索条件数据处理
// 表单字段名称
$name
=
$v
[
'search_config'
][
'form_name'
];
// 条件类型
$type
=
isset
(
$v
[
'search_config'
][
'where_type'
])
?
$v
[
'search_config'
][
'where_type'
]
:
$v
[
'search_config'
][
'form_type'
];
// 是否自定义条件处理方法
$custom
=
isset
(
$v
[
'search_config'
][
'where_custom'
])
?
$v
[
'search_config'
][
'where_custom'
]
:
''
;
// 根据条件类型处理
switch
(
$type
)
{
// 单个值
case
'='
:
case
'<'
:
case
'>'
:
case
'<='
:
case
'>='
:
case
'like'
:
if
(
array_key_exists
(
$form_key
,
$this
->
out_params
)
&&
$this
->
out_params
[
$form_key
]
!==
null
&&
$this
->
out_params
[
$form_key
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$form_key
]);
$this
->
where_params
[
$form_key
]
=
$value
;
// 条件
$this
->
where
[]
=
[
$name
,
'<='
,
$this
->
WhereValueHandle
(
$value
,
$custom
,
[
'is_end'
=>
1
])];
}
break
;
// 条件值处理
$value
=
$this
->
WhereValueHandle
(
$value
,
$custom
);
// 时间
case
'datetime'
:
case
'date'
:
$key_start
=
$form_key
.
'_start'
;
$key_end
=
$form_key
.
'_end'
;
if
(
array_key_exists
(
$key_start
,
$this
->
out_params
)
&&
$this
->
out_params
[
$key_start
]
!==
null
&&
$this
->
out_params
[
$key_start
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$key_start
]);
$this
->
where_params
[
$key_start
]
=
$value
;
// 是否 like 条件
if
(
$type
==
'like'
)
{
$value
=
'%'
.
$value
.
'%'
;
}
// 条件
$this
->
where
[]
=
[
$name
,
'>='
,
$this
->
WhereValueHandle
(
strtotime
(
$value
),
$custom
,
[
'is_start'
=>
1
])];
}
if
(
array_key_exists
(
$key_end
,
$this
->
out_params
)
&&
$this
->
out_params
[
$key_end
]
!==
null
&&
$this
->
out_params
[
$key_end
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$key_end
]);
$this
->
where_params
[
$key_end
]
=
$value
;
// 条件
$this
->
where
[]
=
[
$name
,
$type
,
$value
];
}
break
;
// 条件
$this
->
where
[]
=
[
$name
,
'<='
,
$this
->
WhereValueHandle
(
strtotime
(
$value
),
$custom
,
[
'is_end'
=>
1
])];
// in
case
'in'
:
if
(
array_key_exists
(
$form_key
,
$this
->
out_params
)
&&
$this
->
out_params
[
$form_key
]
!==
null
&&
$this
->
out_params
[
$form_key
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$form_key
]);
if
(
!
is_array
(
$value
))
{
$value
=
explode
(
','
,
$value
);
}
$this
->
where_params
[
$form_key
]
=
$value
;
// 条件
$this
->
where
[]
=
[
$name
,
$type
,
$this
->
WhereValueHandle
(
$value
,
$custom
)];
}
break
;
}
break
;
// 区间值
case
'section'
:
$key_min
=
$form_key
.
'_min'
;
$key_max
=
$form_key
.
'_max'
;
if
(
array_key_exists
(
$key_min
,
$this
->
out_params
)
&&
$this
->
out_params
[
$key_min
]
!==
null
&&
$this
->
out_params
[
$key_min
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$key_min
]);
$this
->
where_params
[
$key_min
]
=
$value
;
// 条件
$this
->
where
[]
=
[
$name
,
'>='
,
$this
->
WhereValueHandle
(
$value
,
$custom
,
[
'is_min'
=>
1
])];
}
if
(
array_key_exists
(
$key_max
,
$this
->
out_params
)
&&
$this
->
out_params
[
$key_max
]
!==
null
&&
$this
->
out_params
[
$key_max
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$key_max
]);
$this
->
where_params
[
$key_max
]
=
$value
;
// 条件
$this
->
where
[]
=
[
$name
,
'<='
,
$this
->
WhereValueHandle
(
$value
,
$custom
,
[
'is_end'
=>
1
])];
}
break
;
// 时间
case
'datetime'
:
case
'date'
:
$key_start
=
$form_key
.
'_start'
;
$key_end
=
$form_key
.
'_end'
;
if
(
array_key_exists
(
$key_start
,
$this
->
out_params
)
&&
$this
->
out_params
[
$key_start
]
!==
null
&&
$this
->
out_params
[
$key_start
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$key_start
]);
$this
->
where_params
[
$key_start
]
=
$value
;
// 条件
$this
->
where
[]
=
[
$name
,
'>='
,
$this
->
WhereValueHandle
(
strtotime
(
$value
),
$custom
,
[
'is_start'
=>
1
])];
}
if
(
array_key_exists
(
$key_end
,
$this
->
out_params
)
&&
$this
->
out_params
[
$key_end
]
!==
null
&&
$this
->
out_params
[
$key_end
]
!==
''
)
{
// 参数值
$value
=
urldecode
(
$this
->
out_params
[
$key_end
]);
$this
->
where_params
[
$key_end
]
=
$value
;
// 条件
$this
->
where
[]
=
[
$name
,
'<='
,
$this
->
WhereValueHandle
(
strtotime
(
$value
),
$custom
,
[
'is_end'
=>
1
])];
}
break
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录