Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
飞鱼0526
ShopXO
提交
d45fb76d
ShopXO
项目概览
飞鱼0526
/
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,发现更多精彩内容 >>
提交
d45fb76d
编写于
3月 22, 2020
作者:
D
devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
购物车优化
上级
2c13394a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
6 deletion
+19
-6
application/index/controller/Cart.php
application/index/controller/Cart.php
+0
-1
application/index/view/default/cart/index.html
application/index/view/default/cart/index.html
+2
-2
public/static/common/css/common.css
public/static/common/css/common.css
+3
-0
public/static/index/default/js/cart.js
public/static/index/default/js/cart.js
+14
-3
未找到文件。
application/index/controller/Cart.php
浏览文件 @
d45fb76d
...
...
@@ -53,7 +53,6 @@ class Cart extends Common
$base
=
[
'total_price'
=>
empty
(
$cart_list
[
'data'
])
?
0
:
array_sum
(
array_column
(
$cart_list
[
'data'
],
'total_price'
)),
'buy_count'
=>
empty
(
$cart_list
[
'data'
])
?
0
:
array_sum
(
array_column
(
$cart_list
[
'data'
],
'stock'
)),
'ids'
=>
empty
(
$cart_list
[
'data'
])
?
''
:
implode
(
','
,
array_column
(
$cart_list
[
'data'
],
'id'
)),
];
$this
->
assign
(
'base'
,
$base
);
...
...
application/index/view/default/cart/index.html
浏览文件 @
d45fb76d
...
...
@@ -67,7 +67,7 @@
<p
class=
"line-price"
>
{{$price_symbol}}{{$goods.price}}
</p>
</td>
<td
class=
"number"
>
<div
class=
"am-input-group am-input-group-sm stock-tag"
data-inventory=
"{{$goods.inventory}}"
data-price=
"{{$goods.price}}"
data-ajax-url=
"{{:MyUrl('index/cart/
S
tock')}}"
>
<div
class=
"am-input-group am-input-group-sm stock-tag"
data-inventory=
"{{$goods.inventory}}"
data-price=
"{{$goods.price}}"
data-ajax-url=
"{{:MyUrl('index/cart/
s
tock')}}"
>
<span
class=
"am-input-group-label {{if $goods['is_shelves'] eq 1 and $goods['is_delete_time'] eq 0}}stock-submit{{/if}}"
data-type=
"min"
>
-
</span>
<input
type=
"number"
class=
"am-form-field"
value=
"{{$goods.stock}}"
{{
if
$
goods
['
is_shelves
']
neq
1
or
$
goods
['
is_delete_time
']
neq
0}}
disabled
{{/
if
}}
/>
<span
class=
"am-input-group-label {{if $goods['is_shelves'] eq 1 and $goods['is_delete_time'] eq 0}}stock-submit{{/if}}"
data-type=
"add"
>
+
</span>
...
...
@@ -94,7 +94,7 @@
<input
type=
"checkbox"
value=
"1"
data-am-ucheck
/>
<span
class=
"el-text"
>
全选
</span>
</label>
<a
href=
"javascript:;"
class=
"am-margin-left-sm
submit-ajax"
data-url=
"{{:MyUrl('index/cart/delete')}}"
data-id=
"{{$base.ids}}"
data-view=
"reload"
data-msg=
"清空后不可恢复、确认操作吗?"
>
清空
</a>
<a
href=
"javascript:;"
class=
"am-margin-left-sm
nav-delete-submit submit-ajax"
data-url=
"{{:MyUrl('index/cart/delete')}}"
data-id=
"0"
data-view=
"reload"
data-msg=
"删除后不可恢复、确认操作吗?"
>
删除
</a>
</div>
<div
class=
"am-fr nav-right"
>
<form
action=
"{{:MyUrl('index/buy/index')}}"
method=
"post"
>
...
...
public/static/common/css/common.css
浏览文件 @
d45fb76d
...
...
@@ -252,6 +252,8 @@ ul.plug-file-upload-view-video li {
.am-checkbox
,
.am-radio
,
.am-checkbox-inline
,
.am-radio-inline
{
font-size
:
12px
;
padding-left
:
18px
;
min-width
:
18px
;
min-height
:
18px
;
}
.am-ucheck-icons
{
line-height
:
18px
;
...
...
@@ -472,6 +474,7 @@ button.colorpicker-submit:active {
width
:
100px
;
height
:
auto
;
text-align
:
center
;
z-index
:
2
;
}
.am-table-scrollable-horizontal
.am-table-td-fixed-first
td
:first-child
,
.am-table-scrollable-horizontal
.am-table-td-fixed-last
td
:last-child
{
...
...
public/static/index/default/js/cart.js
浏览文件 @
d45fb76d
$
(
function
()
{
// 计算选择的商品总数和总价
/**
* 计算选择的商品总数和总价
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-03-21
* @desc description
*/
function
CartBaseTotal
()
{
var
total_stock
=
0
;
...
...
@@ -17,9 +24,11 @@ $(function()
ids
.
push
(
$
(
this
).
val
());
}
});
ids
=
ids
.
toString
()
||
0
;
$
(
'
.cart-nav .selected-tips strong
'
).
text
(
total_stock
);
$
(
'
.cart-nav .nav-total-price
'
).
text
(
__price_symbol__
+
FomatFloat
(
total_price
));
$
(
'
.cart-nav input[name="ids"]
'
).
val
(
ids
.
toString
()
||
0
);
$
(
'
.cart-nav .nav-delete-submit
'
).
attr
(
'
data-id
'
,
ids
);
}
/**
...
...
@@ -48,8 +57,6 @@ $(function()
{
stock
=
1
;
}
self
.
parents
(
'
.stock-tag
'
).
find
(
'
input
'
).
val
(
stock
);
self
.
parents
(
'
tr
'
).
find
(
'
.total-price-content
'
).
text
(
__price_symbol__
+
FomatFloat
(
stock
*
price
,
2
));
// 开启进度条
$
.
AMUI
.
progress
.
start
();
...
...
@@ -66,6 +73,9 @@ $(function()
$
.
AMUI
.
progress
.
done
();
if
(
result
.
code
==
0
)
{
self
.
parents
(
'
.stock-tag
'
).
find
(
'
input
'
).
val
(
stock
);
self
.
parents
(
'
tr
'
).
find
(
'
.total-price-content
'
).
text
(
__price_symbol__
+
FomatFloat
(
stock
*
price
,
2
));
PromptCenter
(
result
.
msg
,
'
success
'
);
// 数量更新
...
...
@@ -94,6 +104,7 @@ $(function()
CardNumberUpdate
(
$
(
this
),
temp_stock
);
});
// 输入事件
$
(
'
.stock-tag input[type="number"]
'
).
on
(
'
blur
'
,
function
()
{
var
stock
=
$
(
this
).
val
()
||
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录