动态表格优化

feat/task1-c-wallet
devil 2020-08-20 23:38:41 +08:00
parent d9a029b8c6
commit 0b5c5e2a24
21 changed files with 175 additions and 53 deletions

View File

@ -67,7 +67,7 @@ class Answer
'form_name' => 'user_id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueUserInfo',
'where_value_custom' => 'WhereValueUserInfo',
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],

View File

@ -97,7 +97,7 @@ class Brand
'data_key' => 'id',
'data_name' => 'name',
'is_multiple' => 1,
'where_handle_custom' => 'WhereValueBrandCategory',
'where_value_custom' => 'WhereValueBrandCategory',
],
],
[

View File

@ -94,7 +94,7 @@ class Goods
'template' => 'lib/module/goods_category',
'form_name' => 'id',
'where_type' => 'in',
'where_handle_custom' => 'WhereValueGoodsCategory',
'where_value_custom' => 'WhereValueGoodsCategory',
'data' => GoodsService::GoodsCategoryAll(),
],
],

View File

@ -66,7 +66,7 @@ class Goodsbrowse
'form_name' => 'b.user_id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueUserInfo',
'where_value_custom' => 'WhereValueUserInfo',
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],

View File

@ -67,7 +67,7 @@ class Goodscomments
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereGoodsInfo',
'where_value_custom' => 'WhereGoodsInfo',
'placeholder' => '请输入商品名称/型号',
],
],
@ -81,7 +81,7 @@ class Goodscomments
'form_name' => 'user_id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueUserInfo',
'where_value_custom' => 'WhereValueUserInfo',
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],

View File

@ -66,7 +66,7 @@ class Goodsfavor
'form_name' => 'f.user_id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueUserInfo',
'where_value_custom' => 'WhereValueUserInfo',
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],

View File

@ -55,7 +55,7 @@ class Integrallog
'form_name' => 'user_id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueUserInfo',
'where_value_custom' => 'WhereValueUserInfo',
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],

View File

@ -68,7 +68,7 @@ class Message
'form_name' => 'user_id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueUserInfo',
'where_value_custom' => 'WhereValueUserInfo',
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],

View File

@ -62,7 +62,7 @@ class Order
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereBaseGoodsInfo',
'where_value_custom' => 'WhereBaseGoodsInfo',
'placeholder' => '请输入订单ID/订单号/商品名称/型号',
],
],
@ -76,7 +76,7 @@ class Order
'form_name' => 'user_id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueUserInfo',
'where_value_custom' => 'WhereValueUserInfo',
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],
@ -190,7 +190,7 @@ class Order
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueAddressInfo',
'where_value_custom' => 'WhereValueAddressInfo',
],
],
[
@ -204,7 +204,7 @@ class Order
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueTakeInfo',
'where_value_custom' => 'WhereValueTakeInfo',
],
],
[

View File

@ -56,7 +56,7 @@ class Orderaftersale
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereBaseGoodsInfo',
'where_value_custom' => 'WhereBaseGoodsInfo',
'placeholder' => '请输入订单号/商品名称/型号',
],
],
@ -70,7 +70,7 @@ class Orderaftersale
'form_name' => 'user_id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueUserInfo',
'where_value_custom' => 'WhereValueUserInfo',
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],

View File

@ -57,7 +57,7 @@ class Paylog
'form_name' => 'user_id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueUserInfo',
'where_value_custom' => 'WhereValueUserInfo',
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],
@ -142,7 +142,7 @@ class Paylog
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueBusinessInfo',
'where_value_custom' => 'WhereValueBusinessInfo',
],
],
[

View File

@ -56,7 +56,7 @@ class Refundlog
'form_name' => 'user_id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueUserInfo',
'where_value_custom' => 'WhereValueUserInfo',
'placeholder' => '请输入用户名/昵称/手机/邮箱',
],
],

View File

@ -70,7 +70,7 @@ class Warehousegoods
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereGoodsInfo',
'where_value_custom' => 'WhereGoodsInfo',
'placeholder' => '请输入商品名称/型号',
],
],

View File

