From ca68fd02de8e217f726a29e02b4a1db70ab1013f Mon Sep 17 00:00:00 2001 From: devil_gong Date: Thu, 23 May 2019 17:57:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=94=AE=E5=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common.php | 10 +- application/index/controller/Order.php | 81 +++-- .../index/view/default/order/aftersale.html | 198 ++++++---- ...ersale_form.html => aftersale_create.html} | 2 +- .../default/order/aftersale_delivery.html | 16 + .../view/default/order/aftersale_step.html | 46 ++- .../index/view/default/public/footer.html | 1 + .../index/view/default/public/header.html | 1 + application/plugins/newuserreduction/Hook.php | 5 +- application/plugins/touristbuy/Hook.php | 2 +- application/service/OrderAftersaleService.php | 338 ++++++++++++++++++ config/shopxo.sql | 96 ++--- public/static/common/css/common.css | 6 + .../index/default/css/order.aftersale.css | 2 +- .../static/index/default/css/order.detail.css | 2 +- .../css/touristbuy/index/index.detail.css | 2 +- .../static/plugins/css/wallet/index/cash.css | 1 - 17 files changed, 634 insertions(+), 175 deletions(-) rename application/index/view/default/order/{aftersale_form.html => aftersale_create.html} (94%) create mode 100644 application/index/view/default/order/aftersale_delivery.html create mode 100644 application/service/OrderAftersaleService.php diff --git a/application/common.php b/application/common.php index 0535ce49b..292fb9d54 100755 --- a/application/common.php +++ b/application/common.php @@ -1257,6 +1257,9 @@ function ParamsChecked($data, $params) continue; } + // 数据类型,默认字符串类型 + $data_type = empty($v['data_type']) ? 'string' : $v['data_type']; + // 验证规则,默认isset $checked_type = isset($v['checked_type']) ? $v['checked_type'] : 'isset'; switch($checked_type) @@ -1311,7 +1314,12 @@ function ParamsChecked($data, $params) { return $v['error_msg']; } - $length = mb_strlen($data[$v['key_name']], 'utf-8'); + if($data_type == 'array') + { + $length = count($data[$v['key_name']]); + } else { + $length = mb_strlen($data[$v['key_name']], 'utf-8'); + } $rule = explode(',', $v['checked_data']); if(count($rule) == 1) { diff --git a/application/index/controller/Order.php b/application/index/controller/Order.php index b09f7c7ca..88e712187 100755 --- a/application/index/controller/Order.php +++ b/application/index/controller/Order.php @@ -13,6 +13,7 @@ namespace app\index\controller; use app\service\OrderService; use app\service\PaymentService; use app\service\GoodsCommentsService; +use app\service\OrderAftersaleService; /** * 订单管理 @@ -211,36 +212,13 @@ class Order extends Common { // 参数 $params = input(); - $params['user'] = $this->user; - $params['user_type'] = 'user'; - - // 条件 - $where = OrderService::OrderListWhere($params); - - // 获取列表 - $data_params = array( - 'm' => 0, - 'n' => 1, - 'where' => $where, - ); - $data = OrderService::OrderList($data_params); - if(!empty($data['data'][0])) + $order_id = isset($params['id']) ? intval($params['id']) : 0; + $goods_id = isset($params['gid']) ? intval($params['gid']) : 0; + $ret = OrderAftersaleService::OrdferGoodsRow($order_id, $goods_id, $this->user['id']); + if($ret['code'] == 0) { - // 商品处理 - $goods = []; - if(!empty($data['data'][0]['items'])) - { - foreach($data['data'][0]['items'] as $v) - { - if(isset($params['gid']) && $params['gid'] == $v['goods_id']) - { - $goods = $v; - break; - } - } - } - $this->assign('goods', $goods); - $this->assign('order', $data['data'][0]); + $this->assign('goods', $ret['data']['items']); + $this->assign('order', $ret['data']); // 仅退款原因 $return_only_money_reason = MyC('home_order_aftersale_return_only_money_reason'); @@ -250,14 +228,57 @@ class Order extends Common $return_money_goods_reason = MyC('home_order_aftersale_return_money_goods_reason'); $this->assign('return_money_goods_reason_list', empty($return_money_goods_reason) ? [] : explode("\n", $return_money_goods_reason)); + // 获取当前订单商品售后最新的一条纪录 + $data_params = [ + 'm' => 0, + 'n' => 1, + 'where' => [ + ['order_id', '=', $order_id], + ['goods_id', '=', $goods_id], + ['user_id', '=', $this->user['id']], + ], + ]; + $new_aftersale = OrderAftersaleService::OrderGoodsAftersaleList($data_params); + $this->assign('new_aftersale_data', empty($new_aftersale['data'][0]) ? [] : $new_aftersale['data'][0]); + $this->assign('params', $params); return $this->fetch(); } else { - $this->assign('msg', '没有相关数据'); + $this->assign('msg', $ret['msg']); return $this->fetch('public/tips_error'); } } + /** + * 申请售后创建 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-05-23 + * @desc description + */ + public function AftersaleCreate() + { + $params = input(); + $params['user'] = $this->user; + return OrderAftersaleService::AftersaleCreate($params); + } + + /** + * 申请售后-用户发货 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-05-23 + * @desc description + */ + public function AftersaleDelivery() + { + $params = input(); + $params['user'] = $this->user; + return OrderAftersaleService::AftersaleDelivery($params); + } + /** * 订单支付 * @author Devil diff --git a/application/index/view/default/order/aftersale.html b/application/index/view/default/order/aftersale.html index e4777c875..688ce1522 100644 --- a/application/index/view/default/order/aftersale.html +++ b/application/index/view/default/order/aftersale.html @@ -22,83 +22,101 @@
- {{if true }} - - {{if !empty($goods)}} -
-
- - - - - - - - - - + + + +
商品信息单价
-
- - - -
- {{$goods.title}} - {{if !empty($goods.spec)}} -
    - {{foreach $goods.spec as $spec}} -
  • {{$spec.type}}:{{$spec.value}}
  • - {{/foreach}} -
