You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
4879
static/app2/js/1.js
Executable file
4879
static/app2/js/1.js
Executable file
File diff suppressed because it is too large
Load Diff
119
static/app2/js/ac1111next.js
Executable file
119
static/app2/js/ac1111next.js
Executable file
@ -0,0 +1,119 @@
|
||||
//添加返回顶部按钮
|
||||
document.write('<script type="text/javascript" src="' + localStorage.getItem("jsUrl") + 'scrollToTop.js?ver=' + localStorage.getItem('version') + '"></scr' + 'ipt>');
|
||||
var isjiazai = 1;
|
||||
var topTypeId = '';
|
||||
var type = 1;
|
||||
var order = 'desc';
|
||||
var page = 1;
|
||||
var pageSize = 10;
|
||||
var costnum = 0;
|
||||
|
||||
var swiper = new Swiper('#timer_swiper', {
|
||||
slidesPerView: 3,
|
||||
paginationClickable: true,
|
||||
spaceBetween: 0,
|
||||
freeMode: true
|
||||
});
|
||||
|
||||
function getData(topTypeId, type, order, page, pageSize) {
|
||||
var data_ = {
|
||||
topTypeId: topTypeId,
|
||||
type: type ? type : 1,
|
||||
order: order ? order : 'desc',
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 10
|
||||
}
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
mui.ajax(llUrl('addon/shuff-shuff-moreGoodsList'), {
|
||||
data: data_,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.data.goodsFavoritesNum)
|
||||
// console.log(data.data.Rows)
|
||||
// var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
var data = data.data;
|
||||
var html = '';
|
||||
|
||||
if(data.Rows == '') {
|
||||
$('#recommend_con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display:none;" data-shopId="' + this.shopId + '">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
|
||||
});
|
||||
if(page == 1) {
|
||||
$('#recommend_con').html(html);
|
||||
} else {
|
||||
$('#recommend_con').append(html);
|
||||
}
|
||||
isjiazai = 1;
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
}else{
|
||||
// console.log(data.msg)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
topTypeId = self.topTypeId;
|
||||
|
||||
getData(topTypeId, type, order, page, pageSize)
|
||||
|
||||
$('.nav').on('tap', '.nav_block', function() {
|
||||
type = $(this).attr('data-type');
|
||||
isjiazai = 1;
|
||||
page = 1;
|
||||
|
||||
if(type == 3) {
|
||||
|
||||
costnum += 1;
|
||||
|
||||
if(costnum % 2 == 1) {
|
||||
|
||||
$('.nav_block').eq(2).html('价格 <img src="../img/cost_3.png"/>');
|
||||
|
||||
order = 'asc';
|
||||
|
||||
} else if(costnum % 2 == 0) {
|
||||
|
||||
$('.nav_block').eq(2).html('价格 <img src="../img/cost_2.png"/>');
|
||||
|
||||
order = 'desc';
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$('.nav_block').eq(2).html('价格 <img src="../img/cost_1.png"/>')
|
||||
|
||||
costnum = 0;
|
||||
order = 'desc';
|
||||
}
|
||||
getData(topTypeId, type, order, page, pageSize);
|
||||
})
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getData(topTypeId, type, order, page, pageSize);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
})
|
83
static/app2/js/ac1111next_.js
Executable file
83
static/app2/js/ac1111next_.js
Executable file
@ -0,0 +1,83 @@
|
||||
//添加返回顶部按钮
|
||||
document.write('<script type="text/javascript" src="' + localStorage.getItem("jsUrl") + 'scrollToTop.js?ver=' + localStorage.getItem('version') + '"></scr' + 'ipt>');
|
||||
var isjiazai = 1;
|
||||
var topTypeId = '';
|
||||
var page = 1;
|
||||
var pageSize = 10;
|
||||
var costnum = 0;
|
||||
|
||||
function getData(topTypeId, page, pageSize) {
|
||||
var data_ = {
|
||||
goodsName: topTypeId,
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 10
|
||||
}
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
mui.ajax(llUrl('addon/shuff-shuff-appSearch'), {
|
||||
data: data_,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.data.goodsFavoritesNum)
|
||||
// console.log(data.data.Rows)
|
||||
// var data = toJson(data);
|
||||
console.log(data.status)
|
||||
if(data.status == 1) {
|
||||
var data = data.data;
|
||||
var html = '';
|
||||
|
||||
if(data.Rows == '') {
|
||||
if(page == 1) {
|
||||
$('#recommend_con').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
} else {
|
||||
$('#recommend_con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
}
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display:none;" data-shopId="' + this.shopId + '">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
|
||||
});
|
||||
if(page == 1) {
|
||||
$('#recommend_con').html(html);
|
||||
} else {
|
||||
$('#recommend_con').append(html);
|
||||
}
|
||||
isjiazai = 1;
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
} else {
|
||||
// console.log(data.msg)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
topTypeId = self.data_keyword;
|
||||
console.log(topTypeId)
|
||||
|
||||
getData(topTypeId, page, pageSize)
|
||||
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getData(topTypeId, page, pageSize);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
})
|
71
static/app2/js/ac2.js
Executable file
71
static/app2/js/ac2.js
Executable file
@ -0,0 +1,71 @@
|
||||
var data_keyword = '';
|
||||
var pageSize = 10;
|
||||
var page = 1;
|
||||
var topTypeId=1;
|
||||
var isjiazai = 1;
|
||||
$('.title').html('更多商品');
|
||||
document.write('<link rel="stylesheet" type="text/css" href="' + localStorage.getItem("cssUrl") + 'recommend.css?ver=' + localStorage.getItem("version") + '"/>');
|
||||
document.write('<script type="text/javascript" src="' + localStorage.getItem("jsUrl") + 'recommend.js?ver=' + localStorage.getItem('version') + '"></scr' + 'ipt>');
|
||||
|
||||
function lxy_search(page, pageSize, data_keyword) {
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
var lxy_data_ = {
|
||||
goodsName : data_keyword ? data_keyword : '',
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 10,
|
||||
topTypeId:topTypeId
|
||||
}
|
||||
|
||||
mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-inqueryList'), {
|
||||
data: lxy_data_,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data.data.goodsFavoritesNum)
|
||||
//console.log(data.data.Rows)
|
||||
//var data = toJson(data);
|
||||
var data = data.data
|
||||
var html = '';
|
||||
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display: none;">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img class="icon_icon" src="../img/icon_sscl.png"alt=""style="display:none;"/></div>'
|
||||
});
|
||||
|
||||
if(page == 1) {
|
||||
$('.con_').html(html);
|
||||
} else {
|
||||
$('.con_').append(html);
|
||||
}
|
||||
isjiazai = 1;
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
data_keyword = self.data_keyword;
|
||||
if(self.topTypeId){
|
||||
topTypeId = self.topTypeId;
|
||||
}
|
||||
//console.log(data_keyword);
|
||||
//console.log(topTypeId)
|
||||
lxy_search(page, pageSize, data_keyword);
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
lxy_search(page, pageSize, data_keyword);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
})
|
73
static/app2/js/ac3.js
Executable file
73
static/app2/js/ac3.js
Executable file
@ -0,0 +1,73 @@
|
||||
$('.title').html('更多');
|
||||
document.write('<link rel="stylesheet" type="text/css" href="' + localStorage.getItem("cssUrl") + 'recommend.css?ver=' + localStorage.getItem("version") + '"/>');
|
||||
document.write('<script type="text/javascript" src="' + localStorage.getItem("jsUrl") + 'recommend.js?ver=' + localStorage.getItem('version') + '"></scr' + 'ipt>');
|
||||
var page = 1;
|
||||
var pageSize = 10;
|
||||
var isjiazai = 1;
|
||||
|
||||
function getData(page, pageSize) {
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
var data_ = {
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 10
|
||||
}
|
||||
mui.ajax(llUrl('addon/selfmarket-selfmarket-selfMore'), {
|
||||
|
||||
data: data_,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.data.goodsFavoritesNum)
|
||||
// console.log(data.data.Rows)
|
||||
|
||||
// var data = toJson(data);
|
||||
var data = data.data
|
||||
var html = '';
|
||||
if(data.Rows == '') {
|
||||
|
||||
if(page == 1) {
|
||||
$('.con_').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;margin-top:20px;">没有更多商品</p>');
|
||||
} else {
|
||||
$('.con_').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;margin-top:20px;">没有更多商品</p>');
|
||||
}
|
||||
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display: inline-block;">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img class="icon_icon" src="../img/icon_sscl.png"alt=""style="display:none;"/></div>'
|
||||
});
|
||||
|
||||
if(page == 1) {
|
||||
$('.con_').html(html);
|
||||
} else {
|
||||
$('.con_').append(html);
|
||||
}
|
||||
|
||||
isjiazai = 1;
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
getData(page, pageSize);
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getData(page, pageSize);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
})
|
106
static/app2/js/activity1.js
Executable file
106
static/app2/js/activity1.js
Executable file
@ -0,0 +1,106 @@
|
||||
mui.plusReady(function() {
|
||||
$('#bg').html('<img src="../img/activity1_head.png" />');
|
||||
mui.ajax(hyhUrl('addon/hyhdailyupdate-Hyhdailyupdate-getIndex'), {
|
||||
data: {
|
||||
typeSrc: 2
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
data = data.data;
|
||||
var html1 = '';
|
||||
var html2 = '';
|
||||
$.each(data['6'].list, function(num) {
|
||||
num++;
|
||||
if(num % 2 == 1) {
|
||||
html1 += '<div class="bktj_b" data-goodsId="' + this.goodsId + '"><img src="../img/bktj' + num + '.png" /><div class="bktj_con clearfix"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="bktj_con_con"><p class="p3">' + this.goodsName + '</p><p class="p4">折扣到手价</p><p class="p3">¥.' + this.shopPrice + '</p><div class="ljjg_btn ljqg_btn">立即抢购</div></div></div></div>';
|
||||
} else {
|
||||
html1 += '<div class="bktj_b" data-goodsId="' + this.goodsId + '"><img src="../img/bktj' + num + '.png" /><div class="bktj_con clearfix"><div class="bktj_con_con"><p class="p3">' + this.goodsName + '</p><p class="p4">折扣到手价</p><p class="p3">¥.' + this.shopPrice + '</p><div class="ljjg_btn ljqg_btn">立即抢购</div></div><img src="' + hyhImgUrl(this.goodsImg) + '" /></div></div>';
|
||||
}
|
||||
|
||||
});
|
||||
$('.bktj').html(html1);
|
||||
$.each(data['7'].list, function() {
|
||||
html2 += '<div class="xpss_b" data-goodsId="' + this.goodsId + '"><img src="../img/xpss_bg.png" /><div class="xpss_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p class="p5"><del>原价' + this.marketPrice + '</del>' + this.marketPrice + '</p><div class="xpss_ljqg_btn">立即抢购</div></div></div>'
|
||||
});
|
||||
|
||||
$('.xpss').html(html2);
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
//跳商品页面
|
||||
$('.bktj').on('tap', '.bktj_b', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html'+goodsId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodsId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
$('.xpss').on('tap', '.xpss_b', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
console.log(goodsId)
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html'+goodsId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodsId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
0
static/app2/js/activity10.js
Executable file
0
static/app2/js/activity10.js
Executable file
288
static/app2/js/activity1111.js
Executable file
288
static/app2/js/activity1111.js
Executable file
@ -0,0 +1,288 @@
|
||||
|
||||
function getData(topTypeId,secTypeId,html_){
|
||||
mui.ajax(llUrl('addon/shuff-shuff-actGoodsList'), {
|
||||
data:{
|
||||
topTypeId:topTypeId,
|
||||
secTypeId:secTypeId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
$.each(data, function() {
|
||||
html += '<div class="accc_block" data-goodsId="'+ this.goodsId +'"><img src="'+ ectImgUrl(this.goodsImg) +'" /><p>'+this.goodsName+'</p><span>'+this.shopPrice+'</span></div>';
|
||||
});
|
||||
html_.html(html);
|
||||
html_.find('img').height(html_.find('img').width())
|
||||
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
|
||||
//双11弹窗
|
||||
var lxy_div = '<div class="mui-backdrop lxy_home_zz" style="display: block;background-color: rgba(0,0,0,.7);" id="home_zhezhao"><div class="lxy_zz" style="width:100%"><img src="'+ectImgUrl('static/app2/img/to_coupon2.png')+'" /></div></div>';
|
||||
|
||||
$('body').append(lxy_div);
|
||||
|
||||
//点击让遮罩层消失
|
||||
mui('body').on('tap', '#home_zhezhao', function() {
|
||||
$('#home_zhezhao').css('display', 'none');
|
||||
});
|
||||
//跳转
|
||||
mui('#home_zhezhao').on('tap', '.lxy_zz', function() {
|
||||
mui.openWindow({
|
||||
url: 'god_ect.html',
|
||||
id: 'god_ect.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
},
|
||||
extras: {
|
||||
// data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//折扣专区
|
||||
mui.ajax(llUrl('addon/shuff-shuff-activityList'), {
|
||||
data:{
|
||||
topTypeId:105
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
$.each(data, function() {
|
||||
html += '<div class="acct_block" data-topTypeId="105" data-secTypeId="'+ this.secTypeId +'"><p>'+ this.secTypeName +'</p></div>';
|
||||
});
|
||||
$('.acc_title').eq(0).html(html);
|
||||
$('.acc_title').eq(0).find('.acct_block').eq(0).addClass('on');
|
||||
getData(105,$('.acc_title').eq(0).find('.acct_block').eq(0).attr('data-secTypeId'),$('.acc_title').eq(0).siblings())
|
||||
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
//11.11专区
|
||||
getData(118,119,$('.acc_con').eq(1))
|
||||
mui.ajax(llUrl('addon/shuff-shuff-activityList'), {
|
||||
data:{
|
||||
topTypeId:110
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
$.each(data, function() {
|
||||
html += '<div class="acct_block" data-topTypeId="110" data-secTypeId="'+ this.secTypeId +'"><p>'+ this.secTypeName +'</p></div>';
|
||||
});
|
||||
$('.acc_title').eq(1).html(html);
|
||||
$('.acc_title').eq(1).find('.acct_block').eq(0).addClass('on');
|
||||
getData(110,$('.acc_title').eq(1).find('.acct_block').eq(0).attr('data-secTypeId'),$('.acc_title').eq(1).siblings())
|
||||
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
mui.ajax(llUrl('addon/shuff-shuff-activityList'), {
|
||||
data:{
|
||||
topTypeId:115
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
$.each(data, function() {
|
||||
html += '<div class="acct_block" data-topTypeId="115" data-secTypeId="'+ this.secTypeId +'"><p>'+ this.secTypeName +'</p></div>';
|
||||
});
|
||||
$('.acc_title').eq(2).html(html);
|
||||
$('.acc_title').eq(2).find('.acct_block').eq(0).addClass('on');
|
||||
getData(115,$('.acc_title').eq(2).find('.acct_block').eq(0).attr('data-secTypeId'),$('.acc_title').eq(2).siblings())
|
||||
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
mui('body').on('tap','.acct_block',function(){
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
getData($(this).attr('data-topTypeId'),$(this).attr('data-secTypeId'),$(this).parent().siblings())
|
||||
})
|
||||
mui('body').on('tap','.more',function(){
|
||||
|
||||
var topTypeId = $(this).attr('data-topTypeId');
|
||||
|
||||
mui.openWindow({
|
||||
url: 'ac1111next.html',
|
||||
id: 'ac1111next.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
},
|
||||
extras: {
|
||||
topTypeId: topTypeId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {}
|
||||
})
|
||||
})
|
||||
mui('body').on('tap','.accc_block',function(){
|
||||
|
||||
var data_id = this.attributes["data-goodsId"].nodeValue;
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + data_id,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
},
|
||||
extras: {
|
||||
data_id: data_id
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {}
|
||||
})
|
||||
})
|
||||
|
||||
mui('body').on('tap','.next',function(){
|
||||
$('#next').show();
|
||||
})
|
||||
mui('body').on('tap','#next',function(){
|
||||
$('#next').hide();
|
||||
})
|
||||
$('.header').on('focus', '#keyword', function() {
|
||||
$(".search button").css('display', 'block');
|
||||
})
|
||||
$('.header').on('blur', '#keyword', function() {
|
||||
$(".search button").css('display', 'none');
|
||||
})
|
||||
//店铺搜索
|
||||
$(".header").on('keypress', '#keyword', function(e) {
|
||||
var keycode = e.keyCode;
|
||||
var searchName = $('#keyword').val();
|
||||
if(keycode == '13') {
|
||||
// e.preventDefault();
|
||||
// console.log(searchName)
|
||||
//请求搜索接口
|
||||
mui.openWindow({
|
||||
url: 'ac1111next_.html',
|
||||
id: 'ac1111next_.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
$(".header").on('tap', '.search button', function(e) {
|
||||
var searchName = $('#keyword').val();
|
||||
// e.preventDefault();
|
||||
// console.log(searchName)
|
||||
//请求搜索接口
|
||||
mui.openWindow({
|
||||
url: 'ac1111next_.html',
|
||||
id: 'ac1111next_.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
})
|
154
static/app2/js/activity2.js
Executable file
154
static/app2/js/activity2.js
Executable file
@ -0,0 +1,154 @@
|
||||
$('.title p').html('');
|
||||
mui.plusReady(function() {
|
||||
mui.ajax(hyhUrl('addon/hyhdailyupdate-Hyhdailyupdate-getIndex'), {
|
||||
data: {
|
||||
typeSrc: 0
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
data = data.data;
|
||||
var html1 = '';
|
||||
var html2 = '';
|
||||
var html3 = '';
|
||||
$('.title').css('display','none');
|
||||
if(data['1'].list) {
|
||||
$.each(data['1'].list, function() {
|
||||
html1 += '<div class="gchh_block" data-goodsId="' + this.goodsId + '"><img class="gchh_b_bg" src="../img/guochan_con_bg.png" /><div class="gchh_b_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>¥' + this.shopPrice + '</p></div></div>'
|
||||
});
|
||||
$('.gchh').html(html1);
|
||||
$('.title').eq(0).children('p').html(data['title_1'].name);
|
||||
$('.title').eq(0).css('display','block');
|
||||
}
|
||||
if(data['2'].list) {
|
||||
$.each(data['2'].list, function() {
|
||||
html2 += '<div class="zdzb_block" data-goodsId="' + this.goodsId + '"><img src="../img/ac2_zdzb_bg.png" /><div class="zdzb_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>' + this.goodsName + '</p><b>¥</b><span class="cost">' + this.shopPrice + '</span><div class="zdzb_btn">立即购买</div></div><img class="zdzb_zzc" src="../img/ac2_zdzb_zzc.png" /></div>'
|
||||
});
|
||||
$('.zdzb').html(html2);
|
||||
$('.title').eq(1).children('p').html(data['title_2'].name);
|
||||
$('.title').eq(1).css('display','block');
|
||||
}
|
||||
if(data['3'].list) {
|
||||
$.each(data['3'].list, function() {
|
||||
html3 += '<div class="zdzb3_block" data-goodsId="' + this.goodsId + '"><img src="../img/ac2_ac3_bg.png" /><div class="zdzb3_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>RMB ' + this.shopPrice + '</p><img class="sanjiao" src="../img/ac2_sanjiao.png" /></div></div>';
|
||||
});
|
||||
$('.zdzb3').html(html3)
|
||||
$('.title').eq(2).children('p').html(data['title_3'].name);
|
||||
$('.title').eq(2).css('display','block');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
//跳商品页面
|
||||
$('.gchh').on('tap', '.gchh_block', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + goodsId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodsId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//跳商品页面
|
||||
$('.zdzb').on('tap', '.zdzb_block', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
console.log(goodsId)
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + goodsId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodsId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//跳商品页面
|
||||
$('.zdzb3').on('tap', '.zdzb3_block', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
console.log(goodsId)
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + goodsId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodsId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
167
static/app2/js/activity3.js
Executable file
167
static/app2/js/activity3.js
Executable file
@ -0,0 +1,167 @@
|
||||
$('.jggcj').css('display', 'none');
|
||||
$('.time').css('display', 'none');
|
||||
$('.title').eq(0).css('display', 'none');
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
mui.ajax(hyhUrl('addon/hyhdailyupdate-Hyhdailyupdate-getIndex'), {
|
||||
|
||||
data: {
|
||||
typeSrc: 1
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
data = data.data;
|
||||
var html1 = '';
|
||||
var html2 = '';
|
||||
|
||||
$.each(data['4'].list, function() {
|
||||
html1 += '<div class="list_block" data-goodsId="' + this.goodsId + '"><img class="list_block_bg" src="../img/ac3_bg5.png" /><div class="list_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p class="p3">' + this.goodsName + '</p><p class="p4">¥' + this.shopPrice + '</p></div></div>';
|
||||
});
|
||||
$('#list1').html(html1);
|
||||
$.each(data['5'].list, function() {
|
||||
html2 += '<div class="list_block" data-goodsId="' + this.goodsId + '"><img class="list_block_bg" src="../img/ac3_bg5.png" /><div class="list_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p class="p3">' + this.goodsName + '</p><p class="p4">¥' + this.shopPrice + '</p></div></div>';
|
||||
});
|
||||
$('#list2').html(html2);
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
mui.ajax(hyhUrl('addon/hyhlucky-Hyhlucky-getLuckyPrize'), {
|
||||
data: {
|
||||
draw_id: 1
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
data = data.data;
|
||||
|
||||
if(data.prize_list) {
|
||||
var html = '<div class="content content-1" data-id="' + data.prize_list[0].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[0].prize_img) + '" /></div></div><div class="content content-2" data-id="' + data.prize_list[1].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[1].prize_img) + '" /></div></div><div class="content content-3" data-id="' + data.prize_list[2].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[2].prize_img) + '" /></div></div><div class="content content-8" data-id="' + data.prize_list[7].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[7].prize_img) + '" /></div></div><div class="content content-click"><div id="text"><img src="../img/ac3_button1.png" /></div></div><div class="content content-4" data-id="' + data.prize_list[3].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[3].prize_img) + '" /></div></div><div class="content content-7" data-id="' + data.prize_list[6].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[6].prize_img) + '" /></div></div><div class="content content-6" data-id="' + data.prize_list[5].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[5].prize_img) + '" /></div></div><div class="content content-5" data-id="' + data.prize_list[4].id + '"><img src="../img/ac3_bg1.png" /><div class="content_con"><img src="' + hyhImgUrl(data.prize_list[4].prize_img) + '" /></div></div>'
|
||||
|
||||
$('.cj_con').html(html);
|
||||
$('.num .number').html(data.max_num)
|
||||
|
||||
$('.content').height($('.content').width() * 123 / 165 + 'px')
|
||||
$(window).resize(function() {
|
||||
$('.content').height($('.content').width() + 'px')
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
// $('.content').height($('.content').width() * 123 / 165 + 'px')
|
||||
// $(window).resize(function() {
|
||||
// $('.content').height($('.content').width() + 'px')
|
||||
// })
|
||||
|
||||
function time(a) {
|
||||
return function() {
|
||||
if(a > 8) {
|
||||
a = parseInt(a % 8)
|
||||
if(a == 0) {
|
||||
a = 8;
|
||||
}
|
||||
}
|
||||
$('.content').removeClass('active');
|
||||
$('.content-' + a).addClass('active');
|
||||
$('.zz_img').toggleClass('on');
|
||||
}
|
||||
}
|
||||
// 在旋转的时候不能再次被点击
|
||||
var t = true
|
||||
$('.cj_con').on('tap', '.content-click', function() {
|
||||
console.log(token)
|
||||
if(t) {
|
||||
t = false;
|
||||
// 产生随机数
|
||||
var prize;
|
||||
var msg = '';
|
||||
mui.ajax(hyhUrl('addon/hyhlucky-Hyhlucky-luckyDraw'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
draw_id: 1
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
console.log(data.msg)
|
||||
if(data.status == 1) {
|
||||
if($('.number').html() > 0) {
|
||||
data = data.data;
|
||||
prize = data.v;
|
||||
msg = data.yes;
|
||||
|
||||
$('.number').html($('.number').html() - 1)
|
||||
// 默认先转3圈
|
||||
prize += 32
|
||||
for(var i = 1; i <= prize; i++) {
|
||||
setTimeout(time(i), 6 * i * i);
|
||||
}
|
||||
setTimeout(function() {
|
||||
t = true;
|
||||
alert(msg);
|
||||
}, 6 * prize * prize)
|
||||
} else {
|
||||
alert('您没有抽奖机会了');
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
//跳商品页面
|
||||
$('.list').on('tap', '.list_block', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + goodsId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodsId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
199
static/app2/js/activity4.js
Executable file
199
static/app2/js/activity4.js
Executable file
@ -0,0 +1,199 @@
|
||||
//添加返回顶部按钮
|
||||
document.write('<script type="text/javascript" src="' + localStorage.getItem("jsUrl") + 'scrollToTop.js?ver=' + localStorage.getItem('version') + '"></scr' + 'ipt>');
|
||||
|
||||
var num = 1;
|
||||
var isOver = 1;
|
||||
var catId = '';
|
||||
|
||||
function getMsg(catIdNum, pageNum, pagesizeNum) {
|
||||
|
||||
var data_msg = {
|
||||
catId: catIdNum ? catIdNum : '',
|
||||
page: pageNum ? pageNum : 1,
|
||||
pagesize: pagesizeNum ? pagesizeNum : 10
|
||||
}
|
||||
|
||||
if(isOver == 0) {
|
||||
return;
|
||||
} else {
|
||||
isOver = 0;
|
||||
}
|
||||
mui.ajax(llUrl('addon/hyhbrandsrec-hyhBrandsrec-getBrandCatList'), {
|
||||
data: data_msg,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var htmlcon = '';
|
||||
data = data.data;
|
||||
if(data.Rows == '') {
|
||||
if(pageNum == 1) {
|
||||
$('.scroll_con').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px; margin-top:10px">没有更多内容</p>');
|
||||
} else if(pageNum > 1) {
|
||||
$('.scroll_con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px; margin-top:10px">没有更多内容</p>');
|
||||
}
|
||||
|
||||
isOver = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
htmlcon += '<div class="scroll_con_block shadown_wai"><div class="scb_title" data-shopId="'+ this.shopId +'"><img src="'+ ectImgUrl(this.shopImg) +'" /><p>'+ this.shopName +'</p><span class="s1">官方旗舰店</span><span class="s2">进店看看</span></div>';
|
||||
|
||||
if(this.list != '') {
|
||||
htmlcon += '<div class="scroll_con_con clearfix">';
|
||||
|
||||
$.each(this.list, function() {
|
||||
htmlcon += '<div class = "scc_block" data-goodsId="' + this.goodsId + '"><img src = "'+ ectImgUrl(this.goodsImg) +'" /><p>'+ this.goodsName +'</p><span>¥'+ this.shopPrice +'</span></div>';
|
||||
});
|
||||
|
||||
htmlcon += '</div>';
|
||||
}
|
||||
htmlcon += '</div>';
|
||||
|
||||
});
|
||||
|
||||
if(pageNum == 1) {
|
||||
$('.scroll_con').html(htmlcon);
|
||||
} else if(pageNum > 1) {
|
||||
$('.scroll_con').append(htmlcon);
|
||||
}
|
||||
isOver = 1;
|
||||
} else {
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
mui.ajax(llUrl('addon/hyhbrandsrec-hyhBrandsrec-getBrandList'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data,1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
var html_ = '';
|
||||
var data = data.data;
|
||||
$.each(data.brandlist_rec, function(num) {
|
||||
if(num % 2 == 0) {
|
||||
html += '<div class="swiper-slide"><div class="ss_top ss_ shadown_wai"data-shopId="' + this.shopId + '"><img src="' + ectImgUrl(this.brandImg) + '" /><p>' + this.brandName + '</p></div>';
|
||||
} else {
|
||||
html += '<div class="ss_bottom ss_ shadown_wai"data-shopId="' + this.shopId + '"><img src="' + ectImgUrl(this.brandImg) + '" /><p>' + this.brandName + '</p></div></div>';
|
||||
}
|
||||
})
|
||||
$.each(data.brand_list, function() {
|
||||
html_ += '<div class="nav_block" data-catId="' + this.catId + '">' + this.typeName + '</div>';
|
||||
});
|
||||
$('.swiper-wrapper').html(html);
|
||||
$('.nav').html(html_);
|
||||
$('.nav_block').eq(0).addClass('on');
|
||||
$('.t_con').height($('.t_con').width() * 470 / 718);
|
||||
$('#topbanner').height($('#topbanner').width() * 470 / 718);
|
||||
|
||||
$('#topbanner .swiper-slide').height($('#topbanner .swiper-slide').width() * 2.1);
|
||||
var swiper = new Swiper('#topbanner', {
|
||||
slidesPerView: 3.1,
|
||||
paginationClickable: true,
|
||||
spaceBetween: 5,
|
||||
freeMode: true
|
||||
});
|
||||
$('.ss_top').height($('.ss_top').width());
|
||||
$('.ss_bottom').height($('.ss_bottom').width());
|
||||
getMsg($('.nav_block').eq(0).attr('data-catId'), 1, 10);
|
||||
} else {
|
||||
console.log(data.status);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
console.log(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isOver == 1) {
|
||||
num++;
|
||||
getMsg(catId, num, 10);
|
||||
}
|
||||
}
|
||||
})
|
||||
$('.con').on('tap', '.scc_block', function() {
|
||||
var id = $(this).attr('data-goodsId');
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + id,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: id
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {
|
||||
autoShow: false, //自动显示等待框,默认为true
|
||||
}
|
||||
})
|
||||
})
|
||||
$('.con').on('tap', '.scb_title', function() {
|
||||
var shopId = $(this).attr('data-shopId');
|
||||
mui.openWindow({
|
||||
url: 'storeout.html',
|
||||
id: 'storeout.html' + shopId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
shopId: shopId
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {
|
||||
autoShow: false, //自动显示等待框,默认为true
|
||||
}
|
||||
})
|
||||
})
|
||||
$('.con').on('tap', '.ss_', function() {
|
||||
var shopId = $(this).attr('data-shopId');
|
||||
mui.openWindow({
|
||||
url: 'storeout.html',
|
||||
id: 'storeout.html' + shopId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
shopId: shopId
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {
|
||||
autoShow: false, //自动显示等待框,默认为true
|
||||
}
|
||||
})
|
||||
})
|
||||
$('.nav').on('tap', '.nav_block', function() {
|
||||
catId = $(this).attr('data-catId');
|
||||
isOver = 1;
|
||||
num = 1;
|
||||
getMsg(catId, 1, 10);
|
||||
$(this).addClass('on').siblings().removeClass('on')
|
||||
})
|
||||
|
||||
})
|
11
static/app2/js/activity5.js
Executable file
11
static/app2/js/activity5.js
Executable file
@ -0,0 +1,11 @@
|
||||
mui.init()
|
||||
mui('.con').scroll({
|
||||
deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
|
||||
});
|
||||
var slider = mui("#slider");
|
||||
slider.slider({
|
||||
interval: 5000
|
||||
});
|
||||
|
||||
$('.con_o .img').height($('.con_o .img').width())
|
||||
$('.con_t_block img').height($('.con_t_block img').width())
|
143
static/app2/js/activity6.js
Executable file
143
static/app2/js/activity6.js
Executable file
@ -0,0 +1,143 @@
|
||||
mui.plusReady(function() {
|
||||
mui.ajax(chengUrl('addon/hyhactive-Hyhactive-getGoodsList'), {
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
data = data.data;
|
||||
var html1 = '';
|
||||
var html2 = '';
|
||||
var html3 = '';
|
||||
|
||||
$.each(data[0].goodsInfo, function() {
|
||||
html1 += '<div class="gchh_block" data-goodsId="' + this.goodsId + '"><img class="gchh_b_bg" src="../img/guochan_con_bg.png" /><div class="gchh_b_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>¥' + this.shopPrice + '</p></div></div>'
|
||||
});
|
||||
$('#tt1 p').html(data[0].activeTypeName);
|
||||
$('.gchh').html(html1);
|
||||
|
||||
$.each(data[1].goodsInfo, function() {
|
||||
html2 += '<div class="zdzb_block" data-goodsId="' + this.goodsId + '"><img src="../img/ac2_zdzb_bg.png" /><div class="zdzb_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>' + this.goodsName + '</p><b>¥</b><span class="cost">' + this.shopPrice + '</span><div class="zdzb_btn">立即购买</div></div><img class="zdzb_zzc" src="../img/ac2_zdzb_zzc.png" /></div>'
|
||||
});
|
||||
$('#tt2 p').html(data[1].activeTypeName);
|
||||
$('.zdzb').html(html2);
|
||||
|
||||
$.each(data[2].goodsInfo, function() {
|
||||
html3 += '<div class="zdzb3_block" data-goodsId="' + this.goodsId + '"><img src="../img/ac2_ac3_bg.png" /><div class="zdzb3_block_con"><img src="' + hyhImgUrl(this.goodsImg) + '" /><p>RMB ' + this.shopPrice + '</p><img class="sanjiao" src="../img/ac2_sanjiao.png" /></div></div>';
|
||||
});
|
||||
$('#tt3 p').html(data[2].activeTypeName);
|
||||
$('.zdzb3').html(html3)
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
//跳商品页面
|
||||
$('.gchh').on('tap', '.gchh_block', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html'+goodsId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodsId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//跳商品页面
|
||||
$('.zdzb').on('tap', '.zdzb_block', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
console.log(goodsId)
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html'+goodsId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodsId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//跳商品页面
|
||||
$('.zdzb3').on('tap', '.zdzb3_block', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
console.log(goodsId)
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html'+goodsId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodsId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
330
static/app2/js/activity7.js
Executable file
330
static/app2/js/activity7.js
Executable file
@ -0,0 +1,330 @@
|
||||
$('.mui-title').html('ECT专区');
|
||||
var ect_top = '<div class="ect_top"><p class="ect_m">最新价</p><p class="ect_m">24H成交量</p><img src="'+ hyhImgUrl('Upload/app/icon/star.png') +'" /><p class="ect_m" id="last"></p><p class="ect_m" id="vol"></p></div>';
|
||||
$('header').before(ect_top);
|
||||
var time_ = '距活动结束还有<span id="_d"></span>天';
|
||||
|
||||
$('.mui-scroll-wrapper').removeClass('scroll_out1').addClass('scroll_out3');
|
||||
//var info = '<img src="http://img.heyuanhui.cn/Upload/app/icon/info.png" class="tanhao" />';
|
||||
//$('header').append(info);
|
||||
var nav = '<div class="nav clearfix"></div>';
|
||||
$('.ect_top').before(nav);
|
||||
|
||||
var html_con = '<div class="ten clearfix"></div><div class="title_img"></div><div class="time_"></div><div class="con_"></div>'
|
||||
|
||||
$('.con').html(html_con);
|
||||
$('.time_').html(time_);
|
||||
var nav_data = [];
|
||||
var secTypeId = 1;
|
||||
var timestamp1 = Date.parse(new Date());
|
||||
if(timestamp1 >= 1538755200000) {
|
||||
$('.mui-scroll-wrapper').removeClass('scroll_out3').addClass('scroll_out4');
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
function getimg(num) {
|
||||
var img_ = '<img src="'+ hyhImgUrl('static/app/img/ect101-' + num + '.png') +'"/>'
|
||||
$('.title_img').html(img_);
|
||||
|
||||
}
|
||||
|
||||
function getTwoClass(secTypeId) {
|
||||
mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-activits'), {
|
||||
data: {
|
||||
topTypeId: secTypeId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
data = data.data;
|
||||
var html_ = '';
|
||||
$.each(data, function() {
|
||||
html_ += '<div class="ten_t" data-secTypeId="' + this.secTypeId + '">' + this.secTypeName + '</div>'
|
||||
});
|
||||
$('.ten').html(html_);
|
||||
|
||||
} else {
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var issx = 0;
|
||||
var doller = 0;
|
||||
var secTypeId = '';
|
||||
|
||||
function getData(secTypeId, goodsCatId) {
|
||||
// mui('').pullRefresh().scroll(0, 0, 0);
|
||||
backTop();
|
||||
var data_set = {
|
||||
secTypeId: secTypeId,
|
||||
topTypeId: 1,
|
||||
goodsCatId: goodsCatId ? goodsCatId : ''
|
||||
};
|
||||
mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-frontList'), {
|
||||
data: data_set,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
|
||||
data = data.data;
|
||||
var html_ = '';
|
||||
var htmlcon = '';
|
||||
|
||||
doller = data.doller;
|
||||
// if(data.secTypeId == 5 || data.secTypeId == 4) {
|
||||
// htmlcon = '<div class="ect_activity"><img src="http://img.heyuanhui.cn/static/app/img/e' + secTypeId + '.png" class="ect_hd" /></div>'
|
||||
// } else {
|
||||
// htmlcon = '<div class="ect_activity_"><img src="http://img.heyuanhui.cn/static/app/img/countdown.png" class="ect_djs" /> <span id="_h">00</span><span id="_m">00</span><span id="_s">00</span></div>'
|
||||
// html_ = '<div class="day"><p>此活动仅限14-15号两天</p></div>';
|
||||
// }
|
||||
|
||||
$.each(data.list, function(num) {
|
||||
htmlcon += '<div class="ect_com" data-id="' + this.goodsId + '" ><div class="com_img1" ><img src="' + hyhImgUrl(this.goodsImg) + '" /></div><p class="p1"><img src="'+ hyhImgUrl('static/app/img/ectb.png') +'" class="com_img2" />' + this.goodsName + '</p><p class="p3"><l></l>CNY <o>' + this.shopPrice + '</o></p>' + html_ + '</div>';
|
||||
});
|
||||
$('.con_').html(htmlcon);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.com_img1').height($('.com_img1').width());
|
||||
}, 200)
|
||||
countTime();
|
||||
|
||||
} else {
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function countTime() {
|
||||
|
||||
//获取当前时间
|
||||
var date = new Date();
|
||||
var now = date.getTime();
|
||||
//设置截止时间
|
||||
var endDate = new Date("2018/10/6 00:00:00");
|
||||
var end = endDate.getTime();
|
||||
//时间差
|
||||
var leftTime = end - now;
|
||||
//定义变量 d,h,m,s保存倒计时的时间
|
||||
var d, h, m, s;
|
||||
if(leftTime >= 0) {
|
||||
d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
|
||||
// h = Math.floor(leftTime / 1000 / 60 / 60);
|
||||
// m = Math.floor(leftTime / 1000 / 60 % 60);
|
||||
// s = Math.floor(leftTime / 1000 % 60);
|
||||
//将倒计时赋值到div中
|
||||
if(d < 10) {
|
||||
d = "0" + d;
|
||||
}
|
||||
if(h < 10) {
|
||||
h = "0" + h;
|
||||
}
|
||||
if(m < 10) {
|
||||
m = "0" + m;
|
||||
}
|
||||
if(s < 10) {
|
||||
s = "0" + s;
|
||||
}
|
||||
$("#_d").html(d);
|
||||
// $("#_h").html(h);
|
||||
// $("#_m").html(m);
|
||||
// $("#_s").html(s);
|
||||
}
|
||||
|
||||
//递归每秒调用countTime方法,显示动态时间效果
|
||||
setTimeout(countTime, 1000);
|
||||
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('refresh', function(e) { //执行刷新
|
||||
location.reload();
|
||||
|
||||
});
|
||||
// countTime();
|
||||
// getData(secTypeId);
|
||||
mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-activityList'), {
|
||||
data: {
|
||||
topTypeId: 1
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
// console.log(1)
|
||||
var data = data.data;
|
||||
var html_ = '';
|
||||
$.each(data, function(num) {
|
||||
html_ += '<div class="nav_block" data-num="' + num + '" data-secTypeId="' + this.secTypeId + '">' + this.secTypeName + '</div>';
|
||||
});
|
||||
$('.nav').html(html_);
|
||||
$('.nav_block').eq(0).addClass('on');
|
||||
secTypeId = $('.nav_block').eq(0).attr('data-secTypeId');
|
||||
getTwoClass(secTypeId);
|
||||
getData(secTypeId);
|
||||
getimg(1);
|
||||
}
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
setInterval(function() {
|
||||
|
||||
mui.ajax('https://api.tokencan.net/exchange-open-api/open/api/get_ticker?symbol=ectusdt&random=' + Math.random(), {
|
||||
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'get', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
$('#last').html(Math.floor((+data.data.last) * doller * 100) / 100);
|
||||
$('#vol').html(data.data.vol);
|
||||
$('.p3').each(function(num) {
|
||||
$(this).children('l').html('ECT ' + (Math.floor(+$(this).children('o').html() / (+data.data.last) / (+doller) * 100)) / 100 + '≈');
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
}, 2000)
|
||||
|
||||
mui("body").on('tap', '.nav_block', function(e) {
|
||||
secTypeId = this.attributes["data-secTypeId"].nodeValue;
|
||||
var num = +$(this).attr('data-num');
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
getTwoClass(secTypeId);
|
||||
getData(secTypeId);
|
||||
getimg(num + 1);
|
||||
})
|
||||
|
||||
mui("body").on('tap', '.ten_t', function() {
|
||||
var goodsCatId = this.attributes["data-secTypeId"].nodeValue;
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
getData(secTypeId, goodsCatId)
|
||||
})
|
||||
|
||||
mui(".con").on('tap', '.ect_com', function() {
|
||||
// var tj = plus.webview.create('search.html');
|
||||
// tj.show();
|
||||
// mui.alert(e.target.attributes["data-id"].nodeValue);
|
||||
var data_id = this.attributes["data-id"].nodeValue;
|
||||
var isEct = 1;
|
||||
// console.log(this.attributes["data-id"].nodeValue);
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + data_id,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: data_id,
|
||||
isEct: isEct
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
// if(isjiazai == 1) {
|
||||
// page++;
|
||||
// }
|
||||
|
||||
} else if(scroll.y > 100 && issx == 0) {
|
||||
issx = 1;
|
||||
setTimeout(function() {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('header').on('tap', '.tanhao', function() {
|
||||
mui.openWindow({
|
||||
url: 'activity8.html',
|
||||
id: 'activity8.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
// data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
31
static/app2/js/activity8.js
Executable file
31
static/app2/js/activity8.js
Executable file
@ -0,0 +1,31 @@
|
||||
$('.mui-title').html('活动规则');
|
||||
var html = `<p class="rul_p">ECT专区9月14-15日活动规则</p>
|
||||
|
||||
<div class="rul_div">
|
||||
<p class="rul_p1">满199-100</p>
|
||||
<p class="rul_p2">活动规则</p>
|
||||
<p class="rul_p2">1、参加活动产品享受此优惠</p>
|
||||
<p class="rul_p2">2、此活动不叠加使用</p>
|
||||
<p class="rul_p2">3、活动日期2018-9-14 00:00至2018-9-15 23:59:59</p>
|
||||
<p class="rul_p2">4、此活动不兑换现金、不兑换券</p>
|
||||
<p class="rul_p2">5、ECT专区单品与普通单品分开结账</p>
|
||||
</div>
|
||||
<div class="rul_div">
|
||||
<p class="rul_p1">满二赠一</p>
|
||||
<p class="rul_p2">活动规则</p>
|
||||
<p class="rul_p2">1、仅限同款产品满二赠一</p>
|
||||
<p class="rul_p2">2、仅限参加活动产品享受此优惠</p>
|
||||
<p class="rul_p2">3、此活动不叠加使用,每单仅限使用一次</p>
|
||||
<p class="rul_p2">4、活动时间2018-9-14 00:00至2018-9-15 23:59:59</p>
|
||||
<p class="rul_p2">5、此活动不兑换现金、不兑换券</p>
|
||||
<p class="rul_p2">6、ECT专区单品与普通单品分开结账</p>
|
||||
</div>
|
||||
<div class="rul_div">
|
||||
<p class="rul_p1">9.15元</p>
|
||||
<p class="rul_p2">活动规则</p>
|
||||
<p class="rul_p2">1、此专区产品每人仅限购买四件</p>
|
||||
<p class="rul_p2">2、活动时间2018-9-14 00:00至2018-9-15 23:59:59</p>
|
||||
<p class="rul_p2">3、此活动不兑换现金、不兑换券</p>
|
||||
<p class="rul_p2">4、ECT专区单品与普通单品分开结账</p>
|
||||
</div>`;
|
||||
$('.con').html(html)
|
145
static/app2/js/activity9.js
Executable file
145
static/app2/js/activity9.js
Executable file
@ -0,0 +1,145 @@
|
||||
var puch_html = '<div class="header"><div class="header_con"><a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left lxy_a"></a><img src="'+ectImgUrl('static/app2/img/mj_log.png')+'" class="mj_lxy" /></div></div><div class="mui-scroll-wrapper scroll_out_t"><div class="mui-scroll"><div class="t_con"><input type="search" name="ect_pre" id="keyword" value="" placeholder="请输入搜索内容" /></div <div class="con_"><div class="nav clearfix"><div class="nav_block on" data-type="326"><span>满200减50</span></div><div class="nav_block" data-type="328"><span>满400减100</span></div></div><div class="nav clearfix"></div><div class="recommend"><div class="recommend_con clearfix" id="recommend_con"></div></div></div></div></div>';
|
||||
$('body').html(puch_html);
|
||||
(function($){
|
||||
$(".mui-scroll-wrapper").scroll({
|
||||
bounce: true,//滚动条是否有弹力默认是true
|
||||
indicators: false, //是否显示滚动条,默认是true
|
||||
});
|
||||
})(mui);
|
||||
document.write('<link rel="stylesheet" type="text/css" href="' + localStorage.getItem("cssUrl") + 'recommend.css?ver=' + localStorage.getItem("version") + '"/>');
|
||||
mui.plusReady(function(){
|
||||
|
||||
var topId = $('.nav_block').first().attr('data-type');
|
||||
var secTypeId=0;
|
||||
var page = 1;
|
||||
getTitle();
|
||||
mui(".nav").on('tap', '.nav_block', function() {
|
||||
page=1;
|
||||
topId = $(this).attr('data-type');
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
getTitle();
|
||||
})
|
||||
mui(".nav").on('tap', '.nav_block_a', function() {
|
||||
page=1;
|
||||
secTypeId = $(this).attr('data-type');
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
getData();
|
||||
})
|
||||
|
||||
function getTitle(){
|
||||
mui.ajax(hyhUrl('addon/shuff-Shuff-actList'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'get', //HTTP请求类型
|
||||
data:{'topTypeId':topId},
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
var data = toJson(data, 1);
|
||||
var html = '';
|
||||
$.each(data.data, function() {
|
||||
html+='<div class="nav_block_a" data-type="'+this.secTypeId+'"><span>'+this.secTypeName+'</span></div>';
|
||||
});
|
||||
$('.nav').eq(1).html(html);
|
||||
$('.nav_block_a').first().addClass('on');
|
||||
secTypeId = $('.nav_block_a').first().attr('data-type');
|
||||
getData();
|
||||
},
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
function getData() {
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
}else{
|
||||
isjiazai = 0;
|
||||
}
|
||||
// mui('').pullRefresh().scroll(0, 0, 0);
|
||||
//backTop();
|
||||
var data_set = {
|
||||
'secTypeId': secTypeId,
|
||||
'topTypeId': topId,
|
||||
'pageSize':10,
|
||||
'page':page
|
||||
};
|
||||
mui.ajax(hyhUrl('addon/shuff-Shuff-activits'), {
|
||||
data: data_set,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
data = data.data;
|
||||
//console.log(JSON.stringify(data))
|
||||
var html = '';
|
||||
if(data.list.Rows != ''){
|
||||
$.each(data.list.Rows, function() {
|
||||
// console.log(ectImgUrl(this.goodsImg))
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="'+this.goodsId+'"><img class="rcb_img" src="'+ectImgUrl(this.goodsImg)+'" alt="" /><div class="rcb_con"><div class="rcb_title"><span>满减</span>'+this.goodsName+'</div><div class="rcb_pay">'+this.shopPrice+'</div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div></div>';
|
||||
});
|
||||
|
||||
}else{
|
||||
//html='<div>没有更多商品</div>';
|
||||
}
|
||||
if(page == 1) {
|
||||
$('#recommend_con').html(html);
|
||||
} else {
|
||||
$('#recommend_con').append(html);
|
||||
}
|
||||
isjiazai=1;
|
||||
|
||||
} else {
|
||||
//console.log(data);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
$("#keyword").on('keypress', function(e) {
|
||||
var keycode = e.keyCode;
|
||||
var searchName = $(this).val();
|
||||
var url = '';
|
||||
if(keycode == '13') {
|
||||
JZL.openWindow('ac2.html', 'ac2.html',{'data_keyword': searchName,'topTypeId':($('.nav_block').eq(0).attr('data-type')+','+$('.nav_block').eq(1).attr('data-type'))});
|
||||
}
|
||||
});
|
||||
|
||||
var issx = 0;
|
||||
var isjiazai = 1;
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getData();
|
||||
}
|
||||
|
||||
} else if(scroll.y > 100 && issx == 0) {
|
||||
issx = 1;
|
||||
setTimeout(function() {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// window.addEventListener('refresh', function(e) { //执行刷新
|
||||
// location.reload();
|
||||
//
|
||||
// });
|
||||
mui("body").on('tap', '.recommend_con_block', function() {
|
||||
var data_id = this.attributes["data-goodsId"].nodeValue;
|
||||
JZL.openWindow('details.html', 'details.html'+data_id,{data_id: data_id});
|
||||
});
|
||||
//puchase的html_lxy_2018/12/08
|
||||
//var lxy_puch_html = '<div class="header"><div class="header_con"><a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left lxy_a"></a><img src="../img/mj_log.png" class="mj_lxy" /></div></div><div class="mui-scroll-wrapper scroll_out_t"><div class="mui-scroll"><div class="t_con"><input type="search" name="ect_pre" id="keyword" value="" placeholder="请输入搜索内容" /></div <div class="con_"><div class="nav clearfix"><div class="nav_block on" data-type="1"><span>满200减50</span></div><div class="nav_block" data-type="2"><span>满400减100</span></div></div><div class="nav clearfix"><div class="nav_block_a on" data-type="1"><span>食品</span></div><div class="nav_block_a" data-type="2"><span>服饰</span></div><div class="nav_block_a" data-type="3"><span>家居</span></div><div class="nav_block_a" data-type="4"><span>时尚</span></div><div class="nav_block_a" data-type="5"><span>美妆</span></div><div class="nav_block_a" data-type="6"><span>电器</span></div></div><div class="recommend"><div class="recommend_con clearfix" id="recommend_con"><div class="recommend_con_block shadown_wai"><img class="rcb_img" src="../img/kong.png" alt="" /><div class="rcb_con"><div class="rcb_title"><span>满减</span>VeroModa双腰头修身九分棉弹牛仔裤</div><div class="rcb_pay">¥269.00</div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div></div><div class="recommend_con_block shadown_wai"><img class="rcb_img" src="../img/kong.png" alt="" /><div class="rcb_con"><div class="rcb_title"><span>满减</span>VeroModa双腰头修身九分棉弹牛仔裤</div><div class="rcb_pay">¥269.00</div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div></div></div></div></div></div></div>';
|
||||
|
||||
//$('body').append(lxy_puch_html);
|
||||
})
|
0
static/app2/js/addessay.js
Executable file
0
static/app2/js/addessay.js
Executable file
658
static/app2/js/addgoods.1.js
Executable file
658
static/app2/js/addgoods.1.js
Executable file
@ -0,0 +1,658 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
mui.plusReady(function() {
|
||||
|
||||
var self = plus.webview.currentWebview();
|
||||
//console.log(self);
|
||||
var shopId = self.id;
|
||||
var goodsId = self.goodsId;
|
||||
// //console.log(shopId);
|
||||
// var isSale = typeof(self.isSale)!= 'undefined' ? self.isSale : "";
|
||||
// var isSpec = typeof(self.isSpec)!= 'undefined' ? self.isSpec : "";
|
||||
if (goodsId > 0) {
|
||||
$(".title").text("编辑商品")
|
||||
|
||||
JZL.ajax(qlgUrl("app/shops/getGoodsInfo"), {
|
||||
shopId: shopId,
|
||||
goodsId: goodsId
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
var html1 = '';
|
||||
var data = data.data;
|
||||
var i = 0,
|
||||
j = 0;
|
||||
var res = '';
|
||||
var id = data.setNameId;
|
||||
if (1 == data.isSpec) {
|
||||
getRecommend(page, pageSize, id)
|
||||
JZL.ajax(qlgUrl('app/shops/getGoodsSpecCats'), {
|
||||
shopId: shopId,
|
||||
id: id
|
||||
}, function(datas) {
|
||||
setSpec(data.spec, specList)
|
||||
});
|
||||
|
||||
}
|
||||
if (1 == data.isSale) {
|
||||
$('#isSale').prop("checked", "checked");
|
||||
}
|
||||
mui.each(data, function(index, element) {
|
||||
if ($('#' + index).attr("type") == "hidden" & $('#' + index).hasClass('inp')) {
|
||||
var imgindex = index.substring(0, index.length - 3);
|
||||
var obj = '#' + imgindex;
|
||||
// //console.log(obj);
|
||||
// if ($(obj)!= "") {
|
||||
if ($(obj).is('img')) {
|
||||
// //console.log(element);
|
||||
$(obj).attr("src", hyhImgUrl(element))
|
||||
$('#' + index).val(element)
|
||||
// }
|
||||
} else if ($('#' + index).hasClass('gallery')) {
|
||||
var html = ''
|
||||
// //console.log(element.length);
|
||||
if (element.length > 0) {
|
||||
var imgurls = element.split(",") ? imgurls = element.split(",") : imgurls = element;
|
||||
//console.log("test");
|
||||
|
||||
html = ''
|
||||
for (var i = 0; i < imgurls.length; i++) {
|
||||
html += '<div data-id="' + i +
|
||||
'" data-src="" class="galleryImg photo"><div class="delete"><img src="../img/close.png" alt=""></div><img src=' +
|
||||
hyhImgUrl(imgurls[i]) + ' class="ossfile" id="galleryImg[' + i +
|
||||
']" alt=""><input type="hidden" value="' + imgurls[i] +
|
||||
'" name="gallery[]" class="gallery" id="gallery[' + i + ']"><span class=""></span></div>'
|
||||
// $('#' + index+'Img['+i+']').val(hyhImgUrl(imgurls[i]))
|
||||
}
|
||||
var maxNum = +$('.galleryImg').last().attr('data-id') + 1; //$('.batchImg').children('.galleryImg').length - 1;
|
||||
html += '<div class="galleryImg photo" data-id="' + maxNum +
|
||||
'" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[' +
|
||||
maxNum + ']" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[' +
|
||||
maxNum +
|
||||
']"><span class=""></span></div>';
|
||||
$(".batchImg").html(html)
|
||||
} else {
|
||||
html = "";
|
||||
html =
|
||||
'<div class="galleryImg photo" data-id="0" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[0]" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[0]"><span class=""></span></div>';
|
||||
$(".batchImg").html(html)
|
||||
}
|
||||
}
|
||||
} else if (index == 'goodsCatIdPath') {
|
||||
// data.goodsCatIdPath 三级目录
|
||||
var goodsCatIdPathArr = [];
|
||||
var pathArr = ["largeCat", "mediumCat", "smallCat"]
|
||||
// //console.log(data.goodsCatIdPath);
|
||||
goodsCatIdPathArr = data.goodsCatIdPath.split('_')
|
||||
goodsCatIdPathArr.pop()
|
||||
// //console.log(goodsCatIdPathArr);
|
||||
mui.each(pathArr, function(idx, ele) {
|
||||
// //console.log(idx);
|
||||
switch (ele) {
|
||||
case 'largeCat':
|
||||
getCatIdPathName(goodsCatIdPathArr[0], function(data) {
|
||||
// //console.log(data);
|
||||
getGoodsCats('largeCat', 0, goodsCatIdPathArr[0]);
|
||||
})
|
||||
break;
|
||||
case 'mediumCat':
|
||||
getCatIdPathName(goodsCatIdPathArr[1], function(data) {
|
||||
$('#mediumCat').html('<option selected value="' + goodsCatIdPathArr[1] + '">' + data.data.catName +
|
||||
'</option>')
|
||||
});
|
||||
break;
|
||||
case 'smallCat':
|
||||
getCatIdPathName(goodsCatIdPathArr[2], function(data) {
|
||||
$('#smallCat').html('<option selected value="' + goodsCatIdPathArr[2] + '">' + data.data.catName +
|
||||
'</option>')
|
||||
});
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
$('#' + index).val(element)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
getGoodsCats("largeCat", 0)
|
||||
getRecommend(page, pageSize);
|
||||
|
||||
$(".title").text("添加商品")
|
||||
}
|
||||
|
||||
function setSpec(goodsSpec, specList) {
|
||||
var html1 = '',
|
||||
res = '',
|
||||
goodsRes = ''
|
||||
|
||||
var arr = [];
|
||||
var arr2 = {};
|
||||
for (var i = 0; i < specList.length; i++) {
|
||||
arr.push(specList[i].list);
|
||||
arr2[specList[i].catId] = specList[i].list;
|
||||
}
|
||||
var a = combins(arr);
|
||||
var cLength = 0;
|
||||
var catId = 0;
|
||||
var showSpecNames = [];
|
||||
while (c = a.next()) {
|
||||
res = c.join(' ');
|
||||
cLength = c.length;
|
||||
for (i = 0; i < cLength; i++) {
|
||||
$.each(arr2, function(ind, val) {
|
||||
$.each(val, function(index, value) {
|
||||
if (value == c[i]) {
|
||||
catId = ind;
|
||||
return;
|
||||
}
|
||||
});
|
||||
})
|
||||
html1 += '<input type="hidden" name="specItemIds[]" id="specItemIds[' + j + '][' + i +
|
||||
']" class="inp" value="0" />' +
|
||||
'<input type="hidden" name="specNamesId[]" id="specNamesId[' + j + '][' + i + ']" class="inp" value="' +
|
||||
catId + '" />' +
|
||||
'<input type="hidden" name="specItems[]" id="specItems[' + j + '][' + i + ']" class="inp" value="' + c[
|
||||
i] +
|
||||
'" />';
|
||||
}
|
||||
html1 += '<input type="hidden" name="specIds[]" id="specIds[' + j + ']" class="inp" value=\'0\' />' +
|
||||
'<div class="addcon_con shadown_wai"><label for="" data-id = "'+j+'" name="showSpecNames[]" class=""><input name="defultType" type="radio" value="" />' + res +
|
||||
'</label><input type="text" name="specPrice[]" id="specPrice[' + j +
|
||||
']" class="inp label-t" value="" /><input type="text" name="specStock[]" id="specStock[' + j +
|
||||
']" class="inp label-t" value=""/></div>'
|
||||
j++;
|
||||
}
|
||||
$('.pricset_con_con').html(html1);
|
||||
mui.each(goodsSpec, function(idx, val) {
|
||||
goodsRes = '';
|
||||
i = 0;
|
||||
mui.each(val.names, function(index, value) {
|
||||
goodsRes += value.itemName + ' '; //hongse 39ma
|
||||
})
|
||||
var showSpecNames = $('label[name="showSpecNames[]"]');
|
||||
|
||||
var specNameArr=[];
|
||||
for(var k=0;k<showSpecNames.length;k++){
|
||||
specNameArr[$(showSpecNames[k]).attr('data-id')]= $(showSpecNames[k]).text();
|
||||
}
|
||||
$.each(specNameArr,function(sitem,sval){
|
||||
if (goodsSpec == sval) {
|
||||
i=0;
|
||||
//find
|
||||
mui.each(val.names, function(index, value) {
|
||||
$('#specItemIds[' + sitem + '][' + i +
|
||||
']').val(value.itemId);
|
||||
i++;
|
||||
});
|
||||
$('#specIds[' + sitem + ']').val(val.id);
|
||||
$('#specPrice[' + sitem + ']').val(val.specPrice);
|
||||
$('#specStock[' + sitem + ']').val(val.specStock);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
// mui.each(val.names, function(index, value) {
|
||||
// html1 += '<input type="hidden" name="specItemIds[]" id="specItemIds[' + j + '][' + i +
|
||||
// ']" class="inp" value="' + value.itemId + '" />' +
|
||||
// '<input type="hidden" name="specNamesId[]" id="specNamesId[' + j + '][' + i +
|
||||
// ']" class="inp" value="' +
|
||||
// value.catId + '" />' +
|
||||
// '<input type="hidden" name="specItems[]" id="specItems[' + j + '][' + i + ']" class="inp" value="' +
|
||||
// value.itemName +
|
||||
// '" />';
|
||||
// goodsRes += value.itemName + ' ';
|
||||
// i++;
|
||||
// })
|
||||
// html1 += '<input type="hidden" name="specIds[]" id="specIds[' + j + ']" class="inp" value="' + val.id +
|
||||
// '" />' +
|
||||
// '<div class="addcon_con shadown_wai"><label for="" class="">' + goodsRes +
|
||||
// '</label><input type="text" name="specPrice[]" id="specPrice[' + j +
|
||||
// ']" class="inp label-t" value="' + val.specPrice +
|
||||
// '" /><input type="text" name="specStock[]" id="specStock[' + j +
|
||||
// ']" class="inp label-t" value="' + val.specStock + '"/></div>';
|
||||
// j++;
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// $('.pricset_con_con').html(html1);
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function getCatIdPathName(catId, callback) {
|
||||
JZL.ajax(qlgUrl("app/goodscats/getCatName"), {
|
||||
catId: catId
|
||||
}, function(data) {
|
||||
callback(data);
|
||||
})
|
||||
}
|
||||
|
||||
//获取商品总规格列表
|
||||
var page = 1;
|
||||
var pageSize = 100;
|
||||
var isjiazai = 1;
|
||||
|
||||
function getRecommend(page, pageSize, defaultVal) {
|
||||
|
||||
var recommenddata = {
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 100
|
||||
}
|
||||
recommenddata.shopId = shopId
|
||||
if (isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/shops/getSpecs'), recommenddata, function(data) {
|
||||
|
||||
|
||||
// //console.log(data);
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="0">选择属性</option>';
|
||||
if (typeof(defaultVal) == "undefined") {
|
||||
// //console.log(1);
|
||||
$.each(data.Rows, function() {
|
||||
html += '<option data-id="' + this.id + ' "value="' + this.id + '">' + this.setName + '</option>'
|
||||
});
|
||||
if (page == 1) {
|
||||
$('#setNameId').html(html);
|
||||
|
||||
} else {
|
||||
$('#setNameId').append(html);
|
||||
|
||||
}
|
||||
} else {
|
||||
// //console.log(defaultVal);
|
||||
$.each(data.Rows, function() {
|
||||
if (this.id = defaultVal) {
|
||||
selected = 'selected';
|
||||
} else {
|
||||
selected = '';
|
||||
}
|
||||
html = '<option value="' + defaultVal + '"' + selected + '>' + this.setName + '</option>';
|
||||
if (page == 1) {
|
||||
$('#setNameId').html(html);
|
||||
|
||||
} else {
|
||||
$('#setNameId').append(html);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
isjiazai = 1;
|
||||
})
|
||||
}
|
||||
|
||||
//获取商品规格
|
||||
|
||||
combins = function(args) {
|
||||
|
||||
if (args.length < 2) return args[0] || [];
|
||||
// if (arguments.length < 2) return arguments[0] || [];
|
||||
//var args = Array.prototype.slice.call(arguments);
|
||||
var that = {
|
||||
index: 0,
|
||||
nth: function(n) {
|
||||
var result = [],
|
||||
d = 0;
|
||||
for (; d < this.dim; d++) {
|
||||
var l = this[d].length;
|
||||
var i = n % l;
|
||||
result.push(this[d][i]);
|
||||
n -= i;
|
||||
n /= l;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
next: function() {
|
||||
if (this.index >= size) return;
|
||||
var result = this.nth(this.index);
|
||||
this.index++;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
var size = 1;
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
size = size * args[i].length;
|
||||
that[i] = args[i];
|
||||
}
|
||||
that.size = size;
|
||||
that.dim = args.length;
|
||||
return that;
|
||||
}
|
||||
|
||||
// 判断是否上架
|
||||
var isSale = "",
|
||||
setNameId,
|
||||
isSpec;
|
||||
if ($("#isSale").prop("checked")) {
|
||||
isSale = "1";
|
||||
} else {
|
||||
isSale = "0";
|
||||
}
|
||||
// 判断有没有商品属性
|
||||
|
||||
if ($("#setNameId option:selected").val() != "") {
|
||||
isSpec = 1;
|
||||
} else {
|
||||
isSpec = 0;
|
||||
}
|
||||
|
||||
$('#setNameId').change(function() {
|
||||
var id = $('#setNameId option:selected').val()
|
||||
|
||||
var html1 = "";
|
||||
JZL.ajax(qlgUrl('app/shops/getGoodsSpecCats'), {
|
||||
shopId: shopId,
|
||||
id: id
|
||||
}, function(data) {
|
||||
|
||||
// //console.log(data);
|
||||
if (1 == data.status) {
|
||||
|
||||
var arr = [];
|
||||
var arr2 = {};
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
arr.push(data.data[i].list);
|
||||
arr2[data.data[i].catId] = data.data[i].list;
|
||||
}
|
||||
var a = combins(arr);
|
||||
var j = 0;
|
||||
var res = '';
|
||||
var cLength = 0;
|
||||
var catId = 0;
|
||||
while (c = a.next()) {
|
||||
res = c.join(',');
|
||||
cLength = c.length;
|
||||
for (i = 0; i < cLength; i++) {
|
||||
$.each(arr2, function(ind, val) {
|
||||
$.each(val, function(index, value) {
|
||||
if (value == c[i]) {
|
||||
catId = ind;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
html1 += '<input type="hidden" name="specItemIds[]" id="specItemIds[' + j + '][' + i +
|
||||
']" class="inp" value="0" />' +
|
||||
'<input type="hidden" name="specNamesId[]" id="specNamesId[' + j + '][' + i + ']" class="inp" value="' +
|
||||
catId + '" />' +
|
||||
'<input type="hidden" name="specItems[]" id="specItems[' + j + '][' + i + ']" class="inp" value="' + c[i] +
|
||||
'" />';
|
||||
|
||||
}
|
||||
html1 += '<input type="hidden" name="specIds[]" id="specIds[' + j + ']" class="inp" value=\'0\' />' +
|
||||
'<div class="addcon_con shadown_wai"><label for="" class="">' + res +
|
||||
'</label><input type="text" name="specPrice[]" id="specPrice[' + j +
|
||||
']" class="inp label-t" value="" /><input type="text" name="specStock[]" id="specStock[' + j +
|
||||
']" class="inp label-t" value=""/></div>'
|
||||
j++;
|
||||
}
|
||||
$('.pricset_con_con').html(html1);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// 下一页
|
||||
var check = true;
|
||||
mui("body").on('tap', '.next_btn', function() {
|
||||
check = true;
|
||||
$('.isemptyinp').each(function() {
|
||||
// //console.log(this);
|
||||
|
||||
if (!this.value || "" == $.trim(this.value)) {
|
||||
var label = this.previousElementSibling;
|
||||
//console.log(label);
|
||||
mui.alert(label.innerText + "不允许为空")
|
||||
check = false;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if ($("#shopPrice").val() == "" & $("#setNameId option:selected").val() == "0" & check == true) {
|
||||
mui.alert("商品没有属性必须输入商品价格")
|
||||
check = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($("#setNameId option:selected").val() != "" & check == true) {
|
||||
$('.pricset_con_con input').each(function() {
|
||||
if ((!this.value || "" == $.trim(this.value))) {
|
||||
mui.alert("请输入数据")
|
||||
check = false;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (check == true) {
|
||||
$(".addcon").css("display", "none")
|
||||
$(".pre").css("display", "block");
|
||||
backTop();
|
||||
let E = window.wangEditor;
|
||||
|
||||
let editor = new E('#goodsDesc');
|
||||
editor.customConfig.uploadImgShowBase64 = true;
|
||||
editor.create();
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
//预览
|
||||
mui("body").on('tap', '.prelook', function() {
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 上一页
|
||||
mui('body').on('tap', '.pre_btn', function() {
|
||||
$(".addcon").css("display", "block")
|
||||
$(".pre").css("display", "none")
|
||||
})
|
||||
// //console.log($("#goodsDesc").text());
|
||||
|
||||
//提交
|
||||
var click = false;
|
||||
mui('.btn').on('tap', '.submit_btn ', function() {
|
||||
if (click == true) {
|
||||
return
|
||||
}
|
||||
|
||||
var imgs = '';
|
||||
var data = $('input[name="gallery[]"]');
|
||||
// //console.log(data);
|
||||
$.each(data, function() {
|
||||
if ('' != $(this).val())
|
||||
imgs = $(this).val() + ',' + imgs;
|
||||
|
||||
})
|
||||
|
||||
|
||||
imgs = imgs.substring(0, imgs.lastIndexOf(','));
|
||||
|
||||
|
||||
$('#gallery').val(imgs);
|
||||
// //console.log($('#gallery').val());
|
||||
|
||||
var params = JZL.getParams(".inp");
|
||||
params.shopId = shopId;
|
||||
params.isSale = isSale;
|
||||
params.isSpec = isSpec;
|
||||
params.goodsDesc = $("#goodsDesc").text();
|
||||
params.setNameId = $('#setNameId option:selected').val()
|
||||
click = true;
|
||||
if (goodsId > 0) {
|
||||
params.goodsId = goodsId;
|
||||
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/shops/addGoods'), params, function(data) {
|
||||
// //console.log(data);
|
||||
if (data.status == 1) {
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
//获取类目
|
||||
$('.selectarea').on("change", ".area", function() {
|
||||
var objs = ['largeCat', 'mediumCat', 'smallCat'];
|
||||
// var areaStr = ['请选择', '请选择', '请选择'];
|
||||
var level = +$(this).attr('data-level') + 1; //0
|
||||
pid = $('#' + objs[level - 1] + ' option:selected').val();
|
||||
getGoodsCats(objs[level], pid);
|
||||
|
||||
})
|
||||
|
||||
//三级类目
|
||||
function getGoodsCats(obj, pid, defaultId) {
|
||||
JZL.ajax(qlgUrl('app/shops/getGoodsCats'), {
|
||||
pid: pid
|
||||
},
|
||||
function(data) {
|
||||
// //console.log(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="">' + "请选择" + '</option>';
|
||||
if ('undefined' == typeof(defaultId)) {
|
||||
$.each(data, function() {
|
||||
// //console.log(this);
|
||||
html += '<option value="' + this.catId + '">' + this.catName + '</option>'
|
||||
});
|
||||
} else {
|
||||
$.each(data, function() {
|
||||
if (this.catId == defaultId) {
|
||||
selected = 'selected';
|
||||
} else {
|
||||
selected = '';
|
||||
}
|
||||
html += '<option value="' + this.catId + '" ' + selected + '>' + this.catName + '</option>'
|
||||
});
|
||||
}
|
||||
$('#' + obj).html(html);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
$(".batchImg").on("tap", '.galleryImg', function() {
|
||||
var num = $(this).attr('data-id');
|
||||
UP.init("gallery[" + num + "]", "test", "galleryImg[" + num + "]", 1);
|
||||
var that = $(this);
|
||||
openCamera(function(t, status, fileName, serverName) {
|
||||
var html = '<div class="delete" data-id="' + num + '"><img src="../img/close.png" alt=""></div><img src="' +
|
||||
serverName + '" class="ossfile" data-src="' + fileName + '" data-id="' + num + '" id="galleryImg[' + num +
|
||||
']" alt=""><input type="hidden" name="gallery[]" value="' + fileName +
|
||||
'" class="gallery" id="gallery[' + num + ']"><span class=""></span>';
|
||||
// //console.log($('#galleryImg[' + num + ']'));
|
||||
//if ($('#galleryImg[' + num + ']').length > 0) {
|
||||
that.html(html);
|
||||
//} else {
|
||||
// $(".batchImg").append(html);
|
||||
//}
|
||||
|
||||
var maxNum = $('.galleryImg').last().attr('data-id'); //$('.batchImg').children('.galleryImg').length - 1;
|
||||
if (num == maxNum) {
|
||||
maxNum++;
|
||||
html = '<div class="galleryImg photo" data-id="' + maxNum +
|
||||
'" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[' +
|
||||
maxNum + ']" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[' + maxNum +
|
||||
']"><span class=""></span></div>';
|
||||
$(".batchImg").append(html);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$(".oneImg").on("tap", '#goods', function() {
|
||||
// UP.init("accountBookImg", "test", "accountBookImgTag")
|
||||
|
||||
UP.init("goodsImg", "test", "goods")
|
||||
openCamera(function(t, status, fileName, serverName) {
|
||||
var html = '<img src="' + serverName + '" class="ossfile" data-src="' + fileName +
|
||||
'" id="goods" alt=""><input type="hidden" value="' + fileName +
|
||||
'" class="goodsImg inp" id="goodsImg"><span class=""></span>';
|
||||
|
||||
$(".goods").html(html);
|
||||
|
||||
})
|
||||
})
|
||||
// 删除图片
|
||||
$(".batchImg").on('tap', '.delete', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation()
|
||||
|
||||
// //console.log(this);
|
||||
var that = $(this)
|
||||
//var idx = that.parent().attr('data-id');
|
||||
//var maxNum = $('.galleryImg').last().attr('data-id'); //$('.batchImg').children('.galleryImg').length - 1;
|
||||
if (confirm('确认删除图片?')) {
|
||||
that.parent().remove()
|
||||
//delete galleryarr[idx];
|
||||
}
|
||||
})
|
||||
|
||||
})
|
859
static/app2/js/addgoods.2.js
Executable file
859
static/app2/js/addgoods.2.js
Executable file
@ -0,0 +1,859 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
$(".pricset_con").hide();
|
||||
function escape2Html(str) {
|
||||
var arrEntities = {
|
||||
'lt': '<',
|
||||
'gt': '>',
|
||||
'nbsp': ' ',
|
||||
'amp': '&',
|
||||
'quot': '"'
|
||||
};
|
||||
return str.replace(/&(lt|gt|nbsp|amp|quot);/ig, function(all, i) {
|
||||
return arrEntities[i];
|
||||
});
|
||||
};
|
||||
mui.plusReady(function() {
|
||||
|
||||
var self = plus.webview.currentWebview();
|
||||
// ////console.log(self);
|
||||
var shopId = self.id;
|
||||
var goodsId = self.goodsId;
|
||||
var richText = '';
|
||||
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#goodsDesc')
|
||||
// editor.customConfig.showLinkImg = false // 隐藏“网络图片”tab
|
||||
// editor.customConfig.uploadFileName = 'yourFileName' //给上传的本地图片文件命名的统一名称
|
||||
// editor.customConfig.uploadImgServer = '/upload'; //官方文档上写的是服务器地址,也就是上传图片的方法名
|
||||
|
||||
// 允许上传到七牛云存储
|
||||
editor.customConfig.qiniu = true;
|
||||
editor.customConfig.debug = true;
|
||||
// editor.customConfig.onchange = function (html) {
|
||||
// // 监控变化,同步更新到 textarea
|
||||
// // $text1.val(html)
|
||||
// };
|
||||
editor.create();
|
||||
// 初始化七牛上传
|
||||
|
||||
|
||||
if (goodsId > 0) {
|
||||
$(".title").text("编辑商品")
|
||||
|
||||
JZL.ajax(qlgUrl("app/shops/getGoodsInfo"), {
|
||||
shopId: shopId,
|
||||
goodsId: goodsId
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
var html1 = '';
|
||||
var data = data.data;
|
||||
var i = 0,
|
||||
j = 0;
|
||||
var res = '';
|
||||
var bjSpec = data.isSpec;
|
||||
if (1 == data.isSpec) {
|
||||
$(".pricset_con").show()
|
||||
var id = data.setNameId;
|
||||
|
||||
// ////console.log(id);
|
||||
getRecommend(page, pageSize, id)
|
||||
|
||||
JZL.ajax(qlgUrl('app/shops/getGoodsSpecCats'), {
|
||||
shopId: shopId,
|
||||
id: id
|
||||
}, function(data1) {
|
||||
//console.log(data1);
|
||||
if (1 == data1.status) {
|
||||
var that = this
|
||||
var arr = [];
|
||||
var arr2 = {};
|
||||
for (var i = 0; i < data1.data.length; i++) {
|
||||
arr.push(data1.data[i].list);
|
||||
arr2[data1.data[i].catId] = data1.data[i].list;
|
||||
}
|
||||
|
||||
// ////console.log(a);
|
||||
var cLength = 0;
|
||||
var catId = 0;
|
||||
var goodsRes = "";
|
||||
if (arr.length > 0) {
|
||||
var tmpI = 0;
|
||||
var a = combins(arr);
|
||||
while (true) {
|
||||
if (arr.length > 1) {
|
||||
c = a.next();
|
||||
if (!c) break;
|
||||
cLength = c.length;
|
||||
res = c.join(' ');
|
||||
} else {
|
||||
if (tmpI >= arr[0].length) {
|
||||
break;
|
||||
}
|
||||
c = arr[0];
|
||||
res = arr[0][tmpI];
|
||||
cLength = arr[0].length;
|
||||
}
|
||||
tmpI++;
|
||||
// ////console.log(c);
|
||||
// ////console.log(res);
|
||||
for (i = 0; i < cLength; i++) {
|
||||
$.each(arr2, function(ind, val) {
|
||||
$.each(val, function(index, value) {
|
||||
if (value == c[i]) {
|
||||
catId = ind;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
html1 += '<input type="hidden" name="specItemIds[]" id="specItemIds[' + j + '][' + i +
|
||||
']" class="inp" value="0" />' + //属性值id
|
||||
'<input type="hidden" name="specNamesId[]" id="specNamesId[' + j + '][' + i + ']" class="inp" value="' +
|
||||
catId + '" />' + //分类ID
|
||||
'<input type="hidden" name="specItems[]" id="specItems[' + j + '][' + i + ']" class="inp" value="' + c[
|
||||
i] + //属性值
|
||||
'" />';
|
||||
}
|
||||
//console.log(j);
|
||||
html1 += '<input type="hidden" name="specIds[]" id="specIds[' + j + ']" class="inp" value="0" />' + //规格表ID 新增传0
|
||||
'<div class="addcon_con shadown_wai"><div class="radio"><input name="defaultId" type="radio" value="' +
|
||||
j + '" /></div><label for="" data-id = "' + j +
|
||||
'" name="showSpecNames[]" class="">' + res +
|
||||
'</label><input type="text" name="specPrice[]" id="specPrice[' + j +
|
||||
']" class="inp label-t" value="" /><input type="text" name="specStock[]" id="specStock[' + j +
|
||||
']" class="inp label-t" value=""/></div>';
|
||||
j++;
|
||||
}
|
||||
|
||||
$('.pricset_con_con').html(html1);
|
||||
var setNum = 0;
|
||||
mui.each(data.spec, function(idx, val) {
|
||||
if (cLength != val.names.length) return false;
|
||||
goodsRes = '';
|
||||
i = 0;
|
||||
if (arr.length > 1) {
|
||||
mui.each(val.names, function(index, value) {
|
||||
goodsRes += value.itemName + ' '; //hongse 39ma
|
||||
})
|
||||
} else {
|
||||
// //console.log(val);
|
||||
//console.log(val.names);
|
||||
goodsRes = val.names[setNum].itemName;
|
||||
setNum++;
|
||||
}
|
||||
var showSpecNames = $('label[name="showSpecNames[]"]');
|
||||
var specNameArr = [];
|
||||
for (var k = 0; k < showSpecNames.length; k++) {
|
||||
specNameArr[$(showSpecNames[k]).attr('data-id')] = $(showSpecNames[k]).text();
|
||||
}
|
||||
$.each(specNameArr, function(sitem, sval) {
|
||||
if ($.trim(goodsRes) == $.trim(sval)) { //去除空格 不然报错
|
||||
i = 0;
|
||||
mui.each(val.names, function(index, value) {
|
||||
// ////console.log(i);
|
||||
document.getElementById('specItemIds[' + +sitem + '][' + i + ']').value = value.itemId //属性值ID 新增传0
|
||||
i++;
|
||||
});
|
||||
document.getElementById('specIds[' + +sitem + ']').value = val.id //规格表ID,新增传0
|
||||
document.getElementById('specPrice[' + +sitem + ']').value = val.specPrice
|
||||
document.getElementById('specStock[' + +sitem + ']').value = val.specStock
|
||||
if (1 == val.isDefault) {
|
||||
|
||||
//checked
|
||||
var inputList = $('input[name=defaultId]')
|
||||
|
||||
|
||||
$.each(inputList, function(index, value) {
|
||||
// ////console.log(value, index);
|
||||
this.previousElementSibling
|
||||
if (sitem == this.value) {
|
||||
this.checked = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
} else if (0 == data.isSpec) {
|
||||
// $('#setNameId').html('<option value="0">选择属性</option>')
|
||||
getRecommend(page, pageSize)
|
||||
}
|
||||
if (1 == data.isSale) {
|
||||
$('#isSale').prop("checked", "checked");
|
||||
}
|
||||
mui.each(data, function(index, element) {
|
||||
if ($('#' + index).attr("type") == "hidden" & $('#' + index).hasClass('inp')) {
|
||||
var imgindex = index.substring(0, index.length - 3);
|
||||
var obj = '#' + imgindex;
|
||||
if ($(obj).is('img')) {
|
||||
$(obj).attr("src", hyhImgUrl(element))
|
||||
$('#' + index).val(element)
|
||||
} else if ($('#' + index).hasClass('gallery')) {
|
||||
var html = '';
|
||||
if (element.length > 0) {
|
||||
var imgurls = element.split(",") ? imgurls = element.split(",") : imgurls = element;
|
||||
html = ''
|
||||
for (var i = 0; i < imgurls.length; i++) {
|
||||
html += '<div data-id="' + i +
|
||||
'" data-src="" class="galleryImg photo"><div class="delete"><img src="../img/close.png" alt=""></div><img src=' +
|
||||
hyhImgUrl(imgurls[i]) + ' class="ossfile" id="galleryImg[' + i +
|
||||
']" alt=""><input type="hidden" value="' + imgurls[i] +
|
||||
'" name="gallery[]" class="gallery" id="gallery[' + i + ']"><span class=""></span></div>'
|
||||
// $('#' + index+'Img['+i+']').val(hyhImgUrl(imgurls[i]))
|
||||
}
|
||||
var maxNum = +$('.galleryImg').last().attr('data-id') + 1; //$('.batchImg').children('.galleryImg').length - 1;
|
||||
html += '<div class="galleryImg photo" data-id="' + maxNum +
|
||||
'" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[' +
|
||||
maxNum + ']" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[' +
|
||||
maxNum +
|
||||
']"><span class=""></span></div>';
|
||||
$(".batchImg").html(html)
|
||||
} else {
|
||||
html = "";
|
||||
html =
|
||||
'<div class="galleryImg photo" data-id="0" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[0]" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[0]"><span class=""></span></div>';
|
||||
$(".batchImg").html(html)
|
||||
}
|
||||
}
|
||||
} else if (index == 'goodsCatIdPath') {
|
||||
// data.goodsCatIdPath 三级目录
|
||||
var goodsCatIdPathArr = [];
|
||||
var pathArr = ["largeCat", "mediumCat", "smallCat"]
|
||||
// ////console.log(data.goodsCatIdPath);
|
||||
goodsCatIdPathArr = data.goodsCatIdPath.split('_')
|
||||
goodsCatIdPathArr.pop() //移除最后一个数组元素 _
|
||||
mui.each(pathArr, function(idx, ele) {
|
||||
// ////console.log(idx);
|
||||
switch (ele) {
|
||||
case 'largeCat':
|
||||
getCatIdPathName(goodsCatIdPathArr[0], function(data) {
|
||||
getGoodsCats('largeCat', 0, goodsCatIdPathArr[0]);
|
||||
})
|
||||
break;
|
||||
case 'mediumCat':
|
||||
getCatIdPathName(goodsCatIdPathArr[1], function(data) {
|
||||
$('#mediumCat').html('<option selected value="' + goodsCatIdPathArr[1] + '">' + data.data.catName +
|
||||
'</option>')
|
||||
});
|
||||
break;
|
||||
case 'smallCat':
|
||||
getCatIdPathName(goodsCatIdPathArr[2], function(data) {
|
||||
$('#smallCat').html('<option selected value="' + goodsCatIdPathArr[2] + '">' + data.data.catName +
|
||||
'</option>')
|
||||
});
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
$('#' + index).val(element)
|
||||
}
|
||||
})
|
||||
if ('' != data.goodsDesc) {
|
||||
var Desc = escape2Html(data.goodsDesc)
|
||||
// var Desc= HtmlUtils.htmlUnescape(data.goodsDesc)
|
||||
////console.log(Desc)
|
||||
// $('#goodsDesc').val(Desc)
|
||||
// $('#goodsDesc').html(Desc)
|
||||
editor.txt.html(Desc)
|
||||
}
|
||||
|
||||
// params.goodsDesc = editor.txt.html();
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
getGoodsCats("largeCat", 0)
|
||||
getRecommend(page, pageSize);
|
||||
|
||||
$(".title").text("添加商品")
|
||||
}
|
||||
|
||||
|
||||
function getCatIdPathName(catId, callback) {
|
||||
JZL.ajax(qlgUrl("app/goodscats/getCatName"), {
|
||||
catId: catId
|
||||
}, function(data) {
|
||||
callback(data);
|
||||
})
|
||||
}
|
||||
|
||||
//获取商品总规格列表
|
||||
var page = 1;
|
||||
var pageSize = 100;
|
||||
var isjiazai = 1;
|
||||
|
||||
function getRecommend(page, pageSize, defaultVal) {
|
||||
|
||||
var recommenddata = {
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 100
|
||||
}
|
||||
recommenddata.shopId = shopId
|
||||
if (isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/shops/getSpecs'), recommenddata, function(data) {
|
||||
|
||||
|
||||
// ////console.log(data);
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="0">无规格属性</option>';
|
||||
if (typeof(defaultVal) == "undefined") {
|
||||
// ////console.log(1);
|
||||
$.each(data.Rows, function() {
|
||||
html += '<option value= "' + this.id + '" data-id="' + this.id + ' ">' + this.setName + '</option>'
|
||||
});
|
||||
if (page == 1) {
|
||||
$('#setNameId').html(html);
|
||||
|
||||
} else {
|
||||
$('#setNameId').append(html);
|
||||
|
||||
}
|
||||
} else {
|
||||
// ////console.log(defaultVal);
|
||||
$.each(data.Rows, function() {
|
||||
if (this.id == defaultVal) {
|
||||
selected = 'selected';
|
||||
} else {
|
||||
selected = '';
|
||||
}
|
||||
html += '<option data-id="' + this.id + '" value="' + this.id + '" ' + selected + '>' + this.setName +
|
||||
'</option>';
|
||||
|
||||
});
|
||||
if (page == 1) {
|
||||
$('#setNameId').html(html);
|
||||
|
||||
} else {
|
||||
$('#setNameId').append(html);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
mui.alert(data.msg);
|
||||
// location.reload();
|
||||
}
|
||||
isjiazai = 1;
|
||||
})
|
||||
}
|
||||
|
||||
//获取商品规格
|
||||
// 笛卡尔积
|
||||
combins = function(args) {
|
||||
|
||||
if (args.length < 2) return args[0] || [];
|
||||
// if (arguments.length < 2) return arguments[0] || [];
|
||||
//var args = Array.prototype.slice.call(arguments);
|
||||
var that = {
|
||||
index: 0,
|
||||
nth: function(n) {
|
||||
var result = [],
|
||||
d = 0;
|
||||
for (; d < this.dim; d++) {
|
||||
var l = this[d].length;
|
||||
var i = n % l;
|
||||
result.push(this[d][i]);
|
||||
n -= i;
|
||||
n /= l;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
next: function() {
|
||||
if (this.index >= size) return;
|
||||
var result = this.nth(this.index);
|
||||
this.index++;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
var size = 1;
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
size = size * args[i].length;
|
||||
that[i] = args[i];
|
||||
}
|
||||
that.size = size;
|
||||
that.dim = args.length;
|
||||
return that;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('#setNameId').change(function() {
|
||||
var id = $('#setNameId option:selected').attr('data-id')
|
||||
// ////console.log(id);
|
||||
|
||||
var html1 = "";
|
||||
if (typeof id == "undefined" || 0 == id) {
|
||||
$(".pricset_con").hide()
|
||||
} else {
|
||||
$(".pricset_con").show()
|
||||
JZL.ajax(qlgUrl('app/shops/getGoodsSpecCats'), {
|
||||
shopId: shopId,
|
||||
id: id
|
||||
}, function(data) {
|
||||
// ////console.log(data);
|
||||
if (1 == data.status) {
|
||||
html1 = "";
|
||||
var arr = [];
|
||||
var arr2 = {};
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
arr.push(data.data[i].list);
|
||||
arr2[data.data[i].catId] = data.data[i].list;
|
||||
}
|
||||
|
||||
var j = 0;
|
||||
var res = '';
|
||||
var cLength = 0;
|
||||
var catId = 0;
|
||||
var tmpI = 0;
|
||||
var a = combins(arr);
|
||||
while (true) {
|
||||
if (arr.length > 1) {
|
||||
c = a.next();
|
||||
if (!c) break;
|
||||
cLength = c.length;
|
||||
res = c.join(' ');
|
||||
} else {
|
||||
if (tmpI >= arr[0].length) {
|
||||
break;
|
||||
}
|
||||
c = arr[0];
|
||||
res = arr[0][tmpI];
|
||||
cLength = arr[0].length;
|
||||
}
|
||||
tmpI++;
|
||||
for (i = 0; i < cLength; i++) {
|
||||
$.each(arr2, function(ind, val) {
|
||||
$.each(val, function(index, value) {
|
||||
if (value == c[i]) {
|
||||
catId = ind;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
html1 += '<input type="hidden" name="specItemIds[]" id="specItemIds[' + j + '][' + i +
|
||||
']" class="inp" value="0" />' +
|
||||
'<input type="hidden" name="specNamesId[]" id="specNamesId[' + j + '][' + i + ']" class="inp" value="' +
|
||||
catId + '" />' +
|
||||
'<input type="hidden" name="specItems[]" id="specItems[' + j + '][' + i + ']" class="inp" value="' + c[i] +
|
||||
'" />';
|
||||
|
||||
}
|
||||
html1 += '<input type="hidden" name="specIds[]" id="specIds[' + j + ']" class="inp" value=\'0\' />' +
|
||||
'<div class="addcon_con shadown_wai"><div class="radio"><input name="defaultId" type="radio" value="' + j +
|
||||
'" /></div><label for="" class="">' +
|
||||
res +
|
||||
'</label><input type="text" name="specPrice[]" id="specPrice[' + j +
|
||||
']" class="inp label-t" value="" /><input type="text" name="specStock[]" id="specStock[' + j +
|
||||
']" class="inp label-t" value=""/></div>'
|
||||
j++;
|
||||
}
|
||||
$('.pricset_con_con').html(html1);
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// 下一页
|
||||
var check = true;
|
||||
mui("body").on('tap', '.next_btn', function() {
|
||||
check = true;
|
||||
$('.isemptyinp').each(function() {
|
||||
if (!this.value || "" == $.trim(this.value)) {
|
||||
var label = this.previousElementSibling;
|
||||
mui.alert(label.innerText + "不允许为空")
|
||||
check = false;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if ($("#shopPrice").val() == "" & $("#setNameId option:selected").val() == "0" & check == true) {
|
||||
mui.alert("商品没有属性必须输入商品价格")
|
||||
check = false;
|
||||
return false;
|
||||
}
|
||||
if ($("#setNameId option:selected").val() != 0 && check == true) {
|
||||
|
||||
if ($('input[name="defaultId"]:checked').length == 0) {
|
||||
mui.alert("请选择默认规格")
|
||||
check = false;
|
||||
return false
|
||||
}
|
||||
$('.pricset_con_con input').each(function() {
|
||||
if ((!$(this).val() || "" == $.trim(this.value))) {
|
||||
|
||||
|
||||
mui.alert("请输入数据")
|
||||
$(this).focus();
|
||||
check = false;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
// var shopPrice= $('input[name="defaultId"]:checked').parent().parent().find('input[name="specPrice[]"]').val();
|
||||
// ////console.log(shopPrice)
|
||||
if ($("#isSale").prop("checked")) {
|
||||
isSale = "1";
|
||||
} else {
|
||||
isSale = "0";
|
||||
}
|
||||
if (check == true) {
|
||||
$(".addcon").css("display", "none")
|
||||
$(".pre").css("display", "block");
|
||||
backTop();
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
//预览
|
||||
$('.prelook').hide();
|
||||
// mui("body").on('tap', '.prelook', function() {
|
||||
//
|
||||
//
|
||||
//
|
||||
// })
|
||||
// 上一页
|
||||
mui('body').on('tap', '.pre_btn', function() {
|
||||
$(".addcon").css("display", "block")
|
||||
$(".pre").css("display", "none")
|
||||
})
|
||||
// ////console.log($("#goodsDesc").text());
|
||||
|
||||
//提交
|
||||
// 判断是否上架
|
||||
var isSale = "",
|
||||
setNameId,
|
||||
isSpec;
|
||||
|
||||
// ////console.log(typeof($("#setNameId option:selected").val()));
|
||||
|
||||
|
||||
//提交
|
||||
var click = false;
|
||||
mui('.btn').on('tap', '.submit_btn ', function() {
|
||||
richText = editor.txt.text()
|
||||
// 判断有没有商品属性
|
||||
if ($("#setNameId option:selected").val() != 0) {
|
||||
isSpec = 1;
|
||||
} else {
|
||||
isSpec = 0;
|
||||
}
|
||||
if (click == true) {
|
||||
return
|
||||
}
|
||||
|
||||
if ($("#isSale").prop("checked")) {
|
||||
// ////console.log(1);
|
||||
isSale = "1";
|
||||
} else {
|
||||
// ////console.log(0);
|
||||
isSale = "0";
|
||||
}
|
||||
var imgs = '';
|
||||
var data = $('input[name="gallery[]"]');
|
||||
// ////console.log(data);
|
||||
$.each(data, function() {
|
||||
if ('' != $(this).val())
|
||||
imgs = $(this).val() + ',' + imgs;
|
||||
|
||||
})
|
||||
|
||||
|
||||
imgs = imgs.substring(0, imgs.lastIndexOf(','));
|
||||
|
||||
|
||||
$('#gallery').val(imgs);
|
||||
//默认选中
|
||||
var defaultPrice = $('input[name="defaultId"]:checked').parent().parent().find('input[name="specPrice[]"]').val();
|
||||
var params = JZL.getParams(".inp");
|
||||
params.shopId = shopId;
|
||||
params.isSale = isSale;
|
||||
params.isSpec = isSpec;
|
||||
params.defaultId = $('input[name="defaultId"]:checked').val();
|
||||
params.goodsDesc = editor.txt.html();
|
||||
params.setNameId = $('#setNameId option:selected').val()
|
||||
if (isSpec == 1) {
|
||||
// params.shopPrice = shopPrice
|
||||
$('#shopPrice').val(defaultPrice);
|
||||
|
||||
}
|
||||
params.shopPrice = $('#shopPrice').val()
|
||||
click = true;
|
||||
if (goodsId > 0) {
|
||||
params.goodsId = goodsId;
|
||||
|
||||
}
|
||||
// alert(editor.txt.html())
|
||||
JZL.ajax(qlgUrl('app/shops/addGoods'), params, function(data) {
|
||||
// ////console.log(data);
|
||||
if (data.status == 1) {
|
||||
mui.toast(data.msg);
|
||||
mui.back();
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
//获取类目
|
||||
$('.selectarea').on("change", ".area", function() {
|
||||
var objs = ['largeCat', 'mediumCat', 'smallCat'];
|
||||
// var areaStr = ['请选择', '请选择', '请选择'];
|
||||
var level = +$(this).attr('data-level') + 1; //0
|
||||
pid = $('#' + objs[level - 1] + ' option:selected').val();
|
||||
getGoodsCats(objs[level], pid);
|
||||
|
||||
})
|
||||
|
||||
//三级类目
|
||||
function getGoodsCats(obj, pid, defaultId) {
|
||||
JZL.ajax(qlgUrl('app/shops/getGoodsCats'), {
|
||||
pid: pid
|
||||
},
|
||||
function(data) {
|
||||
// ////console.log(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="">' + "请选择" + '</option>';
|
||||
if ('undefined' == typeof(defaultId)) {
|
||||
$.each(data, function() {
|
||||
// ////console.log(this);
|
||||
html += '<option value="' + this.catId + '">' + this.catName + '</option>'
|
||||
});
|
||||
} else {
|
||||
$.each(data, function() {
|
||||
if (this.catId == defaultId) {
|
||||
selected = 'selected';
|
||||
} else {
|
||||
selected = '';
|
||||
}
|
||||
html += '<option value="' + this.catId + '" ' + selected + '>' + this.catName + '</option>'
|
||||
});
|
||||
}
|
||||
$('#' + obj).html(html);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
$(".batchImg").on("tap", '.galleryImg', function() {
|
||||
var num = $(this).attr('data-id');
|
||||
UP.init("gallery[" + num + "]", "test", "galleryImg[" + num + "]", 1);
|
||||
var that = $(this);
|
||||
openCamera(function(t, status, fileName, serverName) {
|
||||
var html = '<div class="delete" data-id="' + num + '"><img src="../img/close.png" alt=""></div><img src="' +
|
||||
serverName + '" class="ossfile" data-src="' + fileName + '" data-id="' + num + '" id="galleryImg[' + num +
|
||||
']" alt=""><input type="hidden" name="gallery[]" value="' + fileName +
|
||||
'" class="gallery" id="gallery[' + num + ']"><span class=""></span>';
|
||||
// ////console.log($('#galleryImg[' + num + ']'));
|
||||
//if ($('#galleryImg[' + num + ']').length > 0) {
|
||||
that.html(html);
|
||||
//} else {
|
||||
// $(".batchImg").append(html);
|
||||
//}
|
||||
|
||||
var maxNum = $('.galleryImg').last().attr('data-id'); //$('.batchImg').children('.galleryImg').length - 1;
|
||||
if (num == maxNum) {
|
||||
maxNum++;
|
||||
html = '<div class="galleryImg photo" data-id="' + maxNum +
|
||||
'" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[' +
|
||||
maxNum + ']" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[' + maxNum +
|
||||
']"><span class=""></span></div>';
|
||||
$(".batchImg").append(html);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$(".oneImg").on("tap", '#goods', function() {
|
||||
// UP.init("accountBookImg", "test", "accountBookImgTag")
|
||||
|
||||
UP.init("goodsImg", "test", "goods")
|
||||
openCamera(function(t, status, fileName, serverName) {
|
||||
var html = '<img src="' + serverName + '" class="ossfile" data-src="' + fileName +
|
||||
'" id="goods" alt=""><input type="hidden" value="' + fileName +
|
||||
'" class="goodsImg inp" id="goodsImg"><span class=""></span>';
|
||||
|
||||
$(".goods").html(html);
|
||||
|
||||
})
|
||||
})
|
||||
// 删除图片
|
||||
$(".batchImg").on('tap', '.delete', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation()
|
||||
|
||||
// ////console.log(this);
|
||||
var that = $(this)
|
||||
//var idx = that.parent().attr('data-id');
|
||||
//var maxNum = $('.galleryImg').last().attr('data-id'); //$('.batchImg').children('.galleryImg').length - 1;
|
||||
if (confirm('确认删除图片?')) {
|
||||
that.parent().remove()
|
||||
//delete galleryarr[idx];
|
||||
}
|
||||
})
|
||||
//上传图片到七牛;
|
||||
|
||||
var uptoken = '';
|
||||
var rs = send_request();
|
||||
rs = JSON.parse(rs);
|
||||
|
||||
uptoken = rs.token;
|
||||
|
||||
function send_request() {
|
||||
var xmlhttp = null;
|
||||
if (window.XMLHttpRequest) {
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
|
||||
if (xmlhttp != null) {
|
||||
// ////console.log(dir)
|
||||
serverUrl = hyhUrl('oss/qiniu.php');
|
||||
xmlhttp.open("GET", serverUrl, false);
|
||||
xmlhttp.send(null);
|
||||
return xmlhttp.responseText
|
||||
} else {
|
||||
mui.alert("Your browser does not support XMLHTTP.");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 初始化七牛上传的方法
|
||||
function uploadInit() {
|
||||
var btnId = editor.imgMenuId;
|
||||
var containerId = editor.toolbarElemId;
|
||||
var textElemId = editor.textElemId;
|
||||
// 创建上传对象
|
||||
var uploader = Qiniu.uploader({
|
||||
runtimes: 'html5,flash,html4', //上传模式,依次退化
|
||||
browse_button: btnId, //上传选择的点选按钮,**必需**
|
||||
//uptoken_url: rs,
|
||||
//Ajax请求upToken的Url,**强烈建议设置**(服务端提供)
|
||||
uptoken: uptoken,
|
||||
// url: 'http://up-z1.qiniup.com',
|
||||
|
||||
// uptoken : '<Your upload token>',
|
||||
//若未指定uptoken_url,则必须指定 uptoken ,uptoken由其他程序生成
|
||||
// unique_names: true,
|
||||
// 默认 false,key为文件名。若开启该选项,SDK会为每个文件自动生成key(文件名)
|
||||
// save_key: true,
|
||||
// 默认 false。若在服务端生成uptoken的上传策略中指定了 `sava_key`,则开启,SDK在前端将不对key进行任何处理
|
||||
// domain: 'http://7xrjl5.com1.z0.glb.clouddn.com/',
|
||||
// domain:$('#domain').val(),
|
||||
domain: rs.url,
|
||||
|
||||
//bucket 域名,下载资源时用到,**必需**
|
||||
container: containerId, //上传区域DOM ID,默认是browser_button的父元素,
|
||||
max_file_size: '100mb', //最大文件体积限制
|
||||
flash_swf_url: '../js/plupload/Moxie.swf', //引入flash,相对路径
|
||||
filters: {
|
||||
mime_types: [
|
||||
//只允许上传图片文件 (注意,extensions中,逗号后面不要加空格)
|
||||
{
|
||||
title: "图片文件",
|
||||
extensions: "jpg,gif,png,bmp"
|
||||
}
|
||||
]
|
||||
},
|
||||
max_retries: 3, //上传失败最大重试次数
|
||||
dragdrop: true, //开启可拖曳上传
|
||||
drop_element: textElemId, //拖曳上传区域元素的ID,拖曳文件或文件夹后可触发上传
|
||||
chunk_size: '4mb', //分块上传时,每片的体积
|
||||
auto_start: true, //选择文件后自动上传,若关闭需要自己绑定事件触发上传
|
||||
init: {
|
||||
'FilesAdded': function(up, files) {
|
||||
plupload.each(files, function(file) {
|
||||
// 文件添加进队列后,处理相关的事情
|
||||
// printLog('on FilesAdded');
|
||||
});
|
||||
},
|
||||
'BeforeUpload': function(up, file) {
|
||||
// 每个文件上传前,处理相关的事情
|
||||
// printLog('on BeforeUpload');
|
||||
},
|
||||
'UploadProgress': function(up, file) {
|
||||
// 显示进度
|
||||
// printLog('进度 ' + file.percent)
|
||||
},
|
||||
'FileUploaded': function(up, file, info) {
|
||||
// 每个文件上传成功后,处理相关的事情
|
||||
// 其中 info 是文件上传成功后,服务端返回的json,形式如
|
||||
// {
|
||||
// "hash": "Fh8xVqod2MQ1mocfI4S4KpRL6D98",
|
||||
// "key": "gogopher.jpg"
|
||||
// }
|
||||
// printLog(info);
|
||||
// 参考http://developer.qiniu.com/docs/v6/api/overview/up/response/simple-response.html
|
||||
|
||||
var domain = up.getOption('domain');
|
||||
var res = $.parseJSON(info);
|
||||
var sourceLink = domain + res.key; //获取上传成功后的文件的Url
|
||||
// 插入图片到editor
|
||||
editor.cmd.do('insertHtml', '<img src="' + sourceLink + '" style="max-width:100%;"/>')
|
||||
},
|
||||
'Error': function(up, err, errTip) {
|
||||
//上传出错时,处理相关的事情
|
||||
// printLog('on Error');
|
||||
},
|
||||
'UploadComplete': function() {
|
||||
//队列文件处理完毕后,处理相关的事情
|
||||
// printLog('on UploadComplete');
|
||||
}
|
||||
// Key 函数如果有需要自行配置,无特殊需要请注释
|
||||
//,
|
||||
// 'Key': function(up, file) {
|
||||
// // 若想在前端对每个文件的key进行个性化处理,可以配置该函数
|
||||
// // 该配置必须要在 unique_names: false , save_key: false 时才生效
|
||||
// var key = "";
|
||||
// // do something with key here
|
||||
// return key
|
||||
// }
|
||||
}
|
||||
// domain 为七牛空间(bucket)对应的域名,选择某个空间后,可通过"空间设置->基本设置->域名设置"查看获取
|
||||
// uploader 为一个plupload对象,继承了所有plupload的方法,参考http://plupload.com/docs
|
||||
});
|
||||
}
|
||||
uploadInit();
|
||||
// 封装 ////console.log 函数
|
||||
function printLog(title, info) {
|
||||
window.console && console.log(title, info);
|
||||
}
|
||||
})
|
855
static/app2/js/addgoods.js
Executable file
855
static/app2/js/addgoods.js
Executable file
@ -0,0 +1,855 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
$(".pricset_con").hide();
|
||||
|
||||
function escape2Html(str) {
|
||||
var arrEntities = {
|
||||
'lt': '<',
|
||||
'gt': '>',
|
||||
'nbsp': ' ',
|
||||
'amp': '&',
|
||||
'quot': '"'
|
||||
};
|
||||
return str.replace(/&(lt|gt|nbsp|amp|quot);/ig, function(all, i) {
|
||||
return arrEntities[i];
|
||||
});
|
||||
};
|
||||
mui.plusReady(function() {
|
||||
$("#isSale").prop("checked", true);
|
||||
var self = plus.webview.currentWebview();
|
||||
|
||||
var shopId = self.id;
|
||||
var goodsId = self.goodsId;
|
||||
var richText = '';
|
||||
|
||||
var E = window.wangEditor
|
||||
var editor = new E('#goodsDesc')
|
||||
// editor.customConfig.showLinkImg = false // 隐藏“网络图片”tab
|
||||
// editor.customConfig.uploadFileName = 'yourFileName' //给上传的本地图片文件命名的统一名称
|
||||
// editor.customConfig.uploadImgServer = '/upload'; //官方文档上写的是服务器地址,也就是上传图片的方法名
|
||||
|
||||
// 允许上传到七牛云存储
|
||||
editor.customConfig.qiniu = true;
|
||||
editor.customConfig.debug = true;
|
||||
// editor.customConfig.onchange = function (html) {
|
||||
// // 监控变化,同步更新到 textarea
|
||||
// // $text1.val(html)
|
||||
// };
|
||||
editor.create();
|
||||
// 初始化七牛上传
|
||||
|
||||
|
||||
if (goodsId > 0) {
|
||||
$(".title").text("编辑商品")
|
||||
|
||||
JZL.ajax(qlgUrl("app/shops/getGoodsInfo"), {
|
||||
shopId: shopId,
|
||||
goodsId: goodsId
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
var html1 = '';
|
||||
var data = data.data;
|
||||
var i = 0,
|
||||
j = 0;
|
||||
var res = '';
|
||||
var bjSpec = data.isSpec;
|
||||
if (1 == data.isSpec) {
|
||||
$(".pricset_con").show()
|
||||
var id = data.setNameId;
|
||||
|
||||
|
||||
getRecommend(page, pageSize, id)
|
||||
|
||||
JZL.ajax(qlgUrl('app/shops/getGoodsSpecCats'), {
|
||||
shopId: shopId,
|
||||
id: id
|
||||
}, function(data1) {
|
||||
|
||||
if (1 == data1.status) {
|
||||
var that = this
|
||||
var arr = [];
|
||||
var arr2 = {};
|
||||
for (var i = 0; i < data1.data.length; i++) {
|
||||
arr.push(data1.data[i].list);
|
||||
arr2[data1.data[i].catId] = data1.data[i].list;
|
||||
}
|
||||
|
||||
|
||||
var cLength = 0;
|
||||
var catId = 0;
|
||||
var goodsRes = "";
|
||||
if (arr.length > 0) {
|
||||
var calc = calcDescartes(arr);
|
||||
var cIndex = 0,
|
||||
cArr = [];
|
||||
while (true) {
|
||||
if (cIndex >= calc.length) {
|
||||
break;
|
||||
}
|
||||
//区分单规格和多规格
|
||||
if (Array.isArray(calc[cIndex])) {
|
||||
res = calc[cIndex].join(' ');
|
||||
cArr = calc[cIndex];
|
||||
cLength = calc[cIndex].length;
|
||||
} else {
|
||||
res = calc[cIndex];
|
||||
cArr[0] = res;
|
||||
cLength = 1;
|
||||
}
|
||||
for (i = 0; i < cArr.length; i++) {
|
||||
//获取catId
|
||||
|
||||
// console.log(cArr[i]);
|
||||
$.each(arr2, function(ind, val) {
|
||||
//console.log(val);
|
||||
$.each(val, function(index, value) {
|
||||
if (value == cArr[i]) {
|
||||
catId = ind;
|
||||
// console.log(catId);
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
html1 += '<input type="hidden" name="specItemIds[]" id="specItemIds[' + j + '][' + i +
|
||||
']" class="inp" value="0" />' + //属性值id
|
||||
'<input type="hidden" name="specNamesId[]" id="specNamesId[' + j + '][' + i + ']" class="inp" value="' +
|
||||
catId + '" />' + //分类ID
|
||||
'<input type="hidden" name="specItems[]" id="specItems[' + j + '][' + i + ']" class="inp" value="' +
|
||||
cArr[i] + //属性值
|
||||
'" />';
|
||||
}
|
||||
//console.log(j);
|
||||
html1 += '<input type="hidden" name="specIds[]" id="specIds[' + j + ']" class="inp" value="0" />' + //规格表ID 新增传0
|
||||
'<div class="addcon_con shadown_wai"><div class="radio"><input name="defaultId" type="radio" value="' +
|
||||
j + '" /></div><label for="" data-id = "' + j +
|
||||
'" name="showSpecNames[]" class="">' + res +
|
||||
'</label><input type="text" name="specPrice[]" id="specPrice[' + j +
|
||||
']" class="inp label-t" value="" /><input type="text" name="specStock[]" id="specStock[' + j +
|
||||
']" class="inp label-t" value=""/></div>';
|
||||
j++;
|
||||
cIndex++;
|
||||
}
|
||||
|
||||
$('.pricset_con_con').html(html1);
|
||||
//var setNum = 0;
|
||||
|
||||
mui.each(data.spec, function(idx, val) {
|
||||
// console.log(val.names);
|
||||
//if (calc[setNum].length != val.names.length) return false;
|
||||
//setNum++;
|
||||
goodsRes = '';
|
||||
i = 0;
|
||||
mui.each(val.names, function(index, value) {
|
||||
goodsRes += value.itemName + ' '; //hongse 39ma
|
||||
})
|
||||
|
||||
var showSpecNames = $('label[name="showSpecNames[]"]');
|
||||
var specNameArr = [];
|
||||
for (var k = 0; k < showSpecNames.length; k++) {
|
||||
specNameArr[$(showSpecNames[k]).attr('data-id')] = $(showSpecNames[k]).text();
|
||||
}
|
||||
$.each(specNameArr, function(sitem, sval) {
|
||||
if ($.trim(goodsRes) == $.trim(sval)) { //去除空格 不然报错
|
||||
i = 0;
|
||||
mui.each(val.names, function(index, value) {
|
||||
|
||||
document.getElementById('specItemIds[' + +sitem + '][' + i + ']').value = value.itemId //属性值ID 新增传0
|
||||
i++;
|
||||
});
|
||||
document.getElementById('specIds[' + +sitem + ']').value = val.id //规格表ID,新增传0
|
||||
document.getElementById('specPrice[' + +sitem + ']').value = val.specPrice
|
||||
document.getElementById('specStock[' + +sitem + ']').value = val.specStock
|
||||
if (1 == val.isDefault) {
|
||||
|
||||
//checked
|
||||
var inputList = $('input[name=defaultId]')
|
||||
|
||||
|
||||
$.each(inputList, function(index, value) {
|
||||
|
||||
this.previousElementSibling
|
||||
if (sitem == this.value) {
|
||||
this.checked = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
} else if (0 == data.isSpec) {
|
||||
// $('#setNameId').html('<option value="0">选择属性</option>')
|
||||
getRecommend(page, pageSize)
|
||||
}
|
||||
if (1 == data.isSale) {
|
||||
$('#isSale').prop("checked", "checked");
|
||||
}
|
||||
mui.each(data, function(index, element) {
|
||||
if ($('#' + index).attr("type") == "hidden" & $('#' + index).hasClass('inp')) {
|
||||
var imgindex = index.substring(0, index.length - 3);
|
||||
var obj = '#' + imgindex;
|
||||
if ($(obj).is('img')) {
|
||||
$(obj).attr("src", hyhImgUrl(element))
|
||||
$('#' + index).val(element)
|
||||
} else if ($('#' + index).hasClass('gallery')) {
|
||||
var html = '';
|
||||
if (element.length > 0) {
|
||||
var imgurls = element.split(",") ? imgurls = element.split(",") : imgurls = element;
|
||||
html = ''
|
||||
for (var i = 0; i < imgurls.length; i++) {
|
||||
html += '<div data-id="' + i +
|
||||
'" data-src="" class="galleryImg photo"><div class="delete"><img src="../img/close.png" alt=""></div><img src=' +
|
||||
hyhImgUrl(imgurls[i]) + ' class="ossfile" id="galleryImg[' + i +
|
||||
']" alt=""><input type="hidden" value="' + imgurls[i] +
|
||||
'" name="gallery[]" class="gallery" id="gallery[' + i + ']"><span class=""></span></div>'
|
||||
// $('#' + index+'Img['+i+']').val(hyhImgUrl(imgurls[i]))
|
||||
}
|
||||
var maxNum = +$('.galleryImg').last().attr('data-id') + 1; //$('.batchImg').children('.galleryImg').length - 1;
|
||||
html += '<div class="galleryImg photo" data-id="' + maxNum +
|
||||
'" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[' +
|
||||
maxNum + ']" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[' +
|
||||
maxNum +
|
||||
']"><span class=""></span></div>';
|
||||
$(".batchImg").html(html)
|
||||
} else {
|
||||
html = "";
|
||||
html =
|
||||
'<div class="galleryImg photo" data-id="0" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[0]" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[0]"><span class=""></span></div>';
|
||||
$(".batchImg").html(html)
|
||||
}
|
||||
}
|
||||
} else if (index == 'goodsCatIdPath') {
|
||||
// data.goodsCatIdPath 三级目录
|
||||
var goodsCatIdPathArr = [];
|
||||
var pathArr = ["largeCat", "mediumCat", "smallCat"]
|
||||
//console.log(data.goodsCatIdPath);
|
||||
goodsCatIdPathArr = data.goodsCatIdPath.split('_')
|
||||
goodsCatIdPathArr.pop() //移除最后一个数组元素 _
|
||||
mui.each(pathArr, function(idx, ele) {
|
||||
//console.log(idx);
|
||||
switch (ele) {
|
||||
case 'largeCat':
|
||||
getCatIdPathName(goodsCatIdPathArr[0], function(data) {
|
||||
getGoodsCats('largeCat', 0, goodsCatIdPathArr[0]);
|
||||
})
|
||||
break;
|
||||
case 'mediumCat':
|
||||
getCatIdPathName(goodsCatIdPathArr[1], function(data) {
|
||||
$('#mediumCat').html('<option selected value="' + goodsCatIdPathArr[1] + '">' + data.data.catName +
|
||||
'</option>')
|
||||
});
|
||||
break;
|
||||
case 'smallCat':
|
||||
getCatIdPathName(goodsCatIdPathArr[2], function(data) {
|
||||
$('#smallCat').html('<option selected value="' + goodsCatIdPathArr[2] + '">' + data.data.catName +
|
||||
'</option>')
|
||||
});
|
||||
break;
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
$('#' + index).val(element)
|
||||
}
|
||||
})
|
||||
if ('' != data.goodsDesc) {
|
||||
var Desc = escape2Html(data.goodsDesc)
|
||||
editor.txt.html(Desc)
|
||||
}
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
getGoodsCats("largeCat", 0)
|
||||
getRecommend(page, pageSize);
|
||||
$(".title").text("添加商品")
|
||||
}
|
||||
function getCatIdPathName(catId, callback) {
|
||||
JZL.ajax(qlgUrl("app/goodscats/getCatName"), {
|
||||
catId: catId
|
||||
}, function(data) {
|
||||
callback(data);
|
||||
})
|
||||
}
|
||||
|
||||
//获取商品总规格列表
|
||||
var page = 1;
|
||||
var pageSize = 100;
|
||||
var isjiazai = 1;
|
||||
function getRecommend(page, pageSize, defaultVal) {
|
||||
var recommenddata = {
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 100
|
||||
}
|
||||
recommenddata.shopId = shopId
|
||||
if (isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/shops/getSpecs'), recommenddata, function(data) {
|
||||
|
||||
|
||||
// ////console.log(data);
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="0">无规格属性</option>';
|
||||
if (typeof(defaultVal) == "undefined") {
|
||||
// ////console.log(1);
|
||||
$.each(data.Rows, function() {
|
||||
html += '<option value= "' + this.id + '" data-id="' + this.id + ' ">' + this.setName + '</option>'
|
||||
});
|
||||
if (page == 1) {
|
||||
$('#setNameId').html(html);
|
||||
|
||||
} else {
|
||||
$('#setNameId').append(html);
|
||||
|
||||
}
|
||||
} else {
|
||||
// ////console.log(defaultVal);
|
||||
$.each(data.Rows, function() {
|
||||
if (this.id == defaultVal) {
|
||||
selected = 'selected';
|
||||
} else {
|
||||
selected = '';
|
||||
}
|
||||
html += '<option data-id="' + this.id + '" value="' + this.id + '" ' + selected + '>' + this.setName +
|
||||
'</option>';
|
||||
|
||||
});
|
||||
if (page == 1) {
|
||||
$('#setNameId').html(html);
|
||||
|
||||
} else {
|
||||
$('#setNameId').append(html);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
mui.alert(data.msg);
|
||||
// location.reload();
|
||||
}
|
||||
isjiazai = 1;
|
||||
})
|
||||
}
|
||||
|
||||
//获取商品规格
|
||||
//笛卡尔积
|
||||
function calcDescartes(array) {
|
||||
if (array.length < 2) return array[0] || [];
|
||||
return [].reduce.call(array, function(col, set) {
|
||||
var res = [];
|
||||
col.forEach(function(c) {
|
||||
set.forEach(function(s) {
|
||||
var t = [].concat(Array.isArray(c) ? c : [c]);
|
||||
t.push(s);
|
||||
res.push(t);
|
||||
})
|
||||
});
|
||||
return res;
|
||||
});
|
||||
}
|
||||
// 笛卡尔积
|
||||
// combins = function(args) {
|
||||
//
|
||||
// if (args.length < 2) return args[0] || [];
|
||||
// // if (arguments.length < 2) return arguments[0] || [];
|
||||
// //var args = Array.prototype.slice.call(arguments);
|
||||
// var that = {
|
||||
// index: 0,
|
||||
// nth: function(n) {
|
||||
// var result = [],
|
||||
// d = 0;
|
||||
// for (; d < this.dim; d++) {
|
||||
// var l = this[d].length;
|
||||
// var i = n % l;
|
||||
// result.push(this[d][i]);
|
||||
// n -= i;
|
||||
// n /= l;
|
||||
// }
|
||||
// return result;
|
||||
// },
|
||||
// next: function() {
|
||||
// if (this.index >= size) return;
|
||||
// var result = this.nth(this.index);
|
||||
// this.index++;
|
||||
// return result;
|
||||
// }
|
||||
// };
|
||||
// var size = 1;
|
||||
// for (var i = 0; i < args.length; i++) {
|
||||
// size = size * args[i].length;
|
||||
// that[i] = args[i];
|
||||
// }
|
||||
// that.size = size;
|
||||
// that.dim = args.length;
|
||||
// return that;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
$('#setNameId').change(function() {
|
||||
var id = $('#setNameId option:selected').attr('data-id')
|
||||
// ////console.log(id);
|
||||
|
||||
var html1 = "";
|
||||
if (typeof id == "undefined" || 0 == id) {
|
||||
$(".pricset_con").hide()
|
||||
} else {
|
||||
$(".pricset_con").show()
|
||||
JZL.ajax(qlgUrl('app/shops/getGoodsSpecCats'), {
|
||||
shopId: shopId,
|
||||
id: id
|
||||
}, function(data) {
|
||||
// ////console.log(data);
|
||||
if (1 == data.status) {
|
||||
html1 = "";
|
||||
var arr = [];
|
||||
var arr2 = {};
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
arr.push(data.data[i].list);
|
||||
arr2[data.data[i].catId] = data.data[i].list;
|
||||
}
|
||||
var calc = calcDescartes(arr);
|
||||
var cIndex = 0;
|
||||
var i = 0,
|
||||
j = 0,
|
||||
cArr = [];
|
||||
while (true) {
|
||||
if (cIndex >= calc.length) {
|
||||
break;
|
||||
}
|
||||
//区分单规格和多规格
|
||||
if (Array.isArray(calc[cIndex])) {
|
||||
res = calc[cIndex].join(' ');
|
||||
cArr = calc[cIndex];
|
||||
cLength = calc[cIndex].length;
|
||||
} else {
|
||||
res = calc[cIndex];
|
||||
cArr[0] = res;
|
||||
cLength = 1;
|
||||
}
|
||||
for (i = 0; i < cArr.length; i++) {
|
||||
//获取catId
|
||||
|
||||
// console.log(cArr[i]);
|
||||
$.each(arr2, function(ind, val) {
|
||||
//console.log(val);
|
||||
$.each(val, function(index, value) {
|
||||
if (value == cArr[i]) {
|
||||
catId = ind;
|
||||
// console.log(catId);
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
html1 += '<input type="hidden" name="specItemIds[]" id="specItemIds[' + j + '][' + i +
|
||||
']" class="inp" value="0" />' + //属性值id
|
||||
'<input type="hidden" name="specNamesId[]" id="specNamesId[' + j + '][' + i + ']" class="inp" value="' +
|
||||
catId + '" />' + //分类ID
|
||||
'<input type="hidden" name="specItems[]" id="specItems[' + j + '][' + i + ']" class="inp" value="' + cArr[
|
||||
i] + //属性值
|
||||
'" />';
|
||||
}
|
||||
//console.log(j);
|
||||
html1 += '<input type="hidden" name="specIds[]" id="specIds[' + j + ']" class="inp" value="0" />' + //规格表ID 新增传0
|
||||
'<div class="addcon_con shadown_wai"><div class="radio"><input name="defaultId" type="radio" value="' + j +
|
||||
'" /></div><label for="" data-id = "' + j +
|
||||
'" name="showSpecNames[]" class="">' + res +
|
||||
'</label><input type="text" name="specPrice[]" id="specPrice[' + j +
|
||||
']" class="inp label-t" value="" /><input type="text" name="specStock[]" id="specStock[' + j +
|
||||
']" class="inp label-t" value=""/></div>';
|
||||
j++;
|
||||
cIndex++;
|
||||
}
|
||||
|
||||
$('.pricset_con_con').html(html1);
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// 下一页
|
||||
var check = true;
|
||||
mui("body").on('tap', '.next_btn', function() {
|
||||
check = true;
|
||||
$('.isemptyinp').each(function() {
|
||||
if (!this.value || "" == $.trim(this.value)) {
|
||||
var label = this.previousElementSibling;
|
||||
mui.alert(label.innerText + "不允许为空")
|
||||
check = false;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if ($("#shopPrice").val() == "" & $("#setNameId option:selected").val() == "0" & check == true) {
|
||||
mui.alert("商品没有属性必须输入商品价格")
|
||||
check = false;
|
||||
return false;
|
||||
}
|
||||
if ($("#setNameId option:selected").val() != 0 && check == true) {
|
||||
|
||||
if ($('input[name="defaultId"]:checked').length == 0) {
|
||||
mui.alert("请选择默认规格")
|
||||
check = false;
|
||||
return false
|
||||
}
|
||||
$('.pricset_con_con input').each(function() {
|
||||
if ((!$(this).val() || "" == $.trim(this.value))) {
|
||||
|
||||
|
||||
mui.alert("请输入数据")
|
||||
$(this).focus();
|
||||
check = false;
|
||||
return false;
|
||||
}
|
||||
})
|
||||
}
|
||||
// var shopPrice= $('input[name="defaultId"]:checked').parent().parent().find('input[name="specPrice[]"]').val();
|
||||
// ////console.log(shopPrice)
|
||||
if ($("#isSale").prop("checked")) {
|
||||
isSale = "1";
|
||||
} else {
|
||||
isSale = "0";
|
||||
}
|
||||
if (check == true) {
|
||||
$(".addcon").css("display", "none")
|
||||
$(".pre").css("display", "block");
|
||||
backTop();
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
//预览
|
||||
$('.prelook').hide();
|
||||
// mui("body").on('tap', '.prelook', function() {
|
||||
//
|
||||
//
|
||||
//
|
||||
// })
|
||||
// 上一页
|
||||
mui('body').on('tap', '.pre_btn', function() {
|
||||
$(".addcon").css("display", "block")
|
||||
$(".pre").css("display", "none")
|
||||
})
|
||||
// ////console.log($("#goodsDesc").text());
|
||||
|
||||
//提交
|
||||
// 判断是否上架
|
||||
var isSale = "",
|
||||
setNameId,
|
||||
isSpec;
|
||||
//提交
|
||||
var click = false;
|
||||
mui('.btn').on('tap', '.submit_btn ', function() {
|
||||
// if (click == true) return;
|
||||
richText = editor.txt.text()
|
||||
// 判断有没有商品属性
|
||||
if ($("#setNameId option:selected").val() != 0) {
|
||||
isSpec = 1;
|
||||
} else {
|
||||
isSpec = 0;
|
||||
}
|
||||
if (click == true) return;
|
||||
if ($("#isSale").prop("checked")) {
|
||||
isSale = "1";
|
||||
} else {
|
||||
isSale = "0";
|
||||
}
|
||||
var imgs = '';
|
||||
var data = $('input[name="gallery[]"]');
|
||||
$.each(data, function() {
|
||||
if ('' != $(this).val())
|
||||
imgs = $(this).val() + ',' + imgs;
|
||||
|
||||
})
|
||||
|
||||
|
||||
imgs = imgs.substring(0, imgs.lastIndexOf(','));
|
||||
|
||||
|
||||
$('#gallery').val(imgs);
|
||||
//默认选中
|
||||
var defaultPrice = $('input[name="defaultId"]:checked').parent().parent().find('input[name="specPrice[]"]').val();
|
||||
var params = JZL.getParams(".inp");
|
||||
params.shopId = shopId;
|
||||
params.isSale = isSale;
|
||||
params.isSpec = isSpec;
|
||||
params.defaultId = $('input[name="defaultId"]:checked').val();
|
||||
params.goodsDesc = editor.txt.html();
|
||||
params.setNameId = $('#setNameId option:selected').val()
|
||||
if (isSpec == 1) {
|
||||
// params.shopPrice = shopPrice
|
||||
$('#shopPrice').val(defaultPrice);
|
||||
|
||||
}
|
||||
params.shopPrice = $('#shopPrice').val()
|
||||
click = true;
|
||||
if (goodsId > 0) {
|
||||
params.goodsId = goodsId;
|
||||
|
||||
}
|
||||
|
||||
JZL.ajax(qlgUrl('app/shops/addGoods'), params, function(data) {
|
||||
|
||||
if (data.status == 1) {
|
||||
click = false;
|
||||
mui.toast(data.msg);
|
||||
mui.back();
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
//获取类目
|
||||
$('.selectarea').on("change", ".area", function() {
|
||||
var objs = ['largeCat', 'mediumCat', 'smallCat'];
|
||||
// var areaStr = ['请选择', '请选择', '请选择'];
|
||||
var level = +$(this).attr('data-level') + 1; //0
|
||||
pid = $('#' + objs[level - 1] + ' option:selected').val();
|
||||
getGoodsCats(objs[level], pid);
|
||||
|
||||
})
|
||||
|
||||
//三级类目
|
||||
function getGoodsCats(obj, pid, defaultId) {
|
||||
JZL.ajax(qlgUrl('app/shops/getGoodsCats'), {
|
||||
pid: pid
|
||||
},
|
||||
function(data) {
|
||||
// ////console.log(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="">' + "请选择" + '</option>';
|
||||
if ('undefined' == typeof(defaultId)) {
|
||||
$.each(data, function() {
|
||||
// ////console.log(this);
|
||||
html += '<option value="' + this.catId + '">' + this.catName + '</option>'
|
||||
});
|
||||
} else {
|
||||
$.each(data, function() {
|
||||
if (this.catId == defaultId) {
|
||||
selected = 'selected';
|
||||
} else {
|
||||
selected = '';
|
||||
}
|
||||
html += '<option value="' + this.catId + '" ' + selected + '>' + this.catName + '</option>'
|
||||
});
|
||||
}
|
||||
$('#' + obj).html(html);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
$(".batchImg").on("tap", '.galleryImg', function() {
|
||||
var num = $(this).attr('data-id');
|
||||
UP.init("gallery[" + num + "]", "test", "galleryImg[" + num + "]", 1);
|
||||
var that = $(this);
|
||||
openCamera(function(t, status, fileName, serverName) {
|
||||
var html = '<div class="delete" data-id="' + num + '"><img src="../img/close.png" alt=""></div><img src="' +
|
||||
serverName + '" class="ossfile" data-src="' + fileName + '" data-id="' + num + '" id="galleryImg[' + num +
|
||||
']" alt=""><input type="hidden" name="gallery[]" value="' + fileName +
|
||||
'" class="gallery" id="gallery[' + num + ']"><span class=""></span>';
|
||||
|
||||
|
||||
that.html(html);
|
||||
|
||||
|
||||
var maxNum = $('.galleryImg').last().attr('data-id'); //$('.batchImg').children('.galleryImg').length - 1;
|
||||
if (num == maxNum) {
|
||||
maxNum++;
|
||||
html = '<div class="galleryImg photo" data-id="' + maxNum +
|
||||
'" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[' +
|
||||
maxNum + ']" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[' + maxNum +
|
||||
']"><span class=""></span></div>';
|
||||
$(".batchImg").append(html);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$(".oneImg").on("tap", '#goods', function() {
|
||||
|
||||
|
||||
UP.init("goodsImg", "test", "goods")
|
||||
openCamera(function(t, status, fileName, serverName) {
|
||||
var html = '<img src="' + serverName + '" class="ossfile" data-src="' + fileName +
|
||||
'" id="goods" alt=""><input type="hidden" value="' + fileName +
|
||||
'" class="goodsImg inp" id="goodsImg"><span class=""></span>';
|
||||
|
||||
$(".goods").html(html);
|
||||
|
||||
})
|
||||
})
|
||||
// 删除图片
|
||||
$(".batchImg").on('tap', '.delete', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation()
|
||||
|
||||
|
||||
var that = $(this)
|
||||
|
||||
if (confirm('确认删除图片?')) {
|
||||
that.parent().remove()
|
||||
|
||||
}
|
||||
})
|
||||
//上传图片到七牛;
|
||||
|
||||
var uptoken = '';
|
||||
var rs = send_request();
|
||||
rs = JSON.parse(rs);
|
||||
|
||||
uptoken = rs.token;
|
||||
|
||||
function send_request() {
|
||||
var xmlhttp = null;
|
||||
if (window.XMLHttpRequest) {
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
|
||||
if (xmlhttp != null) {
|
||||
|
||||
serverUrl = hyhUrl('oss/qiniu.php');
|
||||
xmlhttp.open("GET", serverUrl, false);
|
||||
xmlhttp.send(null);
|
||||
return xmlhttp.responseText
|
||||
} else {
|
||||
mui.alert("Your browser does not support XMLHTTP.");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// 初始化七牛上传的方法
|
||||
function uploadInit() {
|
||||
var btnId = editor.imgMenuId;
|
||||
var containerId = editor.toolbarElemId;
|
||||
var textElemId = editor.textElemId;
|
||||
// 创建上传对象
|
||||
var uploader = Qiniu.uploader({
|
||||
runtimes: 'html5,flash,html4', //上传模式,依次退化
|
||||
browse_button: btnId, //上传选择的点选按钮,**必需**
|
||||
//uptoken_url: rs,
|
||||
//Ajax请求upToken的Url,**强烈建议设置**(服务端提供)
|
||||
uptoken: uptoken,
|
||||
// url: 'http://up-z1.qiniup.com',
|
||||
|
||||
// uptoken : '<Your upload token>',
|
||||
//若未指定uptoken_url,则必须指定 uptoken ,uptoken由其他程序生成
|
||||
// unique_names: true,
|
||||
// 默认 false,key为文件名。若开启该选项,SDK会为每个文件自动生成key(文件名)
|
||||
// save_key: true,
|
||||
// 默认 false。若在服务端生成uptoken的上传策略中指定了 `sava_key`,则开启,SDK在前端将不对key进行任何处理
|
||||
// domain: 'http://7xrjl5.com1.z0.glb.clouddn.com/',
|
||||
// domain:$('#domain').val(),
|
||||
domain: rs.url,
|
||||
|
||||
//bucket 域名,下载资源时用到,**必需**
|
||||
container: containerId, //上传区域DOM ID,默认是browser_button的父元素,
|
||||
max_file_size: '100mb', //最大文件体积限制
|
||||
flash_swf_url: '../js/plupload/Moxie.swf', //引入flash,相对路径
|
||||
filters: {
|
||||
mime_types: [
|
||||
//只允许上传图片文件 (注意,extensions中,逗号后面不要加空格)
|
||||
{
|
||||
title: "图片文件",
|
||||
extensions: "jpg,gif,png,bmp"
|
||||
}
|
||||
]
|
||||
},
|
||||
max_retries: 3, //上传失败最大重试次数
|
||||
dragdrop: true, //开启可拖曳上传
|
||||
drop_element: textElemId, //拖曳上传区域元素的ID,拖曳文件或文件夹后可触发上传
|
||||
chunk_size: '4mb', //分块上传时,每片的体积
|
||||
auto_start: true, //选择文件后自动上传,若关闭需要自己绑定事件触发上传
|
||||
init: {
|
||||
'FilesAdded': function(up, files) {
|
||||
plupload.each(files, function(file) {
|
||||
// 文件添加进队列后,处理相关的事情
|
||||
// printLog('on FilesAdded');
|
||||
});
|
||||
},
|
||||
'BeforeUpload': function(up, file) {
|
||||
// 每个文件上传前,处理相关的事情
|
||||
// printLog('on BeforeUpload');
|
||||
},
|
||||
'UploadProgress': function(up, file) {
|
||||
// 显示进度
|
||||
// printLog('进度 ' + file.percent)
|
||||
},
|
||||
'FileUploaded': function(up, file, info) {
|
||||
// 每个文件上传成功后,处理相关的事情
|
||||
// 其中 info 是文件上传成功后,服务端返回的json,形式如
|
||||
// {
|
||||
// "hash": "Fh8xVqod2MQ1mocfI4S4KpRL6D98",
|
||||
// "key": "gogopher.jpg"
|
||||
// }
|
||||
// printLog(info);
|
||||
// 参考http://developer.qiniu.com/docs/v6/api/overview/up/response/simple-response.html
|
||||
|
||||
var domain = up.getOption('domain');
|
||||
var res = $.parseJSON(info);
|
||||
var sourceLink = domain + res.key; //获取上传成功后的文件的Url
|
||||
// 插入图片到editor
|
||||
editor.cmd.do('insertHtml', '<img src="' + sourceLink + '" style="max-width:100%;"/>')
|
||||
},
|
||||
'Error': function(up, err, errTip) {
|
||||
//上传出错时,处理相关的事情
|
||||
// printLog('on Error');
|
||||
},
|
||||
'UploadComplete': function() {
|
||||
//队列文件处理完毕后,处理相关的事情
|
||||
// printLog('on UploadComplete');
|
||||
}
|
||||
// Key 函数如果有需要自行配置,无特殊需要请注释
|
||||
//,
|
||||
// 'Key': function(up, file) {
|
||||
// // 若想在前端对每个文件的key进行个性化处理,可以配置该函数
|
||||
// // 该配置必须要在 unique_names: false , save_key: false 时才生效
|
||||
// var key = "";
|
||||
// // do something with key here
|
||||
// return key
|
||||
// }
|
||||
}
|
||||
// domain 为七牛空间(bucket)对应的域名,选择某个空间后,可通过"空间设置->基本设置->域名设置"查看获取
|
||||
// uploader 为一个plupload对象,继承了所有plupload的方法,参考http://plupload.com/docs
|
||||
});
|
||||
}
|
||||
uploadInit();
|
||||
// 封装 ////console.log 函数
|
||||
function printLog(title, info) {
|
||||
window.console && console.log(title, info);
|
||||
}
|
||||
})
|
174
static/app2/js/addhhrrz.js
Executable file
174
static/app2/js/addhhrrz.js
Executable file
@ -0,0 +1,174 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
var hhrrzid = self.id ? self.id : 0;
|
||||
//console.log(hhrrzid);
|
||||
if (hhrrzid > 0) {
|
||||
$('.header .title').html("编辑合伙人认证信息")
|
||||
$('#home_zhezhao').hide();
|
||||
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthFamilyPersonalInfo'), {
|
||||
id: hhrrzid
|
||||
}, function(data) {
|
||||
// //console.log(data);
|
||||
if (data.status == 1) {
|
||||
var data = data.data
|
||||
$('#userName').val(data.familyName);
|
||||
$('#cardId').val(data.familyIdCard);
|
||||
$('#familyRelations').val(data.familyRelations);
|
||||
// var html='<img data-src="' +data.familyRelationsImg + '" src="' + hyhImgUrl(data.familyRelationsImg)+ '" />';
|
||||
$("#familyRelationsImg").val(data.familyRelationsImg)
|
||||
$("#idCardFrontImg").val(data.idCardFrontImg)
|
||||
$("#idCardBackImg").val(data.idCardBackImg)
|
||||
|
||||
$("#familyRelationsimg").attr("src", hyhImgUrl(data.familyRelationsImg))
|
||||
$("#idCardBack").attr("src", hyhImgUrl(data.idCardBackImg))
|
||||
|
||||
$("#idCardFront").attr("src", hyhImgUrl(data.idCardFrontImg))
|
||||
}else{
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$('.header .title').html("添加合伙人认证信息")
|
||||
}
|
||||
|
||||
$('.lxy_home_zz ul').on('tap', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation()
|
||||
})
|
||||
var wait = 120;
|
||||
|
||||
function time() {
|
||||
if (wait == 0) {
|
||||
$('.HQYZM').removeAttr("disabled");
|
||||
$('.HQYZM').val("重新发送");
|
||||
wait = 120;
|
||||
} else {
|
||||
$('.HQYZM').attr("disabled", true);
|
||||
$('.HQYZM').val("重新发送(" + wait + ")");
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
time()
|
||||
},
|
||||
1000)
|
||||
}
|
||||
}
|
||||
mui('.lxy_home_zz ul').on('tap', '.HQYZM', function() {
|
||||
var pargams = {}
|
||||
pargams.userPhone = $('#indiv-tel').val();
|
||||
if ('' == pargams.userPhone) {
|
||||
mui.alert('手机号不能为空!');
|
||||
return;
|
||||
}
|
||||
if (!(
|
||||
/^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/
|
||||
.test(pargams.userPhone))) {
|
||||
mui.alert("手机号码有误,请重填!");
|
||||
return;
|
||||
}
|
||||
|
||||
JZL.ajax(qlgUrl('app/auth/getPartnerPhoneCode'), pargams, function(data) {
|
||||
data = toJson(data);
|
||||
//console.log(data)
|
||||
if (data.status == 1) {
|
||||
telephoneNo = pargams.userPhone;
|
||||
time();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
});
|
||||
})
|
||||
var click = 0;
|
||||
|
||||
mui('.lxy_home_zz ul').on('tap', '.lxy_zz_btn', function() {
|
||||
if (1 == click) return
|
||||
click = 1
|
||||
var pargams = {}
|
||||
pargams.userPhone = $('#indiv-tel').val();
|
||||
pargams.mobileCode = $('.YZM').val();
|
||||
if ('' == pargams.mobileCode) {
|
||||
mui.alert('请输入验证码!');
|
||||
return;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthInfoByMobile'), {
|
||||
mobileCode: pargams.mobileCode
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
var data = data.data;
|
||||
$('#home_zhezhao').hide();
|
||||
|
||||
$('#familyName').val(data.uName);
|
||||
$('#familyIdCard').val(data.idCard);
|
||||
}else{
|
||||
mui.alert (data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
$(".photos_con").on("tap", '.business', function() {
|
||||
UP.init("businessImg", "test", "business")
|
||||
openCamera();
|
||||
})
|
||||
$(".photos_con").on("tap", '.idCardFront', function() {
|
||||
UP.init("idCardFrontImg", "test", "idCardFront")
|
||||
openCamera();
|
||||
})
|
||||
$(".photos_con").on("tap", '.idCardBack', function() {
|
||||
UP.init("idCardBackImg", "test", "idCardBack")
|
||||
openCamera();
|
||||
})
|
||||
|
||||
|
||||
var bcclick = 0
|
||||
$(".bc_btn").on('tap',function() {
|
||||
if (bcclick == 1) return;
|
||||
bcclick = 1;
|
||||
var pargams = JZL.getParams('.inp');
|
||||
pargams.id = hhrrzid
|
||||
|
||||
if (pargams.positionName == '') {
|
||||
mui.alert('职位名不能为空!');
|
||||
return;
|
||||
}
|
||||
if (pargams.stake == '') {
|
||||
mui.alert('持股比例不能为空!');
|
||||
return;
|
||||
}
|
||||
if (pargams.businessImg == '') {
|
||||
mui.alert('请上传手持营业执照照!');
|
||||
return;
|
||||
}
|
||||
if (pargams.idCardFrontImg == '') {
|
||||
mui.alert('请上传身份证正面照!');
|
||||
return;
|
||||
}
|
||||
if (pargams.idCardBackImg == '') {
|
||||
mui.alert('请上传身份证反面照!');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
JZL.ajax(qlgUrl('app/auth/setAuthPartner'), pargams, function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data);
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
})
|
84
static/app2/js/addmemorandum.js
Executable file
84
static/app2/js/addmemorandum.js
Executable file
@ -0,0 +1,84 @@
|
||||
mui.plusReady(function () {
|
||||
|
||||
|
||||
var uploader = new plupload.Uploader({
|
||||
runtimes: 'html5,flash,silverlight,html4',
|
||||
browse_button: 'selectfiles',
|
||||
//multi_selection: false,
|
||||
// container: document.getElementById('container'),
|
||||
flash_swf_url: '../lib/plupload-2.1.2/js/Moxie.swf',
|
||||
silverlight_xap_url: '../lib/plupload-2.1.2/js/Moxie.xap',
|
||||
url: 'http://oss.aliyuncs.com',
|
||||
|
||||
filters: {
|
||||
mime_types: [ //只允许上传图片和zip,rar文件
|
||||
{
|
||||
title: "Image files",
|
||||
extensions: "jpg,gif,png,bmp"
|
||||
}
|
||||
],
|
||||
max_file_size: '10mb', //最大只能上传10mb的文件
|
||||
prevent_duplicates: true //不允许选取重复文件
|
||||
},
|
||||
|
||||
init: {
|
||||
PostInit: function() {
|
||||
document.getElementById('ossfile').innerHTML = '';
|
||||
// document.getElementById('postfiles').onclick = function() {
|
||||
// set_upload_param(uploader, '', false);
|
||||
// return false;
|
||||
// };
|
||||
uploader.bind('FilesAdded', function() {
|
||||
set_upload_param(uploader, '', false, 'complains');
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
FilesAdded: function(up, files) {
|
||||
plupload.each(files, function(file) {
|
||||
document.getElementById('ossfile').innerHTML += '<div class="files_out" id="' + file.id + '"><b></b>' +
|
||||
'<div class="progress"><div class="progress-bar" style="width: 60px"></div></div>' +
|
||||
'</div>';
|
||||
});
|
||||
},
|
||||
|
||||
BeforeUpload: function(up, file) {
|
||||
check_object_radio();
|
||||
set_upload_param(up, file.name, true);
|
||||
},
|
||||
|
||||
UploadProgress: function(up, file) {
|
||||
var d = document.getElementById(file.id);
|
||||
d.getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
|
||||
var prog = d.getElementsByTagName('div')[0];
|
||||
var progBar = prog.getElementsByTagName('div')[0]
|
||||
progBar.style.width = 2 * file.percent + 'px';
|
||||
progBar.setAttribute('aria-valuenow', file.percent);
|
||||
},
|
||||
|
||||
FileUploaded: function(up, file, info) {
|
||||
if (info.status == 200) {
|
||||
console.log(get_uploaded_object_name (file.name));
|
||||
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<img data-src="' +
|
||||
get_uploaded_object_name(file.name) + '" src="' + hyhImgUrl(get_uploaded_object_name(file.name)) + '" />';
|
||||
} else {
|
||||
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = info.response;
|
||||
}
|
||||
},
|
||||
|
||||
Error: function(up, err) {
|
||||
if (err.code == -600) {
|
||||
mui.alert("\n选择的文件太大了");
|
||||
} else if (err.code == -601) {
|
||||
mui.alert("\n选择的文件后缀不对");
|
||||
} else if (err.code == -602) {
|
||||
mui.alert("\n这个文件已经上传过一遍了");
|
||||
} else {
|
||||
mui.alert("\nError xml:" + err.response);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
uploader.init();
|
||||
})
|
125
static/app2/js/addproperties.js
Executable file
125
static/app2/js/addproperties.js
Executable file
@ -0,0 +1,125 @@
|
||||
mui.plusReady(function() {
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
var self = plus.webview.currentWebview();
|
||||
//console.log(self);
|
||||
var shopId = self.id;
|
||||
var specCatsId = self.specCatsId ? self.specCatsId : 0;
|
||||
var setName = self.setName ? self.setName : 0;
|
||||
var index = 0;
|
||||
//console.log(shopId,specCatsId,setName);
|
||||
if (specCatsId > 0) {
|
||||
$(".title").html("编辑产品规格属性")
|
||||
JZL.ajax(qlgUrl("app/shops/getSpecCats"), {
|
||||
id: specCatsId,
|
||||
shopId: shopId
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
$("#setName").val(setName)
|
||||
//var specNames = $('input[name="specNames[]"]');
|
||||
//var specItems = $('input[name="specItems[]"]');//
|
||||
var html = '';
|
||||
$.each(data.data, function(i, v) {
|
||||
|
||||
html +=
|
||||
'<div class="row shadown_wai "><label>属性名称</label><input type="text" name="specNames[]" id="specNames[' + i +
|
||||
']" class="inp" value="' + this.catName +
|
||||
'" /></div><div class="row shadown_wai "><label>可选值列表</label><input type="text" name="specItems[]" id="specItems[' +
|
||||
i + ']" class="inp" value="' + this.itemNames +
|
||||
'" placeholder="输入多项请用英文逗号分隔" /></div><input type="hidden" id="specNamesId[' + i + ']" class="inp" value="' +
|
||||
this.catId + '" /><input type="hidden" id="specItemsId[' + i + ']" class="inp" value="' + this.itemId +
|
||||
'" />'
|
||||
})
|
||||
|
||||
$('.con_con').append(html);
|
||||
|
||||
// $(specNames[i]).val(data.data[i].catName)
|
||||
// $(specItems[i]).val(data.data[i].itemNames)
|
||||
// }
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
} else {
|
||||
$(".title").html("添加产品规格属性")
|
||||
|
||||
var html = '';
|
||||
html = '<div class="row shadown_wai "><label>属性名称</label><input type="text" name="specNames[]" id="specNames[' +
|
||||
index +
|
||||
']" class="inp" value="" /></div><div class="row shadown_wai "><label>可选值列表</label><input type="text" name="specItems[]" id="specItems[' +
|
||||
index +
|
||||
']" class="inp" value="" placeholder="输入多项请用英文逗号分隔" /></div><input type="hidden" id="specNamesId[0]" class="inp" value="0" /><input type="hidden" id="specItemsId[0]" class="inp" value="0" />'
|
||||
index++
|
||||
$('.con_con').append(html);
|
||||
|
||||
}
|
||||
|
||||
mui('body').on('tap', '.add1', function() {
|
||||
var html = '';
|
||||
html += '<div class="row shadown_wai "><label>属性名称</label><input type="text" name="specNames[]" id="specNames[' + index +
|
||||
']" class="inp" value="" /></div><div class="row shadown_wai "><label>可选值列表</label><input type="text" name="specItems[]" id="specItems[' +
|
||||
index + ']" class="inp" value="" /></div><input type="hidden" id="specNamesId[' + index +
|
||||
']" class="inp" value="0" /><input type="hidden" id="specItemsId[' + index + ']" class="inp" value="0" />'
|
||||
$('.con_con').append(html);
|
||||
index++;
|
||||
})
|
||||
var click = false;
|
||||
mui('body').on('tap', '.bc_btn', function() {
|
||||
//if (true == click) return;
|
||||
click = true;
|
||||
var length = $('input[name="specNames[]"]').length;
|
||||
var specName,specItem;
|
||||
for (var i = 0; i < length; i++) {
|
||||
specName = document.getElementById('specNames[' + +i + ']');
|
||||
specItem = document.getElementById('specItems[' + +i + ']');
|
||||
if ('' == specItem.value && '' == specItem.value) {
|
||||
if (specCatsId == 0) {
|
||||
specName.classList.remove("inp");
|
||||
specItem.classList.remove("inp");
|
||||
document.getElementById('specNamesId[' + +i + ']').classList.remove("inp");
|
||||
document.getElementById('specItemsId[' + +i + ']').classList.remove("inp");
|
||||
}
|
||||
} else {
|
||||
if ('' == specName.value) {
|
||||
mui.alert('请输入属性名');
|
||||
specName.focus();
|
||||
return;
|
||||
}
|
||||
if ('' == specItem.value) {
|
||||
specItem.focus();
|
||||
mui.alert('请输入属性值');
|
||||
return;
|
||||
}
|
||||
specItem.value = specItem.value.replace(/,/g, ',');
|
||||
}
|
||||
}
|
||||
var params = JZL.getParams(".inp");
|
||||
// $.each(params,function(i,v){
|
||||
// params[i] = v.replace(/,/g, ',');
|
||||
// })
|
||||
params.shopId = shopId;
|
||||
if (specCatsId > 0) {
|
||||
params.id = specCatsId;
|
||||
}
|
||||
JZL.ajax(qlgUrl("app/shops/setSpecs"), params, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
mui.toast('添加规格成功');
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
//location.reload();
|
||||
}
|
||||
click = false;
|
||||
})
|
||||
})
|
||||
})
|
89
static/app2/js/addqrbb.js
Executable file
89
static/app2/js/addqrbb.js
Executable file
@ -0,0 +1,89 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
// //console.log(self);
|
||||
var qrbbid = self.id ? self.id : 0;
|
||||
//console.log(qrbbid);//
|
||||
|
||||
if (qrbbid >0) {
|
||||
$('.header .title').html("编辑亲人报备信息")
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthFamilyReportInfo'), {id: qrbbid}, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
var data = data.data
|
||||
$('#familyName').val(data.familyName);
|
||||
$('#familyIdCard').val(data.familyIdCard);
|
||||
$('#familyRelations').val(data.familyRelations);
|
||||
// var html='<img data-src="' +data.familyRelationsImg + '" src="' + hyhImgUrl(data.familyRelationsImg)+ '" />';
|
||||
// $('#ossfile').html(html);
|
||||
$('#familyRelationsImg').val(data.familyRelationsImg)
|
||||
$('#familyRelations1').attr('src',hyhImgUrl(data.familyRelationsImg))
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
})
|
||||
}else{
|
||||
$('.header .title').html("添加亲人报备信息")
|
||||
|
||||
}
|
||||
var click = false;
|
||||
|
||||
$(".bc_btn").on('tap', function() {
|
||||
if(click ==true) return;
|
||||
|
||||
click=true;
|
||||
|
||||
var pargams = JZL.getParams('.inp');
|
||||
if (pargams.familyName == '') {
|
||||
mui.alert('姓名不能为空!');
|
||||
return;
|
||||
}
|
||||
if (pargams.familyIdCard == '') {
|
||||
mui.alert('身份证号不能为空!');
|
||||
return;
|
||||
}
|
||||
if (pargams.familyRelations == '') {
|
||||
mui.alert('与户主关系不能为空!');
|
||||
return;
|
||||
}
|
||||
if (pargams.familyRelationsImg == '') {
|
||||
mui.alert('请上传与户主关系照!');
|
||||
return;
|
||||
}
|
||||
// $('.bc_btn').attr('disabled','disabled');
|
||||
if (qrbbid >0) {
|
||||
//console.log(qrbbid);
|
||||
pargams.id=qrbbid
|
||||
}
|
||||
|
||||
JZL.ajax(qlgUrl('app/auth/setAuthFamilyReport'),pargams,function(data){
|
||||
|
||||
//console.log(data);
|
||||
var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
mui.back();
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
click = false
|
||||
|
||||
})
|
||||
//上传图片
|
||||
$('.renzhengphoto').on('tap','.familyRelations',function () {
|
||||
UP.init("familyRelationsImg", "test", "familyRelations1")
|
||||
openCamera()
|
||||
})
|
||||
|
||||
})
|
||||
|
213
static/app2/js/addqrrz.js
Executable file
213
static/app2/js/addqrrz.js
Executable file
@ -0,0 +1,213 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
var qrrzid = self.id ? self.id : 0;
|
||||
//console.log(qrrzid);
|
||||
if (qrrzid > 0) {
|
||||
$('.header .title').html("编辑亲人认证信息")
|
||||
$('#home_zhezhao').hide();
|
||||
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthFamilyPersonalInfo'), {
|
||||
id: qrrzid
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
var data = data.data
|
||||
$('#userName').val(data.familyName);
|
||||
$('#cardId').val(data.familyIdCard);
|
||||
$('#familyRelations').val(data.familyRelations);
|
||||
// var html='<img data-src="' +data.familyRelationsImg + '" src="' + hyhImgUrl(data.familyRelationsImg)+ '" />';
|
||||
$("#familyRelationsImg").val(data.familyRelationsImg)
|
||||
$("#idCardFrontImg").val(data.idCardFrontImg)
|
||||
$("#idCardBackImg").val(data.idCardBackImg)
|
||||
|
||||
$("#familyRelationsimg").attr("src", hyhImgUrl(data.familyRelationsImg))
|
||||
$("#idCardBack").attr("src", hyhImgUrl(data.idCardBackImg))
|
||||
$("#idCardFront").attr("src", hyhImgUrl(data.idCardFrontImg))
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
var click = false;
|
||||
|
||||
$(".bc_btn").on('tap', function() {
|
||||
if (click == true) return;
|
||||
var pargams = JZL.getParams('.inp');
|
||||
pargams.id = qrrzid
|
||||
if (pargams.familyRelations == '') {
|
||||
mui.alert('与户主关系不能为空!');
|
||||
return;
|
||||
}
|
||||
if (pargams.familyRelationsImg == '') {
|
||||
mui.alert('请上传与户主关系照!');
|
||||
return;
|
||||
}
|
||||
if (pargams.idCardFrontImg == '') {
|
||||
mui.alert('请上传身份证正面照!');
|
||||
return;
|
||||
}
|
||||
if (pargams.idCardBackImg == '') {
|
||||
mui.alert('请上传身份证反面照!');
|
||||
return;
|
||||
}
|
||||
click = true;
|
||||
JZL.ajax(qlgUrl('app/auth/setAuthFamilyPersonal'), pargams, function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data);
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
} else {
|
||||
$('.header .title').html("添加亲人认证信息")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('.lxy_home_zz ul').on('tap', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation()
|
||||
})
|
||||
var wait = 120;
|
||||
|
||||
function time() {
|
||||
if (wait == 0) {
|
||||
$('.HQYZM').removeAttr("disabled");
|
||||
$('.HQYZM').val("重新发送");
|
||||
wait = 120;
|
||||
} else {
|
||||
$('.HQYZM').attr("disabled", true);
|
||||
$('.HQYZM').val("重新发送(" + wait + ")");
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
time()
|
||||
},
|
||||
1000)
|
||||
}
|
||||
}
|
||||
mui('.lxy_home_zz ul').on('tap', '.HQYZM', function() {
|
||||
var pargams = {}
|
||||
pargams.userPhone = $('#indiv-tel').val();
|
||||
if ('' == pargams.userPhone) {
|
||||
mui.alert('手机号不能为空!');
|
||||
return;
|
||||
}
|
||||
if (!(
|
||||
/^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/
|
||||
.test(pargams.userPhone))) {
|
||||
mui.alert("手机号码有误,请重填!");
|
||||
return;
|
||||
}
|
||||
|
||||
JZL.ajax(qlgUrl('app/auth/getFamilyPhoneCode'), pargams, function(data) {
|
||||
data = toJson(data);
|
||||
//console.log(data)
|
||||
if (data.status == 1) {
|
||||
telephoneNo = pargams.userPhone;
|
||||
time();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
});
|
||||
})
|
||||
mui('.lxy_home_zz ul').on('tap', '.lxy_zz_btn', function() {
|
||||
var pargams = {}
|
||||
pargams.userPhone = $('#indiv-tel').val();
|
||||
pargams.mobileCode = $('.YZM').val();
|
||||
if ('' == pargams.mobileCode) {
|
||||
mui.alert('请输入验证码!');
|
||||
return;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthInfoByMobile'), pargams, function(data) {
|
||||
//console.log(data)
|
||||
if (data.status == 1) {
|
||||
var data = data.data;
|
||||
$('#home_zhezhao').hide();
|
||||
$('#userName').val(data.uName);
|
||||
$('#cardId').val(data.idCard);
|
||||
$('#telephone').val(pargams.userPhone);
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
$(".photos_con").on("tap", '.familyRelations', function() {
|
||||
UP.init("familyRelationsImg", "test", "familyRelationsimg")
|
||||
openCamera();
|
||||
})
|
||||
$(".photos_con").on("tap", '.idCardFront', function() {
|
||||
UP.init("idCardFrontImg", "test", "idCardFront")
|
||||
openCamera();
|
||||
})
|
||||
$(".photos_con").on("tap", '.idCardBack', function() {
|
||||
UP.init("idCardBackImg", "test", "idCardBack")
|
||||
openCamera();
|
||||
})
|
||||
|
||||
var click = false;
|
||||
|
||||
$(".bc_btn").on('tap', function() {
|
||||
if (click == true) return;
|
||||
var pargams = JZL.getParams('.inp');
|
||||
|
||||
if (pargams.familyRelations == '') {
|
||||
mui.alert('与户主关系不能为空!');
|
||||
return;
|
||||
}
|
||||
if (pargams.familyRelationsImg == '') {
|
||||
mui.alert('请上传与户主关系照!');
|
||||
return;
|
||||
}
|
||||
if (pargams.idCardFrontImg == '') {
|
||||
mui.alert('请上传身份证正面照!');
|
||||
return;
|
||||
}
|
||||
if (pargams.idCardBackImg == '') {
|
||||
mui.alert('请上传身份证反面照!');
|
||||
return;
|
||||
}
|
||||
// $('.bc_btn').attr('disabled','disabled');
|
||||
click = true;
|
||||
JZL.ajax(qlgUrl('app/auth/setAuthFamilyPersonal'), pargams, function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data);
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
mui.back();
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
})
|
0
static/app2/js/addshopping.js
Executable file
0
static/app2/js/addshopping.js
Executable file
98
static/app2/js/addyhk.js
Executable file
98
static/app2/js/addyhk.js
Executable file
@ -0,0 +1,98 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mui.plusReady(function() {
|
||||
|
||||
$('#_select').on('change', function() {
|
||||
var selectValue = $('#_select option:selected').text(); //选中select的内容
|
||||
// alert("selectValue" + selectValue);
|
||||
|
||||
$("#bankUserName").val(selectValue);
|
||||
})
|
||||
var self = plus.webview.currentWebview();
|
||||
////console.log(self);
|
||||
var yhkid = self.id ? self.id : 0;
|
||||
// //console.log(yhkid);//
|
||||
|
||||
if (yhkid > 0) {
|
||||
$('.header .title').html("编辑银行卡")
|
||||
JZL.ajax(qlgUrl('app/auth/getCompanyBankInfo'), {
|
||||
id: yhkid
|
||||
}, function(data) {
|
||||
////console.log(data);
|
||||
if (data.status == 1) {
|
||||
var data = data.data
|
||||
$('#_select').css("background", "none");
|
||||
$("#bankUserName").val(data.accountName);
|
||||
$('.bankname').prepend('<option value="' + data.bankName + '">' + data.bankName + '</option>');
|
||||
$("#cardnum").val(data.bankNo);
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
})
|
||||
}else{
|
||||
$('.header .title').html("添加银行卡")
|
||||
|
||||
}
|
||||
// 选择银行
|
||||
JZL.ajax(qlgUrl('app/auth/getBankNameList'), {}, function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
////console.log(data)
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="">选择银行</option>';
|
||||
$.each(data, function() {
|
||||
html += '<option value="' + this.bankName + '">' + this.bankName + '</option>'
|
||||
});
|
||||
$('.bankname').append(html);
|
||||
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
//提交
|
||||
var click = false
|
||||
$('.bc_btn').on('tap', function() {
|
||||
if(true == click) return;
|
||||
click =true;
|
||||
var pargams = {};
|
||||
//编辑页面需要加id
|
||||
if (yhkid > 0) {
|
||||
pargams.id = yhkid;
|
||||
}
|
||||
pargams.accountName = $("#bankUserName").val();
|
||||
pargams.bankName = $(".bankname option:selected").text();
|
||||
pargams.bankNo = $("#cardnum").val();
|
||||
if ('' == pargams.accountName) {
|
||||
mui.alert("请输入持卡人姓名")
|
||||
return;
|
||||
}
|
||||
if ('' == pargams.bankNo) {
|
||||
mui.alert("请输入银行卡号")
|
||||
return;
|
||||
}
|
||||
if ('选择银行' == pargams.bankName) {
|
||||
mui.alert("请输入银行名称")
|
||||
return;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/auth/setBank'), pargams, function(data) {
|
||||
data = toJson(data);
|
||||
////console.log(data)
|
||||
if (data.status == 1) {
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
})
|
443
static/app2/js/applicationopen.js
Executable file
443
static/app2/js/applicationopen.js
Executable file
@ -0,0 +1,443 @@
|
||||
mui.plusReady(function() {
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
var shopAddress = "";
|
||||
$('.header_con').append('<p class="header_con_bc">保存</p>')
|
||||
$(".oper .next").css("width", "100%")
|
||||
$(".oper .pre").css("width", "0px")
|
||||
// 判断是编辑还是新增
|
||||
var self = plus.webview.currentWebview();
|
||||
// //console.log(self);
|
||||
var shopId = self.id ? self.id : 0;
|
||||
// //console.log(shopid);
|
||||
if (shopId > 0) {
|
||||
//console.log(22);
|
||||
JZL.ajax(qlgUrl('app/shops/getShopJoinInfo'), {
|
||||
shopId: shopId
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
var data = data.data;
|
||||
getMap(data.lng, data.lat);
|
||||
mui.each(data, function(index, element) {
|
||||
//console.log(element);
|
||||
if ($('#' + index).attr("type") == "hidden") {
|
||||
var imgindex = index.substring(0, index.length - 3);
|
||||
var obj = '#' + imgindex + ''
|
||||
// //console.log('#' + imgindex + '')
|
||||
if (imgindex != "") {
|
||||
if ($(obj).is('img')) {
|
||||
$(obj).attr("src", hyhImgUrl(element))
|
||||
$('#' + index + '').val(element)
|
||||
}
|
||||
}
|
||||
|
||||
} else if ($('#' + index).is("select")) {
|
||||
|
||||
switch (index) {
|
||||
case 'provinceId':
|
||||
getAreaName(element, 1, function(data) {
|
||||
getArea(index, 1, 0, '请选择省', data.data.areaId);
|
||||
// $('#'+index).html('<option selected value="'+data.data.areaId+'">'+data.data.areaName+'</option>')
|
||||
})
|
||||
break;
|
||||
case 'cityId':
|
||||
getAreaName(element, 2, function(data) {
|
||||
$('#' + index).html('<option selected value="' + data.data.areaId + '">' + data.data.areaName +
|
||||
'</option>')
|
||||
});
|
||||
break;
|
||||
case 'countyId':
|
||||
getAreaName(element, 3, function(data) {
|
||||
$('#' + index).html('<option selected value="' + data.data.areaId + '">' + data.data.areaName +
|
||||
'</option>')
|
||||
});
|
||||
break;
|
||||
case 'townId':
|
||||
getAreaName(element, 4, function(data) {
|
||||
$('#' + index).html('<option selected value="' + data.data.areaId + '">' + data.data.areaName +
|
||||
'</option>')
|
||||
});
|
||||
break;
|
||||
case 'villageId':
|
||||
getAreaName(element, 5, function(data) {
|
||||
$('#' + index).html('<option selected value="' + data.data.areaId + '">' + data.data.areaName +
|
||||
'</option>')
|
||||
});
|
||||
break;
|
||||
case 'bankName':
|
||||
getBankList(element);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// $('#'+index+' option:selected').text(element)
|
||||
// $('#'+index+' option:selected').attr('value',element)
|
||||
// $('#'+index+' option:selected').attr('text',element)
|
||||
} else {
|
||||
$('#' + index).val(element)
|
||||
// //console.log(this);
|
||||
}
|
||||
})
|
||||
shopAddress = $('#shopAddress').val();
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
setTimeout(function() {
|
||||
$('#shopAddress').val(shopAddress)
|
||||
}, 1000)
|
||||
} else {
|
||||
|
||||
getBankList();
|
||||
getArea('provinceId', 1, 0, '请选择省');
|
||||
getLocation(function(data) {
|
||||
//console.log(11);
|
||||
if (1 == data.status) {
|
||||
$('#lng').val(data.lng);
|
||||
$('#lat').val(data.lat);
|
||||
getMap(data.lng, data.lat)
|
||||
//console.log(JSON.stringify(data));
|
||||
} else {
|
||||
mui.alert(data.errStr);
|
||||
return;
|
||||
}
|
||||
});
|
||||
JZL.getItems('editorShopInfo')
|
||||
}
|
||||
|
||||
function getAreaName(id, level, callback) {
|
||||
JZL.ajax(qlgUrl("app/Position/getAreaName"), {
|
||||
id: id,
|
||||
level: level
|
||||
}, function(data) {
|
||||
callback(data);
|
||||
})
|
||||
}
|
||||
//下一步
|
||||
mui('.next').on('tap', '.bc_btn', function() {
|
||||
var params = JZL.getParams(".inp")
|
||||
// //console.log(params);
|
||||
// var html=
|
||||
var idx = $(this).index() + 1;
|
||||
var prenum = idx + 1;
|
||||
// checkStep(idx)
|
||||
if (checkStep(idx)) {
|
||||
if (prenum !== 1) {
|
||||
// //console.log(1);
|
||||
$(".pre").attr("display", "block")
|
||||
$(".oper .pre").css("width", "50%")
|
||||
$(".oper .next").css("width", "50%")
|
||||
}
|
||||
if (prenum == 1) {
|
||||
// //console.log(1);
|
||||
$(".oper .next").css("width", "100%")
|
||||
$(".oper .pre").css("width", "0px")
|
||||
}
|
||||
$('.con-nav ul li').eq(idx).addClass("active")
|
||||
$('.next .bc_btn').eq(idx).show().siblings().hide()
|
||||
$('.pre .pre_btn').eq(idx).show().siblings().hide()
|
||||
$('.con-content .num').eq(idx).show().siblings().hide()
|
||||
JZL.saveItems('.localinp', 'auth_personal');
|
||||
backTop()
|
||||
}
|
||||
})
|
||||
//上一步
|
||||
mui('.pre').on('tap', '.pre_btn', function() {
|
||||
var idx = $(this).index() - 1;
|
||||
var prenum = idx + 1;
|
||||
if (checkStep(idx)) {
|
||||
if (prenum !== 1) {
|
||||
$(".pre").attr("display", "block")
|
||||
$(".oper .pre").css("width", "50%")
|
||||
$(".oper .next").css("width", "50%")
|
||||
}
|
||||
if (prenum == 1) {
|
||||
$(".oper .next").css("width", "100%")
|
||||
$(".oper .pre").css("width", "0px")
|
||||
}
|
||||
$('.con-nav ul li').eq(idx + 1).removeClass("active")
|
||||
$('.next .bc_btn').eq(idx).show().siblings().hide()
|
||||
$('.pre .pre_btn').eq(idx).show().siblings().hide()
|
||||
$('.con-content .num').eq(idx).show().siblings().hide()
|
||||
JZL.getItems('auth_personal');
|
||||
backTop()
|
||||
}
|
||||
})
|
||||
//五级联动
|
||||
$('.selectarea').on("change", ".area", function() {
|
||||
var areas = ['province', 'city', 'county', 'town', 'village'];
|
||||
var areaStr = ['请选择省', '请选择市', '选择区县', '选择乡镇', '选择村社区'];
|
||||
var level = $(this).attr('data-level'); //1
|
||||
pid = $("#" + areas[level - 1] + "Id option:selected").val();
|
||||
var sonLevel = +level + 1;
|
||||
getArea(areas[level] + 'Id', sonLevel, pid, areaStr[level]);
|
||||
|
||||
})
|
||||
|
||||
function getArea(area, level, pid, selectAreaStr, defaultId) {
|
||||
JZL.ajax(qlgUrl('app/Position/listQuery'), {
|
||||
level: level,
|
||||
pid: pid
|
||||
}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="">' + selectAreaStr + '</option>';
|
||||
if ('undefined' == typeof(defaultId)) {
|
||||
$.each(data, function() {
|
||||
html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
|
||||
});
|
||||
} else {
|
||||
$.each(data, function() {
|
||||
if (this.areaId == defaultId) {
|
||||
selected = 'selected';
|
||||
} else {
|
||||
selected = '';
|
||||
}
|
||||
html += '<option value="' + this.areaId + '" ' + selected + '>' + this.areaName + '</option>'
|
||||
});
|
||||
}
|
||||
|
||||
// //console.log(area)
|
||||
$('#' + area).html(html);
|
||||
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// // location.reload();
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
|
||||
$(".photos_con").on("tap", '.sfzzm', function() {
|
||||
UP.init("idCardFrontImg", "test", "idCardFront")
|
||||
openCamera();
|
||||
})
|
||||
|
||||
$(".photos_con").on("tap", '.sfzfm', function() {
|
||||
UP.init("idCardBackImg", "test", "idCardBack")
|
||||
openCamera();
|
||||
})
|
||||
$(".photos_con").on("tap", '.weituoshu', function() {
|
||||
UP.init("commissionImg", "test", "commission")
|
||||
openCamera();
|
||||
})
|
||||
$(".photos_con").on("tap", '.shopsimg', function() {
|
||||
UP.init("businessLicenceImg", "test", "businessLicence")
|
||||
openCamera();
|
||||
})
|
||||
$(".photos_con").on("tap", '.querenshu', function() {
|
||||
UP.init("confirmationImg", "test", "confirmation")
|
||||
openCamera();
|
||||
})
|
||||
|
||||
function getBankList(defaultBankName) {
|
||||
JZL.ajax(qlgUrl('app/auth/getBankNameList'), {
|
||||
|
||||
},
|
||||
function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data)
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="">选择银行</option>';
|
||||
// var html="";
|
||||
if ('undefined' == typeof(defaultBankName)) {
|
||||
$.each(data, function() {
|
||||
// //console.log(data);
|
||||
html += '<option value="' + this.bankName + '">' + this.bankName + '</option>'
|
||||
});
|
||||
} else {
|
||||
// //console.log(data);
|
||||
$.each(data, function() {
|
||||
// //console.log(data);
|
||||
if (this.bankName == defaultBankName) {
|
||||
selected = 'selected';
|
||||
} else {
|
||||
selected = '';
|
||||
}
|
||||
html += '<option value="' + this.bankName + '" ' + selected + '>' + this.bankName + '</option>'
|
||||
});
|
||||
}
|
||||
|
||||
$('.bankname').append(html);
|
||||
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//获取协议
|
||||
JZL.ajax(qlgUrl('app/Tags/articleDetail'), {
|
||||
articleId: 112
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
// if (1==data.status) {
|
||||
// $('.zcxycontent').html(data.data.articleContent)
|
||||
$('.confirmationtext_con').html(data.articleContent)
|
||||
|
||||
// }
|
||||
|
||||
});
|
||||
|
||||
|
||||
function checkStep(step) {
|
||||
var params = JZL.getParams(".inp")
|
||||
// //console.log(params);
|
||||
// //console.log(step);
|
||||
switch (step) {
|
||||
case 1:
|
||||
if ('' == params.shopName) {
|
||||
mui.alert("请输入店铺名称")
|
||||
return;
|
||||
}
|
||||
if ('' == params.phone) {
|
||||
mui.alert("请输入手机号码")
|
||||
//console.log(params);
|
||||
return;
|
||||
}
|
||||
if ('' == params.userName) {
|
||||
mui.alert("请输入姓名")
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if ('' == params.provinceId) {
|
||||
mui.alert("请输入所在省")
|
||||
return;
|
||||
|
||||
}
|
||||
if ('' == params.cityId) {
|
||||
mui.alert("请输入所在市")
|
||||
return;
|
||||
|
||||
}
|
||||
if ('' == params.countyId) {
|
||||
mui.alert("请输入所在区")
|
||||
return;
|
||||
|
||||
}
|
||||
if ('' == params.townId) {
|
||||
mui.alert("请输入所在镇")
|
||||
return;
|
||||
}
|
||||
if ('' == params.villageId) {
|
||||
mui.alert("请输入所在村")
|
||||
return;
|
||||
}
|
||||
if ('' == params.shopAddress) {
|
||||
mui.alert("请输入详细地址")
|
||||
return;
|
||||
}
|
||||
if ('' == params.lat) {
|
||||
mui.alert("请在地图上选择位置")
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ('' == params.accountName) {
|
||||
mui.alert("请输入持卡人姓名")
|
||||
return;
|
||||
|
||||
}
|
||||
if ('' == params.bankName) {
|
||||
mui.alert("请输入银行名称")
|
||||
return;
|
||||
|
||||
}
|
||||
if ('' == params.bankNo) {
|
||||
mui.alert("请输入银行卡号")
|
||||
return;
|
||||
|
||||
}
|
||||
if ('' == params.userName) {
|
||||
mui.alert("请输入开户行")
|
||||
return;
|
||||
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ('' == params.idCardFrontImg) {
|
||||
mui.alert("请上传身份证正面照")
|
||||
return;
|
||||
}
|
||||
if ('' == params.idCardBackImg) {
|
||||
mui.alert("请上传身份证反面照")
|
||||
return;
|
||||
}
|
||||
if ('' == params.commissionImg) {
|
||||
mui.alert("请上传直营人委托书照片")
|
||||
return;
|
||||
}
|
||||
if ('' == params.businessLicenceImg) {
|
||||
mui.alert("请上传营业执照照片")
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
|
||||
|
||||
if ('' == params.commissionImg) {
|
||||
mui.alert("请上传手持确认书照片")
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 保存
|
||||
mui('.header').on('tap','.header_con_bc',function(){
|
||||
JZL.saveItems (".inp","editorShopInfo");
|
||||
mui.toast('保存成功');
|
||||
})
|
||||
//提交
|
||||
var flag = false;
|
||||
|
||||
|
||||
mui('.next').on('tap', '.finish', function() {
|
||||
if (flag == true) return;
|
||||
flag = true
|
||||
var params = JZL.getParams(".inp")
|
||||
if (shopId > 0) {
|
||||
params.shopId = shopId
|
||||
}
|
||||
|
||||
JZL.ajax(qlgUrl('app/shops/shopJoin'), params, function(data) {
|
||||
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
// JZL.saveItems ("inp","editorShopInfo");
|
||||
mui.toast(data.msg)
|
||||
localStorage.removeItem("editorShopInfo")
|
||||
mui.back()
|
||||
// JZL.openWindow("myshops.html", "myshops.html")
|
||||
// JZL.openWindow("myshop.html", "myshop.html")
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
319
static/app2/js/appraise.js
Executable file
319
static/app2/js/appraise.js
Executable file
@ -0,0 +1,319 @@
|
||||
var isjiazai = 1;
|
||||
var type = '';
|
||||
var page = 1
|
||||
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
var data_id = self.goodsId;
|
||||
// //console.log(data_id)
|
||||
|
||||
function getData(page, pagesize, type) {
|
||||
var set_data = {
|
||||
goodsId: data_id,
|
||||
type: type ? type : '',
|
||||
page: page ? page : 1,
|
||||
pagesize: pagesize ? pagesize : 10
|
||||
}
|
||||
if (isjiazai == 1) {
|
||||
isjiazai = 0
|
||||
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
mui.ajax(qlgUrl('app/goodsappraises/getById'), {
|
||||
|
||||
data: set_data,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
var html = '';
|
||||
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
$('#sum').html('全部(' + data.sum + ')');
|
||||
$('#pic').html('有图(' + data.picNum + ')');
|
||||
$('#bad').html('差评(' + data.badNum + ')');
|
||||
$('#good').html('中评(' + data.goodNum + ')');
|
||||
$('#best').html('好评(' + data.bestNum + ')');
|
||||
if (data.Rows == '') {
|
||||
if (page == 1) {
|
||||
$('.pj_list').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多评价</p>');
|
||||
} else {
|
||||
$('.pj_list').append(
|
||||
'<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多评价</p>');
|
||||
}
|
||||
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
|
||||
var userImg = '';
|
||||
if (this.userPhoto) {
|
||||
userImg = hyhImgUrl(this.userPhoto);
|
||||
} else {
|
||||
userImg = '../img/mujiimg.png'
|
||||
}
|
||||
|
||||
html += '<div class="pj_breviary"><div class="pjbtitle clearfix"><img src="' + userImg + '" /><p>' + this.loginName +
|
||||
'</p></div><div class="pjbcon">' + this.content + '</div>';
|
||||
|
||||
if (this.shopReply != null) {
|
||||
html += '<div class="zjpj"><div class="sanjiao"></div><div class="pjzhuijia">商家回复:' + this.shopReply +
|
||||
'</div></div>';
|
||||
}
|
||||
html += '<div class="pjclass">' + this.goodsSpecNames + '</div><div class="pjclass">' + this.createTime +
|
||||
'</div>';
|
||||
if (this.images != '' && this.images != null) {
|
||||
html += '<div class="gallety"><div class="my-gallery clearfix" data-pswp-uid="">';
|
||||
var imgArr = this.images.split(',');
|
||||
$.each(imgArr, function() {
|
||||
html += '<figure><div class="img-dv"><a href="' + hyhImgUrl(this) +
|
||||
'/thumb512" data-size="1920x1080"><img src="' + hyhImgUrl(this) + '/thumb78"></a></div></figure>';
|
||||
// //console.log(hyhImgUrl(this))
|
||||
});
|
||||
|
||||
html += '</div></div>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
});
|
||||
if (page == 1) {
|
||||
$('.pj_list').html(html);
|
||||
} else {
|
||||
$('.pj_list').append(html);
|
||||
}
|
||||
|
||||
isjiazai = 1;
|
||||
|
||||
setTimeout(function() {
|
||||
$('.img-dv a').each(function() {
|
||||
var that = $(this);
|
||||
var img_ = new Image()
|
||||
img_.src = that.attr('href');
|
||||
img_.onload = function() {
|
||||
that.attr('data-size', img_.width + 'x' + img_.height);
|
||||
}
|
||||
});
|
||||
document.addEventListener('DOMAttrModified', function() {
|
||||
$('.img-dv a').each(function() {
|
||||
var that = $(this);
|
||||
var img_ = new Image()
|
||||
img_.src = that.attr('href');
|
||||
img_.onload = function() {
|
||||
that.attr('data-size', img_.width + 'x' + img_.height);
|
||||
}
|
||||
});
|
||||
}, false);
|
||||
|
||||
var initPhotoSwipeFromDOM = function(gallerySelector) {
|
||||
// 解析来自DOM元素幻灯片数据(URL,标题,大小...)
|
||||
var parseThumbnailElements = function(el) {
|
||||
var thumbElements = el.childNodes,
|
||||
numNodes = thumbElements.length,
|
||||
items = [],
|
||||
figureEl,
|
||||
linkEl,
|
||||
size,
|
||||
item,
|
||||
divEl;
|
||||
for (var i = 0; i < numNodes; i++) {
|
||||
figureEl = thumbElements[i]; // <figure> element
|
||||
// 仅包括元素节点
|
||||
if (figureEl.nodeType !== 1) {
|
||||
continue;
|
||||
}
|
||||
divEl = figureEl.children[0];
|
||||
linkEl = divEl.children[0]; // <a> element
|
||||
size = linkEl.getAttribute('data-size').split('x');
|
||||
// 创建幻灯片对象
|
||||
item = {
|
||||
src: linkEl.getAttribute('href'),
|
||||
w: parseInt(size[0], 10),
|
||||
h: parseInt(size[1], 10)
|
||||
// w: '100%'
|
||||
};
|
||||
if (figureEl.children.length > 1) {
|
||||
item.title = figureEl.children[1].innerHTML;
|
||||
}
|
||||
if (linkEl.children.length > 0) {
|
||||
// <img> 缩略图节点, 检索缩略图网址
|
||||
item.msrc = linkEl.children[0].getAttribute('src');
|
||||
}
|
||||
item.el = figureEl; // 保存链接元素 for getThumbBoundsFn
|
||||
items.push(item);
|
||||
}
|
||||
return items;
|
||||
};
|
||||
|
||||
// 查找最近的父节点
|
||||
var closest = function closest(el, fn) {
|
||||
return el && (fn(el) ? el : closest(el.parentNode, fn));
|
||||
};
|
||||
|
||||
// 当用户点击缩略图触发
|
||||
var onThumbnailsClick = function(e) {
|
||||
e = e || window.event;
|
||||
e.preventDefault ? e.preventDefault() : e.returnValue = false;
|
||||
var eTarget = e.target || e.srcElement;
|
||||
var clickedListItem = closest(eTarget, function(el) {
|
||||
return (el.tagName && el.tagName.toUpperCase() === 'FIGURE');
|
||||
});
|
||||
if (!clickedListItem) {
|
||||
return;
|
||||
}
|
||||
var clickedGallery = clickedListItem.parentNode,
|
||||
childNodes = clickedListItem.parentNode.childNodes,
|
||||
numChildNodes = childNodes.length,
|
||||
nodeIndex = 0,
|
||||
index;
|
||||
for (var i = 0; i < numChildNodes; i++) {
|
||||
if (childNodes[i].nodeType !== 1) {
|
||||
continue;
|
||||
}
|
||||
if (childNodes[i] === clickedListItem) {
|
||||
index = nodeIndex;
|
||||
break;
|
||||
}
|
||||
nodeIndex++;
|
||||
}
|
||||
if (index >= 0) {
|
||||
openPhotoSwipe(index, clickedGallery);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
var photoswipeParseHash = function() {
|
||||
var hash = window.location.hash.substring(1),
|
||||
params = {};
|
||||
if (hash.length < 5) {
|
||||
return params;
|
||||
}
|
||||
var vars = hash.split('&');
|
||||
for (var i = 0; i < vars.length; i++) {
|
||||
if (!vars[i]) {
|
||||
continue;
|
||||
}
|
||||
var pair = vars[i].split('=');
|
||||
if (pair.length < 2) {
|
||||
continue;
|
||||
}
|
||||
params[pair[0]] = pair[1];
|
||||
}
|
||||
if (params.gid) {
|
||||
params.gid = parseInt(params.gid, 10);
|
||||
}
|
||||
return params;
|
||||
};
|
||||
|
||||
var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL) {
|
||||
var pswpElement = document.querySelectorAll('.pswp')[0],
|
||||
gallery,
|
||||
options,
|
||||
items;
|
||||
items = parseThumbnailElements(galleryElement);
|
||||
// 这里可以定义参数
|
||||
options = {
|
||||
barsSize: {
|
||||
top: 100,
|
||||
bottom: 100
|
||||
},
|
||||
fullscreenEl: false,
|
||||
shareButtons: [{
|
||||
id: 'wechat',
|
||||
label: '分享微信',
|
||||
url: '#'
|
||||
},
|
||||
{
|
||||
id: 'weibo',
|
||||
label: '新浪微博',
|
||||
url: '#'
|
||||
},
|
||||
{
|
||||
id: 'download',
|
||||
label: '保存图片',
|
||||
url: '{{raw_image_url}}',
|
||||
download: true
|
||||
}
|
||||
],
|
||||
galleryUID: galleryElement.getAttribute('data-pswp-uid'),
|
||||
getThumbBoundsFn: function(index) {
|
||||
var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail
|
||||
pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
|
||||
rect = thumbnail.getBoundingClientRect();
|
||||
return {
|
||||
x: rect.left,
|
||||
y: rect.top + pageYScroll,
|
||||
w: rect.width
|
||||
};
|
||||
}
|
||||
};
|
||||
if (fromURL) {
|
||||
if (options.galleryPIDs) {
|
||||
for (var j = 0; j < items.length; j++) {
|
||||
if (items[j].pid == index) {
|
||||
options.index = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
options.index = parseInt(index, 10) - 1;
|
||||
}
|
||||
} else {
|
||||
options.index = parseInt(index, 10);
|
||||
}
|
||||
if (isNaN(options.index)) {
|
||||
return;
|
||||
}
|
||||
if (disableAnimation) {
|
||||
options.showAnimationDuration = 0;
|
||||
}
|
||||
gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
|
||||
gallery.init();
|
||||
};
|
||||
|
||||
var galleryElements = document.querySelectorAll(gallerySelector);
|
||||
for (var i = 0, l = galleryElements.length; i < l; i++) {
|
||||
galleryElements[i].setAttribute('data-pswp-uid', i + 1);
|
||||
galleryElements[i].onclick = onThumbnailsClick;
|
||||
}
|
||||
var hashData = photoswipeParseHash();
|
||||
if (hashData.pid && hashData.gid) {
|
||||
openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true);
|
||||
}
|
||||
};
|
||||
|
||||
initPhotoSwipeFromDOM('.my-gallery');
|
||||
}, 500)
|
||||
} else {
|
||||
//console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
getData(1, 10)
|
||||
$('.nav').on('tap', '.nav_', function() {
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
type = $(this).attr('id');
|
||||
page = 1;
|
||||
isjiazai = 1;
|
||||
getData(page, 10, type)
|
||||
})
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isjiazai == 1) {
|
||||
page++;
|
||||
getData(page, 10, type)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
})
|
72
static/app2/js/bill.js
Executable file
72
static/app2/js/bill.js
Executable file
@ -0,0 +1,72 @@
|
||||
var vouchersType = '',
|
||||
isExpected = '';
|
||||
var data_href = '';
|
||||
var pageSize = 20;
|
||||
var count = 1;
|
||||
var isLoading = false;
|
||||
mui.plusReady(function() {
|
||||
|
||||
var self = plus.webview.currentWebview();
|
||||
//console.log(self)
|
||||
vouchersType = self.data_type;
|
||||
isExpected = self.data_expected;
|
||||
data_href = data_href;
|
||||
getBillList(count, pageSize)
|
||||
|
||||
function getBillList(count, pageSize) {
|
||||
if (true == isLoading) return;
|
||||
isLoading = true;
|
||||
JZL.ajax(qlgUrl('app/Uservouchers/getVouchers'), {
|
||||
page: count,
|
||||
perPage: pageSize,
|
||||
vouchersType: vouchersType,
|
||||
isExpected: isExpected,
|
||||
}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
// //console.log(data.data.Rows)
|
||||
//console.log(data);
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
if (data.Rows == '') {
|
||||
$('.con').append(
|
||||
'<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多数据</p>');
|
||||
return;
|
||||
}
|
||||
var html = ''
|
||||
$.each(data.Rows, function() {
|
||||
html +=
|
||||
'<div class="row shadown_wai"><div class="left"> <img src="../img/dingwei1.png" alt=""></div><div class="context"><p class="con_text">' +
|
||||
this.remark + '</p><p class="con_time">' + this.createTime + '</p></div><div class="num">-' + this.num +
|
||||
'</div></div>';
|
||||
|
||||
})
|
||||
if (count == 1) {
|
||||
$('.con').html(html);
|
||||
} else {
|
||||
$('.con').append(html);
|
||||
}
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if (e.cancelable) {
|
||||
// 判断默认行为是否已经被禁用
|
||||
if (!e.defaultPrevented) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isLoading == false) {
|
||||
count++;
|
||||
getBillList(count, pageSize)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
287
static/app2/js/binaryajax.js
Executable file
287
static/app2/js/binaryajax.js
Executable file
@ -0,0 +1,287 @@
|
||||
|
||||
/*
|
||||
* Binary Ajax 0.1.10
|
||||
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
|
||||
* Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
|
||||
*/
|
||||
|
||||
var BinaryFile = function(strData, iDataOffset, iDataLength) {
|
||||
var data = strData;
|
||||
var dataOffset = iDataOffset || 0;
|
||||
var dataLength = 0;
|
||||
|
||||
this.getRawData = function() {
|
||||
return data;
|
||||
}
|
||||
|
||||
if (typeof strData == "string") {
|
||||
dataLength = iDataLength || data.length;
|
||||
|
||||
this.getByteAt = function(iOffset) {
|
||||
return data.charCodeAt(iOffset + dataOffset) & 0xFF;
|
||||
}
|
||||
|
||||
this.getBytesAt = function(iOffset, iLength) {
|
||||
var aBytes = [];
|
||||
|
||||
for (var i = 0; i < iLength; i++) {
|
||||
aBytes[i] = data.charCodeAt((iOffset + i) + dataOffset) & 0xFF
|
||||
}
|
||||
;
|
||||
|
||||
return aBytes;
|
||||
}
|
||||
} else if (typeof strData == "unknown") {
|
||||
dataLength = iDataLength || IEBinary_getLength(data);
|
||||
|
||||
this.getByteAt = function(iOffset) {
|
||||
return IEBinary_getByteAt(data, iOffset + dataOffset);
|
||||
}
|
||||
|
||||
this.getBytesAt = function(iOffset, iLength) {
|
||||
return new VBArray(IEBinary_getBytesAt(data, iOffset + dataOffset, iLength)).toArray();
|
||||
}
|
||||
}
|
||||
|
||||
this.getLength = function() {
|
||||
return dataLength;
|
||||
}
|
||||
|
||||
this.getSByteAt = function(iOffset) {
|
||||
var iByte = this.getByteAt(iOffset);
|
||||
if (iByte > 127)
|
||||
return iByte - 256;
|
||||
else
|
||||
return iByte;
|
||||
}
|
||||
|
||||
this.getShortAt = function(iOffset, bBigEndian) {
|
||||
var iShort = bBigEndian ?
|
||||
(this.getByteAt(iOffset) << 8) + this.getByteAt(iOffset + 1)
|
||||
: (this.getByteAt(iOffset + 1) << 8) + this.getByteAt(iOffset)
|
||||
if (iShort < 0)
|
||||
iShort += 65536;
|
||||
return iShort;
|
||||
}
|
||||
this.getSShortAt = function(iOffset, bBigEndian) {
|
||||
var iUShort = this.getShortAt(iOffset, bBigEndian);
|
||||
if (iUShort > 32767)
|
||||
return iUShort - 65536;
|
||||
else
|
||||
return iUShort;
|
||||
}
|
||||
this.getLongAt = function(iOffset, bBigEndian) {
|
||||
var iByte1 = this.getByteAt(iOffset),
|
||||
iByte2 = this.getByteAt(iOffset + 1),
|
||||
iByte3 = this.getByteAt(iOffset + 2),
|
||||
iByte4 = this.getByteAt(iOffset + 3);
|
||||
|
||||
var iLong = bBigEndian ?
|
||||
(((((iByte1 << 8) + iByte2) << 8) + iByte3) << 8) + iByte4
|
||||
: (((((iByte4 << 8) + iByte3) << 8) + iByte2) << 8) + iByte1;
|
||||
if (iLong < 0)
|
||||
iLong += 4294967296;
|
||||
return iLong;
|
||||
}
|
||||
this.getSLongAt = function(iOffset, bBigEndian) {
|
||||
var iULong = this.getLongAt(iOffset, bBigEndian);
|
||||
if (iULong > 2147483647)
|
||||
return iULong - 4294967296;
|
||||
else
|
||||
return iULong;
|
||||
}
|
||||
|
||||
this.getStringAt = function(iOffset, iLength) {
|
||||
var aStr = [];
|
||||
|
||||
var aBytes = this.getBytesAt(iOffset, iLength);
|
||||
for (var j = 0; j < iLength; j++) {
|
||||
aStr[j] = String.fromCharCode(aBytes[j]);
|
||||
}
|
||||
return aStr.join("");
|
||||
}
|
||||
|
||||
this.getCharAt = function(iOffset) {
|
||||
return String.fromCharCode(this.getByteAt(iOffset));
|
||||
}
|
||||
this.toBase64 = function() {
|
||||
return window.btoa(data);
|
||||
}
|
||||
this.fromBase64 = function(strBase64) {
|
||||
data = window.atob(strBase64);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var BinaryAjax = (function() {
|
||||
|
||||
function createRequest() {
|
||||
var oHTTP = null;
|
||||
if (window.ActiveXObject) {
|
||||
oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} else if (window.XMLHttpRequest) {
|
||||
oHTTP = new XMLHttpRequest();
|
||||
}
|
||||
return oHTTP;
|
||||
}
|
||||
|
||||
function getHead(strURL, fncCallback, fncError) {
|
||||
var oHTTP = createRequest();
|
||||
if (oHTTP) {
|
||||
if (fncCallback) {
|
||||
if (typeof(oHTTP.onload) != "undefined") {
|
||||
oHTTP.onload = function() {
|
||||
if (oHTTP.status == "200") {
|
||||
fncCallback(this);
|
||||
} else {
|
||||
if (fncError)
|
||||
fncError();
|
||||
}
|
||||
oHTTP = null;
|
||||
};
|
||||
} else {
|
||||
oHTTP.onreadystatechange = function() {
|
||||
if (oHTTP.readyState == 4) {
|
||||
if (oHTTP.status == "200") {
|
||||
fncCallback(this);
|
||||
} else {
|
||||
if (fncError)
|
||||
fncError();
|
||||
}
|
||||
oHTTP = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
oHTTP.open("HEAD", strURL, true);
|
||||
oHTTP.send(null);
|
||||
} else {
|
||||
if (fncError)
|
||||
fncError();
|
||||
}
|
||||
}
|
||||
|
||||
function sendRequest(strURL, fncCallback, fncError, aRange, bAcceptRanges, iFileSize) {
|
||||
var oHTTP = createRequest();
|
||||
if (oHTTP) {
|
||||
|
||||
var iDataOffset = 0;
|
||||
if (aRange && !bAcceptRanges) {
|
||||
iDataOffset = aRange[0];
|
||||
}
|
||||
var iDataLen = 0;
|
||||
if (aRange) {
|
||||
iDataLen = aRange[1] - aRange[0] + 1;
|
||||
}
|
||||
|
||||
if (fncCallback) {
|
||||
if (typeof(oHTTP.onload) != "undefined") {
|
||||
oHTTP.onload = function() {
|
||||
if (oHTTP.status == "200" || oHTTP.status == "206" || oHTTP.status == "0") {
|
||||
oHTTP.binaryResponse = new BinaryFile(oHTTP.responseText, iDataOffset, iDataLen);
|
||||
oHTTP.fileSize = iFileSize || oHTTP.getResponseHeader("Content-Length");
|
||||
fncCallback(oHTTP);
|
||||
} else {
|
||||
if (fncError)
|
||||
fncError();
|
||||
}
|
||||
oHTTP = null;
|
||||
};
|
||||
} else {
|
||||
oHTTP.onreadystatechange = function() {
|
||||
if (oHTTP.readyState == 4) {
|
||||
if (oHTTP.status == "200" || oHTTP.status == "206" || oHTTP.status == "0") {
|
||||
// IE6 craps if we try to extend the XHR object
|
||||
var oRes = {
|
||||
status: oHTTP.status,
|
||||
// IE needs responseBody, Chrome/Safari needs responseText
|
||||
binaryResponse: new BinaryFile(
|
||||
typeof oHTTP.responseBody == "unknown" ? oHTTP.responseBody : oHTTP.responseText, iDataOffset, iDataLen
|
||||
),
|
||||
fileSize: iFileSize || oHTTP.getResponseHeader("Content-Length")
|
||||
};
|
||||
fncCallback(oRes);
|
||||
} else {
|
||||
if (fncError)
|
||||
fncError();
|
||||
}
|
||||
oHTTP = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
oHTTP.open("GET", strURL, true);
|
||||
|
||||
if (oHTTP.overrideMimeType)
|
||||
oHTTP.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
|
||||
if (aRange && bAcceptRanges) {
|
||||
oHTTP.setRequestHeader("Range", "bytes=" + aRange[0] + "-" + aRange[1]);
|
||||
}
|
||||
|
||||
oHTTP.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 1970 00:00:00 GMT");
|
||||
|
||||
oHTTP.send(null);
|
||||
} else {
|
||||
if (fncError)
|
||||
fncError();
|
||||
}
|
||||
}
|
||||
|
||||
return function(strURL, fncCallback, fncError, aRange) {
|
||||
|
||||
if (aRange) {
|
||||
getHead(
|
||||
strURL,
|
||||
function(oHTTP) {
|
||||
var iLength = parseInt(oHTTP.getResponseHeader("Content-Length"), 10);
|
||||
var strAcceptRanges = oHTTP.getResponseHeader("Accept-Ranges");
|
||||
|
||||
var iStart, iEnd;
|
||||
iStart = aRange[0];
|
||||
if (aRange[0] < 0)
|
||||
iStart += iLength;
|
||||
iEnd = iStart + aRange[1] - 1;
|
||||
|
||||
sendRequest(strURL, fncCallback, fncError, [iStart, iEnd], (strAcceptRanges == "bytes"), iLength);
|
||||
}
|
||||
);
|
||||
|
||||
} else {
|
||||
sendRequest(strURL, fncCallback, fncError);
|
||||
}
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
/*
|
||||
document.write(
|
||||
"<script type='text/vbscript'>\r\n"
|
||||
+ "Function IEBinary_getByteAt(strBinary, iOffset)\r\n"
|
||||
+ " IEBinary_getByteAt = AscB(MidB(strBinary,iOffset+1,1))\r\n"
|
||||
+ "End Function\r\n"
|
||||
+ "Function IEBinary_getLength(strBinary)\r\n"
|
||||
+ " IEBinary_getLength = LenB(strBinary)\r\n"
|
||||
+ "End Function\r\n"
|
||||
+ "</script>\r\n"
|
||||
);
|
||||
*/
|
||||
|
||||
document.write(
|
||||
"<script type='text/vbscript'>\r\n"
|
||||
+ "Function IEBinary_getByteAt(strBinary, iOffset)\r\n"
|
||||
+ " IEBinary_getByteAt = AscB(MidB(strBinary, iOffset + 1, 1))\r\n"
|
||||
+ "End Function\r\n"
|
||||
+ "Function IEBinary_getBytesAt(strBinary, iOffset, iLength)\r\n"
|
||||
+ " Dim aBytes()\r\n"
|
||||
+ " ReDim aBytes(iLength - 1)\r\n"
|
||||
+ " For i = 0 To iLength - 1\r\n"
|
||||
+ " aBytes(i) = IEBinary_getByteAt(strBinary, iOffset + i)\r\n"
|
||||
+ " Next\r\n"
|
||||
+ " IEBinary_getBytesAt = aBytes\r\n"
|
||||
+ "End Function\r\n"
|
||||
+ "Function IEBinary_getLength(strBinary)\r\n"
|
||||
+ " IEBinary_getLength = LenB(strBinary)\r\n"
|
||||
+ "End Function\r\n"
|
||||
+ "</script>\r\n"
|
||||
);
|
344
static/app2/js/canvasResize.js
Executable file
344
static/app2/js/canvasResize.js
Executable file
@ -0,0 +1,344 @@
|
||||
/*
|
||||
*
|
||||
* canvasResize
|
||||
*
|
||||
* Version: 1.2.0
|
||||
* Date (d/m/y): 02/10/12
|
||||
* Update (d/m/y): 14/05/13
|
||||
* Original author: @gokercebeci
|
||||
* Licensed under the MIT license
|
||||
* - This plugin working with binaryajax.js and exif.js
|
||||
* (It's under the MPL License http://www.nihilogic.dk/licenses/mpl-license.txt)
|
||||
* Demo: http://canvasResize.gokercebeci.com/
|
||||
*
|
||||
* - I fixed iOS6 Safari's image file rendering issue for large size image (over mega-pixel)
|
||||
* using few functions from https://github.com/stomita/ios-imagefile-megapixel
|
||||
* (detectSubsampling, )
|
||||
* And fixed orientation issue by using https://github.com/jseidelin/exif-js
|
||||
* Thanks, Shinichi Tomita and Jacob Seidelin
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
var pluginName = 'canvasResize',
|
||||
methods = {
|
||||
newsize: function(w, h, W, H, C) {
|
||||
var c = C ? 'h' : '';
|
||||
if ((W && w > W) || (H && h > H)) {
|
||||
var r = w / h;
|
||||
if ((r >= 1 || H === 0) && W && !C) {
|
||||
w = W;
|
||||
h = (W / r) >> 0;
|
||||
} else if (C && r <= (W / H)) {
|
||||
w = W;
|
||||
h = (W / r) >> 0;
|
||||
c = 'w';
|
||||
} else {
|
||||
w = (H * r) >> 0;
|
||||
h = H;
|
||||
}
|
||||
}
|
||||
return {
|
||||
'width': w,
|
||||
'height': h,
|
||||
'cropped': c
|
||||
};
|
||||
},
|
||||
dataURLtoBlob: function(data) {
|
||||
var mimeString = data.split(',')[0].split(':')[1].split(';')[0];
|
||||
var byteString = atob(data.split(',')[1]);
|
||||
var ab = new ArrayBuffer(byteString.length);
|
||||
var ia = new Uint8Array(ab);
|
||||
for (var i = 0; i < byteString.length; i++) {
|
||||
ia[i] = byteString.charCodeAt(i);
|
||||
}
|
||||
var bb = (window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder);
|
||||
if (bb) {
|
||||
// console.log('BlobBuilder');
|
||||
bb = new (window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder)();
|
||||
bb.append(ab);
|
||||
return bb.getBlob(mimeString);
|
||||
} else {
|
||||
// console.log('Blob');
|
||||
bb = new Blob([ab], {
|
||||
'type': (mimeString)
|
||||
});
|
||||
return bb;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Detect subsampling in loaded image.
|
||||
* In iOS, larger images than 2M pixels may be subsampled in rendering.
|
||||
*/
|
||||
detectSubsampling: function(img) {
|
||||
var iw = img.width, ih = img.height;
|
||||
if (iw * ih > 1048576) { // subsampling may happen over megapixel image
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = canvas.height = 1;
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(img, -iw + 1, 0);
|
||||
// subsampled image becomes half smaller in rendering size.
|
||||
// check alpha channel value to confirm image is covering edge pixel or not.
|
||||
// if alpha value is 0 image is not covering, hence subsampled.
|
||||
return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Update the orientation according to the specified rotation angle
|
||||
*/
|
||||
rotate: function(orientation, angle) {
|
||||
var o = {
|
||||
// nothing
|
||||
1: {90: 6, 180: 3, 270: 8},
|
||||
// horizontal flip
|
||||
2: {90: 7, 180: 4, 270: 5},
|
||||
// 180 rotate left
|
||||
3: {90: 8, 180: 1, 270: 6},
|
||||
// vertical flip
|
||||
4: {90: 5, 180: 2, 270: 7},
|
||||
// vertical flip + 90 rotate right
|
||||
5: {90: 2, 180: 7, 270: 4},
|
||||
// 90 rotate right
|
||||
6: {90: 3, 180: 8, 270: 1},
|
||||
// horizontal flip + 90 rotate right
|
||||
7: {90: 4, 180: 5, 270: 2},
|
||||
// 90 rotate left
|
||||
8: {90: 1, 180: 6, 270: 3}
|
||||
};
|
||||
return o[orientation][angle] ? o[orientation][angle] : orientation;
|
||||
},
|
||||
/**
|
||||
* Transform canvas coordination according to specified frame size and orientation
|
||||
* Orientation value is from EXIF tag
|
||||
*/
|
||||
transformCoordinate: function(canvas, width, height, orientation) {
|
||||
switch (orientation) {
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
canvas.width = height;
|
||||
canvas.height = width;
|
||||
break;
|
||||
default:
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
}
|
||||
var ctx = canvas.getContext('2d');
|
||||
switch (orientation) {
|
||||
case 1:
|
||||
// nothing
|
||||
break;
|
||||
case 2:
|
||||
// horizontal flip
|
||||
ctx.translate(width, 0);
|
||||
ctx.scale(-1, 1);
|
||||
break;
|
||||
case 3:
|
||||
// 180 rotate left
|
||||
ctx.translate(width, height);
|
||||
ctx.rotate(Math.PI);
|
||||
break;
|
||||
case 4:
|
||||
// vertical flip
|
||||
ctx.translate(0, height);
|
||||
ctx.scale(1, -1);
|
||||
break;
|
||||
case 5:
|
||||
// vertical flip + 90 rotate right
|
||||
ctx.rotate(0.5 * Math.PI);
|
||||
ctx.scale(1, -1);
|
||||
break;
|
||||
case 6:
|
||||
// 90 rotate right
|
||||
ctx.rotate(0.5 * Math.PI);
|
||||
ctx.translate(0, -height);
|
||||
break;
|
||||
case 7:
|
||||
// horizontal flip + 90 rotate right
|
||||
ctx.rotate(0.5 * Math.PI);
|
||||
ctx.translate(width, -height);
|
||||
ctx.scale(-1, 1);
|
||||
break;
|
||||
case 8:
|
||||
// 90 rotate left
|
||||
ctx.rotate(-0.5 * Math.PI);
|
||||
ctx.translate(-width, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Detecting vertical squash in loaded image.
|
||||
* Fixes a bug which squash image vertically while drawing into canvas for some images.
|
||||
*/
|
||||
detectVerticalSquash: function(img, iw, ih) {
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = 1;
|
||||
canvas.height = ih;
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(img, 0, 0);
|
||||
var data = ctx.getImageData(0, 0, 1, ih).data;
|
||||
// search image edge pixel position in case it is squashed vertically.
|
||||
var sy = 0;
|
||||
var ey = ih;
|
||||
var py = ih;
|
||||
while (py > sy) {
|
||||
var alpha = data[(py - 1) * 4 + 3];
|
||||
if (alpha === 0) {
|
||||
ey = py;
|
||||
} else {
|
||||
sy = py;
|
||||
}
|
||||
py = (ey + sy) >> 1;
|
||||
}
|
||||
var ratio = py / ih;
|
||||
return ratio === 0 ? 1 : ratio;
|
||||
},
|
||||
callback: function(d) {
|
||||
return d;
|
||||
},
|
||||
extend: function() {
|
||||
var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
|
||||
if (target.constructor === Boolean) {
|
||||
deep = target;
|
||||
target = arguments[1] || {};
|
||||
}
|
||||
if (al === 1) {
|
||||
target = this;
|
||||
a = 0;
|
||||
}
|
||||
var prop;
|
||||
for (; a < al; a++)
|
||||
if ((prop = arguments[a]) !== null)
|
||||
for (var i in prop) {
|
||||
if (target === prop[i])
|
||||
continue;
|
||||
if (deep && typeof prop[i] === 'object' && target[i])
|
||||
methods.extend(target[i], prop[i]);
|
||||
else if (prop[i] !== undefined)
|
||||
target[i] = prop[i];
|
||||
}
|
||||
return target;
|
||||
}
|
||||
},
|
||||
defaults = {
|
||||
width: 300,
|
||||
height: 0,
|
||||
crop: false,
|
||||
quality: 80,
|
||||
rotate: 0,
|
||||
'callback': methods.callback
|
||||
};
|
||||
function Plugin(file, options) {
|
||||
this.file = file;
|
||||
// EXTEND
|
||||
this.options = methods.extend({}, defaults, options);
|
||||
this._defaults = defaults;
|
||||
this._name = pluginName;
|
||||
this.init();
|
||||
}
|
||||
Plugin.prototype = {
|
||||
init: function() {
|
||||
//this.options.init(this);
|
||||
var $this = this;
|
||||
var file = this.file;
|
||||
|
||||
var reader = new plus.io.FileReader();
|
||||
reader.onloadend = function(e) {
|
||||
|
||||
var dataURL = e.target.result;
|
||||
var byteString = atob(dataURL.split(',')[1]);
|
||||
var binary = new BinaryFile(byteString, 0, byteString.length);
|
||||
var exif = EXIF.readFromBinaryFile(binary);
|
||||
|
||||
var img = new Image();
|
||||
img.onload = function(e) {
|
||||
|
||||
var orientation = exif['Orientation'] || 1;
|
||||
orientation = methods.rotate(orientation, $this.options.rotate);
|
||||
|
||||
// CW or CCW ? replace width and height
|
||||
var size = (orientation >= 5 && orientation <= 8)
|
||||
? methods.newsize(img.height, img.width, $this.options.width, $this.options.height, $this.options.crop)
|
||||
: methods.newsize(img.width, img.height, $this.options.width, $this.options.height, $this.options.crop);
|
||||
|
||||
var iw = img.width, ih = img.height;
|
||||
var width = size.width, height = size.height;
|
||||
|
||||
var canvas = document.createElement("canvas");
|
||||
var ctx = canvas.getContext("2d");
|
||||
ctx.save();
|
||||
methods.transformCoordinate(canvas, width, height, orientation);
|
||||
|
||||
// over image size
|
||||
if (methods.detectSubsampling(img)) {
|
||||
iw /= 2;
|
||||
ih /= 2;
|
||||
}
|
||||
var d = 1024; // size of tiling canvas
|
||||
var tmpCanvas = document.createElement('canvas');
|
||||
tmpCanvas.width = tmpCanvas.height = d;
|
||||
var tmpCtx = tmpCanvas.getContext('2d');
|
||||
var vertSquashRatio = methods.detectVerticalSquash(img, iw, ih);
|
||||
var sy = 0;
|
||||
while (sy < ih) {
|
||||
var sh = sy + d > ih ? ih - sy : d;
|
||||
var sx = 0;
|
||||
while (sx < iw) {
|
||||
var sw = sx + d > iw ? iw - sx : d;
|
||||
tmpCtx.clearRect(0, 0, d, d);
|
||||
tmpCtx.drawImage(img, -sx, -sy);
|
||||
var dx = Math.floor(sx * width / iw);
|
||||
var dw = Math.ceil(sw * width / iw);
|
||||
var dy = Math.floor(sy * height / ih / vertSquashRatio);
|
||||
var dh = Math.ceil(sh * height / ih / vertSquashRatio);
|
||||
ctx.drawImage(tmpCanvas, 0, 0, sw, sh, dx, dy, dw, dh);
|
||||
sx += d;
|
||||
}
|
||||
sy += d;
|
||||
}
|
||||
ctx.restore();
|
||||
tmpCanvas = tmpCtx = null;
|
||||
|
||||
// if rotated width and height data replacing issue
|
||||
var newcanvas = document.createElement('canvas');
|
||||
newcanvas.width = size.cropped === 'h' ? height : width;
|
||||
newcanvas.height = size.cropped === 'w' ? width : height;
|
||||
var x = size.cropped === 'h' ? (height - width) * .5 : 0;
|
||||
var y = size.cropped === 'w' ? (width - height) * .5 : 0;
|
||||
newctx = newcanvas.getContext('2d');
|
||||
newctx.drawImage(canvas, x, y, width, height);
|
||||
|
||||
// console.log(file, file.type);
|
||||
if (file.type === "image/png") {
|
||||
var data = newcanvas.toDataURL(file.type);
|
||||
} else {
|
||||
var data = newcanvas.toDataURL("image/jpeg", ($this.options.quality * .01));
|
||||
}
|
||||
|
||||
// CALLBACK
|
||||
$this.options.callback(data, newcanvas.width, newcanvas.height);
|
||||
|
||||
// });
|
||||
};
|
||||
img.src = dataURL;
|
||||
// =====================================================
|
||||
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
//reader.readAsBinaryString(file);
|
||||
|
||||
}
|
||||
};
|
||||
$[pluginName] = function(file, options) {
|
||||
// console.log(file.size);
|
||||
if (typeof file === 'string')
|
||||
return methods[file](options);
|
||||
else
|
||||
new Plugin(file, options);
|
||||
};
|
||||
|
||||
})(window);
|
110
static/app2/js/cash-out.js
Executable file
110
static/app2/js/cash-out.js
Executable file
@ -0,0 +1,110 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
mui.plusReady(function() {
|
||||
//获取数值
|
||||
$('.bg').css("display", 'none')
|
||||
var self = plus.webview.currentWebview()
|
||||
var shopId = self.id;
|
||||
var totlemoney = "";
|
||||
JZL.ajax(qlgUrl('app/users/getMoney'), {
|
||||
type: 3
|
||||
}, function(data) {
|
||||
if (1 == data.status) {
|
||||
var data = data.data;
|
||||
totlemoney = data.wangNum;
|
||||
// $('.idc-total span').html('¥'+data.wangNum)
|
||||
$('#money').val(totlemoney)
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
$('.btns').on('tap', '.sqtx', function() {
|
||||
if ($('#money').val() > totlemoney) {
|
||||
mui.alert("超过最大提现金额")
|
||||
return;
|
||||
} else if ('' == $('#money').val()) {
|
||||
mui.alert("请输入提现金额")
|
||||
return;
|
||||
} else if (1 > $('#money').val()) {
|
||||
mui.alert("提现金额不能小于1")
|
||||
return;
|
||||
}
|
||||
$('.bg').css('display', 'block');
|
||||
$('.footer').hide();
|
||||
JZL.ajax(qlgUrl('app/shops/getBank'), {
|
||||
shopId: shopId
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
var data = data.data
|
||||
$('#bankUserName').val(data.accountName)
|
||||
// $('.bankname').prepend('<option value="' + data.bankName + '">' + data.bankName + '</option>')
|
||||
$('.bankname').val(data.bankName)
|
||||
$('#cardnum').val(data.bankNo)
|
||||
$('#money').on('focus', function() {
|
||||
$('.bg').css('display', 'none');
|
||||
$('.footer').show();
|
||||
})
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
$('.bg').on('tap', '.qrtx', function() {
|
||||
// mui.prompt("请输入操作密码:")
|
||||
mui.prompt('请输入操作密码', '', '全亮共商城', ['取消', '忘记密码', '确定'], function(e) {
|
||||
//console.log(e);
|
||||
if (2 == e.index) {
|
||||
var payPwd = e.value;
|
||||
if ('' == payPwd) {
|
||||
mui.alert('密码不能为空')
|
||||
return;
|
||||
}
|
||||
var money = $('#money').val();
|
||||
JZL.ajax(qlgUrl('app/shops/withdrawal'), {
|
||||
payPwd: payPwd,
|
||||
money: money,
|
||||
shopId: shopId
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
mui.toast(data.msg)
|
||||
mui.back()
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
} else if (1 == e.index) {
|
||||
JZL.openWindow('setting_fogetPwd.html', 'setting_fogetPwd.html')
|
||||
}
|
||||
|
||||
}, 'div')
|
||||
document.querySelector('.mui-popup-input input').type = 'password'
|
||||
|
||||
// var mark=mui.prompt("请输入操作密码:")
|
||||
// //console.log(document.querySelector('.mui-popup-input input').value)
|
||||
// if(null!=mark){
|
||||
// var payPwd =document.getElementById('mark')
|
||||
// //console.log(payPwd);
|
||||
// }
|
||||
})
|
||||
$('.bg').on('tap', '.mui-icon-left-nav', function() {
|
||||
$('.bg').css('display', 'none');
|
||||
$('.footer').show();
|
||||
})
|
||||
})
|
||||
|
||||
$('.btns').on('tap', '.ckmx', function() {
|
||||
JZL.openWindow("vouchers.html", "vouchers.html", {
|
||||
data_href: "wang",
|
||||
isExpected: 1
|
||||
})
|
||||
})
|
||||
})
|
316
static/app2/js/choiceness.js
Executable file
316
static/app2/js/choiceness.js
Executable file
@ -0,0 +1,316 @@
|
||||
$('.mui-slider-indicator').html('')
|
||||
|
||||
mui.init({
|
||||
pullRefresh: {
|
||||
container: '#pullrefresh',
|
||||
down: {
|
||||
style: 'circle', //必选,下拉刷新样式,目前支持原生5+ ‘circle’ 样式
|
||||
color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
|
||||
height: '50px', //可选,默认50px.下拉刷新控件的高度,
|
||||
range: '100px', //可选 默认100px,控件可下拉拖拽的范围
|
||||
offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
|
||||
// auto: true, //可选,默认false.首次加载自动上拉刷新一次
|
||||
contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
|
||||
contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
|
||||
contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
|
||||
callback: pulldownRefresh //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
|
||||
},
|
||||
up: {
|
||||
contentrefresh: '正在加载...',
|
||||
callback: pullupRefresh
|
||||
}
|
||||
}
|
||||
});
|
||||
var count = 1;
|
||||
|
||||
function pullupRefresh() {
|
||||
count += 1;
|
||||
////console.log(count)
|
||||
setTimeout(function() {
|
||||
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
|
||||
|
||||
// //console.log(order_class)
|
||||
mui.ajax(qlgUrl('addon/hyhchosen-Hyhchosen-getChosen'), {
|
||||
|
||||
data: {
|
||||
page: count,
|
||||
goodsSize: 3,
|
||||
pagesize: 10
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
// //console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
if (data.Rows.length == 0) {
|
||||
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
|
||||
return;
|
||||
}
|
||||
var html = ''
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId +
|
||||
'"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName +
|
||||
'</p><p class="time">' + this.newTime +
|
||||
'</p><div class="btn_gz">+ 关注</div></div><div class="b_con clearfix">';
|
||||
|
||||
$.each(this.goods, function() {
|
||||
|
||||
html += '<div data-goodsId="' + this.goodsId + '" class="bc_img"><img src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" /><p>¥' + this.shopPrice + '</p></div>';
|
||||
});
|
||||
html += '</div></div>'
|
||||
});
|
||||
$('.con').append(html);
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
////console.log(data.status)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉刷新具体业务实现
|
||||
*/
|
||||
function pulldownRefresh() {
|
||||
setTimeout(function() {
|
||||
window.location.reload();
|
||||
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
|
||||
}, 1500);
|
||||
}
|
||||
mui.plusReady(function() {
|
||||
function openAds(item) {
|
||||
if (item.attr('data-adURL') == '' || item.attr('data-targetType') == 0) {
|
||||
return;
|
||||
}
|
||||
var adURL = item.attr('data-adURL');
|
||||
var targetType = '';
|
||||
var data_set = {};
|
||||
if (item.attr('data-targetType') == 1) {
|
||||
//商品
|
||||
targetType = 'details.html';
|
||||
data_set = {
|
||||
data_id: adURL
|
||||
}
|
||||
} else if (item.attr('data-targetType') == 2) {
|
||||
//商家
|
||||
targetType = 'storeout.html';
|
||||
|
||||
if (adURL == 1) {
|
||||
// targetType='self_shop.html';
|
||||
}
|
||||
data_set = {
|
||||
shopId: adURL
|
||||
}
|
||||
} else if (item.attr('data-targetType') == 3) {
|
||||
//活动
|
||||
targetType = adURL + '.html';
|
||||
}
|
||||
mui.openWindow({
|
||||
url: targetType,
|
||||
id: targetType + adURL,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: data_set,
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
var data = '';
|
||||
mui.ajax(qlgUrl('addon/hyhchosen-Hyhchosen-getChosen'), {
|
||||
data: {
|
||||
pagesize: 10,
|
||||
goodsSize: 3,
|
||||
page: 1
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
|
||||
data = data.data;
|
||||
|
||||
var html = '';
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId +
|
||||
'"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName +
|
||||
'</p><p class="time">' + this.newTime +
|
||||
'</p><div class="btn_gz">+ 关注</div></div><div class="b_con clearfix">';
|
||||
|
||||
$.each(this.goods, function() {
|
||||
html += '<div data-goodsId="' + this.goodsId + '" class="bc_img"><img src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" /><p>¥' + this.shopPrice + '</p></div>';
|
||||
});
|
||||
html += '</div></div>'
|
||||
});
|
||||
$('.con').html(html)
|
||||
if (data.chosenAdsList.length != 0) {
|
||||
var html1 = '<div class="mui-slider-group mui-slider-loop"><div data-adId="' + data.chosenAdsList[data.chosenAdsList
|
||||
.length - 1].adId + '" class="mui-slider-item mui-slider-item-duplicate"><a href="#"><img src="' +
|
||||
hyhImgUrl(data.chosenAdsList[data.chosenAdsList.length - 1].adFile) + '"></a></div>';
|
||||
var html2 = '<div class="mui-slider-indicator">';
|
||||
$.each(data.chosenAdsList, function() {
|
||||
html1 += '<div data-adId="' + this.adId + '"data-adURL="' + this.adURL + '"data-targetType="' + this.targetType +
|
||||
'" class="mui-slider-item "><a href="#"><img src="' + hyhImgUrl(this.adFile) + '"></a></div>'
|
||||
html2 += '<div class="mui-indicator"></div>'
|
||||
})
|
||||
html2 += '</div>'
|
||||
html1 += '<div data-adId="' + data.chosenAdsList[0].adId + '"data-adURL="' + data.chosenAdsList[0].adURL +
|
||||
'"data-targetType="' + data.chosenAdsList[0].targetType +
|
||||
'" class="mui-slider-item mui-slider-item-duplicate"><a href="#"><img src="' + hyhImgUrl(data.chosenAdsList[
|
||||
0].adFile) + '"></a></div></div>'
|
||||
html1 += html2;
|
||||
$('#slider').html(html1);
|
||||
|
||||
mui("#slider").slider({
|
||||
interval: 5000
|
||||
});
|
||||
document.getElementsByClassName('mui-indicator')[0].className += ' mui-active';
|
||||
}
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
mui('.con').on('tap', '.storename', function() {
|
||||
var shopId = $(this).parent().attr('data-shopId');
|
||||
var url = 'storeout.html';
|
||||
if (shopId == 1) {
|
||||
// url='self_shop.html'
|
||||
}
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url + shopId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
shopId: shopId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
mui('.con').on('tap', '.bc_img', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + goodsId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodsId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
mui('.con').on('tap', '.btn_gz', function() {
|
||||
var shopId = $(this).parent().attr('data-shopId');
|
||||
var that = $(this);
|
||||
mui.ajax(hyhUrl('app/Favorites/add'), {
|
||||
|
||||
data: {
|
||||
id: shopId,
|
||||
type: 1
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
// //console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
that.html('已关注');
|
||||
that.addClass('btn_gz1').removeClass('btn_gz');
|
||||
} else {
|
||||
mui.alert(data.msg) ////console.log(data.status)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
//轮播图跳转
|
||||
$('#slider').on('tap', '.mui-slider-item', function() {
|
||||
openAds($(this));
|
||||
})
|
||||
|
||||
})
|
129
static/app2/js/classify.js
Executable file
129
static/app2/js/classify.js
Executable file
@ -0,0 +1,129 @@
|
||||
function classInfo(parentId) {
|
||||
mui.ajax(hyhUrl('app/goodscats/getGoodsCat'), {
|
||||
data: {
|
||||
parentId: parentId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html1 = '';
|
||||
data = data.data;
|
||||
$.each(data, function() {
|
||||
|
||||
html1 += '<div class="r_block clearfix" data-catId="' + this.catId + '"><div class="rb_title">' + this.catName + '</div></div>';
|
||||
|
||||
});
|
||||
$('.con_right .mui-scroll').html(html1);
|
||||
|
||||
$('.r_block').each(function() {
|
||||
var parentId2 = $(this).attr('data-catId');
|
||||
var that = $(this);
|
||||
mui.ajax(hyhUrl('app/goodscats/getGoodsCat'), {
|
||||
data: {
|
||||
parentId: parentId2
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
data = data.data;
|
||||
var html2 = '';
|
||||
$.each(data, function() {
|
||||
html2 += '<div class="rb_block" data-catId="' + this.catId + '"><img src="' + hyhImgUrl(this.catImg) + '" /><p>' + this.catName + '</p></div>';
|
||||
});
|
||||
|
||||
that.append(html2);
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
$('.rb_block img').height($('.rb_block img').width())
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
mui.plusReady(function() {
|
||||
|
||||
$('.con_left').on('tap', '.left_row', function() {
|
||||
var classify = $(this).attr('data-catId');
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
$('.rb_block img').height($('.rb_block img').width())
|
||||
classInfo(classify)
|
||||
})
|
||||
|
||||
mui.ajax(hyhUrl('app/goodscats/getGoodsCat'), {
|
||||
data: {
|
||||
parentId: 0
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
data = data.data;
|
||||
$.each(data, function() {
|
||||
html += '<div class="left_row" data-catId="' + this.catId + '">' + this.catName + '</div>'
|
||||
|
||||
});
|
||||
$('.con_left .mui-scroll').html(html);
|
||||
document.getElementsByClassName('left_row')[0].className += ' on';
|
||||
var parentId1 = document.getElementsByClassName('left_row')[0].attributes["data-catId"].nodeValue;
|
||||
classInfo(parentId1)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
$('.con_right .mui-scroll').on('tap', '.rb_block', function() {
|
||||
var catId = $(this).attr('data-catId');
|
||||
mui.openWindow({
|
||||
url: 'goodsList.html',
|
||||
id: 'goodsList.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_catId: catId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
77
static/app2/js/collect.js
Executable file
77
static/app2/js/collect.js
Executable file
@ -0,0 +1,77 @@
|
||||
jumpPage();
|
||||
|
||||
function jumpPage() {
|
||||
//跳转页面
|
||||
// localStorage.setItem('order_class', data_href);
|
||||
var bSize = 64 + (+localStorage.getItem('ipxSizeTop')) + 'px';
|
||||
var subpages = ['collect_commodity.html', 'collect_store.html'];
|
||||
var subpage_style = {
|
||||
top: bSize,
|
||||
bottom: '0px',
|
||||
scrollIndicator: 'none'
|
||||
};
|
||||
|
||||
var aniShow = {}; //动画显示
|
||||
//当前激活选项
|
||||
var activeTab = subpages[0];
|
||||
//选项卡点击事件
|
||||
mui('.nav').on('tap', 'a', function(e) {
|
||||
var targetTab = this.getAttribute('href');
|
||||
if(targetTab == activeTab) {
|
||||
return;
|
||||
}
|
||||
//显示目标选项卡
|
||||
//若为iOS平台或非首次显示,则直接显示
|
||||
if(mui.os.ios || aniShow[targetTab]) {
|
||||
plus.webview.show(targetTab);
|
||||
|
||||
} else {
|
||||
//否则,使用fade-in动画,且保存变量
|
||||
var temp = {};
|
||||
temp[targetTab] = "true";
|
||||
mui.extend(aniShow, temp);
|
||||
plus.webview.show(targetTab, "fade-in", 300);
|
||||
}
|
||||
//隐藏当前;
|
||||
plus.webview.hide(activeTab);
|
||||
//更改当前活跃的选项卡
|
||||
activeTab = targetTab;
|
||||
if(targetTab == 'collect_commodity.html') {
|
||||
document.getElementsByClassName('p1')[1].classList.remove('on')
|
||||
this.classList.add('on');
|
||||
}
|
||||
if(targetTab == 'collect_store.html') {
|
||||
document.getElementsByClassName('p1')[0].classList.remove('on')
|
||||
this.classList.add('on');
|
||||
}
|
||||
});
|
||||
|
||||
//首次启动切滑效果
|
||||
mui.plusReady(function() {
|
||||
// launchScreen();
|
||||
// plus.navigator.setStatusBarStyle('dark');
|
||||
// console.log(plus.navigator.getStatusBarStyle())
|
||||
var self = plus.webview.currentWebview();
|
||||
|
||||
for(var i = 0; i < subpages.length; i++) {
|
||||
var temp = {};
|
||||
//http://www.html5plus.org/doc/zh_cn/webview.html#plus.webview.create
|
||||
var sub = plus.webview.create(subpages[i], subpages[i], subpage_style);
|
||||
if(i > 0) {
|
||||
sub.hide();
|
||||
} else {
|
||||
temp[subpages[i]] = "true";
|
||||
mui.extend(aniShow, temp); //合并对象
|
||||
}
|
||||
self.append(sub);
|
||||
}
|
||||
var data_href = self.data_href;
|
||||
if(data_href == 'collect_store.html') {
|
||||
var defaultTab = document.getElementsByClassName("p1")[1];
|
||||
//模拟首页点击
|
||||
mui.trigger(defaultTab, 'tap');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
129
static/app2/js/collect_commodity.js
Executable file
129
static/app2/js/collect_commodity.js
Executable file
@ -0,0 +1,129 @@
|
||||
mui.plusReady(function() {
|
||||
var page = 1;
|
||||
var isjiazai = 1;
|
||||
|
||||
function getData(page, pagesize) {
|
||||
var setdata = {
|
||||
page: page,
|
||||
pagesize: pagesize
|
||||
}
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
}
|
||||
isjiazai = 0;
|
||||
mui.ajax(hyhUrl('app/favorites/listGoodsQuery'), {
|
||||
|
||||
data: setdata,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.data.goodsFavoritesNum)
|
||||
// console.log(data.data.Rows)
|
||||
|
||||
var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '';
|
||||
if(data.Rows == '') {
|
||||
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="row shadown_wai clearfix"><img src="' + hyhImgUrl(this.goodsImg) + '" /><div class="row_r" data-favoriteId="'+ this.favoriteId +'" data-goodsId="' + this.goodsId + '"><p class="sctitle">' + this.goodsName + '</p><div class="cost">¥' + this.shopPrice + '</div><button class="qxsc">取消收藏</button></div></div>'
|
||||
});
|
||||
if(page == "1") {
|
||||
$('.con').html(html);
|
||||
} else {
|
||||
$('.con').append(html);
|
||||
}
|
||||
isjiazai = 1;
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
getData(page, 10);
|
||||
//下拉加载
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getData(page, 10)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
//商品页调转
|
||||
mui(".con").on('tap', '.sctitle', function() {
|
||||
// var tj = plus.webview.create('search.html');
|
||||
// tj.show();
|
||||
// alert(e.target.attributes["data-id"].nodeValue);
|
||||
var data_id = $(this).parent().attr('data-goodsId');
|
||||
// console.log(this.attributes["data-id"].nodeValue);
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + data_id,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: data_id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//取消关注
|
||||
$('.con').on('tap', '.qxsc', function() {
|
||||
var favoriteId = $(this).parent().attr('data-favoriteId');
|
||||
var that = $(this);
|
||||
mui.ajax(hyhUrl('app/Favorites/cancel'), {
|
||||
|
||||
data: {
|
||||
id: favoriteId,
|
||||
type : 0
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.data.goodsFavoritesNum)
|
||||
// console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
alert(data.msg);
|
||||
location.reload();
|
||||
} else {
|
||||
//console.log(data.status)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
147
static/app2/js/collect_store.js
Executable file
147
static/app2/js/collect_store.js
Executable file
@ -0,0 +1,147 @@
|
||||
mui.plusReady(function() {
|
||||
var page = 1;
|
||||
var isjiazai = 1;
|
||||
|
||||
function getData(page, pagesize) {
|
||||
var setdata = {
|
||||
page: page,
|
||||
pagesize: pagesize
|
||||
}
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
}
|
||||
isjiazai = 0;
|
||||
mui.ajax(hyhUrl('app/favorites/listShopQuery'), {
|
||||
|
||||
data: setdata,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.data.goodsFavoritesNum)
|
||||
// console.log(data.data.Rows)
|
||||
|
||||
var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '';
|
||||
if(data.Rows == '') {
|
||||
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多</p>');
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="row shadown_wai"><div class="row_title"><img class="img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="s_t" data-shopId="' + this.shopId + '">' + this.shopName + '</p><button class="qxsc" data-favoriteId="' + this.favoriteId + '">取消收藏</button></div></div></div>';
|
||||
});
|
||||
if(page == "1") {
|
||||
$('.con').html(html);
|
||||
} else {
|
||||
$('.con').append(html);
|
||||
}
|
||||
|
||||
isjiazai = 1;
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
getData(page, 10);
|
||||
|
||||
//下拉加载
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getData(page, 10)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
//店铺跳转
|
||||
mui(".con").on('tap', '.s_t', function() {
|
||||
// var tj = plus.webview.create('search.html');
|
||||
// tj.show();
|
||||
// mui.alert(e.target.attributes["data-id"].nodeValue);
|
||||
var shopId = this.attributes["data-shopId"].nodeValue;
|
||||
// console.log(this.attributes["data-id"].nodeValue);
|
||||
var url = 'storeout.html';
|
||||
if(shopId==1){
|
||||
url='self_shop.html'
|
||||
}
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url+shopId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
shopId: shopId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//取消关注
|
||||
$('.con').on('tap', '.qxsc', function() {
|
||||
var favoriteId = $(this).attr('data-favoriteId');
|
||||
var that = $(this);
|
||||
mui.ajax(hyhUrl('app/Favorites/cancel'), {
|
||||
|
||||
data: {
|
||||
id: favoriteId,
|
||||
type : 1
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.data.goodsFavoritesNum)
|
||||
// console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
mui.alert(data.msg);
|
||||
location.reload();
|
||||
} else {
|
||||
//console.log(data.status)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
// mui('.con').on('tap', '.img_btn', function() {
|
||||
//
|
||||
// if($(this).attr('src') == '../img/sanjiaoshang.png') {
|
||||
// $(this).parent().siblings('.row_con').css('display', 'none');
|
||||
// $(this).attr('src', '../img/sanjiaoxia.png')
|
||||
// } else {
|
||||
// $(this).parent().siblings('.row_con').css('display', 'block');
|
||||
// $(this).attr('src', '../img/sanjiaoshang.png')
|
||||
// }
|
||||
//
|
||||
// })
|
||||
|
||||
})
|
222
static/app2/js/commercial.js
Executable file
222
static/app2/js/commercial.js
Executable file
@ -0,0 +1,222 @@
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
//console.log(self);
|
||||
|
||||
|
||||
var id = self.ssid ? self.ssid : '';
|
||||
JZL.ajax(qlgUrl('app/shops/getUserUpdate'), {
|
||||
applyLevel: 3
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status & undefined != data.data) {
|
||||
var data = data.data;
|
||||
|
||||
if (0 == data.status || 2 == data.status) {
|
||||
if (id == '') {
|
||||
id = data.id
|
||||
}
|
||||
getShopList(data.shopId);
|
||||
|
||||
$('#confirm').attr('src', hyhImgUrl(data.confirmImg))
|
||||
$('#confirmImg').val(data.confirmImg)
|
||||
|
||||
var imgs = data.shopImg
|
||||
imgs = Array.from(imgs.split(','))
|
||||
//console.log(imgs);
|
||||
var html = "";
|
||||
var html1 = '';
|
||||
mui.each(imgs, function(index, element) {
|
||||
//console.log(index, element);
|
||||
html += '<div class="galleryImg photo" data-id="' + index +
|
||||
'" ><div class="delete" data-id="' + index + '"><img src="../img/close.png" alt=""></div><img src="' +
|
||||
hyhImgUrl(element) + '" class="ossfile" data-src="' + element + '" data-id="' + index + '" id="galleryImg[' +
|
||||
index +
|
||||
']" alt=""><input type="hidden" name="gallery[]" value="' + element +
|
||||
'" class="gallery" id="gallery[' + index + ']"><span class=""></span></div>';
|
||||
})
|
||||
// $(".batchImg").html(html);
|
||||
|
||||
// var maxNum = $('.galleryImg').last().attr('data-id'); //$('.batchImg').children('.galleryImg').length - 1;
|
||||
var maxNum = imgs.length;
|
||||
|
||||
|
||||
// if (num == maxNum) {
|
||||
// maxNum++;
|
||||
html += '<div class="galleryImg photo" data-id="' + maxNum +
|
||||
'" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[' +
|
||||
maxNum + ']" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[' + maxNum +
|
||||
']"><span class=""></span></div>';
|
||||
$(".batchImg").html(html);
|
||||
// }
|
||||
|
||||
//获取协议
|
||||
JZL.ajax(qlgUrl('app/Tags/articleDetail'), {
|
||||
articleId: 116
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
// if (1==data.status) {
|
||||
// $('.zcxycontent').html(data.data.articleContent)
|
||||
$('.zcxycontent').html(data.articleContent)
|
||||
|
||||
// }
|
||||
|
||||
})
|
||||
|
||||
} else if (1 == data.status) {
|
||||
//tiaozhuandao shangdu yemian
|
||||
}
|
||||
} else {
|
||||
getShopList();
|
||||
JZL.ajax(qlgUrl('app/Tags/articleDetail'), {
|
||||
articleId: 116
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
// if (1==data.status) {
|
||||
// $('.zcxycontent').html(data.data.articleContent)
|
||||
$('.zcxycontent').html(data.articleContent)
|
||||
|
||||
// }
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 上传图片
|
||||
$('.photos_con').on('tap', '.confirm', function() {
|
||||
UP.init("confirmImg", "test", "confirm")
|
||||
openCamera()
|
||||
})
|
||||
// 获取店铺信息
|
||||
|
||||
function getShopList(defaultShopId) {
|
||||
|
||||
JZL.ajax(qlgUrl('app/shops/userShopList'), {
|
||||
shopType: 1
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
var html = "";
|
||||
html = `<option value ="">选择店铺</option>`;
|
||||
if (undefined == typeof defaultShop) {
|
||||
|
||||
mui.each(data.data, function() {
|
||||
// //console.log(index, element);
|
||||
html += `<option value =${this.shopId}>${this.shopName}</option>`;
|
||||
})
|
||||
} else {
|
||||
mui.each(data.data, function() {
|
||||
if (this.shopId == defaultShopId) {
|
||||
selected = 'selected';
|
||||
} else {
|
||||
selected = '';
|
||||
}
|
||||
html += `<option value =${this.shopId} ${selected}>${this.shopName}</option>`;
|
||||
})
|
||||
|
||||
}
|
||||
$("#shopId").html(html)
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
// })
|
||||
})
|
||||
}
|
||||
|
||||
$(".batchImg").on("tap", '.galleryImg', function() {
|
||||
var num = $(this).attr('data-id');
|
||||
UP.init("gallery[" + num + "]", "test", "galleryImg[" + num + "]", 1);
|
||||
var that = $(this);
|
||||
openCamera(function(t, status, fileName, serverName) {
|
||||
var html = '<div class="delete" data-id="' + num + '"><img src="../img/close.png" alt=""></div><img src="' +
|
||||
serverName + '" class="ossfile" data-src="' + fileName + '" data-id="' + num + '" id="galleryImg[' + num +
|
||||
']" alt=""><input type="hidden" name="gallery[]" value="' + fileName +
|
||||
'" class="gallery" id="gallery[' + num + ']"><span class=""></span>';
|
||||
|
||||
that.html(html);
|
||||
|
||||
var maxNum = $('.galleryImg').last().attr('data-id'); //$('.batchImg').children('.galleryImg').length - 1;
|
||||
if (num == maxNum) {
|
||||
maxNum++;
|
||||
html = '<div class="galleryImg photo" data-id="' + maxNum +
|
||||
'" ><img src="../img/pjimg.png" class="ossfile" id="galleryImg[' +
|
||||
maxNum + ']" alt=""><input type="hidden" name="gallery[]" value="" class="gallery" id="gallery[' + maxNum +
|
||||
']"><span class=""></span></div>';
|
||||
$(".batchImg").append(html);
|
||||
}
|
||||
});
|
||||
})
|
||||
//删除照片
|
||||
$(".batchImg").on('tap', '.delete', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation()
|
||||
|
||||
// //console.log(this);
|
||||
var that = $(this)
|
||||
//var idx = that.parent().attr('data-id');
|
||||
//var maxNum = $('.galleryImg').last().attr('data-id'); //$('.batchImg').children('.galleryImg').length - 1;
|
||||
if (confirm('确认删除图片?')) {
|
||||
that.parent().remove()
|
||||
//delete galleryarr[idx];
|
||||
}
|
||||
})
|
||||
//获取协议
|
||||
JZL.ajax(qlgUrl('app/Tags/articleDetail'), {
|
||||
articleId: 116
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
// if (1==data.status) {
|
||||
// $('.zcxycontent').html(data.data.articleContent)
|
||||
$('.zcxycontent').html(data.articleContent)
|
||||
|
||||
// }
|
||||
|
||||
})
|
||||
var click = 0;
|
||||
$('.down').on('tap', '.btn', function() {
|
||||
|
||||
if (click == 1) {
|
||||
return;
|
||||
}
|
||||
click = 1
|
||||
var imgs = '';
|
||||
var data = $('input[name="gallery[]"]');
|
||||
//console.log(data);
|
||||
$.each(data, function() {
|
||||
if ('' != $(this).val())
|
||||
imgs = $(this).val() + ',' + imgs;
|
||||
})
|
||||
imgs = imgs.substring(0, imgs.lastIndexOf(','));
|
||||
$('#shopImg').val(imgs);
|
||||
if ('' == $('#shopId option:selected').val()) {
|
||||
mui.alert('请选择要升级的店铺名称')
|
||||
return;
|
||||
}
|
||||
|
||||
if ('' == $('#confirmImg').val()) {
|
||||
mui.alert('请上传确认书照片')
|
||||
return;
|
||||
}
|
||||
if ('' == $('#shopImg').val()) {
|
||||
mui.alert('请上传店铺照片')
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var params = JZL.getParams(".inp");
|
||||
params.applyLevel = 3;
|
||||
if ("" != id) {
|
||||
params.id = id;
|
||||
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/shops/userUpdate'), params, function(data) {
|
||||
// //console.log(data);
|
||||
if (1 == data.status) {
|
||||
mui.back()
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
479
static/app2/js/common.js
Executable file
479
static/app2/js/common.js
Executable file
@ -0,0 +1,479 @@
|
||||
var is_online = 1;
|
||||
var is_app = 1;
|
||||
var imgUrl = 'http://img.zgqlg.com.cn/';
|
||||
var webUrl = 'http://t.ect99.com/';
|
||||
var webUrl1 = 'http://t.ect99.com/';
|
||||
var cssUrl = localStorage.getItem("cssUrl");
|
||||
var jsUrl = localStorage.getItem("jsUrl");
|
||||
var version = localStorage.getItem("version");
|
||||
if (0 == is_online) {
|
||||
webUrl = 'http://192.168.1.111/';
|
||||
}
|
||||
|
||||
function qlgUrl(url) {
|
||||
return webUrl + url;
|
||||
}
|
||||
|
||||
function hyhUrl(url) {
|
||||
return webUrl + url;
|
||||
}
|
||||
|
||||
function llUrl(url) {
|
||||
return webUrl + url;
|
||||
}
|
||||
|
||||
function hgUrl(url) {
|
||||
return webUrl + url;
|
||||
}
|
||||
|
||||
function kxUrl(url) {
|
||||
return webUrl + url;
|
||||
}
|
||||
|
||||
function hyhImgUrl(url) {
|
||||
return imgUrl + url;
|
||||
}
|
||||
|
||||
function ectUrl(url) {
|
||||
return webUrl + url;
|
||||
}
|
||||
|
||||
function ectImgUrl(url) {
|
||||
return imgUrl + url;
|
||||
}
|
||||
|
||||
function cssUrl(url) {
|
||||
return '../css/' + url;
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
var d = new Date(date),
|
||||
|
||||
month = '' + (d.getMonth() + 1),
|
||||
day = '' + d.getDate(),
|
||||
year = d.getFullYear(),
|
||||
hour = d.getHours(),
|
||||
minute =d.getMinutes(),
|
||||
second = d.getSeconds();
|
||||
console.log(hour );
|
||||
if (month.length < 2) month = '0' + month;
|
||||
if (day.length < 2) day = '0' + day;
|
||||
if (hour< 10) hour = '0' + hour;
|
||||
if (minute< 10) minute = '0' + minute;
|
||||
if (second < 10) second = '0' + second;
|
||||
// return [year, month, day].join('-')+" "+[hour,minute,second].join(':');
|
||||
return year+"年"+month +"月"+day+"日";
|
||||
}
|
||||
|
||||
function backTop() {
|
||||
mui('.mui-scroll-wrapper').scroll().scrollTo(0, 0, 0);
|
||||
}
|
||||
function bMapTransQQMap(lng, lat) {
|
||||
var x_pi = 3.14159265358979324 * 3000.0 / 180.0;
|
||||
var x = lng - 0.0065;
|
||||
var y = lat - 0.006;
|
||||
var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
|
||||
var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
|
||||
var lngs = z * Math.cos(theta);
|
||||
var lats = z * Math.sin(theta);
|
||||
|
||||
return {
|
||||
lng: lngs,
|
||||
lat: lats
|
||||
}
|
||||
}
|
||||
function toJson(str, notLimit) {
|
||||
var json = {};
|
||||
if (str) {
|
||||
try {
|
||||
if (typeof(str) == "object") {
|
||||
json = str;
|
||||
} else {
|
||||
json = eval("(" + str + ")");
|
||||
}
|
||||
if(json.status && (json.status == '-555' || json.status == '-666')){
|
||||
//topingzheng
|
||||
var type = 0;
|
||||
if(json.status == '-666') type = 1;
|
||||
JZL.openWindow("paymentVoucher.html",json.data.shopId,{'type':type});
|
||||
}
|
||||
if (!notLimit) {
|
||||
if (json.status && json.status == '-999') {
|
||||
//console.log(str.msg)
|
||||
inLogin();
|
||||
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
mui.alert("系统发生错误:" + e.getMessage);
|
||||
json = {};
|
||||
}
|
||||
return json;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var JZL = JZL || {};
|
||||
JZL.js_init = function(cdn) {
|
||||
var typeName = 'script';
|
||||
var type = 'text/javascript';
|
||||
var element, i = 0,
|
||||
file, parent = document.body;
|
||||
|
||||
for (i; i < cdn.length; i++) {
|
||||
file = cdn[i];
|
||||
element = document.createElement(typeName);
|
||||
element.type = type;
|
||||
element.src = file;
|
||||
parent.appendChild(element);
|
||||
//free file's value
|
||||
file = null;
|
||||
}
|
||||
/*
|
||||
* Cleanup at end of function, which isn't necessary unless lots of memory is being
|
||||
* used up.
|
||||
* No point nulling a Number, however. In some ECMAScript implementations
|
||||
* (ActionScript 3), this throws a warning.
|
||||
*/
|
||||
//empty array
|
||||
cdn.splice(0, cdn.length);
|
||||
//clear variable values
|
||||
element = null;
|
||||
parent = null;
|
||||
cdn = null;
|
||||
}
|
||||
JZL.css_init = function(cdn) {
|
||||
var typeName = 'style';
|
||||
var type = 'text/css';
|
||||
var rel = 'stylesheet';
|
||||
var element, i = 0,
|
||||
file, head, parent = document.head || document.getElementsByTagName('head')[0];
|
||||
for (i; i < cdn.length; i++) {
|
||||
file = cdn[i];
|
||||
element = document.createElement('link');
|
||||
element.rel = rel;
|
||||
element.type = type;
|
||||
element.href = file;
|
||||
parent.appendChild(element);
|
||||
//free file's value
|
||||
file = null;
|
||||
}
|
||||
cdn.splice(0, cdn.length);
|
||||
element = null;
|
||||
parent = null;
|
||||
cdn = null;
|
||||
}
|
||||
JZL.getToken = function() {
|
||||
return localStorage.getItem('token');
|
||||
}
|
||||
JZL.getCssUrl = function(cssName) {
|
||||
return cssUrl + cssName + '?ver=' + version
|
||||
}
|
||||
JZL.getJsUrl = function(jsName) {
|
||||
return jsUrl + jsName + '?ver=' + version
|
||||
}
|
||||
JZL.openWindow = function(openUrl, openId, extras, targetUrl) {
|
||||
if (1 == is_app) {
|
||||
if (typeof(extras) == "undefined") extras = {};
|
||||
mui.openWindow({
|
||||
url: openUrl,
|
||||
id: openId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: extras,
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
location.href = targetUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JZL.closeWindow = function(closeId) {
|
||||
if (1 == is_app) {
|
||||
plus.webview.getWebviewById(closeId).close();
|
||||
}
|
||||
}
|
||||
|
||||
JZL.ajax = function(url, data, fnDeal, sendType, sendToken) {
|
||||
if (typeof(sendType) == "undefined") sendType = 'POST';
|
||||
if (typeof(sendToken) == "undefined") sendToken = 1;
|
||||
if (1 == sendToken)
|
||||
headers = {
|
||||
"HYH-Token": JZL.getToken()
|
||||
};
|
||||
else
|
||||
headers = {};
|
||||
// //console.log(JSON.stringify(headers))
|
||||
if (1 == is_app) {
|
||||
|
||||
mui.ajax(url, {
|
||||
headers: headers,
|
||||
data: data,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: sendType, //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(result) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
|
||||
if (typeof(fnDeal) != "undefined") {
|
||||
fnDeal(result);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(xhr+type+errorThrown);
|
||||
console.log(JSON.stringify(data));
|
||||
console.log(url);
|
||||
//mui.alert(xhr);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
$.ajax(url, {
|
||||
headers: headers,
|
||||
data: data,
|
||||
dataType: 'jsonp', //服务器返回json格式数据
|
||||
type: sendType, //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(result) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
if (typeof(fnDeal) != "undefined") {
|
||||
fnDeal(result);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(xhr+type+errorThrown);
|
||||
alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function inLogin() {
|
||||
JZL.openWindow('login.html', 'login.html');
|
||||
}
|
||||
|
||||
var scroll = mui('.mui-scroll-wrapper').scroll();
|
||||
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if (/iphone|ipad|ipod/.test(ua)) { //苹果手机
|
||||
if (document.getElementsByClassName('zhe')[0]) {
|
||||
document.getElementsByClassName('zhe')[0].style.display = 'none';
|
||||
}
|
||||
// document.getElementsByClassName('zhe')[0].style.display='none';
|
||||
} else if (/android/.test(ua)) {
|
||||
// document.getElementsByClassName('zhe')[0].style.display='block';
|
||||
if (document.getElementsByClassName('zhe')[0]) {
|
||||
document.getElementsByClassName('zhe')[0].style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
var hSize = 64 + (+localStorage.getItem('ipxSizeTop')) + 'px';
|
||||
var hPadding = 22 + (+localStorage.getItem('ipxSizeTop')) + 'px';
|
||||
$('.header').css('height', hSize);
|
||||
$('.header').css('padding-top', hPadding);
|
||||
$('.scroll_out_tb').css('top', hSize);
|
||||
$('.scroll_out_t').css('top', hSize);
|
||||
mui.plusReady(function() {
|
||||
plus.navigator.setStatusBarStyle('dark');
|
||||
})
|
||||
|
||||
mui('.nav').on('tap', '.nav_block', function() {
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
})
|
||||
|
||||
//打开广告
|
||||
function openAds(item) {
|
||||
if (item.attr('data-adURL') == '' || item.attr('data-targetType') == 0) {
|
||||
return;
|
||||
}
|
||||
var adURL = item.attr('data-adURL');
|
||||
var targetType = '';
|
||||
var data_set = {};
|
||||
if (item.attr('data-targetType') == 1) {
|
||||
//商品
|
||||
targetType = 'details.html';
|
||||
data_set = {
|
||||
data_id: adURL
|
||||
}
|
||||
} else if (item.attr('data-targetType') == 2) {
|
||||
//商家
|
||||
targetType = 'storeout.html';
|
||||
if (adURL == 1) {
|
||||
// targetType = 'self_shop.html'
|
||||
}
|
||||
data_set = {
|
||||
shopId: adURL
|
||||
}
|
||||
} else if (item.attr('data-targetType') == 3) {
|
||||
//活动
|
||||
targetType = adURL;
|
||||
data_set = {
|
||||
adURLId: adURL.split('?')[1]
|
||||
}
|
||||
}
|
||||
////console.log(item.attr('data-adURL'));
|
||||
JZL.openWindow(targetType, targetType + adURL, data_set);
|
||||
}
|
||||
|
||||
//返回顶部
|
||||
//var scrollToTopBox = document.getElementById('scrollToTop'); //返回按钮tap
|
||||
//scrollToTopBox.addEventListener('tap', function(e) {
|
||||
// e.stopPropagation();
|
||||
// mui('.mui-scroll-wrapper').scroll().scrollTo(0, 0, 100); //滚动到顶部
|
||||
//});
|
||||
// Android上监听原生滚动,iOS上监听div滚动,上拉超过一屏后显示按钮,否则隐藏,可自行在条件判断中修改
|
||||
//if(mui.os.android) {
|
||||
// window.addEventListener('scroll', function(e) {
|
||||
// if(window.pageYOffset >= window.innerHeight && scrollToTopBox.classList.contains('hide')) {
|
||||
// scrollToTopBox.classList.remove('hide');
|
||||
// } else if(window.pageYOffset < window.innerHeight && !scrollToTopBox.classList.contains('hide')) {
|
||||
// scrollToTopBox.classList.add('hide');
|
||||
// }
|
||||
// });
|
||||
//} else {
|
||||
// document.getElementsByClassName('mui-scroll-wrapper')[0].addEventListener('scroll', function() {
|
||||
// if(mui('.mui-scroll-wrapper').scroll().y <= window.innerHeight * (-1) && scrollToTopBox.classList.contains('hide')) {
|
||||
// scrollToTopBox.classList.remove('hide');
|
||||
// } else if(mui('.mui-scroll-wrapper').scroll().y > window.innerHeight * (-1) && !scrollToTopBox.classList.contains('hide')) {
|
||||
// scrollToTopBox.classList.add('hide');
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
JZL.saveItems = function(className, itemName) {
|
||||
var params = JZL.getParams(className);
|
||||
localStorage.setItem(itemName, JSON.stringify(params));
|
||||
}
|
||||
JZL.getItems = function(itemName) {
|
||||
var itemNames = localStorage.getItem(itemName);
|
||||
//if(null != itemNames)
|
||||
JZL.setValues(JSON.parse(itemNames));
|
||||
|
||||
}
|
||||
JZL.getParams = function(obj) {
|
||||
var params = {};
|
||||
var chk = {};
|
||||
var s;
|
||||
$(obj).each(function() {
|
||||
// //console.log($(this)[0]);
|
||||
if ($(this)[0].type == 'hidden' || $(this)[0].type == 'number' || $(this)[0].type == 'tel' || $(this)[0].type ==
|
||||
'password' || $(this)[0].type == 'select-one' || $(this)[0].type == 'textarea' || $(this)[0].type == 'text') {
|
||||
params[$(this).attr('id')] = $.trim($(this).val());
|
||||
} else if ($(this).is('img')) {
|
||||
// //console.log(1)
|
||||
params[$(this).attr('id')] = $.trim($(this).attr('data-src'));
|
||||
} else if ($(this)[0].type == 'radio') {
|
||||
if ($(this).attr('name')) {
|
||||
params[$(this).attr('name')] = $('input[name=' + $(this).attr('name') + ']:checked').val();
|
||||
}
|
||||
} else if ($(this)[0].type == 'checkbox') {
|
||||
if ($(this).attr('name') && !chk[$(this).attr('name')]) {
|
||||
s = [];
|
||||
chk[$(this).attr('name')] = 1;
|
||||
$('input[name=' + $(this).attr('name') + ']:checked').each(function() {
|
||||
s.push($(this).val());
|
||||
});
|
||||
params[$(this).attr('name')] = s.join(',');
|
||||
}
|
||||
}
|
||||
});
|
||||
chk = null, s = null;
|
||||
return params;
|
||||
}
|
||||
JZL.setValue = function(name, value) {
|
||||
|
||||
var first = name.substr(0, 1),
|
||||
input, i = 0,
|
||||
val;
|
||||
if ("#" === first || "." === first) {
|
||||
input = $(name);
|
||||
} else {
|
||||
input = $("[name='" + name + "']");
|
||||
}
|
||||
|
||||
if (input.eq(0).is(":radio")) { //单选按钮
|
||||
input.filter("[value='" + value + "']").each(function() {
|
||||
this.checked = true
|
||||
});
|
||||
} else if (input.eq(0).is(":checkbox")) { //复选框
|
||||
if (!$.isArray(value)) {
|
||||
val = new Array();
|
||||
val[0] = value;
|
||||
} else {
|
||||
val = value;
|
||||
}
|
||||
for (i = 0, len = val.length; i < len; i++) {
|
||||
input.filter("[value='" + val[i] + "']").each(function() {
|
||||
this.checked = true
|
||||
});
|
||||
}
|
||||
} else if (input.is('img')) { //图片
|
||||
|
||||
if (''!= value) {
|
||||
input.attr('src',hyhImgUrl(value));
|
||||
input.attr('data-src',value);
|
||||
}
|
||||
|
||||
} else { //其他表单选项直接设置值
|
||||
input.val(value);
|
||||
}
|
||||
|
||||
}
|
||||
JZL.setValues = function(obj) {
|
||||
var input, value, val;
|
||||
for (var key in obj) {
|
||||
if ($('#' + key)[0]) {
|
||||
JZL.setValue('#' + key, obj[key]);
|
||||
} else if ($("[name='" + key + "']")[0]) {
|
||||
JZL.setValue(key, obj[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 邮箱格式判断
|
||||
* @param str
|
||||
*/
|
||||
function checkEmail(str){
|
||||
var reg = /^[a-z0-9]([a-z0-9\\.]*[-_]{0,4}?[a-z0-9-_\\.]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+([\.][\w_-]+){1,5}$/i;
|
||||
if(reg.test(str)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 输入为空检查
|
||||
* @param name '#id' '.id' (name模式直接写名称)
|
||||
* @param type 类型 0 默认是id或者class方式 1 name='X'模式
|
||||
*/
|
||||
function is_empty(name,type){
|
||||
if(type == 1){
|
||||
if($('input[name="'+name+'"]').val() == ''){
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
if($(name).val() == ''){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
70
static/app2/js/common_home.js
Executable file
70
static/app2/js/common_home.js
Executable file
@ -0,0 +1,70 @@
|
||||
function hyhUrl(url) {
|
||||
return 'http://www.juzi199.com/' + url;
|
||||
}
|
||||
function hyhImgUrl(url) {
|
||||
return 'http://img.juzi199.com/' + url;
|
||||
}
|
||||
function chengUrl(url) {
|
||||
return 'http://www.juzi199.com/' + url;
|
||||
}
|
||||
|
||||
function toJson(str, notLimit) {
|
||||
var json = {};
|
||||
if(str) {
|
||||
try {
|
||||
if(typeof(str) == "object") {
|
||||
json = str;
|
||||
} else {
|
||||
json = eval("(" + str + ")");
|
||||
}
|
||||
if(!notLimit) {
|
||||
if(json.status && json.status == '-999') {
|
||||
// console.log(str.msg)
|
||||
inLogin();
|
||||
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
alert("系统发生错误:" + e.getMessage);
|
||||
json = {};
|
||||
}
|
||||
return json;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function inLogin() {
|
||||
mui.openWindow({
|
||||
url: 'login.html',
|
||||
id: 'login.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
// data_href: data_href
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
96
static/app2/js/compare.js
Executable file
96
static/app2/js/compare.js
Executable file
@ -0,0 +1,96 @@
|
||||
//加载对比商品
|
||||
function loadCompare(isrefresh) {
|
||||
$("#comparelist").load(HOMESITEURL + '/Compare/showcompare.html');
|
||||
return;
|
||||
if (!$("#comparelist").html()) {
|
||||
isrefresh = true;
|
||||
}
|
||||
if (isrefresh == true) {
|
||||
$("#comparelist").load(HOMESITEURL + '/Compare/showcompare.html');
|
||||
}
|
||||
}
|
||||
//添加对比商品
|
||||
function addCompare(gid) {
|
||||
gid = parseInt(gid);
|
||||
if (gid > 0) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: HOMESITEURL + '/Compare/addcompare.html?id=' + gid,
|
||||
async: false,
|
||||
success: function (data) {
|
||||
if (data.done == true) {
|
||||
$("[ds_type='compare_" + gid + "']").addClass('selected');
|
||||
loadCompare(true);
|
||||
$(".top #content-compare").animate({right: '40px'});
|
||||
} else {
|
||||
showDialog(data.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
showDialog('参数错误');
|
||||
}
|
||||
$("#lockcompare").val('unlock');//解除加入对比按钮的锁定
|
||||
}
|
||||
//清空对比栏
|
||||
function delCompare(gid, type) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: HOMESITEURL + '/Compare/delcompare?gid=' + gid + '&type=' + type,
|
||||
async: false,
|
||||
success: function (data) {
|
||||
if (data.done == true) {
|
||||
//将对比按钮置为未对比状态
|
||||
if (type == 'mini') {
|
||||
if (gid == 'all') {
|
||||
$("[ds_type^='compare_']").removeClass('selected');
|
||||
} else {
|
||||
$("[ds_type='compare_" + gid + "']").removeClass('selected');
|
||||
}
|
||||
}
|
||||
//加载对比信息
|
||||
if (type == 'mini') {
|
||||
//加载对比栏
|
||||
loadCompare(true);
|
||||
$("#content-compare").animate({right: '40px'});
|
||||
} else {
|
||||
go(HOMESITEURL + '/Compare/index/gids/' + data.gid_str);
|
||||
}
|
||||
}
|
||||
$("#lockcompare").val('unlock');//解除加入对比按钮的锁定
|
||||
}
|
||||
});
|
||||
}
|
||||
//初始加入对比按钮
|
||||
function initCompare() {
|
||||
//绑定对比按钮事件
|
||||
$("[ds_type^='compare_']").bind('click', function () {
|
||||
if ($("#lockcompare").val() == 'unlock') {
|
||||
$("#lockcompare").val('lock');//锁定加入对比按钮
|
||||
//处理参数
|
||||
var data_str = '';
|
||||
eval('data_str =' + $(this).attr('data-param'));
|
||||
var gid = data_str.gid;
|
||||
|
||||
if ($(this).hasClass('selected')) {
|
||||
$(this).removeClass('selected');
|
||||
//删除该对比商品
|
||||
delCompare(gid, 'mini');
|
||||
} else {
|
||||
//新增该对比商品
|
||||
addCompare(gid);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//根据是否已加入对比,显示不同样式
|
||||
$.getJSON(HOMESITEURL + '/Compare/checkcompare', function (data) {
|
||||
if (data) {
|
||||
$.each(data, function (i, val) {
|
||||
$("[ds_type='compare_" + val + "']").addClass('selected');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
156
static/app2/js/complain.js
Executable file
156
static/app2/js/complain.js
Executable file
@ -0,0 +1,156 @@
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
var self = plus.webview.currentWebview();
|
||||
var data_order_id = self.data_order_id;
|
||||
|
||||
mui.ajax(hyhUrl('app/Ordercomplains/getComplainCause'), {
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="0">选择投诉类型</option>';
|
||||
$.each(data, function() {
|
||||
html += '<option value="' + this.dataVal + '">' + this.dataName + '</option>';
|
||||
})
|
||||
$('select').html(html);
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
// //console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
var uploader = new plupload.Uploader({
|
||||
runtimes: 'html5,flash,silverlight,html4',
|
||||
browse_button: 'selectfiles',
|
||||
//multi_selection: false,
|
||||
// container: document.getElementById('container'),
|
||||
flash_swf_url: '../lib/plupload-2.1.2/js/Moxie.swf',
|
||||
silverlight_xap_url: '../lib/plupload-2.1.2/js/Moxie.xap',
|
||||
url: 'http://oss.aliyuncs.com',
|
||||
|
||||
filters: {
|
||||
mime_types: [ //只允许上传图片和zip,rar文件
|
||||
{
|
||||
title: "Image files",
|
||||
extensions: "jpg,gif,png,bmp"
|
||||
}
|
||||
],
|
||||
max_file_size: '10mb', //最大只能上传10mb的文件
|
||||
prevent_duplicates: true //不允许选取重复文件
|
||||
},
|
||||
|
||||
init: {
|
||||
PostInit: function() {
|
||||
document.getElementById('ossfile').innerHTML = '';
|
||||
// document.getElementById('postfiles').onclick = function() {
|
||||
// set_upload_param(uploader, '', false);
|
||||
// return false;
|
||||
// };
|
||||
uploader.bind('FilesAdded', function() {
|
||||
set_upload_param(uploader, '', false, 'complains');
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
FilesAdded: function(up, files) {
|
||||
plupload.each(files, function(file) {
|
||||
document.getElementById('ossfile').innerHTML += '<div class="files_out" id="' + file.id + '"><b></b>' +
|
||||
'<div class="progress"><div class="progress-bar" style="width: 60px"></div></div>' +
|
||||
'</div>';
|
||||
});
|
||||
},
|
||||
|
||||
BeforeUpload: function(up, file) {
|
||||
check_object_radio();
|
||||
set_upload_param(up, file.name, true);
|
||||
},
|
||||
|
||||
UploadProgress: function(up, file) {
|
||||
var d = document.getElementById(file.id);
|
||||
d.getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
|
||||
var prog = d.getElementsByTagName('div')[0];
|
||||
var progBar = prog.getElementsByTagName('div')[0]
|
||||
progBar.style.width = 2 * file.percent + 'px';
|
||||
progBar.setAttribute('aria-valuenow', file.percent);
|
||||
},
|
||||
|
||||
FileUploaded: function(up, file, info) {
|
||||
if (info.status == 200) {
|
||||
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<img data-src="' +
|
||||
get_uploaded_object_name(file.name) + '" src="' + hyhImgUrl(get_uploaded_object_name(file.name)) + '" />';
|
||||
} else {
|
||||
document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = info.response;
|
||||
}
|
||||
},
|
||||
|
||||
Error: function(up, err) {
|
||||
if (err.code == -600) {
|
||||
mui.alert("\n选择的文件太大了");
|
||||
} else if (err.code == -601) {
|
||||
mui.alert("\n选择的文件后缀不对");
|
||||
} else if (err.code == -602) {
|
||||
mui.alert("\n这个文件已经上传过一遍了");
|
||||
} else {
|
||||
mui.alert("\nError xml:" + err.response);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
uploader.init();
|
||||
|
||||
$('button').on('tap', function() {
|
||||
var complainType = $('select').val();
|
||||
var complainContent = $('textarea').val();
|
||||
var imagesArr = [];
|
||||
$('#ossfile').children('.files_out').children('b').children('img').each(function() {
|
||||
imagesArr.push($(this).attr('data-src'))
|
||||
})
|
||||
var images = imagesArr.join(',');
|
||||
if (complainType == 0) {
|
||||
mui.alert('请选择投诉原因!');
|
||||
return;
|
||||
}
|
||||
if (complainContent.length < 5) {
|
||||
mui.alert('投诉内容不小于5个字!');
|
||||
return;
|
||||
}
|
||||
var that = $(this);
|
||||
mui.ajax(hyhUrl('app/Ordercomplains/saveComplain'), {
|
||||
data: {
|
||||
orderId: data_order_id,
|
||||
complainType: complainType,
|
||||
complainContent: complainContent,
|
||||
complainAnnex: images
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
mui.alert('提交成功!');
|
||||
var targetTab = plus.webview.getWebviewById('complain.html');
|
||||
mui.fire(targetTab, 'refresh');
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
// //console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
})
|
717
static/app2/js/confirmOrder.js
Executable file
717
static/app2/js/confirmOrder.js
Executable file
@ -0,0 +1,717 @@
|
||||
//$('.pay_info .row_left').eq(0).html('桔子链账号');
|
||||
var wxChannel = null; // 微信支付
|
||||
var aliChannel = null; // 支付宝支付
|
||||
var channel = null; //支付通道
|
||||
mui.init();
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('setAddress', function(e) {
|
||||
var addressId = localStorage.getItem('addressId') ? localStorage.getItem('addressId') : 0;
|
||||
if (addressId == 0) {
|
||||
return;
|
||||
}
|
||||
mui.ajax(hyhUrl('app/useraddress/getById'), {
|
||||
data: {
|
||||
addressId: addressId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
// for(i in data.data){
|
||||
// //console.log(i)
|
||||
// //console.log(data.data[i])
|
||||
// }
|
||||
var html =
|
||||
'<div class="add_l"><img src="../img/dingwei1.png" /></div><div class="add_r"><div class="add_r_t clearfix"><div class="add_r_t_l">收货人:' +
|
||||
data.userName + '</div><div class="add_r_t_r">' + data.userPhone +
|
||||
'</div></div><div class="add_r_b">收货地址:' + data.areaName + ' ' + data.userAddress + '</div></div>';
|
||||
$('.address').html(html);
|
||||
$('.address').attr('data-addressId', data.addressId);
|
||||
$('.address').attr('data-areaId', data.areaId2);
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.con').on('tap', '.address', function() {
|
||||
var addressId = $(this).attr('data-addressId');
|
||||
localStorage.setItem('addressId', addressId);
|
||||
var isOrder = true;
|
||||
mui.openWindow({
|
||||
url: 'setting_address.html',
|
||||
id: 'setting_address.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_addressId: addressId,
|
||||
data_isOrder: isOrder
|
||||
|
||||
// data_href: data_href
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
//支付插件
|
||||
plus.payment.getChannels(function(channels) {
|
||||
for (var i in channels) {
|
||||
if (channels[i].id == "wxpay") {
|
||||
wxChannel = channels[i];
|
||||
} else {
|
||||
aliChannel = channels[i];
|
||||
}
|
||||
}
|
||||
}, function(e) {
|
||||
mui.alert("获取支付通道失败:" + e.message);
|
||||
});
|
||||
// var ALIPAYSERVER = 'http://demo.dcloud.net.cn/helloh5/payment/alipay.php?total=';
|
||||
var ALIPAYSERVER = hyhUrl('app/Alipays/toAlipay?isBatch=1&orderNo=');
|
||||
// 2. 发起支付请求
|
||||
function pay(id, orderNo) {
|
||||
// 从服务器请求支付订单
|
||||
var PAYSERVER = '';
|
||||
if (id == 'alipay') {
|
||||
PAYSERVER = ALIPAYSERVER;
|
||||
channel = aliChannel;
|
||||
} else if (id == 'wxpay') {
|
||||
PAYSERVER = WXPAYSERVER;
|
||||
channel = wxChannel;
|
||||
} else {
|
||||
plus.nativeUI.alert("不支持此支付通道!", null, "捐赠");
|
||||
return;
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
// var amount = 1;
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
switch (xhr.readyState) {
|
||||
case 4:
|
||||
if (xhr.status == 200) {
|
||||
plus.payment.request(channel, xhr.responseText, function(result) {
|
||||
plus.nativeUI.alert("支付成功!", function() {
|
||||
// back();
|
||||
|
||||
});
|
||||
}, function(error) {
|
||||
// plus.nativeUI.alert("支付失败:" + error.code);
|
||||
plus.webview.getWebviewById('confirmOrder.html').close();
|
||||
});
|
||||
} else {
|
||||
mui.alert("获取订单信息失败!");
|
||||
////console.log(xhr.status)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
xhr.open('GET', PAYSERVER + orderNo);
|
||||
xhr.send();
|
||||
|
||||
}
|
||||
var self = plus.webview.currentWebview();
|
||||
var type = self.type;
|
||||
var data_1 = {};
|
||||
var isUseScore = 0;
|
||||
var orderNo;
|
||||
var priceT = 0;
|
||||
var payCode = '';
|
||||
var userCoupon = '';
|
||||
var couponIds = [];
|
||||
var areaId2 = '';
|
||||
// //console.log(type)
|
||||
|
||||
mui.ajax(qlgUrl('app/carts/settlement'), {
|
||||
data: {
|
||||
type: type
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data)
|
||||
var data = toJson(data);
|
||||
// //console.log(JSON.stringify(data));
|
||||
if (data.status == 1) {
|
||||
var allallnum = 0;
|
||||
data = data.data;
|
||||
data_1 = data;
|
||||
if (data.userAddress.addressId) {
|
||||
var html = '<div class="address clearfix" data-addressId="' + data.userAddress.addressId + '" data-areaId2="' +
|
||||
data.userAddress.areaId2 +
|
||||
'"><div class="add_l"><img src="../img/dingwei1.png" /></div><div class="add_r"><div class="add_r_t clearfix"><div class="add_r_t_l">收货人:' +
|
||||
data.userAddress.userName + '</div><div class="add_r_t_r">' + data.userAddress.userPhone +
|
||||
'</div></div><div class="add_r_b">收货地址:' + data.userAddress.areaName + ' ' + data.userAddress.userAddress +
|
||||
'</div></div></div>';
|
||||
} else {
|
||||
var html =
|
||||
'<div class="address clearfix" ><div class="add_l"><img src="../img/dingwei1.png" /></div><div class="add_r"><div class="add_r_t clearfix"><div class="add_r_t_l" style="height:60px;line-height:60px;font-size:14.4px;color:black">请选择收货地址</div></div></div></div>';
|
||||
}
|
||||
$.each(data.carts, function() {
|
||||
var allNum = 0;
|
||||
html += '<div class="shop_info"><div class="row_title"><div class="store_name">' + this.shopName +
|
||||
'</div></div><div class="row_con clearfix">';
|
||||
$.each(this.list, function() {
|
||||
allNum += this.cartNum;
|
||||
var price = '';
|
||||
if (this.isWhsle == 1) {
|
||||
price = this.whslePrice;
|
||||
} else if (this.specPrice != 'null') {
|
||||
price = this.shopPrice;
|
||||
} else {
|
||||
price = this.specPrice;
|
||||
}
|
||||
var specNames = '';
|
||||
for (var i in this.specNames[0]) {
|
||||
if (i == "catName") {
|
||||
specNames = this.specNames[0][i] + ':';
|
||||
} else if (i == "itemName") {
|
||||
specNames += this.specNames[0][i]
|
||||
}
|
||||
}
|
||||
|
||||
html += '<div class="row_block clearfix" data-id="' + this.goodsId + '"><img src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" /><div class="rcr clearfix"><div class="rcrc"><p>' + this.goodsName + ' </p><p class="leibie">';
|
||||
$.each(this.specNames, function() {
|
||||
html += this.catName + ':' + this.itemName + ';';
|
||||
});
|
||||
|
||||
html += '</p></div><div class="rcrr"><p>¥' + price + '</p><del>¥' + this.marketPrice + '</del><span>x' +
|
||||
this.cartNum + '</span></div></div></div>'
|
||||
});
|
||||
allallnum += allNum;
|
||||
html +=
|
||||
'<div class="cost"><div class="c2 clearfix"><div class="c1_l">买家留言:</div><div class="c1_r"><input class="remark" data-shopId="' +
|
||||
this.shopId + '" type="text" name="" id="" value="" placeholder="选填:填写内容已和卖家协商确认" /></div></div></div>';
|
||||
// if (this.coupons != '') {
|
||||
// couponName = '<option value="0">请选择优惠券</option>';
|
||||
// html +=
|
||||
// '<div class="cost"><div class="c2 clearfix"><div class="c1_l">选择优惠券:</div><div class="c1_r"><select name="" data-shopId="' +
|
||||
// this.shopId + '" class="yhq yhq_">' + couponName;
|
||||
// $.each(this.coupons, function() {
|
||||
// html += '<option value="' + this.couponId + '">满' + this.useMoney + '元减' + this.couponValue +
|
||||
// '元</option>';
|
||||
// });
|
||||
// html += '</select></div></div></div>';
|
||||
// } else {
|
||||
html += '<div class="c1_r" style="display:none"><select name="" data-shopId="' + this.shopId +
|
||||
'" class="yhq yhq_"><option value="0"></option></select></div>';
|
||||
//}
|
||||
|
||||
html += '<div class="cost"><div class="c2 clearfix"><div class="c1_r">共' + allNum +
|
||||
'件商品 小计:<o class="on">¥' + this.goodsMoney + '</o> + 运费:<o class="on">¥' + this.shippingMoney +
|
||||
'</o></div></div></div></div></div>';
|
||||
});
|
||||
html += '<div class="cost"><div class="c2 clearfix"><div class="c1_l">发货方式:</div><div class="c1_r"><select name="" id="deliverType" class="yhq"><option value="0" selected>快递发货</option><option value="1" >门店自提【免运费】</option>';
|
||||
|
||||
//双11优惠券
|
||||
// html += '<div class="cost"><div class="c2 clearfix"><div class="c1_l">选择优惠券:</div><div class="c1_r"><select name="" id="userCoupon" class="yhq"><option value="0">不使用优惠券</option>';
|
||||
// $.each(data.userCoupon, function() {
|
||||
// html += '<option value="' + this.recordId + '">满' + this.man + '元减' + this.price + '元</option>';
|
||||
// });
|
||||
// html += '</select></div></div></div>'
|
||||
//木吉抵扣
|
||||
if (data.is_seckilling == 1 || data.promotion_goods == 1 || data.ect_pay == 1) {
|
||||
// data.useOrderScore=0;
|
||||
} else {
|
||||
// html += '<div class="isHb clearfix"><div class="h_left">木吉抵用 <o id="huibao">可抵用木吉:' + data.useOrderScore + '</o></div><div class="he_right"><div class="checkout"><div class="check_btn"></div></div></div></div>'
|
||||
|
||||
}
|
||||
// html+='<div class="num"><span>购买数量</span><div class="change_num"><span class="jian">-</span><input type="text" name="" id="" value="1" /><span class="jia">+</span></div></div>'
|
||||
// html += '<div class="jf_info clearfix"><div class="jf_jf">木吉</div><div class="jf_p">成交后奖励成交价20%的木吉</div></div>';
|
||||
priceT = (Math.floor((+data.goodsTotalMoney - (+data.promotionMoney)) * 100)) / 100;
|
||||
priceT = priceT >= 0 ? priceT : 0;
|
||||
var html1 = '<span>共' + allallnum + '件商品 合计:<j>¥' + priceT +
|
||||
'</j></span> <button class="btn_tj">提交订单</button>';
|
||||
// if(data.ect_pay == 1) {
|
||||
// var htmlpay = '<div class="row clearfix select_payway" data-payCode="ect"><p class="row_left">ECT余额:<o class="userECT">' + data.userECT + '</o></p></div>';
|
||||
//
|
||||
// $('.pay_info .con_1').append(htmlpay);
|
||||
// // $('.pay_info .con_1 .row').eq(0).attr('style','display: none;');
|
||||
// $('.pay_info .con_1 .row').eq(1).remove();
|
||||
// };
|
||||
$.each(data.payments, function(i, v) {
|
||||
$.each(v, function() {
|
||||
$('#pay_way,.pay_info .con_1').append('<div class="row clearfix select_payway" data-payCode="' + this.payCode +
|
||||
'"><p class="row_left">付款方式</p><p class="row_right">' + this.payName + '</p></div>');
|
||||
})
|
||||
})
|
||||
$('.con').html(html);
|
||||
$('.js_r').html(html1);
|
||||
$('#loginName').html(data.loginName);
|
||||
$('.userMoney').html(data.userMoney);
|
||||
|
||||
$('#goodsTotalMoney').html(priceT);
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
//店铺优惠券
|
||||
$('.con').on('change', '.yhq_', function() {
|
||||
userCoupon = $('#userCoupon').val();
|
||||
areaId2 = $('.address').attr('data-areaId2');
|
||||
couponIds = [];
|
||||
$('select').each(function() {
|
||||
couponIds.push($(this).attr('data-shopId') + ':' + $(this).val());
|
||||
})
|
||||
// var addressId = $('.address').attr('data-addressId')
|
||||
var areaId2 = $('.address').attr('data-areaId2')
|
||||
var couponIdsArr = couponIds.join(',');
|
||||
mui.ajax(qlgUrl('app/carts/getMoney'), {
|
||||
data: {
|
||||
type: type,
|
||||
areaId2: areaId2,
|
||||
isUseScore: isUseScore,
|
||||
useScore: data_1.useOrderScore,
|
||||
couponIds: couponIdsArr,
|
||||
recordId: userCoupon
|
||||
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
|
||||
data = toJson(data);
|
||||
// //console.log(data.msg)
|
||||
if (data.status == 1) {
|
||||
data_1.useOrderScore = data.data.maxScore;
|
||||
$('#huibao').html('可抵用木吉:' + data_1.useOrderScore);
|
||||
priceT = data.data.realTotalMoney;
|
||||
$('.js_r span j').html('¥' + data.data.realTotalMoney)
|
||||
$('#goodsTotalMoney').html(data.data.realTotalMoney);
|
||||
} else {
|
||||
mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
});
|
||||
//订单优惠券
|
||||
$('body').on('change', '#userCoupon,#deliverType', function() {
|
||||
userCoupon = $('#userCoupon').val();
|
||||
areaId2 = $('.address').attr('data-areaId2');
|
||||
couponIds = [];
|
||||
$('select').each(function() {
|
||||
couponIds.push($(this).attr('data-shopId') + ':' + $(this).val());
|
||||
})
|
||||
// var addressId = $('.address').attr('data-addressId')
|
||||
var areaId2 = $('.address').attr('data-areaId2')
|
||||
var couponIdsArr = couponIds.join(',');
|
||||
mui.ajax(hyhUrl('app/carts/getMoney'), {
|
||||
data: {
|
||||
type: type,
|
||||
deliverType:$('#deliverType').val(),
|
||||
areaId2: areaId2,
|
||||
//isUseScore: isUseScore,
|
||||
useScore: data_1.useOrderScore,
|
||||
//couponIds: couponIdsArr,
|
||||
//recordId: userCoupon
|
||||
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(JSON.stringify( data))
|
||||
data = toJson(data);
|
||||
// //console.log(data.msg)
|
||||
if (data.status == 1) {
|
||||
data_1.useOrderScore = data.data.maxScore;
|
||||
$('#huibao').html('可抵用木吉:' + data_1.useOrderScore);
|
||||
$('.js_r span j').html('¥' + data.data.realTotalMoney);
|
||||
priceT = data.data.realTotalMoney;
|
||||
$('#goodsTotalMoney').html(data.data.realTotalMoney);
|
||||
} else {
|
||||
mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
});
|
||||
//是否使用木吉
|
||||
// $('.con').on('tap', '.checkout', function() {
|
||||
// userCoupon = $('#userCoupon').val();
|
||||
// $(this).toggleClass('on');
|
||||
// if ($(this).hasClass('on')) {
|
||||
// isUseScore = 1;
|
||||
// } else {
|
||||
// isUseScore = 0;
|
||||
// }
|
||||
// couponIds = [];
|
||||
// $('select').each(function() {
|
||||
// couponIds.push($(this).attr('data-shopId') + ':' + $(this).val());
|
||||
// })
|
||||
// couponIdsArr = couponIds.join(',');
|
||||
// areaId2 = $('.address').attr('data-areaId2');
|
||||
// // //console.log(areaId2)
|
||||
// // //console.log(couponIdsArr)
|
||||
// // //console.log(data_1.userAddress.areaId2)
|
||||
// // //console.log(data_1.userAddress)
|
||||
//
|
||||
// // //console.log( areaId2)
|
||||
// // //console.log(isUseScore)
|
||||
// // //console.log( data_1.useOrderScore)
|
||||
// // //console.log(couponIdsArr)
|
||||
// // //console.log(userCoupon);
|
||||
// mui.ajax(hyhUrl('app/carts/getMoney'), {
|
||||
// data: {
|
||||
// type: type,
|
||||
// areaId2: areaId2,
|
||||
// isUseScore: isUseScore,
|
||||
// useScore: data_1.useOrderScore,
|
||||
// couponIds: couponIdsArr,
|
||||
// recordId: userCoupon
|
||||
//
|
||||
// },
|
||||
// dataType: 'json', //服务器返回json格式数据
|
||||
// type: 'post', //HTTP请求类型
|
||||
// timeout: 10000, //超时时间设置为10秒;
|
||||
// success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//
|
||||
// data = toJson(data);
|
||||
//
|
||||
// if (data.status == 1) {
|
||||
// data_1.useOrderScore = data.data.maxScore;
|
||||
// $('#huibao').html('可抵用木吉:' + data_1.useOrderScore);
|
||||
// // //console.log(data)
|
||||
// // //console.log(data.data.shopFreight)
|
||||
// // for(i in data.data){
|
||||
// // //console.log(i)
|
||||
// // //console.log(data.data[i])
|
||||
// // }
|
||||
// priceT = data.data.realTotalMoney;
|
||||
// $('.js_r span j').html('¥' + data.data.realTotalMoney)
|
||||
// $('#goodsTotalMoney').html(data.data.realTotalMoney);
|
||||
// } else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// // location.reload();
|
||||
// }
|
||||
// },
|
||||
// error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// //alert(errorThrown);
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
$('.footer').on('tap', '.btn_tj', function() {
|
||||
payCode = $('.select_payway').attr('data-payCode');
|
||||
var that = $(this);
|
||||
if (payCode == 'ect') {
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/ect/getToEctNum'), {
|
||||
|
||||
data: {
|
||||
total_money: priceT
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
var btnArray = ['是', '否'];
|
||||
mui.confirm(data.msg, 'ECT确认支付', btnArray, function(e) {
|
||||
if (e.index == 1) {
|
||||
that.removeAttr('disabled');
|
||||
return;
|
||||
|
||||
} else {
|
||||
var addressId = $('.address').attr('data-addressId');
|
||||
if (addressId) {
|
||||
$('.bg').css('display', 'block');
|
||||
$(".pay").slideDown(300);
|
||||
} else {
|
||||
mui.alert('未设置收货地址!')
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
} else {
|
||||
var addressId = $('.address').attr('data-addressId');
|
||||
if (addressId) {
|
||||
$('.bg').css('display', 'block');
|
||||
$(".pay").slideDown(300);
|
||||
} else {
|
||||
mui.alert('未设置收货地址!')
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('.bg').on('tap', '.mui-icon-left-nav', function() {
|
||||
$('.pay').css('display', 'block');
|
||||
$('.pay_way').css('display', 'none');
|
||||
})
|
||||
$('.bg').on('tap', '.mui-icon-closeempty', function() {
|
||||
$('.bg').css('display', 'none');
|
||||
$(".pay").slideUp(300, function() {
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
$('#pay_way').on('tap', '.row', function() {
|
||||
$('#pay_way .row .mui-icon').removeClass('mui-icon-checkmarkempty');
|
||||
$(this).children('.mui-icon').addClass('mui-icon-checkmarkempty');
|
||||
$('.select_payway .row_right o').html($(this).children('.row_left').html());
|
||||
$('.select_payway').attr('data-payCode', $(this).attr('data-payCode'))
|
||||
$('.pay').css('display', 'block');
|
||||
$('#pay_way').css('display', 'none');
|
||||
|
||||
})
|
||||
$('.pay').on('tap', '.select_payway', function() {
|
||||
if ($(this).attr('data-payCode') == 'ect') {} else {
|
||||
$('.pay').css('display', 'none');
|
||||
$('#pay_way').css('display', 'block');
|
||||
}
|
||||
|
||||
})
|
||||
var click = false;
|
||||
$('.pay_btn').on('tap', function() {
|
||||
|
||||
var addressId = $('.address').attr('data-addressId');
|
||||
var areaId = $('.address').attr('data-areaId');
|
||||
var that = $(this);
|
||||
payCode = $('.select_payway').attr('data-payCode');
|
||||
var data_send = {
|
||||
type: type,
|
||||
s_addressId: addressId,
|
||||
s_areaId: areaId,
|
||||
payCode: payCode,
|
||||
payType: 1,
|
||||
isUseScore: isUseScore,
|
||||
useScore: data_1.useOrderScore,
|
||||
deliverType: $('#deliverType').val(),
|
||||
isInvoice: 0,
|
||||
invoiceId: 0,
|
||||
invoiceClient: '',
|
||||
recordId: userCoupon
|
||||
}
|
||||
$('.remark').each(function() {
|
||||
data_send['remark_' + ($(this).attr('data-shopid'))] = $(this).val();
|
||||
});
|
||||
$('select').each(function() {
|
||||
data_send['couponId_' + ($(this).attr('data-shopid'))] = $(this).val();
|
||||
})
|
||||
if (true == click) return;
|
||||
click = true;
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/orders/submit'), {
|
||||
data: data_send,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
////console.log(JSON.stringify(data))
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
orderNo = data.data;
|
||||
if (payCode == 'qlgpay') {
|
||||
JZL.ajax(hyhUrl('app/' + payCode + '/payment'), {
|
||||
orderNo: orderNo,
|
||||
isBatch: 1
|
||||
}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(JSON.stringify(data));
|
||||
var data = toJson(data);
|
||||
// //console.log(JSON.stringify(data))
|
||||
if (data.status == 1) {
|
||||
$('.pay').css('display', 'none');
|
||||
$('#qlg_pay_pwd').css('display', 'block');
|
||||
if (data.data.payPwd == '0') {
|
||||
mui.alert('还未设置支付密码请先设置操作密码!');
|
||||
var url = 'setting_fogetPayPwd';
|
||||
JZL.openWindow(url + '.html', url + '.html');
|
||||
//return;
|
||||
}
|
||||
$('#totalMoney').html('付款总额:¥<o>' + data.data.needPay + '</o>');
|
||||
$('#productNum').val(data.data.product.useProduct);
|
||||
if (data.data.product.useProduct > 0) {
|
||||
var html1 = '<p id="" class="p1"><span>抵扣额</span><span>' + data.data.product.useProductOk +
|
||||
'</span> </p><p id="" class="p1"><span>扣税</span> <span>' + data.data.product.useProductTaxFee +
|
||||
'</span></p><p id="" class="p1"><span>手续费</span> <span>' + data.data.product.useProductHandlingFee +
|
||||
'</span></p>';
|
||||
$('.productInfo_').html(html1)
|
||||
// $('#productInfo').html('产品券[抵扣额:'+data.data.product.useProductOk+',扣税:'+data.data.product.useProductTaxFee+',手续费:'+data.data.product.useProductHandlingFee+']');
|
||||
}
|
||||
$('#couponsNum').val(data.data.coupons.useCoupons);
|
||||
if (data.data.coupons.useCoupons > 0) {
|
||||
var html2 = '<p id="" class="p1"><span>抵扣额</span><span>' + data.data.coupons.useCouponsOk +
|
||||
'</span> </p><p id="" class="p1"><span>扣税</span> <span>' + data.data.coupons.useCouponsTaxFee +
|
||||
'</span></p><p id="" class="p1"><span>手续费</span> <span>' + data.data.coupons.useCouponsHandlingFee +
|
||||
'</span></p>';
|
||||
$('.couponsInfo_').html(html2)
|
||||
// $('#coupousInfo').html('优惠券[抵扣额:' + data.data.coupons.useCouponsOk + ',扣税:' + data.data.coupons.useCouponsTaxFee +
|
||||
// ',手续费:' + data.data.coupons.useCouponsHandlingFee + ']');
|
||||
}
|
||||
$('#wangNum').val(data.data.wang.useWang);
|
||||
$('#moneyNum').val(data.data.money.useMoney);
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
});
|
||||
//显示支付页面
|
||||
} else if (payCode == 'wallets' || payCode == 'ect') {
|
||||
//跳输入密码的页面
|
||||
JZL.ajax(hyhUrl('app/' + payCode + '/payment'), {
|
||||
orderNo: data.data,
|
||||
isBatch: 1
|
||||
}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
$('.pay').css('display', 'none');
|
||||
$('#pay_pwd').css('display', 'block');
|
||||
if (data.data.payPwd == '0') {
|
||||
mui.alert('还未设置支付密码请先设置支付密码!');
|
||||
var url = 'setting_fogetPayPwd';
|
||||
JZL.openWindow(url + '.html', url + '.html');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} else if (payCode == 'alipays') {
|
||||
pay('alipay', data.data);
|
||||
// plus.nativeUI.showWaiting();
|
||||
// mui.post(hyhUrl('app/Alipays/payment'), {
|
||||
// orderNo: data.data,
|
||||
// isBatch: 1
|
||||
// var ALIPAYSERVER = hyhUrl('app/Alipays/payment?orderNo=' + data.data + '&isBatch=1');
|
||||
|
||||
}
|
||||
} else {
|
||||
mui.alert(data.msg); //'发生错误请刷新后重试!');
|
||||
if (-2 == data.status) {
|
||||
JZL.openWindow('indent.html', 'waitPay', {
|
||||
data_href: 'waitPay'
|
||||
});
|
||||
setTimeout(function() {
|
||||
JZL.closeWindow(plus.webview.currentWebview().id);
|
||||
}, 500)
|
||||
} else {
|
||||
//location.reload();
|
||||
}
|
||||
|
||||
//mui.back();
|
||||
|
||||
}
|
||||
click = false;
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// //console.log(type)
|
||||
// //console.log(errorThrown)
|
||||
//mui.alert(errorThrown);
|
||||
}
|
||||
})
|
||||
})
|
||||
$('#pay_pwd,#qlg_pay_pwd').on('tap', '.p9', function() {
|
||||
var url = 'setting_fogetPayPwd';
|
||||
JZL.openWindow(url + '.html', url + '.html');
|
||||
})
|
||||
$('#pay_pwd,#qlg_pay_pwd').on('tap', '.pay_btn_pwd', function() {
|
||||
var payPwd = $('#payPwd').val();
|
||||
if (payPwd == '') {
|
||||
mui.alert('支付密码不能为空!');
|
||||
return;
|
||||
}
|
||||
var that = $(this);
|
||||
that.attr('disabled', 'disabled');
|
||||
var srcc = ''
|
||||
if (payCode == 'qlgpay') {
|
||||
srcc = 'payByQlg';
|
||||
} else if (payCode == 'ect') {
|
||||
srcc = 'payByEct';
|
||||
} else {
|
||||
srcc = 'payByWallet';
|
||||
}
|
||||
JZL.ajax(hyhUrl('app/' + payCode + '/' + srcc), {
|
||||
orderNo: orderNo,
|
||||
isBatch: 1,
|
||||
payPwd: payPwd
|
||||
}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(JSON.stringify(data));
|
||||
var data = toJson(data);
|
||||
mui.alert(data.msg);
|
||||
if (data.status == 1) {
|
||||
JZL.openWindow('indent.html', 'waitDeliver', {
|
||||
data_href: 'waitDeliver'
|
||||
});
|
||||
setTimeout(function() {
|
||||
JZL.closeWindow(plus.webview.currentWebview().id);
|
||||
}, 700)
|
||||
|
||||
} else {
|
||||
if (-1 == data.status) {
|
||||
JZL.openWindow('indent.html', 'waitPay', {
|
||||
data_href: 'waitPay'
|
||||
});
|
||||
setTimeout(function() {
|
||||
JZL.closeWindow(plus.webview.currentWebview().id);
|
||||
}, 700)
|
||||
} else if (-2 == data.status) {
|
||||
var url = 'setting_fogetPayPwd';
|
||||
JZL.openWindow(url + '.html', url + '.html');
|
||||
} else if (-3 == data.status) {
|
||||
|
||||
} else if (-4 == data.status) {
|
||||
JZL.openWindow('indent.html', 'waitDeliver', {
|
||||
data_href: 'waitDeliver'
|
||||
});
|
||||
setTimeout(function() {
|
||||
JZL.closeWindow(plus.webview.currentWebview().id);
|
||||
}, 700)
|
||||
}
|
||||
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
});
|
||||
})
|
||||
})
|
187
static/app2/js/cooperative.js
Executable file
187
static/app2/js/cooperative.js
Executable file
@ -0,0 +1,187 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'refresh');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mui.plusReady(function() {
|
||||
JZL.getItems('auth_company');
|
||||
var id = '';
|
||||
var count = 0;
|
||||
$('.header_con_bc').on('tap', function() {
|
||||
JZL.saveItems('.localinp', 'auth_company');
|
||||
mui.toast('保存成功');
|
||||
})
|
||||
|
||||
if ('' == $('#headImg').val()) {
|
||||
$("#headImgTag").attr("src", "../img/touxiang.jpg")
|
||||
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthInfo'), {
|
||||
isCompany: 1
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
|
||||
if ('undefined' != typeof(data.data) && 1 == data.status) { //编辑
|
||||
count = 1;
|
||||
$('.mobileCode').hide()
|
||||
$('.userPhone').hide()
|
||||
$('.payPwd').show()
|
||||
id = data.data.id
|
||||
|
||||
//赋值
|
||||
////console.log(data);
|
||||
mui.each(data.data, function(index, element) {
|
||||
if ($('#' + index).attr("type") == "hidden") {
|
||||
// var imgindex = index.substring(0, index.length - 3);
|
||||
var imgindex = index + 'Tag'
|
||||
var obj = '#' + imgindex
|
||||
// //console.log('#' + imgindex + '')
|
||||
if (imgindex != "") {
|
||||
if ($(obj).is('img')) {
|
||||
$(obj).attr("src", hyhImgUrl(element))
|
||||
$('#' + index + '').val(element)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$('#' + index).val(element)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
} else { // 添加
|
||||
count = 0
|
||||
$('.userPhone').show()
|
||||
$('.mobileCode').show()
|
||||
$('.payPwd').hide()
|
||||
JZL.getItems('auth_company');
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
mui('.mui-content').on('tap', '.yhk', function() {
|
||||
JZL.openWindow('yhk.html', 'yhk.html');
|
||||
|
||||
})
|
||||
mui('.mui-content').on('tap', '.hhrrz', function() {
|
||||
JZL.openWindow('hhrrz.html', 'hhrrz.html');
|
||||
|
||||
})
|
||||
|
||||
var wait = 120;
|
||||
|
||||
function time() {
|
||||
if (wait == 0) {
|
||||
$('.HQYZM').removeAttr("disabled");
|
||||
$('.HQYZM').val("重新发送");
|
||||
wait = 120;
|
||||
} else {
|
||||
$('.HQYZM').attr("disabled", true);
|
||||
$('.HQYZM').css("background", "#c0a0a0");
|
||||
$('.HQYZM').val("重新发送(" + wait + ")");
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
time()
|
||||
},
|
||||
1000)
|
||||
}
|
||||
}
|
||||
//获取验证码
|
||||
mui('.mui-table-view-cell').on('tap', '.HQYZM', function() {
|
||||
var userPhone = $('.indiv-tel').val();
|
||||
// if (userPhone == '') {
|
||||
// mui.alert('手机号不能为空!');
|
||||
// return;
|
||||
// }
|
||||
// 判断手机号码格式
|
||||
// if (!(
|
||||
// /^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/
|
||||
// .test(userPhone))) {
|
||||
// mui.alert("手机号码有误,请重填!");
|
||||
// return;
|
||||
// }
|
||||
// $(".HQYZM").attr("disabled", true);
|
||||
JZL.ajax(qlgUrl('app/auth/getPhoneCode'), {
|
||||
userPhone: userPhone
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
time();
|
||||
}
|
||||
mui.toast(data.msg);
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
// 上传头像
|
||||
$("#headerimg").on("tap", '#headImgTag', function() {
|
||||
UP.init("headImg", "test", "headImgTag")
|
||||
openCamera();
|
||||
})
|
||||
|
||||
$('.bc_btn').on('tap', function() {
|
||||
|
||||
|
||||
var params = JZL.getParams(".inp");
|
||||
if ('' == params.trueName) {
|
||||
mui.alert("请输入直营人姓名");
|
||||
return;
|
||||
|
||||
}
|
||||
if ('' == params.idCard) {
|
||||
mui.alert("请输入身份证号");
|
||||
return;
|
||||
|
||||
}
|
||||
if ('' == params.companyName) {
|
||||
mui.alert("请输入合作名称");
|
||||
return;
|
||||
}
|
||||
if ('' == params.companyAddress) {
|
||||
mui.alert("请输入地址");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ('' == params.companyName) {
|
||||
mui.alert("请输入合作名称");
|
||||
return;
|
||||
}
|
||||
if (0 == count) { //添加
|
||||
if ('' == $('#mobileCode').val()) {
|
||||
mui.alert("请输入验证码");
|
||||
return;
|
||||
}
|
||||
params.mobileCode = $('#mobileCode').val();
|
||||
|
||||
} else if (1 == count) { //编辑
|
||||
if ('' == $('#payPwd').val()) {
|
||||
mui.alert("请输入操作密码");
|
||||
return;
|
||||
}
|
||||
params.authId = id;
|
||||
params.payPwd = $('#payPwd').val();
|
||||
}
|
||||
params.isCompany = 1
|
||||
JZL.ajax(qlgUrl('app/auth/setAuthInfo'), params, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
JZL.saveItems('.localinp', 'auth_company');
|
||||
localStorage.setItem("authType","2")
|
||||
mui.toast("提交成功 请等待审核")
|
||||
// $(".mui-table-view").attr("readonly", "readonly")
|
||||
$(".mobileCode").hide()
|
||||
$('.userPhone').hide()
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
})
|
874
static/app2/js/details.js
Executable file
874
static/app2/js/details.js
Executable file
@ -0,0 +1,874 @@
|
||||
var data = '';
|
||||
var data_saleSpec = {}
|
||||
var arry_str = '';
|
||||
var data_bak = {};
|
||||
var shopQQ = '';
|
||||
var shopTle = '';
|
||||
var shopName='';
|
||||
var isDefaultArr = [];
|
||||
var token = localStorage.getItem('token');
|
||||
var isShowWhsle = 0;
|
||||
var seckilling_end_time = ''
|
||||
var shareImgThumbs = [];
|
||||
var shares = null;
|
||||
var img_data='';
|
||||
var Intent = null,
|
||||
File = null,
|
||||
Uri = null,
|
||||
main = null;
|
||||
|
||||
//点击遮罩关闭
|
||||
$('.cclass_con').before('<div class="mask" style="height:100%"></div>')
|
||||
$('.header_con').append('<a class="icon-cart"><img style="width:1.7rem;" src="'+ectImgUrl('static/app2/img/icon_cart.png')+'"</a>');
|
||||
function getNextDate(dayStr) {
|
||||
var dd = new Date(dayStr);
|
||||
dd.setDate(dd.getDate() + 1);
|
||||
var y = dd.getFullYear();
|
||||
var m = dd.getMonth() + 1; //获取当前月份的日期
|
||||
var d = dd.getDate();
|
||||
return y + "/" + m + "/" + d + " 00:00:00";
|
||||
};
|
||||
//倒计时
|
||||
function countTime() {
|
||||
|
||||
//获取当前时间
|
||||
var date = new Date();
|
||||
var now = date.getTime();
|
||||
//设置截止时间
|
||||
var endDate = new Date(getNextDate(seckilling_end_time * 1000));
|
||||
var end = endDate.getTime();
|
||||
//时间差
|
||||
var leftTime = seckilling_end_time * 1000 - now;
|
||||
//定义变量 d,h,m,s保存倒计时的时间
|
||||
var d, h, m, s;
|
||||
if(leftTime >= 0) {
|
||||
d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
|
||||
h = Math.floor(leftTime / 1000 / 60 / 60);
|
||||
m = Math.floor(leftTime / 1000 / 60 % 60);
|
||||
s = Math.floor(leftTime / 1000 % 60);
|
||||
//将倒计时赋值到div中
|
||||
if(d < 10) {
|
||||
d = "0" + d;
|
||||
}
|
||||
if(h < 10) {
|
||||
h = "0" + h;
|
||||
}
|
||||
if(m < 10) {
|
||||
m = "0" + m;
|
||||
}
|
||||
if(s < 10) {
|
||||
s = "0" + s;
|
||||
}
|
||||
// $("#_d").html(d);
|
||||
$("#_h").html(h);
|
||||
$("#_m").html(m);
|
||||
$("#_s").html(s);
|
||||
}
|
||||
|
||||
//递归每秒调用countTime方法,显示动态时间效果
|
||||
setTimeout(countTime, 1000);
|
||||
|
||||
}
|
||||
|
||||
//秒杀限购四件
|
||||
var xg = '';
|
||||
$('.miaosha').append(xg);
|
||||
//秒杀规格选择
|
||||
function miaoshaSaleSpec(specId, SaleSpec) {
|
||||
for(i in SaleSpec) {
|
||||
if(SaleSpec[i].id == specId) {
|
||||
var data_sArry = i.split(':');
|
||||
var data_s = SaleSpec[i];
|
||||
arry_str = i;
|
||||
isDefaultArr = i.split(':');
|
||||
$.each(data_sArry, function() {
|
||||
var that = this;
|
||||
$('.cclass1 .block').each(function() {
|
||||
if($(this).attr('data-itemId') == that) {
|
||||
$(this).addClass('on');
|
||||
$(this).parent().attr('data-class', that);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
seckilling_end_time = data_s.seckilling_end_time;
|
||||
html_miaosha = '<img src="../img/bg_miaosha.png"/><p class="miaosha1"><o>¥</o>' + data_s.specPrice + '</p><del class="miaosha2">¥' + data_s.marketPrice + '</del><div class="xiangou">限购四件</div><p class="miaosha3"><o id="_h">00</o>:<o id="_m">00</o>:<o id="_s">00</o></p><p class="miaosha4">桔子抢购</p><p class="miaosha5">距结束还剩</p>';
|
||||
$('.miaosha').html(html_miaosha);
|
||||
$('.cclass_con .cc2 p').html(data_s.specPrice);
|
||||
$('.miaosha').css('display', 'block');
|
||||
$('.price').css('display', 'none');
|
||||
$('.price_old').css('display', 'none');
|
||||
countTime();
|
||||
$('.mujidikou').css('display', 'none');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// H5 plus事件处理
|
||||
function plusReady() {
|
||||
updateSerivces();
|
||||
if(plus.os.name == "Android") {
|
||||
main = plus.android.runtimeMainActivity();
|
||||
Intent = plus.android.importClass("android.content.Intent");
|
||||
File = plus.android.importClass("java.io.File");
|
||||
Uri = plus.android.importClass("android.net.Uri");
|
||||
}
|
||||
}
|
||||
if(window.plus) {
|
||||
plusReady();
|
||||
} else {
|
||||
document.addEventListener("plusready", plusReady, false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 更新分享服务
|
||||
*/
|
||||
function updateSerivces() {
|
||||
plus.share.getServices(function(s) {
|
||||
shares = {};
|
||||
for(var i in s) {
|
||||
var t = s[i];
|
||||
shares[t.id] = t;
|
||||
}
|
||||
}, function(e) {
|
||||
plus.nativeUI.toast("获取分享服务列表失败:" + e.message);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享操作
|
||||
* @param {JSON} sb 分享操作对象s.s为分享通道对象(plus.share.ShareService)
|
||||
* @param {Boolean} bh 是否分享链接
|
||||
*/
|
||||
function shareAction(sb, bh) {
|
||||
if(!sb || !sb.s) {
|
||||
plus.nativeUI.toast("无效的分享服务!");
|
||||
return;
|
||||
}
|
||||
|
||||
var msg = {
|
||||
content: sharehrefDes.value,
|
||||
extra: {
|
||||
scene: sb.x
|
||||
},
|
||||
type: "web"
|
||||
};
|
||||
if(bh) {
|
||||
msg.href = sharehref.value;
|
||||
if(sharehrefTitle && sharehrefTitle.value != "") {
|
||||
msg.title = sharehrefTitle.value;
|
||||
}
|
||||
if(sharehrefDes && sharehrefDes.value != "") {
|
||||
msg.content = sharehrefDes.value;
|
||||
}
|
||||
// msg.thumbs = ["_www/logo.png"];
|
||||
msg.thumbs = $('.swiper-slide img').eq(0).attr('src') ? [$('.swiper-slide img').eq(0).attr('src') + '/thumb60'] : ["_www/logo.png"];
|
||||
|
||||
msg.pictures = ["_www/logo.png"];
|
||||
} else {
|
||||
if(pic && pic.realUrl) {
|
||||
msg.pictures = [pic.realUrl];
|
||||
}
|
||||
}
|
||||
// 发送分享
|
||||
if(sb.s.authenticated) {
|
||||
// plus.nativeUI.toast("---已授权---");
|
||||
shareMessage(msg, sb.s);
|
||||
} else {
|
||||
plus.nativeUI.toast("---未授权---");
|
||||
sb.s.authorize(function() {
|
||||
shareMessage(msg, sb.s);
|
||||
}, function(e) {
|
||||
plus.nativeUI.toast("认证授权失败:" + e.code + " - " + e.message);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 发送分享消息
|
||||
* @param {JSON} msg
|
||||
* @param {plus.share.ShareService} s
|
||||
*/
|
||||
function shareMessage(msg, s) {
|
||||
|
||||
// plus.nativeUI.toast(JSON.stringify(msg));
|
||||
s.send(msg, function() {
|
||||
plus.nativeUI.toast("分享到\"" + s.description + "\"成功! ");
|
||||
|
||||
}, function(e) {
|
||||
plus.nativeUI.toast("分享到\"" + s.description + "\"失败 ");
|
||||
|
||||
});
|
||||
}
|
||||
// 分析链接
|
||||
function shareHref() {
|
||||
var shareBts = [];
|
||||
// 更新分享列表
|
||||
var ss = shares['weixin'];
|
||||
ss && ss.nativeClient && (shareBts.push({
|
||||
title: '微信朋友圈',
|
||||
s: ss,
|
||||
x: 'WXSceneTimeline'
|
||||
}),
|
||||
shareBts.push({
|
||||
title: '微信好友',
|
||||
s: ss,
|
||||
x: 'WXSceneSession'
|
||||
}));
|
||||
|
||||
// 弹出分享列表
|
||||
shareBts.length > 0 ? plus.nativeUI.actionSheet({
|
||||
title: '分享注册链接',
|
||||
cancel: '取消',
|
||||
buttons: shareBts
|
||||
}, function(e) {
|
||||
(e.index > 0) && shareAction(shareBts[e.index - 1], true);
|
||||
}) : plus.nativeUI.plus.nativeUI.toast('当前环境无法支持分享链接操作!');
|
||||
}
|
||||
|
||||
function whslePrice(num, arry_str) {
|
||||
for(var i in data_saleSpec) {
|
||||
if(i == arry_str) {
|
||||
// if(num >= (+(data_saleSpec[i].initNum)) && data_saleSpec[i].whslePrice > 0) {
|
||||
if(isShowWhsle == 1 && data_saleSpec[i].whslePrice > 0) {
|
||||
$('.cclass_con .cc2 o').html('批发单价:¥' + data_saleSpec[i].whslePrice);
|
||||
$('.cclass_con .cc2 l').html('起批数:' + data_saleSpec[i].initNum + '件');
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var i in data_saleSpec) {
|
||||
if(i == arry_str) {
|
||||
$('.cclass_con .cc2 p').html('¥' + data_saleSpec[i].specPrice);
|
||||
}
|
||||
}
|
||||
}
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
var goodsType;
|
||||
if (self.goodsType) {
|
||||
goodsType=self.goodsType;
|
||||
}
|
||||
var goodsId = self.data_id;
|
||||
var isEct = self.isEct;
|
||||
var isMiaosha = self.isMiaosha;
|
||||
var MiaoshaSaleSpec = self.MiaoshaSaleSpec;
|
||||
var specsId = '';
|
||||
// //console.log(isMiaosha)
|
||||
// isMiaosha = 1;
|
||||
// MiaoshaSaleSpec = '0';
|
||||
// console.log(goodsId)
|
||||
|
||||
// mui.ajax(hyhUrl('app/Goods/detail'), {
|
||||
mui.ajax(qlgUrl('app/Goods/detail'), {
|
||||
data: {
|
||||
goodsId: goodsId
|
||||
// goodsId: 1206
|
||||
// goodsId: 1203
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data)
|
||||
var data = toJson(data);
|
||||
// console.log(data.status)
|
||||
if(data.status == 1) {
|
||||
// mui.alert('加载失败请重试!');
|
||||
|
||||
data = data.data;
|
||||
data_bak = data;
|
||||
shopQQ = data.shop.shopQQ;
|
||||
shopTel = data.shop.phone;
|
||||
var isEct = data.isEct;
|
||||
shopName = data.shop.shopName;
|
||||
// if(!shopQQ && shopTel) {
|
||||
$('#lxkf').html('<a href="tel:' + shopTel + '"><img src="../img/haitunlogo.png" /><p>客服</p></a>')
|
||||
// }
|
||||
if(1 == data.isFavorites){
|
||||
$('#scbtn img').attr('src','../img/likelogo1.png')
|
||||
$('#scbtn p').html("已收藏")
|
||||
}
|
||||
var html = '<div class="none" style="display: none;"><p>链接地址:</p><input id="sharehref" type="url" value="' + data.goods_url + '" /><p>链接标题:</p><input id="sharehrefTitle" type="text" value="' + data.goodsName + '" /><p>链接描述:</p><input id="sharehrefDes" type="text" value="' + data.goodsTips + '" /></br></div><div class="banner"><div class="swiper-container"><div class="swiper-wrapper">';
|
||||
var html2 = '';
|
||||
$.each(data.gallery, function() {
|
||||
html += '<div class="swiper-slide"><img src="' + hyhImgUrl(this) + '" /></div>';
|
||||
});
|
||||
|
||||
if(isEct == 1) {
|
||||
html += '</div></div></div><div class="con"><div class="summarize shadown_wai"><div class="miaosha" style="display:none;"></div><p class="price xxl"><o>ECT专享价</o>¥' + data.shopPrice + '</p><p class="price_old">市场价 <del>¥' + data.marketPrice + '</del></p>';
|
||||
} else {
|
||||
html += '</div></div></div><div class="con"><div class="summarize shadown_wai"><div class="miaosha" style="display:none;"></div><p class="price">¥' + data.shopPrice + '</p><p class="price_old">市场价 <del>¥' + data.marketPrice + '</del></p>';
|
||||
}
|
||||
|
||||
// var str1 = '<p class="price"><o>到手价</o>¥' + Math.round(data.shopPrice * 0.8 * 100) / 100 + '</p>'
|
||||
|
||||
html += '<p class="cname" id="shareout" style="color:black;font-size:16px"><o> ' + data.goodsName + '</o><img id="share" src="../img/share.png"/></p>';
|
||||
if(data.goodsTips) {
|
||||
html += '<p class="cname">' + data.goodsTips + '</p>';
|
||||
}
|
||||
if(data.isFreeShipping == '1') {
|
||||
html += '<div class="compilations"><span class="myf">免运费';
|
||||
} else {
|
||||
//html += '<div class="compilations"><span class="myf">不包邮';
|
||||
html += '<div class="compilations"><span class="myf">运费'+data.freight;
|
||||
}
|
||||
html += '</span><span class="yx">月销:' + data.saleNum + '件</span><span class="dz"></span></div>'
|
||||
|
||||
html += '</div><div class="guarantee shadown_wai"><div class="row clearfix yyyhhhqqq"><img src="../img/gouwuquan.png" /><span class="text">领取优惠券</span><button class="lq">领取</button></div>';//<div class="row clearfix"><span class="text1">木吉</span><span class="text">购买后可获得成交价格20%木吉</span></div>
|
||||
if(isEct != 1) {
|
||||
//html += '<div class="row clearfix mujidikou"><span class="text1">木吉</span><span class="text">本商品可用木吉抵扣20%</span></div>'
|
||||
} else {}
|
||||
if(data.promotionList != '') {
|
||||
// html += '<div class="mui-table-view-cell mui-collapse row_"><a class="mui-navigate-right" href="#">促销信息 :' + data.promotionList.rewardTitle + '</a><div class="mui-collapse-content" style="width:100%">';
|
||||
// $.each(data.promotionList.json, function() {
|
||||
// html += '<h4>满' + this.orderMoney + '元</h4>';
|
||||
//
|
||||
// if(this.favourableJson.chk0 == true) {
|
||||
// html += '<h5>减' + this.favourableJson.chk0val + '元</h5>';
|
||||
// }
|
||||
// if(this.favourableJson.chk1 == true) {
|
||||
// html += '<h5>送' + this.favourableJson.chk1val.text + '</h5>';
|
||||
// }
|
||||
// if(this.favourableJson.chk2 == true) {
|
||||
// html += '<h5>免运费</h5>';
|
||||
// }
|
||||
// if(this.favourableJson.chk3 == true) {
|
||||
// html += '<h5>送满' + this.favourableJson.chk3val.text + '元优惠券 满' + this.favourableJson.chk3val.data.useMoney + '元使用</h5>';
|
||||
// }
|
||||
//
|
||||
// });
|
||||
//
|
||||
// html += '</div></div>';
|
||||
}
|
||||
var showShopMsg = '<span class="text">正品保证 </span>';
|
||||
// if(1778 == data.shopId){
|
||||
// showShopMsg+='<span class="text">此商品拆封概不退货换</span>';
|
||||
// showShopMsg+='<span class="text">温馨提示:不支持7天无理由退货</span>';
|
||||
//
|
||||
// }
|
||||
html += '<div class="row clearfix">'+showShopMsg+'<button class="caidan" style="display:none"><img src="../img/menu.png"/></button></div></div><div class="guarantee shadown_wai" id="guarantee"><div class="row clearfix" id="changeclass"><span class="text">选择颜色分类 号码尺寸</span><button class="caidan"><img src="../img/menu.png"/></button></div></div>';
|
||||
if(data.oneAppraises == '') {
|
||||
|
||||
} else {
|
||||
var userImg = '';
|
||||
if(data.oneAppraises.userPhoto) {
|
||||
userImg = hyhImgUrl(data.oneAppraises.userPhoto);
|
||||
} else {
|
||||
userImg = '../img/mujiimg.png'
|
||||
}
|
||||
|
||||
html += '<div class="pjrk shadown_wai" style="display:block"><p class="pj_title">商品评价(' + data.appraiseNum + ')</p><div class="pj_breviary"><div class="pjbtitle clearfix"><img src="' + userImg + '" /><p>' + data.oneAppraises.loginName + '</p></div><div class="pjbcon">' + data.oneAppraises.content + '</div><div class="pjclass">' + data.oneAppraises.goodsSpecNames + '</div></div><div class="pj_all">查看全部评价</div></div>';
|
||||
}
|
||||
|
||||
img_data = data.goodsDesc.replace(/src=\"__ROOT__\//g, 'data-src="').replace(/data-echo=\"__ROOT__\//g, 'src="' + hyhImgUrl('')).replace(/src=\"\//g, 'src="' + hyhImgUrl(''));
|
||||
img_data = img_data.replace(/src=\"http\:\/\/img.heyuanhui.cn\//g,'src="' + hyhImgUrl(''));
|
||||
////console.log(img_data)
|
||||
html += '<div class="shop_info shadown_wai"><div class="shop_title clearfix"><img src="' + hyhImgUrl(data.shop.shopImg) + '" /><p data-shopId="' + data.shop.shopId + '">' + data.shop.shopName + '</p></div><div class="shopinfocon clearfix"><div class="sicl"><div class="sicl_p1">' + data.goodsCount + '</div><div class="sicl_p2">全部宝贝</div></div><div class="sicl"><div class="sicl_p1">' + data.newGoodsCount + '</div><div class="sicl_p2">上新宝贝</div></div><div class="sicl"><div class="sicl_p1">' + data.favoritesShopsNum + '</div><div class="sicl_p2">关注人数</div></div><div class="sicr"><div class="sicr_p">宝贝描述 <o>' + data.shop.goodsScore + '</o></div><div class="sicr_p">卖家服务 <o>' + data.shop.serviceScore + '</o></div><div class="sicr_p">物流服务 <o>' + data.shop.timeScore + '</o></div></div></div></div><div class="imgcon"></div></div>';
|
||||
$('.con_').html(html);
|
||||
|
||||
$('.cclass_con .img').html('<img src="' + hyhImgUrl(data.goodsImg) + '" />');
|
||||
$('.cclass_con .cc2 p').html('¥' + data.shopPrice);
|
||||
$('.cclass_con .cc2 span').html('库存' + data.goodsStock + '件');
|
||||
if(data.showWhsle == 1) {
|
||||
isShowWhsle = 1;
|
||||
}
|
||||
$('#storebtn').attr('data-shopId', data.shopId);
|
||||
$('.swiper-slide img').height($('.swiper-slide img').width());
|
||||
$('.swiper-slide').height($('.swiper-slide').width());
|
||||
//$('.swiper-slide').height($('.swiper-slide').width() * 460 / 750);
|
||||
//$('.swiper-slide img').height($('.swiper-slide img').width() * 460 / 750);
|
||||
|
||||
// $('.banner').height($('.banner').width());
|
||||
var swiper = new Swiper('.swiper-container', {
|
||||
pagination: '.swiper-pagination',
|
||||
paginationClickable: true,
|
||||
spaceBetween: 30,
|
||||
autoplay: 3000
|
||||
});
|
||||
var html1 = '';
|
||||
// var html1 = '<div class="mui-scroll-wrapper" id="hahaha"><div class="mui-scroll">';
|
||||
$.each(data.spec, function() {
|
||||
html1 += '<div class="cclass1 clearfix" data-class=""><p>' + this.name + '</p>'
|
||||
$.each(this.list, function() {
|
||||
// //console.log(this.itemId)
|
||||
html1 += '<div class="block" data-itemId="' + this.itemId + '" data-itemImg="' + this.itemImg + '">' + this.itemName + '</div>'
|
||||
});
|
||||
html1 += '</div>'
|
||||
});
|
||||
// html1+='</div></div>'
|
||||
$('.ccclass').html(html1);
|
||||
// var hahaha = mui('#hahaha').scroll();
|
||||
// $('.ccclass').height($('#hahaha').height())
|
||||
for(var i in data.saleSpec) {
|
||||
data_saleSpec[i] = data.saleSpec[i];
|
||||
// if(data.saleSpec[i]["id"] == MiaoshaSaleSpec) {
|
||||
// specsId = i
|
||||
// arry_str = i;
|
||||
// isDefaultArr = i.split(':');
|
||||
// }
|
||||
if(data.saleSpec[i]["isDefault"] == 1) {
|
||||
isDefaultArr = i.split(':');
|
||||
arry_str = i;
|
||||
}
|
||||
|
||||
}
|
||||
if(data.couponList == '') {
|
||||
$('.yyyhhhqqq').css('display', 'none');
|
||||
} else {
|
||||
$.each(data.couponList, function() {
|
||||
html2 += '<div class="thq_block"><img src="' + hyhImgUrl('static/app2/img/coupon_bg.png') + '"/><p>¥' + this.couponValue + '</p><span>满' + this.useMoney + '元使用</span><button class="lq_btn" data-couponId="' + this.couponId + '">领取</button></div>';
|
||||
});
|
||||
$('.yhqcon').html(html2);
|
||||
}
|
||||
|
||||
// if(isMiaosha == 1 || (data.is_seckilling&&data.is_seckilling == 1)||(data_saleSpec[arry_str].is_seckilling&&data_saleSpec[arry_str].is_seckilling==1)) {
|
||||
var html_miaosha = ''
|
||||
if(data.is_seckilling && data.is_seckilling == '1') {
|
||||
$('.mujidikou').css('display', 'none');
|
||||
seckilling_end_time = data.seckilling_end_time;
|
||||
html_miaosha = '<img src="../img/bg_miaosha.png"/><p class="miaosha1"><o>¥</o>' + data.shopPrice + '</p><del class="miaosha2">¥' + data.marketPrice + '</del><div class="xiangou">限购四件</div><p class="miaosha3"><o id="_h">00</o>:<o id="_m">00</o>:<o id="_s">00</o></p><p class="miaosha4">桔子抢购</p><p class="miaosha5">距结束还剩</p>';
|
||||
|
||||
$('.miaosha').html(html_miaosha);
|
||||
$('.miaosha').css('display', 'block');
|
||||
$('.price').css('display', 'none');
|
||||
$('.price_old').css('display', 'none');
|
||||
countTime();
|
||||
} else if(data_saleSpec[arry_str] && data_saleSpec[arry_str].is_seckilling && data_saleSpec[arry_str].is_seckilling == 1) {
|
||||
miaoshaSaleSpec(data_saleSpec[arry_str].id, data_saleSpec);
|
||||
} else if(isMiaosha == 1) {
|
||||
miaoshaSaleSpec(MiaoshaSaleSpec, data_saleSpec);
|
||||
}
|
||||
// }
|
||||
else {
|
||||
$.each(isDefaultArr, function() {
|
||||
var that = this;
|
||||
$('.cclass1 .block').each(function() {
|
||||
|
||||
if($(this).attr('data-itemId') == that) {
|
||||
$(this).addClass('on');
|
||||
$(this).parent().attr('data-class', that);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
} else if(data.status == -22) {
|
||||
alert(data.msg);
|
||||
mui.back();
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//console.log(errorThrown);
|
||||
}
|
||||
});
|
||||
var scroll = mui('.mui-scroll-wrapper').scroll({
|
||||
//flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
|
||||
deceleration: 0.002
|
||||
});
|
||||
var show_img=false;
|
||||
//导航栏渐变
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
var num;
|
||||
if(scroll.y >= -387 && scroll.y < 0) {
|
||||
|
||||
num = scroll.y / -387;
|
||||
// //console.log('渐变',num)
|
||||
$('.header1').css({
|
||||
'display': 'block',
|
||||
'opacity': num
|
||||
})
|
||||
if(false == show_img){
|
||||
show_img=true;
|
||||
$('.imgcon').html(img_data);
|
||||
}
|
||||
var num1 = 0.2 - num * 0.2;
|
||||
} else if(scroll.y >= 0) {
|
||||
num = 0;
|
||||
// //console.log('透明',num)
|
||||
$('.header1').css({
|
||||
'display': 'none',
|
||||
'opacity': num
|
||||
})
|
||||
} else if(scroll.y < -387) {
|
||||
|
||||
num = 1;
|
||||
// //console.log('不透明',num)
|
||||
$('.header1').css({
|
||||
'display': 'block',
|
||||
'opacity': num
|
||||
})
|
||||
}
|
||||
//导航栏自动切换
|
||||
if($('.imgcon').offset().top >= 66) {
|
||||
$('#nav1').addClass("on").siblings().removeClass('on');
|
||||
} else if($('.imgcon').offset().top < 66) {
|
||||
$('#nav3').addClass("on").siblings().removeClass('on');
|
||||
}
|
||||
})
|
||||
|
||||
mui('.header').on('tap', '.icon-cart', function() {
|
||||
JZL.openWindow('shoppingcart.html','shoppingcart.html');
|
||||
});
|
||||
//点击导航栏跳转
|
||||
mui('.nav').on('tap', '#nav1', function() {
|
||||
mui('.mui-scroll-wrapper').scroll().scrollTo(0, 0, 100);
|
||||
$('#nav1').addClass("on").siblings().removeClass('on');
|
||||
});
|
||||
mui('.nav').on('tap', '#nav2', function() {
|
||||
JZL.openWindow('appraise.html','appraise.html',{goodsId: goodsId});
|
||||
});
|
||||
mui('.nav').on('tap', '#nav3', function() {
|
||||
mui('.mui-scroll-wrapper').scroll().scrollTo(0, -1124, 100);
|
||||
$('#nav3').addClass("on").siblings().removeClass('on');
|
||||
});
|
||||
|
||||
mui('.con_').on('tap', '#changeclass', function() {
|
||||
$('#changeclass_con').show();
|
||||
})
|
||||
|
||||
//选择类型
|
||||
mui('.ccclass').on('tap', '.block', function() {
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
$(this).parent().attr('data-class', $(this).attr('data-itemId'));
|
||||
|
||||
var data_itemId = $(this).attr('data-itemId');
|
||||
if($(this).attr('data-itemImg') != '') {
|
||||
$('.cclass_con .img').html('<img src="' + hyhImgUrl($(this).attr('data-itemImg')) + '" />');
|
||||
}
|
||||
|
||||
var arry = [];
|
||||
|
||||
$.each($('.cclass1'), function() {
|
||||
arry.push($(this).attr('data-class'))
|
||||
});
|
||||
arry.sort(function(a, b) {
|
||||
return a - b;
|
||||
});
|
||||
|
||||
arry_str = arry.join(':');
|
||||
|
||||
for(var i in data_saleSpec) {
|
||||
if(i == arry_str) {
|
||||
$('.cclass_con .cc2 p').html(data_saleSpec[i].specPrice);
|
||||
$('.cclass_con .cc2 span').html('库存' + data_saleSpec[i].specStock + '件');
|
||||
|
||||
if(data_saleSpec[i].is_seckilling && data_saleSpec[i].is_seckilling == 1) {
|
||||
miaoshaSaleSpec(data_saleSpec[i].id, data_saleSpec);
|
||||
} else {
|
||||
|
||||
$('.miaosha').html('');
|
||||
$('.miaosha').css('display', 'none');
|
||||
$('.price').html('¥' + data_saleSpec[i].specPrice);
|
||||
$('.price_old').html('市场价 <del>¥' + data_saleSpec[i].marketPrice + '</del>');
|
||||
$('.price').css('display', 'block');
|
||||
$('.price_old').css('display', 'block');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var num = +$('.change_num input').val();
|
||||
whslePrice(num, arry_str);
|
||||
|
||||
})
|
||||
//跳转选择类型
|
||||
|
||||
$('.footer').on('tap', '.btn_ljgm', function() {
|
||||
$('#changeclass_con').show();
|
||||
})
|
||||
//关闭
|
||||
mui('.cc2').on('tap', '.closecclass', function() {
|
||||
$('#changeclass_con').hide();
|
||||
})
|
||||
|
||||
mui('.en').on('tap', '.engwc', function() {
|
||||
$('#changeclass_con').hide();
|
||||
})
|
||||
|
||||
//改变数量
|
||||
mui('.change_num').on('tap', '.jia', function() {
|
||||
// //console.log($(this).siblings('input').val())
|
||||
var num = +$(this).siblings('input').val() + 1;
|
||||
if(num <= 0) {
|
||||
alert('购买数最小为1!');
|
||||
return;
|
||||
}
|
||||
$(this).siblings('input').val(num);
|
||||
whslePrice(num, arry_str)
|
||||
})
|
||||
mui('.change_num').on('tap', '.jian', function() {
|
||||
var num = +$(this).siblings('input').val() - 1;
|
||||
if(num <= 0) {
|
||||
alert('购买数最小为1!');
|
||||
return;
|
||||
}
|
||||
$(this).siblings('input').val(num);
|
||||
whslePrice(num, arry_str)
|
||||
})
|
||||
$('.change_num input').on('change', function() {
|
||||
var num = +$(this).val();
|
||||
|
||||
whslePrice(num, arry_str);
|
||||
})
|
||||
|
||||
mui('.mui-backdrop').on('tap', '.mask', function() {
|
||||
$('#changeclass_con').hide();
|
||||
})
|
||||
//加入购物车&购买
|
||||
mui('.en').on('tap', '.enarr', function() {
|
||||
|
||||
var that = $(this);
|
||||
// var goodsId = goodsId;
|
||||
var buyNum = $('.change_num input').val();
|
||||
var isGoodsSpecId = 0;
|
||||
var goodsSpecId = 0;
|
||||
var url = '';
|
||||
if($(this).hasClass('engwc')) {
|
||||
url = 'addCart';
|
||||
} else if($(this).hasClass('ensure')) {
|
||||
url = 'buy';
|
||||
}
|
||||
// //console.log(data_bak.isSpec)
|
||||
for(var i in data_saleSpec) {
|
||||
if(i == arry_str) {
|
||||
isGoodsSpecId = 1;
|
||||
goodsSpecId = data_saleSpec[i].id;
|
||||
}
|
||||
}
|
||||
if(isGoodsSpecId == 1) {
|
||||
// goodsSpecId = arry_str;
|
||||
} else if(data_bak.isSpec == 0) {
|
||||
goodsSpecId = 0;
|
||||
} else {
|
||||
alert('请选择商品分类!');
|
||||
return
|
||||
}
|
||||
if(goodsType==2 & $(this).hasClass('engwc')) {
|
||||
mui.alert ("助微吧商品不能加入购物车")
|
||||
return;
|
||||
}
|
||||
// //console.log(arry_str)
|
||||
// //console.log(goodsSpecId)
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/carts/' + url), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
if(goodsType){
|
||||
goodsType:goodsType
|
||||
},
|
||||
goodsId: goodsId,
|
||||
buyNum: buyNum,
|
||||
goodsSpecId: goodsSpecId
|
||||
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
|
||||
data = toJson(data);
|
||||
// //console.log(data.msg);
|
||||
// //console.log(data.status);
|
||||
if(data.status == 1) {
|
||||
if(url == 'buy') {
|
||||
mui.openWindow({
|
||||
url: 'confirmOrder.html',
|
||||
id: 'confirmOrder.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
// goodsId: goodsId
|
||||
|
||||
type: 1
|
||||
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if(url == 'addCart') {
|
||||
mui.alert('添加购物车成功!')
|
||||
}
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
//location.reload();
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
//打开评价列表
|
||||
mui('.con_').on('tap', '.pjrk', function() {
|
||||
JZL.openWindow('appraise.html','appraise.html',{goodsId: goodsId});
|
||||
})
|
||||
$('.footer').on('tap', '#scbtn', function() {
|
||||
var goodId = goodsId;
|
||||
var that = $(this);
|
||||
if($('#scbtn p').html() == '收藏') {
|
||||
mui.ajax(qlgUrl('app/Favorites/add'), {
|
||||
|
||||
data: {
|
||||
id: goodId,
|
||||
type : 0
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
// //console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
$('#scbtn p').html('已收藏');
|
||||
$('#scbtn p').css('color', '#E41F4A');
|
||||
$('#scbtn img').attr('src', '../img/likelogo1.png');
|
||||
// that.addClass('gz_btn1').removeClass('gz_btn');
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
////console.log(data.status)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mui.ajax(hyhUrl('app/Favorites/cancel'), {
|
||||
|
||||
data: {
|
||||
id: goodId,
|
||||
type : 0
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
// //console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
$('#scbtn p').html('收藏');
|
||||
$('#scbtn p').css('color', '#8f8f94');
|
||||
$('#scbtn img').attr('src', '../img/likelogo.png');
|
||||
// that.addClass('gz_btn1').removeClass('gz_btn');
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
////console.log(data.status)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
$('.footer').on('tap', '#storebtn', function() {
|
||||
var shopId = this.attributes["data-shopId"].nodeValue;
|
||||
JZL.openWindow('storeout.html','storeout.html'+ shopId,{shopId: shopId,shopName:shopName});
|
||||
})
|
||||
$('.con').on('tap', '.shop_title p', function() {
|
||||
var shopId = this.attributes["data-shopId"].nodeValue;
|
||||
JZL.openWindow('storeout.html','storeout.html'+ shopId,{shopId: shopId});
|
||||
})
|
||||
//弹出优惠券
|
||||
$('.con_').on('tap', '.lq', function() {
|
||||
$('#youhuiquan_con').css('display', 'block');
|
||||
})
|
||||
//关闭优惠券
|
||||
$('#youhuiquan_con').on('tap', '.thq_close', function() {
|
||||
$('#youhuiquan_con').css('display', 'none');
|
||||
})
|
||||
//领取优惠券
|
||||
$('#youhuiquan_con').on('tap', '.lq_btn', function() {
|
||||
var couponId = $(this).attr('data-couponId');
|
||||
mui.ajax(hyhUrl('addon/coupon-Coupons-receive'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
couponId: couponId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
|
||||
var data = toJson(data);
|
||||
alert(data.msg);
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
//联系客服
|
||||
|
||||
$('#lxkf').on('tap', function() {
|
||||
if(shopQQ) {
|
||||
// location.href="http://wpa.qq.com/msgrd?v=3&uin="+ shopQQ +"&site=qq&menu=yes";
|
||||
// mui.back();
|
||||
// window.open("http://wpa.qq.com/msgrd?v=3&uin="+ shopQQ +"&site=qq&menu=yes")
|
||||
if(plus.os.name == "iOS") {
|
||||
plus.runtime.launchApplication({
|
||||
action: "mqq://im/chat?chat_type=wpa&uin=" + shopQQ + "&version=1&src_type=web"
|
||||
}, function(e) {
|
||||
plus.nativeUI.confirm("检查到您未安装qq,请先到appstore搜索下载?", function(i) {
|
||||
if(i.index == 0) {
|
||||
iosAppstore("itunes.apple.com/cn/app/mqq/");
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if(plus.os.name == "Android") {
|
||||
var Intent = plus.android.importClass('android.content.Intent');
|
||||
var Uri = plus.android.importClass('android.net.Uri');
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var uri = Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin=" + shopQQ);
|
||||
main.startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
}
|
||||
}
|
||||
})
|
||||
//分享
|
||||
$('.con_').on('tap', '#share', function() {
|
||||
shareHref();
|
||||
})
|
||||
|
||||
|
||||
|
||||
})
|
||||
// var self = plus.webview.currentWebview();
|
||||
// //console.log(self.aaa)
|
448
static/app2/js/details_ac.js
Executable file
448
static/app2/js/details_ac.js
Executable file
@ -0,0 +1,448 @@
|
||||
mui.plusReady(function() {
|
||||
var data = '';
|
||||
var data_saleSpec = {}
|
||||
var arry_str = '';
|
||||
var self = plus.webview.currentWebview();
|
||||
var data_id = self.data_id;
|
||||
var data_bak = {}
|
||||
|
||||
function whslePrice(num, arry_str) {
|
||||
for(var i in data_saleSpec) {
|
||||
if(i == arry_str) {
|
||||
if(num >= (+(data_saleSpec[i].initNum))) {
|
||||
$('.cclass_con .cc2 p').html(data_saleSpec[i].whslePrice);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var i in data_saleSpec) {
|
||||
if(i == arry_str) {
|
||||
if(num < (+(data_saleSpec[i].initNum))) {
|
||||
$('.cclass_con .cc2 p').html(data_saleSpec[i].specPrice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mui.ajax(hyhUrl('app/Goods/detail'), {
|
||||
data: {
|
||||
goodsId: data_id
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
|
||||
var data = toJson(data);
|
||||
if(data.status != 1) {
|
||||
mui.alert('加载失败请重试!');
|
||||
}
|
||||
data = data.data;
|
||||
data_bak = data;
|
||||
var html = '<div class="banner"><div class="swiper-container"><div class="swiper-wrapper">';
|
||||
|
||||
$.each(data.gallery, function() {
|
||||
html += '<div class="swiper-slide"><img src="' + hyhImgUrl(this) + '" /></div>';
|
||||
});
|
||||
|
||||
html += '</div></div></div><div class="summarize"><p class="price">¥' + data.shopPrice + '</p><p class="price_old">价格 <del>¥' + data.marketPrice + '</del></p><div class="compilations"><span class="myf">';
|
||||
|
||||
if(data.isFreeShipping == '1') {
|
||||
html += '免运费';
|
||||
} else {
|
||||
html += '不包邮';
|
||||
}
|
||||
html += '</span><span class="yx">月销:' + data.saleNum + '件</span><span class="dz"></span></div><p class="cname">商品介绍 ' + data.goodsTips + '</p></div><div class="guarantee"><div class="row clearfix" style="display:none"><img src="../img/gouwuquan.png" /><span class="text">全合源惠实物商品通用</span><button class="lq">领取</button></div><div class="row clearfix"><img src="../img/jifen.png" /><span class="text">购买后可获得100%积分</span></div><div class="row clearfix"><span class="text">正品保证 · 公益宝贝 · 赠运险费 · 极速退款 · 七天退货</span><button class="caidan" style="display:none"><img src="../img/menu.png"/></button></div></div><div class="guarantee" id="guarantee"><div class="row clearfix" id="changeclass"><span class="text">选择颜色分类 号码尺寸</span><button class="caidan"><img src="../img/menu.png"/></button></div></div>';
|
||||
if(data.oneAppraises == '') {
|
||||
|
||||
} else {
|
||||
html += '<div class="pjrk" style="display:none"><p class="pj_title">商品评价(' + data.appraiseNum + ')</p><div class="pj_breviary"><div class="pjbtitle clearfix"><img src="' + hyhImgUrl(data.oneAppraises.userPhoto) + '" /><p>' + data.oneAppraises.loginName + '</p></div><div class="pjbcon">' + data.oneAppraises.content + '</div><div class="pjclass">' + data.oneAppraises.goodsSpecNames + '</div></div><div class="pj_all">查看全部评价</div></div>';
|
||||
}
|
||||
|
||||
html += '<div class="shop_info"><div class="shop_title clearfix"><img src="' + hyhImgUrl(data.shop.shopImg) + '" /><p>' + data.shop.shopName + '</p></div><div class="shopinfocon clearfix"><div class="sicl"><div class="sicl_p1">' + data.goodsCount + '</div><div class="sicl_p2">全部宝贝</div></div><div class="sicl"><div class="sicl_p1">' + data.newGoodsCount + '</div><div class="sicl_p2">上新宝贝</div></div><div class="sicl"><div class="sicl_p1">' + data.favoritesShopsNum + '</div><div class="sicl_p2">关注人数</div></div><div class="sicr"><div class="sicr_p">宝贝描述 <o>' + data.shop.goodsScore + '</o></div><div class="sicr_p">卖家服务 <o>' + data.shop.serviceScore + '</o></div><div class="sicr_p">物流服务 <o>' + data.shop.timeScore + '</o></div></div></div></div><div class="imgcon">' + data.goodsDesc + '</div>';
|
||||
$('.con').html(html);
|
||||
|
||||
$('.cclass_con .img').html('<img src="' + hyhImgUrl(data.goodsImg) + '" />');
|
||||
$('.cclass_con .cc2 p').html(data.shopPrice);
|
||||
$('.cclass_con .cc2 span').html('库存' + data.goodsStock + '件');
|
||||
$('#storebtn').attr('data-shopId', data.shopId)
|
||||
var swiper = new Swiper('.swiper-container', {
|
||||
pagination: '.swiper-pagination',
|
||||
paginationClickable: true,
|
||||
spaceBetween: 30,
|
||||
autoplay: 3000
|
||||
});
|
||||
var html1 = '';
|
||||
$.each(data.spec, function() {
|
||||
html1 += '<div class="cclass1 clearfix" data-class=""><p>' + this.name + '</p>'
|
||||
$.each(this.list, function() {
|
||||
html1 += '<div class="block" data-itemId="' + this.itemId + '">' + this.itemName + '</div>'
|
||||
});
|
||||
|
||||
html1 += '</div>'
|
||||
});
|
||||
$('.ccclass').html(html1)
|
||||
|
||||
for(var i in data.saleSpec) {
|
||||
data_saleSpec[i] = data.saleSpec[i];
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
var scroll = mui('.mui-scroll-wrapper').scroll({
|
||||
deceleration: 0.002 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
|
||||
});
|
||||
|
||||
//导航栏渐变
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
|
||||
var num;
|
||||
|
||||
if(scroll.y >= -387 && scroll.y < 0) {
|
||||
|
||||
num = scroll.y / -387;
|
||||
// console.log('渐变',num)
|
||||
$('.header1').css({
|
||||
'display': 'block',
|
||||
'opacity': num
|
||||
})
|
||||
$('.zhe').css({
|
||||
'display': 'block',
|
||||
'opacity': num
|
||||
})
|
||||
var num1 = 0.2 - num * 0.2;
|
||||
// $('.header .mui-action-back').css('background', 'rgba(0,0,0,' + num1 + ')')
|
||||
} else if(scroll.y >= 0) {
|
||||
num = 0;
|
||||
// console.log('透明',num)
|
||||
$('.header1').css({
|
||||
'display': 'none',
|
||||
'opacity': num
|
||||
})
|
||||
$('.zhe').css({
|
||||
'display': 'none',
|
||||
'opacity': num
|
||||
})
|
||||
// $('.header .mui-action-back').css('background', 'rgba(0, 0, 0, 0.2)')
|
||||
} else if(scroll.y < -387) {
|
||||
|
||||
num = 1;
|
||||
// console.log('不透明',num)
|
||||
$('.header1').css({
|
||||
'display': 'block',
|
||||
'opacity': num
|
||||
})
|
||||
$('.zhe').css({
|
||||
'display': 'block',
|
||||
'opacity': num
|
||||
});
|
||||
// $('.header .mui-action-back').css('background', 'rgba(0, 0, 0, 0.2)')
|
||||
}
|
||||
//导航栏自动切换
|
||||
if($('.imgcon').offset().top >= 66) {
|
||||
$('#nav1').addClass("on").siblings().removeClass('on');
|
||||
} else if($('.imgcon').offset().top < 66) {
|
||||
$('#nav3').addClass("on").siblings().removeClass('on');
|
||||
}
|
||||
})
|
||||
//点击导航栏跳转
|
||||
mui('.nav').on('tap', '#nav1', function() {
|
||||
mui('.mui-scroll-wrapper').scroll().scrollTo(0, 0, 100);
|
||||
$('#nav1').addClass("on").siblings().removeClass('on');
|
||||
});
|
||||
mui('.nav').on('tap', '#nav2', function() {
|
||||
mui.openWindow({
|
||||
url: 'appraise.html',
|
||||
id: 'appraise.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: data_id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
mui('.nav').on('tap', '#nav3', function() {
|
||||
mui('.mui-scroll-wrapper').scroll().scrollTo(0, -1124, 100);
|
||||
$('#nav3').addClass("on").siblings().removeClass('on');
|
||||
});
|
||||
|
||||
mui('.con').on('tap', '#changeclass', function() {
|
||||
$('#changeclass_con').show();
|
||||
})
|
||||
|
||||
//选择类型
|
||||
mui('.ccclass').on('tap', '.block', function() {
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
$(this).parent().attr('data-class', $(this).attr('data-itemId'));
|
||||
|
||||
var data_itemId = $(this).attr('data-itemId');
|
||||
|
||||
$.each(data.spec, function() {
|
||||
$.each(this.list, function() {
|
||||
if(this.itemId == data_itemId && this.itemImg != '') {
|
||||
$('.cclass_con .img').html('<img src="' + hyhImgUrl(this.itemImg) + '" />');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var arry = [];
|
||||
|
||||
$.each($('.cclass1'), function() {
|
||||
arry.push($(this).attr('data-class'))
|
||||
});
|
||||
arry.sort(function(a, b) {
|
||||
return a - b;
|
||||
});
|
||||
|
||||
arry_str = arry.join(':');
|
||||
$.each(data.saleSpec, function() {
|
||||
if(this == arry_str) {
|
||||
$('.cclass_con .cc2 p').html(this.specPrice);
|
||||
$('.cclass_con .cc2 span').html('库存' + this.specStock + '件');
|
||||
}
|
||||
});
|
||||
|
||||
for(var i in data_saleSpec) {
|
||||
if(i == arry_str) {
|
||||
$('.cclass_con .cc2 p').html(data_saleSpec[i].specPrice);
|
||||
$('.cclass_con .cc2 span').html('库存' + data_saleSpec[i].specStock + '件');
|
||||
}
|
||||
}
|
||||
|
||||
var num = +$('.change_num input').val();
|
||||
whslePrice(num, arry_str);
|
||||
})
|
||||
//跳转选择类型
|
||||
|
||||
$('.footer').on('tap', '.btn_ljgm', function() {
|
||||
$('#changeclass_con').show();
|
||||
})
|
||||
|
||||
mui('.cc2').on('tap', '.closecclass', function() {
|
||||
$('#changeclass_con').hide();
|
||||
})
|
||||
|
||||
mui('.en').on('tap', '.engwc', function() {
|
||||
$('#changeclass_con').hide();
|
||||
})
|
||||
|
||||
//改变数量
|
||||
mui('.change_num').on('tap', '.jia', function() {
|
||||
// console.log($(this).siblings('input').val())
|
||||
var num = +$(this).siblings('input').val() + 1;
|
||||
if(num <= 0) {
|
||||
alert('购买数最小为1!');
|
||||
return;
|
||||
}
|
||||
$(this).siblings('input').val(num);
|
||||
whslePrice(num, arry_str)
|
||||
})
|
||||
mui('.change_num').on('tap', '.jian', function() {
|
||||
var num = +$(this).siblings('input').val() - 1;
|
||||
if(num <= 0) {
|
||||
alert('购买数最小为1!');
|
||||
return;
|
||||
}
|
||||
$(this).siblings('input').val(num);
|
||||
whslePrice(num, arry_str)
|
||||
})
|
||||
$('.change_num input').on('change', function() {
|
||||
var num = +$(this).val();
|
||||
|
||||
whslePrice(num, arry_str);
|
||||
})
|
||||
//加入购物车&购买
|
||||
mui('.en').on('tap', '.enarr', function() {
|
||||
|
||||
var that = $(this);
|
||||
var goodsId = data_id;
|
||||
var buyNum = $('.change_num input').val();
|
||||
var isGoodsSpecId = 0;
|
||||
var goodsSpecId = 0;
|
||||
var url = '';
|
||||
if($(this).hasClass('engwc')) {
|
||||
url = 'addCart';
|
||||
} else if($(this).hasClass('ensure')) {
|
||||
url = 'buy';
|
||||
}
|
||||
// console.log(data_bak.isSpec)
|
||||
for(var i in data_saleSpec) {
|
||||
if(i == arry_str) {
|
||||
isGoodsSpecId = 1;
|
||||
}
|
||||
}
|
||||
if(isGoodsSpecId == 1) {
|
||||
goodsSpecId = arry_str;
|
||||
} else if(data_bak.isSpec == 0) {
|
||||
goodsSpecId = 0;
|
||||
} else {
|
||||
alert('请选择商品分类!');
|
||||
return
|
||||
}
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/carts/' + url), {
|
||||
data: {
|
||||
goodsId: goodsId,
|
||||
buyNum: buyNum,
|
||||
goodsSpecId: goodsSpecId
|
||||
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
|
||||
data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
if(url == 'buy') {
|
||||
mui.openWindow({
|
||||
url: 'confirmOrder.html',
|
||||
id: 'confirmOrder.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
// data_id: data_id
|
||||
|
||||
type: 1
|
||||
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if(url == 'addCart') {
|
||||
alert('添加购物车成功!')
|
||||
}
|
||||
|
||||
} else {
|
||||
alert(data.msg);
|
||||
//location.reload();
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
//打开评价列表
|
||||
mui('.con').on('tap', '.pjrk', function() {
|
||||
mui.openWindow({
|
||||
url: 'appraise.html',
|
||||
id: 'appraise.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: data_id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
$('.footer').on('tap', '#storebtn', function() {
|
||||
var shopId = this.attributes["data-shopId"].nodeValue;
|
||||
var url = 'storeout.html';
|
||||
if(shopId==1){
|
||||
url='self_shop.html'
|
||||
}
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url+shopId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
shopId: shopId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
// var self = plus.webview.currentWebview();
|
||||
// console.log(self.aaa)
|
164
static/app2/js/discount.js
Executable file
164
static/app2/js/discount.js
Executable file
@ -0,0 +1,164 @@
|
||||
$('.mui-action-back').css('display', 'none');
|
||||
$('.header_con img').attr('src', hyhImgUrl('static/app2/img/sale.png'));
|
||||
var topTypeId = '40';
|
||||
var secTypeId = '';
|
||||
var pageSize = 10;
|
||||
var page = 1;
|
||||
var isjiazai = 1;
|
||||
|
||||
function lxy_dis(topTypeId, secTypeId, page, pageSize) {
|
||||
|
||||
var lxy_data_ = {
|
||||
topTypeId: topTypeId ? topTypeId : '40',
|
||||
secTypeId: secTypeId ? secTypeId : '',
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 10
|
||||
}
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
mui.ajax(llUrl('addon/hyhlimitactive-Hyhlimitactive-actGoodsList'), {
|
||||
data: lxy_data_,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data.data.goodsFavoritesNum)
|
||||
//console.log(data.data.Rows)
|
||||
|
||||
//var data = toJson(data);
|
||||
var data = data.data
|
||||
var html = '';
|
||||
|
||||
if(data.Rows == '') {
|
||||
|
||||
if(page == 1) {
|
||||
$('#recommend_con').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
} else {
|
||||
$('#recommend_con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
}
|
||||
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="img" src="' + ectImgUrl(this.goodsImg) + '" /><p class="p1">' + this.goodsName + '</p><p class="p2">享' + parseInt(this.shopPrice * 10 / this.marketPrice) + '折优惠</p><p class="p3">¥<o>' + this.shopPrice + '</o></p><del><o>' + this.marketPrice + '</o></del><button>立即购买</button></div>'
|
||||
});
|
||||
|
||||
if(page == 1) {
|
||||
$('#recommend_con').html(html);
|
||||
} else {
|
||||
$('#recommend_con').append(html);
|
||||
}
|
||||
|
||||
isjiazai = 1;
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
|
||||
mui.ajax(llUrl('addon/hyhlimitactive-Hyhlimitactive-actList'), {
|
||||
data: {
|
||||
topTypeId: topTypeId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data.data.goodsFavoritesNum);
|
||||
//console.log(data.data.Rows);
|
||||
//console.log(data.status);
|
||||
//var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
var data = data.data
|
||||
var html = '';
|
||||
var len = 0;
|
||||
$.each(data.lists, function() {
|
||||
html += '<div class="swiper-slide nav_block" data-secTypeId="' + this.secTypeId + '"><p class="p1">' + this.secTypeName + '</p></div>'
|
||||
|
||||
});
|
||||
$('.nav').html(html);
|
||||
|
||||
if(data.lists.length > 5) {
|
||||
len = 4.5
|
||||
} else {
|
||||
len = data.lists.length;
|
||||
}
|
||||
var swiper = new Swiper('#timer_swiper', {
|
||||
slidesPerView: len,
|
||||
paginationClickable: true,
|
||||
spaceBetween: 0,
|
||||
freeMode: true
|
||||
});
|
||||
|
||||
$('.nav_block').eq(0).addClass('on');
|
||||
secTypeId = $('.nav_block').eq(0).attr('data-secTypeId');
|
||||
lxy_dis(topTypeId, secTypeId, 1, 10);
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
})
|
||||
|
||||
mui('.nav').on('tap', '.nav_block', function() {
|
||||
secTypeId = $(this).attr('data-secTypeId');
|
||||
page = 1;
|
||||
isjiazai=1;
|
||||
lxy_dis(topTypeId, secTypeId, page, 10);
|
||||
|
||||
})
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
lxy_dis(topTypeId, secTypeId, page, pageSize);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
$('#recommend_con').on('tap', '.con_block', function() {
|
||||
var good_id = $(this).attr('data-goodsId');
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + good_id,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: good_id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
80
static/app2/js/discounts.js
Executable file
80
static/app2/js/discounts.js
Executable file
@ -0,0 +1,80 @@
|
||||
jumpPage();
|
||||
|
||||
function jumpPage() {
|
||||
//跳转页面
|
||||
var subpages = ['choiceness.html', 'dynamic.html', 'new_product.html'];
|
||||
var subpage_style = {
|
||||
top: '103px',
|
||||
bottom: '0px',
|
||||
scrollIndicator: 'none'
|
||||
};
|
||||
|
||||
var aniShow = {}; //动画显示
|
||||
//当前激活选项
|
||||
var activeTab = subpages[0];
|
||||
//选项卡点击事件
|
||||
mui('.nav').on('tap', 'a', function(e) {
|
||||
var targetTab = this.getAttribute('href');
|
||||
if(targetTab == activeTab) {
|
||||
return;
|
||||
}
|
||||
//显示目标选项卡
|
||||
//若为iOS平台或非首次显示,则直接显示
|
||||
if(mui.os.ios || aniShow[targetTab]) {
|
||||
plus.webview.show(targetTab);
|
||||
} else {
|
||||
//否则,使用fade-in动画,且保存变量
|
||||
var temp = {};
|
||||
temp[targetTab] = "true";
|
||||
mui.extend(aniShow, temp);
|
||||
plus.webview.show(targetTab, "fade-in", 300);
|
||||
}
|
||||
//隐藏当前;
|
||||
plus.webview.hide(activeTab);
|
||||
//更改当前活跃的选项卡
|
||||
activeTab = targetTab;
|
||||
|
||||
if(targetTab == 'choiceness.html') {
|
||||
document.getElementsByClassName('p1')[1].classList.remove('on')
|
||||
document.getElementsByClassName('p1')[2].classList.remove('on')
|
||||
this.classList.add('on');
|
||||
}
|
||||
|
||||
if(targetTab == 'dynamic.html') {
|
||||
document.getElementsByClassName('p1')[0].classList.remove('on')
|
||||
document.getElementsByClassName('p1')[2].classList.remove('on')
|
||||
this.classList.add('on');
|
||||
}
|
||||
|
||||
if(targetTab == 'new_product.html') {
|
||||
document.getElementsByClassName('p1')[0].classList.remove('on')
|
||||
document.getElementsByClassName('p1')[1].classList.remove('on')
|
||||
this.classList.add('on');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//首次启动切滑效果
|
||||
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('refresh', function(e) {
|
||||
location.reload();
|
||||
})
|
||||
// launchScreen();
|
||||
// plus.navigator.setStatusBarStyle('dark');
|
||||
// //console.log(plus.navigator.getStatusBarStyle())
|
||||
var self = plus.webview.currentWebview();
|
||||
for(var i = 0; i < subpages.length; i++) {
|
||||
var temp = {};
|
||||
//http://www.html5plus.org/doc/zh_cn/webview.html#plus.webview.create
|
||||
var sub = plus.webview.create(subpages[i], subpages[i], subpage_style);
|
||||
if(i > 0) {
|
||||
sub.hide();
|
||||
} else {
|
||||
temp[subpages[i]] = "true";
|
||||
mui.extend(aniShow, temp); //合并对象
|
||||
}
|
||||
self.append(sub);
|
||||
}
|
||||
});
|
||||
}
|
98
static/app2/js/distribution.js
Executable file
98
static/app2/js/distribution.js
Executable file
@ -0,0 +1,98 @@
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
var userId = self.userId
|
||||
var idx = 0;
|
||||
var curIdx;
|
||||
var productNum = "";
|
||||
var couponsNum = '';
|
||||
var click = false;
|
||||
var type, payPwd, num;
|
||||
//获取数据
|
||||
JZL.ajax(qlgUrl('app/users/getInvestmentMoney'), {
|
||||
userId: userId
|
||||
}, function(data) {
|
||||
// console.log(data);
|
||||
if (1 == data.status) {
|
||||
var data = data.data;
|
||||
productNum = data.productNum;
|
||||
couponsNum = data.couponsNum;
|
||||
$(".product .productNum").val(productNum);
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$(".nav").on("tap", ".nav-item", function() {
|
||||
curIdx = idx
|
||||
idx = $(this).index()
|
||||
|
||||
$(".nav .nav-item ").eq(idx).addClass("active")
|
||||
$(".nav .nav-item ").not($(".nav .nav-item ").eq(idx)).removeClass("active")
|
||||
$(".content .content_ ").eq(idx).show()
|
||||
$(".content .content_ ").not($(".content .content_ ").eq(idx)).hide()
|
||||
if (0 == idx) { //product
|
||||
if (curIdx != idx) {
|
||||
//获取数据
|
||||
$(".product .productNum").val(productNum);
|
||||
}
|
||||
|
||||
} else if (1 == idx) { //voucher
|
||||
if (curIdx != idx) {
|
||||
//获取数据
|
||||
$('.voucher .couponsNum ').val(couponsNum)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
$(".down").on("tap", function() {
|
||||
if (true == click) {
|
||||
return
|
||||
}
|
||||
click = true;
|
||||
|
||||
|
||||
if ('' == $('.product .productNum').val() || '' == $.trim($('.product .productNum').val())) {
|
||||
mui.alert("券值不能为空");
|
||||
return;
|
||||
}
|
||||
if ($('.product .productNum').val() < 15) {
|
||||
mui.alert("券值不能低于15 ");
|
||||
return;
|
||||
}
|
||||
|
||||
if (0 == idx) { //product
|
||||
num = parseFloat($('.product .productNum').val())
|
||||
type = 1;
|
||||
payPwd = $('.proPassWord').val();
|
||||
|
||||
}
|
||||
if (1 == idx) { //voucher
|
||||
//ajax
|
||||
num = parseFloat($('.voucher .couponsNum').val())
|
||||
type = 2;
|
||||
payPwd = $('.vouPassWord').val();
|
||||
|
||||
}
|
||||
if ('' == payPwd) {
|
||||
mui.alert("操作密码不能为空");
|
||||
return;
|
||||
}
|
||||
console.log(idx);
|
||||
JZL.ajax(qlgUrl("app/users/distributionInvestmentMoney"), {
|
||||
userId: userId,
|
||||
type: type,
|
||||
num: num,
|
||||
payPwd: payPwd
|
||||
}, function(data) {
|
||||
if (1 == data.status){
|
||||
mui.toast(data.msg)
|
||||
mui.back();
|
||||
}else {
|
||||
mui.alert (data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
})
|
175
static/app2/js/dynamic.js
Executable file
175
static/app2/js/dynamic.js
Executable file
@ -0,0 +1,175 @@
|
||||
var token = localStorage.getItem('token');
|
||||
mui.init({
|
||||
pullRefresh: {
|
||||
container: '#pullrefresh',
|
||||
down: {
|
||||
style: 'circle', //必选,下拉刷新样式,目前支持原生5+ ‘circle’ 样式
|
||||
color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
|
||||
height: '50px', //可选,默认50px.下拉刷新控件的高度,
|
||||
range: '100px', //可选 默认100px,控件可下拉拖拽的范围
|
||||
offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
|
||||
// auto: true, //可选,默认false.首次加载自动上拉刷新一次
|
||||
contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
|
||||
contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
|
||||
contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
|
||||
callback: pulldownRefresh //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
|
||||
},
|
||||
up: {
|
||||
contentrefresh: '正在加载...',
|
||||
callback: pullupRefresh
|
||||
}
|
||||
}
|
||||
});
|
||||
var count = 1;
|
||||
|
||||
function pullupRefresh() {
|
||||
setTimeout(function() {
|
||||
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
|
||||
count += 1;
|
||||
// console.log(order_class)
|
||||
mui.ajax(hyhUrl('addon/hyhprom-Hyhpromuser-getShopPromByUser'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
page: count,
|
||||
pagesize : 10
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.data.goodsFavoritesNum)
|
||||
// console.log(data.data.Rows)
|
||||
|
||||
var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
data = data.data;
|
||||
if(data.Rows.length == 0) {
|
||||
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
|
||||
return;
|
||||
}
|
||||
var html = ''
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId + '"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName + '</p><p class="time">' + this.newTime + '</p></div><div class="b_con clearfix">' + this.promInfo + '</div></div>'
|
||||
});
|
||||
$('.con').append(html);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉刷新具体业务实现
|
||||
*/
|
||||
function pulldownRefresh() {
|
||||
setTimeout(function() {
|
||||
window.location.reload();
|
||||
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
|
||||
}, 1500);
|
||||
}
|
||||
mui.plusReady(function() {
|
||||
var data = '';
|
||||
mui.ajax(hyhUrl('addon/hyhprom-Hyhpromuser-getShopPromByUser'), {
|
||||
data: {
|
||||
pagesize: 10,
|
||||
page: 1
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
if(data.status == 1) {
|
||||
data = toJson(data);
|
||||
data = data.data;
|
||||
var html = '';
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="block"><div class="b_title" data-shopId="' + this.shopId + '"><img class="b_img" src="' + hyhImgUrl(this.shopImg) + '" /><p class="storename">' + this.shopName + '</p><p class="time">' + this.updateTime + '</p></div><div class="b_con clearfix">' + this.promInfo + '</div></div>'
|
||||
});
|
||||
$('.con').html(html);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
mui('.con').on('tap', '.b_title', function() {
|
||||
var shopId = $(this).attr('data-shopId');
|
||||
var url = 'storeout.html';
|
||||
if(shopId==1){
|
||||
// url='self_shop.html'
|
||||
}
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url+shopId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
shopId: shopId
|
||||
// data_id: data_id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
mui('.con').on('tap', 'img[data-goodId]', function() {
|
||||
var goodId = $(this).attr('data-goodId');
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html'+goodId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: goodId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
159
static/app2/js/ect_address.js
Executable file
159
static/app2/js/ect_address.js
Executable file
@ -0,0 +1,159 @@
|
||||
$('.add').css('display','none');
|
||||
$('body').append('<button class="addAddress">添加地址</button>');
|
||||
mui.plusReady(function() {
|
||||
|
||||
// function hyhUrl(url) {
|
||||
// return 'http://192.168.1.101/hyh/' + url;
|
||||
// }
|
||||
|
||||
var token = localStorage.getItem('token');
|
||||
|
||||
// alert(token);
|
||||
|
||||
mui.ajax(hyhUrl('app/Ectwallets/listQuery'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
if(data.data != '') {
|
||||
$.each(data.data, function() {
|
||||
html += '<div class="row shadown_wai"><div class="r_con"><p>钱包地址 ' + this.eAddress + '</p></div><div class="r_bottom " data-eWalletId="' + this.eWalletId + '" data-isDefault="' + this.isDefault + '"><div class="default "><div class="check mui-icon mui-icon-checkmarkempty"></div><p>设为默认</p></div><div class="del"><a class="mui-icon mui-icon-trash del_icon"></a><div class="del_text">删除</div></div></div></div>';
|
||||
});
|
||||
$('.mui-scroll').html(html);
|
||||
|
||||
$('.row').each(function() {
|
||||
if($(this).children('.r_bottom').attr('data-isDefault') == 1) {
|
||||
$(this).children('.r_bottom').children('.default').children('.check').addClass('on');
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
//设为默认
|
||||
$('.mui-scroll').on('tap', '.default', function() {
|
||||
|
||||
if($(this).parent().attr('data-isDefault') == 0) {
|
||||
if(confirm('设为默认地址?')) {
|
||||
var eWalletId = $(this).parent().attr('data-eWalletId');
|
||||
// console.log(eWalletId)
|
||||
mui.ajax(hyhUrl('app/Ectwallets/setDefault'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
eWalletId: eWalletId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
plus.nativeUI.toast(data.msg);
|
||||
location.reload();
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
//删除地址
|
||||
$('.mui-scroll').on('tap', '.del', function() {
|
||||
if(confirm('删除地址?')) {
|
||||
var eWalletId = $(this).parent().attr('data-eWalletId');
|
||||
// console.log(eWalletId)
|
||||
mui.ajax(hyhUrl('app/Ectwallets/del'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
eWalletId: eWalletId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
plus.nativeUI.toast(data.msg);
|
||||
location.reload();
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//添加地址
|
||||
$('body').on('tap','.addAddress', function() {
|
||||
var eAddress = '';
|
||||
var eAddress_ = '';
|
||||
|
||||
if(eAddress = prompt('请输入钱包地址')) {
|
||||
if(eAddress.length != 42) {
|
||||
alert('钱包地址长度必须为42位');
|
||||
return;
|
||||
}
|
||||
// if(eAddress_ = prompt('请再次输入钱包地址')) {
|
||||
// if(eAddress == eAddress_) {
|
||||
var isDefault = 0;
|
||||
if(confirm('是否设为默认地址?')) {
|
||||
isDefault = 1;
|
||||
}
|
||||
mui.ajax(hyhUrl('app/Ectwallets/add'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
eAddress: eAddress,
|
||||
isDefault: isDefault
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
plus.nativeUI.toast(data.msg);
|
||||
location.reload();
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// alert('两次地址输入不一致!');
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
})
|
||||
})
|
270
static/app2/js/ect_area.js
Executable file
270
static/app2/js/ect_area.js
Executable file
@ -0,0 +1,270 @@
|
||||
$('.mui-title').html('ECT专区');
|
||||
var ect_top = '<div class="ect_top"><p class="ect_m">最新价</p><p class="ect_m">24H成交量</p><img src="http://img.juzi199.com/Upload/app/icon/star.png" /><p class="ect_m" id="last"></p><p class="ect_m" id="vol"></p></div>';
|
||||
$('header').before(ect_top);
|
||||
|
||||
$('.mui-scroll-wrapper').removeClass('scroll_out1').addClass('scroll_out3');
|
||||
var info = '<img src="http://img.juzi199.com/Upload/app/icon/info.png" class="tanhao" />';
|
||||
$('header').append(info);
|
||||
var nav = '<div class="nav clearfix"></div>';
|
||||
$('.ect_top').before(nav);
|
||||
var nav_data = [];
|
||||
var secTypeId = 0;
|
||||
var timestamp1 = Date.parse(new Date());
|
||||
if(timestamp1 >= 1537027200000) {
|
||||
secTypeId = 4;
|
||||
nav_data = [{
|
||||
"secTypeId": 4,
|
||||
"name": "海鲜大咖"
|
||||
}, {
|
||||
"secTypeId": 5,
|
||||
"name": "为您推荐"
|
||||
}];
|
||||
} else {
|
||||
secTypeId = 1;
|
||||
nav_data = [{
|
||||
"secTypeId": 1,
|
||||
"name": "9.15元专区"
|
||||
}, {
|
||||
"secTypeId": 2,
|
||||
"name": "满199减100"
|
||||
}, {
|
||||
"secTypeId": 3,
|
||||
"name": "买二赠一专区"
|
||||
}, {
|
||||
"secTypeId": 4,
|
||||
"name": "海鲜大咖"
|
||||
}, {
|
||||
"secTypeId": 5,
|
||||
"name": "为您推荐"
|
||||
}];
|
||||
}
|
||||
|
||||
var issx = 0;
|
||||
var doller = 0;
|
||||
function getData(secTypeId) {
|
||||
// mui('').pullRefresh().scroll(0, 0, 0);
|
||||
backTop();
|
||||
var data_set = {
|
||||
secTypeId: secTypeId,
|
||||
topTypeId: 1
|
||||
};
|
||||
mui.ajax(llUrl('addon/hyhlimitactive-Hyhlimitactive-frontList'), {
|
||||
data: data_set,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
|
||||
data = data.data;
|
||||
var html_ = '';
|
||||
var htmlcon = '';
|
||||
doller = data.doller;
|
||||
if(data.secTypeId == 5 || data.secTypeId == 4) {
|
||||
htmlcon = '<div class="ect_activity"><img src="http://img.juzi199.com/static/app/img/e' + secTypeId + '.png" class="ect_hd" /></div>'
|
||||
} else {
|
||||
htmlcon = '<div class="ect_activity_"><img src="http://img.juzi199.com/static/app/img/countdown.png" class="ect_djs" /> <span id="_h">00</span><span id="_m">00</span><span id="_s">00</span></div>'
|
||||
html_ = '<div class="day"><p>此活动仅限14-15号两天</p></div>';
|
||||
}
|
||||
|
||||
$.each(data.list, function() {
|
||||
htmlcon += '<div class="ect_com" data-id="' + this.goodsId + '"><div class="com_img1" ><img src="' + hyhImgUrl(this.goodsImg) + '" /></div><p class="p1"><img src="http://img.juzi199.com/static/app/img/ectb.png" class="com_img2" />' + this.goodsName + '</p><p class="p3"><l></l>CNY <o>' + this.shopPrice + '</o></p>' + html_ + '</div>';
|
||||
});
|
||||
$('.con').html(htmlcon);
|
||||
setTimeout(function() {
|
||||
$('.com_img1').height($('.com_img1').width());
|
||||
}, 200)
|
||||
countTime();
|
||||
|
||||
} else {
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function countTime() {
|
||||
|
||||
//获取当前时间
|
||||
var date = new Date();
|
||||
var now = date.getTime();
|
||||
//设置截止时间
|
||||
var endDate = new Date("2018/09/16 00:00:00");
|
||||
var end = endDate.getTime();
|
||||
//时间差
|
||||
var leftTime = end - now;
|
||||
//定义变量 d,h,m,s保存倒计时的时间
|
||||
var h, m, s;
|
||||
if(leftTime >= 0) {
|
||||
h = Math.floor(leftTime / 1000 / 60 / 60);
|
||||
m = Math.floor(leftTime / 1000 / 60 % 60);
|
||||
s = Math.floor(leftTime / 1000 % 60);
|
||||
//将倒计时赋值到div中
|
||||
if(h < 10) {
|
||||
h = "0" + h;
|
||||
}
|
||||
if(m < 10) {
|
||||
m = "0" + m;
|
||||
}
|
||||
if(s < 10) {
|
||||
s = "0" + s;
|
||||
}
|
||||
document.getElementById("_h").innerHTML = h;
|
||||
document.getElementById("_m").innerHTML = m;
|
||||
document.getElementById("_s").innerHTML = s;
|
||||
}
|
||||
|
||||
//递归每秒调用countTime方法,显示动态时间效果
|
||||
setTimeout(countTime, 1000);
|
||||
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('refresh', function(e) { //执行刷新
|
||||
location.reload();
|
||||
|
||||
});
|
||||
getData(secTypeId);
|
||||
|
||||
var html = '';
|
||||
$.each(nav_data, function() {
|
||||
if(timestamp1 >= 1537027200000) {
|
||||
html += '<div class="nav_block" style="width:50%;" data-secTypeId="' + this.secTypeId + '">' + this.name + '</div>';
|
||||
} else {
|
||||
html += '<div class="nav_block" data-secTypeId="' + this.secTypeId + '">' + this.name + '</div>';
|
||||
}
|
||||
|
||||
});
|
||||
$('.nav').html(html);
|
||||
$('.nav_block').eq(0).addClass('on');
|
||||
|
||||
setInterval(function() {
|
||||
|
||||
mui.ajax('https://api.tokencan.net/exchange-open-api/open/api/get_ticker?symbol=ectusdt&random=' + Math.random(), {
|
||||
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'get', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
$('#last').html(Math.floor((+data.data.last) * doller * 100) / 100);
|
||||
$('#vol').html(data.data.vol);
|
||||
$('.p3').each(function(num) {
|
||||
$(this).children('l').html('ECT ' + (Math.floor(+$(this).children('o').html() / (+data.data.last) / (+doller) * 100)) / 100 + '≈');
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
}, 2000)
|
||||
|
||||
mui("body").on('tap', '.nav_block', function() {
|
||||
secTypeId = this.attributes["data-secTypeId"].nodeValue;
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
getData(secTypeId)
|
||||
})
|
||||
|
||||
mui(".con").on('tap', '.ect_com', function() {
|
||||
// var tj = plus.webview.create('search.html');
|
||||
// tj.show();
|
||||
// mui.alert(e.target.attributes["data-id"].nodeValue);
|
||||
var data_id = this.attributes["data-id"].nodeValue;
|
||||
var isEct = 1;
|
||||
// console.log(this.attributes["data-id"].nodeValue);
|
||||
mui.openWindow({
|
||||
url: 'details.html',
|
||||
id: 'details.html' + data_id,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_id: data_id,
|
||||
isEct: isEct
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
// if(isjiazai == 1) {
|
||||
// page++;
|
||||
// }
|
||||
|
||||
} else if(scroll.y > 100 && issx == 0) {
|
||||
issx = 1;
|
||||
setTimeout(function() {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('header').on('tap', '.tanhao', function() {
|
||||
mui.openWindow({
|
||||
url: 'activity8.html',
|
||||
id: 'activity8.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
// data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
110
static/app2/js/ect_index.js
Executable file
110
static/app2/js/ect_index.js
Executable file
@ -0,0 +1,110 @@
|
||||
mui.plusReady(function() {
|
||||
|
||||
// $('#ect_withdraw_deposit').css('display','none');
|
||||
$('#ect_transfer_accounts').css('display','none');
|
||||
|
||||
// function hyhUrl(url) {
|
||||
// return 'http://192.168.1.101/hyh/' + url;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
window.addEventListener('refresh', function(e) { //执行刷新
|
||||
// location.reload();
|
||||
mui.ajax(hyhUrl('app/Ectwallets/index'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
$('.num p').html(data.data.ectNum);
|
||||
if(data.data.eAddressInfo.eAddress){
|
||||
$('#ect_add').html('钱包地址:' + data.data.eAddressInfo.eAddress);
|
||||
}else{
|
||||
$('#ect_add').html('钱包地址:未设置钱包地址' );
|
||||
}
|
||||
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var token = localStorage.getItem('token');
|
||||
|
||||
// alert(token);
|
||||
mui.ajax(hyhUrl('app/Ectwallets/index'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
$('.num p').html(data.data.ectNum);
|
||||
if(data.data.eAddressInfo.eAddress){
|
||||
$('#ect_add').html('钱包地址:' + data.data.eAddressInfo.eAddress);
|
||||
}else{
|
||||
$('#ect_add').html('钱包地址:未设置钱包地址' );
|
||||
}
|
||||
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
//跳转
|
||||
$('body').on('tap', '.row', function() {
|
||||
var url = $(this).attr('id')+'.html';
|
||||
if(url==''){
|
||||
return;
|
||||
}
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
// data_href: data_href
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
120
static/app2/js/ect_list.js
Executable file
120
static/app2/js/ect_list.js
Executable file
@ -0,0 +1,120 @@
|
||||
$('.scroll_out_t').removeClass('con');
|
||||
$('.mui-scroll').html('<div class="con"></div>');
|
||||
|
||||
mui.plusReady(function() {
|
||||
var isjiazai = 1;
|
||||
var page = 1;
|
||||
|
||||
// function hyhUrl(url) {
|
||||
// return 'http://192.168.1.101/hyh/' + url;
|
||||
// }
|
||||
|
||||
function getLocalTime(nS) {
|
||||
return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
|
||||
}
|
||||
|
||||
var token = localStorage.getItem('token');
|
||||
|
||||
// alert(token);
|
||||
|
||||
function getDate(page) {
|
||||
var num = page;
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
mui.ajax(hyhUrl('app/Ectwallets/getEctLog'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
page: num
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
if(data.data.Rows == '') {
|
||||
$('.con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多记录</p>');
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.data.Rows, function() {
|
||||
var ectType;
|
||||
var dataSrc;
|
||||
if(this.ectType == 1) {
|
||||
ectType = '+';
|
||||
} else {
|
||||
ectType = '-';
|
||||
}
|
||||
|
||||
if(this.dataSrc == 1) {
|
||||
dataSrc = '注册赠送';
|
||||
} else if(this.dataSrc == 2) {
|
||||
dataSrc = '推荐赠送';
|
||||
} else if(this.dataSrc == 3) {
|
||||
dataSrc = '交易';
|
||||
} else if(this.dataSrc == 4) {
|
||||
dataSrc = '提现';
|
||||
}else if(this.dataSrc == 5) {
|
||||
dataSrc = '联盟积分转换';
|
||||
}else if(this.dataSrc == 6) {
|
||||
dataSrc = '成为商家';
|
||||
}else if(this.dataSrc == 7) {
|
||||
dataSrc = '推荐成为商家';
|
||||
}else if(this.dataSrc == 8) {
|
||||
dataSrc = '成为线上商城商家';
|
||||
}else if(this.dataSrc == 9) {
|
||||
dataSrc = '推荐成为线上商城商家';
|
||||
}else if(this.dataSrc == 11) {
|
||||
dataSrc = '购物';
|
||||
}else if(this.dataSrc == 12) {
|
||||
dataSrc = '结算';
|
||||
}else if(this.dataSrc == 13) {
|
||||
dataSrc = '退款';
|
||||
}else if(this.dataSrc == 14) {
|
||||
dataSrc = '充值';
|
||||
}else{
|
||||
dataSrc = '';
|
||||
}
|
||||
|
||||
// html += '<div class="block"><img src="../img/ect_list_bg.png"/><div class="s1">ECT变动记录</div><div class="s2">' + getLocalTime(this.createTime) + '</div><div class="s3">变动数量</div><div class="s4">' + ectType + ' ' + this.ectNum + ' </div><div class="s5">变动类型:<o>' + dataSrc + '</o></div><div class="s6">备注:<o>' + this.dataRemarks + '</o></div></div>';
|
||||
|
||||
html +='<div class="row"><img src="../img/bg_pay_list.png"/><p class="p1">' + ectType + ' ' + this.ectNum + '</p><p class="p3">变动类型:<o>' + dataSrc + '</o></p><p class="p2">备注:<o>' + this.dataRemarks + '</p><p class="p4">' + getLocalTime(this.createTime) + '</p></div>'
|
||||
|
||||
});
|
||||
|
||||
if(page == 1) {
|
||||
$('.con').html(html);
|
||||
} else {
|
||||
$('.con').append(html);
|
||||
}
|
||||
isjiazai = 1
|
||||
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getDate(page);
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getDate(page);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
})
|
251
static/app2/js/ect_pre_.js
Executable file
251
static/app2/js/ect_pre_.js
Executable file
@ -0,0 +1,251 @@
|
||||
var topTypeId = '1';
|
||||
var secTypeId = '';
|
||||
//var sectypeId = '';
|
||||
var page = 1;
|
||||
var pagesize = 10;
|
||||
var isjiazai = 1;
|
||||
|
||||
function getRecommend(topTypeId, secTypeId, page, pagesize) {
|
||||
|
||||
var recommenddata = {
|
||||
topTypeId: topTypeId ? topTypeId : '1',
|
||||
secTypeId: secTypeId ? secTypeId : '',
|
||||
page: page ? page : 1,
|
||||
pageSize: pagesize ? pagesize : 10
|
||||
}
|
||||
// console.log(recommenddata.secTypeId);
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-frontList'), {
|
||||
|
||||
data: recommenddata,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
if(data.list.Rows == '') {
|
||||
if(page == 1) {
|
||||
$('#recommend_con').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
} else {
|
||||
$('#recommend_con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
}
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(data.list.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title">' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <!--span>八折</span--></div></div></div>';
|
||||
});
|
||||
|
||||
if(page == 1) {
|
||||
$('#recommend_con').html(html);
|
||||
} else {
|
||||
$('#recommend_con').append(html);
|
||||
}
|
||||
isjiazai = 1;
|
||||
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
|
||||
} else {
|
||||
//console.log(2)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
var issx = 0;
|
||||
var doller = '';
|
||||
//获取 美元价格
|
||||
mui.ajax(llUrl('app/ect/getDollerPrice'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
doller = data.data.now_doller;
|
||||
} else {
|
||||
// console.log(2)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
//ect数据
|
||||
setInterval(function() {
|
||||
|
||||
mui.ajax('https://api.tokencan.net/exchange-open-api/open/api/get_ticker?symbol=ectusdt&random=' + Math.random(), {
|
||||
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'get', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
$('.p2 span').html(Math.floor((+data.data.last) * doller * 100) / 100);
|
||||
$('.p4 span').html(data.data.vol.toFixed(2));
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
}, 2000)
|
||||
//bannerTop
|
||||
mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-activityList'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
$.each(data, function() {
|
||||
html += '<div class="nav_block" data-secTypeId="' + this.secTypeId + '"><span>' + this.secTypeName + '</span></div>';
|
||||
});
|
||||
$('.nav').html(html);
|
||||
$('.nav_block').eq(0).addClass('on');
|
||||
secTypeId=$('.nav_block').eq(0).attr('data-secTypeId')
|
||||
getRecommend(topTypeId, secTypeId, page, 10)
|
||||
} else {
|
||||
//console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-ectCarousel'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
$.each(data, function() {
|
||||
html += '<div class="swiper-slide" data-adURL="' + this.adURL + '" data-targetType="' + this.targetType + '"><img src="' + ectImgUrl(this.adFile) + '" alt="" /></div>';
|
||||
});
|
||||
$('#top_banner .swiper-wrapper').html(html);
|
||||
var swiper = new Swiper('#top_banner', {
|
||||
pagination: '#top_banner_pagination',
|
||||
spaceBetween: 0,
|
||||
loop: true,
|
||||
autoplay: 3500,
|
||||
autoplayDisableOnInteraction: false
|
||||
});
|
||||
$('#top_bansner').height($('#top_bansner').width() * 320 / 750);
|
||||
} else {
|
||||
//console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
//轮播图跳转
|
||||
$('#top_banner').on('tap', '.swiper-slide', function() {
|
||||
openAds($(this));
|
||||
})
|
||||
|
||||
mui('.nav').on('tap', '.nav_block', function() {
|
||||
secTypeId = $(this).attr('data-secTypeId');
|
||||
isjiazai = 1;
|
||||
page = 1;
|
||||
getRecommend(topTypeId, secTypeId, page, 10);
|
||||
})
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getRecommend(topTypeId, secTypeId, page, 10);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
//跳转到了解ect
|
||||
$('.header_con').on('tap', '.know_ect', function() {
|
||||
mui.openWindow({
|
||||
url: 'know_ect.html',
|
||||
id: 'know_ect.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
},
|
||||
extras: {
|
||||
// data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {}
|
||||
})
|
||||
})
|
||||
|
||||
$("#keyword").on('keypress', function(e) {
|
||||
var keycode = e.keyCode;
|
||||
var searchName = $(this).val();
|
||||
var url = '';
|
||||
if(keycode == '13') {
|
||||
//e.preventDefault();
|
||||
//console.log(searchName)
|
||||
|
||||
mui.openWindow({
|
||||
url: 'ac2.html',
|
||||
id: 'ac2.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: true, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})
|
119
static/app2/js/ect_recharge.js
Executable file
119
static/app2/js/ect_recharge.js
Executable file
@ -0,0 +1,119 @@
|
||||
var userId = '';
|
||||
var address = '';
|
||||
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
mui.ajax(hgUrl('app/Ectwallets/getEctAddress'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
userId = data.data.userId;
|
||||
address = data.data.address;
|
||||
// address = '0x29208ff5719cbd856c2e1ab32b2d3e101da6f721';
|
||||
// console.log(address)
|
||||
if(address == null) {
|
||||
// console.log(1)
|
||||
mui.ajax('http://moacapi.juzi199.com/api/ect/recharge_token', {
|
||||
data:{
|
||||
userId:userId,
|
||||
tokenName:'ect'
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
address = data.data.address;
|
||||
$('#address').html(address);
|
||||
var qrcode = new QRCode(document.getElementById("qrcode"), {
|
||||
width: 118, //设置宽高
|
||||
height: 118
|
||||
});
|
||||
qrcode.makeCode(address);
|
||||
// console.log(address)
|
||||
|
||||
} else {
|
||||
console.log(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('#address').html(address);
|
||||
var qrcode = new QRCode(document.getElementById("qrcode"), {
|
||||
width: 118, //设置宽高
|
||||
height: 118
|
||||
});
|
||||
qrcode.makeCode(address);
|
||||
}
|
||||
} else {
|
||||
console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('.con').on('tap','#copy_address',function(){
|
||||
copyShareUrl()
|
||||
})
|
||||
$('.header').on('tap','.add',function(){
|
||||
mui.openWindow({
|
||||
url: 'ect_recharge_list.html',
|
||||
id: 'ect_recharge_list.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
},
|
||||
extras: {
|
||||
// data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
function copyShareUrl() {
|
||||
mui.plusReady(function() {
|
||||
//复制链接到剪切板
|
||||
var copy_content = address;
|
||||
//判断是安卓还是ios
|
||||
if(mui.os.ios) {
|
||||
//ios
|
||||
var UIPasteboard = plus.ios.importClass("UIPasteboard");
|
||||
var generalPasteboard = UIPasteboard.generalPasteboard(); //设置/获取文本内容:
|
||||
|
||||
generalPasteboard.plusCallMethod({
|
||||
setValue: copy_content,
|
||||
forPasteboardType: "public.utf8-plain-text"
|
||||
});
|
||||
generalPasteboard.plusCallMethod({
|
||||
valueForPasteboardType: "public.utf8-plain-text"
|
||||
});
|
||||
} else {
|
||||
//安卓
|
||||
var context = plus.android.importClass("android.content.Context");
|
||||
var main = plus.android.runtimeMainActivity();
|
||||
var clip = main.getSystemService(context.CLIPBOARD_SERVICE);
|
||||
plus.android.invoke(clip, "setText", copy_content);
|
||||
}
|
||||
plus.nativeUI.toast("复制到剪切板成功 ");
|
||||
});
|
||||
}
|
90
static/app2/js/ect_recharge_list.js
Executable file
90
static/app2/js/ect_recharge_list.js
Executable file
@ -0,0 +1,90 @@
|
||||
mui.plusReady(function() {
|
||||
var isjiazai = 1;
|
||||
var page = 1;
|
||||
|
||||
// function hyhUrl(url) {
|
||||
// return 'http://192.168.1.101/hyh/' + url;
|
||||
// }
|
||||
|
||||
function getLocalTime(nS) {
|
||||
return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
|
||||
}
|
||||
|
||||
var token = localStorage.getItem('token');
|
||||
|
||||
// alert(token);
|
||||
|
||||
function getDate(page) {
|
||||
var num = page;
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
mui.ajax(hgUrl('app/Ectwallets/getEctRechargeLog'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
page: num
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
if(data.data.list.Rows == '') {
|
||||
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多记录</p>');
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.data.list.Rows, function() {
|
||||
var ectType;
|
||||
var dataSrc;
|
||||
if(this.status == 0){
|
||||
dataSrc = '待确认';
|
||||
}else if(this.status == 1) {
|
||||
dataSrc = '已确认';
|
||||
} else if(this.status == 2) {
|
||||
dataSrc = '已拒绝';
|
||||
} else{
|
||||
dataSrc = '';
|
||||
}
|
||||
|
||||
|
||||
html += '<div class="row"><img src="../img/bg_pay_list.png"/><p class="p1">' + this.value + '</p><p class="p3">状态:' + dataSrc + '</p><p class="p4">' + getLocalTime(this.createTime) + '</p></div>'
|
||||
|
||||
});
|
||||
|
||||
if(page == 1) {
|
||||
$('.con').html(html);
|
||||
} else {
|
||||
$('.con').append(html);
|
||||
}
|
||||
isjiazai = 1
|
||||
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
alert(errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getDate(page);
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getDate(page);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
})
|
138
static/app2/js/ect_transfer_accounts.html.js
Executable file
138
static/app2/js/ect_transfer_accounts.html.js
Executable file
@ -0,0 +1,138 @@
|
||||
mui.plusReady(function() {
|
||||
|
||||
// function hyhUrl(url) {
|
||||
// return 'http://192.168.1.101/hyh/' + url;
|
||||
// }
|
||||
var token = localStorage.getItem('token');
|
||||
|
||||
$('input').eq(0).attr('id','ectNum');
|
||||
$('input').eq(1).attr('id','payPwd');
|
||||
$('.num p').html('');
|
||||
$('input').eq(0).attr('placeholder','ect数量至少为500');
|
||||
// alert(token);
|
||||
|
||||
mui.ajax(hyhUrl('app/Ectwallets/listQuery'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
if(data.data != '') {
|
||||
$.each(data.data, function() {
|
||||
html += '<option value="' + this.eAddress + '">' + this.eAddress + '</option>'
|
||||
});
|
||||
$('#select').html(html);
|
||||
}
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
mui.ajax(hyhUrl('app/Ectwallets/index'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
$('.num p').html(data.data.ectNum);
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
mui('body').on('tap', '.btn_ture', function() {
|
||||
var eAddress = $('#select').val();
|
||||
var ectNum = $('#ectNum').val();
|
||||
var payPwd = $('#payPwd').val();
|
||||
if(eAddress == '') {
|
||||
plus.nativeUI.toast('未选择钱包地址');
|
||||
return;
|
||||
}
|
||||
if(!(ectNum >= 500)) {
|
||||
plus.nativeUI.toast('ect数量必须大于500');
|
||||
return;
|
||||
}
|
||||
if(payPwd == '') {
|
||||
plus.nativeUI.toast('未填写支付密码');
|
||||
return;
|
||||
}
|
||||
$('.btn_ture').attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/Ectwallets/withdraw'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
eAddress: eAddress,
|
||||
ectNum: ectNum,
|
||||
payPwd: payPwd
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
// console.log(data.data.id)
|
||||
|
||||
var id =data.data.id;
|
||||
// $('.btn_ture').removeAttr('disabled');
|
||||
mui.ajax('http://moacapi.heyuanhui.cn/api/ect/ect_transfer', {
|
||||
data: {
|
||||
id:id
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data)
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
mui.fire(plus.webview.getWebviewById('templete/my.html'), 'refresh');
|
||||
mui.fire(plus.webview.getWebviewById('ect_index.html'), 'refresh');
|
||||
alert(data.msg);
|
||||
location.reload();
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
$('.btn_ture').removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
alert(data.msg);
|
||||
location.reload();
|
||||
$('.btn_ture').removeAttr('disabled');
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
0
static/app2/js/ect_transfer_accounts.js
Executable file
0
static/app2/js/ect_transfer_accounts.js
Executable file
90
static/app2/js/ect_withdraw.js
Executable file
90
static/app2/js/ect_withdraw.js
Executable file
@ -0,0 +1,90 @@
|
||||
mui.plusReady(function() {
|
||||
var isjiazai = 1;
|
||||
var page = 1;
|
||||
|
||||
// function hyhUrl(url) {
|
||||
// return 'http://192.168.1.101/hyh/' + url;
|
||||
// }
|
||||
|
||||
function getLocalTime(nS) {
|
||||
return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/, ' ');
|
||||
}
|
||||
|
||||
var token = localStorage.getItem('token');
|
||||
|
||||
// alert(token);
|
||||
|
||||
function getDate(page) {
|
||||
var num = page;
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
mui.ajax(hgUrl('app/Ectwallets/getUserEctCashLog'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
page: num
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
if(data.data.list.Rows == '') {
|
||||
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多记录</p>');
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.data.list.Rows, function() {
|
||||
var ectType;
|
||||
var dataSrc;
|
||||
if(this.status == 0){
|
||||
dataSrc = '待审核';
|
||||
}else if(this.status == 1) {
|
||||
dataSrc = '已发送';
|
||||
} else if(this.status == 2) {
|
||||
dataSrc = '已拒绝';
|
||||
} else{
|
||||
dataSrc = '';
|
||||
}
|
||||
|
||||
html += '<div class="row"><img src="../img/bg_pay_list.png"/><p class="p1">' + this.ectNum + '</p><p class="p2">' + this.toAccount + '</p><p class="p3">状态:' + dataSrc + '</p><p class="p4">' + getLocalTime(this.createTime) + '</p></div>'
|
||||
|
||||
});
|
||||
|
||||
if(page == 1) {
|
||||
$('.con').html(html);
|
||||
} else {
|
||||
$('.con').append(html);
|
||||
}
|
||||
isjiazai = 1
|
||||
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getDate(page);
|
||||
console.log(1)
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
getDate(page);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
})
|
136
static/app2/js/ect_withdraw_deposit.js
Executable file
136
static/app2/js/ect_withdraw_deposit.js
Executable file
@ -0,0 +1,136 @@
|
||||
mui.plusReady(function() {
|
||||
|
||||
// function hyhUrl(url) {
|
||||
// return 'http://192.168.1.101/hyh/' + url;
|
||||
// }
|
||||
var token = localStorage.getItem('token');
|
||||
|
||||
// alert(token);
|
||||
|
||||
mui.ajax(hyhUrl('app/Ectwallets/listQuery'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
if(data.data != '') {
|
||||
$.each(data.data, function() {
|
||||
html += '<option value="' + this.eAddress + '">' + this.eAddress + '</option>'
|
||||
});
|
||||
$('#select').html(html);
|
||||
}else{
|
||||
plus.nativeUI.toast('未设置钱包地址');
|
||||
}
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
mui.ajax(hyhUrl('app/Ectwallets/index'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
$('.num p').html(data.data.ectNum);
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
mui('body').on('tap', '.btn_ture', function() {
|
||||
var eAddress = $('#select').val();
|
||||
var ectNum = $('#ectNum').val();
|
||||
var payPwd = $('#payPwd').val();
|
||||
if(eAddress == '') {
|
||||
plus.nativeUI.toast('未选择钱包地址');
|
||||
return;
|
||||
}
|
||||
if(!(ectNum >= 500)) {
|
||||
plus.nativeUI.toast('ect数量必须大于500');
|
||||
return;
|
||||
}
|
||||
if(payPwd == '') {
|
||||
plus.nativeUI.toast('未填写支付密码');
|
||||
return;
|
||||
}
|
||||
$('.btn_ture').attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/Ectwallets/withdraw'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
eAddress: eAddress,
|
||||
ectNum: ectNum,
|
||||
payPwd: payPwd
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
// console.log(data.data.id)
|
||||
|
||||
var id = data.data.id;
|
||||
// $('.btn_ture').removeAttr('disabled');
|
||||
mui.ajax('http://moacapi.heyuanhui.cn/api/ect/ect_transfer', {
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data)
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
|
||||
alert(data.msg);
|
||||
mui.fire(plus.webview.getWebviewById('templete/my.html'), 'refresh');
|
||||
mui.fire(plus.webview.getWebviewById('ect_index.html'), 'refresh');
|
||||
location.reload();
|
||||
} else {
|
||||
// console.log(data.status)
|
||||
}
|
||||
$('.btn_ture').removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
alert(data.msg);
|
||||
location.reload();
|
||||
$('.btn_ture').removeAttr('disabled');
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
299
static/app2/js/editAddress.js
Executable file
299
static/app2/js/editAddress.js
Executable file
@ -0,0 +1,299 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
var addressId = self.data_addressId ? self.data_addressId : 0;
|
||||
var isParentId = 1;
|
||||
var isProvince;
|
||||
var isCity;
|
||||
var userName = $('#userName');
|
||||
var userPhone = $('#userPhone');
|
||||
var province = $('#province');
|
||||
var city = $('#city');
|
||||
var Area = $('#area');
|
||||
var Textarea = $('textarea');
|
||||
var areaVal;
|
||||
if (addressId != 0) {
|
||||
$('.address_info').css('display', 'none');
|
||||
$('.add_info').css('display', 'block');
|
||||
mui.ajax(qlgUrl('app/useraddress/getById'), {
|
||||
data: {
|
||||
addressId: addressId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) {
|
||||
//console.log(data);//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
//console.log(data);
|
||||
userName.val(data.userName)
|
||||
userPhone.val(data.userPhone)
|
||||
$('.add_info').html(data.areaName)
|
||||
Textarea.val(data.userAddress)
|
||||
areaVal = data.areaId
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
mui.alert(data.msg)
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
mui.ajax(qlgUrl('app/areas/listQuery'), {
|
||||
data: {
|
||||
parentId: 0
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="">选择省</option>';
|
||||
$.each(data, function() {
|
||||
html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
|
||||
});
|
||||
$('#province').html(html);
|
||||
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
mui.alert(data.msg)
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
$('.scroll_out_t').on('tap', '#province', function() {
|
||||
if (isParentId == 1) {
|
||||
isParentId = 0;
|
||||
mui.ajax(qlgUrl('app/areas/listQuery'), {
|
||||
data: {
|
||||
parentId: 0
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '';
|
||||
$.each(data, function() {
|
||||
html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
|
||||
});
|
||||
$('#province').html(html);
|
||||
var province = data[0].areaId;
|
||||
mui.ajax(hyhUrl('app/areas/listQuery'), {
|
||||
data: {
|
||||
parentId: province
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '';
|
||||
$.each(data, function() {
|
||||
html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
|
||||
});
|
||||
$('#city').html(html);
|
||||
var city = data[0].areaId;
|
||||
mui.ajax(hyhUrl('app/areas/listQuery'), {
|
||||
data: {
|
||||
parentId: city
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '';
|
||||
$.each(data, function() {
|
||||
html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
|
||||
});
|
||||
$('#area').html(html);
|
||||
isCity = city;
|
||||
} else {
|
||||
mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
isProvince = province;
|
||||
} else {
|
||||
mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
mui.alert(data.msg)
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
$('.scroll_out_t').on('change', '#province', function() {
|
||||
var province = $(this).val()
|
||||
//console.log(province)
|
||||
if (isProvince != province) {
|
||||
mui.ajax(qlgUrl('app/areas/listQuery'), {
|
||||
data: {
|
||||
parentId: province
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="">选择市</option>';
|
||||
$.each(data, function() {
|
||||
html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
|
||||
});
|
||||
$('#city').html(html);
|
||||
// var city = data[0].areaId;
|
||||
// mui.ajax(hyhUrl('app/areas/listQuery'), {
|
||||
// data: {
|
||||
// parentId: city
|
||||
// },
|
||||
// dataType: 'json', //服务器返回json格式数据
|
||||
// type: 'post', //HTTP请求类型
|
||||
// timeout: 10000, //超时时间设置为10秒;
|
||||
// success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// data = toJson(data);
|
||||
// if(data.status == 1) {
|
||||
// data = data.data;
|
||||
var html = '<option value="">选择区</option>';
|
||||
// $.each(data, function() {
|
||||
// html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
|
||||
// });
|
||||
$('#area').html(html);
|
||||
// isCity = city;
|
||||
// } else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// // location.reload();
|
||||
// }
|
||||
// },
|
||||
// error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// // mui.alert(type);
|
||||
// }
|
||||
// });
|
||||
isProvince = province;
|
||||
} else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
mui.alert(data.msg)
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
$('.scroll_out_t').on('change', '#city', function() {
|
||||
var city = $(this).val()
|
||||
if (isCity != city) {
|
||||
mui.ajax(qlgUrl('app/areas/listQuery'), {
|
||||
data: {
|
||||
parentId: city,
|
||||
level: 2
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<option value="">选择区</option>';
|
||||
$.each(data, function() {
|
||||
html += '<option value="' + this.areaId + '">' + this.areaName + '</option>'
|
||||
});
|
||||
$('#area').html(html);
|
||||
isCity = city;
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
$('.bc_btn').on('tap', function() {
|
||||
var isDefault = $('input:radio[name="isDefault"]:checked').val() ? $('input:radio[name="isDefault"]:checked').val() :
|
||||
0;
|
||||
areaVal = $('#area').val() ? $('#area').val() : areaVal;
|
||||
var data = {
|
||||
isDefault: isDefault,
|
||||
addressId: addressId,
|
||||
userName: $('#userName').val(),
|
||||
areaId: areaVal,
|
||||
userPhone: $('#userPhone').val(),
|
||||
userAddress: $('textarea').val(),
|
||||
}
|
||||
mui.ajax(hyhUrl('app/useraddress/edits'), {
|
||||
data: data,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
$('.add_info').on('tap', function() {
|
||||
$('.address_info').css('display', 'block');
|
||||
$('.add_info').css('display', 'none');
|
||||
})
|
||||
|
||||
})
|
0
static/app2/js/essay.js
Executable file
0
static/app2/js/essay.js
Executable file
9
static/app2/js/essaylist.js
Executable file
9
static/app2/js/essaylist.js
Executable file
@ -0,0 +1,9 @@
|
||||
mui.plusReady(function () {
|
||||
// var url ="",
|
||||
$("body").on("tap" ,".add1",function () {
|
||||
JZL.openWindow('addessay.html', 'addessay.html')
|
||||
})
|
||||
$(".row_con").on("tap" ,".memorandum",function () {
|
||||
JZL.openWindow('memorandumlist.html', 'memorandumlist.html')
|
||||
})
|
||||
})
|
640
static/app2/js/exif.js
Executable file
640
static/app2/js/exif.js
Executable file
@ -0,0 +1,640 @@
|
||||
/*
|
||||
* Javascript EXIF Reader 0.1.6
|
||||
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
|
||||
* Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
|
||||
*/
|
||||
|
||||
|
||||
var EXIF = (function() {
|
||||
|
||||
var debug = false;
|
||||
|
||||
var ExifTags = {
|
||||
|
||||
// version tags
|
||||
0x9000: "ExifVersion", // EXIF version
|
||||
0xA000: "FlashpixVersion", // Flashpix format version
|
||||
|
||||
// colorspace tags
|
||||
0xA001: "ColorSpace", // Color space information tag
|
||||
|
||||
// image configuration
|
||||
0xA002: "PixelXDimension", // Valid width of meaningful image
|
||||
0xA003: "PixelYDimension", // Valid height of meaningful image
|
||||
0x9101: "ComponentsConfiguration", // Information about channels
|
||||
0x9102: "CompressedBitsPerPixel", // Compressed bits per pixel
|
||||
|
||||
// user information
|
||||
0x927C: "MakerNote", // Any desired information written by the manufacturer
|
||||
0x9286: "UserComment", // Comments by user
|
||||
|
||||
// related file
|
||||
0xA004: "RelatedSoundFile", // Name of related sound file
|
||||
|
||||
// date and time
|
||||
0x9003: "DateTimeOriginal", // Date and time when the original image was generated
|
||||
0x9004: "DateTimeDigitized", // Date and time when the image was stored digitally
|
||||
0x9290: "SubsecTime", // Fractions of seconds for DateTime
|
||||
0x9291: "SubsecTimeOriginal", // Fractions of seconds for DateTimeOriginal
|
||||
0x9292: "SubsecTimeDigitized", // Fractions of seconds for DateTimeDigitized
|
||||
|
||||
// picture-taking conditions
|
||||
0x829A: "ExposureTime", // Exposure time (in seconds)
|
||||
0x829D: "FNumber", // F number
|
||||
0x8822: "ExposureProgram", // Exposure program
|
||||
0x8824: "SpectralSensitivity", // Spectral sensitivity
|
||||
0x8827: "ISOSpeedRatings", // ISO speed rating
|
||||
0x8828: "OECF", // Optoelectric conversion factor
|
||||
0x9201: "ShutterSpeedValue", // Shutter speed
|
||||
0x9202: "ApertureValue", // Lens aperture
|
||||
0x9203: "BrightnessValue", // Value of brightness
|
||||
0x9204: "ExposureBias", // Exposure bias
|
||||
0x9205: "MaxApertureValue", // Smallest F number of lens
|
||||
0x9206: "SubjectDistance", // Distance to subject in meters
|
||||
0x9207: "MeteringMode", // Metering mode
|
||||
0x9208: "LightSource", // Kind of light source
|
||||
0x9209: "Flash", // Flash status
|
||||
0x9214: "SubjectArea", // Location and area of main subject
|
||||
0x920A: "FocalLength", // Focal length of the lens in mm
|
||||
0xA20B: "FlashEnergy", // Strobe energy in BCPS
|
||||
0xA20C: "SpatialFrequencyResponse", //
|
||||
0xA20E: "FocalPlaneXResolution", // Number of pixels in width direction per FocalPlaneResolutionUnit
|
||||
0xA20F: "FocalPlaneYResolution", // Number of pixels in height direction per FocalPlaneResolutionUnit
|
||||
0xA210: "FocalPlaneResolutionUnit", // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution
|
||||
0xA214: "SubjectLocation", // Location of subject in image
|
||||
0xA215: "ExposureIndex", // Exposure index selected on camera
|
||||
0xA217: "SensingMethod", // Image sensor type
|
||||
0xA300: "FileSource", // Image source (3 == DSC)
|
||||
0xA301: "SceneType", // Scene type (1 == directly photographed)
|
||||
0xA302: "CFAPattern", // Color filter array geometric pattern
|
||||
0xA401: "CustomRendered", // Special processing
|
||||
0xA402: "ExposureMode", // Exposure mode
|
||||
0xA403: "WhiteBalance", // 1 = auto white balance, 2 = manual
|
||||
0xA404: "DigitalZoomRation", // Digital zoom ratio
|
||||
0xA405: "FocalLengthIn35mmFilm", // Equivalent foacl length assuming 35mm film camera (in mm)
|
||||
0xA406: "SceneCaptureType", // Type of scene
|
||||
0xA407: "GainControl", // Degree of overall image gain adjustment
|
||||
0xA408: "Contrast", // Direction of contrast processing applied by camera
|
||||
0xA409: "Saturation", // Direction of saturation processing applied by camera
|
||||
0xA40A: "Sharpness", // Direction of sharpness processing applied by camera
|
||||
0xA40B: "DeviceSettingDescription", //
|
||||
0xA40C: "SubjectDistanceRange", // Distance to subject
|
||||
|
||||
// other tags
|
||||
0xA005: "InteroperabilityIFDPointer",
|
||||
0xA420: "ImageUniqueID" // Identifier assigned uniquely to each image
|
||||
};
|
||||
|
||||
var TiffTags = {
|
||||
0x0100: "ImageWidth",
|
||||
0x0101: "ImageHeight",
|
||||
0x8769: "ExifIFDPointer",
|
||||
0x8825: "GPSInfoIFDPointer",
|
||||
0xA005: "InteroperabilityIFDPointer",
|
||||
0x0102: "BitsPerSample",
|
||||
0x0103: "Compression",
|
||||
0x0106: "PhotometricInterpretation",
|
||||
0x0112: "Orientation",
|
||||
0x0115: "SamplesPerPixel",
|
||||
0x011C: "PlanarConfiguration",
|
||||
0x0212: "YCbCrSubSampling",
|
||||
0x0213: "YCbCrPositioning",
|
||||
0x011A: "XResolution",
|
||||
0x011B: "YResolution",
|
||||
0x0128: "ResolutionUnit",
|
||||
0x0111: "StripOffsets",
|
||||
0x0116: "RowsPerStrip",
|
||||
0x0117: "StripByteCounts",
|
||||
0x0201: "JPEGInterchangeFormat",
|
||||
0x0202: "JPEGInterchangeFormatLength",
|
||||
0x012D: "TransferFunction",
|
||||
0x013E: "WhitePoint",
|
||||
0x013F: "PrimaryChromaticities",
|
||||
0x0211: "YCbCrCoefficients",
|
||||
0x0214: "ReferenceBlackWhite",
|
||||
0x0132: "DateTime",
|
||||
0x010E: "ImageDescription",
|
||||
0x010F: "Make",
|
||||
0x0110: "Model",
|
||||
0x0131: "Software",
|
||||
0x013B: "Artist",
|
||||
0x8298: "Copyright"
|
||||
};
|
||||
|
||||
var GPSTags = {
|
||||
0x0000: "GPSVersionID",
|
||||
0x0001: "GPSLatitudeRef",
|
||||
0x0002: "GPSLatitude",
|
||||
0x0003: "GPSLongitudeRef",
|
||||
0x0004: "GPSLongitude",
|
||||
0x0005: "GPSAltitudeRef",
|
||||
0x0006: "GPSAltitude",
|
||||
0x0007: "GPSTimeStamp",
|
||||
0x0008: "GPSSatellites",
|
||||
0x0009: "GPSStatus",
|
||||
0x000A: "GPSMeasureMode",
|
||||
0x000B: "GPSDOP",
|
||||
0x000C: "GPSSpeedRef",
|
||||
0x000D: "GPSSpeed",
|
||||
0x000E: "GPSTrackRef",
|
||||
0x000F: "GPSTrack",
|
||||
0x0010: "GPSImgDirectionRef",
|
||||
0x0011: "GPSImgDirection",
|
||||
0x0012: "GPSMapDatum",
|
||||
0x0013: "GPSDestLatitudeRef",
|
||||
0x0014: "GPSDestLatitude",
|
||||
0x0015: "GPSDestLongitudeRef",
|
||||
0x0016: "GPSDestLongitude",
|
||||
0x0017: "GPSDestBearingRef",
|
||||
0x0018: "GPSDestBearing",
|
||||
0x0019: "GPSDestDistanceRef",
|
||||
0x001A: "GPSDestDistance",
|
||||
0x001B: "GPSProcessingMethod",
|
||||
0x001C: "GPSAreaInformation",
|
||||
0x001D: "GPSDateStamp",
|
||||
0x001E: "GPSDifferential"
|
||||
};
|
||||
|
||||
var StringValues = {
|
||||
ExposureProgram: {
|
||||
0: "Not defined",
|
||||
1: "Manual",
|
||||
2: "Normal program",
|
||||
3: "Aperture priority",
|
||||
4: "Shutter priority",
|
||||
5: "Creative program",
|
||||
6: "Action program",
|
||||
7: "Portrait mode",
|
||||
8: "Landscape mode"
|
||||
},
|
||||
MeteringMode: {
|
||||
0: "Unknown",
|
||||
1: "Average",
|
||||
2: "CenterWeightedAverage",
|
||||
3: "Spot",
|
||||
4: "MultiSpot",
|
||||
5: "Pattern",
|
||||
6: "Partial",
|
||||
255: "Other"
|
||||
},
|
||||
LightSource: {
|
||||
0: "Unknown",
|
||||
1: "Daylight",
|
||||
2: "Fluorescent",
|
||||
3: "Tungsten (incandescent light)",
|
||||
4: "Flash",
|
||||
9: "Fine weather",
|
||||
10: "Cloudy weather",
|
||||
11: "Shade",
|
||||
12: "Daylight fluorescent (D 5700 - 7100K)",
|
||||
13: "Day white fluorescent (N 4600 - 5400K)",
|
||||
14: "Cool white fluorescent (W 3900 - 4500K)",
|
||||
15: "White fluorescent (WW 3200 - 3700K)",
|
||||
17: "Standard light A",
|
||||
18: "Standard light B",
|
||||
19: "Standard light C",
|
||||
20: "D55",
|
||||
21: "D65",
|
||||
22: "D75",
|
||||
23: "D50",
|
||||
24: "ISO studio tungsten",
|
||||
255: "Other"
|
||||
},
|
||||
Flash: {
|
||||
0x0000: "Flash did not fire",
|
||||
0x0001: "Flash fired",
|
||||
0x0005: "Strobe return light not detected",
|
||||
0x0007: "Strobe return light detected",
|
||||
0x0009: "Flash fired, compulsory flash mode",
|
||||
0x000D: "Flash fired, compulsory flash mode, return light not detected",
|
||||
0x000F: "Flash fired, compulsory flash mode, return light detected",
|
||||
0x0010: "Flash did not fire, compulsory flash mode",
|
||||
0x0018: "Flash did not fire, auto mode",
|
||||
0x0019: "Flash fired, auto mode",
|
||||
0x001D: "Flash fired, auto mode, return light not detected",
|
||||
0x001F: "Flash fired, auto mode, return light detected",
|
||||
0x0020: "No flash function",
|
||||
0x0041: "Flash fired, red-eye reduction mode",
|
||||
0x0045: "Flash fired, red-eye reduction mode, return light not detected",
|
||||
0x0047: "Flash fired, red-eye reduction mode, return light detected",
|
||||
0x0049: "Flash fired, compulsory flash mode, red-eye reduction mode",
|
||||
0x004D: "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",
|
||||
0x004F: "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",
|
||||
0x0059: "Flash fired, auto mode, red-eye reduction mode",
|
||||
0x005D: "Flash fired, auto mode, return light not detected, red-eye reduction mode",
|
||||
0x005F: "Flash fired, auto mode, return light detected, red-eye reduction mode"
|
||||
},
|
||||
SensingMethod: {
|
||||
1: "Not defined",
|
||||
2: "One-chip color area sensor",
|
||||
3: "Two-chip color area sensor",
|
||||
4: "Three-chip color area sensor",
|
||||
5: "Color sequential area sensor",
|
||||
7: "Trilinear sensor",
|
||||
8: "Color sequential linear sensor"
|
||||
},
|
||||
SceneCaptureType: {
|
||||
0: "Standard",
|
||||
1: "Landscape",
|
||||
2: "Portrait",
|
||||
3: "Night scene"
|
||||
},
|
||||
SceneType: {
|
||||
1: "Directly photographed"
|
||||
},
|
||||
CustomRendered: {
|
||||
0: "Normal process",
|
||||
1: "Custom process"
|
||||
},
|
||||
WhiteBalance: {
|
||||
0: "Auto white balance",
|
||||
1: "Manual white balance"
|
||||
},
|
||||
GainControl: {
|
||||
0: "None",
|
||||
1: "Low gain up",
|
||||
2: "High gain up",
|
||||
3: "Low gain down",
|
||||
4: "High gain down"
|
||||
},
|
||||
Contrast: {
|
||||
0: "Normal",
|
||||
1: "Soft",
|
||||
2: "Hard"
|
||||
},
|
||||
Saturation: {
|
||||
0: "Normal",
|
||||
1: "Low saturation",
|
||||
2: "High saturation"
|
||||
},
|
||||
Sharpness: {
|
||||
0: "Normal",
|
||||
1: "Soft",
|
||||
2: "Hard"
|
||||
},
|
||||
SubjectDistanceRange: {
|
||||
0: "Unknown",
|
||||
1: "Macro",
|
||||
2: "Close view",
|
||||
3: "Distant view"
|
||||
},
|
||||
FileSource: {
|
||||
3: "DSC"
|
||||
},
|
||||
Components: {
|
||||
0: "",
|
||||
1: "Y",
|
||||
2: "Cb",
|
||||
3: "Cr",
|
||||
4: "R",
|
||||
5: "G",
|
||||
6: "B"
|
||||
}
|
||||
};
|
||||
|
||||
function addEvent(element, event, handler) {
|
||||
if (element.addEventListener) {
|
||||
element.addEventListener(event, handler, false);
|
||||
} else if (element.attachEvent) {
|
||||
element.attachEvent("on" + event, handler);
|
||||
}
|
||||
}
|
||||
|
||||
function imageHasData(img) {
|
||||
return !!(img.exifdata);
|
||||
}
|
||||
|
||||
function getImageData(img, callback) {
|
||||
BinaryAjax(img.src, function(http) {
|
||||
var data = findEXIFinJPEG(http.binaryResponse);
|
||||
img.exifdata = data || {};
|
||||
if (callback) {
|
||||
callback.call(img)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function findEXIFinJPEG(file) {
|
||||
if (file.getByteAt(0) != 0xFF || file.getByteAt(1) != 0xD8) {
|
||||
return false; // not a valid jpeg
|
||||
}
|
||||
|
||||
var offset = 2,
|
||||
length = file.getLength(),
|
||||
marker;
|
||||
|
||||
while (offset < length) {
|
||||
if (file.getByteAt(offset) != 0xFF) {
|
||||
if (debug)
|
||||
console.log("Not a valid marker at offset " + offset + ", found: " + file.getByteAt(offset));
|
||||
return false; // not a valid marker, something is wrong
|
||||
}
|
||||
|
||||
marker = file.getByteAt(offset + 1);
|
||||
|
||||
// we could implement handling for other markers here,
|
||||
// but we're only looking for 0xFFE1 for EXIF data
|
||||
|
||||
if (marker == 22400) {
|
||||
if (debug)
|
||||
console.log("Found 0xFFE1 marker");
|
||||
|
||||
return readEXIFData(file, offset + 4, file.getShortAt(offset + 2, true) - 2);
|
||||
|
||||
// offset += 2 + file.getShortAt(offset+2, true);
|
||||
|
||||
} else if (marker == 225) {
|
||||
// 0xE1 = Application-specific 1 (for EXIF)
|
||||
if (debug)
|
||||
console.log("Found 0xFFE1 marker");
|
||||
|
||||
return readEXIFData(file, offset + 4, file.getShortAt(offset + 2, true) - 2);
|
||||
|
||||
} else {
|
||||
offset += 2 + file.getShortAt(offset + 2, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function readTags(file, tiffStart, dirStart, strings, bigEnd) {
|
||||
var entries = file.getShortAt(dirStart, bigEnd),
|
||||
tags = {},
|
||||
entryOffset, tag,
|
||||
i;
|
||||
|
||||
for (i = 0; i < entries; i++) {
|
||||
entryOffset = dirStart + i * 12 + 2;
|
||||
tag = strings[file.getShortAt(entryOffset, bigEnd)];
|
||||
if (!tag && debug)
|
||||
console.log("Unknown tag: " + file.getShortAt(entryOffset, bigEnd));
|
||||
tags[tag] = readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd);
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
|
||||
function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd) {
|
||||
var type = file.getShortAt(entryOffset + 2, bigEnd),
|
||||
numValues = file.getLongAt(entryOffset + 4, bigEnd),
|
||||
valueOffset = file.getLongAt(entryOffset + 8, bigEnd) + tiffStart,
|
||||
offset,
|
||||
vals, val, n,
|
||||
numerator, denominator;
|
||||
|
||||
switch (type) {
|
||||
case 1: // byte, 8-bit unsigned int
|
||||
case 7: // undefined, 8-bit byte, value depending on field
|
||||
if (numValues == 1) {
|
||||
return file.getByteAt(entryOffset + 8, bigEnd);
|
||||
} else {
|
||||
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
|
||||
vals = [];
|
||||
for (n = 0; n < numValues; n++) {
|
||||
vals[n] = file.getByteAt(offset + n);
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
|
||||
case 2: // ascii, 8-bit byte
|
||||
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
|
||||
return file.getStringAt(offset, numValues - 1);
|
||||
|
||||
case 3: // short, 16 bit int
|
||||
if (numValues == 1) {
|
||||
return file.getShortAt(entryOffset + 8, bigEnd);
|
||||
} else {
|
||||
offset = numValues > 2 ? valueOffset : (entryOffset + 8);
|
||||
vals = [];
|
||||
for (n = 0; n < numValues; n++) {
|
||||
vals[n] = file.getShortAt(offset + 2 * n, bigEnd);
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
|
||||
case 4: // long, 32 bit int
|
||||
if (numValues == 1) {
|
||||
return file.getLongAt(entryOffset + 8, bigEnd);
|
||||
} else {
|
||||
vals = [];
|
||||
for (var n = 0; n < numValues; n++) {
|
||||
vals[n] = file.getLongAt(valueOffset + 4 * n, bigEnd);
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
|
||||
case 5: // rational = two long values, first is numerator, second is denominator
|
||||
if (numValues == 1) {
|
||||
numerator = file.getLongAt(valueOffset, bigEnd);
|
||||
denominator = file.getLongAt(valueOffset + 4, bigEnd);
|
||||
val = new Number(numerator / denominator);
|
||||
val.numerator = numerator;
|
||||
val.denominator = denominator;
|
||||
return val;
|
||||
} else {
|
||||
vals = [];
|
||||
for (n = 0; n < numValues; n++) {
|
||||
numerator = file.getLongAt(valueOffset + 8 * n, bigEnd);
|
||||
denominator = file.getLongAt(valueOffset + 4 + 8 * n, bigEnd);
|
||||
vals[n] = new Number(numerator / denominator);
|
||||
vals[n].numerator = numerator;
|
||||
vals[n].denominator = denominator;
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
|
||||
case 9: // slong, 32 bit signed int
|
||||
if (numValues == 1) {
|
||||
return file.getSLongAt(entryOffset + 8, bigEnd);
|
||||
} else {
|
||||
vals = [];
|
||||
for (n = 0; n < numValues; n++) {
|
||||
vals[n] = file.getSLongAt(valueOffset + 4 * n, bigEnd);
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
|
||||
case 10: // signed rational, two slongs, first is numerator, second is denominator
|
||||
if (numValues == 1) {
|
||||
return file.getSLongAt(valueOffset, bigEnd) / file.getSLongAt(valueOffset + 4, bigEnd);
|
||||
} else {
|
||||
vals = [];
|
||||
for (n = 0; n < numValues; n++) {
|
||||
vals[n] = file.getSLongAt(valueOffset + 8 * n, bigEnd) / file.getSLongAt(valueOffset + 4 + 8 * n, bigEnd);
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function readEXIFData(file, start) {
|
||||
if (file.getStringAt(start, 4) != "Exif") {
|
||||
if (debug)
|
||||
console.log("Not valid EXIF data! " + file.getStringAt(start, 4));
|
||||
return false;
|
||||
}
|
||||
|
||||
var bigEnd,
|
||||
tags, tag,
|
||||
exifData, gpsData,
|
||||
tiffOffset = start + 6;
|
||||
|
||||
// test for TIFF validity and endianness
|
||||
if (file.getShortAt(tiffOffset) == 0x4949) {
|
||||
bigEnd = false;
|
||||
} else if (file.getShortAt(tiffOffset) == 0x4D4D) {
|
||||
bigEnd = true;
|
||||
} else {
|
||||
if (debug)
|
||||
console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.getShortAt(tiffOffset + 2, bigEnd) != 0x002A) {
|
||||
if (debug)
|
||||
console.log("Not valid TIFF data! (no 0x002A)");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.getLongAt(tiffOffset + 4, bigEnd) != 0x00000008) {
|
||||
if (debug)
|
||||
console.log("Not valid TIFF data! (First offset not 8)", file.getShortAt(tiffOffset + 4, bigEnd));
|
||||
return false;
|
||||
}
|
||||
|
||||
tags = readTags(file, tiffOffset, tiffOffset + 8, TiffTags, bigEnd);
|
||||
|
||||
if (tags.ExifIFDPointer) {
|
||||
exifData = readTags(file, tiffOffset, tiffOffset + tags.ExifIFDPointer, ExifTags, bigEnd);
|
||||
for (tag in exifData) {
|
||||
switch (tag) {
|
||||
case "LightSource" :
|
||||
case "Flash" :
|
||||
case "MeteringMode" :
|
||||
case "ExposureProgram" :
|
||||
case "SensingMethod" :
|
||||
case "SceneCaptureType" :
|
||||
case "SceneType" :
|
||||
case "CustomRendered" :
|
||||
case "WhiteBalance" :
|
||||
case "GainControl" :
|
||||
case "Contrast" :
|
||||
case "Saturation" :
|
||||
case "Sharpness" :
|
||||
case "SubjectDistanceRange" :
|
||||
case "FileSource" :
|
||||
exifData[tag] = StringValues[tag][exifData[tag]];
|
||||
break;
|
||||
|
||||
case "ExifVersion" :
|
||||
case "FlashpixVersion" :
|
||||
exifData[tag] = String.fromCharCode(exifData[tag][0], exifData[tag][1], exifData[tag][2], exifData[tag][3]);
|
||||
break;
|
||||
|
||||
case "ComponentsConfiguration" :
|
||||
exifData[tag] =
|
||||
StringValues.Components[exifData[tag][0]]
|
||||
+ StringValues.Components[exifData[tag][1]]
|
||||
+ StringValues.Components[exifData[tag][2]]
|
||||
+ StringValues.Components[exifData[tag][3]];
|
||||
break;
|
||||
}
|
||||
tags[tag] = exifData[tag];
|
||||
}
|
||||
}
|
||||
|
||||
if (tags.GPSInfoIFDPointer) {
|
||||
gpsData = readTags(file, tiffOffset, tiffOffset + tags.GPSInfoIFDPointer, GPSTags, bigEnd);
|
||||
for (tag in gpsData) {
|
||||
switch (tag) {
|
||||
case "GPSVersionID" :
|
||||
gpsData[tag] = gpsData[tag][0]
|
||||
+ "." + gpsData[tag][1]
|
||||
+ "." + gpsData[tag][2]
|
||||
+ "." + gpsData[tag][3];
|
||||
break;
|
||||
}
|
||||
tags[tag] = gpsData[tag];
|
||||
}
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
|
||||
|
||||
function getData(img, callback) {
|
||||
if (!img.complete)
|
||||
return false;
|
||||
if (!imageHasData(img)) {
|
||||
getImageData(img, callback);
|
||||
} else {
|
||||
if (callback) {
|
||||
callback.call(img);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function getTag(img, tag) {
|
||||
if (!imageHasData(img))
|
||||
return;
|
||||
return img.exifdata[tag];
|
||||
}
|
||||
|
||||
function getAllTags(img) {
|
||||
if (!imageHasData(img))
|
||||
return {};
|
||||
var a,
|
||||
data = img.exifdata,
|
||||
tags = {};
|
||||
for (a in data) {
|
||||
if (data.hasOwnProperty(a)) {
|
||||
tags[a] = data[a];
|
||||
}
|
||||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
function pretty(img) {
|
||||
if (!imageHasData(img))
|
||||
return "";
|
||||
var a,
|
||||
data = img.exifdata,
|
||||
strPretty = "";
|
||||
for (a in data) {
|
||||
if (data.hasOwnProperty(a)) {
|
||||
if (typeof data[a] == "object") {
|
||||
if (data[a] instanceof Number) {
|
||||
strPretty += a + " : " + data[a] + " [" + data[a].numerator + "/" + data[a].denominator + "]\r\n";
|
||||
} else {
|
||||
strPretty += a + " : [" + data[a].length + " values]\r\n";
|
||||
}
|
||||
} else {
|
||||
strPretty += a + " : " + data[a] + "\r\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return strPretty;
|
||||
}
|
||||
|
||||
function readFromBinaryFile(file) {
|
||||
return findEXIFinJPEG(file);
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
readFromBinaryFile: readFromBinaryFile,
|
||||
pretty: pretty,
|
||||
getTag: getTag,
|
||||
getAllTags: getAllTags,
|
||||
getData: getData,
|
||||
Tags: ExifTags,
|
||||
TiffTags: TiffTags,
|
||||
GPSTags: GPSTags,
|
||||
StringValues: StringValues
|
||||
};
|
||||
|
||||
})();
|
185
static/app2/js/family.js
Executable file
185
static/app2/js/family.js
Executable file
@ -0,0 +1,185 @@
|
||||
$('.t_con').css('display', 'none');
|
||||
var html_li='<p class="title"></p>';
|
||||
$('.header_con').append(html_li);
|
||||
$('.header_con .title').css('display','none');
|
||||
|
||||
|
||||
var topTypeId = '';
|
||||
var isBrand = 0;
|
||||
var secTypeId = '';
|
||||
var pageSize = 10;
|
||||
var page = 1;
|
||||
var lxy_num = 0;
|
||||
var header_class = '';
|
||||
var nav_class = '';
|
||||
var lxy_top = '';
|
||||
var isjiazai = 1;
|
||||
|
||||
function lxy_(topTypeId, secTypeId, page, pageSize) {
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
var lxy_data_ = {
|
||||
topTypeId: topTypeId ? topTypeId : '',
|
||||
secTypeId: secTypeId ? secTypeId : '',
|
||||
isBrand:isBrand,
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 10
|
||||
}
|
||||
|
||||
mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-actGoodsList'), {
|
||||
|
||||
data: lxy_data_,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.data.goodsFavoritesNum)
|
||||
// console.log(data.data.Rows)
|
||||
|
||||
// var data = toJson(data);
|
||||
var data = data.data
|
||||
var html = '';
|
||||
if(data.Rows == '') {
|
||||
|
||||
if(page==1){
|
||||
$('#recommend_con').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;margin-top:20px;">没有更多商品</p>');
|
||||
}else{
|
||||
$('#recommend_con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;margin-top:20px;">没有更多商品</p>');
|
||||
}
|
||||
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display: none;">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img class="icon_icon" src="../img/icon_sscl.png"alt=""style="display:none;"/></div>'
|
||||
});
|
||||
|
||||
if(page == 1) {
|
||||
$('#recommend_con').html(html);
|
||||
} else {
|
||||
$('#recommend_con').append(html);
|
||||
}
|
||||
|
||||
isjiazai = 1;
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
var adUrl = self.adURLId;
|
||||
if(adUrl.indexOf('brandId') >= 0){
|
||||
isBrand = 1;
|
||||
}
|
||||
topTypeId = self.adURLId.split('=')[1];
|
||||
// console.log(topTypeId)
|
||||
if(topTypeId == '45' && isBrand == 0) {
|
||||
lxy_num = 0;
|
||||
} else if(topTypeId == '46' && isBrand == 0) {
|
||||
lxy_num = 1;
|
||||
} else if(topTypeId == '47' && isBrand == 0) {
|
||||
lxy_num = 2;
|
||||
} else if(topTypeId == '48' && isBrand == 0) {
|
||||
lxy_num = 3;
|
||||
} else if(topTypeId == '49' && isBrand == 0) {
|
||||
lxy_num = 4;
|
||||
} else if(topTypeId == '50' && isBrand == 0) {
|
||||
lxy_num = 5;
|
||||
} else {
|
||||
lxy_num = null;
|
||||
}
|
||||
|
||||
if(lxy_num == null) {
|
||||
$('.header_con .title').css('display','block');
|
||||
$('.mui-action-back').css('color','black');
|
||||
} else {
|
||||
header_class = 'header' + lxy_num;
|
||||
nav_class = 'lxy' + lxy_num;
|
||||
lxy_top = 'top' + lxy_num;
|
||||
$('.header').addClass(header_class);
|
||||
var html_lxy = '<img src="'+ hyhImgUrl('static/app2/img/family_log_' + topTypeId + '.png') +'" class="oc_logo" />';
|
||||
$('.header_con').append(html_lxy);
|
||||
$('#timer_swiper .nav').addClass(nav_class);
|
||||
$('.top').addClass(lxy_top);
|
||||
}
|
||||
|
||||
mui.ajax(kxUrl('addon/hyhlimitactive-Hyhlimitactive-actList'), {
|
||||
|
||||
data: {
|
||||
topTypeId: topTypeId,
|
||||
isBrand:isBrand
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data.data.goodsFavoritesNum)
|
||||
// console.log(data.data.Rows)
|
||||
|
||||
// var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
// console.log(isBrand+JSON.stringify(data) );
|
||||
var data = data.data
|
||||
var html = '';
|
||||
var len = 0;
|
||||
$.each(data.lists, function(num) {
|
||||
html += '<div class="swiper-slide nav_block" data-secTypeId="' + this.secTypeId + '"><p class="p1">' + this.secTypeName + '</p></div>';
|
||||
len = num + 1;
|
||||
});
|
||||
$('.nav').html(html);
|
||||
$('.header_con .title').html(data.title);
|
||||
$('.nav_block').eq(0).addClass('on');
|
||||
|
||||
if(len == 0) {
|
||||
// mui.back();
|
||||
} else if(len == 1) {
|
||||
|
||||
} else {
|
||||
$('.t_con').css('display', 'block');
|
||||
}
|
||||
if(len > 5) {
|
||||
len = 4.5
|
||||
} else {
|
||||
len = len;
|
||||
}
|
||||
var swiper = new Swiper('#timer_swiper', {
|
||||
slidesPerView: len,
|
||||
paginationClickable: true,
|
||||
spaceBetween: 0,
|
||||
freeMode: true
|
||||
});
|
||||
secTypeId = $('.nav_block').eq(0).attr('data-secTypeId');
|
||||
lxy_(topTypeId, secTypeId, 1, 10);
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
mui('.nav').on('tap', '.nav_block', function() {
|
||||
secTypeId = $(this).attr('data-secTypeId');
|
||||
isjiazai = 1;
|
||||
page = 1;
|
||||
lxy_(topTypeId, secTypeId, page, 10);
|
||||
})
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
lxy_(topTypeId, secTypeId, page, pageSize);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
})
|
53
static/app2/js/friends.js
Executable file
53
static/app2/js/friends.js
Executable file
@ -0,0 +1,53 @@
|
||||
mui.plusReady(function() {
|
||||
var level = '';
|
||||
JZL.ajax(qlgUrl('app/users/myFriend'), {}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
var data = data.data;
|
||||
var html = '',
|
||||
html1 = '';
|
||||
|
||||
html1 = '<p class="">' + data.pInfo.trueName + '<span class="orange">' + data.pInfo.userStatus +
|
||||
'</span></p><span class="shop_info">' + data.pInfo.userLevel + '</span><span class="shop_info">' + data.pInfo.userPhone +
|
||||
'</span>';
|
||||
html =
|
||||
'<div class="row shadown_wai" data-level="-1"><label for="">我推荐</label><label for=""><span class="lock"></>' +
|
||||
data.lockUserCount +
|
||||
'</span><span class="lock">(禁用)</span></label></div><div class="row shadown_wai" data-level="0"><label for="">购户</label><label for="">' +
|
||||
data.userCount +
|
||||
'</label></div><div class="row shadown_wai" data-level="1"><label for="">商户</label><label for="">' + data.shopCount +
|
||||
'</label></div><div class="row shadown_wai" data-level="2"><label for="">商超</label><label for="">' + data.storeCount +
|
||||
'</label></div><div class="row shadown_wai" data-level="3"><label for="">商厦</label><label for="">' + data.mallCount +
|
||||
'</label></div><div class="row shadown_wai" data-level="4"><label for="">商都</label><label for="">' + data.marketCount +
|
||||
'</label></div>';
|
||||
// html1=data.user.loginName+" "+data.user.userId
|
||||
$('.fri-con').html(html)
|
||||
$('.shop_info').html(html1)
|
||||
$('.userInfo').text(data.user.loginName)
|
||||
//二维码生成
|
||||
// var content=''
|
||||
var qrcode = new QRCode(document.getElementById("qrcode"), {
|
||||
width: 100, //设置宽高
|
||||
height: 100
|
||||
});
|
||||
//console.log(data.share_url);
|
||||
//$('body').append('<div id="qrcode" class="qrcode_img" style="display:none;"></div>');
|
||||
qrcode.makeCode(data.share_url);
|
||||
// //console.log('http://t.ect99.com/mobile/users/reg?pName='+ data.user.loginName);
|
||||
$('#qrcode').show();
|
||||
}else{
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
$('body').on("tap", '.row', function() {
|
||||
// alert(1)
|
||||
level = $(this).attr('data-level');
|
||||
JZL.openWindow('friendsList.html', 'friendsList.html', {
|
||||
'level': level
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
})
|
86
static/app2/js/friendsList.js
Executable file
86
static/app2/js/friendsList.js
Executable file
@ -0,0 +1,86 @@
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
var userLevel = self.level
|
||||
// mui.alert(userLevel)
|
||||
var page = 1;
|
||||
var pagesize = 10;
|
||||
var isjiazai = 1;
|
||||
getRecommend(page, pagesize)
|
||||
|
||||
function getRecommend(page, pagesize) {
|
||||
var recommenddata = {
|
||||
page: page ? page : 1,
|
||||
pagesize: pagesize ? pagesize : 10
|
||||
}
|
||||
recommenddata.userLevel = userLevel;
|
||||
if (-1 == userLevel) {
|
||||
recommenddata.isLock = 1;
|
||||
} else {
|
||||
recommenddata.isLock = 0;
|
||||
|
||||
}
|
||||
if (isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/users/myFriendList'), recommenddata, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
var data = data.data;
|
||||
var html = '';
|
||||
if (data.Rows == '') {
|
||||
$('.fri-con').append(
|
||||
'<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px; padding-top:9px;">没有更多朋友</p>');
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
mui.each(data.Rows, function() {
|
||||
if (!this.lockReason || '' == this.lockReason) {
|
||||
html += '<div class="lock_row shadown_wai"><label for="">姓名</label><span for="">' + this.trueName +
|
||||
'</span><label for="">手机号</label><span for="" >' + this.userPhone + '</span></div>'
|
||||
} else {
|
||||
html += '<div class="list_row shadown_wai"><label for="">姓名</label><span for="">' + this.trueName +
|
||||
'</span><label for="">手机号</label><span for="">' + this.userPhone +
|
||||
'</span><label for="">锁定原因</label><span for="">' + this.lockReason +
|
||||
'</span><label for="">锁定时间</label><span for="">8' + this.lockTime +
|
||||
'小时</span><label for="">开始时间</label><span for="">' + this.createTime + '</span></div>'
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
if (page == 1) {
|
||||
$('.fri-con').html(html);
|
||||
} else {
|
||||
$('.fri-con').append(html);
|
||||
}
|
||||
isjiazai = 1;
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
// 判断默认行为是否可以被禁用
|
||||
if (e.cancelable) {
|
||||
// 判断默认行为是否已经被禁用
|
||||
if (!e.defaultPrevented) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isjiazai == 1) {
|
||||
page++;
|
||||
getRecommend(page, pagesize);
|
||||
}
|
||||
}
|
||||
if (scroll.y > 80 && issx == 0) {
|
||||
issx = 1;
|
||||
setTimeout(function() {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
}
|
||||
}, false)
|
||||
})
|
135
static/app2/js/god_ect.js
Executable file
135
static/app2/js/god_ect.js
Executable file
@ -0,0 +1,135 @@
|
||||
$('.god_rech').on('tap', function() {
|
||||
$('.rech_block').css('display', 'none');
|
||||
$('.rech_none').css('display', 'block');
|
||||
|
||||
setTimeout(function() {
|
||||
$('.rech_block').css('display', 'block');
|
||||
$('.rech_none').css('display', 'none');
|
||||
}, 500)
|
||||
})
|
||||
|
||||
mui.plusReady(function() {
|
||||
//返回用户有多少ect
|
||||
mui.ajax(kxUrl('app/ect/userECT'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data.data.goodsFavoritesNum)
|
||||
//console.log(data.data.Rows)
|
||||
//var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
var lxy_god = $('.god_ect_num');
|
||||
var data = data.data;
|
||||
lxy_god.html(data.ectNum);
|
||||
}
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
// ect实时价格,和购买神券需要多少ect
|
||||
mui.ajax(kxUrl('app/ect/getEctNum'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data.data.goodsFavoritesNum)
|
||||
//console.log(data.data.Rows)
|
||||
//var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
var data = data.data;
|
||||
$('.p2_span').html(data.now_rmb);
|
||||
$('.p3_span').html(data.ect_num);
|
||||
console.log('data.now_rmb')
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
mui('.con').on('tap', '.god_shopping', function() { //立即购买
|
||||
$('#god_zhezhao').css('display', 'block');
|
||||
$('.god_ect_money').css('display', 'block');
|
||||
$('.shopping_block').css('display', 'none');
|
||||
$('.shopping_none').css('display', 'block');
|
||||
});
|
||||
|
||||
mui('.god_ect_money').on('tap', '.money_btn', function() { //购买神劵
|
||||
var that = $(this);
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(kxUrl('app/ect/payElevenEct'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data.data.goodsFavoritesNum)
|
||||
//console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
console.log(data.status);
|
||||
if(data.status == 1) {
|
||||
//购买成功
|
||||
$('.shopping_success').css('display', 'block');
|
||||
$('.god_ect_money').css('display', 'none');
|
||||
} else if(data.status == -1) {
|
||||
//购买失败
|
||||
console.log(111)
|
||||
$('.shopping_success').css('display', 'none');
|
||||
$('.shopping_lose img').attr('src', ectImgUrl('static/app2/img/error-1.png'));
|
||||
$('.shopping_lose').css('display', 'block');
|
||||
$('.shopping_lose img').css('display', 'block');
|
||||
$('.god_ect_money').css('display', 'none');
|
||||
|
||||
} else if(data.status == -2) {
|
||||
//余额不足
|
||||
console.log(444)
|
||||
$('.shopping_lose').css('display', 'block');
|
||||
$('.shopping_lose img').css('display', 'block');
|
||||
$('.god_ect_money').css('display', 'none');
|
||||
$('.shopping_success').css('display', 'none');
|
||||
} else {
|
||||
//不要重复购买
|
||||
console.log(2222)
|
||||
$('.shopping_lose img').attr('src', ectImgUrl('static/app2/img/error-3.png'));
|
||||
$('.shopping_lose').css('display', 'block');
|
||||
$('.shopping_lose img').css('display', 'block');
|
||||
$('.shopping_success').css('display', 'none');
|
||||
$('.god_ect_money').css('display', 'none');
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
console.log(errorThrown);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
mui('body').on('tap', '#god_zhezhao', function() {
|
||||
$('#god_zhezhao').css('display', 'none');
|
||||
$('.shopping_block').css('display', 'block');
|
||||
$('.shopping_none').css('display', 'none');
|
||||
})
|
||||
mui('body').on('tap', '.rech_block', function() {
|
||||
mui.openWindow({
|
||||
url: 'ect_recharge.html',
|
||||
id: 'ect_recharge.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
},
|
||||
extras: {
|
||||
// data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
216
static/app2/js/goodsList.js
Executable file
216
static/app2/js/goodsList.js
Executable file
@ -0,0 +1,216 @@
|
||||
var msort = 1;
|
||||
var page = 1;
|
||||
var condition = 2;
|
||||
var desc = 0;
|
||||
var catId;
|
||||
var keyword;
|
||||
var isjiazai = 1;
|
||||
var count = 1;
|
||||
var goodsType;
|
||||
|
||||
function pullupRefresh() {
|
||||
// setTimeout(function() {
|
||||
|
||||
// mui('#pullrefresh').pullRefresh().endPullupToRefresh();
|
||||
count += 1;
|
||||
|
||||
var data_set = {
|
||||
page: count,
|
||||
pagesize: 10,
|
||||
condition: condition,
|
||||
desc: desc
|
||||
}
|
||||
// //console.log(order_class)
|
||||
if (catId) {
|
||||
data_set.catId = catId;
|
||||
} else if (keyword) {
|
||||
data_set.keyword = keyword;
|
||||
}
|
||||
if (goodsType) {
|
||||
data_set.goodsType = goodsType;
|
||||
}
|
||||
mui.ajax(qlgUrl('app/Goods/pageQuery'), {
|
||||
|
||||
data: data_set,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
// //console.log(data.data.Rows)
|
||||
|
||||
var data = toJson(data);
|
||||
data = data.data;
|
||||
var html = '';
|
||||
if (data.Rows == '') {
|
||||
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId +
|
||||
'"data-goodsType=2><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) +
|
||||
'" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display:none;" data-shopId="' + this.shopId +
|
||||
'">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice +
|
||||
' <span style="display:none;">满减</span></div><div class="rcb_bottom"><div><span>' + this.saleNum +
|
||||
'</span><span>人购买</span></div><div style="display:none"><span>优惠率 </span><span>' + this.discountRate +
|
||||
'%</span></div></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
// html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display:none;" data-shopId="' + this.shopId + '">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
});
|
||||
$('.recommend_con').append(html);
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
isjiazai = 1;
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
// }, 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉刷新具体业务实现
|
||||
*/
|
||||
// function pulldownRefresh() {
|
||||
// setTimeout(function() {
|
||||
// window.location.reload();
|
||||
// mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
|
||||
// }, 1500);
|
||||
// }
|
||||
mui.plusReady(function() {
|
||||
var costnum = 0;
|
||||
var self = plus.webview.currentWebview();
|
||||
catId = self.data_catId;
|
||||
keyword = self.data_keyword;
|
||||
goodsType = self.goodsType?self.goodsType :"";
|
||||
$('.commoditylistnav').on('tap', '.nav_block', function() {
|
||||
page = 1;
|
||||
count = 1;
|
||||
$(this).addClass('on').siblings().removeClass('on');
|
||||
|
||||
condition = $(this).attr('data-condition');
|
||||
|
||||
if ($('#cost_btn').hasClass('on')) {
|
||||
|
||||
costnum += 1;
|
||||
|
||||
if (costnum % 2 == 1) {
|
||||
|
||||
$('#cost_btn').html('价格 <img src="../img/cost3.png"/>');
|
||||
|
||||
desc = 1;
|
||||
|
||||
} else if (costnum % 2 == 0) {
|
||||
|
||||
$('#cost_btn').html('价格 <img src="../img/cost2.png"/>');
|
||||
|
||||
desc = 0;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$('#cost_btn').html('价格 <img src="../img/cost1.png"/>')
|
||||
|
||||
costnum = 0;
|
||||
desc = 0
|
||||
}
|
||||
|
||||
var data = {
|
||||
pagesize: 10,
|
||||
page: 1,
|
||||
condition: condition,
|
||||
desc: desc,
|
||||
goodsType :goodsType
|
||||
}
|
||||
if (catId) {
|
||||
data.catId = catId;
|
||||
} else if (keyword) {
|
||||
data.keyword = keyword;
|
||||
}
|
||||
|
||||
mui.ajax(qlgUrl('app/Goods/pageQuery'), {
|
||||
data: data,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
data = data.data;
|
||||
var html = '';
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId +
|
||||
'" data-goodsType="'+goodsType+'"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) +
|
||||
'" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display:none;" data-shopId="' +
|
||||
this.shopId +
|
||||
'">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice +
|
||||
' <span style="display:none;">满减</span></div><div class="rcb_bottom"><div><span>' + this.saleNum +
|
||||
'</span><span>人购买</span></div><div style ="display:none"><span>优惠率 </span><span>' +
|
||||
this.discountRate +
|
||||
'%</span></div></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
// html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display:none;" data-shopId="' + this.shopId + '">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
});
|
||||
$('.recommend_con').html(html);
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
var data_1 = {
|
||||
pagesize: 10,
|
||||
page: 1,
|
||||
condition: 2,
|
||||
desc: 0
|
||||
}
|
||||
if (catId) {
|
||||
data_1.catId = catId;
|
||||
} else if (keyword) {
|
||||
data_1.keyword = keyword;
|
||||
}
|
||||
mui.ajax(qlgUrl('app/Goods/pageQuery'), {
|
||||
data: data_1,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
data = data.data;
|
||||
var html = '';
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId +
|
||||
'" data-goodsType="'+goodsType+'"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) +
|
||||
'" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display:none;" data-shopId="' + this.shopId +
|
||||
'">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice +
|
||||
' <span style="display:none;">满减</span></div><div class="rcb_bottom"><div><span>' + this.saleNum +
|
||||
'</span><span>人购买</span></div><div style ="display:none"><span>优惠率 </span><span>' + this.discountRate +
|
||||
'%</span></div></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
// html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display:none;" data-shopId="' + this.shopId + '">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
});
|
||||
$('.recommend_con').html(html);
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
// //console.log(scroll.y);
|
||||
// //console.log(scroll.maxScrollY);
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isjiazai == 1) {
|
||||
isjiazai = 0;
|
||||
pullupRefresh()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
// setInterval(function() {
|
||||
// $('.cnxh_block img').height($('.cnxh_block img').width());
|
||||
// $('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
|
||||
// }, 100)
|
61
static/app2/js/guide.js
Executable file
61
static/app2/js/guide.js
Executable file
@ -0,0 +1,61 @@
|
||||
|
||||
var swiperTest = null;
|
||||
var banerArray = new Array();
|
||||
|
||||
mui.init({
|
||||
swipeBack: true //启用右滑关闭功能
|
||||
});
|
||||
|
||||
/**/
|
||||
mui.back = function() {};
|
||||
mui.plusReady(function() {
|
||||
var timestamp1 = Date.parse(new Date());
|
||||
if(timestamp1 >= 1542470400000) {
|
||||
plus.storage.setItem("lauchFlag", "true"); //第一次登陆显示
|
||||
plus.navigator.setFullscreen(false);
|
||||
plus.webview.currentWebview().close();
|
||||
return;
|
||||
}
|
||||
$.ajax('http://www.juzi199.com/get_startup.php', {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
var html = '';
|
||||
$.each(data.img, function() {
|
||||
html += '<div class="mui-slider-item "><img src="' + this + '"/></div>'
|
||||
});
|
||||
$('.mui-slider-group').html(html)
|
||||
$('.mui-slider-item').eq(0).addClass('mui-slider-item-duplicate');
|
||||
$('.mui-slider-item').eq(data.img.length - 1).append('<button id="close" class="mui-btn mui-btn-warning mui-btn-outlined">跳过</button>');
|
||||
var slider = mui("#slider");
|
||||
swiperTest = document.getElementById('swiperTest');
|
||||
plus.navigator.setFullscreen(true);
|
||||
plus.navigator.closeSplashscreen();
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
mui('body').on('tap', '#close', function() {
|
||||
// plus.storage.setItem("lauchFlag", "true"); //第一次登陆显示
|
||||
plus.storage.removeItem("lauchFlag");
|
||||
plus.navigator.setFullscreen(false);
|
||||
plus.webview.currentWebview().close();
|
||||
|
||||
})
|
||||
setTimeout(function(){
|
||||
// plus.storage.setItem("lauchFlag", "true"); //第一次登陆显示
|
||||
plus.storage.removeItem("lauchFlag");
|
||||
plus.navigator.setFullscreen(false);
|
||||
plus.webview.currentWebview().close();
|
||||
},5000)
|
||||
|
||||
});
|
||||
//立即体验按钮点击事件
|
||||
//document.getElementById("close").addEventListener('tap', function(event) {
|
||||
//
|
||||
//}, false);
|
44
static/app2/js/hhrrz.js
Executable file
44
static/app2/js/hhrrz.js
Executable file
@ -0,0 +1,44 @@
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('reload', function(e) { //执行刷新
|
||||
location.reload();
|
||||
});
|
||||
|
||||
|
||||
|
||||
var self = plus.webview.currentWebview();
|
||||
|
||||
mui('.block').on('tap', '.bj', function() {
|
||||
JZL.openWindow('addhhrrz.html', 'addhhrrz.html');
|
||||
|
||||
})
|
||||
$('.con').on('tap', '.del', function() {
|
||||
var data_addressId = $(this).parent().attr('data-addressId');
|
||||
if (confirm('确认删除信息?')) {
|
||||
mui.ajax(qlgUrl('app/Useraddress/del'), {
|
||||
data: {
|
||||
id: data_addressId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
location.reload()
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
$('.add1').on('tap', function() {
|
||||
JZL.openWindow('addhhrrz.html', 'addhhrrz.html');
|
||||
})
|
||||
|
||||
})
|
299
static/app2/js/home.js
Executable file
299
static/app2/js/home.js
Executable file
@ -0,0 +1,299 @@
|
||||
// $('.saoyisao').css('display', 'none');
|
||||
$('#search').css('width', '80%');
|
||||
$('#search').css('left', '5%');
|
||||
$('.searchimg').css('left', '8%');
|
||||
|
||||
|
||||
var page = 1;
|
||||
var pagesize = 10;
|
||||
var isjiazai = 1;
|
||||
|
||||
function getRecommend(page, pagesize) {
|
||||
var recommenddata = {
|
||||
page: page ? page : 1,
|
||||
pagesize: pagesize ? pagesize : 10
|
||||
}
|
||||
if (isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
mui.ajax(qlgUrl('addon/shuff-Shuff-recommend'), {
|
||||
data: recommenddata,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
if (data.Rows == '') {
|
||||
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId +
|
||||
'"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) +
|
||||
'" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display:none;" data-shopId="' + this.shopId +
|
||||
'">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice +
|
||||
' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
});
|
||||
|
||||
if (page == 1) {
|
||||
$('#recommend_con').html(html);
|
||||
} else {
|
||||
$('#recommend_con').append(html);
|
||||
}
|
||||
isjiazai = 1;
|
||||
$('.rcb_title span').each(function() {
|
||||
if ($(this).attr('data-goodsId') == 1) {
|
||||
$(this).css('display', 'none');
|
||||
}
|
||||
})
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
// //console.log(2)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
mui.plusReady(function() {
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
var issx = 0;
|
||||
|
||||
//bannerTop
|
||||
mui.ajax(qlgUrl('addon/shuff-Shuff-homeCarousel'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
$.each(data, function() {
|
||||
html += '<div class="swiper-slide" data-adURL="' + this.adURL + '" data-targetType="' + this.targetType +
|
||||
'"><img src="' + ectImgUrl(this.adFile) + '" alt="" /></div>';
|
||||
});
|
||||
$('#top_banner .swiper-wrapper').html(html);
|
||||
var swiper = new Swiper('#top_banner', {
|
||||
pagination: '#top_banner_pagination',
|
||||
spaceBetween: 0,
|
||||
loop: true,
|
||||
autoplay: 3500,
|
||||
autoplayDisableOnInteraction: false
|
||||
});
|
||||
$('#top_banner').height($('#top_banner').width() * 460 / 750);
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
// //console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
//为你推荐
|
||||
getRecommend(page, pagesize);
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isjiazai == 1) {
|
||||
page++;
|
||||
getRecommend(page, pagesize);
|
||||
}
|
||||
}
|
||||
})
|
||||
setInterval(function() {
|
||||
|
||||
$('.add_top_left img').height($('.add_top_left img').width());
|
||||
$('.add_top_right_con img').height($('.add_top_right_con img').width());
|
||||
$('.add_bottom_con img').height($('.add_bottom_con img').width());
|
||||
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
|
||||
}, 100)
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if (-scroll.y < 0) {
|
||||
num = 0;
|
||||
} else if ((-scroll.y > 0 || scroll.y == 0) && -scroll.y < 150) {
|
||||
num = -scroll.y / 150;
|
||||
} else {
|
||||
num = 1;
|
||||
}
|
||||
$('.header').css('background-color', 'rgba(255,255,255,' + num + ')')
|
||||
|
||||
if (-scroll.y < 75) {
|
||||
$('.saoyisao').attr('src', '../img/saoyisao.png');
|
||||
$('.msg').attr('src', '../img/icon_msg.png');
|
||||
$('.search').attr('src', '../img/icon_search.png');
|
||||
$('#search').css('background-color', 'white');
|
||||
// $('#search').css('color', 'black');
|
||||
// $('#keyword').css('color', 'black');
|
||||
$('.header').removeClass('shadown_wai');
|
||||
} else {
|
||||
$('.saoyisao').attr('src', '../img/saoyisao1.png');
|
||||
$('.msg').attr('src', '../img/icon_msg1.png');
|
||||
$('.search').attr('src', '../img/icon_search1.png');
|
||||
$('#search').css('background-color', '#d8d8d8');
|
||||
// $('#search').css('color', 'white');
|
||||
// $('#keyword').css('color', 'white');
|
||||
$('.header').addClass('shadown_wai');
|
||||
}
|
||||
|
||||
if (scroll.y > 80 && issx == 0) {
|
||||
issx = 1;
|
||||
setTimeout(function() {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
})
|
||||
//轮播图跳转
|
||||
$('#top_banner').on('tap', '.swiper-slide', function() {
|
||||
openAds($(this));
|
||||
})
|
||||
|
||||
var num = 0;
|
||||
|
||||
|
||||
mui('.classify').on('tap', '.class_block', function() {
|
||||
var classifyId = $(this).attr('data-classifyId');
|
||||
var url = 'orSupermarket.html';
|
||||
|
||||
if (classifyId == 5) {
|
||||
url = 'classify.html';
|
||||
}
|
||||
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
},
|
||||
extras: {
|
||||
classifyId: classifyId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
//搜索
|
||||
$('#keyword').on('focus', function() {
|
||||
$(".search button").css('display', 'block');
|
||||
})
|
||||
$('#keyword').on('blur', function() {
|
||||
$(".search button").css('display', 'none');
|
||||
})
|
||||
$(".search button").on('tap', function() {
|
||||
var searchName = $('#keyword').val();
|
||||
var url = '';
|
||||
// e.preventDefault();
|
||||
// //console.log(searchName)
|
||||
//请求搜索接口
|
||||
// //console.log($('.search select').val())
|
||||
if ($('.search select').val() == 0) {
|
||||
url = 'goodslist.html';
|
||||
} else if ($('.search select').val() == 1) {
|
||||
url = 'shopsList.html';
|
||||
}
|
||||
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url + searchName,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: true, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
$("#keyword").on('keypress', function(e) {
|
||||
var keycode = e.keyCode;
|
||||
var searchName = $(this).val();
|
||||
var url = '';
|
||||
if (keycode == '13') {
|
||||
// e.preventDefault();
|
||||
// //console.log(searchName)
|
||||
//请求搜索接口
|
||||
// //console.log($('.search select').val())
|
||||
if ($('.search select').val() == 0) {
|
||||
url = 'goodslist.html';
|
||||
} else if ($('.search select').val() == 1) {
|
||||
url = 'shopsList.html';
|
||||
}
|
||||
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url + searchName,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: true, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
})
|
452
static/app2/js/home_new.js
Executable file
452
static/app2/js/home_new.js
Executable file
@ -0,0 +1,452 @@
|
||||
|
||||
var timestamp1 = Date.parse(new Date());
|
||||
//$('.getquan').css('display', 'none');
|
||||
$('#search').css('width', '82%');
|
||||
$('#search').css('left', '5%');
|
||||
$('.searchimg').css('left', '8%');
|
||||
//$('.time').css('display', 'none');
|
||||
//首页navId
|
||||
$('.class_block').eq(0).attr('data-classifyId', 0);
|
||||
$('.class_block').eq(1).attr('data-classifyId', 2);
|
||||
$('.class_block').eq(2).attr('data-classifyId', 4);
|
||||
$('.class_block').eq(3).attr('data-classifyId', 3);
|
||||
$('.class_block').eq(4).attr('data-classifyId', 9);
|
||||
$('.class_block').eq(5).attr('data-classifyId', 1);
|
||||
$('.class_block').eq(6).attr('data-classifyId', 10);
|
||||
$('.class_block').eq(7).attr('data-classifyId', 11);
|
||||
$('.class_block').eq(8).attr('data-classifyId', 12);
|
||||
$('.class_block').eq(9).attr('data-classifyId', '');
|
||||
var $uList = $(".scroll-box ul");
|
||||
var timer = null;
|
||||
//触摸清空定时器
|
||||
$uList.hover(function() {
|
||||
clearInterval(timer);
|
||||
},
|
||||
function() { //离开启动定时器
|
||||
timer = setInterval(function() {
|
||||
scrollList($uList);
|
||||
},
|
||||
2000);
|
||||
}).trigger("mouseleave"); //自动触发触摸事件
|
||||
//滚动动画
|
||||
function scrollList(obj) {
|
||||
//获得当前<li>的高度
|
||||
var scrollHeight = $("ul li:first").height();
|
||||
//滚动出一个<li>的高度
|
||||
$uList.stop().animate({
|
||||
marginTop: -scrollHeight
|
||||
},
|
||||
600,
|
||||
function() {
|
||||
//动画结束后,将当前<ul>marginTop置为初始值0状态,再将第一个<li>拼接到末尾。
|
||||
$uList.css({
|
||||
marginTop: 0
|
||||
}).find("li:first").appendTo($uList);
|
||||
});
|
||||
}
|
||||
|
||||
$('.bcon_left').height($('.bcon_left').width() * 345 / 185);
|
||||
|
||||
$('.bcr_block').height($('.bcr_block').width());
|
||||
$('.addsct_block').height($('.addsct_block').width() * 225 / 355);
|
||||
$('.addscb_block').height($('.addscb_block').width() * 260 / 180);
|
||||
|
||||
var page = 1;
|
||||
var pagesize = 10;
|
||||
var isjiazai = 1;
|
||||
|
||||
function getRecommend(page, pagesize) {
|
||||
var recommenddata = {
|
||||
page: page ? page : 1,
|
||||
pagesize: pagesize ? pagesize : 10
|
||||
}
|
||||
if (isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
mui.ajax(qlgUrl('app/index/getHotGoods'), {
|
||||
data: recommenddata,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data);
|
||||
|
||||
// var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
//console.log(data);
|
||||
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
if (data.Rows == '') {
|
||||
$('.mui-scroll').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId +
|
||||
'"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) +
|
||||
'" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display:none;" data-shopId="' + this.shopId +
|
||||
'">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice +
|
||||
' <span style="display:none;">满减</span></div><div class="rcb_bottom"><div><span>'+this.saleNum+'</span><span>人购买</span></div><div style="display:none"><span>优惠率 </span><span>'+this.discountRate+'%</span></div></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
});
|
||||
|
||||
if (page == 1) {
|
||||
$('#recommend_con').html(html);
|
||||
} else {
|
||||
$('#recommend_con').append(html);
|
||||
}
|
||||
isjiazai = 1;
|
||||
$('.rcb_title span').each(function() {
|
||||
if ($(this).attr('data-goodsId') == 1) {
|
||||
$(this).css('display', 'none');
|
||||
}
|
||||
})
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
|
||||
} else {
|
||||
// //console.log(2)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//滚动动画
|
||||
function scrollList(obj) {
|
||||
//获得当前<li>的高度
|
||||
var scrollHeight = $("ul li:first").height();
|
||||
//滚动出一个<li>的高度
|
||||
$uList.stop().animate({
|
||||
marginTop: -scrollHeight
|
||||
},
|
||||
600,
|
||||
function() {
|
||||
//动画结束后,将当前<ul>marginTop置为初始值0状态,再将第一个<li>拼接到末尾。
|
||||
$uList.css({
|
||||
marginTop: 0
|
||||
}).find("li:first").appendTo($uList);
|
||||
});
|
||||
}
|
||||
mui.plusReady(function() {
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
var issx = 0;
|
||||
|
||||
if (timestamp1 <= 1550678400000) {
|
||||
//活动弹窗
|
||||
var lxy_div =
|
||||
'<div class="mui-backdrop lxy_home_zz" style="display: block;background-color: rgba(0,0,0,.7);" id="home_zhezhao"><div class="lxy_zz"><img src="' +
|
||||
ectImgUrl('static/app2/img/showActive.png') + '" /></div></div>';
|
||||
|
||||
$('body').append(lxy_div);
|
||||
}
|
||||
//点击让遮罩层消失
|
||||
mui('body').on('tap', '#home_zhezhao', function() {
|
||||
$('#home_zhezhao').css('display', 'none');
|
||||
});
|
||||
|
||||
//跳转活动会场
|
||||
mui('#home_zhezhao').on('tap', '.lxy_zz', function() {
|
||||
mui.openWindow({
|
||||
url: 'journalism_con.html',
|
||||
id: 'journalism_con.html21',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
},
|
||||
extras: {
|
||||
data_articleId: 21
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {}
|
||||
})
|
||||
});
|
||||
// 点击扫一扫
|
||||
$('.saoyisao').on('tap',function () {
|
||||
JZL.openWindow('saoyisao.html','saoyisao.html')
|
||||
})
|
||||
|
||||
//bannerTop
|
||||
mui.ajax(qlgUrl('app/appport/appBanner'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
$.each(data, function() {
|
||||
html += '<div class="swiper-slide" data-adURL="' + this.adURL + '" data-targetType="' + this.targetType +
|
||||
'"><img src="' + hyhImgUrl(this.adFile) + '" alt="" /></div>';
|
||||
});
|
||||
$('#top_banner .swiper-wrapper').html(html);
|
||||
var swiper = new Swiper('#top_banner', {
|
||||
pagination: '#top_banner_pagination',
|
||||
spaceBetween: 0,
|
||||
loop: true,
|
||||
autoplay: 3500,
|
||||
autoplayDisableOnInteraction: false
|
||||
});
|
||||
// console.log($('#top_banner').width());
|
||||
var topBannerheight=($('#top_banner').width() )* 460 / 750;
|
||||
// console.log(topBannerheight);
|
||||
$('#top_banner').height(($('#top_banner').width() )* 460 / 750);
|
||||
localStorage.setItem('topBannerheight',topBannerheight)
|
||||
} else {
|
||||
// //console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
//为你推荐
|
||||
getRecommend(page, pagesize);
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
// 判断默认行为是否可以被禁用
|
||||
if (e.cancelable) {
|
||||
// 判断默认行为是否已经被禁用
|
||||
if (!e.defaultPrevented) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isjiazai == 1) {
|
||||
page++;
|
||||
getRecommend(page, pagesize);
|
||||
}
|
||||
}
|
||||
if (-scroll.y < 0) {
|
||||
num = 0;
|
||||
} else if ((-scroll.y > 0 || scroll.y == 0) && -scroll.y < 150) {
|
||||
num = -scroll.y / 150;
|
||||
} else {
|
||||
num = 1;
|
||||
}
|
||||
$('.header').css('background-color', 'rgba(255,255,255,' + num + ')')
|
||||
|
||||
if (-scroll.y < 75) {
|
||||
$('.saoyisao').attr('src', '../img/saoyisao.png');
|
||||
$('.msg').attr('src', '../img/icon_msg.png');
|
||||
$('.search').attr('src', '../img/icon_search.png');
|
||||
$('#search').css('background-color', 'white');
|
||||
// $('#search').css('color', 'black');
|
||||
// $('#keyword').css('color', 'black');
|
||||
$('.header').removeClass('shadown_wai');
|
||||
} else {
|
||||
$('.saoyisao').attr('src', '../img/saoyisao1.png');
|
||||
$('.msg').attr('src', '../img/icon_msg1.png');
|
||||
$('.search').attr('src', '../img/icon_search1.png');
|
||||
$('#search').css('background-color', '#d8d8d8');
|
||||
// $('#search').css('color', 'white');
|
||||
// $('#keyword').css('color', 'white');
|
||||
$('.header').addClass('shadown_wai');
|
||||
}
|
||||
|
||||
if (scroll.y > 80 && issx == 0) {
|
||||
issx = 1;
|
||||
setTimeout(function() {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
}
|
||||
}, false)
|
||||
setInterval(function() {
|
||||
|
||||
$('.add_top_left img').height($('.add_top_left img').width());
|
||||
$('.add_top_right_con img').height($('.add_top_right_con img').width());
|
||||
$('.add_bottom_con img').height($('.add_bottom_con img').width());
|
||||
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
|
||||
}, 100)
|
||||
//轮播图跳转
|
||||
$('#top_banner').on('tap', '.swiper-slide', function() {
|
||||
openAds($(this));
|
||||
})
|
||||
|
||||
mui('body').on('tap', '.bannerAdd', function() {
|
||||
localStorage.setItem('aaaaaa', 1);
|
||||
})
|
||||
mui('.classify').on('tap', '.class_block', function() {
|
||||
var classifyId = $(this).attr('data-classifyId');
|
||||
var url = 'orSupermarket.html';
|
||||
|
||||
if (classifyId == 0) {
|
||||
url = 'self_shop.html';
|
||||
}
|
||||
if (classifyId == '') {
|
||||
url = 'classify.html';
|
||||
}
|
||||
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
},
|
||||
extras: {
|
||||
classifyId: classifyId
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {}
|
||||
})
|
||||
})
|
||||
// mui('body').on('tap', '.add_bcr', function() {
|
||||
// //var brandId = $(this).attr('data-brandId');
|
||||
//
|
||||
// // openAds($(this));
|
||||
// mui.openWindow({
|
||||
// url: 'storeout.html',
|
||||
// id: 'storeout.html' + shopId,
|
||||
// styles: {
|
||||
// top: '0px', //新页面顶部位置
|
||||
// bottom: '0px', //新页面底部位置
|
||||
// },
|
||||
// extras: {
|
||||
// shopId: shopId
|
||||
// // ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
// },
|
||||
// createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
// show: {},
|
||||
// waiting: {}
|
||||
// })
|
||||
// })
|
||||
|
||||
|
||||
//领券
|
||||
mui('body').on('tap', '.getquan', function() {
|
||||
if (timestamp1 >= 1542470400000) {
|
||||
mui.alert('敬请期待!');
|
||||
return;
|
||||
}
|
||||
mui.openWindow({
|
||||
url: 'god_ect.html',
|
||||
id: 'god_ect.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
},
|
||||
extras: {
|
||||
// data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {}
|
||||
})
|
||||
})
|
||||
|
||||
//搜索
|
||||
$('#keyword').on('focus', function() {
|
||||
$(".search button").css('display', 'block');
|
||||
})
|
||||
$('#keyword').on('blur', function() {
|
||||
$(".search button").css('display', 'none');
|
||||
})
|
||||
$(".search button").on('tap', function() {
|
||||
var searchName = $('#keyword').val();
|
||||
var url = '';
|
||||
// e.preventDefault();
|
||||
// //console.log(searchName)
|
||||
//请求搜索接口
|
||||
// //console.log($('.search select').val())
|
||||
if ($('.search select').val() == 0) {
|
||||
url = 'goodslist.html';
|
||||
} else if ($('.search select').val() == 1) {
|
||||
url = 'shopsList.html';
|
||||
}
|
||||
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url + searchName,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: true, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
$('#keyword').val("")
|
||||
})
|
||||
$("#keyword").on('keypress', function(e) {
|
||||
var keycode = e.keyCode;
|
||||
var searchName = $(this).val();
|
||||
var url = '';
|
||||
if (keycode == '13') {
|
||||
// e.preventDefault();
|
||||
// //console.log(searchName)
|
||||
//请求搜索接口
|
||||
// //console.log($('.search select').val())
|
||||
if ($('.search select').val() == 0) {
|
||||
url = 'goodslist.html';
|
||||
} else if ($('.search select').val() == 1) {
|
||||
url = 'shopsList.html';
|
||||
}
|
||||
|
||||
mui.openWindow({
|
||||
url: url,
|
||||
id: url + searchName,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_keyword: searchName
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: true, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
})
|
20
static/app2/js/income-details.js
Executable file
20
static/app2/js/income-details.js
Executable file
@ -0,0 +1,20 @@
|
||||
mui.plusReady(function() {
|
||||
var self=plus.webview.currentWebview();
|
||||
//console.log(self)
|
||||
var shopId=self.id;
|
||||
var data_href=self.data_href;
|
||||
var data_expect=self.data_expect;
|
||||
if('wait_money' == data_href){
|
||||
$('.title')="待收款"
|
||||
}
|
||||
if('comp_money' == data_href){
|
||||
$('.title')="已收款"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
42
static/app2/js/indent.js
Executable file
42
static/app2/js/indent.js
Executable file
@ -0,0 +1,42 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
})
|
||||
|
||||
mui.plusReady(function() {
|
||||
|
||||
var self = plus.webview.currentWebview();
|
||||
var data_href = self.data_href;
|
||||
if(data_href == 'all') {
|
||||
$('.title').html('全部订单');
|
||||
|
||||
}
|
||||
if(data_href == 'waitPay') {
|
||||
$('.title').html('待付款');
|
||||
}
|
||||
if(data_href == 'waitDeliver') {
|
||||
$('.title').html('待发货');
|
||||
}
|
||||
if(data_href == 'waitReceive') {
|
||||
$('.title').html('待收货');
|
||||
}
|
||||
if(data_href == 'waitAppraise') {
|
||||
$('.title').html('待评价');
|
||||
}
|
||||
if(data_href == 'abnormal') {
|
||||
$('.title').html('退款/售后');
|
||||
}
|
||||
localStorage.setItem('order_class', data_href);
|
||||
var bSize = 64 + (+localStorage.getItem('ipxSizeTop')) + 'px';
|
||||
var sub = plus.webview.create('indentcon.html', data_href, {
|
||||
top: bSize,
|
||||
bottom: '0px',
|
||||
scrollIndicator: 'none'
|
||||
});
|
||||
self.append(sub);
|
||||
|
||||
})
|
939
static/app2/js/indentcon.js
Executable file
939
static/app2/js/indentcon.js
Executable file
@ -0,0 +1,939 @@
|
||||
$('#content').after('<div class="tui"></div>');
|
||||
var pay_name = 0;
|
||||
var token = localStorage.getItem('token');
|
||||
var order_class = localStorage.getItem('order_class');
|
||||
var orderNo;
|
||||
var orderId;
|
||||
var getReasonUrl = '';
|
||||
var priceT = 0;
|
||||
var payCode = '';
|
||||
var wxChannel = null; // 微信支付
|
||||
var aliChannel = null; // 支付宝支付
|
||||
var channel = null; //支付通道
|
||||
mui.init({
|
||||
pullRefresh: {
|
||||
container: '#pullrefresh',
|
||||
down: {
|
||||
style: 'circle', //必选,下拉刷新样式,目前支持原生5+ ‘circle’ 样式
|
||||
color: '#2BD009', //可选,默认“#2BD009” 下拉刷新控件颜色
|
||||
height: '50px', //可选,默认50px.下拉刷新控件的高度,
|
||||
range: '100px', //可选 默认100px,控件可下拉拖拽的范围
|
||||
offset: '0px', //可选 默认0px,下拉刷新控件的起始位置
|
||||
// auto: true, //可选,默认false.首次加载自动上拉刷新一次
|
||||
contentdown: "下拉可以刷新", //可选,在下拉可刷新状态时,下拉刷新控件上显示的标题内容
|
||||
contentover: "释放立即刷新", //可选,在释放可刷新状态时,下拉刷新控件上显示的标题内容
|
||||
contentrefresh: "正在刷新...", //可选,正在刷新状态时,下拉刷新控件上显示的标题内容
|
||||
contentnomore: '没有更多数据了',
|
||||
callback: pulldownRefresh //必选,刷新函数,根据具体业务来编写,比如通过ajax从服务器获取新数据;
|
||||
},
|
||||
up: {
|
||||
contentrefresh: '正在加载...',
|
||||
callback: pullupRefresh
|
||||
}
|
||||
}
|
||||
});
|
||||
var count = 1;
|
||||
|
||||
function pullupRefresh() {
|
||||
count += 1;
|
||||
getData(count);
|
||||
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉刷新具体业务实现
|
||||
*/
|
||||
function pulldownRefresh() {
|
||||
setTimeout(function() {
|
||||
window.location.reload();
|
||||
//mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
|
||||
}, 1500);
|
||||
}
|
||||
var isLoad = false;
|
||||
|
||||
function getData(page) {
|
||||
if (true == isLoad) return;
|
||||
isLoad = true;
|
||||
JZL.ajax(qlgUrl('app/Orders/getOrderList'), {
|
||||
type: order_class,
|
||||
page: page,
|
||||
pagesize: 10
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
var data = toJson(data);
|
||||
var html = ''
|
||||
if ('' == data.data.Rows) {
|
||||
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
|
||||
return;
|
||||
}
|
||||
$.each(data.data.Rows, function() {
|
||||
//this.pay_name = 1;
|
||||
var shopConfirmHtml = '';
|
||||
if (this.orderStatus == 0) {
|
||||
if (0 == this.shopConfirm) {
|
||||
shopConfirmHtml = '<div class="indent_status confirm_wait" > 待商家确认</div>';
|
||||
} else if (1 == this.shopConfirm) {
|
||||
shopConfirmHtml = '<div class="indent_status confirm_ok" > 商家已确认</div>';
|
||||
} else if (2 == this.shopConfirm) {
|
||||
shopConfirmHtml = '<div class="indent_status confirm_no" > 商家未收款</div>';
|
||||
}
|
||||
}
|
||||
html += '<div class="row" data-orderNo="' + this.orderNo + '" data-id="' + this.orderId +
|
||||
'"><div class="row_title"><div class="store_name">' + this.shopName +
|
||||
'</div><div class="indent_status shopPhone">商家电话:<a href="tel:' +
|
||||
this.phone + '">' + this.phone + '</a></div>' + shopConfirmHtml + '<div class="indent_status yellow">' +
|
||||
this.status + '</div></div><div class="row_con clearfix" data-id="' + this.orderId +
|
||||
'">'
|
||||
$.each(this.list, function() {
|
||||
html += '<div class="row_block clearfix"><img src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" /><div class="rcr clearfix"><div class="rcrc"><p>' + this.goodsName + ' </p><p class="leibie">' + this.goodsSpecNames +
|
||||
'</p></div><div class="rcrr"><p>¥' + this.goodsPrice + '</p><del>¥' + this.marketPrice + '</del><span>x' +
|
||||
this.goodsNum + '</span></div></div></div>';
|
||||
})
|
||||
html += '</div><div class="combination">共' + this.list.length + '件商品 合计:<o>¥' + this.realTotalMoney +
|
||||
'</o>(含运费¥' + this.deliverMoney + ')</div><div class="btns clearfix">';
|
||||
if (this.orderStatus == -2) {
|
||||
html += '<div class="btns_btn ljfk" data-payName="' + this.pay_name +
|
||||
'">立即付款</div><div class="btns_btn qxdd_js">取消订单</div>';
|
||||
} else if (this.orderStatus == 0) {
|
||||
html += '<div class="btns_btn uploadCertificate">上传凭证</div>';
|
||||
if (this.noticeDeliver == 0) {
|
||||
html += '<div class="btns_btn txfh" style="display:none;">提醒发货</div><div class="btns_btn qxdd_js">取消订单</div>';
|
||||
} else {
|
||||
html += '<div class="btns_btn " style="display:none;">已提醒</div><div class="btns_btn qxdd_js">取消订单</div>';
|
||||
}
|
||||
|
||||
} else if (this.orderStatus == 1) {
|
||||
html +=
|
||||
'<div class="btns_btn qrsh">确认收货</div><div class="btns_btn ckwl">查看物流</div><div class="btns_btn qxdd_js" >拒收</div><div class="btns_btn yssh">延长收货</div>';
|
||||
} else if (this.orderStatus == 2) {
|
||||
if (this.isAppraise == 0) {
|
||||
html += '<div class="btns_btn ljpj" >立即评价</div>';
|
||||
} else {
|
||||
html += '<div class="btns_btn ckpj">查看评价</div>';
|
||||
}
|
||||
|
||||
}
|
||||
if (this.orderStatus != 1 && this.orderStatus != -2 && this.isComplain == 0) {
|
||||
html += '<div class="btns_btn tsdd" >投诉</div>';
|
||||
}
|
||||
if (this.allowRefund == 1 && (this.orderStatus == -1 || this.orderStatus == -3)) {
|
||||
html += '<div class="btns_btn qxdd_js" >申请退款</div>';
|
||||
}
|
||||
|
||||
html += '</div></div>'
|
||||
})
|
||||
|
||||
$('.con').append(html);
|
||||
isLoad = false;
|
||||
})
|
||||
}
|
||||
mui.plusReady(function() {
|
||||
|
||||
// window.addEventListener('refresh', function(e) { //执行刷新
|
||||
// location.reload();
|
||||
// });
|
||||
// //console.log(order_class)
|
||||
if (order_class == 'all') {
|
||||
order_class = '';
|
||||
}
|
||||
getData(count);
|
||||
|
||||
//支付插件
|
||||
plus.payment.getChannels(function(channels) {
|
||||
for (var i in channels) {
|
||||
if (channels[i].id == "wxpay") {
|
||||
wxChannel = channels[i];
|
||||
} else {
|
||||
aliChannel = channels[i];
|
||||
}
|
||||
}
|
||||
}, function(e) {
|
||||
mui.alert("获取支付通道失败:" + e.message);
|
||||
});
|
||||
// var ALIPAYSERVER = 'http://demo.dcloud.net.cn/helloh5/payment/alipay.php?total=';
|
||||
var ALIPAYSERVER = hyhUrl('app/Alipays/toAlipay?isBatch=0&orderNo=');
|
||||
// 2. 发起支付请求
|
||||
function pay(id, orderNo) {
|
||||
// 从服务器请求支付订单
|
||||
var PAYSERVER = '';
|
||||
if (id == 'alipay') {
|
||||
PAYSERVER = ALIPAYSERVER;
|
||||
channel = aliChannel;
|
||||
} else if (id == 'wxpay') {
|
||||
PAYSERVER = WXPAYSERVER;
|
||||
channel = wxChannel;
|
||||
} else {
|
||||
plus.nativeUI.alert("不支持此支付通道!", null, "捐赠");
|
||||
return;
|
||||
}
|
||||
var xhr = new XMLHttpRequest();
|
||||
// var amount = 1;
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
switch (xhr.readyState) {
|
||||
case 4:
|
||||
if (xhr.status == 200) {
|
||||
plus.payment.request(channel, xhr.responseText, function(result) {
|
||||
plus.nativeUI.alert("支付成功!", function() {
|
||||
// back();
|
||||
var targetTab = plus.webview.getWebviewById("templete/my.html");
|
||||
mui.fire(targetTab, 'refresh');
|
||||
location.reload();
|
||||
});
|
||||
}, function(error) {
|
||||
// plus.nativeUI.alert("支付失败:" + error.code);
|
||||
// plus.webview.getWebviewById('confirmOrder.html').close()
|
||||
});
|
||||
} else {
|
||||
mui.alert("获取订单信息失败!");
|
||||
//console.log(xhr.status)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
xhr.open('GET', PAYSERVER + orderNo);
|
||||
xhr.send();
|
||||
|
||||
}
|
||||
$('#pay_way,.pay_info .con_1').append(
|
||||
'<div class="row clearfix select_payway" data-payCode="qlgpay"><p class="row_left">付款方式</p><p class="row_right">线下支付</p></div>'
|
||||
);
|
||||
|
||||
// mui.ajax(hyhUrl('/app/Users/get_name_and_money'), {
|
||||
// headers: {
|
||||
// "HYH-Token": token
|
||||
// },
|
||||
// data: {},
|
||||
// dataType: 'json', //服务器返回json格式数据
|
||||
// type: 'post', //HTTP请求类型
|
||||
// timeout: 10000, //超时时间设置为10秒;
|
||||
// success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// // //console.log(data)
|
||||
// data = toJson(data);
|
||||
//
|
||||
// if(data.status == 1) {
|
||||
// $('#loginName').html(data.data.name);
|
||||
// $('.userMoney').html(data.data.money);
|
||||
// var htmlpay = '<div class="row clearfix select_payway" data-payCode="ect"><p class="row_left">ECT余额:<o class="userECT">' + data.data.userECT + '</o></p></div>';
|
||||
// $('.pay_info .con_1').append(htmlpay);
|
||||
// } else {
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// // location.reload();
|
||||
// }
|
||||
// },
|
||||
// error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// // mui.alert(type);
|
||||
// }
|
||||
// })
|
||||
$('.con').on('tap', '.ljfk', function() {
|
||||
var that = $(this);
|
||||
pay_name = $(this).attr('data-payName');
|
||||
priceT = $(this).parent().siblings('.combination').children('o').html().slice(1);
|
||||
$('#goodsTotalMoney').html($(this).parent().siblings('.combination').children('o').html())
|
||||
orderNo = $(this).parent().parent().attr('data-orderNo');
|
||||
if (pay_name == 1) {
|
||||
$('.pay_info .con_1 .row').eq(1).attr('style', 'display: none;');
|
||||
$('.pay_info .con_1 .row').eq(2).addClass('on');
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(hqlgUrl('app/ect/getToEctNum'), {
|
||||
|
||||
data: {
|
||||
total_money: priceT
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
var btnArray = ['是', '否'];
|
||||
mui.confirm(data.msg, 'ECT确认支付', btnArray, function(e) {
|
||||
if (e.index == 1) {
|
||||
return;
|
||||
} else {
|
||||
$('.bg').css('display', 'block');
|
||||
$(".pay").slideDown(300);
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
})
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
that.removeAttr('disabled');
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$('.pay_info .con_1 .row').eq(1).addClass('on');
|
||||
$('.pay_info .con_1 .row').eq(2).attr('style', 'display: none;');
|
||||
$('.bg').css('display', 'block');
|
||||
$(".pay").slideDown(300);
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('.bg').on('tap', '.mui-icon-left-nav', function() {
|
||||
$('.pay').css('display', 'block');
|
||||
$('.pay_way').css('display', 'none');
|
||||
})
|
||||
$('.bg').on('tap', '.mui-icon-closeempty', function() {
|
||||
$('.bg').css('display', 'none');
|
||||
$(".pay").slideUp(300, function() {
|
||||
|
||||
});
|
||||
})
|
||||
$('#pay_way').on('tap', '.row', function() {
|
||||
$('#pay_way .row .mui-icon').removeClass('mui-icon-checkmarkempty');
|
||||
$(this).children('.mui-icon').addClass('mui-icon-checkmarkempty');
|
||||
$('.con_1 .on .row_right o').html($(this).children('.row_left').html());
|
||||
$('.con_1 .on').attr('data-payCode', $(this).attr('data-payCode'))
|
||||
$('.pay').css('display', 'block');
|
||||
$('#pay_way').css('display', 'none');
|
||||
|
||||
})
|
||||
$('.pay').on('tap', '.con_1 .on', function() {
|
||||
if ($(this).attr('data-payCode') == 'ect') {
|
||||
|
||||
} else {
|
||||
$('.pay').css('display', 'none');
|
||||
$('#pay_way').css('display', 'block');
|
||||
}
|
||||
|
||||
})
|
||||
$('.pay_btn').on('tap', function() {
|
||||
payCode = $('.con_1 .on').attr('data-payCode');
|
||||
////console.log(payCode)
|
||||
var that = $(this);
|
||||
var data_ljfk = {
|
||||
isBatch: 0,
|
||||
orderNo: orderNo
|
||||
}
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/orders/succeed'), {
|
||||
data: data_ljfk,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
data = toJson(data);
|
||||
|
||||
if (data.status == 1) {
|
||||
if (payCode == 'qlgpay') {
|
||||
JZL.ajax(hyhUrl('app/' + payCode + '/payment'), {
|
||||
orderNo: orderNo,
|
||||
isBatch: 0
|
||||
}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(JSON.stringify(data));
|
||||
var data = toJson(data);
|
||||
// //console.log(JSON.stringify(data))
|
||||
if (data.status == 1) {
|
||||
$('.pay').css('display', 'none');
|
||||
$('#qlg_pay_pwd').css('display', 'block');
|
||||
if (data.data.payPwd == '0') {
|
||||
mui.alert('还未设置支付密码请先设置操作密码!');
|
||||
var url = 'setting_fogetPayPwd';
|
||||
JZL.openWindow(url + '.html', url + '.html');
|
||||
//return;
|
||||
}
|
||||
$('#totalMoney').html('付款总额:¥<o>' + data.data.needPay + '</o>');
|
||||
$('#productNum').val(data.data.product.useProduct);
|
||||
if (data.data.product.useProduct > 0) {
|
||||
var html1 = '<p id="" class="p1"><span>抵扣额</span><span>' + data.data.product.useProductOk +
|
||||
'</span> </p><p id="" class="p1"><span>扣税</span> <span>' + data.data.product.useProductTaxFee +
|
||||
'</span></p><p id="" class="p1"><span>手续费</span> <span>' + data.data.product.useProductHandlingFee +
|
||||
'</span></p>';
|
||||
// $('#productInfo').html('产品券[抵扣额:' + data.data.product.useProductOk + ',扣税:' + data.data.product.useProductTaxFee +
|
||||
// ',手续费:' + data.data.product.useProductHandlingFee + ']');
|
||||
$('.productInfo_').html(html1)
|
||||
|
||||
}
|
||||
$('#couponsNum').val(data.data.coupons.useCoupons);
|
||||
if (data.data.coupons.useCoupons > 0) {
|
||||
var html2 = '<p id="" class="p1"><span>抵扣额</span><span>' + data.data.coupons.useCouponsOk +
|
||||
'</span> </p><p id="" class="p1"><span>扣税</span> <span>' + data.data.coupons.useCouponsTaxFee +
|
||||
'</span></p><p id="" class="p1"><span>手续费</span> <span>' + data.data.coupons.useCouponsHandlingFee +
|
||||
'</span></p>';
|
||||
$('.couponsInfo_').html(html2)
|
||||
// $('#couponsInfo').html('优惠券[抵扣额:' + data.data.coupons.useCouponsOk + ',扣税:' + data.data.coupons.useCouponsTaxFee +
|
||||
// ',手续费:' + data.data.coupons.useCouponsHandlingFee + ']');
|
||||
}
|
||||
$('#wangNum').val(data.data.wang.useWang);
|
||||
$('#moneyNum').val(data.data.money.useMoney);
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
});
|
||||
} else if (payCode == 'wallets' || payCode == 'ect') {
|
||||
//跳输入密码的页面
|
||||
mui.ajax(hyhUrl('app/' + payCode + '/payment'), {
|
||||
data: {
|
||||
orderNo: orderNo,
|
||||
isBatch: 0
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
$('.pay').css('display', 'none');
|
||||
$('#pay_pwd').css('display', 'block');
|
||||
if (data.data.payPwd == '0') {
|
||||
mui.alert('还未设置支付密码请先设置支付密码!');
|
||||
var url = 'setting_fogetPayPwd';
|
||||
mui.openWindow({
|
||||
url: url + '.html',
|
||||
id: url + '.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
// data_href: data_href
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
} else if (payCode == 'alipays') {
|
||||
pay('alipay', orderNo);
|
||||
// plus.nativeUI.showWaiting();
|
||||
// mui.post(hyhUrl('app/Alipays/payment'), {
|
||||
// orderNo: data.data,
|
||||
// isBatch: 1
|
||||
// var ALIPAYSERVER = hyhUrl('app/Alipays/payment?orderNo=' + data.data + '&isBatch=1');
|
||||
|
||||
}
|
||||
|
||||
that.removeAttr('disabled');
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
// mui.alert('发生错误请刷新后重试!');
|
||||
// location.reload();
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
mui.alert(type);
|
||||
}
|
||||
})
|
||||
})
|
||||
$('#pay_pwd,#qlg_pay_pwd').on('tap', '.p9', function() {
|
||||
var url = 'setting_fogetPayPwd';
|
||||
JZL.openWindow(url + '.html', url + '.html');
|
||||
})
|
||||
$('#pay_pwd,#qlg_pay_pwd').on('tap', '.pay_btn_pwd', function() {
|
||||
// var self = plus.webview.currentWebview();
|
||||
// var data_href = self.id;
|
||||
// //console.log(data_href)
|
||||
// JZL.closeWindow('waitPay');
|
||||
//return;
|
||||
var payPwd = $('#payPwd').val();
|
||||
if (payPwd == '') {
|
||||
mui.alert('支付密码不能为空!');
|
||||
return;
|
||||
}
|
||||
var that = $(this);
|
||||
that.attr('disabled', 'disabled')
|
||||
var srcc = ''
|
||||
if (payCode == 'qlgpay') {
|
||||
srcc = 'payByQlg';
|
||||
} else if (payCode == 'ect') {
|
||||
srcc = 'payByEct';
|
||||
} else {
|
||||
srcc = 'payByWallet';
|
||||
}
|
||||
|
||||
mui.ajax(hyhUrl('app/' + payCode + '/' + srcc), {
|
||||
|
||||
data: {
|
||||
orderNo: orderNo,
|
||||
isBatch: 0,
|
||||
payPwd: payPwd
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
var data = toJson(data);
|
||||
mui.alert(data.msg)
|
||||
//console.log(data.status)
|
||||
if (data.status == 1) {
|
||||
JZL.openWindow('indent.html', 'waitDeliver', {
|
||||
data_href: 'waitDeliver'
|
||||
});
|
||||
setTimeout(function() {
|
||||
JZL.closeWindow(plus.webview.currentWebview().id);
|
||||
// JZL.closeWindow('indent.html');
|
||||
}, 700)
|
||||
// var targetTab = plus.webview.getWebviewById("templete/my.html");
|
||||
// mui.fire(targetTab, 'refresh');
|
||||
// location.reload();
|
||||
} else {
|
||||
|
||||
}
|
||||
that.removeAttr('disabled')
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
mui('.con').on('tap', '.row_con', function() {
|
||||
var data_order_id = $(this).attr('data-id');
|
||||
mui.openWindow({
|
||||
url: 'order_out.html',
|
||||
id: 'order_out.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_order_id: data_order_id
|
||||
// data_id: data_id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
mui('.con').on('tap', '.ckwl', function() {
|
||||
var data_order_id = $(this).parent().parent().attr('data-id'); //$(this).attr('data-id');
|
||||
JZL.openWindow('logistics.html', 'logistics.html', {
|
||||
data_order_id: data_order_id
|
||||
});
|
||||
})
|
||||
//上传凭证
|
||||
mui('.con').on('tap', '.uploadCertificate', function() {
|
||||
var orderId = $(this).parent().parent().attr('data-id');
|
||||
// mui.alert('跳到上传凭证页'+orderId)
|
||||
|
||||
JZL.openWindow('uploadVoucher.html', 'uploadVoucher.html' + orderId, {
|
||||
orderId: orderId
|
||||
});
|
||||
|
||||
})
|
||||
$('.con').on('tap', '.qxdd_js', function() {
|
||||
orderNo = $(this).parent().parent().attr('data-orderNo');
|
||||
orderId = $(this).parent().parent().attr('data-id');
|
||||
if ($(this).html() == '取消订单') {
|
||||
getReasonUrl = 'getCancelCause';
|
||||
} else if ($(this).html() == '拒收') {
|
||||
getReasonUrl = 'getRejectCause';
|
||||
} else if ($(this).html() == '申请退款') {
|
||||
getReasonUrl = 'getRefundCause';
|
||||
JZL.ajax(hyhUrl('/app/Orders/getRefund'), {
|
||||
id: orderId
|
||||
}, function(data) { //服务器返回响应
|
||||
// //console.log(JSON.stringify(data));
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '';
|
||||
if ('qlgpay' == data.payFrom) {
|
||||
html = ' 退款产品券数量:<input type="text" class="refundTxt" name="productNum" id="productNum" value="' +
|
||||
data.productNum +
|
||||
'" placeholder="请输入产品券数量"/>' +
|
||||
' 退款优惠券数量:<input type="text" class="refundTxt" name="couponsNum" id="couponsNum" value="' + data.couponsNum +
|
||||
'" placeholder="请输入优惠券数量"/>' +
|
||||
' 退款旺旺券数量:<input type="text" class="refundTxt" name="wangNum" id="wangNum" value="' + data.wangNum +
|
||||
'" placeholder="请输入旺旺券数量"/>' +
|
||||
' 退款现金数量:' + data.moneyNum + ',现金方面请与商家协商' +
|
||||
// '<p class="info1">(金额不能超过<o>¥' + data.realTotalMoney +
|
||||
'</o>)</p>';
|
||||
} else {
|
||||
html = '<input type="text" name="Tmoney" id="Tmoney" value="' + data.realTotalMoney +
|
||||
'" placeholder="请输入退款金额"/><p class="info1">(金额不能超过<o>¥' + data.realTotalMoney +
|
||||
'</o>)</p><p class="info1">(积分数量:' + data.ectNum + ')</p>';
|
||||
}
|
||||
|
||||
$('.tui').html(html)
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
});
|
||||
}
|
||||
$('.bg_').css('display', 'block');
|
||||
$('.bg_con').css('display', 'none');
|
||||
$('.bg_con').slideDown(300, function() {});
|
||||
|
||||
mui.ajax(hyhUrl('/app/Orders/' + getReasonUrl), {
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
// //console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
var html = '<option value="0">请下拉选择原因</option>';
|
||||
$.each(data.data, function() {
|
||||
html += '<option value="' + this.dataVal + '">' + this.dataName + '</option>'
|
||||
});
|
||||
$('#select').html(html)
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.bg_').on('tap', '.en_false', function() {
|
||||
$('.bg_').css('display', 'none');
|
||||
|
||||
})
|
||||
$('.bg_').on('tap', '.en_true', function() {
|
||||
var setReasonUrl = '';
|
||||
var content = $('#content').val();
|
||||
var reason = $('#select').val();
|
||||
if ($('#select').val() == 0) {
|
||||
mui.alert('请选择原因!');
|
||||
return;
|
||||
}
|
||||
if ($('#select').val() == 10000 && content == '') {
|
||||
mui.alert('请输入其他原因!');
|
||||
return;
|
||||
}
|
||||
if (getReasonUrl == 'getCancelCause') {
|
||||
setReasonUrl = 'cancellation';
|
||||
mui.ajax(qlgUrl('app/Orders/' + setReasonUrl), {
|
||||
data: {
|
||||
reason: reason,
|
||||
id: orderId,
|
||||
content: content
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
// //console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
mui.alert(data.msg);
|
||||
if (data.status == 1) {
|
||||
// var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
// mui.fire(list, 'refresh');
|
||||
if ('waitPay' == plus.webview.currentWebview().id) {
|
||||
location.reload();
|
||||
} else {
|
||||
JZL.openWindow('indent.html', 'abnormal', {
|
||||
data_href: 'abnormal'
|
||||
});
|
||||
setTimeout(function() {
|
||||
//plus.webview.currentWebview().close();
|
||||
JZL.closeWindow(plus.webview.currentWebview().id);
|
||||
}, 500)
|
||||
}
|
||||
// JZL.openWindow('indent.html', 'abnormal', {
|
||||
// data_href: 'abnormal'
|
||||
// });
|
||||
// setTimeout(function() {
|
||||
// plus.webview.currentWebview().close();
|
||||
// // JZL.closeWindow(plus.webview.currentWebview().id);
|
||||
// }, 500)
|
||||
//location.reload();
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
} else if (getReasonUrl == 'getRejectCause') {
|
||||
setReasonUrl = 'reject';
|
||||
mui.ajax(qlgUrl('app/Orders/' + setReasonUrl), {
|
||||
data: {
|
||||
reason: reason,
|
||||
id: orderId,
|
||||
content: content
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
// //console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
mui.alert(data.msg);
|
||||
if (data.status == 1) {
|
||||
// var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
// mui.fire(list, 'refresh');
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
} else if (getReasonUrl == 'getRefundCause') {
|
||||
var params = {}
|
||||
// params.money = $('#Tmoney').val();
|
||||
// if (params.money < 0 || params.money == 0) {
|
||||
// mui.alert('退款金额不能为0!');
|
||||
// return;
|
||||
// }
|
||||
params.productNum = $('#productNum').val();
|
||||
params.couponsNum = $('#couponsNum').val();
|
||||
params.wangNum = $('#wangNum').val();
|
||||
params.reason = reason;
|
||||
params.id = orderId;
|
||||
params.content = content;
|
||||
JZL.ajax(qlgUrl('app/Orderrefunds/refund'), params, function(data) {
|
||||
var data = toJson(data);
|
||||
mui.alert(data.msg);
|
||||
if (data.status == 1) {
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'refresh');
|
||||
location.reload();
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('.con').on('tap', '.yssh', function() {
|
||||
orderNo = $(this).parent().parent().attr('data-orderNo');
|
||||
orderId = $(this).parent().parent().attr('data-id');
|
||||
if (confirm('你要延长收货么?')) {
|
||||
mui.ajax(qlgUrl('/app/orders/delay'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
id: orderId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
////console.log(data.data.goodsFavoritesNum)
|
||||
////console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
////console.log(data.status)
|
||||
if (data.status == 1) {
|
||||
mui.alert(data.msg);
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
$('.con').on('tap', '.qrsh', function() {
|
||||
//$('.bg_').css('display', 'block');
|
||||
orderNo = $(this).parent().parent().attr('data-orderNo');
|
||||
orderId = $(this).parent().parent().attr('data-id');
|
||||
if (confirm('确认收货?')) {
|
||||
mui.ajax(hyhUrl('/app/Orders/receive'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
id: orderId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
////console.log(data.data.goodsFavoritesNum)
|
||||
////console.log(data.data.Rows)
|
||||
var data = toJson(data);
|
||||
////console.log(data.status)
|
||||
if (data.status == 1) {
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'refresh');
|
||||
location.reload()
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
$('#select').on('change', function() {
|
||||
if ($(this).val() == '10000') {
|
||||
$('#content').css('display', 'block');
|
||||
} else {
|
||||
$('#content').css('display', 'none');
|
||||
}
|
||||
})
|
||||
//跳转到评价
|
||||
mui('.con').on('tap', '.ljpj', function() {
|
||||
var oId = $(this).parent().parent().attr('data-id');
|
||||
mui.openWindow({
|
||||
url: 'pj.html',
|
||||
id: 'pj.html' + oId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_order_id: oId
|
||||
// data_id: data_id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//跳转到评价
|
||||
mui('.con').on('tap', '.ckpj', function() {
|
||||
var oId = $(this).parent().parent().attr('data-id');
|
||||
mui.openWindow({
|
||||
url: 'pj.html',
|
||||
id: 'pj.html' + oId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_order_id: oId
|
||||
// data_id: data_id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
//跳转到评价
|
||||
mui('.con').on('tap', '.tsdd', function() {
|
||||
var oId = $(this).parent().parent().attr('data-id');
|
||||
mui.openWindow({
|
||||
url: 'complain.html',
|
||||
id: 'complain.html' + oId,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_order_id: oId
|
||||
// data_id: data_id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
101
static/app2/js/index.js
Executable file
101
static/app2/js/index.js
Executable file
@ -0,0 +1,101 @@
|
||||
var wgtVer = null;
|
||||
var is_juzi_online = 0;
|
||||
|
||||
function plusReady() { // 获取本地应用资源版本号
|
||||
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
|
||||
wgtVer = inf.version;
|
||||
});
|
||||
}
|
||||
//休眠方法
|
||||
var ver;
|
||||
//获取数据
|
||||
|
||||
function sleep(numberMillis) {
|
||||
var now = new Date();
|
||||
var exitTime = now.getTime() + numberMillis;
|
||||
while (true) {
|
||||
now = new Date();
|
||||
if (now.getTime() > exitTime)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mui.init({
|
||||
swipeBack: true
|
||||
});
|
||||
var firstBackbutton = null;
|
||||
mui.back = function() {
|
||||
if (!firstBackbutton) {
|
||||
window.plus.nativeUI.toast('再按一次退出应用');
|
||||
firstBackbutton = new Date().getTime();
|
||||
setTimeout(function() {
|
||||
firstBackbutton = null
|
||||
}, 2000);
|
||||
return false;
|
||||
} else {
|
||||
if (new Date().getTime() - firstBackbutton < 2000) {
|
||||
if (mui.os.ios) {
|
||||
const threadClass = plus.ios.importClass("NSThread");
|
||||
const mainThread = plus.ios.invoke(threadClass, "mainThread");
|
||||
plus.ios.invoke(mainThread, "exit");
|
||||
} else {
|
||||
plus.runtime.quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
//获取cid用于推送
|
||||
mui.plusReady(function() {
|
||||
// var cid = plus.push.getClientInfo().clientid;
|
||||
var timer = 0;
|
||||
timer = setInterval(function() {
|
||||
getData();
|
||||
}, 3000)
|
||||
getData();
|
||||
|
||||
function getData() {
|
||||
|
||||
if (!localStorage.getItem('isFirstDownlodad')) {
|
||||
localStorage.setItem('isFirstDownlodad', true);
|
||||
}
|
||||
mui.ajax('http://www.juzi199.com/get_version_new.php?' + Math.random(), {
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;clearInterval(timer)
|
||||
clearInterval(timer);
|
||||
localStorage.setItem('version', data.version);
|
||||
if (0 == is_juzi_online) {
|
||||
localStorage.setItem('cssUrl', "../css/");
|
||||
localStorage.setItem('jsUrl', "../js/");
|
||||
} else {
|
||||
localStorage.setItem('cssUrl', data.cssUrl ? data.cssUrl : "../css/");
|
||||
localStorage.setItem('jsUrl', data.jsUrl ? data.jsUrl : "../js/");
|
||||
}
|
||||
$('nav').css('display', 'block');
|
||||
$('#bg').css('display', 'none');
|
||||
var ipxSizeTop = 0;
|
||||
var ipxSizeBottom = 0;
|
||||
if (/iphone/gi.test(navigator.userAgent) && ((screen.height == 812 && screen.width == 375) || (screen.height ==
|
||||
896 && screen.width == 414) || (screen.height == 1792 / 3 && screen.width == 828 / 3))) {
|
||||
|
||||
ipxSizeTop = 24;
|
||||
ipxSizeBottom = 34;
|
||||
//$('.mui-bar').attr('style', "bottom: 34px;")
|
||||
};
|
||||
|
||||
localStorage.setItem('ipxSizeTop', ipxSizeTop);
|
||||
localStorage.setItem('ipxSizeBottom', ipxSizeBottom);
|
||||
init(data);
|
||||
jumpPage(ipxSizeBottom);
|
||||
nav(0);
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
mui.toast("网络异常,请检查网络设置!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
179
static/app2/js/individual.js
Executable file
179
static/app2/js/individual.js
Executable file
@ -0,0 +1,179 @@
|
||||
mui.plusReady(function() {
|
||||
var wait = 120;
|
||||
var count = 0;
|
||||
var authId = '';
|
||||
JZL.getItems('auth_personal');
|
||||
|
||||
$('.header_con_bc').on('tap', function() {
|
||||
JZL.saveItems('.localinp', 'auth_personal');
|
||||
mui.toast('保存成功');
|
||||
})
|
||||
// //console.log($('#headImg').val());
|
||||
|
||||
if ('' == $('#headImg').val()) {
|
||||
$("#headImgTag").attr("src", "../img/touxiang.jpg")
|
||||
}
|
||||
if ('' == $('#accountBookImg').val()) {
|
||||
$("#accountBookImgTag").attr("src", "../img/hukou.jpg")
|
||||
}
|
||||
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthInfo'), {}, function(data) {
|
||||
//console.log(data);
|
||||
// //console.log(typeof(data.data));
|
||||
if ('undefined' != typeof(data.data) && 1 == data.status) { //编辑
|
||||
count = 1;
|
||||
authId = data.data.id
|
||||
$('.mobileCode').hide()
|
||||
$('.userPhone').hide()
|
||||
$('.payPwd').show()
|
||||
mui.each(data.data, function(index, element) {
|
||||
if ($('#' + index).attr("type") == "hidden") {
|
||||
// var imgindex = index.substring(0, index.length - 3);
|
||||
var imgindex = index + 'Tag'
|
||||
var obj = '#' + imgindex
|
||||
// //console.log('#' + imgindex + '')
|
||||
if (imgindex != "") {
|
||||
if ($(obj).is('img')) {
|
||||
$(obj).attr("src", hyhImgUrl(element))
|
||||
$('#' + index + '').val(element)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$('#' + index).val(element)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
// if (data.status == 1) {
|
||||
// $('.qrbb').show();
|
||||
// $('.qrrz').show();
|
||||
// } else {
|
||||
// $('.qrbb').hide();
|
||||
// $('.qrrz').hide();
|
||||
// }
|
||||
} else {
|
||||
//console.log(2222);
|
||||
$('.userPhone').show()
|
||||
$('.mobileCode').show()
|
||||
$('.payPwd').hide()
|
||||
JZL.getItems('auth_company');
|
||||
}
|
||||
})
|
||||
|
||||
function time() {
|
||||
if (wait == 0) {
|
||||
$('.HQYZM').removeAttr("disabled");
|
||||
$('.HQYZM').html("重新发送");
|
||||
wait = 120;
|
||||
} else {
|
||||
$('.HQYZM').attr("disabled", true);
|
||||
$('.HQYZM').html("重新发送(" + wait + ")");
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
time()
|
||||
},
|
||||
1000)
|
||||
}
|
||||
}
|
||||
$(".HQYZM").on("tap", function() {
|
||||
var userPhone = $('#userPhone').val();
|
||||
if ('' == userPhone) {
|
||||
mui.alert("请输入手机号")
|
||||
return;
|
||||
}
|
||||
if (!(
|
||||
/^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/
|
||||
.test(userPhone))) {
|
||||
mui.alert("手机号码有误,请重填!");
|
||||
return;
|
||||
}
|
||||
$(".HQYZM").attr("disabled", true);
|
||||
|
||||
JZL.ajax(qlgUrl('app/auth/getPhoneCode'), {
|
||||
userPhone: userPhone
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
time();
|
||||
$('.YZM').focus();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
$('.bc_btn').on('tap', function() {
|
||||
var params = JZL.getParams(".inp");
|
||||
if ('' == params.houseAddress) {
|
||||
mui.alert("请输入地址");
|
||||
return;
|
||||
}
|
||||
if ('' == params.householdIdCard) {
|
||||
mui.alert("请输入身份证号");
|
||||
return;
|
||||
|
||||
}
|
||||
if ('' == params.householdName) {
|
||||
mui.alert("请输入户主姓名");
|
||||
return;
|
||||
|
||||
}
|
||||
if (0 == count) {
|
||||
if ('' == params.mobileCode) {
|
||||
mui.alert("请输入验证码");
|
||||
return;
|
||||
|
||||
}
|
||||
} else if (1 == count) {
|
||||
if ('' == params.payPwd) {
|
||||
mui.alert("请输入操作密码");
|
||||
return;
|
||||
}
|
||||
params.authId = authId;
|
||||
}
|
||||
|
||||
//console.log(params);
|
||||
JZL.ajax(qlgUrl('app/auth/setAuthInfo'), params, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
|
||||
JZL.saveItems('.localinp', 'auth_personal');
|
||||
localStorage.setItem("authType","1")
|
||||
mui.toast("提交成功 请等待审核")
|
||||
// $(".mui-table-view").attr("readonly", "readonly")
|
||||
$(".mobileCode").attr("display", "none")
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
mui('.mui-table-content').on('tap', '.qrbb', function() {
|
||||
JZL.openWindow('qrbb.html', 'qrbb.html');
|
||||
|
||||
})
|
||||
mui('.mui-table-content').on('tap', '.qrrz', function() {
|
||||
JZL.openWindow('qrrz.html', 'qrrz.html');
|
||||
|
||||
})
|
||||
|
||||
|
||||
$(".ossfile").on("tap", '#accountBookImgTag', function() {
|
||||
UP.init("accountBookImg", "test", "accountBookImgTag")
|
||||
|
||||
// UP.init("id", "test", "imgId")
|
||||
|
||||
openCamera();
|
||||
})
|
||||
//更换头像
|
||||
$("#headerimg").on("tap", '#headImgTag', function() {
|
||||
UP.init("headImg", "test", "headImgTag")
|
||||
openCamera();
|
||||
})
|
||||
|
||||
|
||||
})
|
27
static/app2/js/invest.js
Executable file
27
static/app2/js/invest.js
Executable file
@ -0,0 +1,27 @@
|
||||
mui.plusReady(function () {
|
||||
var userId="";
|
||||
var shopName="";
|
||||
// 获取数据
|
||||
JZL.ajax(qlgUrl('app/users/familyInvestmentList'),{},function (data ) {
|
||||
console.log(data);
|
||||
var html ="";
|
||||
if (1 == data.status){
|
||||
var data = data.data
|
||||
$.each(data,function () {
|
||||
html+='<div class="con_ shadown_wai" data-id ='+this.userId+' data-shopName="'+this.companyName+'" ><div class="top"><div class="left"> <img src="'+hyhImgUrl(this.headImg)+'" alt=""></div><div class="mid"><div class="title">'+this.companyName+' </div><div class="partner"> 合作人'+this.count +'人</div><div class="timer">'+formatDate(new Date(this.createTime*1000))+'创建 </div></div><div class="right"><div class="scale"><div class="scaleNum">'+this.stake+'%</div><p>持股</p></div></div></div><div class="bottom"><div class="img"> <img src="../img/ditudingwei.png" ></div><div class="pos">'+this.companyAddress+' </div></div></div>'
|
||||
})
|
||||
|
||||
$('.con').append(html)
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
$("body").on("tap",".con_",function () {
|
||||
userId=$(this).attr("data-id")
|
||||
shopName=$(this).attr("data-shopName")
|
||||
|
||||
JZL.openWindow('investdetail.html', 'investdetail.html',{userId : userId,shopName:shopName})
|
||||
})
|
||||
})
|
24
static/app2/js/investdetail.js
Executable file
24
static/app2/js/investdetail.js
Executable file
@ -0,0 +1,24 @@
|
||||
mui.plusReady(function () {
|
||||
var self =plus.webview.currentWebview()
|
||||
var userId = self.userId;
|
||||
var shopName = self.shopName;
|
||||
var html = "";
|
||||
|
||||
// console.log(self.userId);
|
||||
//获取数据
|
||||
JZL.ajax(qlgUrl("app/users/investmentInfo"),{userId:userId},function (data) {
|
||||
console.log(data);
|
||||
if (1 == data.status) {
|
||||
var data =data.data;
|
||||
html ='<div class="shopName">'+shopName+'</div>'
|
||||
$.each(data,function () {
|
||||
html += '<div class="con_ shadown_wai"><div class="top"><div class="left"> <img src="'+hyhImgUrl(this.businessImg)+'" alt=""></div><div class="mid"><div class="title partnerName">'+ this.uName+'</div><div class=" partner zhiwei">'+this.positionName+'</div><div class="timer">'+formatDate(new Date(this.createTime*1000))+'加入</div></div><div class="right"><div class="scale"><div class="scaleNum">'+this.stake+'%</div><p>持股</p></div></div></div></div>'
|
||||
})
|
||||
$('.con').html(html)
|
||||
}
|
||||
})
|
||||
|
||||
$('.down').on ("tap",".btn",function () {
|
||||
JZL.openWindow("distribution.html","distribution.html",{userId :userId})
|
||||
})
|
||||
})
|
155
static/app2/js/journalism.js
Executable file
155
static/app2/js/journalism.js
Executable file
@ -0,0 +1,155 @@
|
||||
document.write('<link rel="stylesheet" type="text/css" href="../css/swiper.min.css"/>');
|
||||
document.write('<script type="text/javascript" src="../js/swiper.min.js"></scr' + 'ipt>');
|
||||
var num = 1;
|
||||
var isOver = 1;
|
||||
var catId = '';
|
||||
|
||||
function getMsg(catIdNum, pageNum, pagesizeNum) {
|
||||
|
||||
var data_msg = {
|
||||
catId: catIdNum ? catIdNum : '',
|
||||
page: pageNum ? pageNum : 1,
|
||||
pagesize: pagesizeNum ? pagesizeNum : 10
|
||||
}
|
||||
|
||||
if(isOver == 0) {
|
||||
return;
|
||||
} else {
|
||||
isOver = 0;
|
||||
}
|
||||
mui.ajax(kxUrl('app/Articles/headLine'), {
|
||||
data: data_msg,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
data = data.data;
|
||||
if(data.Rows == '') {
|
||||
if(pageNum == 1) {
|
||||
$('.con_').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px; margin-top:10px">没有更多内容</p>');
|
||||
} else if(pageNum > 1) {
|
||||
$('.con_').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px; margin-top:10px">没有更多内容</p>');
|
||||
}
|
||||
|
||||
isOver = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
var coverImg = '';
|
||||
if(data.coverImg) {
|
||||
coverImg = ectImgUrl(data.coverImg)
|
||||
} else {
|
||||
coverImg = '../img/mujiimg.png'
|
||||
}
|
||||
html += '<div class="con_block shadown_wai" data-articleId = "' + this.articleId + '" data-><img src="' + coverImg + '" alt="" class="cbimg"/><p class="cbtitle">' + this.articleTitle + '</p><p class="name">' + this.articleKey + ' <img src="../img/icon_eye.png" alt="" />' + this.visitorNum + '</p></div>'
|
||||
});
|
||||
|
||||
if(pageNum == 1) {
|
||||
$('.con_').html(html);
|
||||
} else if(pageNum > 1) {
|
||||
$('.con_').append(html);
|
||||
}
|
||||
isOver = 1;
|
||||
} else {
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('refresh', function(e) {
|
||||
location.reload();
|
||||
})
|
||||
mui.ajax(kxUrl('app/Articles/orange'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data,1);
|
||||
if(data.status == 1) {
|
||||
var html = '<div class="swiper-container" id="timer_swiper"><div class="swiper-wrapper">';
|
||||
var len = 0;
|
||||
var data = data.data;
|
||||
$.each(data, function(num) {
|
||||
html += '<div class="swiper-slide nav_block" data-catId="' + this.catId + '"><p class="p1">' + this.catName + '</p></div>';
|
||||
len = num + 1;
|
||||
})
|
||||
|
||||
html += '</div></div>'
|
||||
$('.nav').html(html);
|
||||
|
||||
if(len == 0) {
|
||||
// mui.back();
|
||||
} else if(len == 1) {
|
||||
|
||||
} else {
|
||||
$('.t_con').css('display', 'block');
|
||||
}
|
||||
if(len > 5) {
|
||||
len = 4.5
|
||||
} else {
|
||||
len = len;
|
||||
}
|
||||
var swiper = new Swiper('#timer_swiper', {
|
||||
slidesPerView: len,
|
||||
paginationClickable: true,
|
||||
spaceBetween: 0,
|
||||
freeMode: true
|
||||
});
|
||||
$('.nav_block').eq(0).addClass('on');
|
||||
catId = $('.nav_block').eq(0).attr('data-catId');
|
||||
getMsg(catId, 1, 10);
|
||||
} else {
|
||||
console.log(data.status);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
console.log(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isOver == 1) {
|
||||
num++;
|
||||
getMsg(catId, num, 10);
|
||||
}
|
||||
}
|
||||
})
|
||||
$('.con').on('tap', '.con_block', function() {
|
||||
var id = $(this).attr('data-articleId');
|
||||
mui.openWindow({
|
||||
url: 'journalism_con.html',
|
||||
id: 'journalism_con.html' + id,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_articleId: id
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {
|
||||
autoShow: false, //自动显示等待框,默认为true
|
||||
}
|
||||
})
|
||||
})
|
||||
$('.nav').on('tap', '.nav_block', function() {
|
||||
catId = $(this).attr('data-catId');
|
||||
isOver = 1;
|
||||
num = 1;
|
||||
getMsg(catId, 1, 10);
|
||||
$(this).addClass('on').siblings().removeClass('on')
|
||||
})
|
||||
|
||||
})
|
38
static/app2/js/journalism_con.js
Executable file
38
static/app2/js/journalism_con.js
Executable file
@ -0,0 +1,38 @@
|
||||
$('.con_').html('');
|
||||
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
var msgId = self.data_articleId;
|
||||
mui.ajax(kxUrl('app/Articles/detail'), {
|
||||
|
||||
data: {
|
||||
articleId: msgId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data,1);
|
||||
|
||||
if(data.status == 1) {
|
||||
var data = data.data;
|
||||
|
||||
var coverImg = '';
|
||||
|
||||
if(data.coverImg){
|
||||
coverImg = ectImgUrl(data.coverImg)
|
||||
}else{
|
||||
coverImg = '../img/mujiimg.png'
|
||||
}
|
||||
var html = '<div class="con_top"><img class="headImg" src="'+ coverImg +'" /><div class="con_top_title">'+ data.articleKey +'</div><div class="num">'+ data.visitorNum +'阅读</div><button class="guanzhu"style="display: none;">关注</button></div><div class="con_con">'+ data.articleContent +'</div><div class="time">'+ data.createTime +'</div>';
|
||||
$('.con_').html(html);
|
||||
} else {
|
||||
console.log(data.status);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
4
static/app2/js/jquery-3.2.1.min.js
vendored
Executable file
4
static/app2/js/jquery-3.2.1.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
13
static/app2/js/jquery-ui.min.js
vendored
Executable file
13
static/app2/js/jquery-ui.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
117
static/app2/js/jquery.cookie.js
Executable file
117
static/app2/js/jquery.cookie.js
Executable file
@ -0,0 +1,117 @@
|
||||
/*!
|
||||
* jQuery Cookie Plugin v1.4.1
|
||||
* https://github.com/carhartl/jquery-cookie
|
||||
*
|
||||
* Copyright 2013 Klaus Hartl
|
||||
* Released under the MIT license
|
||||
*/
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
// CommonJS
|
||||
factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
|
||||
var pluses = /\+/g;
|
||||
|
||||
function encode(s) {
|
||||
return config.raw ? s : encodeURIComponent(s);
|
||||
}
|
||||
|
||||
function decode(s) {
|
||||
return config.raw ? s : decodeURIComponent(s);
|
||||
}
|
||||
|
||||
function stringifyCookieValue(value) {
|
||||
return encode(config.json ? JSON.stringify(value) : String(value));
|
||||
}
|
||||
|
||||
function parseCookieValue(s) {
|
||||
if (s.indexOf('"') === 0) {
|
||||
// This is a quoted cookie as according to RFC2068, unescape...
|
||||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
||||
}
|
||||
|
||||
try {
|
||||
// Replace server-side written pluses with spaces.
|
||||
// If we can't decode the cookie, ignore it, it's unusable.
|
||||
// If we can't parse the cookie, ignore it, it's unusable.
|
||||
s = decodeURIComponent(s.replace(pluses, ' '));
|
||||
return config.json ? JSON.parse(s) : s;
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
function read(s, converter) {
|
||||
var value = config.raw ? s : parseCookieValue(s);
|
||||
return $.isFunction(converter) ? converter(value) : value;
|
||||
}
|
||||
|
||||
var config = $.cookie = function (key, value, options) {
|
||||
|
||||
// Write
|
||||
|
||||
if (value !== undefined && !$.isFunction(value)) {
|
||||
options = $.extend({}, config.defaults, options);
|
||||
|
||||
if (typeof options.expires === 'number') {
|
||||
var days = options.expires, t = options.expires = new Date();
|
||||
t.setTime(+t + days * 864e+5);
|
||||
}
|
||||
|
||||
return (document.cookie = [
|
||||
encode(key), '=', stringifyCookieValue(value),
|
||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
||||
options.path ? '; path=' + options.path : '',
|
||||
options.domain ? '; domain=' + options.domain : '',
|
||||
options.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
var result = key ? undefined : {};
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling $.cookie().
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
|
||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var name = decode(parts.shift());
|
||||
var cookie = parts.join('=');
|
||||
|
||||
if (key && key === name) {
|
||||
// If second argument (value) is a function it's a converter...
|
||||
result = read(cookie, value);
|
||||
break;
|
||||
}
|
||||
|
||||
// Prevent storing a cookie that we couldn't decode.
|
||||
if (!key && (cookie = read(cookie)) !== undefined) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
config.defaults = {};
|
||||
|
||||
$.removeCookie = function (key, options) {
|
||||
if ($.cookie(key) === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Must not alter options, thus extending a fresh object...
|
||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
||||
return !$.cookie(key);
|
||||
};
|
||||
|
||||
}));
|
5
static/app2/js/jquery.qtip.min.js
vendored
Executable file
5
static/app2/js/jquery.qtip.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
4
static/app2/js/jquery.validate.min.js
vendored
Executable file
4
static/app2/js/jquery.validate.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
69
static/app2/js/juan_goods.js
Executable file
69
static/app2/js/juan_goods.js
Executable file
@ -0,0 +1,69 @@
|
||||
$('.t_con').css('display', 'none');
|
||||
var html_li = '<p class="title"></p>';
|
||||
$('.header_con').append(html_li);
|
||||
$('.header_con .title').css('display', 'none');
|
||||
|
||||
var couponId = '';
|
||||
var secTypeId = '';
|
||||
var pageSize = 10;
|
||||
var page = 1;
|
||||
var isjiazai = 1;
|
||||
|
||||
function lxy_(couponId, page, pageSize) {
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
var lxy_data_ = {
|
||||
couponId: couponId ? couponId : '',
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 10
|
||||
}
|
||||
|
||||
mui.ajax(kxUrl('addon/hyhcouponset-Hyhcouponset-cateGoods'), {
|
||||
data: lxy_data_,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data.data.goodsFavoritesNum)
|
||||
//console.log(data.data.Rows)
|
||||
//var data = toJson(data);
|
||||
var data = data.data
|
||||
var html = '';
|
||||
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId + '"><img class="rcb_img" src="' + ectImgUrl(this.goodsImg) + '" alt="" /><div class="rcb_con"><div class="rcb_title"><span style="display: none;">自营</span>' + this.goodsName + '</div><div class="rcb_pay">¥' + this.shopPrice + ' <span style="display:none;">满减</span></div><div class="rcb_bottom"><span>可用木吉抵扣20%货款</span></div></div><img class="icon_icon" src="../img/icon_sscl.png"alt=""style="display:none;"/></div>'
|
||||
});
|
||||
|
||||
if(page == 1) {
|
||||
$('#recommend_con').html(html);
|
||||
} else {
|
||||
$('#recommend_con').append(html);
|
||||
}
|
||||
isjiazai = 1;
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
couponId = self.couponId;
|
||||
console.log(couponId);
|
||||
// console.log(topTypeId)
|
||||
lxy_(couponId, page, pageSize);
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
lxy_(couponId, page, pageSize);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
})
|
125
static/app2/js/juan_index.js
Executable file
125
static/app2/js/juan_index.js
Executable file
@ -0,0 +1,125 @@
|
||||
var pageSize = 10;
|
||||
var page = 1;
|
||||
var isjiazai = 1;
|
||||
var userCoupon = 'userCoupon';
|
||||
|
||||
function lxy_quan(page, pageSize, userCoupon) {
|
||||
if(isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
|
||||
var lxy_quan_data = {
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 10
|
||||
}
|
||||
|
||||
mui.ajax(kxUrl('addon/hyhcouponset-Hyhcouponset-' + userCoupon), {
|
||||
data: lxy_quan_data,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data.data.goodsFavoritesNum)
|
||||
//console.log(data.data.Rows)
|
||||
// var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
var data = data.data;
|
||||
var html = '';
|
||||
if(data.Rows == '') {
|
||||
if(page == 1) {
|
||||
$('#con_juan').html('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多内容</p>');
|
||||
} else {
|
||||
$('#con_juan').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多内容</p>');
|
||||
}
|
||||
isjiazai = 0;
|
||||
return;
|
||||
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="coupon" data-couponId="' + this.couponId + '"><p class="cou_p1">¥ <span>' + this.price + '</span> 满' + this.man + '减' + this.price + '</p><p class="cou_p2">' + this.couponDesc + '</p><p class="cou_p3">' + this.begin_time + '——' + this.end_time + '</p><button class="cou_btn" data-couponId="' + this.couponId + '" style="display: none;">去使用</button><img src="../img/juan_yes.png"/ class="j_yes" style="display: none;"></div>';
|
||||
});
|
||||
if(page == 1) {
|
||||
$('#con_juan').html(html);
|
||||
} else {
|
||||
$('#con_juan').append(html);
|
||||
}
|
||||
|
||||
if(userCoupon == 'userCoupon') {
|
||||
$('.cou_btn').show();
|
||||
} else {
|
||||
$('.j_yes').show();
|
||||
}
|
||||
isjiazai = 1;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
//alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
mui.plusReady(function() {
|
||||
lxy_quan(1, pageSize, userCoupon);
|
||||
mui('.nav').on('tap', '.nav_block', function() {
|
||||
if($(this).attr('data-id') == 1) {
|
||||
userCoupon = 'userCoupon'
|
||||
} else {
|
||||
userCoupon = 'userYetCoupon'
|
||||
}
|
||||
isjiazai = 1;
|
||||
page = 1;
|
||||
lxy_quan(page, pageSize, userCoupon);
|
||||
})
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isjiazai == 1) {
|
||||
page++;
|
||||
lxy_quan(page, pageSize, userCoupon);
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
//跳转到优惠劵使用页
|
||||
$('.con_').on('tap', '.cou_btn', function() {
|
||||
var couponId = $(this).attr('data-couponId');
|
||||
mui.openWindow({
|
||||
url: 'juan_goods.html',
|
||||
id: 'juan_godds.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
couponId: couponId
|
||||
//..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
121
static/app2/js/login.js
Executable file
121
static/app2/js/login.js
Executable file
@ -0,0 +1,121 @@
|
||||
document.write('<script type="text/javascript" src="https://ssl.captcha.qq.com/TCaptcha.js?ver=' + localStorage.getItem('version') + '"></scr' + 'ipt>');
|
||||
|
||||
$('.top').attr('style', "margin-top:"+(localStorage.getItem("ipxSizeTop")*4)+"px;")
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'refresh');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mui.plusReady(function() {
|
||||
$('.loginbg').height(window.screen.height);
|
||||
$('.btn').attr('id','Tcaptcha');
|
||||
$('.btn').attr('data-appid','2089606583');
|
||||
$('.btn').attr('data-cbfn','callback');
|
||||
window.callback = function(res){
|
||||
// //console.log(JSON.stringify(res));
|
||||
$('.btn').removeAttr('disabled');
|
||||
// res(未通过验证)= {ret: 1, ticket: null}
|
||||
// res(验证成功) = {ret: 0, ticket: "String", randstr: "String"}
|
||||
|
||||
if(res.ret === 0){
|
||||
var send_data = {};
|
||||
send_data.loginName = $('#loginName').val();
|
||||
send_data.loginPwd = $('#loginPwd').val();
|
||||
send_data.ticket = res.ticket; // 票据
|
||||
send_data.randstr = res.randstr;
|
||||
var url = qlgUrl('app/users/checkLogin');
|
||||
// var url = hyhUrl('app/users/checkLogin');
|
||||
|
||||
JZL.ajax(url, send_data, function(data){
|
||||
if(data.status == 1) {
|
||||
var token = data.data.token;
|
||||
localStorage.setItem('token', token);
|
||||
////console.log(data.data.token);
|
||||
mui.back();
|
||||
return;
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
}, 'POST',0);
|
||||
}
|
||||
}
|
||||
mui('.down').on('tap', '.btn', function() {
|
||||
|
||||
var loginName = $('#loginName').val();
|
||||
|
||||
var loginPwd = $('#loginPwd').val();
|
||||
|
||||
if(loginName == '') {
|
||||
|
||||
mui.alert('用户名不能为空!');
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if(loginPwd == '') {
|
||||
|
||||
mui.alert('密码不能为空!');
|
||||
|
||||
return;
|
||||
}
|
||||
$('.btn').attr('disabled', 'disabled');
|
||||
var captcha1 = new TencentCaptcha(document.getElementById('Tcaptcha'));
|
||||
captcha1.show();
|
||||
setTimeout(function(){
|
||||
$('.feedback-group',document.getElementById('tcaptcha_iframe').contentWindow.document).hide();
|
||||
// $('.feedback-group',document.frames("")).hide();
|
||||
},2000)
|
||||
//$(this).trigger('click');
|
||||
return;
|
||||
// var loginName = 'zxcvbn';
|
||||
// s var loginPwd = 'zxcvbn';
|
||||
|
||||
mui.ajax(qlgUrl('app/users/checkLogin'), {
|
||||
// mui.ajax(hyhUrl('app/users/checkLogin'), {
|
||||
|
||||
data: {
|
||||
loginName: loginName,
|
||||
loginPwd: loginPwd,
|
||||
nameType: 3,
|
||||
ticker:ticker
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data);
|
||||
if(data.status == 1) {
|
||||
var token = data.data.token;
|
||||
localStorage.setItem('token', token);
|
||||
////console.log(data.data.token);
|
||||
mui.back();
|
||||
return;
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
|
||||
$('.btn').removeAttr('disabled');
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
mui('.down').on('tap', '#register', function() {
|
||||
// JZL.openWindow('register.html', 'register.html');
|
||||
JZL.openWindow('register.html', 'register.html');
|
||||
|
||||
})
|
||||
mui('.down').on('tap', '#fogetpsd', function() {
|
||||
JZL.openWindow('setting_fogetPwd.html', 'setting_fogetPwd.html');
|
||||
})
|
||||
|
||||
})
|
15
static/app2/js/logistics.js
Executable file
15
static/app2/js/logistics.js
Executable file
@ -0,0 +1,15 @@
|
||||
mui.plusReady(function() {
|
||||
|
||||
var self = plus.webview.currentWebview();
|
||||
var data_order_id = self.data_order_id;
|
||||
localStorage.setItem('data_order_id', data_order_id);
|
||||
var bSize = 64 + (+localStorage.getItem('ipxSizeTop')) + 'px';
|
||||
var sub = plus.webview.create('logisticscon.html', 'logisticscon.html', {
|
||||
top: bSize,
|
||||
bottom: '0',
|
||||
scrollIndicator: 'none'
|
||||
});
|
||||
self.append(sub);
|
||||
|
||||
|
||||
})
|
50
static/app2/js/logisticscon.js
Executable file
50
static/app2/js/logisticscon.js
Executable file
@ -0,0 +1,50 @@
|
||||
$('.summarize').html('');
|
||||
mui.plusReady(function() {
|
||||
var data_order_id = localStorage.getItem('data_order_id');
|
||||
var token = localStorage.getItem('token');
|
||||
var nwaiting = plus.nativeUI.showWaiting();
|
||||
mui.ajax(hyhUrl('app/Orders/findExpress'), {
|
||||
|
||||
data: {
|
||||
orderId: data_order_id
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
nwaiting.close();
|
||||
var data = toJson(data);
|
||||
if(!data.express){
|
||||
data=data.data;
|
||||
}
|
||||
var html = '<div class="summarize clearfix"><img src="' + ectImgUrl(data.express.expressImg) + '" /><div class="summarizeinfo"><p class="pp1">物流状态: <o>' + data.express.stateTxt + '</o></p><p class="pp2">承运来源:' + data.express.expressName + '</p><p class="pp2">运单编号:' + data.express.expressNo + '</p></p></div></div><div class="track-list"><ul>';
|
||||
if(data.status == 200 || data.status == 1) {
|
||||
var data_ = data.data;
|
||||
if(data.data.length > 1) {
|
||||
var d_1 = data.data[0].time;
|
||||
var d_2 = data.data[data.data.length - 1].time;
|
||||
var e_1 = new Date(d_1).getTime();
|
||||
var e_2 = new Date(d_2).getTime();
|
||||
if(e_1 < e_2) {
|
||||
data_.reverse();
|
||||
}
|
||||
}
|
||||
|
||||
$.each(data_, function() {
|
||||
html += '<li><i class="node-icon"></i><p class="txt">' + this.context + '</p><p class="time">' + this.time + '</p></li>'
|
||||
});
|
||||
|
||||
} else {
|
||||
// mui.alert(data.status);
|
||||
}
|
||||
html += '</ul></div>'
|
||||
$('.con').html(html);
|
||||
document.getElementsByTagName('li')[0].className = 'first';
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
nwaiting.close();
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
2
static/app2/js/lrz.bundle.js
Executable file
2
static/app2/js/lrz.bundle.js
Executable file
File diff suppressed because one or more lines are too long
86
static/app2/js/main_guide.js
Executable file
86
static/app2/js/main_guide.js
Executable file
@ -0,0 +1,86 @@
|
||||
mui.init({
|
||||
swipeBack: true //启用右滑关闭功能
|
||||
});
|
||||
/**/
|
||||
mui.back = function() {};
|
||||
mui.plusReady(function() {
|
||||
var showGuide = plus.storage.getItem("lauchFlag");
|
||||
if(showGuide) {
|
||||
//有值,说明已经显示过了,无需显示//关闭splash页面;
|
||||
plus.navigator.closeSplashscreen();
|
||||
closeGuide();
|
||||
}else{
|
||||
launchScreen();
|
||||
}
|
||||
function launchScreen() {
|
||||
mui.ajax('http://www.juzi199.com/get_startup.php', {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
aysnc:false,
|
||||
success: function(data) {//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
if(1 == data.show){
|
||||
var html = '';
|
||||
var indicatorHtml = '';
|
||||
$.each(data.img, function() {
|
||||
html += '<div class="mui-slider-item"><img class="guide-img" src="' + this.src + '"/></div>';
|
||||
indicatorHtml+='<div class="mui-indicator"></div>';
|
||||
});
|
||||
$(".mui-slider-group").html(html);
|
||||
$(".mui-slider-indicator").html(indicatorHtml);
|
||||
$('.mui-slider-item').first().addClass('mui-slider-item-duplicate');
|
||||
$('.mui-slider-item').last().append('<button id="close" class="mui-btn mui-btn-warning mui-btn-outlined">跳过</button>');
|
||||
$('.mui-indicator').first().addClass('mui-active');
|
||||
setTimeout(function(){
|
||||
plus.navigator.closeSplashscreen();
|
||||
},1000)
|
||||
}else{
|
||||
plus.navigator.closeSplashscreen();
|
||||
closeGuide();
|
||||
}
|
||||
//if(data.img.count() == 1){
|
||||
|
||||
//}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
//alert(errorThrown);
|
||||
}
|
||||
});
|
||||
setTimeout(function(){
|
||||
closeGuide();
|
||||
},6000)
|
||||
}
|
||||
mui('body').on('tap', '#close', function(){
|
||||
closeGuide();
|
||||
})
|
||||
// document.addEventListener('tap', function() {
|
||||
// // //console.log("addEventListener: newintent");
|
||||
// //console.log(1)
|
||||
// }, false);
|
||||
|
||||
function closeGuide(){
|
||||
//显示启动导航
|
||||
mui.openWindow({
|
||||
id: 'index',
|
||||
url: 'index.html',
|
||||
show: {
|
||||
},
|
||||
waiting: {
|
||||
autoShow: false
|
||||
}
|
||||
});
|
||||
setTimeout(function(){
|
||||
//plus.storage.setItem("lauchFlag", "true"); //第一次登陆显示
|
||||
//plus.storage.removeItem("lauchFlag");
|
||||
//plus.navigator.setFullscreen(false);
|
||||
plus.webview.currentWebview().close();
|
||||
},1000)
|
||||
}
|
||||
});
|
||||
|
||||
//立即体验按钮点击事件
|
||||
//document.getElementById("close").addEventListener('tap', function(event) {
|
||||
//
|
||||
//}, false);
|
347
static/app2/js/mapcommon.js
Executable file
347
static/app2/js/mapcommon.js
Executable file
@ -0,0 +1,347 @@
|
||||
// var num = 1 / window.devicePixelRatio;
|
||||
// // document.querySelector('meta').setAttribute('name', 'viewport')
|
||||
// //document.querySelector('meta').setAttribute('content', 'width=device-width, initial-scale=' + num + ', maximum-scale=' + num + ', minimum-scale=' + num + ', user-scalable=no');
|
||||
// // document.querySelector('meta').setAttribute('content', 'width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no');
|
||||
//
|
||||
// // browserRedirect();
|
||||
// function browserRedirect() {
|
||||
// var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
||||
// var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
|
||||
// var width = w > h ? h : w;
|
||||
// var sUserAgent = navigator.userAgent.toLowerCase();
|
||||
// var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
|
||||
// var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
|
||||
// var bIsMidp = sUserAgent.match(/midp/i) == "midp";
|
||||
// var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
|
||||
// var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
|
||||
// var bIsAndroid = sUserAgent.match(/android/i) == "android";
|
||||
// var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
|
||||
// var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
|
||||
// var bIsWX = sUserAgent.match(/MicroMessenger/i) == "micromessenger";
|
||||
// // document.writeln("您的浏览设备为:");
|
||||
// if(bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM || bIsWX) {
|
||||
// width = width;
|
||||
// // document.writeln("phone");
|
||||
// } else {
|
||||
// width = 640;
|
||||
// // document.writeln("pc");
|
||||
// }
|
||||
// var fz = ~~(width * 64000 / 100) / 6400;
|
||||
// document.getElementsByTagName("html")[0].style.cssText = 'font-size: ' + fz + "px";
|
||||
// var realfz = ~~(+window.getComputedStyle(document.getElementsByTagName("html")[0]).fontSize.replace('px', '') * 6400) / 6400
|
||||
// if(fz !== realfz) {
|
||||
// document.getElementsByTagName("html")[0].style.cssText = 'font-size:' + fz * (fz / realfz) + "px";
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// window.onresize = function(){
|
||||
// browserRedirect();
|
||||
// }
|
||||
|
||||
|
||||
var EARTH_RADIUS = 6378137.0; //单位M
|
||||
|
||||
var PI = Math.PI;
|
||||
|
||||
function getRad(d) {
|
||||
|
||||
return d * PI / 180.0;
|
||||
|
||||
}
|
||||
|
||||
// var dis = getFlatternDistance(118.515179,37.478422,118.51471,37.475623);
|
||||
|
||||
/**
|
||||
|
||||
* approx distance between two points on earth ellipsoid
|
||||
|
||||
* @param {Object} lat1
|
||||
|
||||
* @param {Object} lng1
|
||||
|
||||
* @param {Object} lat2
|
||||
|
||||
* @param {Object} lng2
|
||||
|
||||
*/
|
||||
|
||||
function getFlatternDistance(lat1, lng1, lat2, lng2) {
|
||||
|
||||
var f = getRad((lat1 + lat2) / 2);
|
||||
|
||||
var g = getRad((lat1 - lat2) / 2);
|
||||
|
||||
var l = getRad((lng1 - lng2) / 2);
|
||||
|
||||
var sg = Math.sin(g);
|
||||
|
||||
var sl = Math.sin(l);
|
||||
|
||||
var sf = Math.sin(f);
|
||||
|
||||
var s, c, w, r, d, h1, h2;
|
||||
|
||||
var a = EARTH_RADIUS;
|
||||
|
||||
var fl = 1 / 298.257;
|
||||
|
||||
sg = sg * sg;
|
||||
|
||||
sl = sl * sl;
|
||||
|
||||
sf = sf * sf;
|
||||
|
||||
s = sg * (1 - sl) + (1 - sf) * sl;
|
||||
|
||||
c = (1 - sg) * (1 - sl) + sf * sl;
|
||||
|
||||
w = Math.atan(Math.sqrt(s / c));
|
||||
|
||||
r = Math.sqrt(s * c) / w;
|
||||
|
||||
d = 2 * w * a;
|
||||
|
||||
h1 = (3 * r - 1) / 2 / c;
|
||||
|
||||
h2 = (3 * r + 1) / 2 / s;
|
||||
|
||||
return d * (1 + fl * (h1 * sf * (1 - sg) - h2 * (1 - sf) * sg));
|
||||
|
||||
}
|
||||
/**
|
||||
* 获取省份
|
||||
*/
|
||||
function get_province() {
|
||||
var url = '/index.php?m=Admin&c=Api&a=getRegion&level=1&parent_id=0';
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
error: function(request) {
|
||||
alert("服务器繁忙, 请联系管理员!");
|
||||
return;
|
||||
},
|
||||
success: function(v) {
|
||||
v = '<option value="0">选择省份</option>' + v;
|
||||
$('#province').empty().html(v);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取城市
|
||||
* @param t 省份select对象
|
||||
*/
|
||||
function get_city(t) {
|
||||
var parent_id = $(t).val();
|
||||
if (!parent_id > 0) {
|
||||
return;
|
||||
}
|
||||
$('#twon').empty().css('display', 'none');
|
||||
var url = '/index.php?m=Home&c=Api&a=getRegion&level=2&parent_id=' + parent_id;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
error: function(request) {
|
||||
alert("服务器繁忙, 请联系管理员!");
|
||||
return;
|
||||
},
|
||||
success: function(v) {
|
||||
v = '<option value="0">选择城市</option>' + v;
|
||||
$('#city').empty().html(v);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地区
|
||||
* @param t 城市select对象
|
||||
*/
|
||||
function get_area(t) {
|
||||
var parent_id = $(t).val();
|
||||
if (!parent_id > 0) {
|
||||
return;
|
||||
}
|
||||
var url = '/index.php?m=Home&c=Api&a=getRegion&level=3&parent_id=' + parent_id;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
error: function(request) {
|
||||
alert("服务器繁忙, 请联系管理员!");
|
||||
return;
|
||||
},
|
||||
success: function(v) {
|
||||
v = '<option value="0">选择区域</option>' + v;
|
||||
$('#district').empty().html(v);
|
||||
}
|
||||
});
|
||||
}
|
||||
// 获取最后一级乡镇
|
||||
function get_twon(obj) {
|
||||
var parent_id = $(obj).val();
|
||||
var url = '/index.php?m=Home&c=Api&a=getTwon&parent_id=' + parent_id;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
success: function(res) {
|
||||
if (parseInt(res) == 0) {
|
||||
$('#twon').empty().css('display', 'none');
|
||||
} else {
|
||||
$('#twon').css('display', 'block');
|
||||
$('#twon').empty().html(res);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 点击收藏商品
|
||||
function collect_goods(goods_id) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
url: "/index.php?m=Home&c=goods&a=collect_goods&goods_id=" + goods_id, //+tab,
|
||||
success: function(data) {
|
||||
alert(data.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//加载地图
|
||||
function getMap(lng, lat) {
|
||||
// var pcenter = new plus.maps.Point(lng,lat); // 地图中心点
|
||||
// var map = new plus.maps.Map('allmap');
|
||||
// map.centerAndZoom(pcenter, 15); // 设置地图的中心点和缩放级别
|
||||
// map.showUserLocation( true ); // 设置是否显示用户的位置
|
||||
// 还有很多属性可以设置,请参考官方文档
|
||||
var map = new BMap.Map("allmap");
|
||||
// var point = new BMap.Point("{$apply_info['lng']|default=118.514285}", "{$apply_info['lat']|default=37.478362}");
|
||||
var point = new BMap.Point(lng, lat);
|
||||
map.centerAndZoom(point, 16);
|
||||
var marker = new BMap.Marker(point);
|
||||
map.clearOverlays();
|
||||
map.addOverlay(marker);
|
||||
marker.setAnimation(BMAP_ANIMATION_BOUNCE);
|
||||
function showInfo(e) {
|
||||
parent.selectCallBack('data_lng', 'data_lat', document.getElementById('lng').value, document.getElementById('lat').value);
|
||||
}
|
||||
function showPoint(e) {
|
||||
|
||||
document.getElementById('lat').value = e.point.lat;
|
||||
document.getElementById('lng').value = e.point.lng;
|
||||
var p = new BMap.Point(e.point.lng, e.point.lat);
|
||||
var mk = new BMap.Marker(p);
|
||||
map.clearOverlays();
|
||||
map.addOverlay(mk);
|
||||
mk.setAnimation(BMAP_ANIMATION_BOUNCE);
|
||||
// //console.log(BMAP_ANIMATION_BOUNCE);
|
||||
}
|
||||
map.enableScrollWheelZoom(true);
|
||||
map.addControl(new BMap.NavigationControl());
|
||||
map.addEventListener("click", showPoint);
|
||||
|
||||
function G(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
var ac = new BMap.Autocomplete({
|
||||
"input": "shopAddress",
|
||||
"location": map
|
||||
});
|
||||
ac.addEventListener("onhighlight", function(e) {
|
||||
var str = "";
|
||||
var _value = e.fromitem.value;
|
||||
var value = "";
|
||||
if (e.fromitem.index > -1) {
|
||||
value = _value.province + _value.city + _value.district + _value.street + _value.business;
|
||||
}
|
||||
str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
|
||||
|
||||
value = "";
|
||||
if (e.toitem.index > -1) {
|
||||
_value = e.toitem.value;
|
||||
value = _value.province + _value.city + _value.district + _value.street + _value.business;
|
||||
}
|
||||
str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
|
||||
// G("searchResultPanel").innerHTML = str;
|
||||
});
|
||||
var myValue;
|
||||
ac.addEventListener("onconfirm", function(e) {
|
||||
var _value = e.item.value;
|
||||
myValue = _value.province + _value.city + _value.district + _value.street + _value.business;
|
||||
G("searchResultPanel").innerHTML = "onconfirm<br />index = " + e.item.index + "<br />myValue = " + myValue;
|
||||
|
||||
setPlace();
|
||||
});
|
||||
function setPlace() {
|
||||
map.clearOverlays();
|
||||
|
||||
function myFun() {
|
||||
var pp = local.getResults().getPoi(0).point;
|
||||
map.centerAndZoom(pp, 18);
|
||||
map.addOverlay(new BMap.Marker(pp));
|
||||
}
|
||||
var local = new BMap.LocalSearch(map, {
|
||||
onSearchComplete: myFun
|
||||
});
|
||||
local.search(myValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 读取本地地址
|
||||
function getLocation(callback) {
|
||||
// var object = obj;
|
||||
plus.geolocation.getCurrentPosition(function(res) {
|
||||
//成功回调
|
||||
var obj = new Object();
|
||||
obj.status = 1;
|
||||
obj.lat = res.coords.latitude; //纬度
|
||||
obj.lng = res.coords.longitude; //经度
|
||||
callback(obj);
|
||||
}, function(e) {
|
||||
//失败回调
|
||||
//console.log('Gelocation Error: code - ' + e.code + '; message - ' + e.message);
|
||||
switch (e.code) {
|
||||
case 10:
|
||||
obj.errStr = '请开启应用的定位权限';
|
||||
break;
|
||||
case 9:
|
||||
//mui.alert('请开启手机定位服务');
|
||||
obj.errStr = '请开启手机定位服务';
|
||||
break;
|
||||
case 2:
|
||||
if (e.message.indexOf("[geolocation:13]") > -1) {
|
||||
//如果网络开启,定位失败,提示检查定位权限
|
||||
obj.errStr = '请开启应用的定位权限';
|
||||
}
|
||||
if (e.message.indexOf("[geolocation:14]") > -1) {
|
||||
//如果应用的权限开了,提示网络异常
|
||||
obj.errStr = '请检查网络是否正常';
|
||||
}
|
||||
break;
|
||||
case e.PERMISSION_DENIED:
|
||||
obj.errStr = '请求定位被拒绝';
|
||||
break;
|
||||
case e.POSITION_UNAVAILABLE:
|
||||
obj.errStr = "位置信息不可用";
|
||||
break;
|
||||
case e.TIMEOUT:
|
||||
obj.errStr = "获取位置信息超时";
|
||||
break;
|
||||
case e.UNKNOWN_ERROR:
|
||||
obj.errStr = "未知错误";
|
||||
break;
|
||||
}
|
||||
|
||||
var obj = new Object();
|
||||
obj.errCode = e.code;
|
||||
obj.status = 0;
|
||||
callback(obj);
|
||||
}, {
|
||||
//超时未获取到经纬度信息 执行失败回调 (默认为5秒)
|
||||
timeout: 3000
|
||||
});
|
||||
//JZL.saveItems('.user_pos', 'user_pos');
|
||||
}
|
7
static/app2/js/memorandumlist.js
Executable file
7
static/app2/js/memorandumlist.js
Executable file
@ -0,0 +1,7 @@
|
||||
mui.plusReady(function () {
|
||||
|
||||
|
||||
$("body").on("tap" ,".add1",function () {
|
||||
JZL.openWindow('addmemorandum.html', 'addmemorandum.html')
|
||||
})
|
||||
})
|
102
static/app2/js/msg.js
Executable file
102
static/app2/js/msg.js
Executable file
@ -0,0 +1,102 @@
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('refresh', function(e) {
|
||||
location.reload();
|
||||
})
|
||||
var token = localStorage.getItem('token');
|
||||
var num = 1;
|
||||
var isOver = 1;
|
||||
|
||||
function getMsg(pageNum, pagesizeNum) {
|
||||
if(isOver == 1) {
|
||||
isOver = 0;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
var data_msg = {
|
||||
page: pageNum ? pageNum : 1,
|
||||
pagesize: pagesizeNum ? pagesizeNum : 10
|
||||
}
|
||||
var arr = ["普通消息", "订单", "商品", "订单投诉", "结算信息", "提现信息", "订单评价"]
|
||||
mui.ajax(hyhUrl('app/messages/msglist'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: data_msg,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data,1);
|
||||
if(data.status == 1) {
|
||||
var html = '';
|
||||
data = data.data;
|
||||
if(data.Rows == '') {
|
||||
$('.con1').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px; margin-top:10px">没有更多消息</p>');
|
||||
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="row clearfix shadown_wai" data-id="' + this.id + '"><div class="img"><img src="' + hyhImgUrl(this.img) + '" /></div><div class="r_right"><div class="r_r_top clearfix"><p class="rrt_left">' + arr[this.from] + '</p><p class="rrt_right">' + this.createTime + '</p></div><div class="r_r_con">' + this.msgContent + '</div></div></div>'
|
||||
});
|
||||
|
||||
if(pageNum == 1) {
|
||||
$('.con1').html(html)
|
||||
} else if(pageNum > 1) {
|
||||
$('.con1').append(html)
|
||||
}
|
||||
isOver = 1;
|
||||
} else {
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
getMsg(1, 10);
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if(scroll.y == scroll.maxScrollY) {
|
||||
if(isOver == 1) {
|
||||
num += 1;
|
||||
getMsg(num, 10);
|
||||
}
|
||||
}
|
||||
})
|
||||
$('.con1').on('tap', '.row', function() {
|
||||
var id = $(this).attr('data-id');
|
||||
mui.openWindow({
|
||||
url: 'msg_con.html',
|
||||
id: 'msg_con.html'+id,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_msgId: id
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {
|
||||
// autoShow: true, //页面loaded事件发生后自动显示,默认为true
|
||||
// aniShow: animationType, //页面显示动画,默认为”slide-in-right“;
|
||||
// duration: animationTime, //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
|
||||
// event: 'titleUpdate', //页面显示时机,默认为titleUpdate事件时显示
|
||||
// extras: {} //窗口动画是否使用图片加速
|
||||
},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {
|
||||
// width: waiting - dialog - widht, //等待框背景区域宽度,默认根据内容自动计算合适宽度
|
||||
// height: waiting - dialog - height, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
31
static/app2/js/msg_con.js
Executable file
31
static/app2/js/msg_con.js
Executable file
@ -0,0 +1,31 @@
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
var self = plus.webview.currentWebview();
|
||||
var msgId = self.data_msgId;
|
||||
mui.ajax(hyhUrl('app/messages/getById'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
msgId: msgId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
|
||||
if(data.status == 1) {
|
||||
data = data.data;
|
||||
var html = '<div class="time">' + data.createTime + '</div><div class="con_">' + data.msgContent + '</div>';
|
||||
$('.con_b').html(html);
|
||||
} else {
|
||||
console.log(data.status)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user