From c73b204f34f7c8767aaecd73dd33f0cb5d995b92 Mon Sep 17 00:00:00 2001 From: devil Date: Mon, 20 Jul 2020 22:38:53 +0800 Subject: [PATCH] =?UTF-8?q?=20=E4=B8=8B=E5=8D=95=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=88=86=E7=BB=84=E5=95=86=E5=93=81=E6=89=A9=E5=B1=95=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/Buy.php | 6 +- application/index/view/default/buy/index.html | 78 +++++++++++++++---- application/service/BuyService.php | 21 +---- application/service/OrderSplitService.php | 46 +++++++---- public/static/index/default/css/buy.css | 6 +- 5 files changed, 98 insertions(+), 59 deletions(-) diff --git a/application/index/controller/Buy.php b/application/index/controller/Buy.php index 24bd1a8ea..e3cd8a2b1 100755 --- a/application/index/controller/Buy.php +++ b/application/index/controller/Buy.php @@ -81,7 +81,6 @@ class Buy extends Common // 基础信息 $buy_base = $buy_ret['data']['base']; $buy_goods = $buy_ret['data']['goods']; - $buy_extension_data = $buy_ret['data']['extension_data']; // 用户地址 $address = UserService::UserAddressList(['user'=>$this->user]); @@ -104,7 +103,6 @@ class Buy extends Common // 页面数据 $this->assign('base', $buy_base); $this->assign('buy_goods', $buy_goods); - $this->assign('extension_data', $buy_extension_data); $this->assign('params', $params); // 加载百度地图api @@ -173,8 +171,8 @@ class Buy extends Common 'params' => $params, ])); - // 订单确认页面商品底部钩子 - $hook_name = 'plugins_view_buy_goods_bottom'; + // 订单确认页面分组商品底部钩子 + $hook_name = 'plugins_view_buy_group_goods_bottom'; $this->assign($hook_name.'_data', Hook::listen($hook_name, [ 'hook_name' => $hook_name, diff --git a/application/index/view/default/buy/index.html b/application/index/view/default/buy/index.html index c47ea739c..586aacce3 100755 --- a/application/index/view/default/buy/index.html +++ b/application/index/view/default/buy/index.html @@ -273,6 +273,27 @@ {{/if}}
+ + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ plugins_view_buy_group_goods_inside_top +
+ {{/if}} + {{php}} + $hook_name = 'plugins_view_buy_group_goods_inside_top'; + $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'data'=>$v]); + if(!empty($hook_data) && is_array($hook_data)) + { + foreach($hook_data as $hook) + { + if(is_string($hook) || is_int($hook)) + { + echo htmlspecialchars_decode($hook); + } + } + } + {{/php}} + {{if !empty($v['goods_items'])}} @@ -331,8 +352,43 @@
没有商品
{{/if}} - +
+ + + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}} +
+ plugins_view_buy_group_goods_inside_bottom +
+ {{/if}} + {{php}} + $hook_name = 'plugins_view_buy_group_goods_inside_bottom'; + $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'data'=>$v]); + if(!empty($hook_data) && is_array($hook_data)) + { + foreach($hook_data as $hook) + { + if(is_string($hook) || is_int($hook)) + { + echo htmlspecialchars_decode($hook); + } + } + } + {{/php}} + + + {{if !empty($v['extension_data'])}} + + {{/if}} + +

合计 {{$price_symbol}}{{$v.items_total_price}} @@ -347,14 +403,14 @@ {{/if}}

