You've already forked qlg.frontend
Init Repo
This commit is contained in:
100
js/shopgoodlist.js
Normal file
100
js/shopgoodlist.js
Normal file
@ -0,0 +1,100 @@
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('reload', function(e) { //执行刷新
|
||||
location.reload();
|
||||
});
|
||||
var self = plus.webview.currentWebview();
|
||||
// //console.log(self);
|
||||
var shopId = self.id;
|
||||
$('.add1').on('tap', function() {
|
||||
JZL.openWindow('addgoods.html', parseInt(shopId));
|
||||
})
|
||||
//获取商品列表
|
||||
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.shopId = shopId
|
||||
if (isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/shops/getGoodsList'), recommenddata, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
var html = '';
|
||||
var status = '';
|
||||
var data = data.data;
|
||||
var status = "";
|
||||
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() {
|
||||
// //console.log(this.goodsStatus);
|
||||
if (0 == this.goodsStatus) {
|
||||
status = "等待审核"
|
||||
}
|
||||
if (1 == this.goodsStatus) {
|
||||
status = "已上架"
|
||||
}
|
||||
if (-1 == this.goodsStatus) {
|
||||
status = "已拒绝"
|
||||
}
|
||||
html += '<div class="row shadown_wai" data-spec="' + this.isSpec + '" data-sale="' + this.isSale +
|
||||
'"><div class="left"><img src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" alt=""></div><div class="center"><div><h4>' + this.goodsName + '</h4></div><div><span>价格:</span><span>' +
|
||||
this.shopPrice +
|
||||
'</span></div></div><div class="right"><div><p>' + status +
|
||||
'</p></div><div class="oper"><span class="bj" data-id="' +
|
||||
this.goodsId + '"><img src="../img/bianji.png"></span><span class="del" data-id="' + this.goodsId +
|
||||
'"><img src="../img/delete.png"></span></div></div></div>'
|
||||
})
|
||||
$('.con').append(html);
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
isjiazai = 1;
|
||||
})
|
||||
}
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isjiazai == 1) {
|
||||
page++;
|
||||
getRecommend(page, pageSize);
|
||||
}
|
||||
}
|
||||
})
|
||||
var goodsId = "";
|
||||
var isSpec = "";
|
||||
$('.con').on('tap', '.bj', function() {
|
||||
goodsId = $(this).attr('data-id')
|
||||
isSpec = $(this).parent().parent().parent().attr("data-spec")
|
||||
isSale = $(this).parent().parent().parent().attr("data-sale")
|
||||
JZL.openWindow('addgoods.html', parseInt(shopId), {
|
||||
goodsId: goodsId,
|
||||
isSpec: isSpec,
|
||||
isSale: isSale
|
||||
});
|
||||
})
|
||||
$('.con').on('tap', '.del', function() {
|
||||
goodsId = $(this).attr('data-id')
|
||||
if (confirm('确认删除?')) {
|
||||
JZL.ajax(qlgUrl("app/shops/delGoods"), {
|
||||
shopId: shopId,
|
||||
goodsId: goodsId
|
||||
}, function() {
|
||||
$(this).parent().parent().parent().remove();
|
||||
location.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user