mui.plusReady(function() {
window.addEventListener('reload', function(e) { //执行刷新
location.reload();
});
$('.orange').html("¥000.00")
var self = plus.webview.currentWebview();
//console.log(self);
var shopId = self.id;
//console.log(shopId);
$('.seeting').on("tap", function() {
JZL.openWindow('shopsetting.html', parseInt(shopId))
})
$('.money').on('tap', function() {
JZL.openWindow('cash-out.html', parseInt(shopId))
})
// $('.money').on('tap','.myYouhuiquan_cb',function () {
// var data_href=$(this).attr('data-href')
// var data_expect =$(this).attr('data_expect')
// //console.log(data_href)
// JZL.openWindow('income-details.html',parseInt(shopId),{data_href:data_href,data_expect:data_expect})
// })
// $('.money').on('tap',function () {
// JZL.openWindow('paymentvoucher.html',parseInt(shopId))
// })
// 获取商家首页信息
JZL.ajax(qlgUrl('app/shops/shopInfo'), {
shopId: shopId
}, function(data) {
//console.log(data);
if (1 == data.status) {
data = data.data;
// //console.log(data.status);
var html = "";
var html1 = "";
html = '
' + data.shopName + '
' + data.userName +
'' + data.phone + ''
$('.shop_info').html(html)
$('.wait_money .orange').text('¥' + data.waitPayMoneyNum);
$('.comp_money .orange').text('¥' + data.receivedPayMoneyNum);
var html1 = '' + data.waitPayNum +
'
待付款
' +
data.waitConfirmNum +
'
待确认
' +
data.waitDeliverNum +
'
待发货
' +
data.waitReceiveNum +
'
待收货
' +
data.abnormal + '
退款/售后
';
$('.line_order .order_con').html(html1);
$('.num').each(function() {
if ($(this).html() == '0') {
$(this).css('display', 'none');
}
})
}else{
mui.alert(data.msg)
}
})
mui('.order').on('tap', '.indent_btn', function() {
var data_href = this.attributes["data-href"].nodeValue;
JZL.openWindow("shop_indent.html", data_href, {
data_href: data_href,
shopId: shopId
})
})
mui('.order').on('tap', '.pingzheng', function() {
// var data_href = this.attributes["data-href"].nodeValue;
JZL.openWindow("paymentVoucher.html", parseInt(shopId))
})
mui('.order').on('tap', '.tixian', function() {
// var data_href = this.attributes["data-href"].nodeValue;
JZL.openWindow('cash-out.html', parseInt(shopId))
})
getRecommend(nowpage, pagesize)
// 获取店铺商品
var nowpage = 1;
var pagesize = 10;
var isload = false;
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
if (scroll.y >= scroll.maxScrollY) {
if (isload == false) {
nowpage++;
// getShops(nowPage, pageSize);
console.log(nowpage)
getRecommend(nowpage, pagesize)
}
}
})
function getRecommend(nowpage, pagesize) {
var recommenddata = {
page: nowpage ? nowpage : 1,
pageSize: pagesize ? pagesize : 10
}
recommenddata.shopId = shopId
if (isload == true) {
return;
}
isload = true
mui.ajax(qlgUrl('app/Shopping/getShopIndexGoodsList'), {
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(
'没有更多商品
');
return;
}
$.each(data.Rows, function() {
html += ' +
')
' + this.goodsName +
'
价格¥' + this.shopPrice +
'
优惠率' + this.discountRate +
'%
'
// html += ' +
// ')
'+ this.goodsName + '
¥' + this.shopPrice +
// ' 满减
'+this.saleNum+'人购买
优惠率 '+this.discountRate+'%

';
});
if (nowpage == 1) {
// //console.log(222);
$('.shop-goods-content').html(html);
} else {
$('.shop-goods-content').append(html);
}
// $('.rcb_title span').each(function() {
// if ($(this).attr('data-goodsId') == 1) {
// $(this).css('display', 'none');
// }
// })
$('.sdg-img').height($('.sdg-img').width());
} else{
mui.alert(data.msg)
}
isload = false
},
error: function(xhr, type, errorThrown) { //异常处理;
// mui.alert(errorThrown);
}
});
}
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
// 判断默认行为是否可以被禁用
if (e.cancelable) {
// 判断默认行为是否已经被禁用
if (!e.defaultPrevented) {
e.preventDefault();
}
}
if (scroll.y == scroll.maxScrollY) {
if (isload = true) {
nowpage++;
getRecommend(nowpage, pagesize);
}
}
})
$('.shop-goods').on('tap', '.shop-goods-detail', function() {
var good_id = $(this).attr('data-goodsId');
JZL.openWindow('details.html', parseInt(good_id), {
shopId: shopId,
data_id: good_id
})
})
})