|
|
1
|
+<!DOCTYPE html>
|
|
|
2
|
+<html lang="en">
|
|
|
3
|
+<head>
|
|
|
4
|
+ <meta charset="UTF-8">
|
|
|
5
|
+ <link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css">
|
|
|
6
|
+ <link rel="stylesheet" href="__INDEX__/css/base.css">
|
|
|
7
|
+ <link rel="stylesheet" href="__INDEX__/css/cart.css">
|
|
|
8
|
+ <link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
|
|
|
9
|
+ <script type="text/javascript" src="__INDEX__/js/base.js" charset="utf-8"></script>
|
|
|
10
|
+ <title>购物车</title>
|
|
|
11
|
+ <style>
|
|
|
12
|
+ .one{
|
|
|
13
|
+ font-size: 0.39rem;
|
|
|
14
|
+ height:1.79rem;
|
|
|
15
|
+ line-height: 1.79rem;
|
|
|
16
|
+ }
|
|
|
17
|
+ .all{
|
|
|
18
|
+ font-size: 0.39rem;
|
|
|
19
|
+ height:0.5rem;
|
|
|
20
|
+ line-height: 0.5rem;
|
|
|
21
|
+ }
|
|
|
22
|
+ .icon-xuanzhong{
|
|
|
23
|
+ font-size: 0.39rem;
|
|
|
24
|
+ color: #FF0000;
|
|
|
25
|
+ }
|
|
|
26
|
+ .carlist{
|
|
|
27
|
+ padding-bottom: 2.6rem;
|
|
|
28
|
+ }
|
|
|
29
|
+ </style>
|
|
|
30
|
+</head>
|
|
|
31
|
+<body>
|
|
|
32
|
+<!--弹出提醒-->
|
|
|
33
|
+<div class="remindpop" style="display:none">
|
|
|
34
|
+
|
|
|
35
|
+ <p>您好,不同专区的商品</p>
|
|
|
36
|
+ <p>不可混合支付请重新选择</p>
|
|
|
37
|
+
|
|
|
38
|
+</div>
|
|
|
39
|
+<!--确认删除-->
|
|
|
40
|
+<div class="deletewrap" style="display:none">
|
|
|
41
|
+ <div class="deletepop">
|
|
|
42
|
+ <p class="suredelete">确认删除</p>
|
|
|
43
|
+ <p class="certainornot">确定删除该商品吗?</p>
|
|
|
44
|
+ <div class="certain">
|
|
|
45
|
+ <p class="cancel">取消</p>
|
|
|
46
|
+ <p class="sure">确认</p>
|
|
|
47
|
+ </div>
|
|
|
48
|
+
|
|
|
49
|
+ </div>
|
|
|
50
|
+</div>
|
|
|
51
|
+<div class="container">
|
|
|
52
|
+ <!--购物车为空-->
|
|
|
53
|
+ <div class="nogood" style="display:none">
|
|
|
54
|
+ <p class="shopcar">您的购物车还没有商品</p>
|
|
|
55
|
+ <p class="see">
|
|
|
56
|
+ 去逛逛
|
|
|
57
|
+ </p>
|
|
|
58
|
+ </div>
|
|
|
59
|
+ <div class="havegood" >
|
|
|
60
|
+ <!--<p class="status edit">编辑</p>-->
|
|
|
61
|
+ <p class="status delect">删除</p>
|
|
|
62
|
+ <!--<p class="status finish" style="display:none">完成</p>-->
|
|
|
63
|
+ <div class="carlist">
|
|
|
64
|
+ <foreach name="all" item="vo">
|
|
|
65
|
+ <div class="cart_text">
|
|
|
66
|
+ <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>
|
|
|
67
|
+ <p class="good_img"><img src="{:cmf_get_image_url($vo.thumb)}"></p>
|
|
|
68
|
+ <div class="good_content">
|
|
|
69
|
+ <p class="cart_name">
|
|
|
70
|
+ <if condition="mb_strlen($vo.name) gt 13">
|
|
|
71
|
+ {:mb_substr($vo.name,0,13)}...
|
|
|
72
|
+ <else>
|
|
|
73
|
+ {$vo.name}
|
|
|
74
|
+ </if>
|
|
|
75
|
+ </p>
|
|
|
76
|
+ <p class="cart_tast">
|
|
|
77
|
+ <if condition="$vo.caid eq 1">
|
|
|
78
|
+ <if condition="mb_strlen($vo.intro) gt 12">
|
|
|
79
|
+ {:mb_substr($vo.intro,0,12)}...
|
|
|
80
|
+ <else>
|
|
|
81
|
+ {$vo.intro}
|
|
|
82
|
+ </if>
|
|
|
83
|
+ <else>
|
|
|
84
|
+ <if condition="mb_strlen($vo.intro) gt 25">
|
|
|
85
|
+ {:mb_substr($vo.intro,0,25)}...
|
|
|
86
|
+ <else>
|
|
|
87
|
+ {$vo.intro}
|
|
|
88
|
+ </if>
|
|
|
89
|
+ </if>
|
|
|
90
|
+
|
|
|
91
|
+ </p>
|
|
|
92
|
+ <if condition="$vo.caid eq 1">
|
|
|
93
|
+ <p class="inter">购买可获得{$vo.price*2}积分</p>
|
|
|
94
|
+ </if>
|
|
|
95
|
+ <div class="addcart">
|
|
|
96
|
+ <p class="price">
|
|
|
97
|
+ ¥{$vo.price}
|
|
|
98
|
+ <if condition="$vo.caid eq 3">
|
|
|
99
|
+ (积分)
|
|
|
100
|
+ </if>
|
|
|
101
|
+ </p>
|
|
|
102
|
+ <div class="add_cart_num">
|
|
|
103
|
+ <p class="reduce_num" data-id="{$vo.cartid}">
|
|
|
104
|
+ <img src="__INDEX__/img/minus.png">
|
|
|
105
|
+ </p>
|
|
|
106
|
+ <p class="num_num">{$vo.num}</p>
|
|
|
107
|
+ <p class="add_num" data-id="{$vo.cartid}">
|
|
|
108
|
+ <img src="__INDEX__/img/add.png">
|
|
|
109
|
+ </p>
|
|
|
110
|
+ </div>
|
|
|
111
|
+ </div>
|
|
|
112
|
+ </div>
|
|
|
113
|
+ </div>
|
|
|
114
|
+ </foreach>
|
|
|
115
|
+
|
|
|
116
|
+ </div>
|
|
|
117
|
+ <div class="balance">
|
|
|
118
|
+ <div class="select_all">
|
|
|
119
|
+ <p class="iconfont icon-not_Selected-copy all" ></p>
|
|
|
120
|
+ <p class="both">全选</p>
|
|
|
121
|
+ </div>
|
|
|
122
|
+ <div class="total_select">
|
|
|
123
|
+ <p class="total_balance">合计:</p>
|
|
|
124
|
+ <p class="total_calute"> ¥0</p>
|
|
|
125
|
+ </div>
|
|
|
126
|
+ <div class="settle">结算</div>
|
|
|
127
|
+ </div>
|
|
|
128
|
+ </div>
|
|
|
129
|
+
|
|
|
130
|
+ <div class="foot">
|
|
|
131
|
+ <div class="home">
|
|
|
132
|
+ <p class="home_img">
|
|
|
133
|
+ <img src="__INDEX__/img/homegray.png" alt="">
|
|
|
134
|
+ </p>
|
|
|
135
|
+ <p class="home_page">首页</p>
|
|
|
136
|
+ </div>
|
|
|
137
|
+ <div class="shopcart">
|
|
|
138
|
+ <p class="shopcart_img">
|
|
|
139
|
+ <img src="__INDEX__/img/cartred.png" alt="">
|
|
|
140
|
+ </p>
|
|
|
141
|
+ <p class="shop_cart">
|
|
|
142
|
+ 购物车
|
|
|
143
|
+ </p>
|
|
|
144
|
+ </div>
|
|
|
145
|
+ <div class="membercenter">
|
|
|
146
|
+ <p class="member_img">
|
|
|
147
|
+ <img src="__INDEX__/img/peoplegray.png" alt="">
|
|
|
148
|
+ </p>
|
|
|
149
|
+ <p class="member_center">
|
|
|
150
|
+ 会员中心
|
|
|
151
|
+ </p>
|
|
|
152
|
+ </div>
|
|
|
153
|
+ </div>
|
|
|
154
|
+</div>
|
|
|
155
|
+</body>
|
|
|
156
|
+<script src="__INDEX__/js/jquery.min.js"></script>
|
|
|
157
|
+<script>
|
|
|
158
|
+ if ({$you}==1){
|
|
|
159
|
+ $('.nogood').css('display','block')
|
|
|
160
|
+ }
|
|
|
161
|
+ //购物车的数量
|
|
|
162
|
+ $(".add_num").click(function(){
|
|
|
163
|
+ var cartid=$(this).data('id')
|
|
|
164
|
+ var num=$(this).siblings(".num_num").text();
|
|
|
165
|
+ $.ajax({
|
|
|
166
|
+ url:"{:url('num')}",
|
|
|
167
|
+ type:"POST",
|
|
|
168
|
+ data:{id:cartid,state:2}
|
|
|
169
|
+ })
|
|
|
170
|
+ num++;
|
|
|
171
|
+ $(this).siblings(".num_num").html(num);
|
|
|
172
|
+ $(this).parent().parent().parent().siblings(".one").attr('data-num',num);
|
|
|
173
|
+ if ($(this).parent().parent().parent().siblings(".one").hasClass('icon-xuanzhong')){
|
|
|
174
|
+ sum();
|
|
|
175
|
+ }
|
|
|
176
|
+ })
|
|
|
177
|
+ $(".reduce_num").click(function(){
|
|
|
178
|
+ var cartid=$(this).data('id')
|
|
|
179
|
+ var num=$(this).siblings(".num_num").text();
|
|
|
180
|
+ if (num>1){
|
|
|
181
|
+ $.ajax({
|
|
|
182
|
+ url:"{:url('num')}",
|
|
|
183
|
+ type:"POST",
|
|
|
184
|
+ data:{id:cartid,state:1}
|
|
|
185
|
+ })
|
|
|
186
|
+ num--;
|
|
|
187
|
+ $(this).siblings(".num_num").html(num);
|
|
|
188
|
+ $(this).parent().parent().parent().siblings(".one").attr('data-num',num);
|
|
|
189
|
+ if ($(this).parent().parent().parent().siblings(".one").hasClass('icon-xuanzhong')){
|
|
|
190
|
+ sum();
|
|
|
191
|
+ }
|
|
|
192
|
+ }
|
|
|
193
|
+ })
|
|
|
194
|
+ //全选按钮
|
|
|
195
|
+ $(".all").click(function(){
|
|
|
196
|
+ var _this=$(this)
|
|
|
197
|
+ if (_this.hasClass('icon-not_Selected-copy')){
|
|
|
198
|
+ _this.removeClass('icon-not_Selected-copy')
|
|
|
199
|
+ _this.addClass('icon-xuanzhong')
|
|
|
200
|
+ $('.one').removeClass('icon-not_Selected-copy')
|
|
|
201
|
+ $('.one').addClass('icon-xuanzhong')
|
|
|
202
|
+ }else {
|
|
|
203
|
+ _this.removeClass('icon-xuanzhong')
|
|
|
204
|
+ _this.addClass('icon-not_Selected-copy')
|
|
|
205
|
+ $('.one').removeClass('icon-xuanzhong')
|
|
|
206
|
+ $('.one').addClass('icon-not_Selected-copy')
|
|
|
207
|
+ }
|
|
|
208
|
+ sum()
|
|
|
209
|
+ })
|
|
|
210
|
+ //单选按钮
|
|
|
211
|
+ $(".one").click(function(){
|
|
|
212
|
+ var _this=$(this)
|
|
|
213
|
+ if (_this.hasClass('icon-not_Selected-copy')){
|
|
|
214
|
+ _this.removeClass('icon-not_Selected-copy')
|
|
|
215
|
+ _this.addClass('icon-xuanzhong')
|
|
|
216
|
+ }else {
|
|
|
217
|
+ _this.removeClass('icon-xuanzhong')
|
|
|
218
|
+ _this.addClass('icon-not_Selected-copy')
|
|
|
219
|
+ }
|
|
|
220
|
+ var one=$('.one')
|
|
|
221
|
+ var len1=one.length
|
|
|
222
|
+ var len2=one.filter('.icon-xuanzhong').length
|
|
|
223
|
+ if (len1==len2){
|
|
|
224
|
+ $('.all').addClass('icon-xuanzhong')
|
|
|
225
|
+ $('.all').removeClass('icon-not_Selected-copy')
|
|
|
226
|
+ }else {
|
|
|
227
|
+ $('.all').addClass('icon-not_Selected-copy')
|
|
|
228
|
+ $('.all').removeClass('icon-xuanzhong')
|
|
|
229
|
+ }
|
|
|
230
|
+ sum()
|
|
|
231
|
+ })
|
|
|
232
|
+
|
|
|
233
|
+ //计算总价
|
|
|
234
|
+ function sum() {
|
|
|
235
|
+ var one=$('.one').filter('.icon-xuanzhong');
|
|
|
236
|
+ var sum=0;
|
|
|
237
|
+ for (i=0;i<one.length;i++){
|
|
|
238
|
+ sum+=one.eq(i).attr('data-num')*one.eq(i).data('price')
|
|
|
239
|
+ }
|
|
|
240
|
+ $('.total_calute').html('¥'+sum);
|
|
|
241
|
+ }
|
|
|
242
|
+ //删除
|
|
|
243
|
+ $(".delect").click(function(){
|
|
|
244
|
+ if ($('.one').filter('.icon-xuanzhong').length>0){
|
|
|
245
|
+ $(".deletewrap").show();
|
|
|
246
|
+ }
|
|
|
247
|
+ })
|
|
|
248
|
+ //确认删除
|
|
|
249
|
+ $(".sure").click(function(){
|
|
|
250
|
+ var one=$('.one').filter('.icon-xuanzhong');
|
|
|
251
|
+ id=[];
|
|
|
252
|
+ for (i=0;i<one.length;i++){
|
|
|
253
|
+ var ii=one.eq(i).data('id')
|
|
|
254
|
+ one.eq(i).parent().remove()
|
|
|
255
|
+ id.push(ii)
|
|
|
256
|
+ }
|
|
|
257
|
+ $.ajax({
|
|
|
258
|
+ url:"{:url('del')}",
|
|
|
259
|
+ type:"POST",
|
|
|
260
|
+ data:{id:id}
|
|
|
261
|
+ })
|
|
|
262
|
+
|
|
|
263
|
+ $(".deletewrap").hide();
|
|
|
264
|
+ });
|
|
|
265
|
+ //取消删除
|
|
|
266
|
+ $(".cancel").click(function(){
|
|
|
267
|
+ $(".deletewrap").hide();
|
|
|
268
|
+ })
|
|
|
269
|
+ //结算
|
|
|
270
|
+ $(".settle").click(function(){
|
|
|
271
|
+ var one=$('.one').filter('.icon-xuanzhong');
|
|
|
272
|
+ if (one.length>0){
|
|
|
273
|
+ data=[];
|
|
|
274
|
+ for (i=0;i<one.length;i++){
|
|
|
275
|
+ var ii=one.eq(i).attr('data-id')
|
|
|
276
|
+ var nm=one.eq(i).attr('data-num')
|
|
|
277
|
+ data.push([ii,nm])
|
|
|
278
|
+ }
|
|
|
279
|
+ $.ajax({
|
|
|
280
|
+ url:"{:url('')}",
|
|
|
281
|
+ type:'POST',
|
|
|
282
|
+ data:{data}
|
|
|
283
|
+ })
|
|
|
284
|
+ }
|
|
|
285
|
+ })
|
|
|
286
|
+ $(".home").click(function(){
|
|
|
287
|
+ window.location.href="{:url('index/index/index')}"
|
|
|
288
|
+ })
|
|
|
289
|
+ $(".membercenter").click(function(){
|
|
|
290
|
+ window.location.href="{:url('index/index/index')}"
|
|
|
291
|
+ })
|
|
|
292
|
+</script>
|
|
|
293
|
+</html> |