You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
120
hyhproject/home2/view/default/users/favorites/favorites.js
Executable file
120
hyhproject/home2/view/default/users/favorites/favorites.js
Executable file
@ -0,0 +1,120 @@
|
||||
//关注的商品列表
|
||||
function freGoodsList(pages){
|
||||
var param = {};
|
||||
param.pagesize = 8;
|
||||
param.page = pages;
|
||||
$.post(WST.U('home/favorites/listGoodsQuery'),param,function(data){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
json = json.data;
|
||||
if(param.page>json.TotalPage && json.TotalPage >0){
|
||||
freGoodsList(json.TotalPage);
|
||||
return;
|
||||
}
|
||||
var gettpl = document.getElementById('list').innerHTML;
|
||||
laytpl(gettpl).render(json.Rows, function(html){
|
||||
$('#list-goods').html(html);
|
||||
});
|
||||
laypage({
|
||||
cont: 'goodsPage',
|
||||
pages:json.TotalPage,
|
||||
curr: json.CurrentPage,
|
||||
skip: true, //是否开启跳页
|
||||
skin: '#f46442',
|
||||
groups: 3,
|
||||
prev: '<<',
|
||||
next: '>>',
|
||||
jump: function(e, first){
|
||||
if(!first){
|
||||
freGoodsList(e.curr);
|
||||
}
|
||||
}
|
||||
});
|
||||
$(".wst-fav-goimg").hover(function(){
|
||||
$(this).find(".js-operate").slideDown();
|
||||
},function(){
|
||||
$(this).find(".js-operate").slideUp();
|
||||
});
|
||||
$('.goodsImg2').lazyload({ effect: "fadeIn",failurelimit : 10,skip_invisible : false,threshold: 200,placeholder:window.conf.IMGURL+'/'+window.conf.GOODS_LOGO});//商品默认图片
|
||||
}
|
||||
});
|
||||
}
|
||||
function getGoods(id){
|
||||
location.href=WST.U('home/goods/detail','id='+id);
|
||||
}
|
||||
function cancelFavorite(id,type){
|
||||
WST.confirm({content:"您确定要取消关注吗?", yes:function(tips){
|
||||
var load = WST.load({msg:'请稍后...'});
|
||||
var param = {};
|
||||
param.id = id;
|
||||
param.type = type;
|
||||
$.post(WST.U('home/favorites/cancel'),param,function(data,textStatus){
|
||||
layer.close(load);
|
||||
var json = WST.toJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg(json.msg,{icon:1},function(){
|
||||
if(type==0){
|
||||
freGoodsList(WSTCurrPage);
|
||||
}else{
|
||||
freShopList(WSTCurrPage);
|
||||
}
|
||||
|
||||
});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:5});
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
//关注的店铺列表
|
||||
function freShopList(pages){
|
||||
var param = {};
|
||||
param.pagesize = 3;
|
||||
param.page = pages;
|
||||
$.post(WST.U('home/favorites/listShopQuery'),param,function(data){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
json = json.data;
|
||||
if(param.page>json.TotalPage && json.TotalPage >0){
|
||||
freShopList(json.TotalPage);
|
||||
return;
|
||||
}
|
||||
var gettpl = document.getElementById('list').innerHTML;
|
||||
laytpl(gettpl).render(json.Rows, function(html){
|
||||
$('#list-shops').html(html);
|
||||
});
|
||||
//商品滑动
|
||||
var goodsNum = json.Rows.length;
|
||||
for(var i=0;i<goodsNum;++i){
|
||||
$("#js-goods"+i).als({
|
||||
visible_items: 5,
|
||||
scrolling_items: 1,
|
||||
orientation: "horizontal",
|
||||
circular: "yes",
|
||||
autoscroll: "no",
|
||||
start_from: 2
|
||||
});
|
||||
}
|
||||
$('.goodsImg2').lazyload({ effect: "fadeIn",failurelimit : 10,skip_invisible : false,threshold: 200,placeholder:window.conf.IMGURL+'/'+window.conf.GOODS_LOGO});//商品默认图片
|
||||
$('.shopsImg2').lazyload({ effect: "fadeIn",failurelimit : 10,skip_invisible : false,threshold: 200,placeholder:window.conf.IMGURL+'/'+window.conf.SHOP_LOGO});//店铺默认头像
|
||||
laypage({
|
||||
cont: 'shopsPage',
|
||||
pages:json.TotalPage,
|
||||
curr: json.CurrentPage,
|
||||
skip: true, //是否开启跳页
|
||||
skin: '#f46442',
|
||||
groups: 3,
|
||||
prev: '<<',
|
||||
next: '>>',
|
||||
jump: function(e, first){
|
||||
if(!first){
|
||||
freShopList(e.curr);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function getShop(id){
|
||||
location.href=WST.U('home/shops/home','shopId='+id);
|
||||
}
|
36
hyhproject/home2/view/default/users/favorites/list_goods.html
Executable file
36
hyhproject/home2/view/default/users/favorites/list_goods.html
Executable file
@ -0,0 +1,36 @@
|
||||
{extend name="default/users/base" /}
|
||||
{block name="title"}关注的商品 - 买家中心{__block__}{/block}
|
||||
{block name="css"}{/block}
|
||||
{block name="content"}
|
||||
<div class="wst-user-head"><span>我关注的商品 </span></div>
|
||||
<div class="wst-clear"></div>
|
||||
<div class="wst-fav-listg" id="list-goods"></div>
|
||||
<div class="wst-clear"></div>
|
||||
<div class="wst-fav-pa"><div id="goodsPage"></div></div>
|
||||
<script id="list" type="text/html">
|
||||
{{# for(var i = 0; i < d.length; i++){}}
|
||||
<div class="wst-fav-goods">
|
||||
<div class="wst-fav-goimg"><img class="goodsImg2" data-original="__IMGURL__/{{ d[i].goodsImg }}" title="{{ d[i].goodsName }}"><span class="js-operate" onclick="javascript:cancelFavorite({{ d[i].favoriteId }},0)">取消收藏</div>
|
||||
<a href="javascript:getGoods({{ d[i].goodsId }})">
|
||||
<p class="wst-fav-gonam">{{WST.cutStr(d[i].goodsName,50)}}</p>
|
||||
<p class="wst-fav-goodp1"><span class="wst-fav-goodpr">¥{{ d[i].shopPrice }}</span><span class="wst-rfloat">成交数:<span class="wst-fav-goodpr2">{{ d[i].saleNum }}</span></p>
|
||||
<p class="wst-fav-goodp2"><span class="wst-fav-goodpr3">市场价:¥{{ d[i].marketPrice }}</span><span class="wst-rfloat">已有<span class="wst-fav-goodpr4">{{ d[i].appraiseNum }}</span>人评价</span></p>
|
||||
<p class="wst-fav-shop">
|
||||
<span class="wst-lfloat">{{WST.cutStr(d[i].shopName,8)}}</span>
|
||||
{{# for(var a = 0; a < d[i].accreds.length; a++){ }}
|
||||
<img src="__IMGURL__/{{ d[i].accreds[a].accredImg }}" title="{{ d[i].accreds[a].accredName }}">
|
||||
{{# } }}
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
{/block}
|
||||
{block name="js"}
|
||||
<script type='text/javascript' src='__STYLE__/users/favorites/favorites.js?v={$v}'></script>
|
||||
<script>
|
||||
$(function(){
|
||||
freGoodsList();
|
||||
});
|
||||
</script>
|
||||
{/block}
|
49
hyhproject/home2/view/default/users/favorites/list_shops.html
Executable file
49
hyhproject/home2/view/default/users/favorites/list_shops.html
Executable file
@ -0,0 +1,49 @@
|
||||
{extend name="default/users/base" /}
|
||||
{block name="title"}关注的店铺 - 买家中心{__block__}{/block}
|
||||
{block name="css"}{/block}
|
||||
{block name="content"}
|
||||
<div class="wst-user-head"><span>我关注的店铺</span></div>
|
||||
<div class="wst-clear"></div>
|
||||
<div id="list-shops"></div>
|
||||
<div class="wst-fav-pa"><div id="shopsPage"></div></div>
|
||||
<script id="list" type="text/html">
|
||||
{{# for(var i = 0; i < d.length; i++){ }}
|
||||
<div class="wst-favo-shop">
|
||||
<div class="wst-favo-shopl">
|
||||
<a href="javascript:getShop({{ d[i].shopId }})" class="wst-favo-shopimg"><img class="shopsImg2" data-original="__IMGURL__/{{ d[i].shopImg }}" title="{{ d[i].shopName }}"/></a>
|
||||
<p>{{WST.cutStr(d[i].shopName,15)}}</p>
|
||||
<a href="javascript:getShop({{ d[i].shopId }})" class="wst-favo-shopa">进入店铺</a><a href="javascript:cancelFavorite({{ d[i].favoriteId }},1)" class="wst-favo-shopa">取消关注</a>
|
||||
</div>
|
||||
<div class="wst-favo-shopr">
|
||||
<div class="wst-favo-more"><span class="wst-lfloat">推荐商品</span><a href="javascript:getShop({{ d[i].shopId }})" class="wst-rfloat">查看更多 ></a></div>
|
||||
<div class="wst-favo-good wst-lfloat">
|
||||
<div class="als-container" id="{{# if(d[i].goods.length>5){ }}js-goods{{i}}{{# } }}">
|
||||
{{# if(d[i].goods.length>5){ }}<span class="als-prev"><img src="__STYLE__/img/icon_left.png" alt="prev" title="previous" /></span>{{# } }}
|
||||
<div class="als-viewport">
|
||||
<ul class="als-wrapper">
|
||||
{{# for(var a = 0; a < d[i].goods.length; a++){ }}
|
||||
<li class="als-item wst-favo-goods">
|
||||
<div class="wst-favo-goodimg"><a href="javascript:getGoods({{ d[i].goods[a].goodsId }})"><img class="goodsImg2" data-original="__IMGURL__/{{ d[i].goods[a].goodsImg }}" title="{{ d[i].goods[a].goodsName }}"/></a></div>
|
||||
<span>¥{{ d[i].goods[a].shopPrice }}</span>
|
||||
</li>
|
||||
{{# } }}
|
||||
</ul>
|
||||
</div>
|
||||
{{# if(d[i].goods.length>5){ }}<span class="als-next"><img src="__STYLE__/img/icon_right.png" alt="next" title="next" /></span>{{# } }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wst-clear"></div>
|
||||
</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
{/block}
|
||||
{block name="js"}
|
||||
<script type='text/javascript' src='__STYLE__/js/jquery.als.js?v={$v}'></script>
|
||||
<script type='text/javascript' src='__STYLE__/users/favorites/favorites.js?v={$v}'></script>
|
||||
<script>
|
||||
$(function(){
|
||||
freShopList();
|
||||
});
|
||||
</script>
|
||||
{/block}
|
Reference in New Issue
Block a user