切换导航条
此项目
正在载入...
登录
李涵
/
integral
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
差异文件
浏览文件
作者
李涵
6 years ago
提交
34c52c1bb767ff8c047173e07e126e89a524730a
2 个父辈
55adf9e4
1ab3c1ea
合并分支 'xv' 到 'master'
Xv 查看合并请求
!7
隐藏空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
383 行增加
和
6 行删除
app/admin/controller/ZjGoodsController.php
app/cart/controller/ZjCartController.php
public/static/index/css/cart.css
public/themes/admin_simpleboot3/admin/zj_goods/add.html
public/themes/admin_simpleboot3/admin/zj_goods/edit.html
public/themes/admin_simpleboot3/admin/zj_goods/index.html
public/themes/simpleboot3/cart/zj_cart/cart.html
app/admin/controller/ZjGoodsController.php
查看文件 @
34c52c1
...
...
@@ -438,12 +438,18 @@ class ZjGoodsController extends AdminBaseController
public
function
delCate
(){
if
(
$this
->
request
->
isAjax
()){
$param
=
input
(
'param.id'
);
$edit
=
Db
::
name
(
'zj_category'
)
->
where
([
'id'
=>
$param
,
'grade'
=>
'2'
])
->
update
([
'delete_time'
=>
time
()]);
if
(
empty
(
$edit
)){
$this
->
error
(
'删除失败'
);
$is
=
Db
::
name
(
'zj_goods'
)
->
where
([
'delete_time'
=>
'0'
,
'cid'
=>
$param
])
->
find
();
if
(
empty
(
$is
)){
$edit
=
Db
::
name
(
'zj_category'
)
->
where
([
'id'
=>
$param
,
'grade'
=>
'2'
])
->
update
([
'delete_time'
=>
time
()]);
if
(
empty
(
$edit
)){
$this
->
error
(
'删除失败'
);
}
else
{
$this
->
success
(
'删除成功'
);
}
}
else
{
$this
->
success
(
'删除成功
'
);
$this
->
error
(
'此分类下有商品,不可删除。
'
);
}
}
}
}
\ No newline at end of file
...
...
app/cart/controller/ZjCartController.php
0 → 100644
查看文件 @
34c52c1
<?php
/**
* Created by PhpStorm.
* User: wz
* Date: 2018/9/28
* Time: 18:05
*/
namespace
app\cart\controller
;
use
cmf\controller\HomeBaseController
;
use
think\Db
;
class
ZjCartController
extends
HomeBaseController
{
/**
* 购物车
*/
public
function
cart
(){
// $id=session('user.id');
$id
=
8
;
$all
=
Db
::
name
(
'zj_cart'
)
->
alias
(
'c'
)
->
join
(
'zj_goods g'
,
'c.gid=g.id'
)
->
join
(
'zj_category ca'
,
'g.cid=ca.id'
)
->
where
(
'c.uid'
,
$id
)
->
field
(
'c.id as cartid,c.gid,c.num,g.*,ca.cid as caid'
)
->
select
();
if
(
empty
(
$all
[
0
])){
$you
=
1
;
}
else
{
$you
=
2
;
}
$this
->
assign
(
'you'
,
$you
);
$this
->
assign
(
'all'
,
$all
);
return
$this
->
fetch
();
}
/**
* 商品数量更改
*/
public
function
num
(){
if
(
$this
->
request
->
isAjax
()){
$param
=
input
(
'param.'
);
if
(
$param
[
'state'
]
==
1
){
$jia
=
Db
::
name
(
'zj_cart'
)
->
where
(
'id'
,
$param
[
'id'
])
->
setDec
(
'num'
,
'1'
);
}
else
{
$jia
=
Db
::
name
(
'zj_cart'
)
->
where
(
'id'
,
$param
[
'id'
])
->
setInc
(
'num'
,
'1'
);
}
if
(
empty
(
$jia
)){
$this
->
error
(
'NO'
);
}
else
{
$this
->
success
(
'OK'
);
}
}
}
/**
* 删除选中商品
*/
public
function
del
(){
if
(
$this
->
request
->
isAjax
()){
$param
=
input
(
'param.'
);
$del
=
Db
::
name
(
'zj_cart'
)
->
where
(
'id'
,
'in'
,
$param
[
'id'
])
->
delete
();
if
(
empty
(
$del
)){
$this
->
error
(
'NO'
);
}
else
{
$this
->
success
(
'OK'
);
}
}
}
}
\ No newline at end of file
...
...
public/static/index/css/cart.css
查看文件 @
34c52c1
...
...
@@ -20,7 +20,8 @@ body,html{
margin-left
:
0.21rem
;
}
.good_img
img
{
width
:
100%
;
width
:
1.79rem
;
height
:
1.79rem
;
}
.cart_text
{
display
:
flex
;
...
...
@@ -48,6 +49,7 @@ body,html{
color
:
#FF0000
;
}
.good_content
{
width
:
3.59rem
;
margin-left
:
0.39rem
;
}
.cart_name
{
...
...
public/themes/admin_simpleboot3/admin/zj_goods/add.html
查看文件 @
34c52c1
...
...
@@ -84,6 +84,7 @@
width=
"135"
style=
"cursor: pointer"
/>
</a>
<input
type=
"button"
class=
"btn btn-sm btn-cancel-thumbnail"
value=
"取消图片"
>
<p
style=
"color: red"
>
注:选择的图片比例应为1:1,否则商城内图片会变形
</p>
</div>
</div>
</div>
...
...
@@ -93,6 +94,7 @@
<ul
id=
"photos"
class=
"pic-list list-unstyled form-inline"
></ul>
<a
href=
"javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
class=
"btn btn-default btn-sm"
>
选择图片
</a>
<p
style=
"color: red"
>
注:选择的图片比例应为1:1,否则商城内图片会变形
</p>
</div>
</div>
<div
class=
"form-group"
id=
"xx"
style=
"display: none"
>
...
...
public/themes/admin_simpleboot3/admin/zj_goods/edit.html
查看文件 @
34c52c1
...
...
@@ -96,6 +96,7 @@
</if>
</a>
<input
type=
"button"
class=
"btn btn-sm btn-cancel-thumbnail"
value=
"取消图片"
>
<p
style=
"color: red"
>
注:选择的图片比例应为1:1,否则商城内图片会变形
</p>
</div>
</div>
</div>
...
...
@@ -122,6 +123,7 @@
</ul>
<a
href=
"javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
class=
"btn btn-default btn-sm"
>
选择图片
</a>
<p
style=
"color: red"
>
注:选择的图片比例应为1:1,否则商城内图片会变形
</p>
</div>
</div>
<div
class=
"form-group"
id=
"xx"
<
if
condition=
"$one.caid neq 2"
>
style="display: none"
</if>
>
...
...
public/themes/admin_simpleboot3/admin/zj_goods/index.html
查看文件 @
34c52c1
...
...
@@ -100,6 +100,7 @@
</eq>
</td>
<td>
<a
href=
"{:url('edit',array('id'=>$vo.id))}"
>
编辑
</a>
<eq
name=
"$vo.is_shove"
value=
"1"
>
<a
href=
"{:url('state',array('id'=>$vo['id'],'is_shove'=>'2'))}"
class=
"js-ajax-dialog-btn"
data-msg=
"确定推荐该商品"
>
推荐
</a>
<else>
...
...
@@ -110,7 +111,6 @@
<else>
<a
href=
"{:url('state',array('id'=>$vo['id'],'is_sta'=>'1'))}"
class=
"js-ajax-dialog-btn"
data-msg=
"确定上架商品"
>
上架
</a>
</eq>
<a
href=
"{:url('edit',array('id'=>$vo.id))}"
>
编辑
</a>
<a
href=
"{:url('delete',array('id'=>$vo['id']))}"
class=
"js-ajax-delete"
>
{:lang('DELETE')}
</a>
<a
href=
"{:url('eva',array('id'=>$vo.id))}"
>
查看评论
</a>
</td>
...
...
public/themes/simpleboot3/cart/zj_cart/cart.html
0 → 100644
查看文件 @
34c52c1
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<link
rel=
"stylesheet"
href=
"https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css"
>
<link
rel=
"stylesheet"
href=
"__INDEX__/css/base.css"
>
<link
rel=
"stylesheet"
href=
"__INDEX__/css/cart.css"
>
<link
rel=
"stylesheet"
href=
"__INDEX__/css/swiper.min.css"
>
<script
type=
"text/javascript"
src=
"__INDEX__/js/base.js"
charset=
"utf-8"
></script>
<title>
购物车
</title>
<style>
.one
{
font-size
:
0.39rem
;
height
:
1.79rem
;
line-height
:
1.79rem
;
}
.all
{
font-size
:
0.39rem
;
height
:
0.5rem
;
line-height
:
0.5rem
;
}
.icon-xuanzhong
{
font-size
:
0.39rem
;
color
:
#FF0000
;
}
.carlist
{
padding-bottom
:
2.6rem
;
}
</style>
</head>
<body>
<!--弹出提醒-->
<div
class=
"remindpop"
style=
"display:none"
>
<p>
您好,不同专区的商品
</p>
<p>
不可混合支付请重新选择
</p>
</div>
<!--确认删除-->
<div
class=
"deletewrap"
style=
"display:none"
>
<div
class=
"deletepop"
>
<p
class=
"suredelete"
>
确认删除
</p>
<p
class=
"certainornot"
>
确定删除该商品吗?
</p>
<div
class=
"certain"
>
<p
class=
"cancel"
>
取消
</p>
<p
class=
"sure"
>
确认
</p>
</div>
</div>
</div>
<div
class=
"container"
>
<!--购物车为空-->
<div
class=
"nogood"
style=
"display:none"
>
<p
class=
"shopcar"
>
您的购物车还没有商品
</p>
<p
class=
"see"
>
去逛逛
</p>
</div>
<div
class=
"havegood"
>
<!--<p class="status edit">编辑</p>-->
<p
class=
"status delect"
>
删除
</p>
<!--<p class="status finish" style="display:none">完成</p>-->
<div
class=
"carlist"
>
<foreach
name=
"all"
item=
"vo"
>
<div
class=
"cart_text"
>
<p
class=
"iconfont icon-not_Selected-copy one"
data-id=
"{$vo.cartid}"
data-price=
"{$vo.price}"
data-num=
"{$vo.num}"
style=
"font-size: 0.39rem"
></p>
<p
class=
"good_img"
><img
src=
"{:cmf_get_image_url($vo.thumb)}"
></p>
<div
class=
"good_content"
>
<p
class=
"cart_name"
>
<if
condition=
"mb_strlen($vo.name) gt 13"
>
{:mb_substr($vo.name,0,13)}...
<else>
{$vo.name}
</if>
</p>
<p
class=
"cart_tast"
>
<if
condition=
"$vo.caid eq 1"
>
<if
condition=
"mb_strlen($vo.intro) gt 12"
>
{:mb_substr($vo.intro,0,12)}...
<else>
{$vo.intro}
</if>
<else>
<if
condition=
"mb_strlen($vo.intro) gt 25"
>
{:mb_substr($vo.intro,0,25)}...
<else>
{$vo.intro}
</if>
</if>
</p>
<if
condition=
"$vo.caid eq 1"
>
<p
class=
"inter"
>
购买可获得{$vo.price*2}积分
</p>
</if>
<div
class=
"addcart"
>
<p
class=
"price"
>
¥{$vo.price}
<if
condition=
"$vo.caid eq 3"
>
(积分)
</if>
</p>
<div
class=
"add_cart_num"
>
<p
class=
"reduce_num"
data-id=
"{$vo.cartid}"
>
<img
src=
"__INDEX__/img/minus.png"
>
</p>
<p
class=
"num_num"
>
{$vo.num}
</p>
<p
class=
"add_num"
data-id=
"{$vo.cartid}"
>
<img
src=
"__INDEX__/img/add.png"
>
</p>
</div>
</div>
</div>
</div>
</foreach>
</div>
<div
class=
"balance"
>
<div
class=
"select_all"
>
<p
class=
"iconfont icon-not_Selected-copy all"
></p>
<p
class=
"both"
>
全选
</p>
</div>
<div
class=
"total_select"
>
<p
class=
"total_balance"
>
合计:
</p>
<p
class=
"total_calute"
>
¥0
</p>
</div>
<div
class=
"settle"
>
结算
</div>
</div>
</div>
<div
class=
"foot"
>
<div
class=
"home"
>
<p
class=
"home_img"
>
<img
src=
"__INDEX__/img/homegray.png"
alt=
""
>
</p>
<p
class=
"home_page"
>
首页
</p>
</div>
<div
class=
"shopcart"
>
<p
class=
"shopcart_img"
>
<img
src=
"__INDEX__/img/cartred.png"
alt=
""
>
</p>
<p
class=
"shop_cart"
>
购物车
</p>
</div>
<div
class=
"membercenter"
>
<p
class=
"member_img"
>
<img
src=
"__INDEX__/img/peoplegray.png"
alt=
""
>
</p>
<p
class=
"member_center"
>
会员中心
</p>
</div>
</div>
</div>
</body>
<script
src=
"__INDEX__/js/jquery.min.js"
></script>
<script>
if
({
$you
}
==
1
){
$
(
'.havegood'
).
remove
()
$
(
'.nogood'
).
css
(
'display'
,
'block'
)
}
//购物车的数量
$
(
".add_num"
).
click
(
function
(){
var
cartid
=
$
(
this
).
data
(
'id'
)
var
num
=
$
(
this
).
siblings
(
".num_num"
).
text
();
$
.
ajax
({
url
:
"{:url('num')}"
,
type
:
"POST"
,
data
:{
id
:
cartid
,
state
:
2
}
})
num
++
;
$
(
this
).
siblings
(
".num_num"
).
html
(
num
);
$
(
this
).
parent
().
parent
().
parent
().
siblings
(
".one"
).
attr
(
'data-num'
,
num
);
if
(
$
(
this
).
parent
().
parent
().
parent
().
siblings
(
".one"
).
hasClass
(
'icon-xuanzhong'
)){
sum
();
}
})
$
(
".reduce_num"
).
click
(
function
(){
var
cartid
=
$
(
this
).
data
(
'id'
)
var
num
=
$
(
this
).
siblings
(
".num_num"
).
text
();
if
(
num
>
1
){
$
.
ajax
({
url
:
"{:url('num')}"
,
type
:
"POST"
,
data
:{
id
:
cartid
,
state
:
1
}
})
num
--
;
$
(
this
).
siblings
(
".num_num"
).
html
(
num
);
$
(
this
).
parent
().
parent
().
parent
().
siblings
(
".one"
).
attr
(
'data-num'
,
num
);
if
(
$
(
this
).
parent
().
parent
().
parent
().
siblings
(
".one"
).
hasClass
(
'icon-xuanzhong'
)){
sum
();
}
}
})
//全选按钮
$
(
".all"
).
click
(
function
(){
var
_this
=
$
(
this
)
if
(
_this
.
hasClass
(
'icon-not_Selected-copy'
)){
_this
.
removeClass
(
'icon-not_Selected-copy'
)
_this
.
addClass
(
'icon-xuanzhong'
)
$
(
'.one'
).
removeClass
(
'icon-not_Selected-copy'
)
$
(
'.one'
).
addClass
(
'icon-xuanzhong'
)
}
else
{
_this
.
removeClass
(
'icon-xuanzhong'
)
_this
.
addClass
(
'icon-not_Selected-copy'
)
$
(
'.one'
).
removeClass
(
'icon-xuanzhong'
)
$
(
'.one'
).
addClass
(
'icon-not_Selected-copy'
)
}
sum
()
})
//单选按钮
$
(
".one"
).
click
(
function
(){
var
_this
=
$
(
this
)
if
(
_this
.
hasClass
(
'icon-not_Selected-copy'
)){
_this
.
removeClass
(
'icon-not_Selected-copy'
)
_this
.
addClass
(
'icon-xuanzhong'
)
}
else
{
_this
.
removeClass
(
'icon-xuanzhong'
)
_this
.
addClass
(
'icon-not_Selected-copy'
)
}
var
one
=
$
(
'.one'
)
var
len1
=
one
.
length
var
len2
=
one
.
filter
(
'.icon-xuanzhong'
).
length
if
(
len1
==
len2
){
$
(
'.all'
).
addClass
(
'icon-xuanzhong'
)
$
(
'.all'
).
removeClass
(
'icon-not_Selected-copy'
)
}
else
{
$
(
'.all'
).
addClass
(
'icon-not_Selected-copy'
)
$
(
'.all'
).
removeClass
(
'icon-xuanzhong'
)
}
sum
()
})
//计算总价
function
sum
()
{
var
one
=
$
(
'.one'
).
filter
(
'.icon-xuanzhong'
);
var
sum
=
0
;
for
(
i
=
0
;
i
<
one
.
length
;
i
++
){
sum
+=
one
.
eq
(
i
).
attr
(
'data-num'
)
*
one
.
eq
(
i
).
data
(
'price'
)
}
$
(
'.total_calute'
).
html
(
'¥'
+
sum
);
}
//删除
$
(
".delect"
).
click
(
function
(){
if
(
$
(
'.one'
).
filter
(
'.icon-xuanzhong'
).
length
>
0
){
$
(
".deletewrap"
).
show
();
}
})
//确认删除
$
(
".sure"
).
click
(
function
(){
var
one
=
$
(
'.one'
).
filter
(
'.icon-xuanzhong'
);
id
=
[];
for
(
i
=
0
;
i
<
one
.
length
;
i
++
){
var
ii
=
one
.
eq
(
i
).
data
(
'id'
)
one
.
eq
(
i
).
parent
().
remove
()
id
.
push
(
ii
)
}
$
.
ajax
({
url
:
"{:url('del')}"
,
type
:
"POST"
,
data
:{
id
:
id
}
})
$
(
".deletewrap"
).
hide
();
});
//取消删除
$
(
".cancel"
).
click
(
function
(){
$
(
".deletewrap"
).
hide
();
})
//结算
$
(
".settle"
).
click
(
function
(){
var
one
=
$
(
'.one'
).
filter
(
'.icon-xuanzhong'
);
if
(
one
.
length
>
0
){
data
=
[];
for
(
i
=
0
;
i
<
one
.
length
;
i
++
){
var
ii
=
one
.
eq
(
i
).
attr
(
'data-id'
)
var
nm
=
one
.
eq
(
i
).
attr
(
'data-num'
)
data
.
push
([
ii
,
nm
])
}
$
.
ajax
({
url
:
"{:url('')}"
,
type
:
'POST'
,
data
:{
data
}
})
}
})
$
(
".see"
).
click
(
function
(){
window
.
location
.
href
=
"{:url('index/index/index')}"
})
$
(
".home"
).
click
(
function
(){
window
.
location
.
href
=
"{:url('index/index/index')}"
})
$
(
".membercenter"
).
click
(
function
(){
window
.
location
.
href
=
"{:url('index/index/index')}"
})
</script>
</html>
...
...
请
注册
或
登录
后发表评论