You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
288
hyhproject/home/view/default/js/apply.js
Executable file
288
hyhproject/home/view/default/js/apply.js
Executable file
@ -0,0 +1,288 @@
|
||||
function initStep2(businessAreaPath,shopAreaIdPath){
|
||||
if(businessAreaPath!=''){
|
||||
var areaIdPath = businessAreaPath.split("_");
|
||||
$('#area_0').val(areaIdPath[0]);
|
||||
var aopts = {id:'area_0',val:areaIdPath[0],childIds:areaIdPath,className:'j-areas',isRequire:true}
|
||||
WST.ITSetAreas(aopts);
|
||||
}
|
||||
if(shopAreaIdPath!=''){
|
||||
var areaIdPath = shopAreaIdPath.split("_");
|
||||
$('#carea_0').val(areaIdPath[0]);
|
||||
var aopts = {id:'carea_0',val:areaIdPath[0],childIds:areaIdPath,className:'j-careas',isRequire:true}
|
||||
WST.ITSetAreas(aopts);
|
||||
}
|
||||
WST.upload({
|
||||
pick:'#legalCertificateImgPicker',
|
||||
formData: {dir:'shops'},
|
||||
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
|
||||
callback:function(f){
|
||||
var json = WST.toJson(f);
|
||||
if(json.status==1){
|
||||
$('#legalCertificateImgMsg').empty().hide();
|
||||
$('#legalCertificateImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show();
|
||||
$('#legalCertificateImg').val(json.savePath+json.name);
|
||||
$('#msg_legalCertificateImg').hide();
|
||||
}
|
||||
},
|
||||
progress:function(rate){
|
||||
$('#legalCertificateImgMsg').show().html('已上传'+rate+"%");
|
||||
}
|
||||
});
|
||||
WST.upload({
|
||||
pick:'#businessLicenceImgPicker',
|
||||
formData: {dir:'shops'},
|
||||
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
|
||||
callback:function(f){
|
||||
var json = WST.toJson(f);
|
||||
if(json.status==1){
|
||||
$('#businessLicenceImgMsg').empty().hide();
|
||||
$('#businessLicenceImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show();
|
||||
$('#businessLicenceImg').val(json.savePath+json.name);
|
||||
$('#msg_businessLicenceImg').hide();
|
||||
}
|
||||
},
|
||||
progress:function(rate){
|
||||
$('#businessLicenceImgMsg').show().html('已上传'+rate+"%");
|
||||
}
|
||||
});
|
||||
WST.upload({
|
||||
pick:'#bankAccountPermitImgPicker',
|
||||
formData: {dir:'shops'},
|
||||
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
|
||||
callback:function(f){
|
||||
var json = WST.toJson(f);
|
||||
if(json.status==1){
|
||||
$('#bankAccountPermitImgMsg').empty().hide();
|
||||
$('#bankAccountPermitImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show();
|
||||
$('#bankAccountPermitImg').val(json.savePath+json.name);
|
||||
$('#msg_bankAccountPermitImg').hide();
|
||||
}
|
||||
},
|
||||
progress:function(rate){
|
||||
$('#bankAccountPermitImgMsg').show().html('已上传'+rate+"%");
|
||||
}
|
||||
});
|
||||
WST.upload({
|
||||
pick:'#organizationCodeImgPicker',
|
||||
formData: {dir:'shops'},
|
||||
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
|
||||
callback:function(f){
|
||||
var json = WST.toJson(f);
|
||||
if(json.status==1){
|
||||
$('#organizationCodeImgMsg').empty().hide();
|
||||
$('#organizationCodeImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show();
|
||||
$('#organizationCodeImg').val(json.savePath+json.name);
|
||||
$('#msg_organizationCodeImg').hide();
|
||||
}
|
||||
},
|
||||
progress:function(rate){
|
||||
$('#organizationCodeImgMsg').show().html('已上传'+rate+"%");
|
||||
}
|
||||
});
|
||||
}
|
||||
function delVO(obj){
|
||||
$(obj).parent().remove();
|
||||
}
|
||||
function initStep3(areaPath){
|
||||
if(areaPath!=''){
|
||||
var areaIdPath = areaPath.split("_");
|
||||
$('#barea_0').val(areaIdPath[0]);
|
||||
var aopts = {id:'barea_0',val:areaIdPath[0],childIds:areaIdPath,className:'j-bareas',isRequire:true}
|
||||
WST.ITSetAreas(aopts);
|
||||
}
|
||||
var uploader = WST.upload({
|
||||
pick:'#taxRegistrationCertificateImgPicker',
|
||||
formData: {dir:'shops'},
|
||||
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
|
||||
fileNumLimit:3,
|
||||
callback:function(f,file){
|
||||
var json = WST.toJson(f);
|
||||
if(json.status==1){
|
||||
$('#taxRegistrationCertificateImgMsg').empty().hide();
|
||||
var tdiv = $("<div style='width:75px;float:left;margin-right:5px;'>"+
|
||||
"<img class='step_pic"+"' width='75' height='75' src='"+WST.conf.IMGURL+"/"+json.savePath+json.thumb+"' v='"+json.savePath+json.name+"'></div>");
|
||||
var btn = $('<div style="position:relative;top:-80px;left:60px;cursor:pointer;" ><img src="'+WST.conf.ROOT+'/hyhproject/home/view/default/img/seller_icon_error.png"></div>');
|
||||
tdiv.append(btn);
|
||||
$('#taxRegistrationCertificateImgBox').append(tdiv);
|
||||
$('#msg_taxRegistrationCertificateImg').hide();
|
||||
var imgPath = [];
|
||||
$('.step_pic').each(function(){
|
||||
imgPath.push($(this).attr('v'));
|
||||
});
|
||||
$('#taxRegistrationCertificateImg').val(imgPath.join(','));
|
||||
btn.on('click','img',function(){
|
||||
uploader.removeFile(file);
|
||||
$(this).parent().parent().remove();
|
||||
uploader.refresh();
|
||||
if($('#taxRegistrationCertificateImgBox').children().size()<=0){
|
||||
$('#msg_taxRegistrationCertificateImg').show();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
},
|
||||
progress:function(rate){
|
||||
$('#taxRegistrationCertificateImgMsg').show().html('已上传'+rate+"%");
|
||||
}
|
||||
});
|
||||
WST.upload({
|
||||
pick:'#taxpayerQualificationImgPicker',
|
||||
formData: {dir:'shops'},
|
||||
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
|
||||
callback:function(f){
|
||||
var json = WST.toJson(f);
|
||||
if(json.status==1){
|
||||
$('#taxpayerQualificationImgMsg').empty().hide();
|
||||
$('#taxpayerQualificationImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show();
|
||||
$('#taxpayerQualificationImg').val(json.savePath+json.name);
|
||||
$('#msg_taxpayerQualificationImg').hide();
|
||||
}
|
||||
},
|
||||
progress:function(rate){
|
||||
$('#taxpayerQualificationImgMsg').show().html('已上传'+rate+"%");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initStep4(){
|
||||
WST.upload({
|
||||
pick:'#shopImgPicker',
|
||||
formData: {dir:'shops'},
|
||||
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
|
||||
callback:function(f){
|
||||
var json = WST.toJson(f);
|
||||
if(json.status==1){
|
||||
$('#shopImgMsg').empty().hide();
|
||||
$('#shopImgPreview').attr('src',WST.conf.IMGURL+"/"+json.savePath+json.thumb).show();
|
||||
$('#shopImg').val(json.savePath+json.name);
|
||||
$('#msg_shopImg').hide();
|
||||
}
|
||||
},
|
||||
progress:function(rate){
|
||||
$('#shopImgMsg').show().html('已上传'+rate+"%");
|
||||
}
|
||||
});
|
||||
initTime('#serviceStartTime',$('#serviceStartTime').attr('v'));
|
||||
initTime('#serviceEndTime',$('#serviceEndTime').attr('v'));
|
||||
}
|
||||
function initTime(id,val){
|
||||
var html = [],t0,t1;
|
||||
var str = val.split(':');
|
||||
for(var i=0;i<24;i++){
|
||||
t0 = (val.indexOf(':00')>-1 && (parseInt(str[0],10)==i))?'selected':'';
|
||||
t1 = (val.indexOf(':30')>-1 && (parseInt(str[0],10)==i))?'selected':'';
|
||||
html.push('<option value="'+i+':00" '+t0+'>'+i+':00</option>');
|
||||
html.push('<option value="'+i+':30" '+t1+'>'+i+':30</option>');
|
||||
}
|
||||
$(id).append(html.join(''));
|
||||
}
|
||||
function checkProtocol(obj){
|
||||
if(obj.checked){
|
||||
$('.msg-box').hide();
|
||||
}else{
|
||||
$('.msg-box').show();
|
||||
}
|
||||
}
|
||||
function saveStep1(){
|
||||
if($('#protocol')[0].checked){
|
||||
location.href=WST.U('home/shops/joinStep2');
|
||||
}else{
|
||||
$('.msg-box').show();
|
||||
}
|
||||
}
|
||||
function saveStep2(){
|
||||
$('#applyFrom').isValid(function(v){
|
||||
if(v){
|
||||
var params = WST.getParams('.a-ipt');
|
||||
var load = WST.load({msg:'正在提交请求,请稍后...'});
|
||||
$.post(WST.U('home/shops/saveStep2'),params,function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
location.href = WST.U('home/shops/joinStep3');
|
||||
}else{
|
||||
layer.close(load);
|
||||
WST.msg(json.msg,{icon:5});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function saveStep3(){
|
||||
$('#applyFrom').isValid(function(v){
|
||||
if(v){
|
||||
var p= $('.file-panel').text();
|
||||
if(p!=""){
|
||||
WST.msg('请先上传补充材料',{icon:6});
|
||||
return;
|
||||
}
|
||||
var params = WST.getParams('.a-ipt');
|
||||
if((params.isLongbusinessDate=='' || params.isLongbusinessDate==0) && params.businessEndDate==''){
|
||||
WST.msg('请选择营业期限结束日期',{icon:5});
|
||||
return;
|
||||
}
|
||||
if((params.isLonglegalCertificateDate=='' || params.isLonglegalCertificateDate==0) && params.legalCertificateEndDate==''){
|
||||
WST.msg('请选择法定代表人证件有效期结束日期',{icon:5});
|
||||
return;
|
||||
}
|
||||
// if((params.isLongOrganizationCodeDate=='' || params.isLongOrganizationCodeDate==0) && params.organizationCodeEndDate==''){
|
||||
// WST.msg('请选择组织机构代码证有效期结束日期',{icon:5});
|
||||
// return;
|
||||
// }
|
||||
params.businessAreaPath0 = WST.ITGetAreaVal('j-areas');
|
||||
params.areaIdPath0 = WST.ITGetAreaVal('j-careas');
|
||||
var shopAds = [];
|
||||
$('.j-gallery-img').each(function(){
|
||||
shopAds.push($(this).attr('v'));
|
||||
});
|
||||
var a=$('.info').text();
|
||||
|
||||
params.shopAds = shopAds.join(',');
|
||||
var load = WST.load({msg:'正在提交请求,请稍后...'});
|
||||
$.post(WST.U('home/shops/saveStep3'),params,function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
location.href = WST.U('home/shops/joinStep4');
|
||||
}else{
|
||||
layer.close(load);
|
||||
WST.msg(json.msg,{icon:5});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function saveStep4(){
|
||||
$('#applyFrom').isValid(function(v){
|
||||
if(v){
|
||||
var load = WST.load({msg:'正在提交请求,请稍后...'});
|
||||
var params = WST.getParams('.a-ipt');
|
||||
params.bankAreaId = WST.ITGetAreaVal('j-bareas');
|
||||
$.post(WST.U('home/shops/saveStep4'),params,function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
location.href = WST.U('home/shops/joinStep5');
|
||||
}else{
|
||||
layer.close(load);
|
||||
WST.msg(json.msg,{icon:5});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function saveStep5(){
|
||||
$('#applyFrom').isValid(function(v){
|
||||
if(v){
|
||||
var load = WST.load({msg:'正在提交入驻请求,请稍后...'});
|
||||
var params = WST.getParams('.a-ipt');
|
||||
$.post(WST.U('home/shops/saveStep5'),params,function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
location.href = WST.U('home/shops/joinSuccess');
|
||||
}else{
|
||||
layer.close(load);
|
||||
WST.msg(json.msg,{icon:5});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
33
hyhproject/home/view/default/js/brandslist.js
Executable file
33
hyhproject/home/view/default/js/brandslist.js
Executable file
@ -0,0 +1,33 @@
|
||||
//滑过效果
|
||||
var nodes = document.querySelectorAll('.wst-brands'), _nodes = [].slice.call(nodes, 0);
|
||||
var getDirection = function (ev, obj) {
|
||||
var w = obj.offsetWidth, h = obj.offsetHeight, x = ev.pageX - obj.offsetLeft - w / 2 * (w > h ? h / w : 1), y = ev.pageY - obj.offsetTop - h / 2 * (h > w ? w / h : 1), d = Math.round(Math.atan2(y, x) / 1.57079633 + 5) % 4;
|
||||
return d;
|
||||
};
|
||||
var addClass = function (ev, obj, state) {
|
||||
var direction = getDirection(ev, obj), class_suffix = '';
|
||||
obj.className = '';
|
||||
switch (direction) {
|
||||
case 0:
|
||||
class_suffix = '-top';
|
||||
break;
|
||||
case 1:
|
||||
class_suffix = '-right';
|
||||
break;
|
||||
case 2:
|
||||
class_suffix = '-bottom';
|
||||
break;
|
||||
case 3:
|
||||
class_suffix = '-left';
|
||||
break;
|
||||
}
|
||||
obj.classList.add(state + class_suffix);
|
||||
};
|
||||
_nodes.forEach(function (el) {
|
||||
el.addEventListener('mouseover', function (ev) {
|
||||
addClass(ev, this, 'in');
|
||||
}, false);
|
||||
el.addEventListener('mouseout', function (ev) {
|
||||
addClass(ev, this, 'out');
|
||||
}, false);
|
||||
});
|
683
hyhproject/home/view/default/js/carts.js
Executable file
683
hyhproject/home/view/default/js/carts.js
Executable file
@ -0,0 +1,683 @@
|
||||
var promotionMethod = {};
|
||||
function checkChks(obj,cobj){
|
||||
WST.checkChks(obj,cobj);
|
||||
var ids = [];
|
||||
$(cobj).each(function(){
|
||||
id = $(this).val();
|
||||
if(obj.checked){
|
||||
$(this).addClass('selected');
|
||||
}else{
|
||||
$(this).removeClass('selected');
|
||||
}
|
||||
var cid = $(this).find(".j-chk").val();
|
||||
if(cid!='' && typeof(cid)!='undefined'){
|
||||
ids.push(cid);
|
||||
statCartMoney();
|
||||
}
|
||||
});
|
||||
batchChangeCartGoods(ids.join(','),obj.checked?1:0);
|
||||
}
|
||||
function batchChangeCartGoods(ids,isCheck){
|
||||
$.post(WST.U('home/carts/batchChangeCartGoods'),{ids:ids,isCheck:isCheck,rnd:Math.random()},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status!=1){
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
function statCartMoney(){
|
||||
var cartMoney = 0,goodsTotalPrice,id;
|
||||
$('.j-gchk').each(function(){
|
||||
id = $(this).val();
|
||||
goodsTotalPrice = parseFloat($(this).attr('mval'))*parseInt($('#buyNum_'+id).val());
|
||||
$('#tprice_'+id).html(goodsTotalPrice.toFixed(2));
|
||||
if($(this).prop('checked')){
|
||||
cartMoney = cartMoney + goodsTotalPrice;
|
||||
}
|
||||
});
|
||||
var minusMoney = 0;
|
||||
for(var key in promotionMethod){
|
||||
minusMoney = window[key](cartMoney);
|
||||
cartMoney = cartMoney - minusMoney;
|
||||
}
|
||||
$('#totalMoney').html(cartMoney.toFixed(2));
|
||||
checkGoodsBuyStatus();
|
||||
}
|
||||
function checkGoodsBuyStatus(){
|
||||
var cartNum = 0,stockNum = 0,cartId = 0;
|
||||
$('.j-gchk').each(function(){
|
||||
cartId = $(this).val();
|
||||
cartNum = parseInt($('#buyNum_'+cartId).val(),10);
|
||||
stockNum = parseInt($(this).attr('sval'),10);;
|
||||
if(stockNum < 0 || stockNum < cartNum){
|
||||
if($(this).prop('checked')){
|
||||
$(this).parent().parent().css('border','2px solid red');
|
||||
}else{
|
||||
$(this).parent().parent().css('border','0px solid #eeeeee');
|
||||
$(this).parent().parent().css('border-bottom','1px solid #eeeeee');
|
||||
}
|
||||
if(stockNum < 0){
|
||||
$('#gchk_'+cartId).attr('allowbuy',0);
|
||||
$('#err_'+cartId).css('color','red').html('库存不足');
|
||||
}else{
|
||||
$('#gchk_'+cartId).attr('allowbuy',1);
|
||||
$('#err_'+cartId).css('color','red').html('购买量超过库存');
|
||||
}
|
||||
}else{
|
||||
$('#gchk_'+cartId).attr('allowbuy',10);
|
||||
$(this).parent().parent().css('border','0px solid #eeeeee');
|
||||
$(this).parent().parent().css('border-bottom','1px solid #eeeeee');
|
||||
$('#err_'+cartId).html('');
|
||||
}
|
||||
});
|
||||
}
|
||||
function toSettlement(){
|
||||
var isChk = false;
|
||||
$('.j-gchk').each(function(){
|
||||
if($(this).prop('checked'))isChk = true;
|
||||
});
|
||||
if(!isChk){
|
||||
WST.msg('请选择要结算的商品!',{icon:1});
|
||||
return;
|
||||
}
|
||||
var msg = '';
|
||||
$('.j-gchk').each(function(){
|
||||
if($(this).prop('checked')){
|
||||
if($(this).attr('allowbuy')==0){
|
||||
msg = '所选商品库存不足';
|
||||
return;
|
||||
}else if($(this).attr('allowbuy')==1){
|
||||
msg = '所选商品购买量大于商品库存';
|
||||
return;
|
||||
}
|
||||
}
|
||||
})
|
||||
if(msg!=''){
|
||||
WST.msg(msg,{icon:2});
|
||||
return;
|
||||
}
|
||||
location.href=WST.U('home/carts/settlement');
|
||||
}
|
||||
|
||||
function addrBoxOver(t){
|
||||
$(t).addClass('radio-box-hover');
|
||||
$(t).find('.operate-box').show();
|
||||
}
|
||||
function addrBoxOut(t){
|
||||
$(t).removeClass('radio-box-hover');
|
||||
$(t).find('.operate-box').hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function setDeaultAddr(id){
|
||||
$.post(WST.U('home/useraddress/setDefault'),{id:id},function(data){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
getAddressList();
|
||||
changeAddrId(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function changeAddrId(id){
|
||||
$.post(WST.U('home/useraddress/getById'),{id:id},function(data){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
inEffect($('#addr-'+id),1);
|
||||
$('#s_addressId').val(json.data.addressId);
|
||||
$("select[id^='area_0_']").remove();
|
||||
var areaIdPath = json.data.areaIdPath.split("_");
|
||||
// 设置收货地区市级id
|
||||
$('#s_areaId').val(areaIdPath[1]);
|
||||
|
||||
$('#area_0').val(areaIdPath[0]);
|
||||
// 计算运费
|
||||
getCartMoney();
|
||||
var aopts = {id:'area_0',val:areaIdPath[0],childIds:areaIdPath,className:'j-areas'}
|
||||
WST.ITSetAreas(aopts);
|
||||
WST.setValues(json.data);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function delAddr(id){
|
||||
WST.confirm({content:'您确定要删除该地址吗?',yes:function(index){
|
||||
$.post(WST.U('home/useraddress/del'),{id:id},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg,{icon:1});
|
||||
getAddressList();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
|
||||
function getAddressList(obj){
|
||||
var id = $('#s_addressId').val();
|
||||
var load = WST.load({msg:'正在加载记录,请稍后...'});
|
||||
$.post(WST.U('home/useraddress/listQuery'),{rnd:Math.random()},function(data,textStatus){
|
||||
layer.close(load);
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
if(json.data && json.data && json.data.length){
|
||||
var html = [],tmp;
|
||||
for(var i=0;i<json.data.length;i++){
|
||||
tmp = json.data[i];
|
||||
var selected = (id==tmp.addressId)?'j-selected':'';
|
||||
html.push(
|
||||
'<div class="wst-frame1 '+selected+'" onclick="javascript:changeAddrId('+tmp.addressId+')" id="addr-'+tmp.addressId+'" >'+tmp.userName+'<i></i></div>',
|
||||
'<li class="radio-box" onmouseover="addrBoxOver(this)" onmouseout="addrBoxOut(this)">',
|
||||
tmp.userName,
|
||||
' ',
|
||||
tmp.areaName+tmp.userAddress,
|
||||
' ',
|
||||
tmp.userPhone
|
||||
)
|
||||
if(tmp.isDefault==1){
|
||||
html.push(' <span class="j-default">默认地址</span>')
|
||||
}
|
||||
html.push('<div class="operate-box">');
|
||||
if(tmp.isDefault!=1){
|
||||
html.push('<a href="javascript:;" onclick="setDeaultAddr('+tmp.addressId+')">设为默认地址</a> ');
|
||||
}
|
||||
html.push('<a href="javascript:void(0)" onclick="javascript:toEditAddress('+tmp.addressId+',this,1,1)">编辑</a> ');
|
||||
if(json.data.length>1){
|
||||
html.push('<a href="javascript:void(0)" onclick="javascript:delAddr('+tmp.addressId+',this)">删除</a></div>');
|
||||
}
|
||||
html.push('<div class="wst-clear"></div>','</li>');
|
||||
}
|
||||
html.push('<a style="color:#1c9eff" onclick="editAddress()" href="javascript:;">收起地址</a>');
|
||||
|
||||
|
||||
$('#addressList').html(html.join(''));
|
||||
}else{
|
||||
$('#addressList').empty();
|
||||
}
|
||||
}else{
|
||||
$('#addressList').empty();
|
||||
}
|
||||
})
|
||||
}
|
||||
function inEffect(obj,n){
|
||||
$(obj).addClass('j-selected').siblings('.wst-frame'+n).removeClass('j-selected');
|
||||
}
|
||||
function editAddress(){
|
||||
var isNoSelected = false;
|
||||
$('.j-areas').each(function(){
|
||||
isSelected = true;
|
||||
if($(this).val()==''){
|
||||
isNoSelected = true;
|
||||
return;
|
||||
}
|
||||
})
|
||||
if(isNoSelected){
|
||||
WST.msg('请选择完整收货地址!',{icon:2});
|
||||
return;
|
||||
}
|
||||
layer.close(layerbox);
|
||||
var load = WST.load({msg:'正在提交数据,请稍后...'});
|
||||
var params = WST.getParams('.j-eipt');
|
||||
params.areaId = WST.ITGetAreaVal('j-areas');
|
||||
$.post(WST.U('home/useraddress/'+((params.addressId>0)?'toEdit':'add')),params,function(data,textStatus){
|
||||
layer.close(load);
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
$('.j-edit-box').hide();
|
||||
$('.j-list-box').hide();
|
||||
$('.j-show-box').show();
|
||||
if(params.addressId==0){
|
||||
$('#s_addressId').val(json.data.addressId);
|
||||
}else{
|
||||
$('#s_addressId').val(params.addressId);
|
||||
}
|
||||
var areaIds = WST.ITGetAllAreaVals('area_0','j-areas');
|
||||
$('#s_areaId').val(areaIds[1]);
|
||||
getCartMoney();
|
||||
var areaNames = [];
|
||||
$('.j-areas').each(function(){
|
||||
areaNames.push($('#'+$(this).attr('id')+' option:selected').text());
|
||||
})
|
||||
$('#s_userName').html(params.userName+'<i></i>');
|
||||
$('#s_address').html(params.userName+' '+areaNames.join('')+' '+params.userAddress+' '+params.userPhone);
|
||||
|
||||
$('#s_address').siblings('.operate-box').find('a').attr('onclick','toEditAddress('+params.addressId+',this,1,1,1)');
|
||||
|
||||
if(params.isDefault==1){
|
||||
$('#isdefault').html('默认地址').addClass('j-default');
|
||||
}else{
|
||||
$('#isdefault').html('').removeClass('j-default');
|
||||
}
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
var layerbox;
|
||||
function showEditAddressBox(){
|
||||
getAddressList();
|
||||
toEditAddress();
|
||||
}
|
||||
function emptyAddress(obj,n){
|
||||
inEffect(obj,n);
|
||||
$('#addressForm')[0].reset();
|
||||
$('#s_addressId').val(0);
|
||||
$('#addressId').val(0);
|
||||
$("select[id^='area_0_']").remove();
|
||||
|
||||
layerbox = layer.open({
|
||||
title:'用户地址',
|
||||
type: 1,
|
||||
area: ['800px', '300px'],
|
||||
content: $('.j-edit-box')
|
||||
});
|
||||
}
|
||||
function toEditAddress(id,obj,n,flag,type){
|
||||
inEffect(obj,n);
|
||||
id = (id>0)?id:$('#s_addressId').val();
|
||||
$.post(WST.U('home/useraddress/getById'),{id:id},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
if(flag){
|
||||
layerbox = layer.open({
|
||||
title:'用户地址',
|
||||
type: 1,
|
||||
area: ['800px', '300px'], //宽高
|
||||
content: $('.j-edit-box')
|
||||
});
|
||||
}
|
||||
if(type!=1){
|
||||
$('.j-list-box').show();
|
||||
$('.j-show-box').hide();
|
||||
}
|
||||
WST.setValues(json.data);
|
||||
$('input[name="addrUserPhone"]').val(json.data.userPhone)
|
||||
$("select[id^='area_0_']").remove();
|
||||
if(id>0){
|
||||
var areaIdPath = json.data.areaIdPath.split("_");
|
||||
$('#area_0').val(areaIdPath[0]);
|
||||
var aopts = {id:'area_0',val:areaIdPath[0],childIds:areaIdPath,className:'j-areas'}
|
||||
WST.ITSetAreas(aopts);
|
||||
}
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
function getCartMoney(){
|
||||
var params = {};
|
||||
params.isUseScore = $('#isUseScore').prop('checked')?1:0;
|
||||
params.useScore = $('#useScore').val();
|
||||
params.areaId2 = $('#s_areaId').val();
|
||||
params.recordId = $('#recordId').val();
|
||||
params.rnd = Math.random();
|
||||
params.deliverType = $('#deliverType').val();
|
||||
var couponIds = [];
|
||||
$('.j-shop').each(function(){
|
||||
couponIds.push($(this).attr('dataval')+":"+$('#couponId_'+$(this).attr('dataval')).val());
|
||||
});
|
||||
params.couponIds = couponIds.join(',');
|
||||
var load = WST.load({msg:'正在计算订单价格,请稍后...'});
|
||||
$.post(WST.U('home/carts/getCartMoney'),params,function(data,textStatus){
|
||||
layer.close(load);
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
json = json.data;
|
||||
var shopFreight = 0;
|
||||
for(var key in json.shops){
|
||||
// 设置每间店铺的运费及总价格
|
||||
$('#shopF_'+key).html(json.shops[key]['freight']);
|
||||
$('#shopC_'+key).html(json.shops[key]['goodsMoney']);
|
||||
shopFreight = shopFreight + json.shops[key]['freight'];
|
||||
}
|
||||
$('#maxScoreSpan').html(json.maxScore);
|
||||
$('#maxScoreMoneySpan').html(Math.round(json.maxScoreMoney*100) / 100);
|
||||
$('#isUseScore').attr('dataval',json.maxScore);
|
||||
$('#deliverMoney').html(shopFreight);
|
||||
$('#useScore').val(json.useScore);
|
||||
$('#scoreMoney2').html(json.scoreMoney);
|
||||
$('#totalMoney').html(json.realTotalMoney+'(含运费)');
|
||||
$('#orderScore').html((Math.round(json.realTotalMoney*100)/100));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
function changeDeliverType(n,index,obj){
|
||||
changeSelected(n,index,obj);
|
||||
getCartMoney();
|
||||
}
|
||||
function submitOrder(){
|
||||
var params = WST.getParams('.j-ipt');
|
||||
params.isUseScore = $('#isUseScore').prop('checked')?1:0
|
||||
var load = WST.load({msg:'正在提交,请稍后...'});
|
||||
$.post(WST.U('home/orders/submit'),params,function(data,textStatus){
|
||||
layer.close(load);
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg,{icon:1},function(){
|
||||
location.href=WST.U('home/orders/succeed','orderNo='+json.data);
|
||||
});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var invoicebox;
|
||||
function changeInvoice(t,str,obj){
|
||||
var param = {};
|
||||
param.isInvoice = $('#isInvoice').val();
|
||||
param.invoiceId = $('#invoiceId').val();
|
||||
var loading = WST.load({msg:'正在请求数据,请稍后...'});
|
||||
$.post(WST.U('home/invoices/index'),param,function(data){
|
||||
layer.close(loading);
|
||||
// layer弹出层
|
||||
invoicebox = layer.open({
|
||||
title:'发票信息',
|
||||
type: 1,
|
||||
area: ['628px', '420px'], //宽高
|
||||
content: data,
|
||||
success :function(){
|
||||
if(param.invoiceId>0){
|
||||
$('.inv_codebox').show();
|
||||
console.log($('#invoiceCode_'+param.invoiceId));
|
||||
$('#invoice_num').val($('#invoiceCode_'+param.invoiceId).val());
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
function layerclose(){
|
||||
layer.close(invoicebox);
|
||||
}
|
||||
|
||||
|
||||
function changeInvoiceItem(t,obj){
|
||||
$(obj).addClass('inv_li_curr').siblings().removeClass('inv_li_curr');
|
||||
$('.inv_editing').remove();// 删除正在编辑中的发票信息
|
||||
$('.inv_add').show();
|
||||
$('#invoiceId').val(t);
|
||||
if(t==0){
|
||||
// 为个人时,隐藏识别号
|
||||
$('.inv_codebox').css({display:'none'});
|
||||
$('#invoice_num').val(' ');
|
||||
}else{
|
||||
$('#invoice_num').val($('#invoiceCode_'+t).val());
|
||||
$('.inv_codebox').css({display:'block'});
|
||||
}
|
||||
$("#invoice_obj").val(t);
|
||||
}
|
||||
// 是否需要开发票
|
||||
function changeInvoiceItem1(t,obj){
|
||||
$(obj).addClass('inv_li_curr').siblings().removeClass('inv_li_curr');
|
||||
$('#isInvoice').val(t);
|
||||
}
|
||||
// 显示发票增加
|
||||
function invAdd(){
|
||||
$("#invoiceId").val(0);
|
||||
$("#invoice_obj").val(1);
|
||||
$('#invoice_num').val('');
|
||||
$('.inv_li').removeClass('inv_li_curr');// 移除当前选中样式
|
||||
$('.inv_ul').append('<li class="inv_li inv_li_curr inv_editing"><input type="text" id="invoiceHead" placeholder="新增单位发票抬头" value="" style="width:65%;height:21px;padding:1px;"><i></i><div style="top:8px;" class="inv_opabox"><a href="javascript:void(0)" onCLick="addInvoice()">保存</a></div></li>');
|
||||
$('.inv_ul').scrollTop($('.inv_ul')[0].scrollHeight);// 滚动到底部
|
||||
$('.inv_add').hide();// 隐藏新增按钮
|
||||
$('.inv_codebox').css({display:'block'});// 显示`纳税人识别号`
|
||||
}
|
||||
// 执行发票抬头新增
|
||||
function addInvoice(){
|
||||
var head = $('#invoiceHead').val();
|
||||
if(head.length==0){
|
||||
WST.msg('发票抬头不能为空');
|
||||
return;
|
||||
}
|
||||
var loading = WST.load({msg:'正在提交数据,请稍后...'});
|
||||
$.post(WST.U('home/Invoices/add'),{invoiceHead:head},function(data){
|
||||
var json = WST.toJson(data);
|
||||
layer.close(loading);
|
||||
if(json.status==1){
|
||||
$('#invoiceId').val(json.data.id);
|
||||
WST.msg(json.msg,{icon:1});
|
||||
$('.inv_editing').remove();
|
||||
var code = [];
|
||||
code.push('<li class=\'inv_li inv_li_curr\' onClick="changeInvoiceItem(\''+json.data.id+'\',this)">');
|
||||
code.push('<input type="text" value="'+head+'" readonly="readonly" class="invoice_input" id="invoiceHead_'+json.data.id+'" />');
|
||||
code.push('<input type="hidden" id="invoiceCode_'+json.data.id+'" value=""} /><i></i>');
|
||||
code.push('<div class="inv_opabox">');
|
||||
code.push('<a href=\'javascript:void(0)\' onClick="invEdit(\''+json.data.id+'\',this)" class="edit_btn">编辑</a>');
|
||||
code.push('<a href=\'javascript:void(0)\' onClick="editInvoice(\''+json.data.id+'\',this)" style="display:none;" class="save_btn">保存</a>');
|
||||
code.push('<a href=\'javascript:void(0)\' onClick="delInvoice(\''+json.data.id+'\',this)">删除</a></div></li>');
|
||||
$('.inv_li:first').after(code.join(''));
|
||||
// 显示新增按钮
|
||||
$('.inv_add').show();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 显示发票修改
|
||||
function invEdit(id,obj){
|
||||
var input = $(obj).parent().parent().find('.invoice_input');
|
||||
input.removeAttr('readonly').focus();
|
||||
input.mouseup(function(){return false});
|
||||
$(obj).parent().parent().mouseup(function(){
|
||||
input.attr('readonly','readonly');
|
||||
$(obj).show().siblings('.save_btn').hide();
|
||||
});
|
||||
$(obj).hide().siblings('.save_btn').show();
|
||||
var invoice_code = $('#invoiceCode_'+id).val();
|
||||
$('.inv_codebox').css({display:'block'})
|
||||
$('#invoice_num').val(invoice_code);// 显示`纳税人识别号`)
|
||||
}
|
||||
// 完成发票修改
|
||||
function editInvoice(id,obj){
|
||||
var head = $('#invoiceHead_'+id).val();
|
||||
if(head.length==0){
|
||||
WST.msg('发票抬头不能为空');
|
||||
return;
|
||||
}
|
||||
alert(111);
|
||||
var loading = WST.load({msg:'正在提交数据,请稍后...'});
|
||||
$.post(WST.U('home/Invoices/edit'),{invoiceHead:head,id:id},function(data){
|
||||
var json = WST.toJson(data);
|
||||
layer.close(loading);
|
||||
if(json.status==1){
|
||||
var input = $(obj).parent().parent().find('.invoice_input');
|
||||
input.attr('readonly','readonly')
|
||||
$(obj).hide().siblings('.edit_btn').show();
|
||||
WST.msg(json.msg,{icon:1});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 设置页面显示值
|
||||
function setInvoiceText(invoiceHead){
|
||||
var isInvoice = $('#isInvoice').val();
|
||||
var invoiceObj = $('#invoice_obj').val();// 发票对象
|
||||
var text = '不开发票';
|
||||
if(isInvoice==1){
|
||||
text = (invoiceObj==0)?'普通发票(纸质) 个人 明细':'普通发票(纸质)'+invoiceHead+' 明细';
|
||||
}
|
||||
$('#invoice_info').html(text);
|
||||
layerclose();
|
||||
}
|
||||
|
||||
// 保存纳税人识别号
|
||||
function saveInvoice(){
|
||||
var isInv = $('#isInvoice').val();
|
||||
var num = $('#invoice_num').val();
|
||||
var id = $('#invoiceId').val();
|
||||
var invoiceHead = $('#invoiceHead').val();// 发票抬头
|
||||
var url = WST.U('home/Invoices/add');
|
||||
var params = {};
|
||||
if(id>0){
|
||||
url = WST.U('home/Invoices/edit');
|
||||
invoiceHead = $('#invoiceHead_'+id).val();// 发票抬头
|
||||
params.id = id;
|
||||
}
|
||||
params.invoiceHead = invoiceHead;
|
||||
params.invoiceCode = num;
|
||||
if($('#invoice_obj').val()!=0){
|
||||
var loading = WST.load({msg:'正在提交数据,请稍后...'});
|
||||
$.post(url,params,function(data){
|
||||
var json = WST.toJson(data);
|
||||
layer.close(loading);
|
||||
if(json.status==1){
|
||||
// 判断用户是否需要发票
|
||||
setInvoiceText(invoiceHead);
|
||||
if(id==0)$('#invoiceId').val(json.data.id)
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
setInvoiceText('');
|
||||
}
|
||||
}
|
||||
// 删除发票信息
|
||||
function delInvoice(id,obj){
|
||||
WST.confirm({content:'您确定要删除该发票信息吗?',yes:function(index){
|
||||
$.post(WST.U('home/invoices/del'),{id:id},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg,{icon:1});
|
||||
$(obj).parent().parent().remove();
|
||||
$('#invoiceId').val(0);
|
||||
// 选中 `个人`
|
||||
$('.inv_li:first').click();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function changeSelected(n,index,obj){
|
||||
$('#'+index).val(n);
|
||||
inEffect(obj,2);
|
||||
}
|
||||
|
||||
function getPayUrl(){
|
||||
var params = {};
|
||||
params.payObj = "orderPay";
|
||||
params.orderNo = $("#orderNo").val();
|
||||
params.isBatch = $("#isBatch").val();
|
||||
params.payCode = $.trim($("#payCode").val());
|
||||
if(params.payCode==""){
|
||||
WST.msg('请先选择支付方式', {icon: 5});
|
||||
return;
|
||||
}
|
||||
|
||||
jQuery.post(WST.U('home/'+params.payCode+'/get'+params.payCode+"Url"),params,function(data) {
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
if(params.payCode=="weixinpays" || params.payCode=="wallets"){
|
||||
location.href = json.url;
|
||||
}else{
|
||||
if(params.payCode=="unionpays"){
|
||||
location.href = WST.U('home/unionpays/tounionpays',params);
|
||||
}else{
|
||||
location.href = json.url;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
WST.msg('您的订单已支付!', {icon: 5,time:1500},function(){
|
||||
window.location = WST.U('home/orders/waitReceive');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function payByWallet(){
|
||||
var params = WST.getParams('.j-ipt');
|
||||
if(window.conf.IS_CRYPT=='1'){
|
||||
var public_key=$('#token').val();
|
||||
var exponent="10001";
|
||||
var rsa = new RSAKey();
|
||||
rsa.setPublic(public_key, exponent);
|
||||
params.payPwd = rsa.encrypt(params.payPwd);
|
||||
}
|
||||
var load = WST.load({msg:'正在核对支付密码,请稍后...'});
|
||||
$.post(WST.U('home/wallets/payByWallet'),params,function(data,textStatus){
|
||||
layer.close(load);
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg, {icon: 1,time:1500},function(){
|
||||
window.location = WST.U('home/orders/waitReceive');
|
||||
});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2,time:1500});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function checkScoreBox(v){
|
||||
if(v){
|
||||
var val = $('#isUseScore').attr('dataval');
|
||||
$('#useScore').val(val);
|
||||
$('#scoreMoney').show();
|
||||
|
||||
}else{
|
||||
$('#scoreMoney').hide();
|
||||
}
|
||||
getCartMoney();
|
||||
}
|
||||
|
||||
function setPaypwd(){
|
||||
layerbox = layer.open({
|
||||
title:['设置支付密码','text-align:left'],
|
||||
type: 1,
|
||||
area: ['450px', '240px'],
|
||||
content: $('.j-paypwd-box'),
|
||||
btn: ['设置支付密码,并支付订单', '关闭'],
|
||||
yes: function(index, layero){
|
||||
var newPass = $.trim($("#payPwd").val());
|
||||
var reNewPass = $.trim($("#reNewPass").val());
|
||||
if(newPass==""){
|
||||
WST.msg("请输入支付密码!");
|
||||
return false;
|
||||
}
|
||||
if(reNewPass==""){
|
||||
WST.msg("请输入确认支付密码!");
|
||||
return false;
|
||||
}
|
||||
if(newPass!=reNewPass){
|
||||
WST.msg("密码不一致!");
|
||||
return false;
|
||||
}
|
||||
if(window.conf.IS_CRYPT=='1'){
|
||||
var public_key=$('#token').val();
|
||||
var exponent="10001";
|
||||
var rsa = new RSAKey();
|
||||
rsa.setPublic(public_key, exponent);
|
||||
newPass = rsa.encrypt(newPass);
|
||||
reNewPass = rsa.encrypt(reNewPass);
|
||||
}
|
||||
var load = WST.load({msg:'正在提交支付密码,请稍后...'});
|
||||
$.post(WST.U('home/users/payPassEdit'),{newPass:newPass,reNewPass:reNewPass},function(data,textStatus){
|
||||
layer.close(load);
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg, {icon: 1,time:1500},function(){
|
||||
layer.close(layerbox);
|
||||
payByWallet();
|
||||
});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2,time:1500});
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
},
|
||||
btn2: function(index, layero){}
|
||||
});
|
||||
}
|
256
hyhproject/home/view/default/js/carts_quick.js
Executable file
256
hyhproject/home/view/default/js/carts_quick.js
Executable file
@ -0,0 +1,256 @@
|
||||
function submitOrder(){
|
||||
var params = WST.getParams('.j-ipt');
|
||||
params.isUseScore = $('#isUseScore').prop('checked')?1:0
|
||||
var load = WST.load({msg:'正在提交,请稍后...'});
|
||||
$.post(WST.U('home/orders/quickSubmit'),params,function(data,textStatus){
|
||||
layer.close(load);
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg,{icon:1},function(){
|
||||
location.href=WST.U('home/orders/succeed','orderNo='+json.data);
|
||||
});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function inEffect(obj,n){
|
||||
$(obj).addClass('j-selected').siblings('.wst-frame'+n).removeClass('j-selected');
|
||||
}
|
||||
function changeSelected(n,index,obj){
|
||||
$('#'+index).val(n);
|
||||
inEffect(obj,2);
|
||||
}
|
||||
function getCartMoney(){
|
||||
var params = {};
|
||||
params.isUseScore = $('#isUseScore').prop('checked')?1:0;
|
||||
params.useScore = $('#useScore').val();
|
||||
params.rnd = Math.random();
|
||||
params.deliverType = 1;
|
||||
var couponIds = [];
|
||||
$('.j-shop').each(function(){
|
||||
couponIds.push($(this).attr('dataval')+":"+$('#couponId_'+$(this).attr('dataval')).val());
|
||||
});
|
||||
params.couponIds = couponIds.join(',');
|
||||
var load = WST.load({msg:'正在计算订单价格,请稍后...'});
|
||||
$.post(WST.U('home/carts/getQuickCartMoney'),params,function(data,textStatus){
|
||||
layer.close(load);
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
json = json.data;
|
||||
for(var key in json.shops){
|
||||
$('#shopC_'+key).html(json.shops[key]['goodsMoney']);
|
||||
}
|
||||
$('#maxScoreSpan').html(json.maxScore);
|
||||
$('#maxScoreMoneySpan').html(json.maxScoreMoney);
|
||||
$('#isUseScore').attr('dataval',json.maxScore);
|
||||
$('#useScore').val(json.useScore);
|
||||
$('#scoreMoney2').html(json.scoreMoney);
|
||||
$('#totalMoney').html(json.realTotalMoney);
|
||||
}
|
||||
});
|
||||
}
|
||||
function checkScoreBox(v){
|
||||
if(v){
|
||||
var val = $('#isUseScore').attr('dataval');
|
||||
$('#useScore').val(val);
|
||||
$('#scoreMoney').show();
|
||||
}else{
|
||||
$('#scoreMoney').hide();
|
||||
}
|
||||
getCartMoney();
|
||||
}
|
||||
|
||||
|
||||
var invoicebox;
|
||||
function changeInvoice(t,str,obj){
|
||||
var param = {};
|
||||
param.isInvoice = $('#isInvoice').val();
|
||||
param.invoiceId = $('#invoiceId').val();
|
||||
var loading = WST.load({msg:'正在请求数据,请稍后...'});
|
||||
$.post(WST.U('home/invoices/index'),param,function(data){
|
||||
layer.close(loading);
|
||||
// layer弹出层
|
||||
invoicebox = layer.open({
|
||||
title:'发票信息',
|
||||
type: 1,
|
||||
area: ['628px', '420px'], //宽高
|
||||
content: data,
|
||||
success :function(){
|
||||
if(param.invoiceId>0){
|
||||
$('.inv_codebox').show();
|
||||
console.log($('#invoiceCode_'+param.invoiceId));
|
||||
$('#invoice_num').val($('#invoiceCode_'+param.invoiceId).val());
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
function layerclose(){
|
||||
layer.close(invoicebox);
|
||||
}
|
||||
|
||||
|
||||
function changeInvoiceItem(t,obj){
|
||||
$(obj).addClass('inv_li_curr').siblings().removeClass('inv_li_curr');
|
||||
$('.inv_editing').remove();// 删除正在编辑中的发票信息
|
||||
$('.inv_add').show();
|
||||
$('#invoiceId').val(t);
|
||||
if(t==0){
|
||||
// 为个人时,隐藏识别号
|
||||
$('.inv_codebox').css({display:'none'});
|
||||
$('#invoice_num').val(' ');
|
||||
}else{
|
||||
$('#invoice_num').val($('#invoiceCode_'+t).val());
|
||||
$('.inv_codebox').css({display:'block'});
|
||||
}
|
||||
$("#invoice_obj").val(t);
|
||||
}
|
||||
// 是否需要开发票
|
||||
function changeInvoiceItem1(t,obj){
|
||||
$(obj).addClass('inv_li_curr').siblings().removeClass('inv_li_curr');
|
||||
$('#isInvoice').val(t);
|
||||
}
|
||||
// 显示发票增加
|
||||
function invAdd(){
|
||||
$("#invoiceId").val(0);
|
||||
$("#invoice_obj").val(1);
|
||||
$('#invoice_num').val('');
|
||||
$('.inv_li').removeClass('inv_li_curr');// 移除当前选中样式
|
||||
$('.inv_ul').append('<li class="inv_li inv_li_curr inv_editing"><input type="text" id="invoiceHead" placeholder="新增单位发票抬头" value="" style="width:65%;height:20px;padding:1px;"><i></i><div style="top:8px;" class="inv_opabox"><a href="javascript:void(0)" onCLick="addInvoice()">保存</a></div></li>');
|
||||
$('.inv_ul').scrollTop($('.inv_ul')[0].scrollHeight);// 滚动到底部
|
||||
$('.inv_add').hide();// 隐藏新增按钮
|
||||
$('.inv_codebox').css({display:'block'});// 显示`纳税人识别号`
|
||||
}
|
||||
// 执行发票抬头新增
|
||||
function addInvoice(){
|
||||
var head = $('#invoiceHead').val();
|
||||
if(head.length==0){
|
||||
WST.msg('发票抬头不能为空');
|
||||
return;
|
||||
}
|
||||
var loading = WST.load({msg:'正在提交数据,请稍后...'});
|
||||
$.post(WST.U('home/Invoices/add'),{invoiceHead:head},function(data){
|
||||
var json = WST.toJson(data);
|
||||
layer.close(loading);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg,{icon:1});
|
||||
$('.inv_editing').remove();
|
||||
var code = [];
|
||||
code.push('<li class=\'inv_li inv_li_curr\' onClick="changeInvoiceItem(\''+json.data.id+'\',this)">');
|
||||
code.push('<input type="text" value="'+head+'" readonly="readonly" class="invoice_input" id="invoiceHead_'+json.data.id+'" />');
|
||||
code.push('<input type="hidden" id="invoiceCode_'+json.data.id+'" value=""} /><i></i>');
|
||||
code.push('<div class="inv_opabox">');
|
||||
code.push('<a href=\'javascript:void(0)\' onClick="invEdit(\''+json.data.id+'\',this)" class="edit_btn">编辑</a>');
|
||||
code.push('<a href=\'javascript:void(0)\' onClick="editInvoice(\''+json.data.id+'\',this)" style="display:none;" class="save_btn">保存</a>');
|
||||
code.push('<a href=\'javascript:void(0)\' onClick="delInvoice(\''+json.data.id+'\',this)">删除</a></div></li>');
|
||||
$('.inv_li:first').after(code.join(''));
|
||||
// 显示新增按钮
|
||||
$('.inv_add').show();
|
||||
// 修改invoiceId
|
||||
$('#invoiceId').val(json.data.id);
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
// 显示发票修改
|
||||
function invEdit(id,obj){
|
||||
var input = $(obj).parent().parent().find('.invoice_input');
|
||||
input.removeAttr('readonly').focus();
|
||||
input.mouseup(function(){return false});
|
||||
$(obj).parent().parent().mouseup(function(){
|
||||
input.attr('readonly','readonly');
|
||||
$(obj).show().siblings('.save_btn').hide();
|
||||
});
|
||||
$(obj).hide().siblings('.save_btn').show();
|
||||
var invoice_code = $('#invoiceCode_'+id).val();
|
||||
$('.inv_codebox').css({display:'block'})
|
||||
$('#invoice_num').val(invoice_code);// 显示`纳税人识别号`)
|
||||
}
|
||||
// 完成发票修改
|
||||
function editInvoice(id,obj){
|
||||
var head = $('#invoiceHead_'+id).val();
|
||||
if(head.length==0){
|
||||
WST.msg('发票抬头不能为空');
|
||||
return;
|
||||
}
|
||||
var loading = WST.load({msg:'正在提交数据,请稍后...'});
|
||||
$.post(WST.U('home/Invoices/edit'),{invoiceHead:head,id:id},function(data){
|
||||
var json = WST.toJson(data);
|
||||
layer.close(loading);
|
||||
if(json.status==1){
|
||||
var input = $(obj).parent().parent().find('.invoice_input');
|
||||
input.attr('readonly','readonly')
|
||||
$(obj).hide().siblings('.edit_btn').show();
|
||||
WST.msg(json.msg,{icon:1});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 设置页面显示值
|
||||
function setInvoiceText(invoiceHead){
|
||||
var isInvoice = $('#isInvoice').val();
|
||||
var invoiceObj = $('#invoice_obj').val();// 发票对象
|
||||
var text = '不开发票';
|
||||
if(isInvoice==1){
|
||||
text = (invoiceObj==0)?'普通发票(纸质) 个人 明细':'普通发票(纸质)'+invoiceHead+' 明细';
|
||||
}
|
||||
$('#invoice_info').html(text);
|
||||
layerclose();
|
||||
}
|
||||
|
||||
|
||||
// 保存纳税人识别号
|
||||
function saveInvoice(){
|
||||
var isInv = $('#isInvoice').val();
|
||||
var num = $('#invoice_num').val();
|
||||
var id = $('#invoiceId').val();
|
||||
var invoiceHead = $('#invoiceHead').val();// 发票抬头
|
||||
var url = WST.U('home/Invoices/add');
|
||||
var params = {};
|
||||
if(id>0){
|
||||
url = WST.U('home/Invoices/edit');
|
||||
invoiceHead = $('#invoiceHead_'+id).val();// 发票抬头
|
||||
params.id = id;
|
||||
}
|
||||
params.invoiceHead = invoiceHead;
|
||||
params.invoiceCode = num;
|
||||
if($('#invoice_obj').val()!=0){
|
||||
var loading = WST.load({msg:'正在提交数据,请稍后...'});
|
||||
$.post(url,params,function(data){
|
||||
var json = WST.toJson(data);
|
||||
layer.close(loading);
|
||||
if(json.status==1){
|
||||
// 判断用户是否需要发票
|
||||
setInvoiceText(invoiceHead);
|
||||
if(id==0)$('#invoiceId').val(json.data.id)
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
setInvoiceText('');
|
||||
}
|
||||
}
|
||||
|
||||
// 删除发票信息
|
||||
function delInvoice(id,obj){
|
||||
WST.confirm({content:'您确定要删除该发票信息吗?',yes:function(index){
|
||||
$.post(WST.U('home/invoices/del'),{id:id},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg,{icon:1});
|
||||
$(obj).parent().parent().remove();
|
||||
$('#invoiceId').val(0);
|
||||
// 选中 `个人`
|
||||
$('.inv_li:first').click();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}});
|
||||
}
|
933
hyhproject/home/view/default/js/cloudzoom.js
Executable file
933
hyhproject/home/view/default/js/cloudzoom.js
Executable file
@ -0,0 +1,933 @@
|
||||
/*
|
||||
Version 3.1
|
||||
*/
|
||||
(function(e) {
|
||||
function s(a) {
|
||||
var b = a.zoom,
|
||||
c = a.Q,
|
||||
g = a.R,
|
||||
k = a.e,
|
||||
f = a.g;
|
||||
this.data = a;
|
||||
this.U = this.b = null;
|
||||
this.za = 0;
|
||||
this.zoom = b;
|
||||
this.V = !0;
|
||||
this.r = this.interval = this.t = this.p = 0;
|
||||
var q = this,
|
||||
m;
|
||||
q.b = e("<div class='" + a.K + "' style='position:absolute;overflow:hidden'></div>");
|
||||
var p = e("<img style='-webkit-touch-callout:none;position:absolute;max-width:none' src='" + v(b.T, b.options) + "'/>");
|
||||
b.options.variableMagnification && p.bind("mousewheel",
|
||||
function(a, b) {
|
||||
q.zoom.ia(0.1 * b);
|
||||
return ! 1
|
||||
});
|
||||
q.U = p;
|
||||
p.width(q.zoom.e);
|
||||
p.height(q.zoom.g);
|
||||
d.Ja && q.U.css("-webkit-transform", "perspective(400px)");
|
||||
var l = q.b;
|
||||
l.append(p);
|
||||
var h = e("<div style='position:absolute;'></div>");
|
||||
a.caption ? ("html" == b.options.captionType ? m = a.caption: "attr" == b.options.captionType && (m = e("<div class='cloudzoom-caption'>" + a.caption + "</div>")), m.css("display", "block"), h.css({
|
||||
width: k
|
||||
}), l.append(h), h.append(m), e("body").append(l), this.r = m.outerHeight(), "bottom" == b.options.captionPosition ? h.css("top", f) : (h.css("top", 0), this.za = this.r)) : e("body").append(l);
|
||||
l.css({
|
||||
opacity: 0,
|
||||
width: k,
|
||||
height: f + this.r
|
||||
});
|
||||
this.zoom.C = "auto" === b.options.minMagnification ? Math.max(k / b.a.width(), f / b.a.height()) : b.options.minMagnification;
|
||||
this.zoom.B = "auto" === b.options.maxMagnification ? p.width() / b.a.width() : b.options.maxMagnification;
|
||||
a = l.height();
|
||||
this.V = !1;
|
||||
b.options.zoomFlyOut ? (f = b.a.offset(), f.left += b.d / 2, f.top += b.c / 2, l.offset(f), l.width(0), l.height(0), l.animate({
|
||||
left: c,
|
||||
top: g,
|
||||
width: k,
|
||||
height: a,
|
||||
opacity: 1
|
||||
},
|
||||
{
|
||||
duration: b.options.animationTime,
|
||||
complete: function() {
|
||||
q.V = !0
|
||||
}
|
||||
})) : (l.offset({
|
||||
left: c,
|
||||
top: g
|
||||
}), l.width(k), l.height(a), l.animate({
|
||||
opacity: 1
|
||||
},
|
||||
{
|
||||
duration: b.options.animationTime,
|
||||
complete: function() {
|
||||
q.V = !0
|
||||
}
|
||||
}))
|
||||
}
|
||||
function x(a, b, c) {
|
||||
this.a = a;
|
||||
this.ba = a[0];
|
||||
this.Ca = c;
|
||||
this.va = !0;
|
||||
var g = this;
|
||||
this.interval = setInterval(function() {
|
||||
0 < g.ba.width && 0 < g.ba.height && (clearInterval(g.interval), g.va = !1, g.Ca(a))
|
||||
},
|
||||
100);
|
||||
this.ba.src = b
|
||||
}
|
||||
function d(a, b) {
|
||||
function c() {
|
||||
k.update();
|
||||
window.Qa(c)
|
||||
}
|
||||
function g() {
|
||||
var c;
|
||||
c = "" != b.image ? b.image: "" + a.attr("src");
|
||||
k.sa();
|
||||
b.lazyLoadZoom ? a.bind("touchstart.preload " + k.options.mouseTriggerEvent + ".preload",
|
||||
function() {
|
||||
k.O(c, b.zoomImage)
|
||||
}) : k.O(c, b.zoomImage)
|
||||
}
|
||||
var k = this;
|
||||
b = e.extend({},e.fn.CloudZoom.defaults, b);
|
||||
var f = d.qa(a, e.fn.CloudZoom.attr);
|
||||
b = e.extend({},b, f);
|
||||
1 > b.easing && (b.easing = 1);
|
||||
f = a.parent();
|
||||
f.is("a") && "" == b.zoomImage && (b.zoomImage = f.attr("href"), f.removeAttr("href"));
|
||||
f = e("<div class='" + b.zoomClass + "'</div>");
|
||||
e("body").append(f);
|
||||
this.Z = f.width();
|
||||
this.Y = f.height();
|
||||
b.zoomWidth && (this.Z = b.zoomWidth, this.Y = b.zoomHeight);
|
||||
f.remove();
|
||||
this.options = b;
|
||||
this.a = a;
|
||||
this.g = this.e = this.d = this.c = 0;
|
||||
this.H = this.m = null;
|
||||
this.j = this.n = 0;
|
||||
this.D = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
this.Ua = this.caption = "";
|
||||
this.ea = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
this.k = [];
|
||||
this.pa = 0;
|
||||
this.oa = "";
|
||||
this.b = this.v = this.u = null;
|
||||
this.T = "";
|
||||
this.L = this.S = this.aa = !1;
|
||||
this.G = null;
|
||||
this.ha = this.Oa = !1;
|
||||
this.l = null;
|
||||
this.id = ++d.id;
|
||||
this.I = this.ua = this.ta = 0;
|
||||
this.o = this.h = null;
|
||||
this.wa = this.B = this.C = this.f = this.i = this.ja = 0;
|
||||
this.na(a);
|
||||
this.ma = !1;
|
||||
this.N = this.A = this.da = this.ca = 0;
|
||||
if (a.is(":hidden")) var q = setInterval(function() {
|
||||
a.is(":hidden") || (clearInterval(q), g())
|
||||
},
|
||||
100);
|
||||
else g();
|
||||
c()
|
||||
}
|
||||
function v(a, b) {
|
||||
var c = b.uriEscapeMethod;
|
||||
return "escape" == c ? escape(a) : "encodeURI" == c ? encodeURI(a) : a
|
||||
}
|
||||
function h(a) {
|
||||
for (var b = "",
|
||||
c, g = C("charCodeAt"), d = a[g](0) - 32, e = 1; e < a.length - 1; e++) c = a[g](e),
|
||||
c ^= d & 31,
|
||||
d++,
|
||||
b += String[C("fromCharCode")](c);
|
||||
a[g](e);
|
||||
return b
|
||||
}
|
||||
function C(a) {
|
||||
return a;
|
||||
}
|
||||
function y(a) {
|
||||
var b = a || window.event,
|
||||
c = [].slice.call(arguments, 1),
|
||||
g = 0,
|
||||
d = 0,
|
||||
f = 0;
|
||||
a = e.event.fix(b);
|
||||
a.type = "mousewheel";
|
||||
b.wheelDelta && (g = b.wheelDelta / 120);
|
||||
b.detail && (g = -b.detail / 3);
|
||||
f = g;
|
||||
void 0 !== b.axis && b.axis === b.HORIZONTAL_AXIS && (f = 0, d = -1 * g);
|
||||
void 0 !== b.wheelDeltaY && (f = b.wheelDeltaY / 120);
|
||||
void 0 !== b.wheelDeltaX && (d = -1 * b.wheelDeltaX / 120);
|
||||
c.unshift(a, g, d, f);
|
||||
return (e.event.dispatch || e.event.handle).apply(this, c)
|
||||
}
|
||||
var t = ["DOMMouseScroll", "mousewheel"];
|
||||
if (e.event.fixHooks) for (var n = t.length; n;) e.event.fixHooks[t[--n]] = e.event.mouseHooks;
|
||||
e.event.special.mousewheel = {
|
||||
setup: function() {
|
||||
if (this.addEventListener) for (var a = t.length; a;) this.addEventListener(t[--a], y, !1);
|
||||
else this.onmousewheel = y
|
||||
},
|
||||
teardown: function() {
|
||||
if (this.removeEventListener) for (var a = t.length; a;) this.removeEventListener(t[--a], y, !1);
|
||||
else this.onmousewheel = null
|
||||
}
|
||||
};
|
||||
e.fn.extend({
|
||||
mousewheel: function(a) {
|
||||
return a ? this.bind("mousewheel", a) : this.trigger("mousewheel")
|
||||
},
|
||||
unmousewheel: function(a) {
|
||||
return this.unbind("mousewheel", a)
|
||||
}
|
||||
});
|
||||
window.Qa = function() {
|
||||
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
|
||||
function(a) {
|
||||
window.setTimeout(a, 20)
|
||||
}
|
||||
} ();
|
||||
var n = document.getElementsByTagName("script"),
|
||||
w = n[n.length - 1].src.lastIndexOf("/"),
|
||||
z;
|
||||
z = "undefined" != typeof window.CloudZoom ? window.CloudZoom.path: n[n.length - 1].src.slice(0, w);
|
||||
var n = window,
|
||||
D = n[h("$Bphd|`ee&")],
|
||||
u = !0,
|
||||
E = !1,
|
||||
F = h("%KISIYZ2"),
|
||||
w = h("&VRZJBJ_HJ?").length,
|
||||
A = !1,
|
||||
B = !1;
|
||||
5 == w ? B = !0 : 4 == w && (A = !0);
|
||||
d.xa = 1E9;
|
||||
e(window).bind("resize.cloudzoom",
|
||||
function() {
|
||||
d.xa = e(this).width()
|
||||
});
|
||||
e(window).trigger("resize.cloudzoom");
|
||||
d.prototype.J = function() {
|
||||
return "inside" === this.options.zoomPosition || d.xa <= this.options.autoInside ? !0 : !1
|
||||
};
|
||||
d.prototype.update = function() {
|
||||
var a = this.h;
|
||||
null != a && (this.q(this.D, 0), this.f != this.i && (this.i += (this.f - this.i) / this.options.easing, 1E-4 > Math.abs(this.f - this.i) && (this.i = this.f), this.Na()), a.update())
|
||||
};
|
||||
d.id = 0;
|
||||
d.prototype.Ha = function(a) {
|
||||
var b = this.T.replace(/^\/|\/$/g, "");
|
||||
if (0 == this.k.length) return {
|
||||
href: this.options.zoomImage,
|
||||
title: this.a.attr("title")
|
||||
};
|
||||
if (void 0 != a) return this.k;
|
||||
a = [];
|
||||
for (var c = 0; c < this.k.length && this.k[c].href.replace(/^\/|\/$/g, "") != b; c++);
|
||||
for (b = 0; b < this.k.length; b++) a[b] = this.k[c],
|
||||
c++,
|
||||
c >= this.k.length && (c = 0);
|
||||
return a
|
||||
};
|
||||
d.prototype.getGalleryList = d.prototype.Ha;
|
||||
d.prototype.P = function() {
|
||||
clearTimeout(this.ja);
|
||||
null != this.o && this.o.remove()
|
||||
};
|
||||
d.prototype.sa = function() {
|
||||
var a = this;
|
||||
this.Oa || this.a.bind("mouseover.prehov mousemove.prehov mouseout.prehov",
|
||||
function(b) {
|
||||
a.G = "mouseout" == b.type ? null: {
|
||||
pageX: b.pageX,
|
||||
pageY: b.pageY
|
||||
}
|
||||
})
|
||||
};
|
||||
d.prototype.Ea = function() {
|
||||
this.G = null;
|
||||
this.a.unbind("mouseover.prehov mousemove.prehov mouseout.prehov")
|
||||
};
|
||||
d.prototype.O = function(a, b) {
|
||||
var c = this;
|
||||
c.a.unbind("touchstart.preload " + c.options.mouseTriggerEvent + ".preload");
|
||||
c.sa();
|
||||
this.P();
|
||||
e("body").children(".cloudzoom-fade-" + c.id).remove();
|
||||
null != this.v && (this.v.cancel(), this.v = null);
|
||||
null != this.u && (this.u.cancel(), this.u = null);
|
||||
this.T = "" != b && void 0 != b ? b: a;
|
||||
this.L = this.S = !1; ! c.options.galleryFade || !c.aa || c.J() && null != c.h || (c.l = e(new Image).css({
|
||||
position: "absolute"
|
||||
}), c.l.attr("src", c.a.attr("src")), c.l.width(c.a.width()), c.l.height(c.a.height()), c.l.offset(c.a.offset()), c.l.addClass("cloudzoom-fade-" + c.id), e("body").append(c.l));
|
||||
this.Ma();
|
||||
var g = e(new Image);
|
||||
this.u = new x(g, a,
|
||||
function(a, b) {
|
||||
c.u = null;
|
||||
c.L = !0;
|
||||
c.a.attr("src", g.attr("src"));
|
||||
e("body").children(".cloudzoom-fade-" + c.id).fadeOut(c.options.fadeTime,
|
||||
function() {
|
||||
e(this).remove();
|
||||
c.l = null
|
||||
});
|
||||
void 0 !== b ? (c.P(), c.options.errorCallback({
|
||||
$element: c.a,
|
||||
type: "IMAGE_NOT_FOUND",
|
||||
data: b.Ga
|
||||
})) : c.ra()
|
||||
})
|
||||
};
|
||||
d.prototype.Ma = function() {
|
||||
var a = this;
|
||||
a.ja = setTimeout(function() {
|
||||
a.o = e("<div class='cloudzoom-ajax-loader' style='position:absolute;left:0px;top:0px'/>");
|
||||
e("body").append(a.o);
|
||||
var b = a.o.width(),
|
||||
g = a.o.height(),
|
||||
b = a.a.offset().left + a.a.width() / 2 - b / 2,
|
||||
g = a.a.offset().top + a.a.height() / 2 - g / 2;
|
||||
a.o.offset({
|
||||
left: b,
|
||||
top: g
|
||||
})
|
||||
},
|
||||
250);
|
||||
var b = e(new Image);
|
||||
this.v = new x(b, this.T,
|
||||
function(c, g) {
|
||||
a.v = null;
|
||||
a.S = !0;
|
||||
a.e = b[0].width;
|
||||
a.g = b[0].height;
|
||||
void 0 !== g ? (a.P(), a.options.errorCallback({
|
||||
$element: a.a,
|
||||
type: "IMAGE_NOT_FOUND",
|
||||
data: g.Ga
|
||||
})) : a.ra()
|
||||
})
|
||||
};
|
||||
d.prototype.loadImage = d.prototype.O;
|
||||
d.prototype.Ba = function() {
|
||||
alert("Cloud Zoom API OK")
|
||||
};
|
||||
d.prototype.apiTest = d.prototype.Ba;
|
||||
d.prototype.s = function() {
|
||||
null != this.h && (this.a.trigger("cloudzoom_end_zoom"), this.h.$());
|
||||
this.h = null
|
||||
};
|
||||
d.prototype.$ = function() {
|
||||
e(document).unbind("mousemove." + this.id);
|
||||
this.a.unbind();
|
||||
null != this.b && (this.b.unbind(), this.s());
|
||||
this.a.removeData("CloudZoom");
|
||||
e("body").children(".cloudzoom-fade-" + this.id).remove();
|
||||
this.ma = !0
|
||||
};
|
||||
d.prototype.destroy = d.prototype.$;
|
||||
d.prototype.Da = function(a) {
|
||||
if (!this.options.hoverIntentDelay) return ! 1;
|
||||
0 === this.A && (this.A = (new Date).getTime(), this.ca = a.pageX, this.da = a.pageY);
|
||||
var b = a.pageX - this.ca,
|
||||
c = a.pageY - this.da,
|
||||
b = Math.sqrt(b * b + c * c);
|
||||
this.ca = a.pageX;
|
||||
this.da = a.pageY;
|
||||
a = (new Date).getTime();
|
||||
b <= this.options.hoverIntentDistance ? this.N += a - this.A: this.A = a;
|
||||
if (this.N < this.options.hoverIntentDelay) return ! 0;
|
||||
this.N = this.A = 0;
|
||||
return ! 1
|
||||
};
|
||||
d.prototype.W = function() {
|
||||
var a = this;
|
||||
a.a.bind(a.options.mouseTriggerEvent + ".trigger",
|
||||
function(b) {
|
||||
if (!a.X() && null == a.b && !a.Da(b)) {
|
||||
var c = a.a.offset();
|
||||
b = new d.F(b.pageX - c.left, b.pageY - c.top);
|
||||
a.M();
|
||||
a.w();
|
||||
a.q(b, 0);
|
||||
a.D = b
|
||||
}
|
||||
})
|
||||
};
|
||||
d.prototype.X = function() {
|
||||
if (this.ma || !this.S || !this.L) return ! 0;
|
||||
if (!1 === this.options.disableZoom) return ! 1;
|
||||
if (!0 === this.options.disableZoom) return ! 0;
|
||||
if ("auto" == this.options.disableZoom) {
|
||||
if (!isNaN(this.options.maxMagnification) && 1 < this.options.maxMagnification) return ! 1;
|
||||
if (this.a.width() >= this.e) return ! 0
|
||||
}
|
||||
return ! 1
|
||||
};
|
||||
d.prototype.ra = function() {
|
||||
var a = this;
|
||||
if (a.S && a.L) {
|
||||
this.la();
|
||||
a.e = a.a.width() * this.i;
|
||||
a.g = a.a.height() * this.i;
|
||||
this.P();
|
||||
this.ga();
|
||||
null != a.h && (a.s(), a.w(), a.H.attr("src", v(this.a.attr("src"), this.options)), a.q(a.ea, 0));
|
||||
if (!a.aa) {
|
||||
a.aa = !0;
|
||||
e(document).bind("MSPointerUp." + this.id + " mousemove." + this.id,
|
||||
function(b) {
|
||||
if (null != a.b) {
|
||||
var c = a.a.offset(),
|
||||
g = !0,
|
||||
c = new d.F(b.pageX - Math.floor(c.left), b.pageY - Math.floor(c.top));
|
||||
if ( - 1 > c.x || c.x > a.d || 0 > c.y || c.y > a.c) g = !1,
|
||||
a.options.permaZoom || (a.b.remove(), a.s(), a.b = null);
|
||||
a.ha = !1;
|
||||
"MSPointerUp" === b.type && (a.ha = !0);
|
||||
g && (a.D = c)
|
||||
}
|
||||
});
|
||||
a.W();
|
||||
var b = 0,
|
||||
c = 0,
|
||||
g = 0,
|
||||
k = function(a, b) {
|
||||
return Math.sqrt((a.pageX - b.pageX) * (a.pageX - b.pageX) + (a.pageY - b.pageY) * (a.pageY - b.pageY))
|
||||
};
|
||||
a.a.css({
|
||||
"-ms-touch-action": "none",
|
||||
"-ms-user-select": "none"
|
||||
});
|
||||
a.a.bind("touchstart touchmove touchend",
|
||||
function(e) {
|
||||
if (a.X()) return ! 0;
|
||||
var f = a.a.offset(),
|
||||
h = e.originalEvent,
|
||||
l = {
|
||||
x: 0,
|
||||
y: 0
|
||||
},
|
||||
r = h.type;
|
||||
if ("touchend" == r && 0 == h.touches.length) return a.fa(r, l),
|
||||
!1;
|
||||
l = new d.F(h.touches[0].pageX - Math.floor(f.left), h.touches[0].pageY - Math.floor(f.top));
|
||||
a.D = l;
|
||||
if ("touchstart" == r && 1 == h.touches.length && null == a.b) return a.fa(r, l),
|
||||
!1;
|
||||
2 > b && 2 == h.touches.length && (c = a.f, g = k(h.touches[0], h.touches[1]));
|
||||
b = h.touches.length;
|
||||
2 == b && a.options.variableMagnification && (f = k(h.touches[0], h.touches[1]) / g, a.f = a.J() ? c * f: c / f, a.f < a.C && (a.f = a.C), a.f > a.B && (a.f = a.B));
|
||||
a.fa("touchmove", l);
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
return e.returnValue = !1
|
||||
});
|
||||
if (null != a.G) {
|
||||
if (this.X()) return;
|
||||
var f = a.a.offset(),
|
||||
f = new d.F(a.G.pageX - f.left, a.G.pageY - f.top);
|
||||
a.M();
|
||||
a.w();
|
||||
a.q(f, 0);
|
||||
a.D = f
|
||||
}
|
||||
}
|
||||
a.Ea();
|
||||
a.a.trigger("cloudzoom_ready")
|
||||
}
|
||||
};
|
||||
d.prototype.fa = function(a, b) {
|
||||
var c = this;
|
||||
switch (a) {
|
||||
case "touchstart":
|
||||
if (null != c.b) break;
|
||||
clearTimeout(c.interval);
|
||||
c.interval = setTimeout(function() {
|
||||
c.M();
|
||||
c.w();
|
||||
c.q(b, c.j / 2);
|
||||
c.update()
|
||||
},
|
||||
150);
|
||||
break;
|
||||
case "touchend":
|
||||
clearTimeout(c.interval);
|
||||
null == c.b ? c.ya() : c.options.permaZoom || (c.b.remove(), c.b = null, c.s());
|
||||
break;
|
||||
case "touchmove":
|
||||
null == c.b && (clearTimeout(c.interval), c.M(), c.w())
|
||||
}
|
||||
};
|
||||
d.prototype.Na = function() {
|
||||
var a = this.i;
|
||||
if (null != this.b) {
|
||||
var b = this.h;
|
||||
this.n = b.b.width() / (this.a.width() * a) * this.a.width();
|
||||
this.j = b.b.height() / (this.a.height() * a) * this.a.height();
|
||||
this.j -= b.r / a;
|
||||
this.m.width(this.n);
|
||||
this.m.height(this.j);
|
||||
this.q(this.ea, 0)
|
||||
}
|
||||
};
|
||||
d.prototype.ia = function(a) {
|
||||
this.f += a;
|
||||
this.f < this.C && (this.f = this.C);
|
||||
this.f > this.B && (this.f = this.B)
|
||||
};
|
||||
d.prototype.na = function(a) {
|
||||
this.caption = null;
|
||||
"attr" == this.options.captionType ? (a = a.attr(this.options.captionSource), "" != a && void 0 != a && (this.caption = a)) : "html" == this.options.captionType && (a = e(this.options.captionSource), a.length && (this.caption = a.clone(), a.css("display", "none")))
|
||||
};
|
||||
d.prototype.Ia = function(a, b) {
|
||||
if ("html" == b.captionType) {
|
||||
var c;
|
||||
c = e(b.captionSource);
|
||||
c.length && c.css("display", "none")
|
||||
}
|
||||
};
|
||||
d.prototype.la = function() {
|
||||
this.f = this.i = "auto" === this.options.startMagnification ? this.e / this.a.width() : this.options.startMagnification
|
||||
};
|
||||
d.prototype.w = function() {
|
||||
var a = this;
|
||||
a.a.trigger("cloudzoom_start_zoom");
|
||||
this.la();
|
||||
a.e = a.a.width() * this.i;
|
||||
a.g = a.a.height() * this.i;
|
||||
var b = this.m,
|
||||
c = a.d,
|
||||
g = a.c,
|
||||
d = a.e,
|
||||
f = a.g,
|
||||
h = a.caption;
|
||||
if (a.J()) {
|
||||
b.width(a.d / a.e * a.d);
|
||||
b.height(a.c / a.g * a.c);
|
||||
b.css("display", "none");
|
||||
var m = a.options.zoomOffsetX,
|
||||
p = a.options.zoomOffsetY;
|
||||
a.options.autoInside && (m = p = 0);
|
||||
a.h = new s({
|
||||
zoom: a,
|
||||
Q: a.a.offset().left + m,
|
||||
R: a.a.offset().top + p,
|
||||
e: a.d,
|
||||
g: a.c,
|
||||
caption: h,
|
||||
K: a.options.zoomInsideClass
|
||||
});
|
||||
a.ka(a.h.b);
|
||||
a.h.b.bind("touchmove touchstart touchend",
|
||||
function(b) {
|
||||
a.a.trigger(b);
|
||||
return ! 1
|
||||
})
|
||||
} else if (isNaN(a.options.zoomPosition)) m = e(a.options.zoomPosition),
|
||||
b.width(m.width() / a.e * a.d),
|
||||
b.height(m.height() / a.g * a.c),
|
||||
b.fadeIn(a.options.fadeTime),
|
||||
a.options.zoomFullSize || "full" == a.options.zoomSizeMode ? (b.width(a.d), b.height(a.c), b.css("display", "none"), a.h = new s({
|
||||
zoom: a,
|
||||
Q: m.offset().left,
|
||||
R: m.offset().top,
|
||||
e: a.e,
|
||||
g: a.g,
|
||||
caption: h,
|
||||
K: a.options.zoomClass
|
||||
})) : a.h = new s({
|
||||
zoom: a,
|
||||
Q: m.offset().left,
|
||||
R: m.offset().top,
|
||||
e: m.width(),
|
||||
g: m.height(),
|
||||
caption: h,
|
||||
K: a.options.zoomClass
|
||||
});
|
||||
else {
|
||||
var m = a.options.zoomOffsetX,
|
||||
p = a.options.zoomOffsetY,
|
||||
l = !1;
|
||||
if (this.options.lensWidth) {
|
||||
var r = this.options.lensWidth,
|
||||
n = this.options.lensHeight;
|
||||
r > c && (r = c);
|
||||
n > g && (n = g);
|
||||
b.width(r);
|
||||
b.height(n)
|
||||
}
|
||||
d *= b.width() / c;
|
||||
f *= b.height() / g;
|
||||
r = a.options.zoomSizeMode;
|
||||
if (a.options.zoomFullSize || "full" == r) d = a.e,
|
||||
f = a.g,
|
||||
b.width(a.d),
|
||||
b.height(a.c),
|
||||
b.css("display", "none"),
|
||||
l = !0;
|
||||
else if (a.options.zoomMatchSize || "image" == r) b.width(a.d / a.e * a.d),
|
||||
b.height(a.c / a.g * a.c),
|
||||
d = a.d,
|
||||
f = a.c;
|
||||
else if ("zoom" === r || this.options.zoomWidth) b.width(a.Z / a.e * a.d),
|
||||
b.height(a.Y / a.g * a.c),
|
||||
d = a.Z,
|
||||
f = a.Y;
|
||||
c = [[c / 2 - d / 2, -f], [c - d, -f], [c, -f], [c, 0], [c, g / 2 - f / 2], [c, g - f], [c, g], [c - d, g], [c / 2 - d / 2, g], [0, g], [ - d, g], [ - d, g - f], [ - d, g / 2 - f / 2], [ - d, 0], [ - d, -f], [0, -f]];
|
||||
m += c[a.options.zoomPosition][0];
|
||||
p += c[a.options.zoomPosition][1];
|
||||
l || b.fadeIn(a.options.fadeTime);
|
||||
a.h = new s({
|
||||
zoom: a,
|
||||
Q: a.a.offset().left + m,
|
||||
R: a.a.offset().top + p,
|
||||
e: d,
|
||||
g: f,
|
||||
caption: h,
|
||||
K: a.options.zoomClass
|
||||
})
|
||||
}
|
||||
a.h.p = void 0;
|
||||
a.n = b.width();
|
||||
a.j = b.height();
|
||||
this.options.variableMagnification && a.m.bind("mousewheel",
|
||||
function(b, c) {
|
||||
a.ia(0.1 * c);
|
||||
return ! 1
|
||||
})
|
||||
};
|
||||
d.prototype.La = function() {
|
||||
return this.h ? !0 : !1
|
||||
};
|
||||
d.prototype.isZoomOpen = d.prototype.La;
|
||||
d.prototype.Fa = function() {
|
||||
this.a.unbind(this.options.mouseTriggerEvent + ".trigger");
|
||||
var a = this;
|
||||
null != this.b && (this.b.remove(), this.b = null);
|
||||
this.s();
|
||||
setTimeout(function() {
|
||||
a.W()
|
||||
},
|
||||
1)
|
||||
};
|
||||
d.prototype.closeZoom = d.prototype.Fa;
|
||||
d.prototype.ya = function() {
|
||||
var a = this;
|
||||
this.a.unbind(a.options.mouseTriggerEvent + ".trigger");
|
||||
this.a.trigger("click");
|
||||
setTimeout(function() {
|
||||
a.W()
|
||||
},
|
||||
1)
|
||||
};
|
||||
d.prototype.ka = function(a) {
|
||||
var b = this;
|
||||
a.bind("mousedown." + b.id + " mouseup." + b.id,
|
||||
function(a) {
|
||||
"mousedown" === a.type ? b.wa = (new Date).getTime() : (b.ha && (b.b && b.b.remove(), b.s(), b.b = null), 250 >= (new Date).getTime() - b.wa && b.ya())
|
||||
})
|
||||
};
|
||||
d.prototype.M = function() {
|
||||
5 == F.length && !1 == E && (u = !0);
|
||||
var a = this,
|
||||
b;
|
||||
a.ga();
|
||||
a.m = e("<div class='" + a.options.lensClass + "' style='overflow:hidden;display:none;position:absolute;top:0px;left:0px;'/>");
|
||||
var c = e('<img style="-webkit-touch-callout: none;position:absolute;left:0;top:0;max-width:none" src="' + v(this.a.attr("src"), this.options) + '">');
|
||||
c.width(this.a.width());
|
||||
c.height(this.a.height());
|
||||
a.H = c;
|
||||
a.H.attr("src", v(this.a.attr("src"), this.options));
|
||||
var d = a.m;
|
||||
a.b = e("<div class='cloudzoom-blank' style='position:absolute;'/>");
|
||||
var k = a.b;
|
||||
b = e("<div style='background-color:" + a.options.tintColor + ";width:100%;height:100%;'/>");
|
||||
b.css("opacity", a.options.tintOpacity);
|
||||
b.fadeIn(a.options.fadeTime);
|
||||
k.width(a.d);
|
||||
k.height(a.c);
|
||||
k.offset(a.a.offset());
|
||||
e("body").append(k);
|
||||
k.append(b);
|
||||
k.append(d);
|
||||
k.bind("touchmove touchstart touchend",
|
||||
function(b) {
|
||||
a.a.trigger(b);
|
||||
return ! 1
|
||||
});
|
||||
d.append(c);
|
||||
a.I = parseInt(d.css("borderTopWidth"), 10);
|
||||
isNaN(a.I) && (a.I = 0);
|
||||
a.ka(a.b);
|
||||
|
||||
if (false) {
|
||||
b = e(h("3/p|`)$6~rj#I"));
|
||||
var f, c = "{}";
|
||||
B ? f = h("7Ttvo<Gqpm!*wvlgk!)ym~cev{}g;uxu2") : A && (f = h("3Pxzcs8Cutq=|f rvbvujro`dx\"nab "), c = h('\'|*kkhgj|`ev>wzzxj; 9?-./\"- akwbbz+0)bb`j2=0|dtu~l`8!,3-bI'));
|
||||
u && (f = h("\'Rfechic}jt1Q{`r7BvuvF"));
|
||||
b[h(".zjhe%")](f);
|
||||
f = h(',w/~`cxfz{{4-:xxhsqkke#.!h``s*3(:<}v-<3p|`ayz:#8/,mf=,#x.mkbbp+0)==>? !0?6cdq{swuig=:#tjwldkm+&)hd}|pk1.7t{wzq90?}plnp!>\'%ano(\'.ykwd<a{uqy`:#8uss{=,#dljq+aidcgu/4-cp|`9fseq87>{qqt,qj~`$=*8:{t/\"-v~|g9bs~qn9&?|ple /&ugcl`dl.7,=`i0?6wye||h9&?/ox!qlhlb\'+=:;.!,mqrytfzcy|4ytprl=:#!g45$zO');
|
||||
b[h("8{ji)")](e[h(":jznn{USNL5")](f));
|
||||
b[h("8{ji)")](e[h(":jznn{USNL5")](c));
|
||||
}
|
||||
};
|
||||
d.prototype.q = function(a, b) {
|
||||
var c, d;
|
||||
this.ea = a;
|
||||
c = a.x;
|
||||
d = a.y;
|
||||
b = 0;
|
||||
this.J() && (b = 0);
|
||||
c -= this.n / 2 + 0;
|
||||
d -= this.j / 2 + b;
|
||||
c > this.d - this.n ? c = this.d - this.n: 0 > c && (c = 0);
|
||||
d > this.c - this.j ? d = this.c - this.j: 0 > d && (d = 0);
|
||||
var e = this.I;
|
||||
this.m.parent();
|
||||
this.m.css({
|
||||
left: Math.ceil(c) - e,
|
||||
top: Math.ceil(d) - e
|
||||
});
|
||||
c = -c;
|
||||
d = -d;
|
||||
this.H.css({
|
||||
left: Math.floor(c) + "px",
|
||||
top: Math.floor(d) + "px"
|
||||
});
|
||||
this.ta = c;
|
||||
this.ua = d
|
||||
};
|
||||
d.qa = function(a, b) {
|
||||
var c = null,
|
||||
d = a.attr(b);
|
||||
if ("string" == typeof d) {
|
||||
var d = e.trim(d),
|
||||
h = d.indexOf("{"),
|
||||
f = d.indexOf("}");
|
||||
f != d.length - 1 && (f = d.indexOf("};"));
|
||||
if ( - 1 != h && -1 != f) {
|
||||
d = d.substr(h, f - h + 1);
|
||||
try {
|
||||
c = e.parseJSON(d)
|
||||
} catch(q) {
|
||||
console.error("Invalid JSON in " + b + " attribute:" + d)
|
||||
}
|
||||
} else c = (new D("return {" + d + "}"))()
|
||||
}
|
||||
return c
|
||||
};
|
||||
d.F = function(a, b) {
|
||||
this.x = a;
|
||||
this.y = b
|
||||
};
|
||||
d.point = d.F;
|
||||
x.prototype.cancel = function() {
|
||||
clearInterval(this.interval);
|
||||
this.va = !1
|
||||
};
|
||||
d.Sa = function(a) {
|
||||
z = a
|
||||
};
|
||||
d.setScriptPath = d.Sa;
|
||||
d.Pa = function() {
|
||||
e(function() {
|
||||
e(".cloudzoom").CloudZoom();
|
||||
e(".cloudzoom-gallery").CloudZoom()
|
||||
})
|
||||
};
|
||||
d.quickStart = d.Pa;
|
||||
d.prototype.ga = function() {
|
||||
this.d = this.a.outerWidth();
|
||||
this.c = this.a.outerHeight()
|
||||
};
|
||||
d.prototype.refreshImage = d.prototype.ga;
|
||||
d.version = "3.1 rev 1312051822";
|
||||
d.Ta = function() {
|
||||
e[h("\'fbhrD")]({
|
||||
url: z + "/" + h(";wu~{qsd,iwN"),
|
||||
dataType: "script",
|
||||
async: !1,
|
||||
crossDomain: !0,
|
||||
cache: !0,
|
||||
success: function() {
|
||||
E = !0
|
||||
}
|
||||
})
|
||||
};
|
||||
d.Ka = function() {
|
||||
d.browser = {};
|
||||
d.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase());
|
||||
var a = new D("a", h('2{u<by|vm5pr}~thmm*uth|fid`03-vx~v.7?e}moir=x~lrg8rdt\'k4oeobjjEC[P{xfxv|to4jwqdnu-hjef|`ee\"ea|ds~q<-v%x4hlqwk(#.!->`hz!|j~-l2 *p/u;zrv~ns\'54)hd+g8;fSkWwpn |esagf|xp0z4wysykh,*b_g[)dldlxe%>98/.)7853xAyAab21 ?>g+oillrDj%,!2:sHvH=56;3g`-#\"=b,jjacGo\"jWoS$2?0:=gscmkt:-&lzttpm%5$'));
|
||||
if (5 != F.length) {
|
||||
var b = h("2agugf{m~suo3}pm-qwewvk}nce#b`sp~*");
|
||||
u = a(b)
|
||||
} else u = !1,
|
||||
d.Ta();
|
||||
this._ = ":Irhxm%sucqtis`agy%obc#cesadycpqwi5pr}~l!Wpaw<6(Echic}j*\"\'\" -wv *,~)x\'085b25ca9h:2=;omhi2Wuas-\\|y;,(2?21305";
|
||||
this.Ja = -1 != navigator.platform.indexOf("iPhone") || -1 != navigator.platform.indexOf("iPod") || -1 != navigator.platform.indexOf("iPad")
|
||||
};
|
||||
d.Ra = function(a) {
|
||||
e.fn.CloudZoom.attr = a
|
||||
};
|
||||
d.setAttr = d.Ra;
|
||||
e.fn.CloudZoom = function(a) {
|
||||
return this.each(function() {
|
||||
if (e(this).hasClass("cloudzoom-gallery")) {
|
||||
var b = d.qa(e(this), e.fn.CloudZoom.attr),
|
||||
c = e(b.useZoom).data("CloudZoom");
|
||||
c.Ia(e(this), b);
|
||||
var g = e.extend({},
|
||||
c.options, b),
|
||||
h = e(this).parent(),
|
||||
f = g.zoomImage;
|
||||
h.is("a") && (f = h.attr("href"));
|
||||
c.k.push({
|
||||
href: f,
|
||||
title: e(this).attr("title"),
|
||||
Aa: e(this)
|
||||
});
|
||||
e(this).bind(g.galleryEvent,
|
||||
function() {
|
||||
var a;
|
||||
for (a = 0; a < c.k.length; a++) c.k[a].Aa.removeClass("cloudzoom-gallery-active");
|
||||
e(this).addClass("cloudzoom-gallery-active");
|
||||
if (b.image == c.oa) return ! 1;
|
||||
c.oa = b.image;
|
||||
c.options = e.extend({},c.options, b);
|
||||
c.na(e(this));
|
||||
var d = e(this).parent();
|
||||
d.is("a") && (b.zoomImage = d.attr("href"));
|
||||
a = "mouseover" == b.galleryEvent ? c.options.galleryHoverDelay: 1;
|
||||
clearTimeout(c.pa);
|
||||
c.pa = setTimeout(function() {
|
||||
c.O(b.image, b.zoomImage)
|
||||
},
|
||||
a);
|
||||
if (d.is("a") || e(this).is("a")) return ! 1
|
||||
})
|
||||
} else e(this).data("CloudZoom", new d(e(this), a))
|
||||
})
|
||||
};
|
||||
e.fn.CloudZoom.attr = "data-cloudzoom";
|
||||
e.fn.CloudZoom.defaults = {
|
||||
image: "",
|
||||
zoomImage: "",
|
||||
tintColor: "#000",
|
||||
tintOpacity: 0.25,
|
||||
animationTime: 500,
|
||||
sizePriority: "lens",
|
||||
lensClass: "cloudzoom-lens",
|
||||
lensProportions: "CSS",
|
||||
lensAutoCircle: !1,
|
||||
innerZoom: !1,
|
||||
galleryEvent: "mousemove",//mousemove|click by 33 h ao.c om
|
||||
easeTime: 500,
|
||||
zoomSizeMode: "lens",
|
||||
zoomMatchSize: !1,
|
||||
zoomPosition: 3,
|
||||
zoomOffsetX: 25,
|
||||
zoomOffsetY: -21,
|
||||
zoomFullSize: !1,
|
||||
zoomFlyOut: !0,
|
||||
zoomClass: "cloudzoom-zoom",
|
||||
zoomInsideClass: "cloudzoom-zoom-inside",
|
||||
captionSource: "title",
|
||||
captionType: "attr",
|
||||
captionPosition: "bottom",
|
||||
imageEvent: "click",
|
||||
uriEscapeMethod: !1,
|
||||
errorCallback: function() {},
|
||||
variableMagnification: !0,
|
||||
startMagnification: "auto",
|
||||
minMagnification: "auto",
|
||||
maxMagnification: "6",
|
||||
easing: 8,
|
||||
lazyLoadZoom: !1,
|
||||
mouseTriggerEvent: "mousemove",
|
||||
disableZoom: !1,
|
||||
galleryFade: !0,
|
||||
galleryHoverDelay: 200,
|
||||
permaZoom: !1,
|
||||
zoomWidth: 360,
|
||||
zoomHeight: 360,
|
||||
lensWidth: 0,
|
||||
lensHeight: 0,
|
||||
hoverIntentDelay: 0,
|
||||
hoverIntentDistance: 2,
|
||||
autoInside: 750
|
||||
};
|
||||
s.prototype.update = function() {
|
||||
var a = this.zoom,
|
||||
b = a.i,
|
||||
c = -a.ta + a.n / 2,
|
||||
d = -a.ua + a.j / 2;
|
||||
void 0 == this.p && (this.p = c, this.t = d);
|
||||
this.p += (c - this.p) / a.options.easing;
|
||||
this.t += (d - this.t) / a.options.easing;
|
||||
var c = -this.p * b,
|
||||
c = c + a.n / 2 * b,
|
||||
d = -this.t * b,
|
||||
d = d + a.j / 2 * b,
|
||||
e = a.a.width() * b,
|
||||
a = a.a.height() * b;
|
||||
0 < c && (c = 0);
|
||||
0 < d && (d = 0);
|
||||
c + e < this.b.width() && (c += this.b.width() - (c + e));
|
||||
d + a < this.b.height() - this.r && (d += this.b.height() - this.r - (d + a));
|
||||
this.U.css({
|
||||
left: c + "px",
|
||||
top: d + this.za + "px",
|
||||
width: e,
|
||||
height: a
|
||||
})
|
||||
};
|
||||
s.prototype.$ = function() {
|
||||
var a = this;
|
||||
a.b.bind("touchstart",
|
||||
function() {
|
||||
return ! 1
|
||||
});
|
||||
var b = this.zoom.a.offset();
|
||||
this.zoom.options.zoomFlyOut ? this.b.animate({
|
||||
left: b.left + this.zoom.d / 2,
|
||||
top: b.top + this.zoom.c / 2,
|
||||
opacity: 0,
|
||||
width: 1,
|
||||
height: 1
|
||||
},
|
||||
{
|
||||
duration: this.zoom.options.animationTime,
|
||||
step: function() {
|
||||
d.browser.webkit && a.b.width(a.b.width())
|
||||
},
|
||||
complete: function() {
|
||||
a.b.remove()
|
||||
}
|
||||
}) : this.b.animate({
|
||||
opacity: 0
|
||||
},
|
||||
{
|
||||
duration: this.zoom.options.animationTime,
|
||||
complete: function() {
|
||||
a.b.remove()
|
||||
}
|
||||
})
|
||||
};
|
||||
n.CloudZoom = d;
|
||||
d.Ka()
|
||||
})(jQuery);
|
1230
hyhproject/home/view/default/js/common webuploader ╔╧┤лoss.js
Executable file
1230
hyhproject/home/view/default/js/common webuploader ╔╧┤лoss.js
Executable file
File diff suppressed because it is too large
Load Diff
1066
hyhproject/home/view/default/js/common.js
Executable file
1066
hyhproject/home/view/default/js/common.js
Executable file
File diff suppressed because it is too large
Load Diff
163
hyhproject/home/view/default/js/findpass.js
Executable file
163
hyhproject/home/view/default/js/findpass.js
Executable file
@ -0,0 +1,163 @@
|
||||
var time = 0;
|
||||
var isSend = false;
|
||||
$(function(){
|
||||
//第一步
|
||||
$('#forgetPwdForm').validator({
|
||||
valid: function(form){
|
||||
forgetPwd();
|
||||
}
|
||||
});
|
||||
//手机发送验证
|
||||
$('#phoneVerify').validator({
|
||||
valid: function(form){
|
||||
phoneVerify2();
|
||||
}
|
||||
});
|
||||
//重置密码
|
||||
$('#forgetPwdForm3').validator({
|
||||
fields: {
|
||||
loginPwd: {
|
||||
rule:"required;length[6~16]",
|
||||
msg:{required:"请输入新密码"},
|
||||
tip:"请输入新密码"
|
||||
},
|
||||
repassword: {
|
||||
rule:"required;length[6~16];match[loginPwd]",
|
||||
msg:{required:"请再次输入新密码",match:"两次输入密码不匹配"},
|
||||
tip:"请再次输入新密码"
|
||||
},
|
||||
},
|
||||
valid: function(form){
|
||||
forgetPwd();
|
||||
}
|
||||
});
|
||||
})
|
||||
function forgetPwd(){
|
||||
var params = WST.getParams('.ipt');
|
||||
if(window.conf.IS_CRYPT=='1' && params.step=='3'){
|
||||
var public_key=$('#token').val();
|
||||
var exponent="10001";
|
||||
var rsa = new RSAKey();
|
||||
rsa.setPublic(public_key, exponent);
|
||||
params.loginPwd = rsa.encrypt(params.loginPwd);
|
||||
params.repassword = rsa.encrypt(params.repassword);
|
||||
}
|
||||
var step = $('#step').val();
|
||||
var modes = $('#modes').val();
|
||||
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
|
||||
$.post(WST.U('home/users/findPass'),params,function(data,textStatus){
|
||||
layer.close(loading);
|
||||
var json = WST.toJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg("操作成功",{icon:1});
|
||||
setTimeout(function(){
|
||||
if(step==1){
|
||||
location.href=WST.U('home/users/forgetpasst','',true);
|
||||
}else if(step==2){
|
||||
if(modes==1){
|
||||
location.href=json.url;
|
||||
}else{
|
||||
disableBtn();
|
||||
}
|
||||
}else if(step==3){
|
||||
location.href=WST.U('home/users/forgetpassf','',true);
|
||||
}
|
||||
},1000);
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
WST.getVerify('#verifyImg');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//第二步
|
||||
$('#type').change(function(){
|
||||
if ($('#type').val() == 'phone') {
|
||||
$('.phone-verify').show();
|
||||
$('.email-verify').hide();
|
||||
$('#modes').val(1);
|
||||
}else{
|
||||
$('.phone-verify').hide();
|
||||
$('.email-verify').show();
|
||||
$('#modes').val(2);
|
||||
}
|
||||
})
|
||||
function phoneVerify(){
|
||||
if(window.conf.SMS_VERFY==1){
|
||||
WST.open({type: 1,title:"请输入验证码",shade: [0.6, '#000'],border: [0],content: $('#phoneVerify'),area: ['500px', '160px']});
|
||||
}else{
|
||||
phoneVerify2();
|
||||
}
|
||||
}
|
||||
function phoneVerify2(){
|
||||
WST.msg('正在发送短信,请稍后...',{time:600000});
|
||||
var time = 0;
|
||||
var isSend = false;
|
||||
var params = WST.getParams('.ipt');
|
||||
$.post(WST.U('home/users/getfindPhone'),params,function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(isSend )return;
|
||||
isSend = true;
|
||||
if(json.status!=1){
|
||||
WST.msg(json.msg, {icon: 5});
|
||||
WST.getVerify2('#verifyImg2');
|
||||
time = 0;
|
||||
isSend = false;
|
||||
}if(json.status==1){
|
||||
WST.msg('短信已发送,请注册查收');
|
||||
layer.closeAll('page');
|
||||
time = 120;
|
||||
$('#timeObtain').attr('disabled', 'disabled').css('background','#e8e6e6');
|
||||
$('#timeObtain').html('获取手机验证码(120)').css('width','130px');
|
||||
var task = setInterval(function(){
|
||||
time--;
|
||||
$('#timeObtain').html('获取手机验证码('+time+")");
|
||||
if(time==0){
|
||||
isSend = false;
|
||||
clearInterval(task);
|
||||
$('#timeObtain').html("重新获取验证码").css('width','100px');
|
||||
$('#timeObtain').removeAttr('disabled').css('background','#e23e3d');
|
||||
}
|
||||
},1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
function forgetPhone(){
|
||||
if(!$('#Checkcode').isValid())return;
|
||||
forgetPwd();
|
||||
}
|
||||
function forgetEmail(){
|
||||
if(!$('#verifyCode').isValid())return;
|
||||
forgetPwd();
|
||||
}
|
||||
/*重置密码*/
|
||||
function resetPass(){
|
||||
if(!$('#secretCode').isValid())return;
|
||||
var secretCode = $('#secretCode').val();
|
||||
$.post(WST.U('home/users/forgetPasss'),{secretCode:secretCode},function(data){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
location.href=WST.U('home/users/resetpass','',true);
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/*禁用发送按钮*/
|
||||
function disableBtn(){
|
||||
time = 120;
|
||||
$('#sendEmailBtn').attr('disabled', 'disabled').css({'background':'#e8e6e6','color':'#a7a7a7'});
|
||||
$('#sendEmailBtn').html('获取邮箱验证码(120)').css('width','130px');
|
||||
var task = setInterval(function(){
|
||||
time--;
|
||||
$('#sendEmailBtn').html('获取邮箱验证码('+time+")");
|
||||
if(time==0){
|
||||
isSend = false;
|
||||
clearInterval(task);
|
||||
$('#sendEmailBtn').html("重新获取验证码").css('width','100px');
|
||||
$('#sendEmailBtn').removeAttr('disabled').css({'background':'#f0efef','color':'#110f0f'});
|
||||
}
|
||||
},1000);
|
||||
}
|
374
hyhproject/home/view/default/js/goods.js
Executable file
374
hyhproject/home/view/default/js/goods.js
Executable file
@ -0,0 +1,374 @@
|
||||
$(function(){
|
||||
WST.dropDownLayer(".item",".dorp-down-layer");
|
||||
$('.item-more').click(function(){
|
||||
if($(this).attr('v')==1){
|
||||
$('.hideItem').show(300);
|
||||
$(this).find("span").html("收起");
|
||||
$(this).find("i").attr({"class":"drop-up"});
|
||||
$(this).attr('v',0);
|
||||
}else{
|
||||
$('.hideItem').hide(300);
|
||||
$(this).find("span").html("更多选项");
|
||||
$(this).find("i").attr({"class":"drop-down-icon"});
|
||||
$(this).attr('v',1);
|
||||
}
|
||||
});
|
||||
|
||||
$(".item-more").hover(function(){
|
||||
if($(this).find("i").hasClass("drop-down-icon")){
|
||||
$(this).find("i").attr({"class":"down-hover"});
|
||||
}else{
|
||||
$(this).find("i").attr({"class":"up-hover"});
|
||||
}
|
||||
|
||||
},function(){
|
||||
if($(this).find("i").hasClass("down-hover")){
|
||||
$(this).find("i").attr({"class":"drop-down"});
|
||||
}else{
|
||||
$(this).find("i").attr({"class":"drop-up"});
|
||||
}
|
||||
});
|
||||
if(goodsInfo.sku){
|
||||
var specs,dv;
|
||||
for(var key in goodsInfo.sku){
|
||||
if(goodsInfo.sku[key].isDefault==1){
|
||||
specs = key.split(':');
|
||||
$('.j-option').each(function(){
|
||||
dv = $(this).attr('data-val')
|
||||
if($.inArray(dv,specs)>-1){
|
||||
$(this).addClass('j-selected');
|
||||
}
|
||||
})
|
||||
$('#buyNum').attr('data-max',goodsInfo.sku[key].specStock);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$('#buyNum').attr('data-max',goodsInfo.goodsStock);
|
||||
}
|
||||
checkGoodsStock();
|
||||
//图片放大镜效果
|
||||
CloudZoom.quickStart();
|
||||
imagesMove({id:'.goods-pics',items:'.items'});
|
||||
//选择规格
|
||||
$('.spec .j-option').click(function(){
|
||||
$(this).addClass('j-selected').siblings().removeClass('j-selected');
|
||||
checkGoodsStock();
|
||||
});
|
||||
fixedbar();
|
||||
$('#tab').TabPanel({tab:0,callback:function(no){
|
||||
if(no==1)queryByPage();
|
||||
if(no==2)queryConsult();
|
||||
}});
|
||||
contrastGoods(1,0,2);
|
||||
// 取消'手机购买'click事件
|
||||
$('#wx_qrcode').unbind();
|
||||
});
|
||||
function fixedbar(){
|
||||
var offsetTop = $("#goodsTabs").offset().top;
|
||||
$(window).scroll(function() {
|
||||
var scrollTop = $(document).scrollTop();
|
||||
if (scrollTop > offsetTop){
|
||||
$('#addCart2').show();
|
||||
$("#goodsTabs").css("position","fixed");
|
||||
$("#wx_qrcode").addClass('wx_qrcode_fixed');
|
||||
}else{
|
||||
$('#addCart2').hide();
|
||||
$("#goodsTabs").css("position", "static");
|
||||
$("#wx_qrcode").removeClass('wx_qrcode_fixed');
|
||||
}
|
||||
});
|
||||
}
|
||||
function checkGoodsStock(){
|
||||
var specIds = [],stock = 0,goodsPrice=0,marketPrice=0,goodsHuibao=0;
|
||||
|
||||
if(goodsInfo.isSpec==1){
|
||||
$('.j-selected').each(function(){
|
||||
specIds.push(parseInt($(this).attr('data-val'),10));
|
||||
});
|
||||
specIds.sort(function(a,b){return a-b;});
|
||||
if(goodsInfo.sku[specIds.join(':')]){
|
||||
stock = goodsInfo.sku[specIds.join(':')].specStock;
|
||||
marketPrice = goodsInfo.sku[specIds.join(':')].marketPrice;
|
||||
goodsPrice = goodsInfo.sku[specIds.join(':')].specPrice;
|
||||
goodsHuibao =Math.round(goodsInfo.sku[specIds.join(':')].specPrice * 0.8 * 100) / 100;
|
||||
|
||||
}
|
||||
}else{
|
||||
stock = goodsInfo.goodsStock;
|
||||
marketPrice = goodsInfo.marketPrice;
|
||||
goodsPrice = goodsInfo.goodsPrice;
|
||||
}
|
||||
$('#goods-stock').html(stock);
|
||||
$('#j-market-price').html('¥'+marketPrice);
|
||||
$('#j-shop-price').html('¥'+goodsPrice);
|
||||
if(goodsHuibao>0){
|
||||
$('#j-shop-huibao').html('¥'+goodsHuibao);
|
||||
}
|
||||
|
||||
if(stock<=0){
|
||||
$('#addBtn').addClass('disabled');
|
||||
$('#buyBtn').addClass('disabled');
|
||||
}else{
|
||||
$('#addBtn').removeClass('disabled');
|
||||
$('#buyBtn').removeClass('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
function imagesMove(opts){
|
||||
var tempLength = 0; //临时变量,当前移动的长度
|
||||
var viewNum = 5; //设置每次显示图片的个数量
|
||||
var moveNum = 2; //每次移动的数量
|
||||
var moveTime = 300; //移动速度,毫秒
|
||||
var scrollDiv = $(opts.id+" "+opts.items+" ul"); //进行移动动画的容器
|
||||
var scrollItems = $(opts.id+" "+opts.items+" ul li"); //移动容器里的集合
|
||||
var moveLength = scrollItems.eq(0).width() * moveNum; //计算每次移动的长度
|
||||
var countLength = (scrollItems.length - viewNum) * scrollItems.eq(0).width(); //计算总长度,总个数*单个长度
|
||||
|
||||
//下一张
|
||||
$(opts.id+" .next").bind("click",function(){
|
||||
if(tempLength < countLength){
|
||||
if((countLength - tempLength) > moveLength){
|
||||
scrollDiv.animate({left:"-=" + moveLength + "px"}, moveTime);
|
||||
tempLength += moveLength;
|
||||
}else{
|
||||
scrollDiv.animate({left:"-=" + (countLength - tempLength) + "px"}, moveTime);
|
||||
tempLength += (countLength - tempLength);
|
||||
}
|
||||
}
|
||||
});
|
||||
//上一张
|
||||
$(opts.id+" .prev").bind("click",function(){
|
||||
if(tempLength > 0){
|
||||
if(tempLength > moveLength){
|
||||
scrollDiv.animate({left: "+=" + moveLength + "px"}, moveTime);
|
||||
tempLength -= moveLength;
|
||||
}else{
|
||||
scrollDiv.animate({left: "+=" + tempLength + "px"}, moveTime);
|
||||
tempLength = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/****************** 商品评价 ******************/
|
||||
function showImg(id){
|
||||
layer.photos({
|
||||
photos: '#img-file-'+id
|
||||
});
|
||||
}
|
||||
function apprfilter(type){
|
||||
$('.appr-filterbox li a').removeClass('curr');
|
||||
$('#filtertype').val(type);
|
||||
queryByPage(1);
|
||||
}
|
||||
|
||||
var _first=true;
|
||||
function queryByPage(p){
|
||||
var params = {};
|
||||
params.page = p;
|
||||
params.goodsId = goodsInfo.id;
|
||||
params.anonymous = 1;
|
||||
params.type = $('#filtertype').val();
|
||||
$.post(WST.U('home/goodsappraises/getById'),params,function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1 && json.data.Rows){
|
||||
var gettpl = document.getElementById('tblist').innerHTML;
|
||||
laytpl(gettpl).render(json.data.Rows, function(html){
|
||||
$('#ga-box').html(html);
|
||||
for(var g=0;g<=json.data.Rows.length;g++){
|
||||
showImg(g);
|
||||
}
|
||||
});
|
||||
// 各评价数.
|
||||
$('#totalNum').html(json.data.sum);
|
||||
$('#bestNum').html(json.data.bestNum);
|
||||
$('#goodNum').html(json.data.goodNum);
|
||||
$('#badNum').html(json.data.badNum);
|
||||
$('#picNum').html(json.data.picNum);
|
||||
// 选中当前筛选条件
|
||||
$('#'+params.type).addClass('curr');
|
||||
if(_first && json.data.sum>0){
|
||||
// 好、中、差评率
|
||||
var best = parseInt(json.data.bestNum/json.data.sum*100);
|
||||
var good = parseInt(json.data.goodNum/json.data.sum*100);
|
||||
var bad = 100-best-good;
|
||||
$('.best_percent').html(best);
|
||||
$('.good_percent').html(good);
|
||||
$('.bad_percent').html(bad);
|
||||
// 背景色
|
||||
$('#best_percentbg').css({width:best+'%'});
|
||||
$('#good_percentbg').css({width:good+'%'});
|
||||
$('#bad_percentbg').css({width:bad+'%'});
|
||||
_first = false;
|
||||
}
|
||||
|
||||
$('.j-lazyImg').lazyload({ effect: "fadeIn",failurelimit : 10,threshold: 200,placeholder:window.conf.IMGURL+'/'+window.conf.GOODS_LOGO});
|
||||
$('.apprimg').lazyload({ effect: "fadeIn",failurelimit : 10,skip_invisible : false,threshold: 100,placeholder:window.conf.IMGURL+'/'+window.conf.USER_LOGO});//会员默认头像
|
||||
laypage({
|
||||
cont: 'pager',
|
||||
pages:json.data.TotalPage,
|
||||
curr: json.data.CurrentPage,
|
||||
skin: '#e23e3d',
|
||||
groups: 3,
|
||||
jump: function(e, first){
|
||||
if(!first){
|
||||
queryByPage(e.curr);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
function addCart(type,iptId){
|
||||
if(window.conf.IS_LOGIN==0){
|
||||
WST.loginWindow();
|
||||
return;
|
||||
}
|
||||
var goodsSpecId = 0;
|
||||
if(goodsInfo.isSpec==1){
|
||||
var specIds = [];
|
||||
$('.j-selected').each(function(){
|
||||
specIds.push($(this).attr('data-val'));
|
||||
});
|
||||
|
||||
if(specIds.length==0){
|
||||
WST.msg('请选择你要购买的商品信息',{icon:2});
|
||||
}
|
||||
specIds.sort(function(a,b){return a-b});
|
||||
if(goodsInfo.sku[specIds.join(':')]){
|
||||
goodsSpecId = goodsInfo.sku[specIds.join(':')].id;
|
||||
}
|
||||
}
|
||||
var buyNum = $(iptId)[0]?$(iptId).val():1;
|
||||
$.post(WST.U('home/carts/addCart'),{goodsId:goodsInfo.id,goodsSpecId:goodsSpecId,buyNum:buyNum,type:type,rnd:Math.random()},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
WST.msg(json.msg,{icon:1},function(){
|
||||
if(json.data && json.data.forward){
|
||||
location.href=WST.U('home/carts/'+json.data.forward);
|
||||
}else{
|
||||
if(type==1){
|
||||
location.href=WST.U('home/carts/settlement');
|
||||
}
|
||||
}
|
||||
});
|
||||
getRightCart();
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
/******************* 商品咨询 ********************/
|
||||
|
||||
// 提交商品咨询
|
||||
function consultCommit(){
|
||||
var params={};
|
||||
params.goodsId = goodsInfo.id;
|
||||
$('[name="pointType"]').each(function(k,v){
|
||||
if(v.checked){params.consultType = v.value}
|
||||
})
|
||||
if(!params.consultType){
|
||||
WST.msg('请选择咨询类别',{icon:2});
|
||||
return;
|
||||
}
|
||||
params.consultContent = $('#consultContent').val();
|
||||
if(params.consultContent == ''){
|
||||
WST.msg('请输入咨询内容',{icon:2});
|
||||
return;
|
||||
}
|
||||
if(params.consultContent.length<3 || params.consultContent.length>200){
|
||||
WST.msg('咨询内容应为3-200个字',{icon:2});
|
||||
return;
|
||||
}
|
||||
var load = WST.load({msg:'正在提交,请稍后...'});
|
||||
$.post(WST.U('home/goodsconsult/add'),params,function(responData){
|
||||
layer.close(load);
|
||||
var json = WST.toJson(responData);
|
||||
if(json.status==1){
|
||||
// 发布成功
|
||||
WST.msg(json.msg,{icon:1},function(){
|
||||
// 重置咨询输入框
|
||||
$('[name="pointType"]').map(function(k,v){v.checked=false;});
|
||||
$('#consultContent').val(' ');
|
||||
queryConsult(0);
|
||||
});
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
})
|
||||
}
|
||||
function queryConsult(p){
|
||||
var params = {};
|
||||
params.page = p;
|
||||
params.goodsId = goodsInfo.id;
|
||||
params.type = $('#consultType').val();
|
||||
params.consultKey = $('#consultKey').val();
|
||||
$.post(WST.U('home/goodsconsult/listquery'),params,function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1 && json.data.Rows){
|
||||
var gettpl = document.getElementById('gclist').innerHTML;
|
||||
laytpl(gettpl).render(json.data.Rows, function(html){
|
||||
$('#consultBox').html(html);
|
||||
});
|
||||
laypage({
|
||||
cont: 'consult-pager',
|
||||
pages:json.data.TotalPage,
|
||||
curr: json.data.CurrentPage,
|
||||
skin: '#e23e3d',
|
||||
groups: 3,
|
||||
jump: function(e, first){
|
||||
if(!first){
|
||||
queryConsult(e.curr);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
//筛选咨询类别
|
||||
function filterConsult(obj, type){
|
||||
$('.gc-filter').each(function(k,v){
|
||||
$(v).removeClass('curr');
|
||||
})
|
||||
$(obj).addClass('curr');
|
||||
$('#consultType').val(type);
|
||||
queryConsult(0);
|
||||
}
|
||||
//对比商品
|
||||
function contrastGoods(show,id,type){
|
||||
if(show==1){
|
||||
$.post(WST.U('home/goods/contrastGoods'),{id:id},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
if(type==2 && json.data)$("#j-cont-frame").addClass('show');
|
||||
var gettpl = document.getElementById('colist').innerHTML;
|
||||
laytpl(gettpl).render(json, function(html){
|
||||
$('#contrastList').html(html);
|
||||
});
|
||||
$('.contImg').lazyload({ effect: "fadeIn",failurelimit : 10,skip_invisible : false,threshold: 200,placeholder:window.conf.IMGURL+'/'+window.conf.GOODS_LOGO});//商品默认图片
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
if(type==1)$("#j-cont-frame").addClass('show');
|
||||
});
|
||||
}else{
|
||||
$("#j-cont-frame").removeClass('show');
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function contrastDel(id){
|
||||
$.post(WST.U('home/goods/contrastDel'),{id:id},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
contrastGoods(1,0,1);
|
||||
}
|
||||
});
|
||||
}
|
||||
function informs($goodsId){
|
||||
if(window.conf.IS_LOGIN==0){
|
||||
WST.loginWindow();
|
||||
return;
|
||||
}
|
||||
location.href=WST.U("home/informs/inform",'id='+$goodsId);
|
||||
}
|
398
hyhproject/home/view/default/js/goodslist.js
Executable file
398
hyhproject/home/view/default/js/goodslist.js
Executable file
@ -0,0 +1,398 @@
|
||||
$(function(){
|
||||
$('.goodsImg2').lazyload({ effect: "fadeIn",failurelimit : 10,skip_invisible : false,threshold: 100,placeholder:window.conf.IMGURL+'/'+window.conf.GOODS_LOGO});//商品默认图片
|
||||
WST.dropDownLayer(".item",".dorp-down-layer");
|
||||
$('.item-more').click(function(){
|
||||
if($(this).attr('v')==1){
|
||||
$('.hideItem').show(300,'swing',function(){
|
||||
showMoreBtn();
|
||||
});
|
||||
$(this).find("span").html("收起");
|
||||
$(this).find("i").attr({"class":"drop-up"});
|
||||
$(this).attr('v',0);
|
||||
}else{
|
||||
$('.hideItem').hide(300);
|
||||
$(this).find("span").html("更多选项");
|
||||
$(this).find("i").attr({"class":"drop-down-icon"});
|
||||
$(this).attr('v',1);
|
||||
}
|
||||
});
|
||||
|
||||
$(".item-more").hover(function(){
|
||||
if($(this).find("i").hasClass("drop-down-icon")){
|
||||
$(this).find("i").attr({"class":"down-hover"});
|
||||
}else{
|
||||
$(this).find("i").attr({"class":"up-hover"});
|
||||
}
|
||||
|
||||
},function(){
|
||||
if($(this).find("i").hasClass("down-hover")){
|
||||
$(this).find("i").attr({"class":"drop-down"});
|
||||
}else{
|
||||
$(this).find("i").attr({"class":"drop-up"});
|
||||
}
|
||||
});
|
||||
$('.img_list li img').mouseover(function(){
|
||||
// 商品列表小图切换
|
||||
$(this).parent().siblings().removeClass('curr');
|
||||
$(this).parent().addClass('curr');
|
||||
var oldImgDom = $(this).parent().parent().parent().children('.img').children().children();
|
||||
oldImgDom.attr('src',this.src.replace('_thumb',''));
|
||||
})
|
||||
});
|
||||
|
||||
function goodsFilter(obj,vtype){
|
||||
if(vtype==1){
|
||||
$('#brand').val($(obj).attr('v'));
|
||||
}else if(vtype==2){
|
||||
var price = $(obj).attr('v');
|
||||
price = price.split('_');
|
||||
$('#sprice').val(price[0]);
|
||||
$('#eprice').val(price[1]);
|
||||
}else if(vtype==3){
|
||||
$('#v_'+$(obj).attr('d')).val($(obj).attr('v'));
|
||||
var vs = $('#vs').val();
|
||||
vs = (vs!='')?vs.split(','):[];
|
||||
vs.push($(obj).attr('d'));
|
||||
$('#vs').val(vs.join(','));
|
||||
}
|
||||
var ipts = WST.getParams('.sipt');
|
||||
if(vtype==4)ipts['order']='1';
|
||||
var params = [];
|
||||
for(var key in ipts){
|
||||
if(ipts[key]!='')params.push(key+"="+ipts[key]);
|
||||
}
|
||||
location.href=WST.U('home/goods/lists',params.join('&'),true);
|
||||
}
|
||||
function goodsOrder(orderby){
|
||||
if($('#orderBy').val()!=orderby){
|
||||
$('#order').val(1);
|
||||
}
|
||||
$('#orderBy').val(orderby);
|
||||
goodsFilter(null,0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function removeFilter(id){
|
||||
if(id!='price'){
|
||||
$('#'+id).val('');
|
||||
if(id.indexOf('v_')>-1){
|
||||
id = id.replace('v_','');
|
||||
var vs = $('#vs').val();
|
||||
vs = (vs!='')?vs.split(','):[];
|
||||
var nvs = [];
|
||||
for(var i=0;i<vs.length;i++){
|
||||
if(vs[i]!=id)nvs.push(vs[i]);
|
||||
}
|
||||
$('#vs').val(nvs.join(','));
|
||||
}
|
||||
}else{
|
||||
$('#sprice').val('');
|
||||
$('#eprice').val('');
|
||||
}
|
||||
var ipts = WST.getParams('.sipt');
|
||||
var params = [];
|
||||
for(var key in ipts){
|
||||
if(ipts[key]!='')params.push(key+"="+ipts[key]);
|
||||
}
|
||||
location.href=WST.U('home/goods/lists',params.join('&'),true);
|
||||
}
|
||||
/*搜索列表*/
|
||||
function searchFilter(obj,vtype){
|
||||
if(vtype==1){
|
||||
$('#brand').val($(obj).attr('v'));
|
||||
}else if(vtype==2){
|
||||
var price = $(obj).attr('v');
|
||||
price = price.split('_');
|
||||
$('#sprice').val(price[0]);
|
||||
$('#eprice').val(price[1]);
|
||||
}else if(vtype==3){
|
||||
$('#v_'+$(obj).attr('d')).val($(obj).attr('v'));
|
||||
var vs = $('#vs').val();
|
||||
vs = (vs!='')?vs.split(','):[];
|
||||
vs.push($(obj).attr('d'));
|
||||
$('#vs').val(vs.join(','));
|
||||
}
|
||||
var ipts = WST.getParams('.sipt');
|
||||
if(vtype==4)ipts['order']='1';
|
||||
var params = [];
|
||||
for(var key in ipts){
|
||||
if(ipts[key]!='')params.push(key+"="+ipts[key]);
|
||||
}
|
||||
location.href=WST.U('home/goods/search',params.join('&'),true);
|
||||
}
|
||||
function searchOrder(orderby){
|
||||
if($('#orderBy').val()!=orderby){
|
||||
$('#order').val(1);
|
||||
}
|
||||
$('#orderBy').val(orderby);
|
||||
searchFilter(null,0);
|
||||
}
|
||||
|
||||
|
||||
/*加入购物车*/
|
||||
$('.goods').hover(function(){
|
||||
$(this).find('.sale-num').hide();
|
||||
$(this).find('.p-add-cart').show();
|
||||
},function(){
|
||||
$(this).find('.sale-num').show();
|
||||
$(this).find('.p-add-cart').hide();
|
||||
})
|
||||
|
||||
|
||||
|
||||
/*发货地*/
|
||||
function gpanelOver(obj){
|
||||
var sid = $(obj).attr("id");
|
||||
|
||||
var index = $(obj).attr('c');
|
||||
|
||||
var ids = sid.split("_");
|
||||
var preid = ids[0]+"_"+ids[1];
|
||||
if(ids[2]==1){
|
||||
$("li[id^="+preid+"_]").hide();
|
||||
$("#"+sid).show();
|
||||
}else if(ids[2]==2){
|
||||
$('#fl_1_3').hide();
|
||||
}
|
||||
|
||||
$("li[id^="+preid+"_]").removeClass("j-tab-selected"+index);
|
||||
$("#"+sid).addClass("j-tab-selected"+index);
|
||||
|
||||
$("ul[id^="+preid+"_]").hide();
|
||||
$("#"+sid+"_pl").show();
|
||||
}
|
||||
function choiceArea(t,pid){
|
||||
var areaName = $(t).find('a').html();
|
||||
var parent = $(t).parent().attr('id');
|
||||
var ids = parent.split("_");
|
||||
var preid = "#"+ids[0]+"_"+ids[1]+"_"+ids[2];
|
||||
if(ids[2]==3){
|
||||
$(preid).find('a').html(areaName);
|
||||
// 执行发货地筛选
|
||||
$('#areaId').val(pid);
|
||||
var ipts = WST.getParams('.sipt');
|
||||
var params = [];
|
||||
for(var key in ipts){
|
||||
if(ipts[key]!='')params.push(key+"="+ipts[key]);
|
||||
}
|
||||
var url = ($(t).attr('search')==1)?'home/goods/search':'home/goods/lists';
|
||||
location.href=WST.U(url,params.join('&'));
|
||||
}else{
|
||||
// 替换当前选中地区
|
||||
$(preid).find('a').html(areaName);
|
||||
$(preid).removeClass('j-tab-selected'+ids[1]);
|
||||
|
||||
|
||||
var next = parseInt(ids[2])+1;
|
||||
var nextid = "#"+ids[0]+"_"+ids[1]+"_"+next;
|
||||
$(nextid).show();
|
||||
$(nextid).addClass("j-tab-selected"+ids[1]);
|
||||
// 替换下级地图标题
|
||||
$(nextid).html('<a href="javascript:void(0)">请选择</a>');
|
||||
|
||||
// 获取下级地区信息
|
||||
$.post(WST.U('home/areas/listQuery'),{parentId:pid},function(data){
|
||||
// 判断搜索页面
|
||||
var search = $(t).attr('search');
|
||||
if(search==1){search = 'search="1"';}
|
||||
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
var html = '';
|
||||
$(json.data).each(function(k,v){
|
||||
|
||||
html +='<li onclick="choiceArea(this,'+v.areaId+')" '+search+' ><a href="javascript:void(0)">'+v.areaName+'</a></li>';
|
||||
});
|
||||
$(nextid+"_pl").html(html);
|
||||
}
|
||||
});
|
||||
|
||||
// 隐藏当前地区,显示下级地区
|
||||
var preid = ids[0]+"_"+ids[1];
|
||||
$("ul[id^="+preid+"_]").hide();
|
||||
$(nextid+"_pl").show();
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************** 筛选 ******************************************/
|
||||
function showMoreBtn(){
|
||||
// 判断是否需要显示【更多】
|
||||
$('.item .content').each(function() {
|
||||
if (this.scrollHeight > 34) {
|
||||
$(this).parent().find('.extra .extra_more').css({visibility:'visible'});
|
||||
}
|
||||
});
|
||||
}
|
||||
$(function(){
|
||||
showMoreBtn();
|
||||
})
|
||||
function extra_show(obj){
|
||||
$(obj).addClass('extra_more_on');
|
||||
$(obj).parent().parent().find('ul').css({height:'auto'});
|
||||
$(obj).html('收起<i></i>');
|
||||
$(obj).attr('onClick','extra_hide(this)');
|
||||
}
|
||||
function extra_hide(obj){
|
||||
// 修改点击事件
|
||||
$(obj).removeClass('extra_more_on');
|
||||
$(obj).parent().parent().find('ul').css({height:'30px'});
|
||||
$(obj).attr('onClick','extra_show(this)');
|
||||
$(obj).html('更多<i></i>');
|
||||
}
|
||||
var _preObj;
|
||||
function multibox_show(obj,type){
|
||||
var _topParent = $(obj).parent().parent();
|
||||
// 显示被隐藏的选项
|
||||
_topParent.find('ul').css({height:'auto'});
|
||||
// 给每个li绑定事件
|
||||
_topParent.find('ul li').each(function(){
|
||||
$(this).attr('_onclick',$(this).attr('onclick'));
|
||||
$(this).removeAttr('onclick');
|
||||
$(this).click(function(){
|
||||
$(this).toggleClass('selected');
|
||||
($('li.selected').length>0)?_topParent.find('a.confirm_btn').css({visibility:'visible'}):_topParent.find('a.confirm_btn').css({visibility:'hidden'});
|
||||
})
|
||||
})
|
||||
// 隐藏右侧按钮
|
||||
$(obj).parent().hide();
|
||||
// 显示多选盒子
|
||||
_topParent.addClass('multi_on');
|
||||
_topParent.append('<div class="multi_btns"><a class="confirm_btn" href="javascript:void(0)" onClick="multi_done(this,\''+type+'\')">确定</a><a onClick="multibox_hide(this)" href="javascript:void(0)">取消</a></div>')
|
||||
// 隐藏上一个多选盒子
|
||||
if($('.multi_on').length>1){multibox_hide(_preObj)}
|
||||
_preObj = obj;
|
||||
}
|
||||
// 完成多选
|
||||
function multi_done(obj,type){
|
||||
var ids = [],attrId=0;
|
||||
// 获取选中的值
|
||||
$(obj).parent().parent().find('ul li.selected').each(function(){
|
||||
ids.push($(this).attr('v'));
|
||||
if(type=='attr')attrId = $(this).attr('d');
|
||||
})
|
||||
if(ids.length==0){
|
||||
WST.msg('请选择要筛选的选项');
|
||||
return false;
|
||||
}
|
||||
if(type=='brand'){
|
||||
$('#brand').val(ids.join(','));
|
||||
}else if(type=='attr'){
|
||||
$('#v_'+attrId).val(ids.join('、'));// 属性名称 -> 双卡双4G_电信4G_移动4G
|
||||
var vs = $('#vs').val();// 属性id【不需要再拼凑】
|
||||
vs = (vs!='')?vs.split(','):[];
|
||||
vs.push(attrId);
|
||||
$('#vs').val(vs.join(','));
|
||||
|
||||
}
|
||||
var ipts = WST.getParams('.sipt');
|
||||
var params = [];
|
||||
for(var key in ipts){
|
||||
if(ipts[key]!='')params.push(key+"="+ipts[key]);
|
||||
}
|
||||
location.href=WST.U('home/goods/lists',params.join('&'),true);
|
||||
|
||||
|
||||
}
|
||||
// 多选隐藏
|
||||
function multibox_hide(obj){
|
||||
var _topParent = $(obj).parent().parent();
|
||||
// 显示被隐藏的选项
|
||||
_topParent.find('ul').css({height:'30px'});
|
||||
// 给每个li绑定事件
|
||||
_topParent.find('ul li').each(function(){
|
||||
$(this).unbind('click');
|
||||
$(this).attr('onclick',$(this).attr('_onclick'));
|
||||
$(this).removeAttr('_onclick');
|
||||
$(this).removeClass('selected');
|
||||
})
|
||||
// 显示右侧按钮
|
||||
_topParent.find('div.extra').show();
|
||||
// 隐藏多选盒子
|
||||
_topParent.removeClass('multi_on');
|
||||
_topParent.find('div.multi_btns').remove();
|
||||
// 设置【更多】按钮
|
||||
var _moreBtn = _topParent.find('a.extra_more');
|
||||
_moreBtn.removeClass('extra_more_on');
|
||||
_moreBtn.attr('onClick','extra_show(this)');
|
||||
_moreBtn.html('更多<i></i>');
|
||||
}
|
||||
|
||||
//对比商品
|
||||
function contrastGoods(show,id,type){
|
||||
if(show==1){
|
||||
$.post(WST.U('home/goods/contrastGoods'),{id:id},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
if(type==2 && json.data)$("#j-cont-frame").addClass('show');
|
||||
var gettpl = document.getElementById('colist').innerHTML;
|
||||
laytpl(gettpl).render(json, function(html){
|
||||
$('#contrastList').html(html);
|
||||
});
|
||||
$('.contImg').lazyload({ effect: "fadeIn",failurelimit : 10,skip_invisible : false,threshold: 200,placeholder:window.conf.IMGURL+'/'+window.conf.GOODS_LOGO});//商品默认图片
|
||||
}else{
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
if(type==1)$("#j-cont-frame").addClass('show');
|
||||
});
|
||||
}else{
|
||||
$("#j-cont-frame").removeClass('show');
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function contrastDels(id){
|
||||
$.post(WST.U('home/goods/contrastDel'),{id:id},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
contrastGoods(1,0,1);
|
||||
}
|
||||
});
|
||||
}
|
||||
//对比商品列表
|
||||
//滑动
|
||||
function fixedGoods(){
|
||||
var offsetTop = $("#goodsTabs").offset().top;
|
||||
$(window).scroll(function() {
|
||||
var scrollTop = $(document).scrollTop();
|
||||
if (scrollTop > offsetTop){
|
||||
$("#goodsTabs").addClass('goods-fixed');
|
||||
$("#goodsTabs2").show();
|
||||
}else{
|
||||
$("#goodsTabs").removeClass('goods-fixed');
|
||||
$("#goodsTabs2").hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
//删除
|
||||
function contrastDel(id){
|
||||
$.post(WST.U('home/goods/contrastDel'),{id:id},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
location.href=WST.U('home/goods/contrast');
|
||||
}
|
||||
});
|
||||
}
|
||||
//筛选条件
|
||||
function screenContrast(obj,id){
|
||||
if ($(obj).is(':checked')) {
|
||||
$(".identical_"+id).addClass('active');
|
||||
}else{
|
||||
$(".identical_"+id).removeClass('active');
|
||||
}
|
||||
}
|
||||
//筛选规格
|
||||
function choiceContrast(obj,itemId,catId,goodsId){
|
||||
$(obj).addClass('active').siblings('.list-box li').removeClass('active');
|
||||
$("#defaultSpec_"+goodsId+"_"+catId).val(itemId);
|
||||
var specIds = [];
|
||||
$(".defaultSpec_"+goodsId).each(function(){
|
||||
specIds.push(parseInt($(this).val(),10));
|
||||
});
|
||||
specIds.sort(function(a,b){return a-b;});
|
||||
if(saleSpec.sku[goodsId][specIds.join(':')]){
|
||||
stock = saleSpec.sku[goodsId][specIds.join(':')].specStock;
|
||||
marketPrice = saleSpec.sku[goodsId][specIds.join(':')].marketPrice;
|
||||
goodsPrice = saleSpec.sku[goodsId][specIds.join(':')].specPrice;
|
||||
}
|
||||
$('#goods-price-'+goodsId).html('¥ <span>'+goodsPrice+'</span>');
|
||||
}
|
420
hyhproject/home/view/default/js/index.js
Executable file
420
hyhproject/home/view/default/js/index.js
Executable file
@ -0,0 +1,420 @@
|
||||
$.fn.TabiPanel = function(options){
|
||||
var defaults = {tab: 0};
|
||||
var opts = $.extend(defaults, options);
|
||||
var t = this;
|
||||
|
||||
$(t).find('.wst-tab-nav .tab').click(function(){
|
||||
$(this).addClass("on").siblings().removeClass("on");
|
||||
var index = $(this).index();
|
||||
$(t).find('.wst-tab-content .wst-tab-item').eq(index).show().siblings().hide();
|
||||
if(opts.callback)opts.callback(index);
|
||||
});
|
||||
$(t).find('.wst-tab-nav .tab').eq(opts.tab).click();
|
||||
}
|
||||
$(function(){
|
||||
WST.slides('.wst-slide');
|
||||
$('#index-tab').TabiPanel({tab:0,callback:function(no){}});
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*楼层*/
|
||||
function gpanelOver(obj){
|
||||
var sid = $(obj).attr("id");
|
||||
|
||||
var index = $(obj).attr('c');
|
||||
|
||||
var ids = sid.split("_");
|
||||
var preid = ids[0]+"_"+ids[1];
|
||||
|
||||
$("li[id^="+preid+"_]").removeClass("j-tab-selected"+index);
|
||||
$("#"+sid).addClass("j-tab-selected"+index);
|
||||
|
||||
$("div[id^="+preid+"_]").hide();
|
||||
$("#"+sid+"_pl").show();
|
||||
}
|
||||
|
||||
|
||||
/*楼层商品 加入购物车*/
|
||||
$('.goods').hover(function(){
|
||||
$(this).find('.sale-num').hide();
|
||||
$(this).find('.f-add-cart').show();
|
||||
},function(){
|
||||
$(this).find('.sale-num').show();
|
||||
$(this).find('.f-add-cart').hide();
|
||||
})
|
||||
|
||||
|
||||
/*楼层右侧滚动广告*/
|
||||
function floorAds(i){
|
||||
var slide = $('#wst-floor-slide-'+i), li = slide.find("li");
|
||||
var slidecontrols = $('#wst-floor-slide-controls-'+i),
|
||||
|
||||
span = slidecontrols.find("span");
|
||||
var index = 1, _self = null;
|
||||
span.bind("mouseover", function() {
|
||||
_self = $(this);
|
||||
index = span.index(_self);
|
||||
span.removeClass("curr");
|
||||
span.eq(index).addClass("curr");
|
||||
li.addClass("hide");
|
||||
li.css("z-index", -1);
|
||||
li.css("display", "none");
|
||||
li.eq(index).css("display", "");
|
||||
li.eq(index).css("z-index", 1);
|
||||
li.eq(index).removeClass("hide");
|
||||
clearInterval(timer);
|
||||
});
|
||||
var timer = setInterval(function() {
|
||||
span.removeClass("curr");
|
||||
span.eq(index).addClass("curr");
|
||||
li.addClass("hide");
|
||||
li.css("z-index", -1);
|
||||
li.css("display", "none");
|
||||
li.eq(index).fadeToggle(500);
|
||||
li.eq(index).css("z-index", 1);
|
||||
li.eq(index).removeClass("hide");
|
||||
index++;
|
||||
if (index >= span.length)
|
||||
index = 0;
|
||||
}, 3000);
|
||||
span.bind("mouseout", function() {
|
||||
timer = setInterval(function() {
|
||||
span.removeClass("curr");
|
||||
span.eq(index).addClass("curr");
|
||||
li.addClass("hide");
|
||||
li.css("z-index", -1);
|
||||
li.css("display", "none");
|
||||
li.eq(index).fadeToggle(500);
|
||||
li.eq(index).css("z-index", 1);
|
||||
li.eq(index).removeClass("hide");
|
||||
index++;
|
||||
if (index >= span.length)
|
||||
index = 0;
|
||||
}, 4000);
|
||||
});
|
||||
}
|
||||
$(function(){
|
||||
//执行楼层右侧广告js
|
||||
var fRAds = $(this).find("div[id^='wst-floor-slide-controls-']").length;
|
||||
for(var i=1;i<=fRAds;++i){
|
||||
floorAds(i);
|
||||
}
|
||||
//执行右侧底部商品切换js
|
||||
var fBgoods = $(this).find("ul[id^='styleMain']").length;
|
||||
for(var i=1;i<=fBgoods;++i){
|
||||
var li = $('#styleMain'+i).find('li');
|
||||
if(li.length>5){
|
||||
fBGoods(i);
|
||||
}else{
|
||||
li.each(function(){$(this).css('padding-bottom','0')})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
function fBGoods(id){
|
||||
$('#styleMain'+id).bxCarousel({
|
||||
display_num: 5,
|
||||
move: 1,
|
||||
auto: 0,
|
||||
controls: true,
|
||||
prev_image: WST.conf.ROOT+'/hyhproject/home/view/default/img/btn_slide_left.png',
|
||||
next_image: WST.conf.ROOT+'/hyhproject/home/view/default/img/btn_slide_right.png',
|
||||
margin: 10,
|
||||
auto_hover: true
|
||||
});
|
||||
}
|
||||
|
||||
function loadImg(){
|
||||
$('.fImg').lazyload({ failurelimit : 10,skip_invisible : false,threshold: 200,placeholder:window.conf.IMGURL+'/'+window.conf.GOODS_LOGO});
|
||||
}
|
||||
|
||||
/*左侧楼层导航*/
|
||||
$(function() {
|
||||
loadImg();
|
||||
});
|
||||
$('.lnav').click(function(){
|
||||
var i = $(this).index()+1;
|
||||
i = i+'F';
|
||||
$("html,body").animate({scrollTop: $("a[name='"+i+"']").offset().top-7}, 500);
|
||||
})
|
||||
|
||||
function leftNav(){
|
||||
//内容距离左边空白处宽度
|
||||
var containerW = $('.wst-container').offset().left;
|
||||
left = containerW-40;
|
||||
$('#screen-left-nav').css('left', left);
|
||||
}
|
||||
$(window).resize(function(){leftNav()});
|
||||
|
||||
|
||||
var currF,first=true;
|
||||
|
||||
function cf(){
|
||||
var sumFloor = $('.floor-box').length;
|
||||
for(var f=sumFloor;f>=1;--f){
|
||||
var id = '#c'+f;
|
||||
if($(id).offset().top+500-$(window).scrollTop()>0){
|
||||
currF = f;
|
||||
first = false;
|
||||
lcurr(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//内容高度
|
||||
var containerH = parseInt($('.wst-main').css('height'));
|
||||
$(window).scroll(function(){
|
||||
leftNav();
|
||||
//滚动条当前高度
|
||||
var scrollHeight = $(window).scrollTop();
|
||||
|
||||
// 楼层选中
|
||||
if(first){
|
||||
cf();
|
||||
}else{
|
||||
var cfh = $('#c'+currF).offset().top+500-$(window).scrollTop();
|
||||
if(cfh<0 || cfh>1200)cf();
|
||||
|
||||
}
|
||||
|
||||
if(scrollHeight>=462 && scrollHeight<containerH+200){
|
||||
$('#screen-left-nav').show();
|
||||
}else{
|
||||
$('#screen-left-nav').hide();
|
||||
}
|
||||
|
||||
});
|
||||
function lcurr(F){
|
||||
$('#F'+F).siblings().removeClass('lcurr');
|
||||
$('#F'+F).addClass('lcurr');
|
||||
}
|
||||
|
||||
/*签到*/
|
||||
function inSign(){
|
||||
$("#j-sign").attr('disabled', 'disabled');
|
||||
$.post(WST.U('home/userscores/signScore'),{},function(data){
|
||||
var json = WST.toJson(data,true);
|
||||
if(json.status==1){
|
||||
$("#j-sign .plus").html('+'+json.data.score);
|
||||
$("#currentScore").html(json.data.totalScore);
|
||||
$("#j-sign").addClass('active');
|
||||
setInterval(function(){
|
||||
$("#j-sign").addClass('actives').html('已签到');
|
||||
},600);
|
||||
WST.msg(json.msg, {icon: 1});
|
||||
}else{
|
||||
WST.msg(json.msg, {icon: 5});
|
||||
$("#j-sign").removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
WST.countDown = function(opts){
|
||||
var f = {
|
||||
zero: function(n){
|
||||
var n = parseInt(n, 10);
|
||||
if(n > 0){
|
||||
if(n <= 9){
|
||||
n = n;
|
||||
}
|
||||
return String(n);
|
||||
}else{
|
||||
return "0";
|
||||
}
|
||||
},
|
||||
count: function(){
|
||||
if(opts.nowTime){
|
||||
var d = new Date();
|
||||
d.setTime(opts.nowTime.getTime()+1000);
|
||||
opts.nowTime = d;
|
||||
d = null;
|
||||
}else{
|
||||
opts.nowTime = new Date();
|
||||
}
|
||||
//现在将来秒差值
|
||||
var dur = Math.round((opts.endTime.getTime() - opts.nowTime.getTime()) / 1000), pms = {
|
||||
sec: "0",
|
||||
mini: "0",
|
||||
hour: "0",
|
||||
day: "0"
|
||||
};
|
||||
if(dur > 0){
|
||||
pms.sec = f.zero(dur % 60);
|
||||
pms.mini = Math.floor((dur / 60)) > 0? f.zero(Math.floor((dur / 60)) % 60) : "0";
|
||||
pms.hour = Math.floor((dur / 3600)) > 0? f.zero(Math.floor((dur / 3600)) % 24) : "0";
|
||||
pms.day = Math.floor((dur / 86400)) > 0? f.zero(Math.floor(dur / 86400)) : "0";
|
||||
}
|
||||
pms.last = dur;
|
||||
pms.nowTime = opts.nowTime;
|
||||
opts.callback(pms);
|
||||
if(pms.last>0)setTimeout(f.count, 1000);
|
||||
}
|
||||
};
|
||||
f.count();
|
||||
};
|
||||
// 拍卖轮播
|
||||
$(function(){
|
||||
var _p = $('.aution_list');
|
||||
var step = _p.width();// 步进值
|
||||
var totalItem = $('.aution_list .aution_main').length;// 总拍卖商品数
|
||||
if(totalItem==0)return;
|
||||
var au_lbtn = $('.au_l_btn');
|
||||
var au_rbtn = $('.au_r_btn');
|
||||
|
||||
$('.ws-right-user').css({height:'85px',overflow:'hidden'});// 确保右侧不溢出轮播区域
|
||||
var nowTime = new Date(Date.parse($('.aution_list').attr('sc').replace(/-/g, "/")));
|
||||
// 倒计时
|
||||
$('.aution_main').each(function(){
|
||||
var g = $(this);
|
||||
var startTime = new Date(Date.parse(g.attr('sv').replace(/-/g, "/")));
|
||||
var endTime = new Date(Date.parse(g.attr('ev').replace(/-/g, "/")));
|
||||
if(startTime.getTime()<= nowTime && endTime.getTime() >=nowTime){
|
||||
var opts = {
|
||||
nowTime: nowTime,
|
||||
endTime: endTime,
|
||||
callback: function(data){
|
||||
if(data.last>0){
|
||||
g.find('.aution_time .aution_h').html(data.hour);
|
||||
g.find('.aution_time .aution_i').html(data.mini);
|
||||
g.find('.aution_time .aution_s').html(data.sec);
|
||||
}else{
|
||||
g.find('.aution_time').html('拍卖活动已结束');
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
WST.countDown(opts);
|
||||
}else{
|
||||
g.find('.aution_time').html('拍卖活动已结束');
|
||||
}
|
||||
})
|
||||
|
||||
// 设置父容器宽度
|
||||
_p.css({width:totalItem+'00%'});
|
||||
var _curr = 0;// 当前显示的index
|
||||
// 右切换按钮
|
||||
au_rbtn.click(function(){
|
||||
_curr++;
|
||||
if (_curr + 1 > totalItem) { _curr = 0 }
|
||||
au_s();
|
||||
return false;
|
||||
});
|
||||
// 左切换按钮
|
||||
au_lbtn.click(function(){
|
||||
_curr--;
|
||||
if (_curr + 1 < 1) {
|
||||
_curr = totalItem - 1
|
||||
}
|
||||
au_s();
|
||||
return false;
|
||||
});
|
||||
function au_auto_swiper() { y = setInterval(function () { au_rbtn.click() }, 5000) }
|
||||
au_auto_swiper();
|
||||
$('.aution_out').bind({ mouseover: function () { clearInterval(y);au_lbtn.show();au_rbtn.show(); }, mouseout: function () { au_auto_swiper();au_lbtn.hide();au_rbtn.hide(); } })
|
||||
// 执行切换
|
||||
function au_s(){
|
||||
_p.stop().animate({left:-_curr*step});
|
||||
}
|
||||
})
|
||||
|
||||
// 团购轮播
|
||||
$(function(){
|
||||
var g_list_time;
|
||||
var g_obj = $('.groupon_view');
|
||||
var g_step = g_obj.width();// 步进值
|
||||
var g_list = $('.groupon_list'); // 轮播对象
|
||||
// 设置长度
|
||||
var g_list_w = $('.groupon_list li').length;
|
||||
g_list.css({width:g_list_w*100+'%'});
|
||||
var g_list_i = 0;
|
||||
|
||||
// 按钮
|
||||
$('.groupon_btns span').each(function(k,v){
|
||||
$(this).mouseover(function(){
|
||||
clearInterval(g_list_time);
|
||||
g_list_i = k;
|
||||
g_list_auto();
|
||||
})
|
||||
});
|
||||
$('.groupon_btns').mouseout(function(){glistautoplay();})
|
||||
function glistautoplay(){
|
||||
clearInterval(g_list_time);
|
||||
g_list_time = setInterval(function(){
|
||||
g_list_i++;
|
||||
if (g_list_i + 1 > g_list_w) { g_list_i = 0 }
|
||||
g_list_auto();
|
||||
},3000);
|
||||
}
|
||||
function g_list_auto(){
|
||||
g_list.stop().animate({left:-g_list_i*g_step});
|
||||
$('.groupon_btns span').removeClass('curr').eq(g_list_i).addClass('curr')
|
||||
}
|
||||
glistautoplay();
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 楼层商品轮播
|
||||
$(function(){
|
||||
var a = $(".floor_silder");
|
||||
a.each(function () {
|
||||
var q = $(this);
|
||||
var s = q.find("ul");
|
||||
var t = q.find("ul li");
|
||||
var c = q.find(".prev_btn");
|
||||
var w = q.find(".next_btn");
|
||||
var u = t.length;
|
||||
// q.find(".show_num").find("em").html(u);
|
||||
if (u == 1) { return }
|
||||
var p = 0;
|
||||
var y = 0;
|
||||
var x = 3000; // 轮播间隔
|
||||
w.click(function () { // 下一张
|
||||
p++;
|
||||
if (p + 1 > u) { p = 0 }
|
||||
z(p);
|
||||
v();
|
||||
return false
|
||||
});
|
||||
c.click(function () { // 上一张
|
||||
p--;
|
||||
if (p + 1 < 1) {
|
||||
p = u - 1
|
||||
}
|
||||
z(p);
|
||||
v();
|
||||
return false
|
||||
});
|
||||
function z(e) {// 执行轮播
|
||||
switch (e) {
|
||||
case 2:
|
||||
t.eq(e).css("z-index", 100).stop().animate({ width: 155, height: 225, left: 20, top: 0 });
|
||||
t.eq(e - 1).css("z-index", 80).stop().animate({ width: 195, height: 170, left: 0, top:30 });
|
||||
t.eq(e - 2).css("z-index", 90).stop().animate({ width: 175, height: 200, left: 10, top: 15 });
|
||||
t.eq(e).find(".color_mask").stop().animate({ opacity: 0 });
|
||||
t.eq(e - 1).find(".color_mask").stop().animate({ opacity: 0.7 });
|
||||
t.eq(e - 2).find(".color_mask").stop().animate({ opacity: 0.5 });
|
||||
break;
|
||||
default:
|
||||
t.eq(e).css("z-index", 100).stop().animate({ width: 155, height: 225, left: 20, top: 0 });
|
||||
t.eq(e - 1).css("z-index", 80).stop().animate({ width: 195, height: 170, left: 0, top: 30 });
|
||||
t.eq(e + 1).css("z-index", 90).stop().animate({ width: 175, height: 200, left: 10, top: 15 });
|
||||
t.eq(e).find(".color_mask").stop().animate({ opacity: 0 });
|
||||
t.eq(e - 1).find(".color_mask").stop().animate({ opacity: 0.7 });
|
||||
t.eq(e + 1).find(".color_mask").stop().animate({ opacity: 0.5 });
|
||||
}
|
||||
}
|
||||
function v() {
|
||||
// 当前显示张数
|
||||
q.find(".show_num").find("span").removeClass('curr').eq(p).addClass('curr');
|
||||
}
|
||||
function r() { y = setInterval(function () { w.click() }, x) }
|
||||
r();
|
||||
$(this).bind({ mouseover: function () { clearInterval(y) }, mouseout: function () { r() } })
|
||||
})
|
||||
})
|
1714
hyhproject/home/view/default/js/jquery.als.js
Executable file
1714
hyhproject/home/view/default/js/jquery.als.js
Executable file
File diff suppressed because it is too large
Load Diff
218
hyhproject/home/view/default/js/login.js
Executable file
218
hyhproject/home/view/default/js/login.js
Executable file
@ -0,0 +1,218 @@
|
||||
function login(typ){
|
||||
var params = WST.getParams('.ipt');
|
||||
if(!$('#loginName').isValid())return;
|
||||
if(!$('#loginPwd').isValid())return;
|
||||
if(!$('#verifyCode').isValid())return;
|
||||
if(window.conf.IS_CRYPT=='1'){
|
||||
var public_key=$('#token').val();
|
||||
var exponent="10001";
|
||||
var rsa = new RSAKey();
|
||||
rsa.setPublic(public_key, exponent);
|
||||
params.loginPwd = rsa.encrypt(params.loginPwd);
|
||||
}
|
||||
var ll = WST.load({msg:'正在处理数据,请稍后...'});
|
||||
$.post(WST.U('home/users/checkLogin'),params,function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status=='1'){
|
||||
WST.msg(json.msg, {icon: 1});
|
||||
var url = json.url;
|
||||
if(WST.blank(url)){
|
||||
location.href = url;
|
||||
}else{
|
||||
if(typ==2){
|
||||
location.href=WST.U('home/shops/index');
|
||||
}else if(typ==1){
|
||||
location.href=WST.U('home/users/index');
|
||||
}else{
|
||||
parent.location.reload();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
layer.close(ll);
|
||||
WST.msg(json.msg, {icon: 5});
|
||||
WST.getVerify('#verifyImg');
|
||||
}
|
||||
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function showProtocol(){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '用户注册协议',
|
||||
shadeClose: true,
|
||||
shade: 0.8,
|
||||
area: ['1000px', ($(window).height() - 50) +'px'],
|
||||
content: [WST.U('home/users/protocol')],
|
||||
btn: ['同意并注册'],
|
||||
yes: function(index, layero){
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var time = 0;
|
||||
var isSend = false;
|
||||
var isUse = false;
|
||||
var index2 = null;
|
||||
function getVerifyCode(){
|
||||
var params = {};
|
||||
params.userPhone = $.trim($("#loginName").val());
|
||||
if(params.userPhone==''){
|
||||
WST.msg('请输入手机号码!', {icon: 5});
|
||||
return;
|
||||
}
|
||||
if(isSend )return;
|
||||
isSend = true;
|
||||
if(window.conf.SMS_VERFY=='1'){
|
||||
var html = [];
|
||||
html.push('<table class="wst-smsverfy"><tr><td width="80" align="right">');
|
||||
html.push('验证码:</td><td><input type="text" id="smsVerfyl" size="12" class="wst-text" maxLength="8">');
|
||||
html.push('<img style="vertical-align:middle;cursor:pointer;height:39px;" class="verifyImgd" src="'+WST.DOMAIN+'/hyhproject/Home/View/default/images/clickForVerify.png" title="刷新验证码" onclick="javascript:WST.getVerify(\'.verifyImgd\')"/>');
|
||||
html.push('</td></tr></table>');
|
||||
index2 = layer.open({
|
||||
title:'请输入验证码',
|
||||
type: 1,
|
||||
area: ['420px', '150px'], //宽高
|
||||
content: html.join(''),
|
||||
btn: ['发送验证码'],
|
||||
success: function(layero, index){
|
||||
WST.getVerify('.verifyImgd');
|
||||
},
|
||||
yes: function(index, layero){
|
||||
isSend = true;
|
||||
params.smsVerfy = $.trim($('#smsVerfyl').val());
|
||||
if(params.smsVerfy==''){
|
||||
WST.msg('请输入验证码!', {icon: 5});
|
||||
return;
|
||||
}
|
||||
getPhoneVerifyCode(params);
|
||||
},
|
||||
cancel:function(){
|
||||
isSend = false;
|
||||
}
|
||||
});
|
||||
}else{
|
||||
isSend = true;
|
||||
getPhoneVerifyCode(params);
|
||||
}
|
||||
}
|
||||
|
||||
function getPhoneVerifyCode(params){
|
||||
WST.msg('正在发送短信,请稍后...',{time:600000});
|
||||
$.post(WST.U('home/users/getPhoneVerifyCode'),params,function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status!=1){
|
||||
WST.msg(json.msg, {icon: 5});
|
||||
time = 0;
|
||||
isSend = false;
|
||||
}if(json.status==1){
|
||||
WST.msg('短信已发送,请注意查收');
|
||||
time = 120;
|
||||
$('#timeTips').css('width','100px');
|
||||
$('#timeTips').html('获取验证码(120)');
|
||||
$('#mobileCode').val(json.phoneVerifyCode);
|
||||
var task = setInterval(function(){
|
||||
time--;
|
||||
$('#timeTips').html('获取验证码('+time+")");
|
||||
if(time==0){
|
||||
isSend = false;
|
||||
clearInterval(task);
|
||||
$('#timeTips').html("重新获取验证码");
|
||||
}
|
||||
},1000);
|
||||
}
|
||||
if(json.status!=-2)layer.close(index2);
|
||||
});
|
||||
}
|
||||
function initRegist(){
|
||||
// 阻止按下回车键时触发短信验证码弹窗
|
||||
document.onkeydown=function(event){
|
||||
var e = event || window.event || arguments.callee.caller.arguments[0];
|
||||
if(e && e.keyCode==13){ // enter 键
|
||||
$('#reg_butt').submit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$('#reg_form').validator({
|
||||
rules: {
|
||||
loginName: function(element) {
|
||||
if(this.test(element, "mobile")===true){
|
||||
if(window.conf.SMS_OPEN=='1'){
|
||||
$("#mobileCodeDiv").show();
|
||||
$("#refreshCode").hide();
|
||||
$("#authCodeDiv").hide();
|
||||
$("#nameType").val('3');
|
||||
}else{
|
||||
$("#nameType").val('2');
|
||||
}
|
||||
}
|
||||
return this.test(element, "mobile")===true || '请填写有效的手机号';
|
||||
},
|
||||
mobileCode: function(element){
|
||||
if(window.conf.SMS_OPEN=='1'){
|
||||
if(this.test(document.getElementById("loginName"), "mobile")===true){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
verifyCode: function(element){
|
||||
if(this.test(document.getElementById("loginName"), "mobile")===false){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
},
|
||||
//自定义remote规则(注意:虽然remote规则已经内置,但这里的remote会优先于内置)
|
||||
remote: function(element){
|
||||
return $.post(WST.U('home/users/checkLoginKey'),{"loginName":element.value},function(data,textStatus){
|
||||
|
||||
});
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
'loginName': 'required; loginName; remote;',
|
||||
'loginPwd' : '密码:required; password;',
|
||||
'reUserPwd': '确认密码:required; match(loginPwd);',
|
||||
'mobileCode': {rule:"required(mobileCode)",msg:{required:'请输入短信验证码'}},
|
||||
'verifyCode': {rule:"required(verifyCode)",msg:{required:'请输入验证码'}}
|
||||
},
|
||||
// 表单验证通过后,ajax提交
|
||||
valid: function(form){
|
||||
var me = this;
|
||||
// ajax提交表单之前,先禁用submit
|
||||
me.holdSubmit();
|
||||
var params = WST.getParams('.wst_ipt');
|
||||
if(WST.conf.IS_CRYPT=='1'){
|
||||
var public_key=$('#token').val();
|
||||
var exponent="10001";
|
||||
var rsa = new RSAKey();
|
||||
rsa.setPublic(public_key, exponent);
|
||||
params.loginPwd = rsa.encrypt(params.loginPwd);
|
||||
params.reUserPwd = rsa.encrypt(params.reUserPwd);
|
||||
}
|
||||
$("#reg_butt").css('color', '#999').text('正在提交..');
|
||||
$.post(WST.U('home/users/toRegist'),params,function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status>0){
|
||||
WST.msg('注册成功,正在跳转登录!', {icon: 1}, function(){
|
||||
var url = json.url;
|
||||
if(WST.blank(url)){
|
||||
location.href = url;
|
||||
}else{
|
||||
location.href=WST.U('home/users/index');
|
||||
}
|
||||
});
|
||||
}else{
|
||||
me.holdSubmit(false);
|
||||
WST.getVerify('#verifyImg');
|
||||
WST.msg(json.msg, {icon: 5});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
88
hyhproject/home/view/default/js/qrcode.js
Executable file
88
hyhproject/home/view/default/js/qrcode.js
Executable file
@ -0,0 +1,88 @@
|
||||
|
||||
var qrcode=function(){var qrcode=function(typeNumber,errorCorrectLevel){var PAD0=0xEC;var PAD1=0x11;var _typeNumber=typeNumber;var _errorCorrectLevel=QRErrorCorrectLevel[errorCorrectLevel];var _modules=null;var _moduleCount=0;var _dataCache=null;var _dataList=new Array();var _this={};var makeImpl=function(test,maskPattern){_moduleCount=_typeNumber*4+17;_modules=function(moduleCount){var modules=new Array(moduleCount);for(var row=0;row<moduleCount;row+=1){modules[row]=new Array(moduleCount);for(var col=0;col<moduleCount;col+=1){modules[row][col]=null;}}
|
||||
return modules;}(_moduleCount);setupPositionProbePattern(0,0);setupPositionProbePattern(_moduleCount-7,0);setupPositionProbePattern(0,_moduleCount-7);setupPositionAdjustPattern();setupTimingPattern();setupTypeInfo(test,maskPattern);if(_typeNumber>=7){setupTypeNumber(test);}
|
||||
if(_dataCache==null){_dataCache=createData(_typeNumber,_errorCorrectLevel,_dataList);}
|
||||
mapData(_dataCache,maskPattern);};var setupPositionProbePattern=function(row,col){for(var r=-1;r<=7;r+=1){if(row+r<=-1||_moduleCount<=row+r)continue;for(var c=-1;c<=7;c+=1){if(col+c<=-1||_moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){_modules[row+r][col+c]=true;}else{_modules[row+r][col+c]=false;}}}};var getBestMaskPattern=function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i+=1){makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(_this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}}
|
||||
return pattern;};var setupTimingPattern=function(){for(var r=8;r<_moduleCount-8;r+=1){if(_modules[r][6]!=null){continue;}
|
||||
_modules[r][6]=(r%2==0);}
|
||||
for(var c=8;c<_moduleCount-8;c+=1){if(_modules[6][c]!=null){continue;}
|
||||
_modules[6][c]=(c%2==0);}};var setupPositionAdjustPattern=function(){var pos=QRUtil.getPatternPosition(_typeNumber);for(var i=0;i<pos.length;i+=1){for(var j=0;j<pos.length;j+=1){var row=pos[i];var col=pos[j];if(_modules[row][col]!=null){continue;}
|
||||
for(var r=-2;r<=2;r+=1){for(var c=-2;c<=2;c+=1){if(r==-2||r==2||c==-2||c==2||(r==0&&c==0)){_modules[row+r][col+c]=true;}else{_modules[row+r][col+c]=false;}}}}}};var setupTypeNumber=function(test){var bits=QRUtil.getBCHTypeNumber(_typeNumber);for(var i=0;i<18;i+=1){var mod=(!test&&((bits>>i)&1)==1);_modules[Math.floor(i/3)][i%3+_moduleCount-8-3]=mod;}
|
||||
for(var i=0;i<18;i+=1){var mod=(!test&&((bits>>i)&1)==1);_modules[i%3+_moduleCount-8-3][Math.floor(i/3)]=mod;}};var setupTypeInfo=function(test,maskPattern){var data=(_errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i+=1){var mod=(!test&&((bits>>i)&1)==1);if(i<6){_modules[i][8]=mod;}else if(i<8){_modules[i+1][8]=mod;}else{_modules[_moduleCount-15+i][8]=mod;}}
|
||||
for(var i=0;i<15;i+=1){var mod=(!test&&((bits>>i)&1)==1);if(i<8){_modules[8][_moduleCount-i-1]=mod;}else if(i<9){_modules[8][15-i-1+1]=mod;}else{_modules[8][15-i-1]=mod;}}
|
||||
_modules[_moduleCount-8][8]=(!test);};var mapData=function(data,maskPattern){var inc=-1;var row=_moduleCount-1;var bitIndex=7;var byteIndex=0;var maskFunc=QRUtil.getMaskFunction(maskPattern);for(var col=_moduleCount-1;col>0;col-=2){if(col==6)col-=1;while(true){for(var c=0;c<2;c+=1){if(_modules[row][col-c]==null){var dark=false;if(byteIndex<data.length){dark=(((data[byteIndex]>>>bitIndex)&1)==1);}
|
||||
var mask=maskFunc(row,col-c);if(mask){dark=!dark;}
|
||||
_modules[row][col-c]=dark;bitIndex-=1;if(bitIndex==-1){byteIndex+=1;bitIndex=7;}}}
|
||||
row+=inc;if(row<0||_moduleCount<=row){row-=inc;inc=-inc;break;}}}};var createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r<rsBlocks.length;r+=1){var dcCount=rsBlocks[r].dataCount;var ecCount=rsBlocks[r].totalCount-dcCount;maxDcCount=Math.max(maxDcCount,dcCount);maxEcCount=Math.max(maxEcCount,ecCount);dcdata[r]=new Array(dcCount);for(var i=0;i<dcdata[r].length;i+=1){dcdata[r][i]=0xff&buffer.getBuffer()[i+offset];}
|
||||
offset+=dcCount;var rsPoly=QRUtil.getErrorCorrectPolynomial(ecCount);var rawPoly=qrPolynomial(dcdata[r],rsPoly.getLength()-1);var modPoly=rawPoly.mod(rsPoly);ecdata[r]=new Array(rsPoly.getLength()-1);for(var i=0;i<ecdata[r].length;i+=1){var modIndex=i+modPoly.getLength()-ecdata[r].length;ecdata[r][i]=(modIndex>=0)?modPoly.getAt(modIndex):0;}}
|
||||
var totalCodeCount=0;for(var i=0;i<rsBlocks.length;i+=1){totalCodeCount+=rsBlocks[i].totalCount;}
|
||||
var data=new Array(totalCodeCount);var index=0;for(var i=0;i<maxDcCount;i+=1){for(var r=0;r<rsBlocks.length;r+=1){if(i<dcdata[r].length){data[index]=dcdata[r][i];index+=1;}}}
|
||||
for(var i=0;i<maxEcCount;i+=1){for(var r=0;r<rsBlocks.length;r+=1){if(i<ecdata[r].length){data[index]=ecdata[r][i];index+=1;}}}
|
||||
return data;};var createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=qrBitBuffer();for(var i=0;i<dataList.length;i+=1){var data=dataList[i];buffer.put(data.getMode(),4);buffer.put(data.getLength(),QRUtil.getLengthInBits(data.getMode(),typeNumber));data.write(buffer);}
|
||||
var totalDataCount=0;for(var i=0;i<rsBlocks.length;i+=1){totalDataCount+=rsBlocks[i].dataCount;}
|
||||
if(buffer.getLengthInBits()>totalDataCount*8){throw new Error('code length overflow. ('
|
||||
+buffer.getLengthInBits()
|
||||
+'>'
|
||||
+totalDataCount*8
|
||||
+')');}
|
||||
if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);}
|
||||
while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);}
|
||||
while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;}
|
||||
buffer.put(PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;}
|
||||
buffer.put(PAD1,8);}
|
||||
return createBytes(buffer,rsBlocks);};_this.addData=function(data){var newData=qr8BitByte(data);_dataList.push(newData);_dataCache=null;};_this.isDark=function(row,col){if(row<0||_moduleCount<=row||col<0||_moduleCount<=col){throw new Error(row+','+col);}
|
||||
return _modules[row][col];};_this.getModuleCount=function(){return _moduleCount;};_this.make=function(){makeImpl(false,getBestMaskPattern());};_this.createTableTag=function(cellSize,margin){cellSize=cellSize||2;margin=(typeof margin=='undefined')?cellSize*4:margin;var qrHtml='';qrHtml+='<table style="';qrHtml+=' border-width: 0px; border-style: none;';qrHtml+=' border-collapse: collapse;';qrHtml+=' padding: 0px; margin: '+margin+'px;';qrHtml+='">';qrHtml+='<tbody>';for(var r=0;r<_this.getModuleCount();r+=1){qrHtml+='<tr>';for(var c=0;c<_this.getModuleCount();c+=1){qrHtml+='<td style="';qrHtml+=' border-width: 0px; border-style: none;';qrHtml+=' border-collapse: collapse;';qrHtml+=' padding: 0px; margin: 0px;';qrHtml+=' width: '+cellSize+'px;';qrHtml+=' height: '+cellSize+'px;';qrHtml+=' background-color: ';qrHtml+=_this.isDark(r,c)?'#000000':'#ffffff';qrHtml+=';';qrHtml+='"/>';}
|
||||
qrHtml+='</tr>';}
|
||||
qrHtml+='</tbody>';qrHtml+='</table>';return qrHtml;};_this.createImgTag=function(cellSize,margin){cellSize=cellSize||2;margin=(typeof margin=='undefined')?cellSize*4:margin;var size=_this.getModuleCount()*cellSize+margin*2;var min=margin;var max=size-margin;return createImgTag(size,size,function(x,y){if(min<=x&&x<max&&min<=y&&y<max){var c=Math.floor((x-min)/cellSize);var r=Math.floor((y-min)/cellSize);return _this.isDark(r,c)?0:1;}else{return 1;}});};return _this;};qrcode.stringToBytes=function(s){var bytes=new Array();for(var i=0;i<s.length;i+=1){var c=s.charCodeAt(i);bytes.push(c&0xff);}
|
||||
return bytes;};qrcode.createStringToBytes=function(unicodeData,numChars){var unicodeMap=function(){var bin=base64DecodeInputStream(unicodeData);var read=function(){var b=bin.read();if(b==-1)throw new Error();return b;};var count=0;var unicodeMap={};while(true){var b0=bin.read();if(b0==-1)break;var b1=read();var b2=read();var b3=read();var k=String.fromCharCode((b0<<8)|b1);var v=(b2<<8)|b3;unicodeMap[k]=v;count+=1;}
|
||||
if(count!=numChars){throw new Error(count+' != '+numChars);}
|
||||
return unicodeMap;}();var unknownChar='?'.charCodeAt(0);return function(s){var bytes=new Array();for(var i=0;i<s.length;i+=1){var c=s.charCodeAt(i);if(c<128){bytes.push(c);}else{var b=unicodeMap[s.charAt(i)];if(typeof b=='number'){if((b&0xff)==b){bytes.push(b);}else{bytes.push(b>>>8);bytes.push(b&0xff);}}else{bytes.push(unknownChar);}}}
|
||||
return bytes;};};var QRMode={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3};var QRErrorCorrectLevel={L:1,M:0,Q:3,H:2};var QRMaskPattern={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var QRUtil=function(){var PATTERN_POSITION_TABLE=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]];var G15=(1<<10)|(1<<8)|(1<<5)|(1<<4)|(1<<2)|(1<<1)|(1<<0);var G18=(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<5)|(1<<2)|(1<<0);var G15_MASK=(1<<14)|(1<<12)|(1<<10)|(1<<4)|(1<<1);var _this={};var getBCHDigit=function(data){var digit=0;while(data!=0){digit+=1;data>>>=1;}
|
||||
return digit;};_this.getBCHTypeInfo=function(data){var d=data<<10;while(getBCHDigit(d)-getBCHDigit(G15)>=0){d^=(G15<<(getBCHDigit(d)-getBCHDigit(G15)));}
|
||||
return((data<<10)|d)^G15_MASK;};_this.getBCHTypeNumber=function(data){var d=data<<12;while(getBCHDigit(d)-getBCHDigit(G18)>=0){d^=(G18<<(getBCHDigit(d)-getBCHDigit(G18)));}
|
||||
return(data<<12)|d;};_this.getPatternPosition=function(typeNumber){return PATTERN_POSITION_TABLE[typeNumber-1];};_this.getMaskFunction=function(maskPattern){switch(maskPattern){case QRMaskPattern.PATTERN000:return function(i,j){return(i+j)%2==0;};case QRMaskPattern.PATTERN001:return function(i,j){return i%2==0;};case QRMaskPattern.PATTERN010:return function(i,j){return j%3==0;};case QRMaskPattern.PATTERN011:return function(i,j){return(i+j)%3==0;};case QRMaskPattern.PATTERN100:return function(i,j){return(Math.floor(i/2)+Math.floor(j/3))%2==0;};case QRMaskPattern.PATTERN101:return function(i,j){return(i*j)%2+(i*j)%3==0;};case QRMaskPattern.PATTERN110:return function(i,j){return((i*j)%2+(i*j)%3)%2==0;};case QRMaskPattern.PATTERN111:return function(i,j){return((i*j)%3+(i+j)%2)%2==0;};default:throw new Error('bad maskPattern:'+maskPattern);}};_this.getErrorCorrectPolynomial=function(errorCorrectLength){var a=qrPolynomial([1],0);for(var i=0;i<errorCorrectLength;i+=1){a=a.multiply(qrPolynomial([1,QRMath.gexp(i)],0));}
|
||||
return a;};_this.getLengthInBits=function(mode,type){if(1<=type&&type<10){switch(mode){case QRMode.MODE_NUMBER:return 10;case QRMode.MODE_ALPHA_NUM:return 9;case QRMode.MODE_8BIT_BYTE:return 8;case QRMode.MODE_KANJI:return 8;default:throw new Error('mode:'+mode);}}else if(type<27){switch(mode){case QRMode.MODE_NUMBER:return 12;case QRMode.MODE_ALPHA_NUM:return 11;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 10;default:throw new Error('mode:'+mode);}}else if(type<41){switch(mode){case QRMode.MODE_NUMBER:return 14;case QRMode.MODE_ALPHA_NUM:return 13;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 12;default:throw new Error('mode:'+mode);}}else{throw new Error('type:'+type);}};_this.getLostPoint=function(qrcode){var moduleCount=qrcode.getModuleCount();var lostPoint=0;for(var row=0;row<moduleCount;row+=1){for(var col=0;col<moduleCount;col+=1){var sameCount=0;var dark=qrcode.isDark(row,col);for(var r=-1;r<=1;r+=1){if(row+r<0||moduleCount<=row+r){continue;}
|
||||
for(var c=-1;c<=1;c+=1){if(col+c<0||moduleCount<=col+c){continue;}
|
||||
if(r==0&&c==0){continue;}
|
||||
if(dark==qrcode.isDark(row+r,col+c)){sameCount+=1;}}}
|
||||
if(sameCount>5){lostPoint+=(3+sameCount-5);}}};for(var row=0;row<moduleCount-1;row+=1){for(var col=0;col<moduleCount-1;col+=1){var count=0;if(qrcode.isDark(row,col))count+=1;if(qrcode.isDark(row+1,col))count+=1;if(qrcode.isDark(row,col+1))count+=1;if(qrcode.isDark(row+1,col+1))count+=1;if(count==0||count==4){lostPoint+=3;}}}
|
||||
for(var row=0;row<moduleCount;row+=1){for(var col=0;col<moduleCount-6;col+=1){if(qrcode.isDark(row,col)&&!qrcode.isDark(row,col+1)&&qrcode.isDark(row,col+2)&&qrcode.isDark(row,col+3)&&qrcode.isDark(row,col+4)&&!qrcode.isDark(row,col+5)&&qrcode.isDark(row,col+6)){lostPoint+=40;}}}
|
||||
for(var col=0;col<moduleCount;col+=1){for(var row=0;row<moduleCount-6;row+=1){if(qrcode.isDark(row,col)&&!qrcode.isDark(row+1,col)&&qrcode.isDark(row+2,col)&&qrcode.isDark(row+3,col)&&qrcode.isDark(row+4,col)&&!qrcode.isDark(row+5,col)&&qrcode.isDark(row+6,col)){lostPoint+=40;}}}
|
||||
var darkCount=0;for(var col=0;col<moduleCount;col+=1){for(var row=0;row<moduleCount;row+=1){if(qrcode.isDark(row,col)){darkCount+=1;}}}
|
||||
var ratio=Math.abs(100*darkCount/moduleCount/moduleCount-50)/5;lostPoint+=ratio*10;return lostPoint;};return _this;}();var QRMath=function(){var EXP_TABLE=new Array(256);var LOG_TABLE=new Array(256);for(var i=0;i<8;i+=1){EXP_TABLE[i]=1<<i;}
|
||||
for(var i=8;i<256;i+=1){EXP_TABLE[i]=EXP_TABLE[i-4]^EXP_TABLE[i-5]^EXP_TABLE[i-6]^EXP_TABLE[i-8];}
|
||||
for(var i=0;i<255;i+=1){LOG_TABLE[EXP_TABLE[i]]=i;}
|
||||
var _this={};_this.glog=function(n){if(n<1){throw new Error('glog('+n+')');}
|
||||
return LOG_TABLE[n];};_this.gexp=function(n){while(n<0){n+=255;}
|
||||
while(n>=256){n-=255;}
|
||||
return EXP_TABLE[n];};return _this;}();function qrPolynomial(num,shift){if(typeof num.length=='undefined'){throw new Error(num.length+'/'+shift);}
|
||||
var _num=function(){var offset=0;while(offset<num.length&&num[offset]==0){offset+=1;}
|
||||
var _num=new Array(num.length-offset+shift);for(var i=0;i<num.length-offset;i+=1){_num[i]=num[i+offset];}
|
||||
return _num;}();var _this={};_this.getAt=function(index){return _num[index];};_this.getLength=function(){return _num.length;};_this.multiply=function(e){var num=new Array(_this.getLength()+e.getLength()-1);for(var i=0;i<_this.getLength();i+=1){for(var j=0;j<e.getLength();j+=1){num[i+j]^=QRMath.gexp(QRMath.glog(_this.getAt(i))+QRMath.glog(e.getAt(j)));}}
|
||||
return qrPolynomial(num,0);};_this.mod=function(e){if(_this.getLength()-e.getLength()<0){return _this;}
|
||||
var ratio=QRMath.glog(_this.getAt(0))-QRMath.glog(e.getAt(0));var num=new Array(_this.getLength());for(var i=0;i<_this.getLength();i+=1){num[i]=_this.getAt(i);}
|
||||
for(var i=0;i<e.getLength();i+=1){num[i]^=QRMath.gexp(QRMath.glog(e.getAt(i))+ratio);}
|
||||
return qrPolynomial(num,0).mod(e);};return _this;};var QRRSBlock=function(){var RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16]];var qrRSBlock=function(totalCount,dataCount){var _this={};_this.totalCount=totalCount;_this.dataCount=dataCount;return _this;};var _this={};var getRsBlockTable=function(typeNumber,errorCorrectLevel){switch(errorCorrectLevel){case QRErrorCorrectLevel.L:return RS_BLOCK_TABLE[(typeNumber-1)*4+0];case QRErrorCorrectLevel.M:return RS_BLOCK_TABLE[(typeNumber-1)*4+1];case QRErrorCorrectLevel.Q:return RS_BLOCK_TABLE[(typeNumber-1)*4+2];case QRErrorCorrectLevel.H:return RS_BLOCK_TABLE[(typeNumber-1)*4+3];default:return undefined;}};_this.getRSBlocks=function(typeNumber,errorCorrectLevel){var rsBlock=getRsBlockTable(typeNumber,errorCorrectLevel);if(typeof rsBlock=='undefined'){throw new Error('bad rs block @ typeNumber:'+typeNumber+'/errorCorrectLevel:'+errorCorrectLevel);}
|
||||
var length=rsBlock.length/3;var list=new Array();for(var i=0;i<length;i+=1){var count=rsBlock[i*3+0];var totalCount=rsBlock[i*3+1];var dataCount=rsBlock[i*3+2];for(var j=0;j<count;j+=1){list.push(qrRSBlock(totalCount,dataCount));}}
|
||||
return list;};return _this;}();var qrBitBuffer=function(){var _buffer=new Array();var _length=0;var _this={};_this.getBuffer=function(){return _buffer;};_this.getAt=function(index){var bufIndex=Math.floor(index/8);return((_buffer[bufIndex]>>>(7-index%8))&1)==1;};_this.put=function(num,length){for(var i=0;i<length;i+=1){_this.putBit(((num>>>(length-i-1))&1)==1);}};_this.getLengthInBits=function(){return _length;};_this.putBit=function(bit){var bufIndex=Math.floor(_length/8);if(_buffer.length<=bufIndex){_buffer.push(0);}
|
||||
if(bit){_buffer[bufIndex]|=(0x80>>>(_length%8));}
|
||||
_length+=1;};return _this;};var qr8BitByte=function(data){var _mode=QRMode.MODE_8BIT_BYTE;var _data=data;var _bytes=qrcode.stringToBytes(data);var _this={};_this.getMode=function(){return _mode;};_this.getLength=function(buffer){return _bytes.length;};_this.write=function(buffer){for(var i=0;i<_bytes.length;i+=1){buffer.put(_bytes[i],8);}};return _this;};var byteArrayOutputStream=function(){var _bytes=new Array();var _this={};_this.writeByte=function(b){_bytes.push(b&0xff);};_this.writeShort=function(i){_this.writeByte(i);_this.writeByte(i>>>8);};_this.writeBytes=function(b,off,len){off=off||0;len=len||b.length;for(var i=0;i<len;i+=1){_this.writeByte(b[i+off]);}};_this.writeString=function(s){for(var i=0;i<s.length;i+=1){_this.writeByte(s.charCodeAt(i));}};_this.toByteArray=function(){return _bytes;};_this.toString=function(){var s='';s+='[';for(var i=0;i<_bytes.length;i+=1){if(i>0){s+=',';}
|
||||
s+=_bytes[i];}
|
||||
s+=']';return s;};return _this;};var base64EncodeOutputStream=function(){var _buffer=0;var _buflen=0;var _length=0;var _base64='';var _this={};var writeEncoded=function(b){_base64+=String.fromCharCode(encode(b&0x3f));};var encode=function(n){if(n<0){}else if(n<26){return 0x41+n;}else if(n<52){return 0x61+(n-26);}else if(n<62){return 0x30+(n-52);}else if(n==62){return 0x2b;}else if(n==63){return 0x2f;}
|
||||
throw new Error('n:'+n);};_this.writeByte=function(n){_buffer=(_buffer<<8)|(n&0xff);_buflen+=8;_length+=1;while(_buflen>=6){writeEncoded(_buffer>>>(_buflen-6));_buflen-=6;}};_this.flush=function(){if(_buflen>0){writeEncoded(_buffer<<(6-_buflen));_buffer=0;_buflen=0;}
|
||||
if(_length%3!=0){var padlen=3-_length%3;for(var i=0;i<padlen;i+=1){_base64+='=';}}};_this.toString=function(){return _base64;};return _this;};var base64DecodeInputStream=function(str){var _str=str;var _pos=0;var _buffer=0;var _buflen=0;var _this={};_this.read=function(){while(_buflen<8){if(_pos>=_str.length){if(_buflen==0){return-1;}
|
||||
throw new Error('unexpected end of file./'+_buflen);}
|
||||
var c=_str.charAt(_pos);_pos+=1;if(c=='='){_buflen=0;return-1;}else if(c.match(/^\s$/)){continue;}
|
||||
_buffer=(_buffer<<6)|decode(c.charCodeAt(0));_buflen+=6;}
|
||||
var n=(_buffer>>>(_buflen-8))&0xff;_buflen-=8;return n;};var decode=function(c){if(0x41<=c&&c<=0x5a){return c-0x41;}else if(0x61<=c&&c<=0x7a){return c-0x61+26;}else if(0x30<=c&&c<=0x39){return c-0x30+52;}else if(c==0x2b){return 62;}else if(c==0x2f){return 63;}else{throw new Error('c:'+c);}};return _this;};var gifImage=function(width,height){var _width=width;var _height=height;var _data=new Array(width*height);var _this={};_this.setPixel=function(x,y,pixel){_data[y*_width+x]=pixel;};_this.write=function(out){out.writeString('GIF87a');out.writeShort(_width);out.writeShort(_height);out.writeByte(0x80);out.writeByte(0);out.writeByte(0);out.writeByte(0x00);out.writeByte(0x00);out.writeByte(0x00);out.writeByte(0xff);out.writeByte(0xff);out.writeByte(0xff);out.writeString(',');out.writeShort(0);out.writeShort(0);out.writeShort(_width);out.writeShort(_height);out.writeByte(0);var lzwMinCodeSize=2;var raster=getLZWRaster(lzwMinCodeSize);out.writeByte(lzwMinCodeSize);var offset=0;while(raster.length-offset>255){out.writeByte(255);out.writeBytes(raster,offset,255);offset+=255;}
|
||||
out.writeByte(raster.length-offset);out.writeBytes(raster,offset,raster.length-offset);out.writeByte(0x00);out.writeString(';');};var bitOutputStream=function(out){var _out=out;var _bitLength=0;var _bitBuffer=0;var _this={};_this.write=function(data,length){if((data>>>length)!=0){throw new Error('length over');}
|
||||
while(_bitLength+length>=8){_out.writeByte(0xff&((data<<_bitLength)|_bitBuffer));length-=(8-_bitLength);data>>>=(8-_bitLength);_bitBuffer=0;_bitLength=0;}
|
||||
_bitBuffer=(data<<_bitLength)|_bitBuffer;_bitLength=_bitLength+length;};_this.flush=function(){if(_bitLength>0){_out.writeByte(_bitBuffer);}};return _this;};var getLZWRaster=function(lzwMinCodeSize){var clearCode=1<<lzwMinCodeSize;var endCode=(1<<lzwMinCodeSize)+1;var bitLength=lzwMinCodeSize+1;var table=lzwTable();for(var i=0;i<clearCode;i+=1){table.add(String.fromCharCode(i));}
|
||||
table.add(String.fromCharCode(clearCode));table.add(String.fromCharCode(endCode));var byteOut=byteArrayOutputStream();var bitOut=bitOutputStream(byteOut);bitOut.write(clearCode,bitLength);var dataIndex=0;var s=String.fromCharCode(_data[dataIndex]);dataIndex+=1;while(dataIndex<_data.length){var c=String.fromCharCode(_data[dataIndex]);dataIndex+=1;if(table.contains(s+c)){s=s+c;}else{bitOut.write(table.indexOf(s),bitLength);if(table.size()<0xfff){if(table.size()==(1<<bitLength)){bitLength+=1;}
|
||||
table.add(s+c);}
|
||||
s=c;}}
|
||||
bitOut.write(table.indexOf(s),bitLength);bitOut.write(endCode,bitLength);bitOut.flush();return byteOut.toByteArray();};var lzwTable=function(){var _map={};var _size=0;var _this={};_this.add=function(key){if(_this.contains(key)){throw new Error('dup key:'+key);}
|
||||
_map[key]=_size;_size+=1;};_this.size=function(){return _size;};_this.indexOf=function(key){return _map[key];};_this.contains=function(key){return typeof _map[key]!='undefined';};return _this;};return _this;};var createImgTag=function(width,height,getPixel,alt){var gif=gifImage(width,height);for(var y=0;y<height;y+=1){for(var x=0;x<width;x+=1){gif.setPixel(x,y,getPixel(x,y));}}
|
||||
var b=byteArrayOutputStream();gif.write(b);var base64=base64EncodeOutputStream();var bytes=b.toByteArray();for(var i=0;i<bytes.length;i+=1){base64.writeByte(bytes[i]);}
|
||||
base64.flush();var img='';img+='<img';img+='\u0020src="';img+='data:image/gif;base64,';img+=base64;img+='"';img+='\u0020width="';img+=width;img+='"';img+='\u0020height="';img+=height;img+='"';if(alt){img+='\u0020alt="';img+=alt;img+='"';}
|
||||
img+='/>';return img;};return qrcode;}();/* |xGv00|ca8fc6bde81a353e7cede123b304bdb9 */
|
208
hyhproject/home/view/default/js/right_cart.js
Executable file
208
hyhproject/home/view/default/js/right_cart.js
Executable file
@ -0,0 +1,208 @@
|
||||
$(document).ready(function(){
|
||||
var cartHeight = WST.pageHeight()-120;
|
||||
$('.toolbar-tab').hover(function (){ $(this).find('.tab-text').addClass("tbar-tab-hover"); $(this).find('.footer-tab-text').addClass("tbar-tab-footer-hover"); $(this).addClass("tbar-tab-selected");},function(){ $(this).find('.tab-text').removeClass("tbar-tab-hover"); $(this).find('.footer-tab-text').removeClass("tbar-tab-footer-hover"); $(this).removeClass("tbar-tab-selected"); });
|
||||
$('.j-close').click(function(){
|
||||
if($('.toolbar-wrap').hasClass('toolbar-open')){
|
||||
$('.toolbar-wrap').removeClass('toolbar-open');
|
||||
}else{
|
||||
$('.toolbar-wrap').addClass('toolbar-open');
|
||||
}
|
||||
})
|
||||
$('.j-global-toolbar').siblings().click(function(){
|
||||
if($('.toolbar-wrap').hasClass('toolbar-open')){
|
||||
$('.toolbar-wrap').removeClass('toolbar-open');
|
||||
}
|
||||
})
|
||||
$('.tbar-tab-cart').click(function (){
|
||||
if($('.toolbar-wrap').hasClass('toolbar-open')){
|
||||
if($(this).find('.tab-text').length > 0){
|
||||
if(! $('.tbar-tab-follow').find('.tab-text').length > 0){
|
||||
var info = "<em class='tab-text '>我的关注</em>";
|
||||
$('.tbar-tab-follow').append(info);
|
||||
$('.tbar-tab-follow').removeClass('tbar-tab-click-selected');
|
||||
$('.tbar-panel-follow').css({'visibility':"hidden","z-index":"-1"});
|
||||
}
|
||||
if(! $('.tbar-tab-history').find('.tab-text').length > 0){
|
||||
var info = "<em class='tab-text '>我的足迹</em>";
|
||||
$('.tbar-tab-history').append(info);
|
||||
$('.tbar-tab-history').removeClass('tbar-tab-click-selected');
|
||||
$('.tbar-panel-history').css({'visibility':"hidden","z-index":"-1"});
|
||||
}
|
||||
$(this).addClass('tbar-tab-click-selected');
|
||||
$(this).find('.tab-text').remove();
|
||||
$('.tbar-panel-cart').css({'visibility':"visible","z-index":"1"});
|
||||
getRightCart();
|
||||
}else{
|
||||
var info = "<em class='tab-text '>我的关注</em>";
|
||||
$('.toolbar-wrap').removeClass('toolbar-open');
|
||||
$(this).append(info);
|
||||
$(this).removeClass('tbar-tab-click-selected');
|
||||
$('.tbar-panel-cart').css({'visibility':"hidden","z-index":"-1"});
|
||||
}
|
||||
}else{
|
||||
$(this).addClass('tbar-tab-click-selected');
|
||||
$(this).find('.tab-text').remove();
|
||||
$('.tbar-panel-cart').css({'visibility':"visible","z-index":"1"});
|
||||
$('.tbar-panel-follow').css('visibility','hidden');
|
||||
$('.tbar-panel-history').css('visibility','hidden');
|
||||
$('.toolbar-wrap').addClass('toolbar-open');
|
||||
$('#cart-panel').css('height',cartHeight+"px").css('overflow-y','auto');
|
||||
getRightCart();
|
||||
}
|
||||
});
|
||||
$('.tbar-tab-follow').click(function (){
|
||||
if($('.toolbar-wrap').hasClass('toolbar-open')){
|
||||
if($(this).find('.tab-text').length > 0){
|
||||
if(! $('.tbar-tab-cart').find('.tab-text').length > 0){
|
||||
var info = "<em class='tab-text '>购物车</em>";
|
||||
$('.tbar-tab-cart').append(info);
|
||||
$('.tbar-tab-cart').removeClass('tbar-tab-click-selected');
|
||||
$('.tbar-panel-cart').css({'visibility':"hidden","z-index":"-1"});
|
||||
}
|
||||
if(! $('.tbar-tab-history').find('.tab-text').length > 0){
|
||||
var info = "<em class='tab-text '>我的足迹</em>";
|
||||
$('.tbar-tab-history').append(info);
|
||||
$('.tbar-tab-history').removeClass('tbar-tab-click-selected');
|
||||
$('.tbar-panel-history').css({'visibility':"hidden","z-index":"-1"});
|
||||
}
|
||||
$(this).addClass('tbar-tab-click-selected');
|
||||
$(this).find('.tab-text').remove();
|
||||
$('.tbar-panel-follow').css({'visibility':"visible","z-index":"1"});
|
||||
|
||||
}else{
|
||||
var info = "<em class='tab-text '>我的关注</em>";
|
||||
$('.toolbar-wrap').removeClass('toolbar-open');
|
||||
$(this).append(info);
|
||||
$(this).removeClass('tbar-tab-click-selected');
|
||||
$('.tbar-panel-follow').css({'visibility':"hidden","z-index":"-1"});
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
$(this).addClass('tbar-tab-click-selected');
|
||||
$(this).find('.tab-text').remove();
|
||||
$('.tbar-panel-cart').css('visibility','hidden');
|
||||
$('.tbar-panel-follow').css({'visibility':"visible","z-index":"1"});
|
||||
$('.tbar-panel-history').css('visibility','hidden');
|
||||
$('.toolbar-wrap').addClass('toolbar-open');
|
||||
}
|
||||
});
|
||||
$('.tbar-tab-history').click(function (){
|
||||
if($('.toolbar-wrap').hasClass('toolbar-open')){
|
||||
if($(this).find('.tab-text').length > 0){
|
||||
if(! $('.tbar-tab-follow').find('.tab-text').length > 0){
|
||||
var info = "<em class='tab-text '>我的关注</em>";
|
||||
$('.tbar-tab-follow').append(info);
|
||||
$('.tbar-tab-follow').removeClass('tbar-tab-click-selected');
|
||||
$('.tbar-panel-follow').css({'visibility':"hidden","z-index":"-1"});
|
||||
}
|
||||
if(! $('.tbar-tab-cart').find('.tab-text').length > 0){
|
||||
var info = "<em class='tab-text '>购物车</em>";
|
||||
$('.tbar-tab-cart').append(info);
|
||||
$('.tbar-tab-cart').removeClass('tbar-tab-click-selected');
|
||||
$('.tbar-panel-cart').css({'visibility':"hidden","z-index":"-1"});
|
||||
}
|
||||
$(this).addClass('tbar-tab-click-selected');
|
||||
$(this).find('.tab-text').remove();
|
||||
$('.tbar-panel-history').css({'visibility':"visible","z-index":"1"});
|
||||
getHistoryGoods();
|
||||
}else{
|
||||
var info = "<em class='tab-text '>我的足迹</em>";
|
||||
$('.toolbar-wrap').removeClass('toolbar-open');
|
||||
$(this).append(info);
|
||||
$(this).removeClass('tbar-tab-click-selected');
|
||||
$('.tbar-panel-history').css({'visibility':"hidden","z-index":"-1"});
|
||||
}
|
||||
|
||||
}else{
|
||||
$(this).addClass('tbar-tab-click-selected');
|
||||
$(this).find('.tab-text').remove();
|
||||
$('.tbar-panel-cart').css('visibility','hidden');
|
||||
$('.tbar-panel-follow').css('visibility','hidden');
|
||||
$('.tbar-panel-history').css({'visibility':"visible","z-index":"1"});
|
||||
$('.toolbar-wrap').addClass('toolbar-open');
|
||||
getHistoryGoods();
|
||||
}
|
||||
});
|
||||
});
|
||||
function getRightCart(){
|
||||
//if(WST.conf.IS_LOGIN==0)return;
|
||||
$.post(WST.U('home/carts/getCart'),'',function(data) {
|
||||
var json = WST.toJson(data,true);
|
||||
if(json.status==1){
|
||||
json = json.data;
|
||||
if(json.carts && !json.carts.length){
|
||||
$('.j-cart-count').html(json.goodsTotalNum);
|
||||
if(json.goodsTotalNum>0)$('.j-cart-count').show();
|
||||
var gettpl = document.getElementById('list-rightcart').innerHTML;
|
||||
laytpl(gettpl).render(json.carts, function(html){
|
||||
$('#cart-panel').html(html);
|
||||
});
|
||||
$('#j-goods-count').html(json.goodsTotalNum);
|
||||
$('#j-goods-total-money').html(json.goodsTotalMoney);
|
||||
}else{
|
||||
$('#cart-panel').html('<p class="right-carts-empty">购物车空空如也,赶紧去选购吧~</p>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function delRightCart(obj,id){
|
||||
var dataval = $(obj).attr('dataid');
|
||||
dataval = dataval.split("|");
|
||||
if($('#shop-cart-'+dataval[0]).children().size()>2){
|
||||
$('.j-goods-item-'+dataval[1]).remove();
|
||||
}else{
|
||||
$('#shop-cart-'+dataval[0]).remove();
|
||||
}
|
||||
statRightCartMoney();
|
||||
$.post(WST.U('home/carts/delCart'),{id:dataval[1],rnd:Math.random()},function(data,textStatus){
|
||||
var json = WST.toJson(data);
|
||||
if(json.status!=1){
|
||||
WST.msg(json.msg,{icon:2});
|
||||
}
|
||||
});
|
||||
}
|
||||
function jumpSettlement(){
|
||||
if($('#cart-panel').children().size()==0){
|
||||
WST.msg("您的购物车没有商品哦,请先添加商品~",{icon:2});
|
||||
return;
|
||||
}
|
||||
location.href=WST.U('home/carts/settlement');
|
||||
}
|
||||
function getHistoryGoods(){
|
||||
$.post(WST.U('home/goods/historyByGoods'),{},function(data) {
|
||||
var json = WST.toJson(data);
|
||||
if(json.status==1){
|
||||
var gettpl = document.getElementById('list-history-goods').innerHTML;
|
||||
laytpl(gettpl).render(json.data, function(html){
|
||||
$('#history-goods-panel').html(html);
|
||||
});
|
||||
$('.jth-item').hover(function (){ $(this).find('.add-cart-button').show(); },function(){ $(this).find('.add-cart-button').hide(); });
|
||||
}
|
||||
});
|
||||
}
|
||||
function checkRightChks(cid,obj){
|
||||
WST.changeCartGoods(cid,$('#buyNum_'+cid).val(),obj.checked?1:0);
|
||||
statRightCartMoney();
|
||||
}
|
||||
function statRightCartMoney(){
|
||||
var cartId,goodsNum = 0,goodsMoney = 0,tmpGoodsNum = 0,tmpGoodsMoney = 0;
|
||||
$('.jtc-item-goods').each(function(){
|
||||
cartId = $(this).attr('dataval');
|
||||
if($('#rcart_'+cartId).prop('checked')){
|
||||
goodsNum = parseInt($('#buyNum_'+cartId).val(),10);
|
||||
goodsMoney = parseFloat($('#gprice_'+cartId).html(),10);
|
||||
tmpGoodsNum++;
|
||||
tmpGoodsMoney += goodsMoney*goodsNum;
|
||||
}
|
||||
})
|
||||
if(tmpGoodsNum==0){
|
||||
$('#j-goods-count').html(0);
|
||||
$('.j-cart-count').html(0).hide();
|
||||
$('#j-goods-total-money').html(0);
|
||||
}else{
|
||||
$('.j-cart-count').html(tmpGoodsNum);
|
||||
$('#j-goods-count').html(tmpGoodsNum);
|
||||
$('#j-goods-total-money').html(tmpGoodsMoney);
|
||||
}
|
||||
}
|
94
hyhproject/home/view/default/js/self_shop.js
Executable file
94
hyhproject/home/view/default/js/self_shop.js
Executable file
@ -0,0 +1,94 @@
|
||||
/*店长推荐*/
|
||||
function gpanelOver2(obj){
|
||||
var sid = $(obj).attr("id");
|
||||
var ids = sid.split("_");
|
||||
var preid = ids[0]+"_"+ids[1];
|
||||
|
||||
$("li[id^="+preid+"_]").removeClass("j-s-rec-selected");
|
||||
|
||||
$("#"+sid).addClass("j-s-rec-selected");
|
||||
|
||||
$("div[id^="+preid+"_]").hide();
|
||||
$("#"+sid+"_pl").show();
|
||||
}
|
||||
|
||||
/*楼层*/
|
||||
function gpanelOver(obj){
|
||||
var sid = $(obj).attr("id");
|
||||
|
||||
var index = $(obj).attr('c');
|
||||
|
||||
var ids = sid.split("_");
|
||||
var preid = ids[0]+"_"+ids[1];
|
||||
|
||||
$("li[id^="+preid+"_]").removeClass("j-tab-selected"+index);
|
||||
$("#"+sid).addClass("j-tab-selected"+index);
|
||||
|
||||
$("div[id^="+preid+"_]").hide();
|
||||
$("#"+sid+"_pl").show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function searchShopsGoods(){
|
||||
var params = new Array();
|
||||
params.push("shopId=" + $("#shopId").val());
|
||||
params.push("goodsName=" + $("#goodsName").val());
|
||||
document.location.href = WST.U('home/shops/home',params.join('&'),true);
|
||||
}
|
||||
$(function(){
|
||||
$(".s-goods").hover(function(){
|
||||
$(this).find(".s-add-cart").slideDown(100);
|
||||
},function(){
|
||||
$(this).find(".s-add-cart").slideUp(100);
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
$(function(){
|
||||
if($('.s-wst-slide-items a').length>1)WST.slides('.s-wst-slide');
|
||||
$('.shop-cat1').hover(function(){
|
||||
$(this).addClass('ct1-hover');
|
||||
var cid = $(this).attr('cid');
|
||||
|
||||
var h = 66.3*cid+'px';
|
||||
$('.cid'+cid).css('top',h);
|
||||
$('.cid'+cid).show();
|
||||
},function(){
|
||||
$(this).removeClass('ct1-hover');
|
||||
var cid = $(this).attr('cid');
|
||||
$('.cid'+cid).hide();
|
||||
})
|
||||
|
||||
|
||||
$('.shop-cat2').hover(function(){
|
||||
var cid = $(this).attr('cid');
|
||||
$('#ct1-'+cid).addClass('ct1-hover');
|
||||
$(this).show();
|
||||
},function(){
|
||||
var cid = $(this).attr('cid');
|
||||
$('#ct1-'+cid).removeClass('ct1-hover');
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('.s-cat').hover(function(){
|
||||
$('.s-cat-head').addClass('s-cat-head-hover');
|
||||
$(this).show();
|
||||
},function(){
|
||||
$('.s-cat-head').removeClass('s-cat-head-hover');
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
|
||||
$('.s-cat-head').hover(function(){
|
||||
$(this).addClass('s-cat-head-hover');
|
||||
$('.s-cat').css({left:$('.s-cat-head').offset().left}).show();
|
||||
},function(){
|
||||
$(this).removeClass('s-cat-head-hover');
|
||||
$('.s-cat').hide();
|
||||
})
|
||||
|
||||
|
||||
});
|
39
hyhproject/home/view/default/js/shophome.js
Executable file
39
hyhproject/home/view/default/js/shophome.js
Executable file
@ -0,0 +1,39 @@
|
||||
$(function() {
|
||||
WST.dropDownLayer(".wst-shop-code",".wst-shop-codes");
|
||||
$(".ck-slide-wrapper img").width(1200);
|
||||
$('.ck-slide').ckSlide({
|
||||
autoPlay: true,
|
||||
time:5000,
|
||||
isAnimate:true,
|
||||
dir: 'x'
|
||||
});
|
||||
$(".wst-shop-goimg").hover(function(){
|
||||
$(this).find(".js-cart").slideDown(100);
|
||||
},function(){
|
||||
$(this).find(".js-cart").slideUp(100);
|
||||
});
|
||||
});
|
||||
function dropDown(obj,id){
|
||||
if( $(obj).attr('class').indexOf('js-shop-plus') > -1 ){
|
||||
$(obj).removeClass('js-shop-plus').addClass('js-shop-redu');
|
||||
$('.tree_'+id).slideUp();
|
||||
}else{
|
||||
$(obj).removeClass('js-shop-redu').addClass('js-shop-plus');
|
||||
$('.tree_'+id).slideDown();
|
||||
}
|
||||
}
|
||||
function searchShopsGoods(obj){
|
||||
var mdesc = $('#mdesc').val();
|
||||
if($('#msort').val() != obj)mdesc = 0;
|
||||
var msort = obj;
|
||||
var params = new Array();
|
||||
params.push("shopId=" + $("#shopId").val());
|
||||
params.push("msort=" + obj);
|
||||
params.push("mdesc=" + ((mdesc=="0")?"1":"0"));
|
||||
params.push("sprice=" + $("#sprice").val());
|
||||
params.push("eprice=" + $("#eprice").val());
|
||||
params.push("ct1=" + $("#ct1").val());
|
||||
params.push("ct2=" + $("#ct2").val());
|
||||
if($("#goodsName").val()!=undefined)params.push("goodsName=" + $("#goodsName").val());
|
||||
location.href = WST.U('home/shops/home',params.join('&'),true);
|
||||
}
|
18
hyhproject/home/view/default/js/shopstreet.js
Executable file
18
hyhproject/home/view/default/js/shopstreet.js
Executable file
@ -0,0 +1,18 @@
|
||||
//筛选分类
|
||||
function screenCat(id){
|
||||
location.href=WST.U('home/shops/shopstreet','id='+id,true);
|
||||
}
|
||||
$(function(){
|
||||
var goodsNum = $(this).find("div[class^='wst-shopstr-shopl']").length;
|
||||
for(var i=1;i<=goodsNum;++i){
|
||||
$("#js-goods"+i).als({
|
||||
visible_items: 6,
|
||||
scrolling_items: 1,
|
||||
orientation: "horizontal",
|
||||
circular: "yes",
|
||||
autoscroll: "no",
|
||||
start_from: 2
|
||||
});
|
||||
}
|
||||
WST.dropDownLayer(".j-score",".j-scores");
|
||||
});
|
Reference in New Issue
Block a user