- + {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
- plugins_view_buy_goods_bottom + plugins_view_buy_group_goods_bottom
{{/if}} - {{if !empty($plugins_view_buy_goods_bottom_data) and is_array($plugins_view_buy_goods_bottom_data)}} - {{foreach $plugins_view_buy_goods_bottom_data as $hook}} + {{if !empty($plugins_view_buy_group_goods_bottom_data) and is_array($plugins_view_buy_group_goods_bottom_data)}} + {{foreach $plugins_view_buy_group_goods_bottom_data as $hook}} {{if is_string($hook) or is_int($hook)}} {{$hook|raw}} {{/if}} @@ -383,18 +439,6 @@ {{/foreach}} {{/if}} - - {{if !empty($extension_data)}} - - {{/if}} - {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
diff --git a/application/service/BuyService.php b/application/service/BuyService.php index b7cafc931..9b147694e 100755 --- a/application/service/BuyService.php +++ b/application/service/BuyService.php @@ -712,7 +712,7 @@ class BuyService } // 订单拆分 - $order_split = OrderSplitService::Run(['goods'=>$goods]); + $order_split = OrderSplitService::Run(['goods'=>$goods, 'params'=>$params]); if($order_split['code'] != 0) { return $order_split; @@ -755,29 +755,10 @@ class BuyService 'common_site_type' => $common_site_type, ]; - // 扩展展示数据 - // name 名称 - // price 金额 - // type 类型(0减少, 1增加) - // tips 提示信息 - // business 业务类型(内容格式不限) - // ext 扩展数据(内容格式不限) - $extension_data = [ - // [ - // 'name' => '感恩节9折', - // 'price' => 23, - // 'type' => 0, - // 'tips' => '-¥23元', - // 'business' => null, - // 'ext' => null, - // ], - ]; - // 返回数据 $result = [ 'goods' => $order_split['data'], 'base' => $base, - 'extension_data' => $extension_data, ]; // 生成订单数据处理钩子 diff --git a/application/service/OrderSplitService.php b/application/service/OrderSplitService.php index 94dcd4d7c..42ea0b116 100644 --- a/application/service/OrderSplitService.php +++ b/application/service/OrderSplitService.php @@ -54,8 +54,8 @@ class OrderSplitService } // 商品仓库集合 - $warehouse_goods = self::GoodsWarehouseAggregate($params['goods']); - return DataReturn('操作成功', 0, $warehouse_goods); + $data = self::GoodsWarehouseAggregate($params['goods']); + return DataReturn('操作成功', 0, $data); } /** @@ -69,21 +69,30 @@ class OrderSplitService */ public static function GoodsWarehouseAggregate($data) { + // 仓库组扩展展示数据 + // name 名称 + // price 金额 + // type 类型(0减少, 1增加) + // tips 提示信息 + // business 业务类型(内容格式不限) + // ext 扩展数据(内容格式不限) + // $extension_data = [ + // [ + // 'name' => '感恩节9折', + // 'price' => 23, + // 'type' => 0, + // 'tips' => '-¥23元', + // 'business' => null, + // 'ext' => null, + // ], + // ]; + + // 数据分组 $result = []; foreach($data as $v) { // 不存在规格则使用默认 - if(empty($v['spec'])) - { - $spec = [ - [ - 'type' => '默认规格', - 'value' => 'default', - ] - ]; - } else { - $spec = $v['spec']; - } + $spec = empty($v['spec']) ? [['type' => '默认规格','value' => 'default']] : $v['spec']; // 获取商品库存 $where = [ @@ -128,6 +137,16 @@ class OrderSplitService // 仓库 $warehouse_handle = WarehouseService::DataHandle([$w]); $result[$w['id']] = $warehouse_handle[0]; + $result[$w['id']]['extension_data'] = [ + [ + 'name' => '感恩节9折', + 'price' => 23, + 'type' => 0, + 'tips' => '-¥23元', + 'business' => null, + 'ext' => null, + ], + ]; $result[$w['id']]['goods_items'] = []; unset($result[$w['id']]['is_default'], $result[$w['id']]['level'], $result[$w['id']]['inventory']); @@ -159,6 +178,7 @@ class OrderSplitService // 仓库 $warehouse_handle = WarehouseService::DataHandle([$warehouse_default]); $result[$warehouse_default['id']] = $warehouse_handle[0]; + $result[$warehouse_default['id']]['extension_data'] = []; $result[$warehouse_default['id']]['goods_items'] = []; // 订单基础信息 diff --git a/public/static/index/default/css/buy.css b/public/static/index/default/css/buy.css index c5cc1ed8b..092f320ad 100755 --- a/public/static/index/default/css/buy.css +++ b/public/static/index/default/css/buy.css @@ -60,10 +60,9 @@ ul.address-list, .business-item ul { overflow: hidden; } .nav-buy .btn-go.am-disabled { background-color: #efa4af; } /* 扩展数据 */ -.buy-extension-data { background: #ffffeb; border: 1px solid #ffe2cf; margin-top: 10px; padding: 5px 10px; margin: 10px 5px 0 5px; } +.buy-extension-data { background: #ffffeb; border: 1px solid #ffe2cf; } .buy-extension-data li { padding: 5px 0; } .buy-extension-data li:not(:last-child) { border-bottom: 1px dashed #ffe2cf; } -.buy-extension-data .extension-items-name { } .buy-extension-data .extension-items-tips { color: #ff8f44; } /** @@ -138,9 +137,6 @@ ul.address-list, .business-item ul { overflow: hidden; } .business-item ul li:nth-child(4n) { margin-right: 10px; } .business-item ul { padding: 10px 1px 0 1px; } .link-list h3 { padding: 0 0 5px 0; } - - /*扩展数据*/ - .buy-extension-data { margin: 10px 0 0 0; } } @media only screen and (max-width:640px) {