@ -139,7 +139,8 @@ class Orderaftersale extends Common
// 编辑器文件存放地址
$this->assign('editor_path_type', 'order_aftersale-'.$this->user['id'].'-'.$order_id.'-'.$order_detail_id);
$this->assign('form_search_keywords_name', 'fp0');
// 订单售后搜索form key
$this->assign('form_search_keywords_form_key', 'f0p');
$this->assign('params', $this->data_request);
return $this->fetch();
} else {

View File

@ -138,6 +138,10 @@ class User extends Common
$data = GoodsBrowseService::GoodsBrowseList($browse_params);
$this->assign('goods_browse_list', $data['data']);
// 订单页面订单状态form key
$this->assign('form_search_order_status_form_key', 'f2p');
$this->assign('form_search_order_user_is_comments_form_key', 'f21p');
// 钩子
$this->PluginsHook();

View File

@ -90,7 +90,7 @@ class Order
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereBaseGoodsInfo',
'where_value_custom' => 'WhereBaseGoodsInfo',
'placeholder' => '请输入订单号/商品名称/型号',
],
],
@ -190,7 +190,7 @@ class Order
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueAddressInfo',
'where_value_custom' => 'WhereValueAddressInfo',
],
],
[
@ -203,7 +203,7 @@ class Order
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereValueTakeInfo',
'where_value_custom' => 'WhereValueTakeInfo',
],
],
[
@ -306,6 +306,22 @@ class Order
'where_type' => 'like',
],
],
[
'label' => '是否评价',
'view_type' => 'module',
'view_key' => 'order/module/is_comments',
'search_config' => [
'form_type' => 'select',
'where_type' => 'in',
'form_name' => 'user_is_comments',
'data' => lang('common_is_text_list'),
'data_key' => 'id',
'data_name' => 'name',
'where_type_custom' => 'WhereTypyUserIsComments',
'where_value_custom' => 'WhereValueUserIsComments',
'is_multiple' => 1,
],
],
[
'label' => '确认时间',
'view_type' => 'field',
@ -381,6 +397,40 @@ class Order
];
}
/**
* 取货码条件处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-08
* @desc description
* @param [string] $form_key [表单数据key]
* @param [array] $params [输入参数]
*/
public function WhereTypyUserIsComments($form_key, $params)
{
if(isset($params[$form_key]))
{
return ($params[$form_key] == 0) ? '=' : '>';
}
return null;
}
/**
* 取货码条件处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-08
* @desc description
* @param [string] $form_key [表单数据key]
* @param [array] $params [输入参数]
*/
public function WhereValueUserIsComments($value, $params = [])
{
return (count($value) == 2) ? null : 0;
}
/**
* 取货码条件处理
* @author Devil

View File

@ -73,7 +73,7 @@ class Orderaftersale
'form_name' => 'id',
'where_type' => 'like',
'where_type_custom' => 'in',
'where_handle_custom' => 'WhereBaseGoodsInfo',
'where_value_custom' => 'WhereBaseGoodsInfo',
'placeholder' => '请输入订单号/商品名称/型号',
],
],

View File

@ -0,0 +1,2 @@
<!-- 是否评价 -->
{{if !empty($module_data) and isset($module_data['user_is_comments']) and $module_data['user_is_comments'] gt 1}}已{{else /}}未{{/if}}评价

View File

@ -112,7 +112,7 @@
<!-- 拒绝/关闭 -->
{{if isset($new_aftersale_data['status']) and $new_aftersale_data['status'] eq 5}}
<div class="am-alert am-alert-warning">
{{$new_aftersale_data.tips_msg}}<a href="{{:MyUrl('index/orderaftersale/index', [$form_search_keywords_name=>$new_aftersale_data['order_no']])}}">查看售后订单</a>
{{$new_aftersale_data.tips_msg}}<a href="{{:MyUrl('index/orderaftersale/index', [$form_search_keywords_form_key=>$new_aftersale_data['order_no']])}}">查看售后订单</a>
</div>
{{/if}}
@ -149,7 +149,7 @@
{{case 0|1|2}}
{{if $new_aftersale_data['status'] eq 1 and $new_aftersale_data['type'] eq 1}}
<div class="am-alert">
{{$new_aftersale_data.tips_msg}}<a href="{{:MyUrl('index/orderaftersale/index', [$form_search_keywords_name=>$new_aftersale_data['order_no']])}}">查看售后订单</a>
{{$new_aftersale_data.tips_msg}}<a href="{{:MyUrl('index/orderaftersale/index', [$form_search_keywords_form_key=>$new_aftersale_data['order_no']])}}">查看售后订单</a>
<button type="button" class="am-btn am-btn-primary am-radius am-margin-left-sm orderaftersale-delivery-submit" data-am-modal="{target: '#popup-orderaftersale-delivery'}" data-is-auto-delivery="{{if isset($params['isautodelivery'])}}{{$params.isautodelivery}}{{else /}}0{{/if}}">立即退货</button>
</div>
<div class="am-alert am-alert-warning">
@ -159,14 +159,14 @@
{{include file="orderaftersale/delivery" /}}
{{else /}}
<div class="am-alert">
{{$new_aftersale_data.tips_msg}}<a href="{{:MyUrl('index/orderaftersale/index', [$form_search_keywords_name=>$new_aftersale_data['order_no']])}}">查看售后订单</a>
{{$new_aftersale_data.tips_msg}}<a href="{{:MyUrl('index/orderaftersale/index', [$form_search_keywords_form_key=>$new_aftersale_data['order_no']])}}">查看售后订单</a>
</div>
{{/if}}
{{/case}}
{{case 3|4}}
<div class="am-alert {{if $new_aftersale_data['status'] eq 3}} am-alert-success{{else /}} am-alert-danger{{/if}}">
{{$new_aftersale_data.tips_msg}}<a href="{{:MyUrl('index/orderaftersale/index', [$form_search_keywords_name=>$new_aftersale_data['order_no']])}}">查看售后订单</a>
{{$new_aftersale_data.tips_msg}}<a href="{{:MyUrl('index/orderaftersale/index', [$form_search_keywords_form_key=>$new_aftersale_data['order_no']])}}">查看售后订单</a>
</div>
{{/case}}
{{/switch}}

View File

@ -107,7 +107,7 @@
{{foreach $user_order_status as $v}}
{{if in_array($v['status'], [1,2,3])}}
<li>
<a href="{{:MyUrl('index/order/index', ['is_more'=>1, 'status'=>$v['status']])}}">
<a href="{{:MyUrl('index/order/index', [$form_search_order_status_form_key=>$v['status']])}}">
<i class="icon-{{$v.status}}"></i>
<p>{{$v.name}}</p>
{{if !empty($v.count)}}
@ -117,7 +117,7 @@
</li>
{{elseif in_array($v['status'], [100]) /}}
<li>
<a href="{{:MyUrl('index/order/index', ['is_more'=>1, 'is_comments'=>0, 'status'=>4])}}">
<a href="{{:MyUrl('index/order/index', [$form_search_order_status_form_key=>4, $form_search_order_user_is_comments_form_key=>0])}}">
<i class="icon-{{$v.status}}"></i>
<p>{{$v.name}}</p>
{{if !empty($v.count)}}

View File

@ -230,7 +230,7 @@ class FormHandleModule
$label = empty($v['label']) ? '' : $v['label'];
// 唯一 formkey
$form_key = 'fp'.$k;
$form_key = 'f'.$k.'p';
$v['form_key'] = $form_key;
// 根据组件类型处理
@ -296,14 +296,16 @@ class FormHandleModule
// 表单字段名称
$name = $v['search_config']['form_name'];
// 条件类型
$type = isset($v['search_config']['where_type']) ? $v['search_config']['where_type'] : $v['search_config']['form_type'];
// 是否自定义条件类型
$type_custom = isset($v['search_config']['where_type_custom']) ? $v['search_config']['where_type_custom'] : $type;
$where_type = isset($v['search_config']['where_type']) ? $v['search_config']['where_type'] : $v['search_config']['form_type'];
// 是否自定义条件处理
$where_custom = isset($v['search_config']['where_type_custom']) ? $v['search_config']['where_type_custom'] : '';
// 条件类型
$where_symbol = $this->WhereSymbolHandle($form_key, $where_custom, $where_type);
// 是否自定义条件处理方法
$handle_custom = isset($v['search_config']['where_handle_custom']) ? $v['search_config']['where_handle_custom'] : '';
$value_custom = isset($v['search_config']['where_value_custom']) ? $v['search_config']['where_value_custom'] : '';
// 根据条件类型处理
switch($type)
switch($where_type)
{
// 单个值
case '=' :
@ -319,16 +321,18 @@ class FormHandleModule
$this->where_params[$form_key] = $value;
// 条件值处理
$value = $this->WhereValueHandle($value, $handle_custom);
// 是否 like 条件
if($type == 'like' && is_string($value))
$value = $this->WhereValueHandle($value, $value_custom);
if($value !== null && $value !== '')
{
$value = '%'.$value.'%';
}
// 是否 like 条件
if($where_type == 'like' && is_string($value))
{
$value = '%'.$value.'%';
}
// 条件
$this->where[] = [$name, $type_custom, $value];
// 条件
$this->where[] = [$name, $where_symbol, $value];
}
}
break;
@ -345,7 +349,20 @@ class FormHandleModule
$this->where_params[$form_key] = $value;
// 条件
$this->where[] = [$name, $type_custom, $this->WhereValueHandle($value, $handle_custom)];
$value = $this->WhereValueHandle($value, $value_custom);
// in条件必须存在值也必须是数组
if($where_symbol == 'in')
{
if(!empty($value) && is_array($value))
{
$this->where[] = [$name, $where_symbol, $value];
}
} else {
if($value !== null && $value !== '')
{
$this->where[] = [$name, $where_symbol, $value];
}
}
}
break;
@ -360,7 +377,11 @@ class FormHandleModule
$this->where_params[$key_min] = $value;
// 条件
$this->where[] = [$name, '>=', $this->WhereValueHandle($value, $handle_custom, ['is_min'=>1])];
$value = $this->WhereValueHandle($value, $value_custom, ['is_min'=>1]);
if($value !== null && $value !== '')
{
$this->where[] = [$name, '>=', $value];
}
}
if(array_key_exists($key_max, $this->out_params) && $this->out_params[$key_max] !== null && $this->out_params[$key_max] !== '')
{
@ -369,7 +390,11 @@ class FormHandleModule
$this->where_params[$key_max] = $value;
// 条件
$this->where[] = [$name, '<=', $this->WhereValueHandle($value, $handle_custom, ['is_end'=>1])];
$value = $this->WhereValueHandle($value, $value_custom, ['is_end'=>1]);
if($value !== null && $value !== '')
{
$this->where[] = [$name, '<=', $value];
}
}
break;
@ -385,7 +410,11 @@ class FormHandleModule
$this->where_params[$key_start] = $value;
// 条件
$this->where[] = [$name, '>=', $this->WhereValueHandle(strtotime($value), $handle_custom, ['is_start'=>1])];
$value = $this->WhereValueHandle(strtotime($value), $value_custom, ['is_start'=>1]);
if($value !== null && $value !== '')
{
$this->where[] = [$name, '>=', $value];
}
}
if(array_key_exists($key_end, $this->out_params) && $this->out_params[$key_end] !== null && $this->out_params[$key_end] !== '')
{
@ -394,8 +423,11 @@ class FormHandleModule
$this->where_params[$key_end] = $value;
// 条件
$this->where[] = [$name, '<=', $this->WhereValueHandle(strtotime($value), $handle_custom, ['is_end'=>1])];
$value = $this->WhereValueHandle(strtotime($value), $value_custom, ['is_end'=>1]);
if($value !== null && $value !== '')
{
$this->where[] = [$name, '<=', $value];
}
}
break;
}
@ -478,6 +510,39 @@ class FormHandleModule
}
}
/**
* 条件符号处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-08-20
* @desc description
* @param [string] $form_key [表单key]
* @param [stribg] $where_custom [自定义条件值]
* @param [stribg] $where_type [条件类型]
*/
public function WhereSymbolHandle($form_key, $where_custom, $where_type)
{
// 是否已定义自定义条件符号
if(!empty($where_custom))
{
// 模块是否自定义条件方法处理条件
if(method_exists($this->module_obj, $where_custom))
{
$value = $this->module_obj->$where_custom($form_key, $this->out_params);
if(!empty($value))
{
return $value;
}
} else {
return $where_custom;
}
}
// 默认条件类型
return $where_type;
}
/**
* 条件值处理
* @author Devil
@ -489,9 +554,9 @@ class FormHandleModule
* @param [string] $action [自定义处理方法名称]
* @param [array] $params [输入参数]
*/
function WhereValueHandle($value, $action = '', $params = [])
public function WhereValueHandle($value, $action = '', $params = [])
{
// 模块是否自定义方法处理条件
// 模块是否自定义条件值方法处理条件
if(!empty($action) && method_exists($this->module_obj, $action))
{
return $this->module_obj->$action($value, $params);
@ -509,7 +574,7 @@ class FormHandleModule
* @date 2020-06-05
* @desc description
*/
function BaseWhereHandle()
public function BaseWhereHandle()
{
// 是否定义基础条件属性
if(property_exists($this->module_obj, 'condition_base') && is_array($this->module_obj->condition_base))