- {{/if}} -
+ + {{if !empty($goods)}} +
+
+ + + + + + + + + + - - - -
商品信息单价
+
+ + + +
+ {{$goods.title}} + {{if !empty($goods.spec)}} +
    + {{foreach $goods.spec as $spec}} +
  • {{$spec.type}}:{{$spec.value}}
  • + {{/foreach}} +
+ {{/if}}
-
- {{if $goods['original_price'] gt 0}} -

¥{{$goods.original_price}}

- {{/if}} -

¥{{$goods.price}} x {{$goods.buy_number}}

-
- -
- {{if !empty($order.price)}} -
-
商品总价:
-
¥{{$order.price}}
-
- {{/if}} - {{if !empty($order.increase_price)}} -
-
增加金额:
-
+¥{{$order.increase_price}}
-
- {{/if}} - {{if !empty($order.preferential_price)}} -
-
优惠金额:
-
-¥{{$order.preferential_price}}
-
- {{/if}} - {{if !empty($order.total_price)}} -
-
订单总价:
-
¥{{$order.total_price}}
-
- {{/if}} - {{if !empty($order.pay_price)}} -
-
支付金额:
-
- ¥{{$order.pay_price}}
+
+ {{if $goods['original_price'] gt 0}} +

¥{{$goods.original_price}}

+ {{/if}} +

¥{{$goods.price}} x {{$goods.buy_number}}

+
+ +
+ {{if !empty($order.price)}} +
+
商品总价:
+
¥{{$order.price}}
+
+ {{/if}} + {{if !empty($order.increase_price)}} +
+
增加金额:
+
+¥{{$order.increase_price}}
+
+ {{/if}} + {{if !empty($order.preferential_price)}} +
+
优惠金额:
+
-¥{{$order.preferential_price}}
+
+ {{/if}} + {{if !empty($order.total_price)}} +
+
订单总价:
+
¥{{$order.total_price}}
+
+ {{/if}} + {{if !empty($order.pay_price)}} +
+
支付金额:
+
+ ¥{{$order.pay_price}}
- {{/if}} -
+
+ {{/if}}
+
+ + + {{if empty($new_aftersale_data) or (isset($new_aftersale_data['status']) and in_array($new_aftersale_data['status'], [4,5]))}} + + {{if isset($new_aftersale_data['status']) and in_array($new_aftersale_data['status'], [3,4])}} + {{switch $new_aftersale_data.status}} + {{case 4}} +
+ 当前订单商品售后申请已被拒绝!详情查看 +
+ {{/case}} + + {{case 5}} +
+ 当前订单商品售后申请已关闭!详情查看 +
+ {{/case}} + {{/switch}} + {{/if}}
@@ -128,12 +146,42 @@
- {{include file="order/aftersale_form" /}} + {{include file="order/aftersale_create" /}}
+ {{else /}} + + {{include file="order/aftersale_step" /}} + + + {{switch $new_aftersale_data.status}} + {{case 0}} +
+ 当前订单商品售后已提交申请,等待管理员确认中!详情查看 +
+ {{/case}} + + {{case 1}} +
+
+ {{include file="order/aftersale_delivery" /}} +
+
+ {{/case}} + + {{case 2}} +
+ 当前订单商品售后已退货,等待管理员审核中!详情查看 +
+ {{/case}} + + {{case 3}} +
+ 当前订单商品售后已处理结束!详情查看 +
+ {{/case}} + {{/switch}} {{/if}} - {{else /}} -
你已进行过评论
{{/if}}
diff --git a/application/index/view/default/order/aftersale_form.html b/application/index/view/default/order/aftersale_create.html similarity index 94% rename from application/index/view/default/order/aftersale_form.html rename to application/index/view/default/order/aftersale_create.html index f6f094678..b2e59ad77 100644 --- a/application/index/view/default/order/aftersale_form.html +++ b/application/index/view/default/order/aftersale_create.html @@ -1,4 +1,4 @@ -
+
+
+ +
+ + +
+ +
+ + +
+
\ No newline at end of file diff --git a/application/index/view/default/order/aftersale_step.html b/application/index/view/default/order/aftersale_step.html index 88751bb37..0b90567bf 100644 --- a/application/index/view/default/order/aftersale_step.html +++ b/application/index/view/default/order/aftersale_step.html @@ -1,43 +1,57 @@ -