Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
starsw001
ShopXO
提交
c73b204f
ShopXO
项目概览
starsw001
/
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,体验更适合开发者的 AI 搜索 >>
提交
c73b204f
编写于
7月 20, 2020
作者:
D
devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
下单页面分组商品扩展数据处理
上级
7b2ef0ed
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
98 addition
and
59 deletion
+98
-59
application/index/controller/Buy.php
application/index/controller/Buy.php
+2
-4
application/index/view/default/buy/index.html
application/index/view/default/buy/index.html
+61
-17
application/service/BuyService.php
application/service/BuyService.php
+1
-20
application/service/OrderSplitService.php
application/service/OrderSplitService.php
+33
-13
public/static/index/default/css/buy.css
public/static/index/default/css/buy.css
+1
-5
未找到文件。
application/index/controller/Buy.php
浏览文件 @
c73b204f
...
...
@@ -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_g
roup_g
oods_bottom'
;
$this
->
assign
(
$hook_name
.
'_data'
,
Hook
::
listen
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
...
...
application/index/view/default/buy/index.html
浏览文件 @
c73b204f
...
...
@@ -273,6 +273,27 @@
{{/if}}
</div>
<div
class=
"am-panel-bd"
>
<!-- 分组商品顶部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div
class=
"plugins-tag"
>
<span>
plugins_view_buy_group_goods_inside_top
</span>
</div>
{{/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'])}}
<table
class=
"am-table"
>
...
...
@@ -331,8 +352,43 @@
<div
class=
"table-no"
><i
class=
"am-icon-warning"
></i>
没有商品
</div>
{{/if}}
<!--
含运费小计
-->
<!--
商品分割线
-->
<hr
data-am-widget=
"divider"
class=
"am-divider am-divider-dashed"
/>
<!-- 分组商品底部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div
class=
"plugins-tag"
>
<span>
plugins_view_buy_group_goods_inside_bottom
</span>
</div>
{{/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'])}}
<ul
class=
"buy-extension-data am-padding-xs am-margin-bottom-sm"
>
{{foreach $v['extension_data'] as $ext}}
<li>
<span
class=
"extension-items-name"
>
{{$ext.name}}
</span>
<span
class=
"am-fr extension-items-tips"
>
{{$ext.tips}}
</span>
</li>
{{/foreach}}
</ul>
{{/if}}
<!-- 含运费小计 -->
<div
class=
"buy-point-discharge am-text-right"
>
<p>
合计
<span
class=
"price"
><strong>
{{$price_symbol}}
</strong><strong
class=
"total-price-content am-text-lg"
>
{{$v.items_total_price}}
</strong></span>
...
...
@@ -347,14 +403,14 @@
{{/if}}
</div>
<!-- 订单确认页面商品底部钩子 -->
<!-- 订单确认页面
分组
商品底部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div
class=
"plugins-tag"
>
<span>
plugins_view_buy_goods_bottom
</span>
<span>
plugins_view_buy_g
roup_g
oods_bottom
</span>
</div>
{{/if}}
{{if !empty($plugins_view_buy_g
oods_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_g
roup_goods_bottom_data) and is_array($plugins_view_buy_group
_goods_bottom_data)}}
{{foreach $plugins_view_buy_g
roup_g
oods_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)}}
<ul
class=
"buy-extension-data"
>
{{foreach $extension_data as $ext}}
<li>
<span
class=
"extension-items-name"
>
{{$ext.name}}
</span>
<span
class=
"am-fr extension-items-tips"
>
{{$ext.tips}}
</span>
</li>
{{/foreach}}
</ul>
{{/if}}
<!-- 订单确认页面订单确认信息顶部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div
class=
"plugins-tag"
>
...
...
application/service/BuyService.php
浏览文件 @
c73b204f
...
...
@@ -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
,
];
// 生成订单数据处理钩子
...
...
application/service/OrderSplitService.php
浏览文件 @
c73b204f
...
...
@@ -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'
]
=
[];
// 订单基础信息
...
...
public/static/index/default/css/buy.css
浏览文件 @
c73b204f
...
...
@@ -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
(
4
n
)
{
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
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录