collect_list.html
12.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<script type="text/javascript" src="__PUBLIC__/js/rem_new.js"></script>
<!DOCTYPE html >
<html>
<head>
<meta charset="UTF-8">
<title>我的收藏</title>
<include file="public/header"/>
<body>
<include file="public/menu"/>
<include file="public/navBall"/>
<link rel="stylesheet" href="__STATIC__/css/user_index.css?v=__CSSVERSION__">
<link rel="stylesheet" href="__STATIC__/css/collect_list.css?v=__CSSVERSION__">
<div id="tbh5v0">
<div class="main" id="user_goods_ka_1" >
<empty name="goods_list">
<div id="list_0_0" class="no_collet flex ai_center jc_center">
<div class="t_c">
<img src="__STATIC__/images/home_page/nocolle.png">
<div class="fs022" style="color: #b9b9b9">当前暂无收藏</div>
<a href="{:U('Index/index',array('stoid'=>$Think.request.stoid))}">
<div class="fc fs024 home_page flex ai_center jc_center">去首页逛逛</div>
</a>
</div>
</div>
<else/>
<div class="collect-frame">
<div class="collect-top flex ai_center jc_sb">
<div class="">
共<span id="total">{$total}</span>件商品
</div>
<div id="edit" onclick="edit_collect()">
编辑
</div>
</div>
</div>
<form name="theForm" method="post" action="">
<div class="shouchang">
<ul>
<foreach name="goods_list" item="goods">
<li class="flex rel">
<div class="flex ai_center select_collct abs" style="display: none"
onclick="select_goods(this)" selid="{$goods['collect_id']}">
<div class="ba-img" style="margin-bottom: 0.6rem"></div>
</div>
<div class="imgurl" style="padding-right:0.1rem">
<a href="{:U('Goods/goodsInfo',array('id'=>$goods[goods_id],'stoid'=>$Think.request.stoid))}">
<img src="{:getimg($goods['original_img'],NOIMG,0,1)}"
onerror="this.src='{$noimg}';this.onerror=null" width="100"
height="100">
</a>
</div>
<div style="width: 70%;height: 1.6rem">
<a class="rel" href="{:U('Goods/goodsInfo',array('id'=>$goods[goods_id],'stoid'=>$Think.request.stoid))}">
<div class="order_info ellipsis-2">
<dl>
<dt class="ellipsis-2 fs032">{$goods.goods_name}</dt>
</dl>
</div>
</a>
<div class="dingdancaozuo abs flex ai_center">
<div class="money-frame flex jc_sb ai_fe" style="width: 100%">
<dd><strong class="goods_money">
<text class="fs11">¥</text><text class="fs20">{$goods.shop_price}</text>
</strong>
<del class="fg fs02">零售价:¥{$goods.market_price}</del>
</dd>
<div class="flex is_hode" style="margin-bottom: 0.08rem;">
<a href="{:U('Goods/goodsList',array('id'=>$goods[cat_id],'stoid'=>$Think.request.stoid))}"><div class="fs020 similar flex jc_center ai_center">找相似</div></a>
<a href="{:U('User/cancel_collect',array('collect_id'=>$goods[collect_id],'stoid'=>$Think.request.stoid))}"
class="s_outs" style=" color:#fff">
<img class="trash-img" src="__STATIC__/images/home_page/trash.png">
</a></div>
</div>
</div>
</div>
</li>
</foreach>
</ul>
</div>
</form>
<eq name="mshow" value="1">
<notempty name="goods_list">
<div id="getmore"
style="font-size:.24rem;text-align: center;color:#888;padding:.25rem .24rem .4rem; clear:both">
<a href="javascript:void(0)" onClick="ajax_sourch_submit()">点击加载更多</a>
</div>
</notempty>
</eq>
</empty>
<!--好物推荐-->
<div class="flex ai_center jc_center hw_title">
<div class="hw_xian"></div>
<div class="flex ai_center" style="margin-left: 0.2rem;margin-right: 0.2rem">
<img class="trash-img" src="__STATIC__/images/home_page/diamonds.png">
<text class="fs026">好物推荐</text>
</div>
<div class="hw_xian"></div>
</div>
<div style="width: 100%;height: auto;background: rgb(245, 245, 245)">
<div class="floor_body2">
<div id="J_ItemList">
<ul class="product single_item info">
</ul>
<a href="javascript:;" class="get_more" style="text-align:center; display:block;">
<img src='__STATIC__/images/category/loader.gif' width="12" height="12"> </a>
</div>
<div class="xc-goods-frame4" id="getmores"
style="font-size:.24rem;text-align: center;color:#888;padding:.25rem .24rem .4rem;">
<a href="javascript:void(0)" onClick="getGoodsList()">点击加载更多</a>
</div>
</div>
</div>
</div>
<input type="hidden" id="hidsellist" value="">
</div>
<div class="bottem flex ai_center" style="display:none;">
<div class="flex ai_center jc_sb bottom-left">
<div class="flex ai_center fs026" onclick="all_election(this)" style="margin-left: 0.32rem">
<div class="ba-img" ></div>
<text style="margin-left: 0.15rem"> 全选</text>
</div>
<div style="margin-right: 0.1rem;">
已选<text class="fs-r">0</text>件
</div>
</div>
<div class="delete fc flex jc_center ai_center fs40" id="btndel">
删除
</div>
</div>
</body>
</html>
<script>
var page = 1;
var stoid = "<?php echo I('stoid')?>";
var edit = 1;
var number = 0;
/*** ajax 提交表单 查询订单列表结果*/
var dataArr =0;//全选删除的
$(function () {
getGoodsList();
});
//全选删除
function all_election(obj) {
dataArr=1;
var is_select = $(obj).find(".ba-img").hasClass("sn");
if (is_select) {
$(".ba-img").removeClass('sn');
$(".fs-r").text("0");
} else {
$(".ba-img").addClass('sn');
var is_select = $(obj).find(".ba-img").hasClass("sn");
var len= $(" .shouchang ul").find("li").size();
$(".fs-r").text(len);
/*获取所有的收藏id*/
}
}
//选中的商品准备删除
function select_goods(obj) {
var is_select = $(obj).find(".ba-img").hasClass("sn");
var sel_number = $(".fs-r").text();
var selgoodsid = $(obj).attr('selid');
if (is_select) {
$(obj).find(".ba-img").removeClass('sn');
if (sel_number > 0) {
sel_number = parseInt(sel_number) - 1;
}
} else {
$(obj).find(".ba-img").addClass('sn');
sel_number = parseInt(sel_number) + 1;
}
$(".fs-r").text(sel_number);
}
/*----
function seladdid(goodsid) {
var getsellist = $("#hidsellist").val();
console.log("ggggggg"+ getsellist);
getsellist += "," + goodsid;
$("#hidsellist").val(getsellist);
console.log("yyyy"+ $("#hidsellist").val());
}
//减去ID
function selremoveid(goodsid) {
var getsellist = $("#hidsellist").val();
var reg = new RegExp("," + goodsid, "g"); //定义正则表达式
getsellist = getsellist.replace(reg, "");
console.log("是什么东西4444444",goodsid);
$("#hidsellist").val(goodsid);
}---*/
//编辑收藏
function edit_collect() {
if (edit == 1) {
$("#edit").html("完成");
edit = 2;
$(".ai_fes").hide();
$(".money-frame").css("padding-left", "0.45rem");
$(".select_collct").show();
$(".bottem").show();
$(".shouchang ul li").css(" padding-top", "0rem");
$(".imgurl").css("margin-left", "0.55rem");
$(".is_hode").hide();
$(".shouchang ul li .dingdancaozuo").css("bottom","12px")
} else {
$("#edit").html("编辑");
$(".money-frame").css("padding-left", "0rem");
edit = 1;
$(".ai_fes").show();
$(".select_collct").hide();
$(".bottem").hide();
$(".shouchang ul li").css(" padding-top", "0.3rem");
$(".is_hode").show();
$(".imgurl").css("margin-left", "0rem");
$(".shouchang ul li .dingdancaozuo").css("bottom","7px")
}
}
function ajax_sourch_submit() {
page += 1;
$.ajax({
type: "GET",
url: "/index.php?m=Mobile&c=User&a=collect_list&is_ajax=1&p=" + page + "&stoid=" + stoid,//+tab,
success: function (data) {
if ($.trim(data) == '')
$('#getmore').hide();
else
$(".shouchang > ul").append(data);
}
});
}
function getGoodsList() {
$('.get_more').show();
$('#getmore').hide();
$.ajax({
type: "get",
url: "/index.php?m=Mobile&c=Index&a=ajaxGetMore&p=" + page + "&stoid=<?php echo getMobileStoId()?>",
success: function (data) {
$('.get_mores').hide();
if (data) {
$("#J_ItemList>ul").append(data);
page++;
} else {
$('#getmore').remove();
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$("#ferweimap").hide();
}
});
}
//删除
$("#btndel").click(function () {
var dataObj="";
//var getsellist=$("#hidsellist").val();
var is_select = $(".ba-img.sn");
//---- 循环选中的 ----
if(is_select) {
$(".ba-img.sn").each(function () {
var obj=$(this).parent();
var selid = obj.attr("selid");
dataObj += selid + ",";
});
}
//删除最后的逗号
dataObj=dataObj.substring(0, dataObj.length-1);
getsellist=dataObj;
if(dataArr==1){
dataObj=dataObj.substring(0, dataObj.length-10);
getsellist= dataObj;
}
var getstoid=<?php echo getMobileStoId()?>;
if (getsellist=="")
{
layer.open({content:'请选择要删除记录!',time:2});
return false;
}
var ui=layer.open({type:2,shadeClose: false});
$.ajax({
type: "POST",
url: "/index.php?m=Mobile&c=Userapi&a=batchcancel_collect&stoid="+getstoid,
data:{"sellist":getsellist},
success: function (data) {
layer.close(ui);
if (data.code==0)
{
layer.open({content:'删除成功!',time:1});
setTimeout(function(){ location.href=location.href; }, 1000);
return false;
}
layer.open({content:data.msg,time:2});
return false;
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
layer.close(ui);
layer.open({content:'异常出错,请刷新重试!',time:2});
return false;
}
});
})
</script>