From 4975d1e68f378623bc9bf7e06ca8f6ec24888d79 Mon Sep 17 00:00:00 2001 From: devil Date: Mon, 8 Jun 2020 17:31:16 +0800 Subject: [PATCH] =?UTF-8?q?=20=E8=AE=A2=E5=8D=95=E5=94=AE=E5=90=8E?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/Orderaftersale.php | 80 ++- application/admin/form/Order.php | 1 - application/admin/form/Orderaftersale.php | 301 +++++++++++ .../admin/view/default/order/index.html | 110 +++- .../view/default/orderaftersale/detail.html | 42 +- .../view/default/orderaftersale/index.html | 491 ++++-------------- .../default/orderaftersale/module/info.html | 24 + .../orderaftersale/module/operate.html | 35 ++ .../default/orderaftersale/module/user.html | 14 + .../orderaftersale/module/voucher.html | 14 + application/service/OrderAftersaleService.php | 2 +- public/static/admin/default/css/order.css | 9 - .../admin/default/css/orderaftersale.css | 28 - 13 files changed, 646 insertions(+), 505 deletions(-) create mode 100644 application/admin/form/Orderaftersale.php create mode 100644 application/admin/view/default/orderaftersale/module/info.html create mode 100644 application/admin/view/default/orderaftersale/module/operate.html create mode 100644 application/admin/view/default/orderaftersale/module/user.html create mode 100644 application/admin/view/default/orderaftersale/module/voucher.html diff --git a/application/admin/controller/Orderaftersale.php b/application/admin/controller/Orderaftersale.php index 081e12d1c..183f92e42 100644 --- a/application/admin/controller/Orderaftersale.php +++ b/application/admin/controller/Orderaftersale.php @@ -52,47 +52,35 @@ class Orderaftersale extends Common */ public function Index() { - // 参数 - $params = input(); - $params['user_type'] = 'admin'; - - // 分页 - $number = MyC('admin_page_number', 10, true); - - // 条件 - $where = OrderAftersaleService::OrderAftersaleListWhere($params); - - // 获取总数 - $total = OrderAftersaleService::OrderAftersaleTotal($where); + // 总数 + $total = OrderAftersaleService::OrderAftersaleTotal($this->form_where); // 分页 $page_params = array( - 'number' => $number, + 'number' => $this->page_size, 'total' => $total, - 'where' => $params, - 'page' => isset($params['page']) ? intval($params['page']) : 1, + 'where' => $this->data_request, + 'page' => $this->page, 'url' => MyUrl('admin/orderaftersale/index'), ); $page = new \base\Page($page_params); - $this->assign('page_html', $page->GetPageHtml()); - // 获取列表 - $data_params = array( - 'm' => $page->GetPageStarNumber(), - 'n' => $number, - 'where' => $where, - 'is_public' => 0, - ); - $data = OrderAftersaleService::OrderAftersaleList($data_params); - $this->assign('data_list', $data['data']); + // 获取数据列表 + $data_params = [ + 'where' => $this->form_where, + 'm' => $page->GetPageStarNumber(), + 'n' => $this->page_size, + 'is_public' => 0, + ]; + $ret = OrderAftersaleService::OrderAftersaleList($data_params); // 静态数据 - $this->assign('common_order_aftersale_type_list', lang('common_order_aftersale_type_list')); - $this->assign('common_order_aftersale_status_list', lang('common_order_aftersale_status_list')); $this->assign('common_order_aftersale_refundment_list', lang('common_order_aftersale_refundment_list')); // 参数 - $this->assign('params', $params); + $this->assign('params', $this->data_request); + $this->assign('page_html', $page->GetPageHtml()); + $this->assign('data_list', $ret['data']); return $this->fetch(); } @@ -105,26 +93,24 @@ class Orderaftersale extends Common */ public function Detail() { - // 参数 - $params = input(); - $params['user_type'] = 'admin'; + if(!empty($this->data_request['id'])) + { + // 条件 + $where = [ + ['id', '=', intval($this->data_request['id'])], + ]; - // 条件 - $where = OrderAftersaleService::OrderAftersaleListWhere($params); - - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => $where, - 'is_public' => 0, - ); - $ret = OrderAftersaleService::OrderAftersaleList($data_params); - $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; - $this->assign('data', $data); - - // 参数 - $this->assign('params', $params); + // 获取列表 + $data_params = array( + 'm' => 0, + 'n' => 1, + 'where' => $where, + 'is_public' => 0, + ); + $ret = OrderAftersaleService::OrderAftersaleList($data_params); + $data = (empty($ret['data']) || empty($ret['data'][0])) ? [] : $ret['data'][0]; + $this->assign('data', $data); + } return $this->fetch(); } diff --git a/application/admin/form/Order.php b/application/admin/form/Order.php index a61ed8147..b4f1c40c5 100644 --- a/application/admin/form/Order.php +++ b/application/admin/form/Order.php @@ -44,7 +44,6 @@ class Order // 基础配置 'base' => [ 'key_field' => 'id', - 'status_field' => 'is_shelves', 'is_search' => 1, 'search_url' => MyUrl('admin/order/index'), ], diff --git a/application/admin/form/Orderaftersale.php b/application/admin/form/Orderaftersale.php new file mode 100644 index 000000000..e86c4f04b --- /dev/null +++ b/application/admin/form/Orderaftersale.php @@ -0,0 +1,301 @@ + [ + 'key_field' => 'id', + 'is_search' => 1, + 'search_url' => MyUrl('admin/orderaftersale/index'), + ], + // 表单配置 + 'form' => [ + [ + 'label' => '订单号', + 'view_type' => 'field', + 'view_key' => 'order_no', + 'width' => 170, + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => '=', + ], + ], + [ + 'label' => '基础信息', + 'view_type' => 'module', + 'view_key' => 'orderaftersale/module/info', + 'grid_size' => 'lg', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'id', + 'where_type' => 'like', + 'where_type_custom' => 'in', + 'where_handle_custom' => 'WhereValueBaseInfo', + 'placeholder' => '请输入商品名称/型号', + ], + ], + [ + 'label' => '用户信息', + 'view_type' => 'module', + 'view_key' => 'orderaftersale/module/user', + 'grid_size' => 'sm', + 'search_config' => [ + 'form_type' => 'input', + 'form_name' => 'user_id', + 'where_type' => 'like', + 'where_type_custom' => 'in', + 'where_handle_custom' => 'WhereValueUserInfo', + 'placeholder' => '请输入用户名/昵称/手机/邮箱', + ], + ], + [ + 'label' => '状态', + 'view_type' => 'field', + 'view_key' => 'status_text', + 'width' => 120, + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'status', + 'where_type' => 'in', + 'data' => lang('common_order_aftersale_status_list'), + 'data_key' => 'value', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '申请类型', + 'view_type' => 'field', + 'view_key' => 'type_text', + 'width' => 120, + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'type', + 'where_type' => 'in', + 'data' => lang('common_order_aftersale_type_list'), + 'data_key' => 'value', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '原因', + 'view_type' => 'field', + 'view_key' => 'reason', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '退款金额(元)', + 'view_type' => 'field', + 'view_key' => 'price', + 'search_config' => [ + 'form_type' => 'section', + 'is_point' => 1, + ], + ], + [ + 'label' => '退货数量', + 'view_type' => 'field', + 'view_key' => 'number', + 'search_config' => [ + 'form_type' => 'section', + ], + ], + [ + 'label' => '退款说明', + 'view_type' => 'field', + 'view_key' => 'msg', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '退款类型', + 'view_type' => 'field', + 'view_key' => 'refundment_text', + 'width' => 120, + 'search_config' => [ + 'form_type' => 'select', + 'form_name' => 'refundment', + 'where_type' => 'in', + 'data' => lang('common_order_aftersale_refundment_list'), + 'data_key' => 'value', + 'data_name' => 'name', + 'is_multiple' => 1, + ], + ], + [ + 'label' => '凭证', + 'view_type' => 'module', + 'view_key' => 'orderaftersale/module/voucher', + 'width' => 140, + ], + [ + 'label' => '快递公司', + 'view_type' => 'field', + 'view_key' => 'express_name', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '快递单号', + 'view_type' => 'field', + 'view_key' => 'express_number', + 'search_config' => [ + 'form_type' => 'input', + 'where_type' => 'like', + ], + ], + [ + 'label' => '申请时间', + 'view_type' => 'field', + 'view_key' => 'apply_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'apply_time', + ], + ], + [ + 'label' => '确认时间', + 'view_type' => 'field', + 'view_key' => 'confirm_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'confirm_time', + ], + ], + [ + 'label' => '退货时间', + 'view_type' => 'field', + 'view_key' => 'delivery_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'delivery_time', + ], + ], + [ + 'label' => '审核时间', + 'view_type' => 'field', + 'view_key' => 'audit_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'audit_time', + ], + ], + [ + 'label' => '创建时间', + 'view_type' => 'field', + 'view_key' => 'add_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'add_time', + ], + ], + [ + 'label' => '更新时间', + 'view_type' => 'field', + 'view_key' => 'upd_time_time', + 'search_config' => [ + 'form_type' => 'datetime', + 'form_name' => 'upd_time', + ], + ], + [ + 'label' => '操作', + 'view_type' => 'operate', + 'view_key' => 'orderaftersale/module/operate', + 'align' => 'center', + 'fixed' => 'right', + ], + ], + ]; + } + + /** + * 用户信息条件处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-08 + * @desc description + * @param [string] $value [条件值] + * @param [array] $params [输入参数] + */ + public function WhereValueUserInfo($value, $params = []) + { + if(!empty($value)) + { + // 获取用户 id + $ids = Db::name('User')->where('username|nickname|mobile|email', 'like', '%'.$value.'%')->column('id'); + + // 避免空条件造成无效的错觉 + return empty($ids) ? [0] : $ids; + } + return $value; + } + + /** + * 基础信息条件处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-06-08 + * @desc description + * @param [string] $value [条件值] + * @param [array] $params [输入参数] + */ + public function WhereValueBaseInfo($value, $params = []) + { + if(!empty($value)) + { + // 获取订单详情搜索的订单售后 id + $ids = Db::name('OrderAftersale')->alias('oa')->join(['__ORDER_DETAIL__'=>'od'], 'oa.order_detail_id=od.id')->where('title|model', 'like', '%'.$value.'%')->column('oa.id'); + + // 避免空条件造成无效的错觉 + return empty($ids) ? [0] : $ids; + } + return $value; + } +} +?> \ No newline at end of file diff --git a/application/admin/view/default/order/index.html b/application/admin/view/default/order/index.html index 907d6eab9..e8609b8a3 100755 --- a/application/admin/view/default/order/index.html +++ b/application/admin/view/default/order/index.html @@ -1,2 +1,110 @@ -{{extend name="public/module/form" /}} \ No newline at end of file +{{extend name="public/module/form" /}} + + +{{block name="form_extend"}} + +
+
+
+ × +
+
+
+
+ + +
+
+ + + +
+
+
+
+
+ + +
+
+
+

发货操作

+ × +
+
+
+
+ {{if !empty($express_list)}} +
    + {{foreach $express_list as $express}} + {{if $express.is_enable eq 1}} +
  • + {{if !empty($express.icon)}} + + {{/if}} + {{$express.name}} + +
  • + {{/if}} + {{/foreach}} +
+ {{/if}} + {{if empty($express_list)}} +
没有快递方式
+ {{/if}} +
+ +
+ + +
+ +
+ + + + +
+
+
+
+
+ + +
+
+
+

支付操作

+ × +
+
+
+
+ {{if !empty($buy_payment_list)}} +
    + {{foreach $buy_payment_list as $payment}} +
  • + {{if !empty($payment.logo)}} + + {{/if}} + {{$payment.name}} + +
  • + {{/foreach}} +
+ {{/if}} + {{if empty($buy_payment_list)}} +
没有支付方式
+ {{/if}} +
+
+ + + +
+
+
+
+
+{{/block}} \ No newline at end of file diff --git a/application/admin/view/default/orderaftersale/detail.html b/application/admin/view/default/orderaftersale/detail.html index 7a76ba02e..fa7dab486 100644 --- a/application/admin/view/default/orderaftersale/detail.html +++ b/application/admin/view/default/orderaftersale/detail.html @@ -1,17 +1,18 @@ -{{include file="public/header" /}} + +{{extend name="public/module/detail" /}} - -
- {{if !empty($data)}} + +{{if !empty($data)}} + {{block name="detail_data"}}
商品信息
-
+
- + -
- {{$data.order_data.items.title}} +
+ {{$data.order_data.items.title}} {{if !empty($data.order_data.items.spec)}}
    {{foreach $data.order_data.items.spec as $spec}} @@ -21,16 +22,18 @@ {{/if}}
- {{if $data.order_data.items.original_price gt 0}} -

{{$price_symbol}}{{$data.order_data.items.original_price}}

- {{/if}} -

{{$price_symbol}}{{$data.order_data.items.price}} x {{$data.order_data.items.buy_number}}

+
+ {{if $data.order_data.items.original_price gt 0}} + {{$price_symbol}}{{$data.order_data.items.original_price}} + {{/if}} + {{$price_symbol}}{{$data.order_data.items.price}} x {{$data.order_data.items.buy_number}} +
用户信息
- {{else /}} -
没有相关数据
- {{/if}} -
- - - -{{include file="public/footer" /}} - \ No newline at end of file + {{/block}} +{{/if}} \ No newline at end of file diff --git a/application/admin/view/default/orderaftersale/index.html b/application/admin/view/default/orderaftersale/index.html index 14fd899ec..d2da26bac 100644 --- a/application/admin/view/default/orderaftersale/index.html +++ b/application/admin/view/default/orderaftersale/index.html @@ -1,402 +1,103 @@ -{{include file="public/header" /}} + +{{extend name="public/module/form" /}} - -
-
- -