You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
98
hyhproject/wechat2/view/default/users/favorites/favorite_shop.js
Executable file
98
hyhproject/wechat2/view/default/users/favorites/favorite_shop.js
Executable file
@ -0,0 +1,98 @@
|
||||
// 获取关注的店铺
|
||||
function getFavorites(){
|
||||
$('#Load').show();
|
||||
loading = true;
|
||||
var param = {};
|
||||
param.pagesize = 10;
|
||||
param.page = Number( $('#currPage').val() ) + 1;
|
||||
$.post(WST.U('wechat/favorites/listShopQuery'), param, function(data){
|
||||
var json = WST.toJson(data.data);
|
||||
var html = '';
|
||||
if(json && json.Rows && json.Rows.length>0){
|
||||
var gettpl = document.getElementById('shopList').innerHTML;
|
||||
laytpl(gettpl).render(json.Rows, function(html){
|
||||
$('#shopBox').html(html);
|
||||
});
|
||||
|
||||
$('#currPage').val(json.CurrentPage);
|
||||
$('#totalPage').val(json.TotalPage);
|
||||
}else{
|
||||
html += '<div class="wst-prompt-icon"><img src="'+ window.conf.WECHAT +'/img/nothing-follow-shps.png"></div>';
|
||||
html += '<div class="wst-prompt-info">';
|
||||
html += '<p>您还没有关注店铺。</p>';
|
||||
html += '</div>';
|
||||
$('#shopBox').html(html);
|
||||
}
|
||||
imgShop('j-imgAdapt');
|
||||
imgShop('goodsImg');
|
||||
loading = false;
|
||||
$('#Load').hide();
|
||||
echo.init();//图片懒加载
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
function goToShop(sid){
|
||||
location.href=WST.U('wechat/shops/home','shopId='+sid);
|
||||
}
|
||||
// 全选
|
||||
function checkAll(obj){
|
||||
var chk = $(obj).prop('checked');
|
||||
$('.s-active').each(function(k,v){
|
||||
$(this).prop('checked',chk);
|
||||
});
|
||||
}
|
||||
// 取消关注
|
||||
function cancelFavorite(){
|
||||
WST.dialogHide('prompt');
|
||||
var fids = new Array();
|
||||
$('.s-active').each(function(k,v){
|
||||
if($(this).attr('checked')){
|
||||
fids.push($(this).attr('fid'));
|
||||
}
|
||||
});
|
||||
fids = fids.join(',');
|
||||
if(fids==''){
|
||||
WST.msg('请先选择店铺','info');
|
||||
return;
|
||||
}
|
||||
$.post(WST.U('wechat/favorites/cancel'),{id:fids,type:1},function(data){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
$('#currPage').val('0')
|
||||
getFavorites();
|
||||
}else{
|
||||
WST.msg(json.msg,'info');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var currPage = totalPage = 0;
|
||||
var loading = false;
|
||||
$(document).ready(function(){
|
||||
getFavorites();
|
||||
$(window).scroll(function(){
|
||||
if (loading) return;
|
||||
if ((5 + $(window).scrollTop()) >= ($(document).height() - screen.height)) {
|
||||
currPage = Number( $('#currPage').val() );
|
||||
totalPage = Number( $('#totalPage').val() );
|
||||
if( totalPage > 0 && currPage < totalPage ){
|
||||
getFavorites();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//适应图片大小正方形
|
||||
function imgShop(name){
|
||||
var w = $('.'+name).width();
|
||||
if(name == 'j-imgAdapt'){
|
||||
$('.'+name).css({"width": w+"px","height": w+"px"});
|
||||
}else{
|
||||
$('.'+name).css({"width": w+"px","height": w+20+"px"});
|
||||
}
|
||||
$('.'+name+' a').css({"width": w+"px","height": w+"px"});
|
||||
$('.'+name+' a img').css({"width": w+"px","height": w+"px"});
|
||||
$('.'+name+' a .goodsPrice').css({"width": w+"px"});
|
||||
}
|
95
hyhproject/wechat2/view/default/users/favorites/favorites.js
Executable file
95
hyhproject/wechat2/view/default/users/favorites/favorites.js
Executable file
@ -0,0 +1,95 @@
|
||||
// 获取关注的商品
|
||||
function getFavorites(){
|
||||
$('#Load').show();
|
||||
loading = true;
|
||||
var param = {};
|
||||
param.id = $('#catId').val();
|
||||
param.condition = $('#condition').val();
|
||||
param.desc = $('#desc').val();
|
||||
param.keyword = $('#searchKey').val();
|
||||
param.pagesize = 10;
|
||||
param.page = Number( $('#currPage').val() ) + 1;
|
||||
$.post(WST.U('wechat/favorites/listGoodsQuery'), param, function(data){
|
||||
var json = WST.toJson(data.data);
|
||||
var html = '';
|
||||
if(json && json.Rows && json.Rows.length>0){
|
||||
var gettpl = document.getElementById('fGoods').innerHTML;
|
||||
laytpl(gettpl).render(json.Rows, function(html){
|
||||
$('#goods-list').html(html);
|
||||
});
|
||||
$('#currPage').val(data.CurrentPage);
|
||||
$('#totalPage').val(data.TotalPage);
|
||||
}else{
|
||||
html += '<div class="wst-prompt-icon"><img src="'+ window.conf.WECHAT +'/img/nothing-follow-goods.png"></div>';
|
||||
html += '<div class="wst-prompt-info">';
|
||||
html += '<p>您还没有关注商品。</p>';
|
||||
html += '</div>';
|
||||
$('#goods-list').html(html);
|
||||
}
|
||||
WST.imgAdapt('j-imgAdapt');
|
||||
loading = false;
|
||||
$('#Load').hide();
|
||||
echo.init();//图片懒加载
|
||||
});
|
||||
}
|
||||
// 全选
|
||||
function checkAll(obj){
|
||||
var chk = $(obj).attr('checked');
|
||||
$('.active').each(function(k,v){
|
||||
$(this).prop('checked',chk);
|
||||
});
|
||||
}
|
||||
// 取消关注
|
||||
function cancelFavorite(){
|
||||
WST.dialogHide('prompt');
|
||||
var gids = new Array();
|
||||
$('.active').each(function(k,v){
|
||||
if($(this).attr('checked')){
|
||||
gids.push($(this).attr('gid'));
|
||||
}
|
||||
});
|
||||
gids = gids.join(',');
|
||||
if(gids==''){
|
||||
WST.msg('请先选择商品','info');
|
||||
return;
|
||||
}
|
||||
$.post(WST.U('wechat/favorites/cancel'),{id:gids,type:0},function(data){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
$('#currPage').val('0')
|
||||
getFavorites();
|
||||
}else{
|
||||
WST.msg(json.msg,'info');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var currPage = totalPage = 0;
|
||||
var loading = false;
|
||||
$(document).ready(function(){
|
||||
getFavorites();
|
||||
$(window).scroll(function(){
|
||||
if (loading) return;
|
||||
if ((5 + $(window).scrollTop()) >= ($(document).height() - screen.height)) {
|
||||
currPage = Number( $('#currPage').val() );
|
||||
totalPage = Number( $('#totalPage').val() );
|
||||
if( totalPage > 0 && currPage < totalPage ){
|
||||
getFavorites();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
function addCart(goodsId){
|
||||
$.post(WST.U('wechat/carts/addCart'),{goodsId:goodsId,buyNum:1},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg,'success');
|
||||
}else{
|
||||
WST.msg(json.msg,'info');
|
||||
}
|
||||
});
|
||||
}
|
74
hyhproject/wechat2/view/default/users/favorites/list_goods.html
Executable file
74
hyhproject/wechat2/view/default/users/favorites/list_goods.html
Executable file
@ -0,0 +1,74 @@
|
||||
{extend name="default/base" /}
|
||||
{block name="title"}我的关注 - {__block__}{/block}
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" href="__WECHAT__/css/favorites.css?v={$v}">
|
||||
{/block}
|
||||
{block name="header"}
|
||||
<div id="info_list">
|
||||
<header style="background:#ffffff;" class="ui-header ui-header-positive ui-border-b wst-header">
|
||||
<i class="ui-icon-return" onclick="history.back()"></i><h1>关注商品</h1>
|
||||
</header>
|
||||
{/block}
|
||||
{block name="footer"}
|
||||
<div class="ui-loading-wrap wst-Load" id="Load">
|
||||
<i class="ui-loading"></i>
|
||||
</div>
|
||||
<footer class="ui-footer wst-footer-btns" style="height:42px; border-top: 1px solid #e8e8e8;" id="footer">
|
||||
<div class="wst-toTop" id="toTop">
|
||||
<i class="wst-toTopimg"><span>顶部</span></i>
|
||||
</div>
|
||||
|
||||
<div class="ui-row-flex ui-whitespace">
|
||||
<div class="ui-col ui-col-2 favorite-tc">
|
||||
<label class="ui-checkbox">
|
||||
<input class="sactive" type="checkbox" onclick="javascript:checkAll(this);">
|
||||
</label>
|
||||
全选
|
||||
</div>
|
||||
|
||||
<div class="ui-col">
|
||||
<div class="ui-btn-wrap f-btn">
|
||||
<button class="ui-btn ui-btn-danger" onclick="WST.dialog('确认要取消关注吗','cancelFavorite()');">
|
||||
取消关注
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<input type="hidden" name="" value="" id="currPage" autocomplete="off">
|
||||
<input type="hidden" name="" value="" id="totalPage" autocomplete="off">
|
||||
<script id="fGoods" type="text/html">
|
||||
{{# for(var i=0; i<d.length; i++){ }}
|
||||
<div class="ui-row-flex wst-shl-list" >
|
||||
<label class="ui-checkbox">
|
||||
<input class="active" type="checkbox" gId="{{d[i].favoriteId}}" onclick="javascript:WST.changeIconStatus($(this), 1);">
|
||||
</label>
|
||||
|
||||
<div class="ui-col">
|
||||
<div class="img j-imgAdapt">
|
||||
<a href="javascript:void(0);" onclick="javascript:WST.intoGoods({{d[i].goodsId}});">
|
||||
<img src="__ROOT__/{{WST.conf.GOODS_LOGO}}" data-echo="__ROOT__/{{d[i].goodsImg}}" title="{{d[i].shopName}}"></a></div>
|
||||
</div>
|
||||
<div class="ui-col ui-col-2 info">
|
||||
<div class="title ui-nowrap-multi" onclick="javascript:WST.intoGoods({{d[i].goodsId}});">{{d[i].goodsName}}</div>
|
||||
<p class="price"><span>¥ </span>{{d[i].shopPrice}}</p>
|
||||
<p class="deal">成交数:{{d[i].saleNum}}</p><span class="add-cart" onclick="addCart({{d[i].goodsId}})"></span>
|
||||
</div>
|
||||
</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
<section class="ui-container info-prompt">
|
||||
<ul class="ui-tab-content">
|
||||
<li id="goods-list"></li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="include"}
|
||||
{include file="default/dialog" /}<!-- 对话框模板 -->
|
||||
{/block}
|
||||
{block name="js"}
|
||||
<script type='text/javascript' src='__WECHAT__/users/favorites/favorites.js?v={$v}'></script>
|
||||
{/block}
|
92
hyhproject/wechat2/view/default/users/favorites/list_shops.html
Executable file
92
hyhproject/wechat2/view/default/users/favorites/list_shops.html
Executable file
@ -0,0 +1,92 @@
|
||||
{extend name="default/base" /}
|
||||
{block name="title"}关注店铺 - {__block__}{/block}
|
||||
{block name="css"}
|
||||
<link rel="stylesheet" href="__WECHAT__/css/favorites.css?v={$v}">
|
||||
{/block}
|
||||
{block name="header"}
|
||||
<div id="info_list">
|
||||
<header style="background:#ffffff;" class="ui-header ui-header-positive ui-border-b wst-header">
|
||||
<i class="ui-icon-return" onclick="history.back()"></i><h1>关注店铺</h1>
|
||||
</header>
|
||||
{/block}
|
||||
{block name="footer"}
|
||||
<div class="ui-loading-wrap wst-Load" id="Load">
|
||||
<i class="ui-loading"></i>
|
||||
</div>
|
||||
<footer class="ui-footer wst-footer-btns" style="height:42px; border-top: 1px solid #e8e8e8;" id="footer">
|
||||
<div class="wst-toTop" id="toTop">
|
||||
<i class="wst-toTopimg"><span>顶部</span></i>
|
||||
</div>
|
||||
|
||||
<div class="ui-row-flex ui-whitespace">
|
||||
<div class="ui-col ui-col-2 favorite-tc">
|
||||
<label class="ui-checkbox">
|
||||
<input class="sactive" type="checkbox" onclick="javascript:checkAll(this);">
|
||||
</label>
|
||||
全选
|
||||
</div>
|
||||
|
||||
<div class="ui-col">
|
||||
<div class="ui-btn-wrap f-btn">
|
||||
<button class="ui-btn ui-btn-danger" onclick="WST.dialog('确认要取消关注吗','cancelFavorite()');">
|
||||
取消关注
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</footer>
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<input type="hidden" name="" value="" id="currPage" autocomplete="off">
|
||||
<input type="hidden" name="" value="" id="totalPage" autocomplete="off">
|
||||
|
||||
<script id="shopList" type="text/html">
|
||||
{{# for(var i = 0; i < d.length; i++){ }}
|
||||
<div class="ui-row-flex ui-whitespace ui-row-flex-ver shop-box">
|
||||
<div class="ui-col f-shop-header">
|
||||
<div class="ui-row-flex ui-whitespace">
|
||||
<div class="ui-col ui-col-3">
|
||||
<label class="ui-checkbox f-chk">
|
||||
<input class="s-active" type="checkbox" fId="{{d[i].favoriteId}}" onclick="javascript:WST.changeIconStatus($(this), 1);">
|
||||
</label>
|
||||
<div class="shopImg j-imgAdapt">
|
||||
<a href="javascript:void(0);" onclick="goToShop({{d[i].shopId}})"><img src="__ROOT__/{:WSTConf('CONF.goodsLogo')}" data-echo="__ROOT__/{{ d[i].shopImg }}" title="{{ d[i].shopName }}"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-col ui-col-2" onclick="goToShop({{d[i].shopId}})">
|
||||
<div class="f-shopname ui-nowrap ui-whitespace">{{d[i].shopName}}</div>
|
||||
|
||||
</div>
|
||||
<div class="ui-col ui-col-3 f-goshops" onclick="goToShop({{d[i].shopId}})">
|
||||
<a href="javascript:void(0);" onclick="goToShop({{d[i].shopId}})"><span class="wst-action">进入店铺</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-row-flex goods-box">
|
||||
{{# var gLength = Math.min(d[i].goods.length,4) }}
|
||||
{{# for(var g=0;g<gLength;++g){ }}
|
||||
<div class="goodsImg"><a href="javascript:void(0);" onclick="WST.intoGoods({{d[i].goods[g].goodsId}})"><img src="__ROOT__/{:WSTConf('CONF.goodsLogo')}" data-echo="__ROOT__/{{WST.replaceImg(d[i].goods[g].goodsImg,'_m_thumb')}}">
|
||||
<p class="goodsPrice ui-nowrap"><span>¥ </span>{{d[i].goods[g].shopPrice}}</p></a>
|
||||
</div>
|
||||
{{# } }}
|
||||
|
||||
</div>
|
||||
<div class="wst-clear"></div>
|
||||
</div>
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<section class="ui-container" id="shopBox">
|
||||
|
||||
</section>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="include"}
|
||||
{include file="default/dialog" /}<!-- 对话框模板 -->
|
||||
{/block}
|
||||
{block name="js"}
|
||||
<script type='text/javascript' src='__WECHAT__/users/favorites/favorite_shop.js?v={$v}'></script>
|
||||
{/block}
|
Reference in New Issue
Block a user