You've already forked qlg.frontend
Init Repo
This commit is contained in:
0
js/addessay.js
Normal file
0
js/addessay.js
Normal file
658
js/addgoods.1.js
Normal file
658
js/addgoods.1.js
Normal 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
js/addgoods.2.js
Normal file
859
js/addgoods.2.js
Normal 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
js/addgoods.js
Normal file
855
js/addgoods.js
Normal 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
js/addhhrrz.js
Normal file
174
js/addhhrrz.js
Normal 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
js/addmemorandum.js
Normal file
84
js/addmemorandum.js
Normal 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
js/addproperties.js
Normal file
125
js/addproperties.js
Normal 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
js/addqrbb.js
Normal file
89
js/addqrbb.js
Normal 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
js/addqrrz.js
Normal file
213
js/addqrrz.js
Normal 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
js/addshopping.js
Normal file
0
js/addshopping.js
Normal file
98
js/addyhk.js
Normal file
98
js/addyhk.js
Normal 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
js/applicationopen.js
Normal file
443
js/applicationopen.js
Normal 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
js/appraise.js
Normal file
319
js/appraise.js
Normal 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
js/bill.js
Normal file
72
js/bill.js
Normal 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)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
110
js/cash-out.js
Normal file
110
js/cash-out.js
Normal 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
js/choiceness.js
Normal file
316
js/choiceness.js
Normal 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));
|
||||
})
|
||||
|
||||
})
|
||||
222
js/commercial.js
Normal file
222
js/commercial.js
Normal 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)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
474
js/common.js
Normal file
474
js/common.js
Normal file
@@ -0,0 +1,474 @@
|
||||
var is_app = 1;
|
||||
var imgUrl = 'http://img.zgqlg.com.cn/';
|
||||
var webUrl = 'http://www.zgqlg.com.cn/';
|
||||
var webUrl1 = 'http://www.zgqlg.com.cn/';
|
||||
var cssUrl = localStorage.getItem("cssUrl");
|
||||
var jsUrl = localStorage.getItem("jsUrl");
|
||||
var version = localStorage.getItem("version");
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
96
js/compare.js
Normal file
96
js/compare.js
Normal 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
js/complain.js
Normal file
156
js/complain.js
Normal 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
js/confirmOrder.js
Normal file
717
js/confirmOrder.js
Normal 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
js/cooperative.js
Normal file
187
js/cooperative.js
Normal 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);
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
872
js/details.js
Normal file
872
js/details.js
Normal file
@@ -0,0 +1,872 @@
|
||||
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: {
|
||||
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)
|
||||
80
js/discounts.js
Normal file
80
js/discounts.js
Normal 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
js/distribution.js
Normal file
98
js/distribution.js
Normal 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)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
299
js/editAddress.js
Normal file
299
js/editAddress.js
Normal 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
js/essay.js
Normal file
0
js/essay.js
Normal file
9
js/essaylist.js
Normal file
9
js/essaylist.js
Normal 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')
|
||||
})
|
||||
})
|
||||
53
js/friends.js
Normal file
53
js/friends.js
Normal 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
js/friendsList.js
Normal file
86
js/friendsList.js
Normal 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)
|
||||
})
|
||||
216
js/goodslist.js
Normal file
216
js/goodslist.js
Normal 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
js/guide.js
Normal file
61
js/guide.js
Normal 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
js/hhrrz.js
Normal file
44
js/hhrrz.js
Normal 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
js/home.js
Normal file
299
js/home.js
Normal 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
js/home_new.js
Normal file
452
js/home_new.js
Normal 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
js/income-details.js
Normal file
20
js/income-details.js
Normal 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
js/indent.js
Normal file
42
js/indent.js
Normal 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
js/indentcon.js
Normal file
939
js/indentcon.js
Normal 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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
74
js/index.js
Normal file
74
js/index.js
Normal file
@@ -0,0 +1,74 @@
|
||||
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);
|
||||
}
|
||||
clearInterval(timer);
|
||||
localStorage.setItem('cssUrl', "../css/");
|
||||
localStorage.setItem('jsUrl', "../js/");
|
||||
$('nav').css('display', 'block');
|
||||
$('#bg').css('display', 'none');
|
||||
var ipxSizeTop = 0;
|
||||
var ipxSizeBottom = 0;
|
||||
localStorage.setItem('ipxSizeTop', ipxSizeTop);
|
||||
localStorage.setItem('ipxSizeBottom', ipxSizeBottom);
|
||||
init(data);
|
||||
jumpPage(ipxSizeBottom);
|
||||
nav(0);
|
||||
}
|
||||
|
||||
})
|
||||
179
js/individual.js
Normal file
179
js/individual.js
Normal 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
js/invest.js
Normal file
27
js/invest.js
Normal 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
js/investdetail.js
Normal file
24
js/investdetail.js
Normal 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})
|
||||
})
|
||||
})
|
||||
4
js/jquery-3.2.1.min.js
vendored
Normal file
4
js/jquery-3.2.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
13
js/jquery-ui.min.js
vendored
Normal file
13
js/jquery-ui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
117
js/jquery.cookie.js
Normal file
117
js/jquery.cookie.js
Normal 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
js/jquery.qtip.min.js
vendored
Normal file
5
js/jquery.qtip.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
js/jquery.validate.min.js
vendored
Normal file
4
js/jquery.validate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
121
js/login.js
Normal file
121
js/login.js
Normal 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
js/logistics.js
Normal file
15
js/logistics.js
Normal 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
js/logisticscon.js
Normal file
50
js/logisticscon.js
Normal 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
js/lrz.bundle.js
Normal file
2
js/lrz.bundle.js
Normal file
File diff suppressed because one or more lines are too long
86
js/main_guide.js
Normal file
86
js/main_guide.js
Normal 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
js/mapcommon.js
Normal file
347
js/mapcommon.js
Normal 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
js/memorandumlist.js
Normal file
7
js/memorandumlist.js
Normal file
@@ -0,0 +1,7 @@
|
||||
mui.plusReady(function () {
|
||||
|
||||
|
||||
$("body").on("tap" ,".add1",function () {
|
||||
JZL.openWindow('addmemorandum.html', 'addmemorandum.html')
|
||||
})
|
||||
})
|
||||
9
js/mui.min.js
vendored
Normal file
9
js/mui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
624
js/my.js
Normal file
624
js/my.js
Normal file
@@ -0,0 +1,624 @@
|
||||
$('.mui-scroll').css('background', 'url(http://img.juzi199.com/static/app2/img/user_center.png) no-repeat center top');
|
||||
$('.mui-scroll').css('background-size', '100%');
|
||||
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('reload', function(e) { //执行刷新
|
||||
location.reload();
|
||||
});
|
||||
var token = localStorage.getItem('token');
|
||||
var authType = 0; //0 未认证 1 个人认证 2 合作认证
|
||||
var userId = 0;
|
||||
var authTypeText = "";
|
||||
var authTypeStatus = "";
|
||||
var reasonsForRefusal = "";
|
||||
// $('.nblock').on('tap',function () {
|
||||
//
|
||||
// })
|
||||
var localAuthType = localStorage.getItem("authType");
|
||||
|
||||
// if (token) {
|
||||
// console.log(token);
|
||||
|
||||
JZL.ajax(qlgUrl('app/users/getIndex'), {}, function(data) {
|
||||
// console.log(data); //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
userId = parseInt(data.data.user.userId);
|
||||
authType = parseInt(data.data.user.authType);
|
||||
var imgurl = data.data.user.userPhoto ? hyhImgUrl(data.data.user.userPhoto) : '../img/mujiimg.png';
|
||||
if(1 == localAuthType){
|
||||
//本地申请亲人认证
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthInfo'), {}, function(result) {
|
||||
authTypeText = "个人认证"
|
||||
if (0 == result.data.status) {
|
||||
authTypeStatus = "待审核"
|
||||
} else if (1 == result.data.status) {
|
||||
authTypeStatus = "已通过"
|
||||
localStorage.setItem("authType","0")
|
||||
} else if (2 == result.data.status) {
|
||||
$('.mydata').on('tap', '.cooperative', function() {
|
||||
JZL.openWindow('cooperative.html', 'cooperative.html')
|
||||
})
|
||||
$('.mydata').on('tap', '.individual', function() {
|
||||
JZL.openWindow('individual.html', 'individual.html')
|
||||
})
|
||||
|
||||
authTypeStatus = "已拒绝";
|
||||
reasonsForRefusal = result.data.reasonsForRefusal;
|
||||
var html1 = '<img src="' + imgurl + '" /><div class="left"><p>' + data.data.user.loginName +
|
||||
'</p><p><span>' + authTypeText +
|
||||
'</span><span>' + authTypeStatus +
|
||||
'</span></p><p><span>' + reasonsForRefusal +
|
||||
'</span></p></div>';
|
||||
$('.con1').html(html1);
|
||||
}
|
||||
|
||||
})
|
||||
}else if(2 == localAuthType){
|
||||
//本地申请合作认证
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthInfo'), {
|
||||
isCompany: 1
|
||||
}, function(res) {
|
||||
console.log(res);
|
||||
authTypeText = "合作认证"
|
||||
if (0 == res.data.status) {
|
||||
authTypeStatus = "待审核"
|
||||
} else if (1 == res.data.status) {
|
||||
authTypeStatus = "已通过"
|
||||
localStorage.setItem("authType","0")
|
||||
|
||||
} else if (2 == res.data.status) {
|
||||
$('.mydata').on('tap', '.cooperative', function() {
|
||||
JZL.openWindow('cooperative.html', 'cooperative.html')
|
||||
})
|
||||
$('.mydata').on('tap', '.individual', function() {
|
||||
JZL.openWindow('individual.html', 'individual.html')
|
||||
})
|
||||
authTypeStatus = "已拒绝";
|
||||
reasonsForRefusal = res.data.reasonsForRefusal;
|
||||
var html1 = '<img src="' + imgurl + '" /><div class="left"><p>' + data.data.user.loginName +
|
||||
'</p><p><span>' + authTypeText +
|
||||
'</span><span>' + authTypeStatus +
|
||||
'</span></p><p><span>' + reasonsForRefusal +
|
||||
'</span></p></div>';
|
||||
$('.con1').html(html1);
|
||||
}
|
||||
|
||||
})
|
||||
}else{
|
||||
if(1 == authType){
|
||||
//个体认证
|
||||
authTypeText = "个人认证"
|
||||
authTypeStatus = "已通过"
|
||||
$('.cooperative img').attr('src', "../img/trade1.png")
|
||||
$('.mydata').on('tap', '.cooperative', function() {
|
||||
mui.alert('已认证 无需再次认证')
|
||||
})
|
||||
$('.mydata').on('tap', '.individual', function() {
|
||||
JZL.openWindow('individual.html', 'individual.html')
|
||||
})
|
||||
|
||||
}else if(2 == authType){
|
||||
//合作认证
|
||||
authTypeText = "合作认证"
|
||||
authTypeStatus = "已通过"
|
||||
$('.individual img').attr('src', "../img/renzheng1.png")
|
||||
$('.mydata').on('tap', '.individual', function() {
|
||||
mui.alert('已认证 无需再次认证')
|
||||
})
|
||||
$('.mydata').on('tap', '.cooperative', function() {
|
||||
JZL.openWindow('cooperative.html', 'cooperative.html')
|
||||
})
|
||||
}else{
|
||||
//未申请认证
|
||||
if (userId > 0) {
|
||||
authTypeText = "未认证 请认证"
|
||||
$('.mydata').on('tap', '.cooperative', function() {
|
||||
JZL.openWindow('cooperative.html', 'cooperative.html')
|
||||
})
|
||||
$('.mydata').on('tap', '.individual', function() {
|
||||
JZL.openWindow('individual.html', 'individual.html')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (2 == authType) {
|
||||
// JZL.ajax(qlgUrl('app/auth/getAuthInfo'), {
|
||||
// isCompany: 1
|
||||
// }, function(res) {
|
||||
// console.log(res);
|
||||
// authTypeText = "合作认证"
|
||||
// if (0 == res.data.status) {
|
||||
// authTypeStatus = "待审核"
|
||||
// } else if (1 == res.data.status) {
|
||||
// authTypeStatus = "已通过"
|
||||
//
|
||||
// } else if (2 == res.data.status) {
|
||||
// authTypeStatus = "已拒绝";
|
||||
// reasonsForRefusal = res.data.reasonsForRefusal;
|
||||
// }
|
||||
//
|
||||
// })
|
||||
// } else if (1 == authType) {
|
||||
// JZL.ajax(qlgUrl('app/auth/getAuthInfo'), {}, function(result) {
|
||||
// console.log(result);
|
||||
// authTypeText = "个人认证"
|
||||
// if (0 == result.data.status) {
|
||||
// authTypeStatus = "待审核"
|
||||
// } else if (1 == result.data.status) {
|
||||
// authTypeStatus = "已通过"
|
||||
//
|
||||
// } else if (2 == result.data.status) {
|
||||
// authTypeStatus = "已拒绝";
|
||||
// reasonsForRefusal = result.data.reasonsForRefusal;
|
||||
// }
|
||||
//
|
||||
// })
|
||||
// }
|
||||
// setTimeout(function () {
|
||||
var html1 = '<img src="' + imgurl + '" /><div class="left"><p>' + data.data.user.loginName +
|
||||
'</p><p><span>' + authTypeText +
|
||||
'</span><span>' + authTypeStatus +
|
||||
'</span></p><p><span>' + reasonsForRefusal +
|
||||
'</span></p></div>';
|
||||
$('.con1').html(html1);
|
||||
// },200)
|
||||
$('.header').html("");
|
||||
// $('.header').html(html);
|
||||
$('.con .login').css('display', 'none')
|
||||
|
||||
$('.nav').css('display', 'none')
|
||||
$('.myYouhuiquan_con').addClass("myYouhuiquan_con1")
|
||||
$('.myYouhuiquan').removeClass("shadown_wai")
|
||||
$('#expectedProductNum').html(+data.data.expectedProductNum);
|
||||
$('#expectedCouponsNum').html(+data.data.expectedCouponsNum);
|
||||
$('#expectedWangNum').html(+data.data.expectedWangNum);
|
||||
$('#couponsNum').html(+data.data.user.couponsNum);
|
||||
$('#productNum').html(+data.data.user.productNum);
|
||||
$('#wangNum').html(+data.data.user.wangNum);
|
||||
|
||||
mui.ajax(qlgUrl('app/users/getFavoritesNum'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
var html = '<div class="nblock" data-href="collect_commodity.html"><p>' + data.data.goodsFavoritesNum +
|
||||
'</p><p>收藏夹</p></div><div class="nblock" data-href="collect_store.html"><p>' + data.data.shopFavoritesNum +
|
||||
'</p><p>关注店铺</p></div><div class="nblock" data-href="share_user_list.html"><p>' + data.data.shareNum +
|
||||
'</p><p>我的分享</p></div>';
|
||||
$('.nav').html(html);
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
// 订单个数
|
||||
mui.ajax(qlgUrl('app/users/getOrderNum'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// console.log(data);
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
|
||||
var html = '<div class="order_cb indent_btn" data-href="waitPay"><div class="num">' + data.data.order.waitPay +
|
||||
'</div><div class="orderimg"><img src="../img/daifukuan.png" /></div><p>待付款</p></div><div class="order_cb indent_btn" data-href="waitDeliver"><div class="num">' +
|
||||
data.data.order.waitSend +
|
||||
'</div><div class="orderimg"><img src="../img/daifahuo.png" /></div><p>待发货</p></div><div class="order_cb indent_btn" data-href="waitReceive"><div class="num">' +
|
||||
data.data.order.waitReceive +
|
||||
'</div><div class="orderimg"><img src="../img/daishouhuo.png" /></div><p>待收货</p></div><div class="order_cb indent_btn" data-href="waitAppraise"><div class="num">' +
|
||||
data.data.order.waitAppraise +
|
||||
'</div><div class="orderimg"><img src="../img/pingjia.png" /></div><p>待评价</p></div><div class="order_cb indent_btn" data-href="abnormal"><div class="num">' +
|
||||
data.data.order.cancelNum +
|
||||
'</div><div class="orderimg"><img src="../img/orderdetail.png" /></div><p>退款/售后</p></div>';
|
||||
$('.order .order_con').html(html);
|
||||
$('.num').each(function() {
|
||||
if ($(this).html() == '0') {
|
||||
$(this).css('display', 'none');
|
||||
}
|
||||
})
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
$('.mydata-content').on('tap', '.friends', function() {
|
||||
if ("undefined" != typeof(cooperativeData) && "undefined" != typeof(individualData)) {
|
||||
mui.alert('请先进行认证')
|
||||
return;
|
||||
} else {
|
||||
JZL.openWindow('friends.html', 'friends.html')
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('.mydata-content').on('tap', '.applicationopen', function() {
|
||||
if (authType > 0) {
|
||||
JZL.openWindow('applicationopen.html', 'applicationopen.html')
|
||||
} else {
|
||||
mui.alert('请先进行认证')
|
||||
}
|
||||
|
||||
})
|
||||
$('.mydata-content').on('tap', '.myshops', function() {
|
||||
if (authType > 0) {
|
||||
JZL.openWindow('myshops.html', 'myshops.html')
|
||||
} else {
|
||||
mui.alert('请先进行认证')
|
||||
}
|
||||
|
||||
})
|
||||
$('.mydata-content').on('tap', '.setting', function() {
|
||||
JZL.openWindow('setting.html', 'setting.html')
|
||||
})
|
||||
$('.mydata-content').on('tap', '.shoppingcart', function() {
|
||||
JZL.openWindow('shoppingcart.html', 'shoppingcart.html')
|
||||
})
|
||||
|
||||
$('.mydata-content').on('tap', '.shangdu', function() {
|
||||
if (authType == 2) {
|
||||
JZL.openWindow('shangdu.html', 'shangdu.html')
|
||||
} else if (authType == 0) {
|
||||
mui.alert('请先进行认证')
|
||||
} else if (authType == 1) {
|
||||
mui.alert('只有合作认证才可以申请商都')
|
||||
}
|
||||
})
|
||||
$('.mydata-content').on('tap', '.supermarket', function() {
|
||||
if (2 == authType) {
|
||||
JZL.openWindow('supermarket.html', 'supermarket.html')
|
||||
} else if (0 == authType) {
|
||||
mui.alert('请先进行认证')
|
||||
} else if (1 == authType) {
|
||||
mui.alert('只有合作认证才可以申请商超')
|
||||
}
|
||||
})
|
||||
$('.mydata-content').on('tap', '.commercial', function() {
|
||||
if (2 == authType) {
|
||||
JZL.openWindow('commercial.html', 'commercial.html')
|
||||
} else if (0 == authType) {
|
||||
mui.alert('请先进行认证')
|
||||
} else if (1 == authType) {
|
||||
mui.alert('只有合作认证才可以申请商厦')
|
||||
}
|
||||
})
|
||||
// setTimeout(function() {
|
||||
// //console.log(authType);
|
||||
// if (2 == authType) { // 合作认证
|
||||
// $('.individual img').attr('src', "../img/renzheng1.png")
|
||||
// $('.mydata').on('tap', '.individual', function() {
|
||||
// mui.alert('已认证 无需再次认证')
|
||||
// })
|
||||
// $('.mydata').on('tap', '.cooperative', function() {
|
||||
// JZL.openWindow('cooperative.html', 'cooperative.html')
|
||||
// })
|
||||
// } else if (1 == authType) { // 个体认证
|
||||
// $('.cooperative img').attr('src', "../img/trade1.png")
|
||||
// $('.mydata').on('tap', '.cooperative', function() {
|
||||
// mui.alert('已认证 无需再次认证')
|
||||
// })
|
||||
// $('.mydata').on('tap', '.individual', function() {
|
||||
// JZL.openWindow('individual.html', 'individual.html')
|
||||
// })
|
||||
// } else if (userId > 0) {
|
||||
// $('.mydata').on('tap', '.cooperative', function() {
|
||||
// JZL.openWindow('cooperative.html', 'cooperative.html')
|
||||
// })
|
||||
// $('.mydata').on('tap', '.individual', function() {
|
||||
// JZL.openWindow('individual.html', 'individual.html')
|
||||
// })
|
||||
// }
|
||||
//
|
||||
// }, 500)
|
||||
|
||||
|
||||
} else {
|
||||
// mui.alert(data.msg)
|
||||
//console.log(data.status)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// } else {
|
||||
// // $('.con').attr('display','block')
|
||||
//
|
||||
// // JZL.openWindow('login.html', 'login.html');
|
||||
// }
|
||||
|
||||
$('.mydata-content').on('tap', '.zhuweiba', function() { //助威吧
|
||||
// JZL.openWindow('essay.html', 'essay.html')
|
||||
mui.alert("功能开发中......")
|
||||
|
||||
})
|
||||
$('.mydata-content').on('tap', '.essaylist', function() { //烂笔头
|
||||
// JZL.openWindow('essaylist.html', 'essaylist.html')
|
||||
// mui.alert("功能开发中......")
|
||||
|
||||
})
|
||||
|
||||
$('.mydata-content').on('tap', '.touzi', function() { //投资
|
||||
// JZL.openWindow('invest.html', 'invest.html')
|
||||
// mui.alert("功能开发中......")
|
||||
|
||||
})
|
||||
$('.mydata-content').on('tap', '.shenqingweiba', function() { //申请微吧
|
||||
// JZL.openWindow('essay.html', 'essay.html')
|
||||
mui.alert("功能开发中......")
|
||||
|
||||
})
|
||||
$('.moneycon').on('tap', '.moneycon_', function() {
|
||||
|
||||
if ($(this).children('p').attr('id') == 'userECT') {
|
||||
mui.openWindow({
|
||||
url: 'ect_index.html',
|
||||
id: 'ect_index.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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
// 跳转到券值
|
||||
$('.myYouhuiquan').on('tap', '.indent_btn', function() { //预获 已获优惠券
|
||||
var data_href = $(this).attr('data-href')
|
||||
var data_type = $(this).attr('data-type')
|
||||
var data_expect = $(this).attr('data-expect')
|
||||
// var data_href = this.attributes["data-href"].nodeValue;
|
||||
//console.log(data_href);
|
||||
JZL.openWindow("vouchers.html", "vouchers.html", {
|
||||
data_href: data_href,
|
||||
data_type: data_type,
|
||||
data_expect: data_expect
|
||||
})
|
||||
|
||||
})
|
||||
//跳转到劵包
|
||||
$('.moneycon').on('tap', '.moneycon_', function() {
|
||||
if ($(this).children('p').attr('id') == 'userJuan') {
|
||||
mui.openWindow({
|
||||
url: 'juan_index.html',
|
||||
id: 'juan_index.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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$('.mydata-content').on('tap', '.userPaymentvoucher', function() { //首页付款凭证
|
||||
// JZL.openWindow('paymentvoucher.html', 'paymentvoucher.html')
|
||||
mui.alert("功能开发中......")
|
||||
|
||||
})
|
||||
//订单按钮
|
||||
mui('.order').on('tap', '.indent_btn', function() {
|
||||
var data_href = this.attributes["data-href"].nodeValue;
|
||||
// //console.log(this.attributes["data-id"].nodeValue);
|
||||
mui.openWindow({
|
||||
url: 'indent.html',
|
||||
id: data_href,
|
||||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
mui('.my').on('tap', '.share', function() {
|
||||
mui.openWindow({
|
||||
url: 'share.html',
|
||||
id: 'share.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
// data_userId: 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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
mui(".nav").on('tap', '.nblock', function() {
|
||||
// var tj = plus.webview.create('search.html');
|
||||
// tj.show();
|
||||
// mui.alert(e.target.attributes["data-id"].nodeValue);
|
||||
// var data_href = this.attributes["data-href"].nodeValue;
|
||||
// var url = 'collect.html';
|
||||
// if (data_href == 'share_user_list.html') {
|
||||
// url = 'share_user_list.html';
|
||||
// }
|
||||
// // //console.log(this.attributes["data-id"].nodeValue);
|
||||
// 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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// // ......
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
})
|
||||
|
||||
|
||||
window.addEventListener('refresh', function(e) { //执行刷新
|
||||
location.reload();
|
||||
});
|
||||
|
||||
//
|
||||
mui('.my').on('tap', '.seeting', function() {
|
||||
JZL.openWindow('setting.html', 'setting.html')
|
||||
})
|
||||
|
||||
// 登录
|
||||
$('.my').on('tap', '.login', function() {
|
||||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
})
|
||||
194
js/myshop.js
Normal file
194
js/myshop.js
Normal file
@@ -0,0 +1,194 @@
|
||||
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 = '<p class="myshopname">' + data.shopName + '</p><span class="shop_">' + data.userName +
|
||||
'</span><span class="shop_">' + data.phone + '</span>'
|
||||
$('.shop_info').html(html)
|
||||
$('.wait_money .orange').text('¥' + data.waitPayMoneyNum);
|
||||
$('.comp_money .orange').text('¥' + data.receivedPayMoneyNum);
|
||||
var html1 = '<div class="order_cb indent_btn" data-href="waitPay"><div class="num">' + data.waitPayNum +
|
||||
'</div><div class="orderimg"><img src="../img/daifukuan.png" /></div><p>待付款</p></div><div class="order_cb indent_btn" data-href="waitConfirm"><div class="num">' +
|
||||
data.waitConfirmNum +
|
||||
'</div><div class="orderimg"><img src="../img/pingjia.png" /></div><p>待确认</p></div><div class="order_cb indent_btn" data-href="waitDeliver"><div class="num">' +
|
||||
data.waitDeliverNum +
|
||||
'</div><div class="orderimg"><img src="../img/daifahuo.png" /></div><p>待发货</p></div><div class="order_cb indent_btn" data-href="waitReceive"><div class="num">' +
|
||||
data.waitReceiveNum +
|
||||
'</div><div class="orderimg"><img src="../img/daishouhuo.png" /></div><p>待收货</p></div><div class="order_cb indent_btn" data-href="abnormal"><div class="num">' +
|
||||
data.abnormal + '</div><div class="orderimg"><img src="../img/orderdetail.png" /></div><p>退款/售后</p></div>';
|
||||
$('.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;
|
||||
|
||||
function getRecommend(nowpage, pagesize) {
|
||||
var recommenddata = {
|
||||
nowpage: 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(
|
||||
'<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="shop-goods-detail" data-goodsId="' + this.goodsId +
|
||||
'"><div class="sgd-list"><img class="sdg-img" src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" alt=""><div class="sgd-info">' + this.goodsName +
|
||||
'</div><div class="sgd-price"><div class="market-price"><span>价格</span><span class="price">¥' + this.shopPrice +
|
||||
'</span></div><div class="youhuilv"><span>优惠率</span><span class="preference-rate">' + this.discountRate +
|
||||
'%</span></div></div></div></div>'
|
||||
// html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId +
|
||||
// '"><img class="rcb_img" src="' + hyhImgUrl(this.goodsImg) +
|
||||
// '" alt="" /><div class="rcb_con"><div class="rcb_title">'+ 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><span>优惠率 </span><span>'+this.discountRate+'%</span></div></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
});
|
||||
|
||||
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
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
316
js/myshops.js
Normal file
316
js/myshops.js
Normal file
@@ -0,0 +1,316 @@
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('reload', function(e) { //执行刷新
|
||||
location.reload();
|
||||
});
|
||||
var authType = localStorage.getItem('authType')
|
||||
var supermarket = '',
|
||||
commercial = '',
|
||||
shangdu = '';
|
||||
var scinfo = '',
|
||||
ssinfo = '',
|
||||
sdinfo = '';
|
||||
var shopName = '';
|
||||
var scshopId = '',
|
||||
ssshopId = "",
|
||||
sdshopId = '';
|
||||
var scid = '',
|
||||
ssid = '',
|
||||
sdid = '';
|
||||
$('.nc').hide();
|
||||
$('.ic').hide();
|
||||
// 获取商超商厦申请记录
|
||||
// //console.log(authType);
|
||||
JZL.ajax(qlgUrl('app/shops/getUserUpdate'), {
|
||||
applyLevel: 2
|
||||
}, function(data) { //shangchang
|
||||
// console.log(data)
|
||||
if ("undefined" != typeof(data.data)) {
|
||||
scshopId = data.data.shopId;
|
||||
scid = data.data.id;
|
||||
|
||||
if (0 == data.data.status) {
|
||||
scinfo = "待审核"
|
||||
}
|
||||
if (1 == data.data.status) {
|
||||
scinfo = "已通过"
|
||||
}
|
||||
if (2 == data.data.status) {
|
||||
scinfo = "已拒绝"
|
||||
}
|
||||
|
||||
}else{
|
||||
JZL.ajax(qlgUrl('app/shops/getUserUpdate'), {
|
||||
applyLevel: 2,
|
||||
status:1
|
||||
}, function(data) { //shangchang
|
||||
// console.log(data)
|
||||
if ("undefined" != typeof(data.data)) {
|
||||
scshopId = data.data.shopId;
|
||||
scid = data.data.id;
|
||||
|
||||
if (0 == data.data.status) {
|
||||
scinfo = "待审核"
|
||||
}
|
||||
if (1 == data.data.status) {
|
||||
scinfo = "已通过"
|
||||
}
|
||||
if (2 == data.data.status) {
|
||||
scinfo = "已拒绝"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
JZL.ajax(qlgUrl('app/shops/getUserUpdate'), {
|
||||
applyLevel: 3
|
||||
}, function(data) { //xiaodian
|
||||
// console.log(data)
|
||||
if ("undefined" != typeof(data.data)) {
|
||||
|
||||
if (0 == data.data.status) {
|
||||
ssinfo = "待审核"
|
||||
}
|
||||
if (1 == data.data.status) {
|
||||
ssinfo = "已通过"
|
||||
}
|
||||
if (2 == data.data.status) {
|
||||
ssinfo = "已拒绝"
|
||||
}
|
||||
ssid = data.data.id;
|
||||
|
||||
ssshopId = data.data.shopId;
|
||||
// ssinfo=data.data.status;
|
||||
|
||||
}else{
|
||||
JZL.ajax(qlgUrl('app/shops/getUserUpdate'), {
|
||||
applyLevel: 3,
|
||||
status:1
|
||||
}, function(data) { //xiaodian
|
||||
// console.log(data)
|
||||
if ("undefined" != typeof(data.data)) {
|
||||
|
||||
if (0 == data.data.status) {
|
||||
ssinfo = "待审核"
|
||||
}
|
||||
if (1 == data.data.status) {
|
||||
ssinfo = "已通过"
|
||||
}
|
||||
if (2 == data.data.status) {
|
||||
ssinfo = "已拒绝"
|
||||
}
|
||||
ssid = data.data.id;
|
||||
|
||||
ssshopId = data.data.shopId;
|
||||
// ssinfo=data.data.status;
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
JZL.ajax(qlgUrl('app/shops/getUserUpdate'), {
|
||||
applyLevel: 4
|
||||
}, function(data) { //shangchangkefu
|
||||
// console.log(data)
|
||||
if ("undefined" != typeof(data.data)) {
|
||||
|
||||
if (0 == data.data.status) {
|
||||
sdinfo = "待审核"
|
||||
}
|
||||
if (1 == data.data.status) {
|
||||
sdinfo = "已通过"
|
||||
}
|
||||
if (2 == data.data.status) {
|
||||
sdinfo = "已拒绝"
|
||||
}
|
||||
sdid = data.data.id;
|
||||
|
||||
sdshopId = data.data.shopId;
|
||||
// sdinfo = data.data.status;
|
||||
// shangdu = '<img src="../img/shangchangkefu.png">'
|
||||
}else{
|
||||
JZL.ajax(qlgUrl('app/shops/getUserUpdate'), {
|
||||
applyLevel: 4,
|
||||
status:1
|
||||
}, function(data) { //shangchangkefu
|
||||
// console.log(data)
|
||||
if ("undefined" != typeof(data.data)) {
|
||||
|
||||
if (0 == data.data.status) {
|
||||
sdinfo = "待审核"
|
||||
}
|
||||
if (1 == data.data.status) {
|
||||
sdinfo = "已通过"
|
||||
}
|
||||
if (2 == data.data.status) {
|
||||
sdinfo = "已拒绝"
|
||||
}
|
||||
sdid = data.data.id;
|
||||
|
||||
sdshopId = data.data.shopId;
|
||||
// sdinfo = data.data.status;
|
||||
// shangdu = '<img src="../img/shangchangkefu.png">'
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
JZL.ajax(qlgUrl('app/shops/userShopList'), {}, function(data) {
|
||||
if (1 == data.status) {
|
||||
var data = data.data;
|
||||
var html = '';
|
||||
var info = "",
|
||||
infotext;
|
||||
$.each(data, function() {
|
||||
if (this.status == 0) {
|
||||
info = "待审核",
|
||||
infotext = "编辑"
|
||||
} else if (this.status == 1) {
|
||||
info = "已通过";
|
||||
infotext = "进入店铺"
|
||||
|
||||
} else if (this.status == 2) {
|
||||
info = "已拒绝";
|
||||
infotext = "编辑"
|
||||
}
|
||||
html = '<div class="list shadown_wai" data-id="' + this.shopId + ' " data-info="' + this.status +
|
||||
'"><div class="listleft"><div class="listimg"><img src="../img/icon_7.png" alt=""></div></div><div class="listcenter"><div class="lctop"><div class="shopname"><p class="shopname namecom ">' +
|
||||
this.shopName + '</p><p class="infocom shopinfo">' + info +
|
||||
'</p></div><div class="shopname supermaket nc "><p class=" namecom ">商超</p><p class="infocom scinfo ">' +
|
||||
scinfo +
|
||||
'</p></div><div class="shopname commercial nc"><p class=" namecom ">商厦</p><p class="infocom ssinfo ">' +
|
||||
ssinfo + '</p></div><div class="shopname shangdu nc"><p class=" namecom ">商都 </p><p class="infocom sdinfo">' +
|
||||
sdinfo + '</p></div></div><div class="listright"><p class="bj">' + infotext +
|
||||
'</p><p class="del">删除</p></div></div></div>';
|
||||
// html = '<div class="list shadown_wai" data-id="' + this.shopId + ' " data-info="' + this.status +
|
||||
// '"><div class="listleft"><div class="listimg"><img src="../img/icon_7.png" alt=""></div></div><div class="listcenter"><div class="name"><span class="shopname namecom ">' +
|
||||
// this.shopName +
|
||||
// '</span><span class="supermaket namecom nc"></span><span class="commercial namecom nc"></span><span class="shangdu nc namecom"></span></div><div class="info"><p class="infocom shopinfo">' +
|
||||
// info +
|
||||
// '</p><p class="scinfo ic infocom"></p><p class="ssinfo ic infocom"></p><p class="sdinfo ic infocom"></p></div><div class="listright"><p class="bj">' +
|
||||
// infotext +
|
||||
// '</p><p class="del">删除</p></div></div></div>';
|
||||
//
|
||||
$('.con').append(html);
|
||||
})
|
||||
}else{
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
setTimeout(function() {
|
||||
$.each($(".list"), function() {
|
||||
var shop_id = $(this).attr("data-id");
|
||||
if (shop_id == scshopId) {
|
||||
$(this).find($('.listcenter .supermaket')).show()
|
||||
// $(this).find($('.listcenter .supermaket .namecom')).html('商超')
|
||||
// $(this).find($('.listcenter .shopname .scinfo')).show()
|
||||
$(this).find($('.listcenter .shopname .scinfo')).html(scinfo)
|
||||
}
|
||||
if (shop_id == ssshopId) {
|
||||
$(this).find($('.listcenter .commercial')).show()
|
||||
// $(this).find($('.listcenter .commercial .namecom')).html('商厦')
|
||||
// $(this).find($('.listcenter .shopname .ssinfo')).show()
|
||||
$(this).find($('.listcenter .shopname .ssinfo')).html(ssinfo)
|
||||
}
|
||||
if (shop_id == sdshopId) {
|
||||
$(this).find($('.listcenter .shangdu')).show()
|
||||
|
||||
// $(this).find($('.listcenter .shangdu .namecom')).html('商都')
|
||||
// $(this).find($('.listcenter .shopname .sdinfo')).show()
|
||||
|
||||
$(this).find($('.listcenter .shopname .sdinfo')).html(sdinfo)
|
||||
}
|
||||
})
|
||||
}, 1000)
|
||||
// 申请店铺
|
||||
$('.add1').on('tap', function() {
|
||||
JZL.openWindow('applicationopen.html', 'applicationopen.html');
|
||||
})
|
||||
|
||||
//编辑店铺
|
||||
var shopId = '';
|
||||
mui('.con').on('tap', '.bj', function() {
|
||||
shopId = $(this).parents().parents().parents().attr("data-id");
|
||||
var status = $(this).parents().parents().parents().attr("data-info");
|
||||
|
||||
if (1 == status) {
|
||||
JZL.openWindow('myshop.html', shopId, {
|
||||
'shopId': shopId
|
||||
});
|
||||
|
||||
// JZL.openWindow('storeout.html', shopId);
|
||||
} else {
|
||||
JZL.openWindow('applicationopen.html', shopId, {
|
||||
'status': status,
|
||||
'shopId': shopId
|
||||
});
|
||||
// JZL.openWindow('myshop.html', shopId);
|
||||
|
||||
}
|
||||
})
|
||||
mui('.con').on('tap', '.supermaket', function() {
|
||||
if (scinfo != "已通过") {
|
||||
JZL.openWindow('supermarket.html', 'supermarket.html', {
|
||||
scid: scid
|
||||
})
|
||||
}
|
||||
})
|
||||
mui('.con').on('tap', '.commercial', function() {
|
||||
if (ssinfo != "已通过") {
|
||||
JZL.openWindow('commercial.html', 'commercial.html', {
|
||||
ssid: ssid
|
||||
})
|
||||
}
|
||||
})
|
||||
mui('.con').on('tap', '.shangdu', function() {
|
||||
if (sdinfo != "已通过") {
|
||||
JZL.openWindow('shangdu.html', 'shangdu.html', {
|
||||
sdid: sdid
|
||||
})
|
||||
}
|
||||
})
|
||||
//删除店铺
|
||||
mui('.con').on('tap', '.del', function() {
|
||||
|
||||
shopId = $(this).parents().parents().parents().attr("data-id");
|
||||
|
||||
if (confirm('确认删除?')) {
|
||||
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 clearfix"><h3>请输入操作密码</h3><div style="background:linear-gradient(to right,#48D1CC,#FFD700,#D2691E);height:2px; margin:10px auto"></div><input class="payword" type="password" placeholder="请输入操作密码"><div class="lxy_zz_btn"><button class="cancle" type="button">取消</button><button class="sure" type="button">确定</button></div></div></div>';
|
||||
$('body').append(lxy_div);
|
||||
$('.lxy_zz').on('tap', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation()
|
||||
})
|
||||
mui('.lxy_zz_btn').on('tap', '.cancle', function() {
|
||||
$('#home_zhezhao').remove();
|
||||
return;
|
||||
})
|
||||
|
||||
mui('.lxy_zz_btn').on('tap', '.sure', function() {
|
||||
var payPwd = $('.payword').val();
|
||||
if (payPwd == '') {
|
||||
mui.alert("请输入密码")
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/shops/delShop'), {
|
||||
shopId: shopId,
|
||||
payPwd: payPwd
|
||||
}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
console.log(data);
|
||||
if (data.status == 1) {
|
||||
$('#home_zhezhao').remove();
|
||||
mui.toast(data.msg)
|
||||
location.reload()
|
||||
}else{
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
115
js/order_con.js
Normal file
115
js/order_con.js
Normal file
@@ -0,0 +1,115 @@
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
var data_order_id = localStorage.getItem('data_order_id');
|
||||
// //console.log(data_order_id)
|
||||
mui.ajax(hyhUrl('app/Orders/getDetail'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
id: data_order_id
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
var data = toJson(data.data);
|
||||
var html = '<div class="ad shadown_wai"><p>' + data.status + '</p></div><div class="address clearfix shadown_wai"><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.userAddress + '</div></div></div><div class="invoice_info shadown_wai"><p>发票信息</p><p>发票抬头 ' + data.invoiceClient + '</p></div><div class="shop_info shadown_wai"><div class="row_title" data-shopId="' + data.shopId + '"><div class="store_name">' + data.shopName + '</div></div><div class="row_con clearfix">';
|
||||
$.each(data.goods, function() {
|
||||
html += '<div class="row_block clearfix" data-goodsId="' + this.goodsId + '"><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 class="cost"><div class="c1 clearfix"><div class="c1_l">商品总价</div><div class="c1_r">¥' + data.goodsMoney + '</div></div><div class="c1 clearfix"><div class="c1_l">运费(快递)</div><div class="c1_r">¥' + data.deliverMoney + '</div></div><div class="c2 clearfix"><div class="c1_l">订单总价</div><div class="c1_r">¥' + data.totalMoney + '</div></div></div><div class="cost"><div class="c2 clearfix"><div class="c1_l">实付款</div><div class="c1_r on">¥' + data.realTotalMoney + '</div></div></div></div></div><div class="jf_info shadown_wai clearfix"><div class="jf_jf">积分</div><div class="jf_p">奖励积分<o>' + data.orderScore + '</o>点</div></div><a href="tel:' + data.shopTel + '" class="lxmj shadown_wai"><img src="../img/phone1.png" /><p>联系卖家 </p></a><div class="info shadown_wai"><p>订单编号:' + data.orderNo + '</p><p>创建时间:' + data.createTime + '</p>';
|
||||
html += '<div class="cost"><div class="c1 clearfix"><div class="c1_l">商品总价</div><div class="c1_r">¥' + data.goodsMoney + '</div></div><div class="c1 clearfix"><div class="c1_l">运费(快递)</div><div class="c1_r">¥' + data.deliverMoney + '</div></div><div class="c2 clearfix"><div class="c1_l">订单总价</div><div class="c1_r">¥' + data.totalMoney + '</div></div></div><div class="cost"><div class="c2 clearfix"><div class="c1_l">产品券</div><div class="c1_r on">¥' + data.productNum + '【税费:' +data.productHandlingFee+',手续费:'+data.productTaxFee+'】</div></div><div class="c2 clearfix"><div class="c1_l">优惠券</div><div class="c1_r on">¥' + data.couponsNum + '【税费:' +data.couponsHandlingFee+',手续费:'+data.couponsTaxFee+'】</div></div><div class="c2 clearfix"><div class="c1_l">旺旺券</div><div class="c1_r on">¥' + data.wangNum + '</div></div><div class="c2 clearfix"><div class="c1_l">现金</div><div class="c1_r on">¥' + data.moneyNum + '</div></div></div></div></div><a href="tel:' + data.shopTel + '" class="lxmj shadown_wai"><img src="../img/phone1.png" /><p>联系卖家 </p></a><div class="info shadown_wai"><p>订单编号:' + data.orderNo + '</p><p>创建时间:' + data.createTime + '</p>';
|
||||
|
||||
if(data.deliveryTime != null) {
|
||||
html += '<p>发货时间:' + data.deliveryTime + '</p>'
|
||||
}
|
||||
if(data.deliveryTime != null) {
|
||||
html += '<p>成交时间:' + data.receiveTime + '</p>'
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
||||
$('.con').html(html);
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
$('.con').on('tap', '.row_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
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
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', '.row_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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
53
js/order_out.js
Normal file
53
js/order_out.js
Normal file
@@ -0,0 +1,53 @@
|
||||
mui.plusReady(function() {
|
||||
|
||||
var self = plus.webview.currentWebview();
|
||||
var data_order_id = self.data_order_id;
|
||||
var bSize = 64 + (+localStorage.getItem('ipxSizeTop')) + 'px';
|
||||
var sub = plus.webview.create('order_con.html', 'order_con.html', {
|
||||
top: bSize,
|
||||
bottom: '49px',
|
||||
scrollIndicator: 'none'
|
||||
});
|
||||
self.append(sub);
|
||||
localStorage.setItem('data_order_id', data_order_id);
|
||||
if(!data_order_id) {
|
||||
$('#ckwl').css('display', 'none')
|
||||
}
|
||||
mui(".btns").on('tap', '#ckwl', function() {
|
||||
// var tj = plus.webview.create('search.html');
|
||||
// tj.show();
|
||||
// mui.alert(e.target.attributes["data-id"].nodeValue);
|
||||
// //console.log(this.attributes["data-id"].nodeValue);
|
||||
mui.openWindow({
|
||||
url: 'logistics.html',
|
||||
id: 'logistics.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_order_id: data_order_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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
277
js/paymentVoucher.js
Normal file
277
js/paymentVoucher.js
Normal file
@@ -0,0 +1,277 @@
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('reload', function(e) { //执行刷新
|
||||
location.reload();
|
||||
});
|
||||
|
||||
var comName = "山东省全亮共信息科技有限公司";
|
||||
var cardNum = "810102701421013395";
|
||||
var cardBank = "日照银行股份有限公司泰安路支行";
|
||||
$('.comName ').val(comName)
|
||||
$('.comNameBtn').attr("data-value", comName)
|
||||
$('.cardNum ').val(cardNum)
|
||||
$('.cardNumBtn').attr("data-value", cardNum)
|
||||
$('.cardBank ').val(cardBank)
|
||||
$('.cardBankBtn').attr("data-value", cardBank)
|
||||
var self = plus.webview.currentWebview();
|
||||
//console.log(self);
|
||||
var shopId = self.id;
|
||||
var type = 0; //0 huozhe 1
|
||||
|
||||
if ("undefined" != typeof(self.type)) {
|
||||
type = self.type
|
||||
}
|
||||
if (0 == type) {
|
||||
getuncommitted();
|
||||
} else if (1 == type) {
|
||||
getcommitted();
|
||||
}
|
||||
$('.con_con_com').eq(type).show().siblings().hide();
|
||||
$('.con_nav').on("tap", ".nav_header", function() {
|
||||
type = $(this).index();
|
||||
$(this).addClass('active').siblings().removeClass('active');
|
||||
$('.con_con_com').eq(type).show().siblings().hide();
|
||||
if (0 == type) {
|
||||
getuncommitted();
|
||||
} else if (1 == type) {
|
||||
getcommitted();
|
||||
}
|
||||
})
|
||||
$('.committed').on("tap", ".row_title", function() {
|
||||
var idx = $(this).index();
|
||||
// //console.log(idx);
|
||||
$('.row_cont').eq(idx).toggle()
|
||||
})
|
||||
$('.committed').on("tap", ".oper", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation()
|
||||
id = $(this).parents().parents().attr("data-id")
|
||||
id = parseInt(id);
|
||||
//console.log(id);
|
||||
JZL.openWindow("shoperUploadVoucher.html", "shoperUploadVoucher.html", {
|
||||
orderId: id,
|
||||
shopId: shopId
|
||||
})
|
||||
})
|
||||
// $('.btns').on('tap', '.bc_btn', function() {
|
||||
// var idx = $(this).index()
|
||||
// JZL.openWindow("uploadVoucher.html", "uploadVoucher.html")
|
||||
// })
|
||||
// 获取未提交凭证
|
||||
getuncommitted();
|
||||
|
||||
function getuncommitted() {
|
||||
JZL.ajax(qlgUrl('app/Shoporders/getCertificate'), {
|
||||
shopId: shopId,
|
||||
type: 0
|
||||
}, function(data) {
|
||||
//console.log(data)
|
||||
if ("undefined" != typeof data.data) {
|
||||
|
||||
var html = '';
|
||||
var youhui = 0;
|
||||
var payable = 0;
|
||||
mui.each(data.data, function() {
|
||||
payable = Math.abs(this.payable);
|
||||
youhui = Math.abs(youhui) + payable;
|
||||
|
||||
html += '<div class="row shadown_wai" data-orderNo="' + this.orderNo + '" data-id="' + this.orderId +
|
||||
'"><div class="row_title"><div class="row_title_"><input type="checkbox" name="check1" class="check1" data-payable=' +
|
||||
payable + ' value="" checked/><label class="store_name">订单编号:' +
|
||||
this.orderNo + ' </label></div><div class="indent_status"><span>' + this.status +
|
||||
'</span> </div><div class="indent_youhui">优惠款<span>' + payable +
|
||||
'</span> </div></div><div class="row_con clearfix" data-id=""><div class="row_block clearfix">'
|
||||
|
||||
mui.each(this.list, function() {
|
||||
|
||||
html += '<div class="row_block_list"><div class="row_block_img"><img src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" /></div><div class="rcr clearfix"><div class="rcrc"><p>' + this.goodsName + '</p><p class="leibie">' +
|
||||
this.goodsSpecNames + '</p></div></div><div class="rcrr"><p>¥' + this.goodsPrice + '</p></div></div>'
|
||||
});
|
||||
youhui = youhui.toFixed(2);
|
||||
html += '</div><div class="combination"> 共' + this.list.length + '件商品 合计<o>¥' + this.realTotalMoney +
|
||||
'</o>(含运费¥' + this.deliverMoney + ')</div><div class="combination create_time shadown_wai">订单完成时间:' + this.receiveTime +
|
||||
'</div></div></div></div>'
|
||||
|
||||
})
|
||||
html +=
|
||||
'<div class="btns clearfix"><input type="checkbox" name="" id="checkall" value="" checked /><label for="checkall">全选</label><div class="combination_totle">共<span class= "orderNo">' +
|
||||
data.data.length + '</span>笔订单 优惠款<span class="youhuiNo">' + youhui +
|
||||
'</span></div><div class="bc_btn">提交凭证</div></div>'
|
||||
} else {
|
||||
|
||||
html = '<p style="float: left;width: 100%;text-align: center;padding: 10px;">没有更多订单了</p>';
|
||||
// html = '<div class="row_title_ shadown_wai clearfix"><label>没有需要提交的订单</label></div>'
|
||||
}
|
||||
$('.uncommitted .con_con_com_').html(html);
|
||||
})
|
||||
}
|
||||
var i = 0;
|
||||
//全选或者全不选
|
||||
$('body').on('change', '#checkall', function() {
|
||||
checkAll('.check1', $(this).prop("checked"));
|
||||
if (false == $(this).prop("checked")) {
|
||||
$('.orderNo').html("0")
|
||||
$('.youhuiNo').html("0")
|
||||
} else {
|
||||
var youhui = 0;
|
||||
$('.orderNo').html($('.check1').length)
|
||||
mui.each($('.indent_youhui span'), function() {
|
||||
youhui += Number($(this).text())
|
||||
})
|
||||
$('.youhuiNo').html(youhui)
|
||||
}
|
||||
// if (0 == i) {
|
||||
// $('input[name="check1"]').prop('checked', true);
|
||||
// i = 1;
|
||||
// } else {
|
||||
// / $('input[name="check1"]').prop('checked', false);
|
||||
// i = 0;
|
||||
// }
|
||||
})
|
||||
// checkAll('.check1',$('#checkall').checked);
|
||||
function checkAll(domName, isChecked) {
|
||||
//console.log(isChecked);
|
||||
$(domName).prop("checked", isChecked);
|
||||
}
|
||||
|
||||
function checkNum() {
|
||||
var length = $('input[name=check1]:checked').length;
|
||||
var len = $('input[name=check1]').length;
|
||||
|
||||
if (length == len) {
|
||||
$('#checkall').prop('checked', true);
|
||||
} else {
|
||||
$('#checkall').prop('checked', false);
|
||||
}
|
||||
var youhui = 0;
|
||||
$.each($('input[name="check1"]:checked'), function() {
|
||||
youhui += Number($(this).attr('data-payable'));
|
||||
|
||||
})
|
||||
$('.orderNo').html(length);
|
||||
$('.youhuiNo').html(youhui);
|
||||
|
||||
}
|
||||
$('body').on('change', '.check1', function() {
|
||||
checkNum();
|
||||
})
|
||||
var click = 0
|
||||
$('body').on('tap', ".bc_btn", function() {
|
||||
if (0 == $('input[name="check1"]:checked').length) {
|
||||
mui.alert("请选择至少一个订单")
|
||||
return;
|
||||
}
|
||||
if (1 == click) {
|
||||
return;
|
||||
}
|
||||
click = 1;
|
||||
var orderIdsArr = [];
|
||||
$.each($('input[name="check1"]:checked'), function() {
|
||||
orderIdsArr.push($(this).parents().parents().parents().attr('data-id'))
|
||||
})
|
||||
orderIds = orderIdsArr.join(',')
|
||||
|
||||
|
||||
JZL.openWindow("shoperUploadVoucher.html", "shoperUploadVoucher.html", {
|
||||
shopId: shopId,
|
||||
orderIds: orderIds
|
||||
})
|
||||
})
|
||||
var isjiazai = false;
|
||||
|
||||
function getcommitted(page, PerPage) {
|
||||
var recommenddata = {
|
||||
page: page ? page : 1,
|
||||
PerPage: PerPage ? PerPage : 10
|
||||
}
|
||||
if (isjiazai == true) {
|
||||
return;
|
||||
}
|
||||
isjiazai = true;
|
||||
|
||||
|
||||
JZL.ajax(qlgUrl('app/Shoporders/getCertificate'), {
|
||||
shopId: shopId,
|
||||
type: 1
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
var data = data.data;
|
||||
var html = '';
|
||||
var totPayable = 0;
|
||||
if (data.Rows == '') {
|
||||
$('.committed ').append(
|
||||
'<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多订单了</p>');
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
totPayable = 0;
|
||||
if ("已通过" == this.statusStr) {
|
||||
html += '<div class="row shadown_wai" data-id="' + this.id +
|
||||
'"><div class="row_title "><span class="created_time">提交时间:' + this.createTime +
|
||||
'</span><span class="indent_status">' + this.statusStr + '</span></div><div class="row_cont">'
|
||||
} else {
|
||||
html += '<div class="row shadown_wai" data-id="' + this.id +
|
||||
'"><div class="row_title "><span class="created_time">提交时间:' + this.createTime +
|
||||
'</span><span class="indent_status">' + this.statusStr +
|
||||
'</span><span class="oper"><img src="../img/bianji9.png"></span></div><div class="row_cont">'
|
||||
}
|
||||
|
||||
$.each(this.list, function() {
|
||||
totPayable += Number(this.payable)
|
||||
html += ' <div class="row_block_list"><div class="order_num">订单编号:' + this.orderNo +
|
||||
'</div><div class="discount_amount">优惠金额:' + this.payable + '</div></div>'
|
||||
})
|
||||
totPayable = totPayable.toFixed(2)
|
||||
|
||||
html += '<div class="combination">总计优惠款:' + totPayable + '</div></div></div>'
|
||||
})
|
||||
if (page == 1) {
|
||||
$('.committed').html(html);
|
||||
} else {
|
||||
$('.committed').append(html);
|
||||
}
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
mui('body').on('tap', '.btn', function() {
|
||||
// 每次触发事件就会使用 innerText 获取纯文本。
|
||||
var copy_content = $(this).attr("data-value");
|
||||
|
||||
// var copy_content = this.innerText;
|
||||
// 加了一个确认框 让用户选择是否复制
|
||||
// mui.confirm('您要复制内容吗?', '小禾CRM', ['取消', '复制内容'], function (e) {
|
||||
// if (e.index == 1) {
|
||||
//判断是安卓还是ios
|
||||
if (mui.os.ios) {
|
||||
// ios 的方法 这个我没具体研究过 直接拿来用了
|
||||
var UIPasteboard = plus.ios.importClass("UIPasteboard");
|
||||
var generalPasteboard = UIPasteboard.generalPasteboard();
|
||||
//设置 复制的内容也就是 触发事件 innerText 获取的内容
|
||||
generalPasteboard.plusCallMethod({
|
||||
setValue: copy_content,
|
||||
forPasteboardType: "public.utf8-plain-text"
|
||||
});
|
||||
generalPasteboard.plusCallMethod({
|
||||
valueForPasteboardType: "public.utf8-plain-text"
|
||||
});
|
||||
// 在上边都走完 给用户一个提示
|
||||
mui.toast('复制成功')
|
||||
} 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);
|
||||
// 在上边都走完 给用户一个提示
|
||||
mui.toast('复制成功')
|
||||
}
|
||||
// }
|
||||
})
|
||||
|
||||
|
||||
|
||||
})
|
||||
4
js/perfect-scrollbar.min.js
vendored
Normal file
4
js/perfect-scrollbar.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
js/photoswipe-ui-default.min.js
vendored
Normal file
4
js/photoswipe-ui-default.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3734
js/photoswipe.js
Normal file
3734
js/photoswipe.js
Normal file
File diff suppressed because it is too large
Load Diff
236
js/pj.js
Normal file
236
js/pj.js
Normal file
@@ -0,0 +1,236 @@
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
var self = plus.webview.currentWebview();
|
||||
var data_order_id = self.data_order_id;
|
||||
mui.ajax(qlgUrl('app/Orders/getOrderAppraise'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
oId: data_order_id
|
||||
},
|
||||
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 = '';
|
||||
var i = 0;
|
||||
$.each(data.Rows, function() {
|
||||
if (this.appraise == null) {
|
||||
html += '<div class="con_1"data-goodsId="' + this.goodsId + '"data-goodsSpecId="' + this.goodsSpecId +
|
||||
'"data-orderId="' + this.orderId + '"data-orderGoodsId="' + this.id +
|
||||
'"><div class="describe"><div class="des_img"><img src="' + hyhImgUrl(this.goodsImg) + '"/></div><p>' +
|
||||
this.goodsName +
|
||||
'</p></div><div class="row"data-class="goodsScore"data-goodsScore="0"><p>商品评分</p><div class="star"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="row"data-class="serviceScore"data-serviceScore="0"><p>服务评分</p><div class="star"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="row"data-class="timeScore"data-timeScore="0"><p>时效评分</p><div class="star"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="purchase"><textarea class="content"name=""rows=""cols=""placeholder="分享你的购买心得"></textarea><div class="up_out"><div id="ossfile' +
|
||||
i + '" class="ossfile clearfix" data-num="' + i +
|
||||
'">你的浏览器不支持flash,Silverlight或者HTML5!</div><div id="container' + i + '" class="container" data-num="' + i +
|
||||
'"><a id="selectfiles' + i + '" href="javascript:void(0);" class="btn selectfiles" data-num="' + i +
|
||||
'">选择图片</a></div></div></div><button class="tijiao">提交评价</button></div>'
|
||||
i++;
|
||||
} else {
|
||||
html += '<div class="con_1"data-goodsId="' + this.goodsId + '"data-goodsSpecId="' + this.goodsSpecId +
|
||||
'"data-orderId="' + data.orderId + '"data-orderGoodsId="' + this.orderId +
|
||||
'"><div class="describe"><div class="des_img"><img src="' + hyhImgUrl(this.goodsImg) + '"/></div><p>' +
|
||||
this.goodsName + '</p></div><div class="row"data-class="goodsScore"data-goodsScore="' + this.appraise.goodsScore +
|
||||
'"><p>商品评分</p><div class="star"data-isPj="1"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="row"data-class="serviceScore"data-serviceScore="' +
|
||||
this.appraise.serviceScore +
|
||||
'"><p>服务评分</p><div class="star"data-isPj="1"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="row"data-class="timeScore"data-timeScore="' +
|
||||
this.appraise.timeScore +
|
||||
'"><p>时效评分</p><div class="star"data-isPj="1"><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div><div class="star_a"><div class="star_off"></div></div></div></div><div class="purchase_"><p>' +
|
||||
this.appraise.content + '</p>'
|
||||
|
||||
$.each(this.appraise.images, function() {
|
||||
html += '<img src="' + hyhImgUrl(this) + '"/>'
|
||||
});
|
||||
|
||||
|
||||
|
||||
html += '</div></div>';
|
||||
}
|
||||
});
|
||||
$('.con').html(html)
|
||||
$('.star').each(function() {
|
||||
if ($(this).attr('data-isPj') == 1) {
|
||||
var num = +$(this).parent().attr('data-' + $(this).parent().attr('data-class')) - 1
|
||||
$(this).children().eq(num).children().addClass('star_on').removeClass('star_off')
|
||||
$(this).children().eq(num).prevAll().children().addClass('star_on').removeClass('star_off')
|
||||
$(this).children().eq(num).nextAll().children().addClass('star_off').removeClass('star_on')
|
||||
}
|
||||
})
|
||||
var btnArr = [];
|
||||
|
||||
$('.selectfiles').each(function(num) {
|
||||
btnArr.push($(this).attr('id'));
|
||||
})
|
||||
|
||||
$.each(btnArr, function(i, n) {
|
||||
var self = this.toString();
|
||||
var that = document.getElementById(this);
|
||||
var uploader = new plupload.Uploader({
|
||||
runtimes: 'html5,flash,silverlight,html4',
|
||||
browse_button: self,
|
||||
//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',
|
||||
dir: 'appraises',
|
||||
|
||||
filters: {
|
||||
mime_types: [ //只允许上传图片和zip,rar文件
|
||||
{
|
||||
title: "Image files",
|
||||
extensions: "jpg,gif,png,bmp"
|
||||
},
|
||||
{
|
||||
title: "Zip files",
|
||||
extensions: "zip,rar"
|
||||
}
|
||||
],
|
||||
max_file_size: '10mb', //最大只能上传10mb的文件
|
||||
prevent_duplicates: true //不允许选取重复文件
|
||||
},
|
||||
|
||||
init: {
|
||||
PostInit: function() {
|
||||
document.getElementsByClassName('ossfile')[i].innerHTML = '';
|
||||
// document.getElementById('postfiles').onclick = function() {
|
||||
// set_upload_param(uploader, '', false);
|
||||
// return false;
|
||||
// };
|
||||
uploader.bind('FilesAdded', function() {
|
||||
set_upload_param(uploader, '', false, 'appraises');
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
FilesAdded: function(up, files) {
|
||||
plupload.each(files, function(file) {
|
||||
document.getElementsByClassName('ossfile')[i].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();
|
||||
});
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
$('.con').on('tap', '.star_a', function() {
|
||||
if ($(this).parent().attr('data-isPj') == 1) {
|
||||
return;
|
||||
}
|
||||
$(this).children().addClass('star_on').removeClass('star_off');
|
||||
$(this).prevAll().children().addClass('star_on').removeClass('star_off');
|
||||
$(this).nextAll().children().addClass('star_off').removeClass('star_on');
|
||||
$(this).parent().parent().attr('data-' + $(this).parent().parent().attr('data-class'), $(this).index() + 1);
|
||||
})
|
||||
|
||||
$('.con').on('tap', '.tijiao', function() {
|
||||
var goodsId = $(this).parent().attr('data-goodsId');
|
||||
var goodsSpecId = $(this).parent().attr('data-goodsSpecId');
|
||||
var orderId = $(this).parent().attr('data-orderId');
|
||||
var orderGoodsId = $(this).parent().attr('data-orderGoodsId');
|
||||
var timeScore = $(this).siblings('.row[data-class*=timeScore]').attr('data-timeScore');
|
||||
var goodsScore = $(this).siblings('.row[data-class*=goodsScore]').attr('data-goodsScore');
|
||||
var serviceScore = $(this).siblings('.row[data-class*=serviceScore]').attr('data-serviceScore');
|
||||
var content = $(this).siblings('.purchase').children('textarea').val();
|
||||
var that = $(this);
|
||||
var imagesArr = [];
|
||||
$(this).siblings('.purchase').children('.up_out').children('.ossfile').children('.files_out').children('b').children(
|
||||
'img').each(function() {
|
||||
imagesArr.push($(this).attr('data-src'))
|
||||
})
|
||||
var images = imagesArr.join(',');
|
||||
if (timeScore == 0 || serviceScore == 0 || serviceScore == 0) {
|
||||
mui.alert('评分必须1-5分之间!');
|
||||
return;
|
||||
}
|
||||
if (content.length < 3) {
|
||||
mui.alert('评论最少3个字!');
|
||||
return;
|
||||
}
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/Goodsappraises/add'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
goodsId: goodsId,
|
||||
goodsSpecId: goodsSpecId,
|
||||
orderId: orderId,
|
||||
orderGoodsId: orderGoodsId,
|
||||
timeScore: timeScore,
|
||||
goodsScore: goodsScore,
|
||||
serviceScore: serviceScore,
|
||||
content: content,
|
||||
images: images
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
mui.alert(data.msg)
|
||||
if (data.status == 1) {
|
||||
location.reload();
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
28
js/plupload.full.min.js
vendored
Normal file
28
js/plupload.full.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
106
js/properties.js
Normal file
106
js/properties.js
Normal file
@@ -0,0 +1,106 @@
|
||||
mui.plusReady(function() {
|
||||
|
||||
window.addEventListener('reload', function(e) { //执行刷新
|
||||
location.reload();
|
||||
});
|
||||
var self = plus.webview.currentWebview();
|
||||
//console.log(self);
|
||||
var shopId = self.id;
|
||||
//console.log(shopId);
|
||||
var page = 1;
|
||||
var pageSize = 10;
|
||||
var isloading = false;
|
||||
getRecommend(page, pageSize);
|
||||
|
||||
function getRecommend(page, pageSize) {
|
||||
var recommenddata = {
|
||||
page: page ? page : 1,
|
||||
pageSize: pageSize ? pageSize : 10
|
||||
}
|
||||
recommenddata.shopId = shopId
|
||||
if (isloading == true) {
|
||||
return;
|
||||
} else {
|
||||
isloading = false;
|
||||
}
|
||||
isloading == true
|
||||
JZL.ajax(qlgUrl("app/shops/getSpecs"), recommenddata, function(data) {
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
if ('' == data.Rows) {
|
||||
//console.log("去" );
|
||||
$('.con').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" data-id="' + this.id + '"><label>' + this.setName +
|
||||
'</label><div class="caozuo"><span class="bj"><img src="../img/bianji.png"></span><span class="del"><img src="../img/delete.png"></span></div></div>'
|
||||
|
||||
if (page == 1) {
|
||||
$('.con_con').html(html);
|
||||
} else {
|
||||
$('.con_con').append(html);
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
isloading == false;
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isloading == true) {
|
||||
page++;
|
||||
getRecommend(page, pageSize);
|
||||
}
|
||||
}
|
||||
})
|
||||
var specCatsId = "";
|
||||
mui('.con').on('tap', '.bj', function() {
|
||||
|
||||
// //console.log(1);
|
||||
specCatsId = $(this).parent().parent().attr("data-id");
|
||||
//console.log(specCatsId);
|
||||
var setName = $(this).parent().parent().find("label").text();
|
||||
//console.log(setName);
|
||||
|
||||
JZL.openWindow("addproperties.html", parseInt(shopId), {
|
||||
"specCatsId": specCatsId,
|
||||
"setName": setName
|
||||
})
|
||||
})
|
||||
//删除
|
||||
$('.con').on('tap', '.del', function() {
|
||||
specCatsId = $(this).parent().parent().attr("data-id");
|
||||
|
||||
if (confirm('确认删除?')) {
|
||||
JZL.ajax(qlgUrl('app/shops/delSpecSet'), {
|
||||
id: specCatsId,
|
||||
shopId: shopId
|
||||
}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
//console.log(1);
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
|
||||
location.reload()
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
$('.add1').on('tap', function() {
|
||||
JZL.openWindow('addproperties.html',parseInt(shopId));
|
||||
})
|
||||
|
||||
})
|
||||
111
js/qrbb.js
Normal file
111
js/qrbb.js
Normal file
@@ -0,0 +1,111 @@
|
||||
mui.plusReady(function() {
|
||||
|
||||
window.addEventListener('reload', function(e) { //执行刷新
|
||||
location.reload();
|
||||
});
|
||||
var page = 1;
|
||||
var pageSize = 10;
|
||||
// var isloading = false;
|
||||
getRecommend();
|
||||
|
||||
function getRecommend() {
|
||||
|
||||
// //console.log(recommenddata);
|
||||
//获取亲人报备列表
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthFamilyReportSelect'), {}, function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data);
|
||||
if (data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
if (data == '') {
|
||||
$('.con').append('<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多数据</p>');
|
||||
return;
|
||||
}
|
||||
$.each(data, function() {
|
||||
html += '<div class="block clearfix" data-id="' + this.id +
|
||||
'"><p class="pname">' + this.familyName + '(' + this.familyRelations +
|
||||
')</p><div class="caozuo"><span class="bj" data-id="' + this.id +
|
||||
'"><img src="../img/bianji.png"></span><span class="del" data-id="' + this.id +
|
||||
'"><img src="../img/delete.png"></span></div></div>';
|
||||
})
|
||||
$('.con').html(html);
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
// document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
// if (scroll.y == scroll.maxScrollY) {
|
||||
// if (isloading == true) {
|
||||
// page++;
|
||||
// getRecommend(page, pageSize);
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
var qrbbid;
|
||||
mui('.con').on('tap', '.bj', function() {
|
||||
qrbbid = $(this).attr('data-id')
|
||||
|
||||
JZL.openWindow('addqrbb.html', qrbbid);
|
||||
|
||||
})
|
||||
$('.con').on('tap', '.del', function() {
|
||||
qrbbid = $(this).attr('data-id')
|
||||
if (confirm('确认删除?')) {
|
||||
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 clearfix"><h3>请输入操作密码</h3><div style="background:linear-gradient(to right,#48D1CC,#FFD700,#D2691E);height:5px; margin:10px auto"></div><input class="payword" type="password" placeholder="请输入操作密码"><div class="lxy_zz_btn"><button class="cancle" type="button">取消</button><button class="sure" type="button">确定</button></div></div></div>';
|
||||
|
||||
$('body').append(lxy_div);
|
||||
|
||||
$('.lxy_zz').on('tap', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation()
|
||||
})
|
||||
mui('.lxy_zz_btn').on('tap', '.cancle', function() {
|
||||
// $('#home_zhezhao').css('display', 'none');
|
||||
$('#home_zhezhao').remove();
|
||||
return;
|
||||
|
||||
})
|
||||
|
||||
mui('.lxy_zz_btn').on('tap', '.sure', function() {
|
||||
var payPwd = $('.payword').val();
|
||||
//console.log(payPwd);
|
||||
if (payPwd == '') {
|
||||
mui.alert("请输入密码")
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/auth/delAuthFamily'), {
|
||||
isReport: 1,
|
||||
id: qrbbid,
|
||||
payPwd: payPwd
|
||||
}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data);
|
||||
var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
$('#home_zhezhao').remove();
|
||||
location.reload()
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
/* mui('.mui-content').on('tap','.qrrz',function(){
|
||||
JZL.openWindow('qrrz.html', 'qrrz.html');
|
||||
|
||||
}) */
|
||||
$('.add1').on('tap', function() {
|
||||
JZL.openWindow('addqrbb.html', 'addqrbb.html');
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
614
js/qrcode.js
Normal file
614
js/qrcode.js
Normal file
@@ -0,0 +1,614 @@
|
||||
/**
|
||||
* @fileoverview
|
||||
* - Using the 'QRCode for Javascript library'
|
||||
* - Fixed dataset of 'QRCode for Javascript library' for support full-spec.
|
||||
* - this library has no dependencies.
|
||||
*
|
||||
* @author davidshimjs
|
||||
* @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a>
|
||||
* @see <a href="http://jeromeetienne.github.com/jquery-qrcode/" target="_blank">http://jeromeetienne.github.com/jquery-qrcode/</a>
|
||||
*/
|
||||
var QRCode;
|
||||
|
||||
(function () {
|
||||
//---------------------------------------------------------------------
|
||||
// QRCode for JavaScript
|
||||
//
|
||||
// Copyright (c) 2009 Kazuhiko Arase
|
||||
//
|
||||
// URL: http://www.d-project.com/
|
||||
//
|
||||
// Licensed under the MIT license:
|
||||
// http://www.opensource.org/licenses/mit-license.php
|
||||
//
|
||||
// The word "QR Code" is registered trademark of
|
||||
// DENSO WAVE INCORPORATED
|
||||
// http://www.denso-wave.com/qrcode/faqpatent-e.html
|
||||
//
|
||||
//---------------------------------------------------------------------
|
||||
function QR8bitByte(data) {
|
||||
this.mode = QRMode.MODE_8BIT_BYTE;
|
||||
this.data = data;
|
||||
this.parsedData = [];
|
||||
|
||||
// Added to support UTF-8 Characters
|
||||
for (var i = 0, l = this.data.length; i < l; i++) {
|
||||
var byteArray = [];
|
||||
var code = this.data.charCodeAt(i);
|
||||
|
||||
if (code > 0x10000) {
|
||||
byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);
|
||||
byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);
|
||||
byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);
|
||||
byteArray[3] = 0x80 | (code & 0x3F);
|
||||
} else if (code > 0x800) {
|
||||
byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);
|
||||
byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);
|
||||
byteArray[2] = 0x80 | (code & 0x3F);
|
||||
} else if (code > 0x80) {
|
||||
byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);
|
||||
byteArray[1] = 0x80 | (code & 0x3F);
|
||||
} else {
|
||||
byteArray[0] = code;
|
||||
}
|
||||
|
||||
this.parsedData.push(byteArray);
|
||||
}
|
||||
|
||||
this.parsedData = Array.prototype.concat.apply([], this.parsedData);
|
||||
|
||||
if (this.parsedData.length != this.data.length) {
|
||||
this.parsedData.unshift(191);
|
||||
this.parsedData.unshift(187);
|
||||
this.parsedData.unshift(239);
|
||||
}
|
||||
}
|
||||
|
||||
QR8bitByte.prototype = {
|
||||
getLength: function (buffer) {
|
||||
return this.parsedData.length;
|
||||
},
|
||||
write: function (buffer) {
|
||||
for (var i = 0, l = this.parsedData.length; i < l; i++) {
|
||||
buffer.put(this.parsedData[i], 8);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function QRCodeModel(typeNumber, errorCorrectLevel) {
|
||||
this.typeNumber = typeNumber;
|
||||
this.errorCorrectLevel = errorCorrectLevel;
|
||||
this.modules = null;
|
||||
this.moduleCount = 0;
|
||||
this.dataCache = null;
|
||||
this.dataList = [];
|
||||
}
|
||||
|
||||
QRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+","+col);}
|
||||
return this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row<this.moduleCount;row++){this.modules[row]=new Array(this.moduleCount);for(var col=0;col<this.moduleCount;col++){this.modules[row][col]=null;}}
|
||||
this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(test,maskPattern);if(this.typeNumber>=7){this.setupTypeNumber(test);}
|
||||
if(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);}
|
||||
this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}}
|
||||
return pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row<this.modules.length;row++){var y=row*cs;for(var col=0;col<this.modules[row].length;col++){var x=col*cs;var dark=this.modules[row][col];if(dark){qr_mc.beginFill(0,100);qr_mc.moveTo(x,y);qr_mc.lineTo(x+cs,y);qr_mc.lineTo(x+cs,y+cs);qr_mc.lineTo(x,y+cs);qr_mc.endFill();}}}
|
||||
return qr_mc;},setupTimingPattern:function(){for(var r=8;r<this.moduleCount-8;r++){if(this.modules[r][6]!=null){continue;}
|
||||
this.modules[r][6]=(r%2==0);}
|
||||
for(var c=8;c<this.moduleCount-8;c++){if(this.modules[6][c]!=null){continue;}
|
||||
this.modules[6][c]=(c%2==0);}},setupPositionAdjustPattern:function(){var pos=QRUtil.getPatternPosition(this.typeNumber);for(var i=0;i<pos.length;i++){for(var j=0;j<pos.length;j++){var row=pos[i];var col=pos[j];if(this.modules[row][col]!=null){continue;}
|
||||
for(var r=-2;r<=2;r++){for(var c=-2;c<=2;c++){if(r==-2||r==2||c==-2||c==2||(r==0&&c==0)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}}}},setupTypeNumber:function(test){var bits=QRUtil.getBCHTypeNumber(this.typeNumber);for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;}
|
||||
for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}}
|
||||
for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}}
|
||||
this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex<data.length){dark=(((data[byteIndex]>>>bitIndex)&1)==1);}
|
||||
var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;}
|
||||
this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}}
|
||||
row+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;i<dataList.length;i++){var data=dataList[i];buffer.put(data.mode,4);buffer.put(data.getLength(),QRUtil.getLengthInBits(data.mode,typeNumber));data.write(buffer);}
|
||||
var totalDataCount=0;for(var i=0;i<rsBlocks.length;i++){totalDataCount+=rsBlocks[i].dataCount;}
|
||||
if(buffer.getLengthInBits()>totalDataCount*8){throw new Error("code length overflow. ("
|
||||
+buffer.getLengthInBits()
|
||||
+">"
|
||||
+totalDataCount*8
|
||||
+")");}
|
||||
if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);}
|
||||
while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);}
|
||||
while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;}
|
||||
buffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;}
|
||||
buffer.put(QRCodeModel.PAD1,8);}
|
||||
return QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r<rsBlocks.length;r++){var dcCount=rsBlocks[r].dataCount;var ecCount=rsBlocks[r].totalCount-dcCount;maxDcCount=Math.max(maxDcCount,dcCount);maxEcCount=Math.max(maxEcCount,ecCount);dcdata[r]=new Array(dcCount);for(var i=0;i<dcdata[r].length;i++){dcdata[r][i]=0xff&buffer.buffer[i+offset];}
|
||||
offset+=dcCount;var rsPoly=QRUtil.getErrorCorrectPolynomial(ecCount);var rawPoly=new QRPolynomial(dcdata[r],rsPoly.getLength()-1);var modPoly=rawPoly.mod(rsPoly);ecdata[r]=new Array(rsPoly.getLength()-1);for(var i=0;i<ecdata[r].length;i++){var modIndex=i+modPoly.getLength()-ecdata[r].length;ecdata[r][i]=(modIndex>=0)?modPoly.get(modIndex):0;}}
|
||||
var totalCodeCount=0;for(var i=0;i<rsBlocks.length;i++){totalCodeCount+=rsBlocks[i].totalCount;}
|
||||
var data=new Array(totalCodeCount);var index=0;for(var i=0;i<maxDcCount;i++){for(var r=0;r<rsBlocks.length;r++){if(i<dcdata[r].length){data[index++]=dcdata[r][i];}}}
|
||||
for(var i=0;i<maxEcCount;i++){for(var r=0;r<rsBlocks.length;r++){if(i<ecdata[r].length){data[index++]=ecdata[r][i];}}}
|
||||
return data;};var QRMode={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3};var QRErrorCorrectLevel={L:1,M:0,Q:3,H:2};var QRMaskPattern={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var QRUtil={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:(1<<10)|(1<<8)|(1<<5)|(1<<4)|(1<<2)|(1<<1)|(1<<0),G18:(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<5)|(1<<2)|(1<<0),G15_MASK:(1<<14)|(1<<12)|(1<<10)|(1<<4)|(1<<1),getBCHTypeInfo:function(data){var d=data<<10;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)>=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));}
|
||||
return((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));}
|
||||
return(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;}
|
||||
return digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error("bad maskPattern:"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i<errorCorrectLength;i++){a=a.multiply(new QRPolynomial([1,QRMath.gexp(i)],0));}
|
||||
return a;},getLengthInBits:function(mode,type){if(1<=type&&type<10){switch(mode){case QRMode.MODE_NUMBER:return 10;case QRMode.MODE_ALPHA_NUM:return 9;case QRMode.MODE_8BIT_BYTE:return 8;case QRMode.MODE_KANJI:return 8;default:throw new Error("mode:"+mode);}}else if(type<27){switch(mode){case QRMode.MODE_NUMBER:return 12;case QRMode.MODE_ALPHA_NUM:return 11;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 10;default:throw new Error("mode:"+mode);}}else if(type<41){switch(mode){case QRMode.MODE_NUMBER:return 14;case QRMode.MODE_ALPHA_NUM:return 13;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 12;default:throw new Error("mode:"+mode);}}else{throw new Error("type:"+type);}},getLostPoint:function(qrCode){var moduleCount=qrCode.getModuleCount();var lostPoint=0;for(var row=0;row<moduleCount;row++){for(var col=0;col<moduleCount;col++){var sameCount=0;var dark=qrCode.isDark(row,col);for(var r=-1;r<=1;r++){if(row+r<0||moduleCount<=row+r){continue;}
|
||||
for(var c=-1;c<=1;c++){if(col+c<0||moduleCount<=col+c){continue;}
|
||||
if(r==0&&c==0){continue;}
|
||||
if(dark==qrCode.isDark(row+r,col+c)){sameCount++;}}}
|
||||
if(sameCount>5){lostPoint+=(3+sameCount-5);}}}
|
||||
for(var row=0;row<moduleCount-1;row++){for(var col=0;col<moduleCount-1;col++){var count=0;if(qrCode.isDark(row,col))count++;if(qrCode.isDark(row+1,col))count++;if(qrCode.isDark(row,col+1))count++;if(qrCode.isDark(row+1,col+1))count++;if(count==0||count==4){lostPoint+=3;}}}
|
||||
for(var row=0;row<moduleCount;row++){for(var col=0;col<moduleCount-6;col++){if(qrCode.isDark(row,col)&&!qrCode.isDark(row,col+1)&&qrCode.isDark(row,col+2)&&qrCode.isDark(row,col+3)&&qrCode.isDark(row,col+4)&&!qrCode.isDark(row,col+5)&&qrCode.isDark(row,col+6)){lostPoint+=40;}}}
|
||||
for(var col=0;col<moduleCount;col++){for(var row=0;row<moduleCount-6;row++){if(qrCode.isDark(row,col)&&!qrCode.isDark(row+1,col)&&qrCode.isDark(row+2,col)&&qrCode.isDark(row+3,col)&&qrCode.isDark(row+4,col)&&!qrCode.isDark(row+5,col)&&qrCode.isDark(row+6,col)){lostPoint+=40;}}}
|
||||
var darkCount=0;for(var col=0;col<moduleCount;col++){for(var row=0;row<moduleCount;row++){if(qrCode.isDark(row,col)){darkCount++;}}}
|
||||
var ratio=Math.abs(100*darkCount/moduleCount/moduleCount-50)/5;lostPoint+=ratio*10;return lostPoint;}};var QRMath={glog:function(n){if(n<1){throw new Error("glog("+n+")");}
|
||||
return QRMath.LOG_TABLE[n];},gexp:function(n){while(n<0){n+=255;}
|
||||
while(n>=256){n-=255;}
|
||||
return QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<<i;}
|
||||
for(var i=8;i<256;i++){QRMath.EXP_TABLE[i]=QRMath.EXP_TABLE[i-4]^QRMath.EXP_TABLE[i-5]^QRMath.EXP_TABLE[i-6]^QRMath.EXP_TABLE[i-8];}
|
||||
for(var i=0;i<255;i++){QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]]=i;}
|
||||
function QRPolynomial(num,shift){if(num.length==undefined){throw new Error(num.length+"/"+shift);}
|
||||
var offset=0;while(offset<num.length&&num[offset]==0){offset++;}
|
||||
this.num=new Array(num.length-offset+shift);for(var i=0;i<num.length-offset;i++){this.num[i]=num[i+offset];}}
|
||||
QRPolynomial.prototype={get:function(index){return this.num[index];},getLength:function(){return this.num.length;},multiply:function(e){var num=new Array(this.getLength()+e.getLength()-1);for(var i=0;i<this.getLength();i++){for(var j=0;j<e.getLength();j++){num[i+j]^=QRMath.gexp(QRMath.glog(this.get(i))+QRMath.glog(e.get(j)));}}
|
||||
return new QRPolynomial(num,0);},mod:function(e){if(this.getLength()-e.getLength()<0){return this;}
|
||||
var ratio=QRMath.glog(this.get(0))-QRMath.glog(e.get(0));var num=new Array(this.getLength());for(var i=0;i<this.getLength();i++){num[i]=this.get(i);}
|
||||
for(var i=0;i<e.getLength();i++){num[i]^=QRMath.gexp(QRMath.glog(e.get(i))+ratio);}
|
||||
return new QRPolynomial(num,0).mod(e);}};function QRRSBlock(totalCount,dataCount){this.totalCount=totalCount;this.dataCount=dataCount;}
|
||||
QRRSBlock.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];QRRSBlock.getRSBlocks=function(typeNumber,errorCorrectLevel){var rsBlock=QRRSBlock.getRsBlockTable(typeNumber,errorCorrectLevel);if(rsBlock==undefined){throw new Error("bad rs block @ typeNumber:"+typeNumber+"/errorCorrectLevel:"+errorCorrectLevel);}
|
||||
var length=rsBlock.length/3;var list=[];for(var i=0;i<length;i++){var count=rsBlock[i*3+0];var totalCount=rsBlock[i*3+1];var dataCount=rsBlock[i*3+2];for(var j=0;j<count;j++){list.push(new QRRSBlock(totalCount,dataCount));}}
|
||||
return list;};QRRSBlock.getRsBlockTable=function(typeNumber,errorCorrectLevel){switch(errorCorrectLevel){case QRErrorCorrectLevel.L:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+0];case QRErrorCorrectLevel.M:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+1];case QRErrorCorrectLevel.Q:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+2];case QRErrorCorrectLevel.H:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+3];default:return undefined;}};function QRBitBuffer(){this.buffer=[];this.length=0;}
|
||||
QRBitBuffer.prototype={get:function(index){var bufIndex=Math.floor(index/8);return((this.buffer[bufIndex]>>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i<length;i++){this.putBit(((num>>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);}
|
||||
if(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));}
|
||||
this.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];
|
||||
|
||||
function _isSupportCanvas() {
|
||||
return typeof CanvasRenderingContext2D != "undefined";
|
||||
}
|
||||
|
||||
// android 2.x doesn't support Data-URI spec
|
||||
function _getAndroid() {
|
||||
var android = false;
|
||||
var sAgent = navigator.userAgent;
|
||||
|
||||
if (/android/i.test(sAgent)) { // android
|
||||
android = true;
|
||||
var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i);
|
||||
|
||||
if (aMat && aMat[1]) {
|
||||
android = parseFloat(aMat[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return android;
|
||||
}
|
||||
|
||||
var svgDrawer = (function() {
|
||||
|
||||
var Drawing = function (el, htOption) {
|
||||
this._el = el;
|
||||
this._htOption = htOption;
|
||||
};
|
||||
|
||||
Drawing.prototype.draw = function (oQRCode) {
|
||||
var _htOption = this._htOption;
|
||||
var _el = this._el;
|
||||
var nCount = oQRCode.getModuleCount();
|
||||
var nWidth = Math.floor(_htOption.width / nCount);
|
||||
var nHeight = Math.floor(_htOption.height / nCount);
|
||||
|
||||
this.clear();
|
||||
|
||||
function makeSVG(tag, attrs) {
|
||||
var el = document.createElementNS('http://www.w3.org/2000/svg', tag);
|
||||
for (var k in attrs)
|
||||
if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]);
|
||||
return el;
|
||||
}
|
||||
|
||||
var svg = makeSVG("svg" , {'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight});
|
||||
svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink");
|
||||
_el.appendChild(svg);
|
||||
|
||||
svg.appendChild(makeSVG("rect", {"fill": _htOption.colorLight, "width": "100%", "height": "100%"}));
|
||||
svg.appendChild(makeSVG("rect", {"fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template"}));
|
||||
|
||||
for (var row = 0; row < nCount; row++) {
|
||||
for (var col = 0; col < nCount; col++) {
|
||||
if (oQRCode.isDark(row, col)) {
|
||||
var child = makeSVG("use", {"x": String(col), "y": String(row)});
|
||||
child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template")
|
||||
svg.appendChild(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Drawing.prototype.clear = function () {
|
||||
while (this._el.hasChildNodes())
|
||||
this._el.removeChild(this._el.lastChild);
|
||||
};
|
||||
return Drawing;
|
||||
})();
|
||||
|
||||
var useSVG = document.documentElement.tagName.toLowerCase() === "svg";
|
||||
|
||||
// Drawing in DOM by using Table tag
|
||||
var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () {
|
||||
var Drawing = function (el, htOption) {
|
||||
this._el = el;
|
||||
this._htOption = htOption;
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw the QRCode
|
||||
*
|
||||
* @param {QRCode} oQRCode
|
||||
*/
|
||||
Drawing.prototype.draw = function (oQRCode) {
|
||||
var _htOption = this._htOption;
|
||||
var _el = this._el;
|
||||
var nCount = oQRCode.getModuleCount();
|
||||
var nWidth = Math.floor(_htOption.width / nCount);
|
||||
var nHeight = Math.floor(_htOption.height / nCount);
|
||||
var aHTML = ['<table style="border:0;border-collapse:collapse;">'];
|
||||
|
||||
for (var row = 0; row < nCount; row++) {
|
||||
aHTML.push('<tr>');
|
||||
|
||||
for (var col = 0; col < nCount; col++) {
|
||||
aHTML.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:' + nWidth + 'px;height:' + nHeight + 'px;background-color:' + (oQRCode.isDark(row, col) ? _htOption.colorDark : _htOption.colorLight) + ';"></td>');
|
||||
}
|
||||
|
||||
aHTML.push('</tr>');
|
||||
}
|
||||
|
||||
aHTML.push('</table>');
|
||||
_el.innerHTML = aHTML.join('');
|
||||
|
||||
// Fix the margin values as real size.
|
||||
var elTable = _el.childNodes[0];
|
||||
var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2;
|
||||
var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2;
|
||||
|
||||
if (nLeftMarginTable > 0 && nTopMarginTable > 0) {
|
||||
elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px";
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the QRCode
|
||||
*/
|
||||
Drawing.prototype.clear = function () {
|
||||
this._el.innerHTML = '';
|
||||
};
|
||||
|
||||
return Drawing;
|
||||
})() : (function () { // Drawing in Canvas
|
||||
function _onMakeImage() {
|
||||
this._elImage.src = this._elCanvas.toDataURL("image/png");
|
||||
this._elImage.style.display = "block";
|
||||
this._elCanvas.style.display = "none";
|
||||
}
|
||||
|
||||
// Android 2.1 bug workaround
|
||||
// http://code.google.com/p/android/issues/detail?id=5141
|
||||
if (this._android && this._android <= 2.1) {
|
||||
var factor = 1 / window.devicePixelRatio;
|
||||
var drawImage = CanvasRenderingContext2D.prototype.drawImage;
|
||||
CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) {
|
||||
if (("nodeName" in image) && /img/i.test(image.nodeName)) {
|
||||
for (var i = arguments.length - 1; i >= 1; i--) {
|
||||
arguments[i] = arguments[i] * factor;
|
||||
}
|
||||
} else if (typeof dw == "undefined") {
|
||||
arguments[1] *= factor;
|
||||
arguments[2] *= factor;
|
||||
arguments[3] *= factor;
|
||||
arguments[4] *= factor;
|
||||
}
|
||||
|
||||
drawImage.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the user's browser supports Data URI or not
|
||||
*
|
||||
* @private
|
||||
* @param {Function} fSuccess Occurs if it supports Data URI
|
||||
* @param {Function} fFail Occurs if it doesn't support Data URI
|
||||
*/
|
||||
function _safeSetDataURI(fSuccess, fFail) {
|
||||
var self = this;
|
||||
self._fFail = fFail;
|
||||
self._fSuccess = fSuccess;
|
||||
|
||||
// Check it just once
|
||||
if (self._bSupportDataURI === null) {
|
||||
var el = document.createElement("img");
|
||||
var fOnError = function() {
|
||||
self._bSupportDataURI = false;
|
||||
|
||||
if (self._fFail) {
|
||||
self._fFail.call(self);
|
||||
}
|
||||
};
|
||||
var fOnSuccess = function() {
|
||||
self._bSupportDataURI = true;
|
||||
|
||||
if (self._fSuccess) {
|
||||
self._fSuccess.call(self);
|
||||
}
|
||||
};
|
||||
|
||||
el.onabort = fOnError;
|
||||
el.onerror = fOnError;
|
||||
el.onload = fOnSuccess;
|
||||
el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data.
|
||||
return;
|
||||
} else if (self._bSupportDataURI === true && self._fSuccess) {
|
||||
self._fSuccess.call(self);
|
||||
} else if (self._bSupportDataURI === false && self._fFail) {
|
||||
self._fFail.call(self);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Drawing QRCode by using canvas
|
||||
*
|
||||
* @constructor
|
||||
* @param {HTMLElement} el
|
||||
* @param {Object} htOption QRCode Options
|
||||
*/
|
||||
var Drawing = function (el, htOption) {
|
||||
this._bIsPainted = false;
|
||||
this._android = _getAndroid();
|
||||
|
||||
this._htOption = htOption;
|
||||
this._elCanvas = document.createElement("canvas");
|
||||
this._elCanvas.width = htOption.width;
|
||||
this._elCanvas.height = htOption.height;
|
||||
el.appendChild(this._elCanvas);
|
||||
this._el = el;
|
||||
this._oContext = this._elCanvas.getContext("2d");
|
||||
this._bIsPainted = false;
|
||||
this._elImage = document.createElement("img");
|
||||
this._elImage.alt = "Scan me!";
|
||||
this._elImage.style.display = "none";
|
||||
this._el.appendChild(this._elImage);
|
||||
this._bSupportDataURI = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw the QRCode
|
||||
*
|
||||
* @param {QRCode} oQRCode
|
||||
*/
|
||||
Drawing.prototype.draw = function (oQRCode) {
|
||||
var _elImage = this._elImage;
|
||||
var _oContext = this._oContext;
|
||||
var _htOption = this._htOption;
|
||||
|
||||
var nCount = oQRCode.getModuleCount();
|
||||
var nWidth = _htOption.width / nCount;
|
||||
var nHeight = _htOption.height / nCount;
|
||||
var nRoundedWidth = Math.round(nWidth);
|
||||
var nRoundedHeight = Math.round(nHeight);
|
||||
|
||||
_elImage.style.display = "none";
|
||||
this.clear();
|
||||
|
||||
for (var row = 0; row < nCount; row++) {
|
||||
for (var col = 0; col < nCount; col++) {
|
||||
var bIsDark = oQRCode.isDark(row, col);
|
||||
var nLeft = col * nWidth;
|
||||
var nTop = row * nHeight;
|
||||
_oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
|
||||
_oContext.lineWidth = 1;
|
||||
_oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
|
||||
_oContext.fillRect(nLeft, nTop, nWidth, nHeight);
|
||||
|
||||
// 안티 앨리어싱 방지 처리
|
||||
_oContext.strokeRect(
|
||||
Math.floor(nLeft) + 0.5,
|
||||
Math.floor(nTop) + 0.5,
|
||||
nRoundedWidth,
|
||||
nRoundedHeight
|
||||
);
|
||||
|
||||
_oContext.strokeRect(
|
||||
Math.ceil(nLeft) - 0.5,
|
||||
Math.ceil(nTop) - 0.5,
|
||||
nRoundedWidth,
|
||||
nRoundedHeight
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this._bIsPainted = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Make the image from Canvas if the browser supports Data URI.
|
||||
*/
|
||||
Drawing.prototype.makeImage = function () {
|
||||
if (this._bIsPainted) {
|
||||
_safeSetDataURI.call(this, _onMakeImage);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return whether the QRCode is painted or not
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
Drawing.prototype.isPainted = function () {
|
||||
return this._bIsPainted;
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the QRCode
|
||||
*/
|
||||
Drawing.prototype.clear = function () {
|
||||
this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height);
|
||||
this._bIsPainted = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {Number} nNumber
|
||||
*/
|
||||
Drawing.prototype.round = function (nNumber) {
|
||||
if (!nNumber) {
|
||||
return nNumber;
|
||||
}
|
||||
|
||||
return Math.floor(nNumber * 1000) / 1000;
|
||||
};
|
||||
|
||||
return Drawing;
|
||||
})();
|
||||
|
||||
/**
|
||||
* Get the type by string length
|
||||
*
|
||||
* @private
|
||||
* @param {String} sText
|
||||
* @param {Number} nCorrectLevel
|
||||
* @return {Number} type
|
||||
*/
|
||||
function _getTypeNumber(sText, nCorrectLevel) {
|
||||
var nType = 1;
|
||||
var length = _getUTF8Length(sText);
|
||||
|
||||
for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
|
||||
var nLimit = 0;
|
||||
|
||||
switch (nCorrectLevel) {
|
||||
case QRErrorCorrectLevel.L :
|
||||
nLimit = QRCodeLimitLength[i][0];
|
||||
break;
|
||||
case QRErrorCorrectLevel.M :
|
||||
nLimit = QRCodeLimitLength[i][1];
|
||||
break;
|
||||
case QRErrorCorrectLevel.Q :
|
||||
nLimit = QRCodeLimitLength[i][2];
|
||||
break;
|
||||
case QRErrorCorrectLevel.H :
|
||||
nLimit = QRCodeLimitLength[i][3];
|
||||
break;
|
||||
}
|
||||
|
||||
if (length <= nLimit) {
|
||||
break;
|
||||
} else {
|
||||
nType++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nType > QRCodeLimitLength.length) {
|
||||
throw new Error("Too long data");
|
||||
}
|
||||
|
||||
return nType;
|
||||
}
|
||||
|
||||
function _getUTF8Length(sText) {
|
||||
var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
|
||||
return replacedText.length + (replacedText.length != sText ? 3 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @class QRCode
|
||||
* @constructor
|
||||
* @example
|
||||
* new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie");
|
||||
*
|
||||
* @example
|
||||
* var oQRCode = new QRCode("test", {
|
||||
* text : "http://naver.com",
|
||||
* width : 128,
|
||||
* height : 128
|
||||
* });
|
||||
*
|
||||
* oQRCode.clear(); // Clear the QRCode.
|
||||
* oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode.
|
||||
*
|
||||
* @param {HTMLElement|String} el target element or 'id' attribute of element.
|
||||
* @param {Object|String} vOption
|
||||
* @param {String} vOption.text QRCode link data
|
||||
* @param {Number} [vOption.width=256]
|
||||
* @param {Number} [vOption.height=256]
|
||||
* @param {String} [vOption.colorDark="#000000"]
|
||||
* @param {String} [vOption.colorLight="#ffffff"]
|
||||
* @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H]
|
||||
*/
|
||||
QRCode = function (el, vOption) {
|
||||
this._htOption = {
|
||||
width : 256,
|
||||
height : 256,
|
||||
typeNumber : 4,
|
||||
colorDark : "#000000",
|
||||
colorLight : "#ffffff",
|
||||
correctLevel : QRErrorCorrectLevel.H
|
||||
};
|
||||
|
||||
if (typeof vOption === 'string') {
|
||||
vOption = {
|
||||
text : vOption
|
||||
};
|
||||
}
|
||||
|
||||
// Overwrites options
|
||||
if (vOption) {
|
||||
for (var i in vOption) {
|
||||
this._htOption[i] = vOption[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof el == "string") {
|
||||
el = document.getElementById(el);
|
||||
}
|
||||
|
||||
if (this._htOption.useSVG) {
|
||||
Drawing = svgDrawer;
|
||||
}
|
||||
|
||||
this._android = _getAndroid();
|
||||
this._el = el;
|
||||
this._oQRCode = null;
|
||||
this._oDrawing = new Drawing(this._el, this._htOption);
|
||||
|
||||
if (this._htOption.text) {
|
||||
this.makeCode(this._htOption.text);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Make the QRCode
|
||||
*
|
||||
* @param {String} sText link data
|
||||
*/
|
||||
QRCode.prototype.makeCode = function (sText) {
|
||||
this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel);
|
||||
this._oQRCode.addData(sText);
|
||||
this._oQRCode.make();
|
||||
this._el.title = sText;
|
||||
this._oDrawing.draw(this._oQRCode);
|
||||
this.makeImage();
|
||||
};
|
||||
|
||||
/**
|
||||
* Make the Image from Canvas element
|
||||
* - It occurs automatically
|
||||
* - Android below 3 doesn't support Data-URI spec.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
QRCode.prototype.makeImage = function () {
|
||||
if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) {
|
||||
this._oDrawing.makeImage();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the QRCode
|
||||
*/
|
||||
QRCode.prototype.clear = function () {
|
||||
this._oDrawing.clear();
|
||||
};
|
||||
|
||||
/**
|
||||
* @name QRCode.CorrectLevel
|
||||
*/
|
||||
QRCode.CorrectLevel = QRErrorCorrectLevel;
|
||||
})();
|
||||
114
js/qrrz.js
Normal file
114
js/qrrz.js
Normal file
@@ -0,0 +1,114 @@
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('reload', function(e) { //执行刷新
|
||||
location.reload();
|
||||
});
|
||||
//获取亲人认证列表
|
||||
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
|
||||
}
|
||||
if (isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/auth/getAuthFamilyPersonalSelect'), recommenddata, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data);
|
||||
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="block clearfix"><p class="pname">' + this.familyName +
|
||||
'(' + this.familyRelations +
|
||||
')</p><div class="caozuo"><span class="bj" data-id="' + this.id +
|
||||
'"><img src="../img/bianji.png"></span><span class="del" data-id="' + this.id +
|
||||
'"><img src="../img/delete.png"></span></div></div>';
|
||||
// //console.log(this.id);
|
||||
|
||||
|
||||
})
|
||||
if (page == 1) {
|
||||
$('.con').html(html);
|
||||
} else {
|
||||
$('.con').append(html);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
isjiazai = 1;
|
||||
})
|
||||
}
|
||||
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isjiazai == 1) {
|
||||
page++;
|
||||
getRecommend(page, pageSize);
|
||||
}
|
||||
}
|
||||
})
|
||||
var qrrzid;
|
||||
// 编辑
|
||||
mui('.con').on('tap', '.bj', function() {
|
||||
|
||||
qrrzid = $(this).attr('data-id');
|
||||
//console.log(qrrzid);
|
||||
JZL.openWindow('addqrrz.html', qrrzid);
|
||||
})
|
||||
// 删除
|
||||
$('.con').on('tap', '.del', function() {
|
||||
qrrzid = $(this).attr('data-id');
|
||||
if (confirm('确认删除?')) {
|
||||
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 clearfix"><h3>请输入操作密码</h3><div style="background:linear-gradient(to right,#48D1CC,#FFD700,#D2691E);height:2px; margin:10px auto"></div><input class="payword" type="password" placeholder="请输入操作密码"><div class="lxy_zz_btn"><button class="cancle" type="button">取消</button><button class="sure" type="button">确定</button></div></div></div>';
|
||||
$('body').append(lxy_div);
|
||||
$('.lxy_zz').on('tap', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation()
|
||||
})
|
||||
mui('.lxy_zz_btn').on('tap', '.cancle', function() {
|
||||
$('#home_zhezhao').remove();
|
||||
return;
|
||||
})
|
||||
|
||||
mui('.lxy_zz_btn').on('tap', '.sure', function() {
|
||||
var payPwd = $('.payword').val();
|
||||
if (payPwd == '') {
|
||||
mui.alert("请输入密码")
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/auth/delAuthFamily'), {
|
||||
id: qrrzid,
|
||||
payPwd: payPwd
|
||||
}, function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// var data = toJson(data, 1);
|
||||
|
||||
if (data.status == 1) {
|
||||
$('#home_zhezhao').remove();
|
||||
location.reload()
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
})
|
||||
$('.add1').on('tap', function() {
|
||||
JZL.openWindow('addqrrz.html', 'addqrrz.html');
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
45
js/recommend.js
Normal file
45
js/recommend.js
Normal file
@@ -0,0 +1,45 @@
|
||||
mui.plusReady(function() {
|
||||
|
||||
//跳转到商品详情
|
||||
mui("body").on('tap', '.recommend_con_block', function() {
|
||||
// var tj = plus.webview.create('search.html');
|
||||
// tj.show();
|
||||
// mui.alert(e.target.attributes["data-id"].nodeValue);
|
||||
var data_id = this.attributes["data-goodsId"].nodeValue;
|
||||
var goodsType =$(this).attr('data-goodsType')
|
||||
// //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,
|
||||
goodsType : goodsType?goodsType :""
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
499
js/reg.js
Normal file
499
js/reg.js
Normal file
@@ -0,0 +1,499 @@
|
||||
// mui.init({
|
||||
// beforeback: function() { //获得父页面的webview
|
||||
// var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
// mui.fire(list, 'refresh');
|
||||
// //返回true,继续页面关闭逻辑
|
||||
// return true;
|
||||
// }
|
||||
// });
|
||||
|
||||
mui.plusReady(function() {
|
||||
|
||||
var wait = 120;
|
||||
|
||||
// 判断用户名是否存在
|
||||
$('#loginName').on('blur', function() {
|
||||
var loginName = $('#loginName').val();
|
||||
JZL.ajax('http://t.ect99.com/app/users/check_login_name', {
|
||||
loginName: loginName
|
||||
}, function(data) {
|
||||
// console.log(data);
|
||||
if (1 != data.status) {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function GetQueryString(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||
console.log(reg);
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
if (r != null)
|
||||
return unescape(r[2]);
|
||||
return null;
|
||||
}
|
||||
|
||||
var pName = GetQueryString('pName') ? GetQueryString('pName') : localStorage.getItem('pName');
|
||||
|
||||
// if (!pName) {
|
||||
// pName = localStorage.getItem('pName');
|
||||
// var indexNum = pName.indexOf('&');
|
||||
// if (indexNum > 0) {
|
||||
// pName = pName.slice(0, indexNum);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
if (pName) {
|
||||
console.log(pName);
|
||||
// $('#pName').val(pname);;
|
||||
// $('#pName').attr('disabled', 'disabled');
|
||||
}
|
||||
// 推荐人信息
|
||||
//var PName = "";
|
||||
$('#pName').on('blur', function() {
|
||||
pName = $('#pName').val();
|
||||
if ('' != pName) {
|
||||
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(pName))) {
|
||||
mui.alert("手机号码有误,请重填!");
|
||||
return;
|
||||
}
|
||||
$('.pNameCode').show();
|
||||
|
||||
mui('.row').on('tap', '#mobileCode1', function() {
|
||||
$(this).attr("disabled", true);
|
||||
JZL.ajax('http://t.ect99.com/app/users/getPhoneVerifyCode', {
|
||||
userPhone: pName
|
||||
}, function(data) {
|
||||
if (1 == data.status) {
|
||||
time()
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
$('#mobileCode1').removeAttr('disabled');
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$('.pNameCode').hide();
|
||||
}
|
||||
|
||||
})
|
||||
// JZL.ajax(qlgUrl('app/users/check_login_name'),{loginName:loginName},function (data) {
|
||||
// // console.log(data);
|
||||
//
|
||||
// if (1 != data.status) {
|
||||
// mui.alert(data.msg)
|
||||
// }
|
||||
// })
|
||||
function time() {
|
||||
if (wait == 0) {
|
||||
$('#mobileCode').removeAttr("disabled");
|
||||
$('#mobileCode').val("重新发送");
|
||||
wait = 120;
|
||||
} else {
|
||||
$('#mobileCode').attr("disabled", true);
|
||||
$('#mobileCode').val("重新发送(" + wait + ")");
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
time()
|
||||
},
|
||||
1000)
|
||||
}
|
||||
}
|
||||
//获取验证码
|
||||
mui('.row').on('tap', '#mobileCode', function() {
|
||||
var loginName = $('#loginName').val();
|
||||
if (loginName == '') {
|
||||
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(loginName))) {
|
||||
// mui.alert("手机号码有误,请重填!");
|
||||
// return;
|
||||
// }
|
||||
$(this).attr("disabled", true);
|
||||
mui.ajax('http://t.ect99.com/app/users/getPhoneVerifyCode', {
|
||||
|
||||
data: {
|
||||
userPhone: loginName
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
if (data.status == 1) {
|
||||
time();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
$('#mobileCode').removeAttr('disabled');
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
mui.alert(type)
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
//注册协议
|
||||
mui.ajax('http://t.ect99.com/app/Tags/articleDetail', {
|
||||
data: {
|
||||
articleId: 114
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
// if(data.status==1){
|
||||
// console.log(1);
|
||||
var html1 = ''
|
||||
html1 = '<h3>' + data.articleContent + '</h3>'
|
||||
$('.zcxycontent').append(html1)
|
||||
// }
|
||||
},
|
||||
error: function(xhr, type, errorThrown) {
|
||||
|
||||
}
|
||||
});
|
||||
//上传图片
|
||||
|
||||
var files = []; //存储文件信息的数组
|
||||
var fname = ""; //表示文件名,例如 XXXX.jpg;
|
||||
var expire = 0;
|
||||
var pathName = '';
|
||||
var inpId = '';
|
||||
var keyname = '';
|
||||
var imgId = '';
|
||||
var isZip = 1;
|
||||
var qualityNum = 90;
|
||||
var response = ';'
|
||||
var UP = UP || {};
|
||||
UP.isBatch = 0;
|
||||
UP.init = function(inputId, path, imageId, isBatch, isZipImg, quality) {
|
||||
inpId = inputId;
|
||||
pathName = path;
|
||||
imgId = imageId;
|
||||
if (typeof(isBatch) != 'undefined') {
|
||||
UP.isBatch = isBatch;
|
||||
}
|
||||
if (typeof(isZipImg) != 'undefined') {
|
||||
// console.log(typeof(isZipImg));
|
||||
isZip = isZipImg;
|
||||
}
|
||||
if (typeof(quality) != 'undefined') {
|
||||
qualityNum = quality;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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 = 'http://t.ect99.com/oss/get.php?dir=' + pathName;
|
||||
// serverUrl = 'https://img.zgqlg.com.cn/oss/get.php?dir=' + pathName;
|
||||
|
||||
xmlhttp.open("GET", serverUrl, false);
|
||||
xmlhttp.send(null);
|
||||
return xmlhttp.responseText;
|
||||
} else {
|
||||
mui.alert("Your browser does not support XMLHTTP.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function get_signature() {
|
||||
//可以判断当前expire是否超过了当前时间,如果超过了当前时间,就重新取一下.3s 做为缓冲
|
||||
now = timestamp = Date.parse(new Date()) / 1000;
|
||||
if (expire < now + 3) {
|
||||
body = send_request()
|
||||
var obj = eval("(" + body + ")");
|
||||
response = obj;
|
||||
// console.log(obj);
|
||||
}
|
||||
return response;
|
||||
};
|
||||
// 上传文件
|
||||
function upload(callback) {
|
||||
// console.log(files);
|
||||
if (files.length <= 0) {
|
||||
mui.toast('没有添加上传文件');
|
||||
return;
|
||||
}
|
||||
var obj = get_signature();
|
||||
if (obj) {
|
||||
server = obj['host'];
|
||||
policyBase64 = obj['policy'];
|
||||
accessid = obj['accessid'];
|
||||
signature = obj['signature'];
|
||||
expire = parseInt(obj['expire']);
|
||||
callbackbody = obj['callback'];
|
||||
path = obj['dir'];
|
||||
|
||||
} else {
|
||||
mui.toast('初始化失败');
|
||||
return;
|
||||
}
|
||||
|
||||
var wt = plus.nativeUI.showWaiting();
|
||||
var task = plus.uploader.createUpload(server, {
|
||||
method: "POST"
|
||||
}, function(t, status) {
|
||||
//上传完成
|
||||
if (status == 200) {
|
||||
wt.close();
|
||||
if (1 == UP.isBatch) {
|
||||
callback(t, status, keyname, server + '/' + keyname);
|
||||
} else {
|
||||
document.getElementById(inpId).value = keyname;
|
||||
var ele = document.getElementById(imgId);
|
||||
ele.src = server + '/' + keyname;
|
||||
ele.setAttribute('data-src', keyname);
|
||||
mui.toast('上传成功');
|
||||
//至此上传成功,上传后的图片完整地址为server+testName
|
||||
//keyname
|
||||
}
|
||||
|
||||
} else {
|
||||
wt.close();
|
||||
mui.toast('上传失败:' + status);
|
||||
}
|
||||
});
|
||||
var suffix1 = get_suffix(fname); //文件后缀 例如 .jpg
|
||||
keyname = path + new Date().getTime() + suffix1;
|
||||
task.addData("key", keyname);
|
||||
task.addData("policy", policyBase64);
|
||||
task.addData("OSSAccessKeyId", accessid);
|
||||
task.addData("success_action_status", "200");
|
||||
// task.addData("callback", callbackbody);
|
||||
task.addData("signature", signature);
|
||||
var f = files[files.length - 1];
|
||||
// console.log(f)
|
||||
|
||||
task.addFile(f.path, {
|
||||
key: "file",
|
||||
name: "file",
|
||||
mime: "image/jpeg"
|
||||
});
|
||||
//files.length = 0;
|
||||
task.start();
|
||||
|
||||
}
|
||||
|
||||
//得到文件名的后缀
|
||||
function get_suffix(filename) {
|
||||
var pos = filename.lastIndexOf('.');
|
||||
var suffix = '';
|
||||
if (pos != -1) {
|
||||
suffix = filename.substring(pos)
|
||||
}
|
||||
return suffix;
|
||||
}
|
||||
// 拍照添加文件
|
||||
function appendByCamera(callback) {
|
||||
plus.camera.getCamera().captureImage(function(p) {
|
||||
uploadImg(p, callback);
|
||||
});
|
||||
}
|
||||
// 从相册添加文件
|
||||
function appendByGallery(callback) {
|
||||
plus.gallery.pick(function(p) {
|
||||
uploadImg(p, callback);
|
||||
});
|
||||
}
|
||||
|
||||
// 添加文件
|
||||
var index = 1;
|
||||
|
||||
function uploadImg(p, callback) {
|
||||
if (1 == isZip) {
|
||||
compressImg(p, callback);
|
||||
} else {
|
||||
appendFile(p, callback)
|
||||
}
|
||||
}
|
||||
|
||||
function appendFile(p, callback) {
|
||||
// var fe = document.getElementById(fileId);
|
||||
var n = p.substr(p.lastIndexOf('/') + 1);
|
||||
// fname = n/////////;
|
||||
files.push({
|
||||
name: "uploadkey" + index,
|
||||
path: p
|
||||
});
|
||||
//console.log(3);
|
||||
// index++;
|
||||
upload(callback);
|
||||
}
|
||||
|
||||
function compressImg(src, callback) {
|
||||
var filename = src.substring(src.lastIndexOf('/') + 1);
|
||||
var opions = {
|
||||
src: src,
|
||||
dst: '_doc/tmp/' + filename,
|
||||
overwrite: true,
|
||||
//width: '300px', //这里指定了宽度,同样可以修改
|
||||
format: 'jpg',
|
||||
quality: qualityNum //图片质量不再修改,以免失真
|
||||
};
|
||||
var successCB = function(evt) {
|
||||
// console.log(JSON.stringify(evt));
|
||||
fname = filename;
|
||||
// files[0]={
|
||||
// name: "uploadkey",
|
||||
// path: evt.target
|
||||
// };
|
||||
files.push({
|
||||
name: "uploadkey" + index,
|
||||
path: evt.target
|
||||
});
|
||||
// index++;
|
||||
//上传
|
||||
upload(callback);
|
||||
//_this.avatar(evt.target);
|
||||
};
|
||||
var errorCB = function(err) {
|
||||
appendFile(src, callback);
|
||||
|
||||
//console.log(JSON.stringify(err));
|
||||
//mui.toast("图片压缩失败");i m
|
||||
};
|
||||
plus.zip.compressImage(opions, successCB, errorCB);
|
||||
};
|
||||
|
||||
function openCamera(callback) {
|
||||
plus.nativeUI.actionSheet({
|
||||
cancel: "取消",
|
||||
buttons: [{
|
||||
title: "拍照"
|
||||
},
|
||||
{
|
||||
title: "从相册中选择"
|
||||
}
|
||||
]
|
||||
}, function(e) { //1 是拍照 2 从相册中选择
|
||||
switch (e.index) {
|
||||
case 1:
|
||||
appendByCamera(callback);
|
||||
break;
|
||||
case 2:
|
||||
appendByGallery(callback);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
$(".photos").on("tap", '.regConfirm', function() {
|
||||
// UP.init("accountBookImg", "test", "accountBookImgTag")
|
||||
|
||||
UP.init("regConfirmImg", "test", "regConfirmImg")
|
||||
openCamera()
|
||||
})
|
||||
|
||||
|
||||
mui('.down').on('tap', '.btn', function() {
|
||||
var loginName = $('#loginName').val();
|
||||
var mobileCode = $('.yzm').val();
|
||||
var loginPwd = $('#loginPwd').val();
|
||||
var reUserPwd = $('#reUserPwd').val();
|
||||
var mobileCode1 = $('#mobileCode1').val() ? $('#mobileCode1').val() : ""; //推荐人验证码
|
||||
|
||||
|
||||
pName = $('#pName').val();
|
||||
|
||||
// var verifyCode = $('.tpyzm').val();
|
||||
var regConfirmImg = $('#regConfirmImg').val();
|
||||
if (loginName == '') {
|
||||
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(loginName))) {
|
||||
mui.alert("手机号码有误,请重填!");
|
||||
return;
|
||||
}
|
||||
if (mobileCode == '') {
|
||||
mui.alert('验证码不能为空!');
|
||||
return;
|
||||
}
|
||||
if (loginPwd == '') {
|
||||
mui.alert('密码不能为空!');
|
||||
return;
|
||||
}
|
||||
if (reUserPwd == '') {
|
||||
mui.alert('确认密码不能为空!');
|
||||
return;
|
||||
}
|
||||
if (loginPwd.length < 6) {
|
||||
mui.alert('密码不能小于6位!');
|
||||
return;
|
||||
}
|
||||
if (!(loginPwd == reUserPwd)) {
|
||||
mui.alert('两次密码不一致!');
|
||||
return;
|
||||
}
|
||||
if (regConfirmImg == '') {
|
||||
mui.alert('请上传确认书照片');
|
||||
return;
|
||||
}
|
||||
if (pName != '') {
|
||||
if ('' == mobileCode1) {
|
||||
mui.alert('请输入推荐人验证码');
|
||||
return;
|
||||
}
|
||||
}
|
||||
$(this).attr("disabled", true);
|
||||
mui.ajax('http://t.ect99.com/app/users/register', {
|
||||
data: {
|
||||
loginName: loginName,
|
||||
mobileCode: mobileCode,
|
||||
loginPwd: loginPwd,
|
||||
reUserPwd: reUserPwd,
|
||||
pName: pName,
|
||||
nameType: 3,
|
||||
regConfirmImg: regConfirmImg,
|
||||
mobileCode1: mobileCode1
|
||||
// verifyCode: verifyCode
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
mui.alert(data.msg);
|
||||
|
||||
if (data.status == 1) {
|
||||
// mui.back();
|
||||
plus.runtime.open
|
||||
} else {
|
||||
// $('.yzmhh').attr('src', hyhUrl('mobile/users/getverify?rnd=' + Math.random()));
|
||||
}
|
||||
$('.btn').removeAttr('disabled');
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
201
js/register.js
Normal file
201
js/register.js
Normal file
@@ -0,0 +1,201 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'refresh');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
mui.plusReady(function() {
|
||||
var wait = 120;
|
||||
// var html =
|
||||
// '<div class="row"><img src="../img/icon_pwd1.png" /><span class="s1">验证码:</span><input class="tpyzm" type="text" maxlength="4" placeholder="请输入图片验证码" /><img class="yzmhh" src = "'+ hyhUrl('mobile/users/getverify?rnd='+Math.random())+'"/></input></div>';
|
||||
//
|
||||
// $('.con').append(html);
|
||||
// 判断用户名是否存在
|
||||
$('#loginName').on('blur', function() {
|
||||
var loginName = $('#loginName').val();
|
||||
if ('' == loginName) {
|
||||
mui.mui.alert('用户名不能为空')
|
||||
return;
|
||||
}
|
||||
if (6 > loginName.length) {
|
||||
mui.alert('用户名不能小于6个字符')
|
||||
return;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/users/check_login_name'), {
|
||||
loginName: loginName
|
||||
}, function(data) {
|
||||
// //console.log(data);
|
||||
if (1 != data.status) {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
// 推荐人信息
|
||||
$('.pNameCode').hide();
|
||||
|
||||
var PName = "";
|
||||
$('#pName').on('blur', function() {
|
||||
pName = $('#pName').val();
|
||||
if ('' != pName) {
|
||||
|
||||
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(pName))) {
|
||||
mui.alert("手机号码有误,请重填!");
|
||||
return;
|
||||
}
|
||||
$('.pNameCode').show();
|
||||
mui('.row').on('tap', '#getMobileCode', function() {
|
||||
var that=$(this)
|
||||
that.attr("disabled", true);
|
||||
JZL.ajax(qlgUrl('app/users/getPhoneVerifyCode'), {
|
||||
userPhone: pName
|
||||
}, function(data) {
|
||||
if (1 == data.status) {
|
||||
time()
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$('.pNameCode').hide();
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
function time() {
|
||||
if (wait == 0) {
|
||||
$('#getMobileCode').removeAttr("disabled");
|
||||
$('#getMobileCode').val("重新发送");
|
||||
wait = 120;
|
||||
} else {
|
||||
$('#getMobileCode').attr("disabled", true);
|
||||
$('#getMobileCode').val("重新发送(" + wait + ")");
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
time()
|
||||
},
|
||||
1000)
|
||||
}
|
||||
}
|
||||
|
||||
//注册协议
|
||||
mui.ajax(qlgUrl('app/Tags/articleDetail'), {
|
||||
data: {
|
||||
articleId: 114
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) {
|
||||
//console.log(data);
|
||||
// if(data.status==1){
|
||||
// //console.log(1);
|
||||
|
||||
$('.zcxycontent').html(data.articleContent)
|
||||
// }
|
||||
},
|
||||
error: function(xhr, type, errorThrown) {
|
||||
|
||||
}
|
||||
});
|
||||
//上传图片
|
||||
$(".photos").on("tap", '.regConfirm', function() {
|
||||
// UP.init("accountBookImg", "test", "accountBookImgTag")
|
||||
|
||||
UP.init("regConfirmImg", "test", "regConfirm")
|
||||
openCamera()
|
||||
})
|
||||
|
||||
|
||||
mui('.down').on('tap', '.btn', function() {
|
||||
var loginName = $('#loginName').val();
|
||||
// var mobileCode = $('.yzm').val();
|
||||
var loginPwd = $('#loginPwd').val();
|
||||
var reUserPwd = $('#reUserPwd').val();
|
||||
var mobileCode = $('#mobileCode').val() ? $('#mobileCode').val() : ""; //推荐人验证码
|
||||
var payPwd = $('#loginPaywd').val();
|
||||
var reUserPaywd = $('#reUserPaywd').val();
|
||||
var pName = $('#pName').val();
|
||||
|
||||
// var verifyCode = $('.tpyzm').val();
|
||||
var regConfirmImg = $('#regConfirmImg').val();
|
||||
if (loginName == '') {
|
||||
mui.alert('用户名不能为空!');
|
||||
return;
|
||||
}
|
||||
if (loginPwd.length < 6) {
|
||||
mui.alert('登录密码不能小于6位!');
|
||||
return;
|
||||
}
|
||||
if (!(loginPwd == reUserPwd)) {
|
||||
mui.alert('两次登录密码不一致!');
|
||||
return;
|
||||
}
|
||||
if (payPwd.length < 6) {
|
||||
mui.alert('操作密码不能小于6位!');
|
||||
return;
|
||||
}
|
||||
if (payPwd != reUserPaywd) {
|
||||
mui.alert('两次操作密码不一致!');
|
||||
return;
|
||||
}
|
||||
if (regConfirmImg == '') {
|
||||
mui.alert('请上传确认书照片');
|
||||
return;
|
||||
}
|
||||
if (pName != '') {
|
||||
if ('' == mobileCode) {
|
||||
mui.alert('请输入推荐人验证码');
|
||||
return;
|
||||
}
|
||||
}
|
||||
var ajaxData={
|
||||
loginName: loginName,
|
||||
// mobileCode: mobileCode,
|
||||
loginPwd: loginPwd,
|
||||
payPwd: payPwd,
|
||||
pName: pName,
|
||||
// nameType: 3,
|
||||
regConfirmImg: regConfirmImg,
|
||||
mobileCode: mobileCode
|
||||
};
|
||||
|
||||
var that = $(this)
|
||||
that.attr("disabled", true);
|
||||
|
||||
mui.ajax(qlgUrl('app/users/register'), {
|
||||
data:ajaxData,
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
mui.alert(data.msg);
|
||||
|
||||
if (data.status == 1) {
|
||||
mui.back();
|
||||
} else {
|
||||
// $('.yzmhh').attr('src', hyhUrl('mobile/users/getverify?rnd=' + Math.random()));
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
471
js/register1.js
Normal file
471
js/register1.js
Normal file
@@ -0,0 +1,471 @@
|
||||
// mui.init({
|
||||
// beforeback: function() { //获得父页面的webview
|
||||
// var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
// mui.fire(list, 'refresh');
|
||||
// //返回true,继续页面关闭逻辑
|
||||
// return true;
|
||||
// }
|
||||
// });
|
||||
|
||||
mui.plusReady(function() {
|
||||
var wait = 120;
|
||||
// var html =
|
||||
// '<div class="row"><img src="../img/icon_pwd1.png" /><span class="s1">验证码:</span><input class="tpyzm" type="text" maxlength="4" placeholder="请输入图片验证码" /><img class="yzmhh" src = "'+ hyhUrl('mobile/users/getverify?rnd='+Math.random())+'"/></input></div>';
|
||||
//
|
||||
// $('.con').append(html);
|
||||
// 判断手机号是否存在 格式是否正确
|
||||
$('#loginName').on('blur', function() {
|
||||
var loginName = $('#loginName').val();
|
||||
JZL.ajax('http://t.ect99.com/app/users/check_login_name', {
|
||||
loginName: loginName
|
||||
}, function(data) {
|
||||
// //console.log(data);
|
||||
if (1 != data.status) {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
// 推荐人信息
|
||||
$('.pNameCode').hide();
|
||||
|
||||
var PName="";
|
||||
$('#pName').on('blur', function() {
|
||||
pName = $('#pName').val();
|
||||
if ('' != pName) {
|
||||
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(pName))) {
|
||||
mui.alert("手机号码有误,请重填!");
|
||||
return;
|
||||
}
|
||||
$('.pNameCode').show();
|
||||
|
||||
mui('.row').on('tap', '#mobileCode1', function() {
|
||||
$(this).attr("disabled", true);
|
||||
JZL.ajax('http://t.ect99.com/app/users/getPhoneVerifyCode',{userPhone:pName},function (data) {
|
||||
if (1==data.status) {
|
||||
time()
|
||||
}else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
$('#mobileCode1').removeAttr('disabled');
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$('.pNameCode').hide();
|
||||
}
|
||||
|
||||
})
|
||||
// JZL.ajax(qlgUrl('app/users/check_login_name'),{loginName:loginName},function (data) {
|
||||
// // //console.log(data);
|
||||
//
|
||||
// if (1 != data.status) {
|
||||
// mui.alert(data.msg)
|
||||
// }
|
||||
// })
|
||||
function time() {
|
||||
if (wait == 0) {
|
||||
$('#mobileCode').removeAttr("disabled");
|
||||
$('#mobileCode').val("重新发送");
|
||||
wait = 120;
|
||||
} else {
|
||||
$('#mobileCode').attr("disabled", true);
|
||||
$('#mobileCode').val("重新发送(" + wait + ")");
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
time()
|
||||
},
|
||||
1000)
|
||||
}
|
||||
}
|
||||
//获取验证码
|
||||
mui('.row').on('tap', '#mobileCode', function() {
|
||||
var loginName = $('#loginName').val();
|
||||
if (loginName == '') {
|
||||
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(loginName))) {
|
||||
// mui.alert("手机号码有误,请重填!");
|
||||
// return;
|
||||
// }
|
||||
$(this).attr("disabled", true);
|
||||
mui.ajax('http://t.ect99.com/app/users/getPhoneVerifyCode', {
|
||||
|
||||
data: {
|
||||
userPhone: loginName
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//console.log(data);
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
if (data.status == 1) {
|
||||
time();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
$('#mobileCode').removeAttr('disabled');
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
mui.alert(type)
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
//注册协议
|
||||
mui.ajax('http://t.ect99.com/app/Tags/articleDetail', {
|
||||
data: {
|
||||
articleId: 114
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) {
|
||||
//console.log(data);
|
||||
// if(data.status==1){
|
||||
// //console.log(1);
|
||||
var html1 = ''
|
||||
html1 = '<h3>' + data.articleContent + '</h3>'
|
||||
$('.zcxycontent').append(html1)
|
||||
// }
|
||||
},
|
||||
error: function(xhr, type, errorThrown) {
|
||||
|
||||
}
|
||||
});
|
||||
//上传图片
|
||||
|
||||
var files = []; //存储文件信息的数组
|
||||
var fname = ""; //表示文件名,例如 XXXX.jpg;
|
||||
var expire = 0;
|
||||
var pathName = '';
|
||||
var inpId = '';
|
||||
var keyname = '';
|
||||
var imgId='';
|
||||
var isZip=1;
|
||||
var qualityNum=90;
|
||||
var response=';'
|
||||
var UP = UP || {};
|
||||
UP.isBatch=0;
|
||||
UP.init = function(inputId, path,imageId,isBatch,isZipImg,quality) {
|
||||
inpId = inputId;
|
||||
pathName = path;
|
||||
imgId = imageId;
|
||||
if(typeof(isBatch) != 'undefined'){
|
||||
UP.isBatch = isBatch;
|
||||
}
|
||||
if(typeof(isZipImg) != 'undefined'){
|
||||
// //console.log(typeof(isZipImg));
|
||||
isZip = isZipImg;
|
||||
}
|
||||
if(typeof(quality) != 'undefined'){
|
||||
qualityNum = quality;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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 = 'http://t.ect99.com/oss/get.php?dir=' + pathName;
|
||||
// serverUrl = 'https://img.zgqlg.com.cn/oss/get.php?dir=' + pathName;
|
||||
|
||||
xmlhttp.open("GET", serverUrl, false);
|
||||
xmlhttp.send(null);
|
||||
return xmlhttp.responseText;
|
||||
} else {
|
||||
mui.alert("Your browser does not support XMLHTTP.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function get_signature() {
|
||||
//可以判断当前expire是否超过了当前时间,如果超过了当前时间,就重新取一下.3s 做为缓冲
|
||||
now = timestamp = Date.parse(new Date()) / 1000;
|
||||
if (expire < now + 3) {
|
||||
body = send_request()
|
||||
var obj = eval("(" + body + ")");
|
||||
response = obj;
|
||||
// //console.log(obj);
|
||||
}
|
||||
return response;
|
||||
};
|
||||
// 上传文件
|
||||
function upload(callback) {
|
||||
// //console.log(files);
|
||||
if (files.length <= 0) {
|
||||
mui.toast('没有添加上传文件');
|
||||
return;
|
||||
}
|
||||
var obj = get_signature();
|
||||
if (obj) {
|
||||
server = obj['host'];
|
||||
policyBase64 = obj['policy'];
|
||||
accessid = obj['accessid'];
|
||||
signature = obj['signature'];
|
||||
expire = parseInt(obj['expire']);
|
||||
callbackbody = obj['callback'];
|
||||
path = obj['dir'];
|
||||
|
||||
} else {
|
||||
mui.toast('初始化失败');
|
||||
return;
|
||||
}
|
||||
|
||||
var wt = plus.nativeUI.showWaiting();
|
||||
var task = plus.uploader.createUpload(server, {
|
||||
method: "POST"
|
||||
}, function(t, status) {
|
||||
//上传完成
|
||||
if (status == 200) {
|
||||
wt.close();
|
||||
if(1 == UP.isBatch){
|
||||
callback(t,status,keyname,server + '/'+keyname);
|
||||
}else{
|
||||
document.getElementById(inpId).value = keyname;
|
||||
var ele=document.getElementById(imgId);
|
||||
ele.src=server + '/'+keyname;
|
||||
ele.setAttribute('data-src',keyname);
|
||||
mui.toast('上传成功');
|
||||
//至此上传成功,上传后的图片完整地址为server+testName
|
||||
//keyname
|
||||
}
|
||||
|
||||
} else {
|
||||
wt.close();
|
||||
mui.toast('上传失败:' + status);
|
||||
}
|
||||
});
|
||||
var suffix1 = get_suffix(fname); //文件后缀 例如 .jpg
|
||||
keyname = path + new Date().getTime() + suffix1;
|
||||
task.addData("key", keyname);
|
||||
task.addData("policy", policyBase64);
|
||||
task.addData("OSSAccessKeyId", accessid);
|
||||
task.addData("success_action_status", "200");
|
||||
// task.addData("callback", callbackbody);
|
||||
task.addData("signature", signature);
|
||||
var f = files[files.length-1];
|
||||
// //console.log(f)
|
||||
|
||||
task.addFile(f.path, {
|
||||
key: "file",
|
||||
name: "file",
|
||||
mime: "image/jpeg"
|
||||
});
|
||||
//files.length = 0;
|
||||
task.start();
|
||||
|
||||
}
|
||||
|
||||
//得到文件名的后缀
|
||||
function get_suffix(filename) {
|
||||
var pos = filename.lastIndexOf('.');
|
||||
var suffix = '';
|
||||
if (pos != -1) {
|
||||
suffix = filename.substring(pos)
|
||||
}
|
||||
return suffix;
|
||||
}
|
||||
// 拍照添加文件
|
||||
function appendByCamera(callback) {
|
||||
plus.camera.getCamera().captureImage(function(p) {
|
||||
uploadImg(p,callback);
|
||||
});
|
||||
}
|
||||
// 从相册添加文件
|
||||
function appendByGallery(callback) {
|
||||
plus.gallery.pick(function(p) {
|
||||
uploadImg(p,callback);
|
||||
});
|
||||
}
|
||||
|
||||
// 添加文件
|
||||
var index = 1;
|
||||
function uploadImg(p,callback){
|
||||
if(1 == isZip){
|
||||
compressImg(p,callback);
|
||||
}else{
|
||||
appendFile(p,callback)
|
||||
}
|
||||
}
|
||||
function appendFile(p,callback) {
|
||||
// var fe = document.getElementById(fileId);
|
||||
var n = p.substr(p.lastIndexOf('/') + 1);
|
||||
fname = n;
|
||||
files.push({
|
||||
name: "uploadkey" + index,
|
||||
path: p
|
||||
});
|
||||
////console.log(3);
|
||||
// index++;
|
||||
upload(callback);
|
||||
}
|
||||
function compressImg(src,callback) {
|
||||
var filename = src.substring(src.lastIndexOf('/') + 1);
|
||||
var opions = {
|
||||
src: src,
|
||||
dst: '_doc/tmp/' + filename,
|
||||
overwrite: true,
|
||||
//width: '300px', //这里指定了宽度,同样可以修改
|
||||
format: 'jpg',
|
||||
quality: qualityNum //图片质量不再修改,以免失真
|
||||
};
|
||||
var successCB = function(evt) {
|
||||
// //console.log(JSON.stringify(evt));
|
||||
fname = filename;
|
||||
// files[0]={
|
||||
// name: "uploadkey",
|
||||
// path: evt.target
|
||||
// };
|
||||
files.push({
|
||||
name: "uploadkey" + index,
|
||||
path: evt.target
|
||||
});
|
||||
// index++;
|
||||
//上传
|
||||
upload(callback);
|
||||
//_this.avatar(evt.target);
|
||||
};
|
||||
var errorCB = function(err) {
|
||||
appendFile(src,callback);
|
||||
////console.log(JSON.stringify(err));
|
||||
//mui.toast("图片压缩失败");
|
||||
};
|
||||
plus.zip.compressImage(opions, successCB, errorCB);
|
||||
};
|
||||
function openCamera(callback) {
|
||||
plus.nativeUI.actionSheet({
|
||||
cancel: "取消",
|
||||
buttons: [{
|
||||
title: "拍照"
|
||||
},
|
||||
{
|
||||
title: "从相册中选择"
|
||||
}
|
||||
]
|
||||
}, function(e) { //1 是拍照 2 从相册中选择
|
||||
switch (e.index) {
|
||||
case 1:
|
||||
appendByCamera(callback);
|
||||
break;
|
||||
case 2:
|
||||
appendByGallery(callback);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
$(".photos").on("tap", '.regConfirm', function() {
|
||||
// UP.init("accountBookImg", "test", "accountBookImgTag")
|
||||
|
||||
UP.init("regConfirmImg", "test", "regConfirmImg")
|
||||
openCamera()
|
||||
})
|
||||
|
||||
|
||||
mui('.down').on('tap', '.btn', function() {
|
||||
var loginName = $('#loginName').val();
|
||||
var mobileCode = $('.yzm').val();
|
||||
var loginPwd = $('#loginPwd').val();
|
||||
var reUserPwd = $('#reUserPwd').val();
|
||||
var mobileCode1 = $('#mobileCode1').val() ? $('#mobileCode1').val() : "";//推荐人验证码
|
||||
|
||||
|
||||
pName = $('#pName').val();
|
||||
|
||||
// var verifyCode = $('.tpyzm').val();
|
||||
var regConfirmImg = $('#regConfirmImg').val();
|
||||
if (loginName == '') {
|
||||
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(loginName))) {
|
||||
mui.alert("手机号码有误,请重填!");
|
||||
return;
|
||||
}
|
||||
if (mobileCode == '') {
|
||||
mui.alert('验证码不能为空!');
|
||||
return;
|
||||
}
|
||||
if (loginPwd == '') {
|
||||
mui.alert('密码不能为空!');
|
||||
return;
|
||||
}
|
||||
if (reUserPwd == '') {
|
||||
mui.alert('确认密码不能为空!');
|
||||
return;
|
||||
}
|
||||
if (loginPwd.length < 6) {
|
||||
mui.alert('密码不能小于6位!');
|
||||
return;
|
||||
}
|
||||
if (!(loginPwd == reUserPwd)) {
|
||||
mui.alert('两次密码不一致!');
|
||||
return;
|
||||
}
|
||||
if (regConfirmImg == '') {
|
||||
mui.alert('请上传确认书照片');
|
||||
return;
|
||||
}
|
||||
if (pName != '') {
|
||||
if(''==mobileCode1){
|
||||
mui.alert('请输入推荐人验证码');
|
||||
return;
|
||||
}
|
||||
}
|
||||
$(this).attr("disabled", true);
|
||||
mui.ajax('http://t.ect99.com/app/users/register', {
|
||||
data: {
|
||||
loginName: loginName,
|
||||
mobileCode: mobileCode,
|
||||
loginPwd: loginPwd,
|
||||
reUserPwd: reUserPwd,
|
||||
pName: pName,
|
||||
nameType: 3,
|
||||
regConfirmImg: regConfirmImg,
|
||||
mobileCode1:mobileCode1
|
||||
// verifyCode: verifyCode
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
mui.alert(data.msg);
|
||||
|
||||
if (data.status == 1) {
|
||||
// mui.back();
|
||||
plus.runtime.open
|
||||
} else {
|
||||
// $('.yzmhh').attr('src', hyhUrl('mobile/users/getverify?rnd=' + Math.random()));
|
||||
}
|
||||
$('.btn').removeAttr('disabled');
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
0
js/reviewsmanage.js
Normal file
0
js/reviewsmanage.js
Normal file
77
js/saoyisao.js
Normal file
77
js/saoyisao.js
Normal file
@@ -0,0 +1,77 @@
|
||||
scan = null; //扫描对象
|
||||
mui.plusReady(function() {
|
||||
mui.init();
|
||||
startRecognize();
|
||||
});
|
||||
|
||||
function startRecognize() {
|
||||
try {
|
||||
var filter;
|
||||
//自定义的扫描控件样式
|
||||
var styles = {
|
||||
frameColor: "#29E52C",
|
||||
scanbarColor: "#29E52C",
|
||||
background: ""
|
||||
}
|
||||
//扫描控件构造
|
||||
scan = new plus.barcode.Barcode('bcid', filter, styles);
|
||||
scan.onmarked = onmarked;
|
||||
scan.onerror = onerror;
|
||||
scan.start();
|
||||
//打开关闭闪光灯处理
|
||||
var flag = false;
|
||||
document.getElementById("turnTheLight").addEventListener('tap', function() {
|
||||
if(flag == false) {
|
||||
scan.setFlash(true);
|
||||
flag = true;
|
||||
} else {
|
||||
scan.setFlash(false);
|
||||
flag = false;
|
||||
}
|
||||
});
|
||||
} catch(e) {
|
||||
mui.alert("出现错误啦:\n" + e);
|
||||
}
|
||||
};
|
||||
|
||||
function onerror(e) {
|
||||
mui.alert(e);
|
||||
};
|
||||
|
||||
function onmarked(type, result) {
|
||||
var text = '';
|
||||
switch(type) {
|
||||
case plus.barcode.QR:
|
||||
text = 'QR: ';
|
||||
break;
|
||||
case plus.barcode.EAN13:
|
||||
text = '条码: ';
|
||||
break;
|
||||
case plus.barcode.EAN8:
|
||||
text = '条码: ';
|
||||
break;
|
||||
}
|
||||
|
||||
if('http' == result.substring(0,4)){
|
||||
console.log(result);
|
||||
plus.runtime.openURL(result);
|
||||
}else{
|
||||
mui.alert(text + " : " + result);
|
||||
}
|
||||
|
||||
scan.cancel();
|
||||
scan.close();
|
||||
// scanDoit(result)
|
||||
|
||||
};
|
||||
|
||||
// 从相册中选择二维码图片
|
||||
function scanPicture() {
|
||||
plus.gallery.pick(function(path) {
|
||||
plus.barcode.scan(path, onmarked, function(error) {
|
||||
plus.nativeUI.alert("无法识别此图片");
|
||||
});
|
||||
}, function(err) {
|
||||
plus.nativeUI.alert("Failed: " + err.message);
|
||||
});
|
||||
}
|
||||
327
js/self_shop.js
Normal file
327
js/self_shop.js
Normal file
@@ -0,0 +1,327 @@
|
||||
$('.getquan').css('display', 'none');
|
||||
// $('#search').css('width', '80%');
|
||||
$('.saoyisao').hide();
|
||||
$('.class_block').eq(0).attr('data-classifyId', 5);
|
||||
$('.class_block').eq(1).attr('data-classifyId', 6);
|
||||
$('.class_block').eq(2).attr('data-classifyId', 7);
|
||||
$('.class_block').eq(3).attr('data-classifyId', 8);
|
||||
$('.class_block').eq(4).attr('data-classifyId', '');
|
||||
$('.zya_block').addClass('add_');
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'refresh');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
},
|
||||
});
|
||||
var data = '';
|
||||
var addr = '';
|
||||
var lat = '',
|
||||
lat1 = '',
|
||||
lng = '';
|
||||
var page = 1;
|
||||
var pageSize = 5;
|
||||
var count = 1;
|
||||
var isjiazai = 1;
|
||||
var nowPage = 1;
|
||||
var isLoading = false;
|
||||
mui.plusReady(function() {
|
||||
getLocation();
|
||||
function getLocation() {
|
||||
if (navigator.geolocation) {
|
||||
plus.geolocation.getCurrentPosition(showPosition, showError);
|
||||
|
||||
} else {
|
||||
mui.alert("手机不支持定位")
|
||||
}
|
||||
}
|
||||
function showPosition(position) {
|
||||
|
||||
lat = position.coords.latitude;
|
||||
lng = position.coords.longitude;
|
||||
localStorage.setItem('lat', lat);
|
||||
localStorage.setItem('lng', lng);
|
||||
getShopList(nowPage, pageSize);
|
||||
addr = position.address.city;
|
||||
localStorage.setItem('addr', addr);
|
||||
$('#location').html(addr);
|
||||
$('#location-r').html(addr);
|
||||
|
||||
}
|
||||
|
||||
function showError(error) {
|
||||
switch (error.code) {
|
||||
case error.TIMEOUT:
|
||||
mui.alert('请求超时,请重试')
|
||||
break;
|
||||
case error.POSITION_UNAVAILABLE:
|
||||
mui.alert('定位不到你的地址')
|
||||
break;
|
||||
case error.PERMISSION_DENIED:
|
||||
// case 22:
|
||||
mui.alert('您拒绝了地理位置请求')
|
||||
break;
|
||||
case error.UNKNOWN_ERROR:
|
||||
mui.alert('未知错误')
|
||||
break;
|
||||
default:
|
||||
mui.alert(error.message)
|
||||
break;
|
||||
}
|
||||
getShopList(nowPage, pageSize);
|
||||
}
|
||||
//bannerTop
|
||||
mui.ajax(qlgUrl('app/shopping/getCarousel'), {
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
if (data.status == 1) {
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
$.each(data, function() {
|
||||
html += '<div class="swiper-slide add_" 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
|
||||
});
|
||||
var topBannerheight = localStorage.getItem('topBannerheight')
|
||||
|
||||
$('#top_banner').height(topBannerheight)
|
||||
// $('#top_banner').height(($('#top_banner').width() )* 460 / 750);
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
|
||||
mui('.con').on('tap', '.bc_img', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
JZL.openWindow('details.html', 'details.html' + goodsId, {data_id: goodsId});
|
||||
})
|
||||
function getShopList(nowPage, pageSize) {
|
||||
|
||||
lat = localStorage.getItem('lat');
|
||||
lng = localStorage.getItem('lng');
|
||||
|
||||
if (null == lat) {
|
||||
lat = 36.659565;
|
||||
lng = 117.125824;
|
||||
}
|
||||
var recommenddata = {
|
||||
shopType: 1,
|
||||
page: nowPage ? nowPage : 1,
|
||||
perPage: pageSize ? pageSize : 10,
|
||||
lat: lat,
|
||||
lng: lng
|
||||
}
|
||||
if (true == isLoading) return;
|
||||
isLoading = true;
|
||||
//console.log(lat);
|
||||
JZL.ajax(hyhUrl('app/shopping/getShops'), recommenddata, function(data) {
|
||||
|
||||
var html = '';
|
||||
if (1 == data.status) {
|
||||
var data = data.data;
|
||||
// console.log(data);
|
||||
if ('' == data.Rows) {
|
||||
$('.shoplist').append(
|
||||
'<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多数据</p>');
|
||||
// isLoading = false;
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function(index, element) {
|
||||
html +=
|
||||
'<div class="con shadown_wai" data-shopId="' + this.shopId +
|
||||
'"><div class="shops-content1-title" data-shopId="' + this.shopId +
|
||||
'" data-shopName="'+this.shopName +'" ><span class="logoimg"><img src="' + hyhImgUrl(this.shopImg) +
|
||||
'"alt=""></span><span class="shop-name">' +
|
||||
this.shopName + '</span><span class="gogogo">进店逛逛</span></div><div class="t_con">'
|
||||
if (0 != this.goods.length) {
|
||||
$.each(this.goods, function(idx, ele) {
|
||||
|
||||
html += '<div class="t_con_ bc_img" data-goodsId="' + this.goodsId +
|
||||
'"><div class="t_con_img"><img src="' + hyhImgUrl(this.goodsImg) + '" data-goodsId="' + this.goodsId +
|
||||
'" alt=""></div><span>¥' + this.shopPrice + '</span></div>'
|
||||
})
|
||||
}
|
||||
|
||||
html += '</div><div class="pos clearfix"><img src="../img/dingwei1.png"><span>距离:' + this.distance / 1000 +
|
||||
'公里</span></div></div>'
|
||||
})
|
||||
if (nowPage == 1) {
|
||||
$('.shoplist').html(html);
|
||||
} else {
|
||||
$('.shoplist').append(html);
|
||||
}
|
||||
isLoading = false;
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
//加载
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isLoading == false) {
|
||||
nowPage++;
|
||||
// getShops(nowPage, pageSize);
|
||||
getShopList(nowPage, pageSize)
|
||||
}
|
||||
}
|
||||
})
|
||||
mui('.shoplist').on('tap', '.shops-content1-title', function() {
|
||||
// var goodsId = $(this).attr('data-goodsId');
|
||||
var shopName = $(this).attr("data-shopName");
|
||||
var shopId = $(this).attr("data-shopId");
|
||||
JZL.openWindow('storeout.html', 'storeout.html', {shopName: shopName,shopId: shopId});
|
||||
})
|
||||
})
|
||||
|
||||
//获取推荐页
|
||||
function getRecommend(page, pagesize) {
|
||||
var recommenddata = {
|
||||
type:1,
|
||||
page: page ? page : 1,
|
||||
pagesize: pageSize ? pageSize : 10
|
||||
}
|
||||
if (isjiazai == 0) {
|
||||
return;
|
||||
} else {
|
||||
isjiazai = 0;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/shopping/getGoods'), recommenddata, function(data) {
|
||||
// console.log(data);
|
||||
// if (data.status == 1) {
|
||||
var html = '';
|
||||
// var data = data.data;
|
||||
if (data.Rows == '') {
|
||||
$('.self_shop_rem').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:inline-block;" 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></div><div style="display:none"><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 {
|
||||
// mui.alert(data.msg)
|
||||
// }
|
||||
})
|
||||
}
|
||||
$('.bcon_left').height($('.bcon_left').width() * 345 / 185);
|
||||
$('.bcon_left img').height($('.bcon_left img').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);
|
||||
$('.zya_block').height($('.zya_block').width() * 185 / 355);
|
||||
|
||||
var issx = 0;
|
||||
|
||||
// 轮播图跳转
|
||||
$('#slider').on('tap', '.swiper-slide', function() {
|
||||
openAds($(this));
|
||||
})
|
||||
|
||||
//导航栏
|
||||
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');
|
||||
$('.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');
|
||||
$('.header').addClass('shadown_wai');
|
||||
}
|
||||
|
||||
if (scroll.y > 80 && issx == 0) {
|
||||
issx = 1;
|
||||
setTimeout(function() {
|
||||
location.reload()
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
mui('.classify').on('tap', '.class_block', function() {
|
||||
var classifyId = $(this).attr('data-classifyId');
|
||||
var url = 'orSupermarket.html';
|
||||
|
||||
if (classifyId == '') {
|
||||
url = 'ac3.html';
|
||||
}
|
||||
JZL.openWindow(url, url, {classifyId: classifyId});
|
||||
})
|
||||
|
||||
//为你推荐
|
||||
getRecommend(page, pageSize);
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isjiazai == 1) {
|
||||
page++;
|
||||
getRecommend(page, pageSize);
|
||||
}
|
||||
}
|
||||
})
|
||||
//搜索
|
||||
$('.header').on('focus', '#keyword', function() {
|
||||
$(".search button").css('display', 'block');
|
||||
})
|
||||
$('.header').on('blur', '#keyword', function() {
|
||||
$(".search button").css('display', 'none');
|
||||
})
|
||||
$(".header").on('tap', '.search button', function(e) {
|
||||
var searchName = $('#keyword').val();
|
||||
JZL.openWindow('goodslist.html', 'goodslist.html', {data_keyword: searchName});
|
||||
$('#keyword').val("")
|
||||
// JZL.openWindow('shopsList.html', 'shopsList.html', {data_keyword: searchName});
|
||||
//JZL.openWindow('shopgoodList.html', 'shopgoodList.html', {data_keyword: searchName});
|
||||
});
|
||||
//跳转商品详情页
|
||||
mui("body").on('tap', '.bc_img', function() {
|
||||
var goodsId = $(this).attr('data-goodsId');
|
||||
var shopId = $(this).parent().parent().attr('data-shopId');
|
||||
JZL.openWindow('details.html', 'details.html' + goodsId, {data_id: goodsId,shopId: shopId});
|
||||
})
|
||||
67
js/setting.js
Normal file
67
js/setting.js
Normal file
@@ -0,0 +1,67 @@
|
||||
$('.header_con .title').html('设置');
|
||||
$('#setting_loginInfo').hide();
|
||||
$('#connect_our').hide();
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
mui('.block').on('tap', '.row', function() {
|
||||
var url = $(this).attr('id');
|
||||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
$('.loginout').on('tap', function() {
|
||||
////console.log(111)
|
||||
mui.ajax(qlgUrl('app/users/logout'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
// //console.log(data.data.goodsFavoritesNum)
|
||||
localStorage.removeItem("token");
|
||||
mui.fire(plus.webview.getWebviewById('templete/my.html'), 'refresh');
|
||||
mui.fire(plus.webview.getWebviewById('templete/shoppingcart.html'), 'refresh');
|
||||
mui.back();
|
||||
var data = toJson(data, 1);
|
||||
if(data.status == 1) {
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
183
js/setting_address.js
Normal file
183
js/setting_address.js
Normal file
@@ -0,0 +1,183 @@
|
||||
$('.header_con .title').html('编辑收货地址');
|
||||
|
||||
$('.mui-scroll-wrapper').addClass('scroll_out_t').removeClass('scroll_out');
|
||||
$('.footer_btn').css('z-index', '10000')
|
||||
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
//触发父页面的自定义事件(refresh),从而进行刷新
|
||||
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mui.plusReady(function() {
|
||||
window.addEventListener('reload', function(e) { //执行刷新
|
||||
location.reload();
|
||||
});
|
||||
var self = plus.webview.currentWebview();
|
||||
var isOrder = self.data_isOrder;
|
||||
if (isOrder == true) {
|
||||
$('.con').on('tap', '.block', function() {
|
||||
var addressId = $(this).attr('data-addressId');
|
||||
localStorage.setItem('addressId', addressId);
|
||||
var list = plus.webview.currentWebview().opener();
|
||||
mui.fire(list, 'setAddress');
|
||||
mui.back();
|
||||
})
|
||||
}
|
||||
mui.ajax(qlgUrl('app/useraddress/getList'), {
|
||||
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 = '';
|
||||
$.each(data.addressList, function() {
|
||||
html += '<div class="block" data-addressId="' + this.addressId + '"><p class="pname">' + this.userName +
|
||||
'</p><p class="pphone">' + this.userPhone + '</p><p class="paddress">' + this.areaName + ' ' + this.userAddress +
|
||||
'</p><hr /><div class="btnout" data-isDefault="' + this.isDefault +
|
||||
'"><div class="btn"></div></div><p class="p1">设为默认地址</p><button class="bj">编辑</button><button class="del">删除</button></div>'
|
||||
});
|
||||
$('.con').html(html)
|
||||
$('.btnout').each(function(num) {
|
||||
if ($(this).attr('data-isDefault') == 1) {
|
||||
$(this).children('.btn').addClass('on')
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('tap', '.footer_btn', function() {
|
||||
mui.openWindow({
|
||||
url: 'editAddress.html',
|
||||
id: 'editAddress.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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$('.con').on('tap', '.bj', function(e) {
|
||||
e.stopPropagation();
|
||||
var data_addressId = $(this).parent().attr('data-addressId');
|
||||
mui.openWindow({
|
||||
url: 'editAddress.html',
|
||||
id: 'editAddress.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {
|
||||
data_addressId: data_addressId
|
||||
// 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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
$('.con').on('tap', '.del', function() {
|
||||
var data_addressId = $(this).parent().attr('data-addressId');
|
||||
if (confirm('确认删除地址?')) {
|
||||
mui.ajax(hyhUrl('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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
$('.con').on('tap', '.btnout', function() {
|
||||
$('.btnout').children('.btn').removeClass('on');
|
||||
$(this).children('.btn').addClass('on');
|
||||
var addressId = $(this).parent().attr('data-addressId')
|
||||
mui.ajax(hyhUrl('app/Useraddress/setDefault'), {
|
||||
data: {
|
||||
id: 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);
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
200
js/setting_fogetPayPwd.js
Normal file
200
js/setting_fogetPayPwd.js
Normal file
@@ -0,0 +1,200 @@
|
||||
$('#newPass').attr('type','text');
|
||||
$('#newPass2').attr('type','text');
|
||||
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
var wait = 120;
|
||||
|
||||
function time() {
|
||||
|
||||
if(wait == 0) {
|
||||
$('#mobileCode').removeAttr("disabled");
|
||||
$('#mobileCode').val("重新发送");
|
||||
wait = 120;
|
||||
} else {
|
||||
$('#mobileCode').attr("disabled", true);
|
||||
$('#mobileCode').val("重新发送(" + wait + ")");
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
time();
|
||||
},
|
||||
1000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mui.ajax(hyhUrl('app/users/backPayPass'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
if(data.status == 1) {
|
||||
data = data.data;
|
||||
if(data.userPhone) {
|
||||
$('#userPhone').val(data.userPhone);
|
||||
$('#userPhone').attr('disabled', 'disabled');
|
||||
} else {
|
||||
alert('未绑定手机请先绑定手机!');
|
||||
mui.openWindow({
|
||||
url: 'setting_phone.html',
|
||||
id: 'setting_phone.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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
mui('.row').on('tap', '#mobileCode', function() {
|
||||
var that = $(this);
|
||||
|
||||
$(this).attr("disabled", true);
|
||||
mui.ajax(hyhUrl('app/users/backpayCode'), {
|
||||
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
var data = toJson(data);
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
if(data.status == 1) {
|
||||
time();
|
||||
} else {
|
||||
alert(data.msg)
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// alert(type)
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
mui('.down').on('tap', '#true', function() {
|
||||
var phoneCode = $('#phoneCode').val();
|
||||
var that = $(this);
|
||||
if(phoneCode == '') {
|
||||
alert('验证码不能为空!');
|
||||
return;
|
||||
} else if(phoneCode.length < 4) {
|
||||
alert('验证码格式不正确!');
|
||||
return;
|
||||
}
|
||||
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/users/verifybackPay'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
phoneCode: phoneCode
|
||||
},
|
||||
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) {
|
||||
$('#con1').css('display', 'none');
|
||||
$('#down1').css('display', 'none');
|
||||
$('#con2').css('display', 'block');
|
||||
$('#down2').css('display', 'block');
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled')
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
mui('.down').on('tap', '#true2', function() {
|
||||
var newPass = $('#newPass').val();
|
||||
var newPass2 = $('#newPass2').val();
|
||||
var that = $(this);
|
||||
if(newPass == '') {
|
||||
alert('支付密码不能为空!');
|
||||
return;
|
||||
} else if(newPass.length != 6) {
|
||||
alert('支付密码为6位!');
|
||||
return;
|
||||
} else if(newPass != newPass2) {
|
||||
alert('两次支付密码不相同!');
|
||||
return;
|
||||
}
|
||||
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/users/resetbackPay'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
newPass: newPass
|
||||
},
|
||||
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);
|
||||
mui.back();
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled')
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
208
js/setting_fogetPwd.js
Normal file
208
js/setting_fogetPwd.js
Normal file
@@ -0,0 +1,208 @@
|
||||
mui.plusReady(function() {
|
||||
var wait = 120;
|
||||
|
||||
function time() {
|
||||
|
||||
if (wait == 0) {
|
||||
$('#mobileCode').removeAttr("disabled");
|
||||
$('#mobileCode').val("重新发送");
|
||||
wait = 120;
|
||||
} else {
|
||||
$('#mobileCode').attr("disabled", true);
|
||||
$('#mobileCode').val("重新发送(" + wait + ")");
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
time();
|
||||
},
|
||||
1000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mui('.row').on('tap', '#mobileCode', function() {
|
||||
var that = $(this);
|
||||
|
||||
$(this).attr("disabled", true);
|
||||
mui.ajax(qlgUrl('app/users/getfindPhone'), {
|
||||
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
var data = toJson(data);
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
if (data.status == 1) {
|
||||
time();
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type)
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
mui('.down').on('tap', '#true0', function() {
|
||||
var loginName0 = $('#loginName0').val();
|
||||
var that = $(this);
|
||||
if (loginName0 == '') {
|
||||
mui.alert('用户名不能为空!');
|
||||
return;
|
||||
}
|
||||
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/users/findPass'), {
|
||||
|
||||
data: {
|
||||
loginName: loginName0,
|
||||
step: 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) {
|
||||
$('#con0').css('display', 'none');
|
||||
$('#down0').css('display', 'none');
|
||||
$('#con1').css('display', 'block');
|
||||
$('#down1').css('display', 'block');
|
||||
mui.ajax(hyhUrl('app/users/forgetPasst'), {
|
||||
|
||||
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) {
|
||||
$('#loginName').val(data.data.loginName);
|
||||
$('#loginName').attr('disabled', 'disabled');
|
||||
$('#userPhone').val(data.data.userPhone);
|
||||
$('#userPhone').attr('disabled', 'disabled');
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled')
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled')
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
mui('.down').on('tap', '#true', function() {
|
||||
var phoneCode = $('#phoneCode').val();
|
||||
var that = $(this);
|
||||
if (phoneCode == '') {
|
||||
mui.alert('验证码不能为空!');
|
||||
return;
|
||||
} else if (phoneCode.length < 4) {
|
||||
mui.alert('验证码格式不正确!');
|
||||
return;
|
||||
}
|
||||
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/users/findPass'), {
|
||||
data: {
|
||||
Checkcode: phoneCode,
|
||||
modes: 1,
|
||||
step: 2
|
||||
},
|
||||
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(data);
|
||||
//alert(1)
|
||||
document.getElementById("con1").style.display = "none";
|
||||
document.getElementById("down1").style.display = "none";
|
||||
document.getElementById("con2").style.display = "block";
|
||||
document.getElementById("down2").style.display = "block";
|
||||
|
||||
//$('#con1').css('display', 'none');
|
||||
//$('#down1').css('display', 'none');
|
||||
//$('#con2').css('display', 'block');
|
||||
//$('#down2').css('display', 'block');
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled')
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
mui('.down').on('tap', '#true2', function() {
|
||||
var loginPwd = $('#loginPwd').val();
|
||||
var repassword = $('#repassword').val();
|
||||
var that = $(this);
|
||||
if (loginPwd == '') {
|
||||
mui.alert('登录密码不能为空!');
|
||||
return;
|
||||
} else if (loginPwd.length < 6) {
|
||||
mui.alert('登录密码最少为6位!');
|
||||
return;
|
||||
} else if (loginPwd != repassword) {
|
||||
mui.alert('两次支付密码不相同!');
|
||||
return;
|
||||
}
|
||||
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/users/findPass'), {
|
||||
data: {
|
||||
step: 3,
|
||||
loginPwd: loginPwd,
|
||||
repassword: repassword
|
||||
},
|
||||
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);
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
34
js/setting_loginInfo.js
Normal file
34
js/setting_loginInfo.js
Normal file
@@ -0,0 +1,34 @@
|
||||
mui('.block').on('tap', '.row', function() {
|
||||
var url = $(this).attr('id');
|
||||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
58
js/setting_payPwd.js
Normal file
58
js/setting_payPwd.js
Normal file
@@ -0,0 +1,58 @@
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
|
||||
mui('.down').on('tap', '#true', function() {
|
||||
var that = $(this)
|
||||
var oldPass = $('#oldPass').val();
|
||||
var newPass = $('#newPass').val();
|
||||
var newPass2 = $('#newPass2').val();
|
||||
|
||||
if (oldPass == '') {
|
||||
mui.alert('原支付密码不能为空!');
|
||||
return;
|
||||
}
|
||||
if (newPass == '') {
|
||||
mui.alert('新支付密码不能为空!');
|
||||
return;
|
||||
}
|
||||
if (newPass.length != 6) {
|
||||
mui.alert('新支付密码长度为6位!');
|
||||
return;
|
||||
}
|
||||
if (!(newPass == newPass2)) {
|
||||
mui.alert('两次支付密码不一致!');
|
||||
return;
|
||||
}
|
||||
|
||||
$(this).attr("disabled", true);
|
||||
mui.ajax(qlgUrl('app/users/editpayPwd'), {
|
||||
|
||||
data: {
|
||||
oldPass: oldPass,
|
||||
newPass: newPass,
|
||||
reNewPass: newPass2
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
var data = toJson(data);
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
if (data.status == 1) {
|
||||
mui.alert(data.msg);
|
||||
mui.back();
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type)
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
})
|
||||
258
js/setting_phone.js
Normal file
258
js/setting_phone.js
Normal file
@@ -0,0 +1,258 @@
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
var isBang = 0;
|
||||
var isOver = 1;
|
||||
var wait = 120;
|
||||
var wait1 = 120;
|
||||
|
||||
function time() {
|
||||
|
||||
if (wait == 0) {
|
||||
$('#mobileCode').removeAttr("disabled");
|
||||
$('#mobileCode').val("重新发送");
|
||||
wait = 120;
|
||||
} else {
|
||||
$('#mobileCode').attr("disabled", true);
|
||||
$('#mobileCode').val("重新发送(" + wait + ")");
|
||||
wait--;
|
||||
setTimeout(function() {
|
||||
time();
|
||||
},
|
||||
1000)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function time1() {
|
||||
|
||||
if (wait1 == 0) {
|
||||
$('#mobileCode1').removeAttr("disabled");
|
||||
$('#mobileCode1').val("重新发送");
|
||||
wait1 = 120;
|
||||
} else {
|
||||
$('#mobileCode1').attr("disabled", true);
|
||||
$('#mobileCode1').val("重新发送(" + wait1 + ")");
|
||||
wait1--;
|
||||
setTimeout(function() {
|
||||
time1();
|
||||
},
|
||||
1000)
|
||||
}
|
||||
|
||||
}
|
||||
mui.ajax(qlgUrl('app/users/editPhone'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
var data = toJson(data);
|
||||
if (data.status == 1) {
|
||||
data = data.data;
|
||||
|
||||
if (data.userPhone) {
|
||||
isBang = 1;
|
||||
$('#userPhone').val(data.userPhone);
|
||||
$('#userPhone').attr('disabled', 'disabled');
|
||||
$('#next_btn').css('display', 'block');
|
||||
} else {
|
||||
$('#true').css('display', 'block');
|
||||
}
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
mui('.row').on('tap', '.codeBtn', function() {
|
||||
var that = $(this)
|
||||
var userPhone = $('#userPhone').val();
|
||||
var url = $(this).attr('id') == 'mobileCode' ? 'sendCodeEdit' : 'sendCodeTie'
|
||||
if (isBang == 0 || isOver == 0) {
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
userPhone = '';
|
||||
}
|
||||
|
||||
$(this).attr("disabled", true);
|
||||
mui.ajax(qlgUrl('app/users/' + url), {
|
||||
|
||||
data: {
|
||||
userPhone: userPhone
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
var data = toJson(data);
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
if (data.status == 1) {
|
||||
|
||||
if (that.attr('id') == 'mobileCode') {
|
||||
time();
|
||||
} else if (that.attr('id') == 'mobileCode1') {
|
||||
time1();
|
||||
}
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type)
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
//未绑定手机
|
||||
mui('.down').on('tap', '#true', function() {
|
||||
var phoneCode = $('#phoneCode').val();
|
||||
var that = $(this);
|
||||
if (phoneCode == '') {
|
||||
mui.alert('验证码不能为空!');
|
||||
return;
|
||||
} else if (phoneCode.length < 4) {
|
||||
mui.alert('验证码格式不正确!');
|
||||
return;
|
||||
}
|
||||
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/users/phoneEdit'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
phoneCode: phoneCode
|
||||
},
|
||||
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);
|
||||
mui.back();
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled')
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
//已绑定手机 1
|
||||
mui('.down').on('tap', '#next_btn', function() {
|
||||
var phoneCode = $('#phoneCode').val();
|
||||
var that = $(this);
|
||||
if (phoneCode == '') {
|
||||
mui.alert('验证码不能为空!');
|
||||
return;
|
||||
} else if (phoneCode.length < 4) {
|
||||
mui.alert('验证码格式不正确!');
|
||||
return;
|
||||
}
|
||||
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/users/phoneEdito'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
phoneCode: phoneCode
|
||||
},
|
||||
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) {
|
||||
$('#next_btn').css('display', 'none');
|
||||
$('#next_true').css('display', 'block');
|
||||
$('#userPhone').removeAttr('disabled');
|
||||
$('#userPhone').val('');
|
||||
$('#phoneCode').val('');
|
||||
$('#mobileCode').css('display', 'none');
|
||||
$('#mobileCode1').css('display', 'block');
|
||||
isOver = 0;
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
//已绑定手机 2
|
||||
mui('.down').on('tap', '#next_true', function() {
|
||||
var phoneCode = $('#phoneCode').val();
|
||||
var that = $(this);
|
||||
if (phoneCode == '') {
|
||||
mui.alert('验证码不能为空!');
|
||||
return;
|
||||
} else if (phoneCode.length < 4) {
|
||||
mui.alert('验证码格式不正确!');
|
||||
return;
|
||||
}
|
||||
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/users/phoneEdit'), {
|
||||
headers: {
|
||||
"HYH-Token": token
|
||||
},
|
||||
data: {
|
||||
phoneCode: phoneCode
|
||||
},
|
||||
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);
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
60
js/setting_pwd.js
Normal file
60
js/setting_pwd.js
Normal file
@@ -0,0 +1,60 @@
|
||||
mui.plusReady(function() {
|
||||
var token = localStorage.getItem('token');
|
||||
|
||||
mui('.down').on('tap', '#true', function() {
|
||||
var that = $(this)
|
||||
var oldPass = $('#oldPass').val();
|
||||
var newPass = $('#newPass').val();
|
||||
var newPass2 = $('#newPass2').val();
|
||||
|
||||
if(oldPass == '') {
|
||||
mui.alert('原支付密码不能为空!');
|
||||
return;
|
||||
}
|
||||
if(newPass == '') {
|
||||
mui.alert('新支付密码不能为空!');
|
||||
return;
|
||||
}
|
||||
if(newPass.length < 6) {
|
||||
mui.alert('新支付密码不能小于6位!');
|
||||
return;
|
||||
}
|
||||
if(!(newPass == newPass2)) {
|
||||
mui.alert('两次支付密码不一致!');
|
||||
return;
|
||||
}
|
||||
|
||||
$(this).attr("disabled", true);
|
||||
mui.ajax(qlgUrl('app/users/editloginPwd'), {
|
||||
|
||||
data: {
|
||||
oldPass: oldPass,
|
||||
newPass: newPass
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒
|
||||
success: function(data) {
|
||||
var data = toJson(data);
|
||||
//服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//console.log(data.status)
|
||||
if(data.status == 1) {
|
||||
|
||||
mui.alert(data.msg);
|
||||
mui.back();
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
|
||||
error: function(xhr, type, errorThrown) {
|
||||
//异常处理;
|
||||
// mui.alert(type)
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
})
|
||||
39
js/setting_user.js
Normal file
39
js/setting_user.js
Normal file
@@ -0,0 +1,39 @@
|
||||
$('.header_con .title').html('个人信息');
|
||||
|
||||
$('.block').addClass('scroll_out_t')
|
||||
|
||||
mui('.block').on('tap', '.row', function() {
|
||||
var url = $(this).attr('id');
|
||||
//console.log($(this));
|
||||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
225
js/shangdu.js
Normal file
225
js/shangdu.js
Normal file
@@ -0,0 +1,225 @@
|
||||
mui.plusReady(function() {
|
||||
// 获取申请信息
|
||||
var self = plus.webview.currentWebview();
|
||||
//console.log(self);
|
||||
var id = self.ssid ? self.ssid : '';
|
||||
JZL.ajax(qlgUrl('app/shops/getUserUpdate'), {
|
||||
applyLevel: 4
|
||||
}, 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 = "";
|
||||
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>';
|
||||
})
|
||||
// var maxNum = $('.galleryImg').last().attr('data-id'); //$('.batchImg').children('.galleryImg').length - 1;
|
||||
var maxNum = imgs.length - 1;
|
||||
// //console.log(maxNum);
|
||||
// //console.log(num);
|
||||
// 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: 117
|
||||
}, 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: 117
|
||||
}, 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()
|
||||
})
|
||||
$(".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];
|
||||
}
|
||||
})
|
||||
|
||||
// 获取店铺信息
|
||||
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)
|
||||
}
|
||||
// })
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let 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");
|
||||
|
||||
// var shopId=$("#chooseshop option:selected").val()
|
||||
// //console.log(shopId);
|
||||
// params.shopId=shopId;
|
||||
params.applyLevel = 4;
|
||||
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)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
126
js/shop_decorate.js
Normal file
126
js/shop_decorate.js
Normal file
@@ -0,0 +1,126 @@
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
//console.log(self);
|
||||
var shopId = self.id;
|
||||
//获取店铺相册
|
||||
JZL.ajax(qlgUrl('app/shops/getShopImg'), {
|
||||
shopId: shopId
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status && '' != data.data.shopImg) {
|
||||
$('#shop').attr('src', hyhImgUrl(data.data.shopImg))
|
||||
$('#shopImg').val(data.data.shopImg)
|
||||
if ('' != data.data.shopAds) {
|
||||
var shopAds = data.data.shopAds;
|
||||
|
||||
ads = shopAds.split(",")
|
||||
//console.log(ads);
|
||||
var html = '';
|
||||
mui.each(ads, function(index, element) {
|
||||
//console.log(element);
|
||||
html += '<div data-id="' + index +
|
||||
'" data-src="" class="galleryImg photo"><div class="delete"><img src="../img/close.png" alt=""></div><img src= "' +
|
||||
hyhImgUrl(element) + '" class="ossfile" id="galleryImg[' + index + ']" alt=""><input type="hidden" value="' +
|
||||
element + '" name="gallery[]" class="gallery inp" id="gallery[' + index + ']"><span class=""></span></div>'
|
||||
})
|
||||
var maxNum = ads.length;
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
$(".oneImg").on("tap", '#shop', function() {
|
||||
// UP.init("accountBookImg", "test", "accountBookImgTag")
|
||||
|
||||
UP.init("shopImg", "test", "shop")
|
||||
openCamera()
|
||||
})
|
||||
// 删除图片
|
||||
$(".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 click = false;
|
||||
$('.bc_btn').on('tap', 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(','));
|
||||
$('#shopAds').val(imgs);
|
||||
if ($.trim($('#shopImg').val()) == '') {
|
||||
mui.alert("请上传店铺主图")
|
||||
return
|
||||
}
|
||||
if ($.trim($('#shopAds').val()) == '') {
|
||||
mui.alert("请上传店铺图片")
|
||||
return
|
||||
}
|
||||
var params = JZL.getParams(".inp");
|
||||
params.shopId = shopId;
|
||||
click == true;
|
||||
JZL.ajax(qlgUrl('app/shops/uploadShopImg'), params, function(data) {
|
||||
if (data.status == 1) {
|
||||
mui.toast('保存成功');
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
})
|
||||
44
js/shop_indent.js
Normal file
44
js/shop_indent.js
Normal file
@@ -0,0 +1,44 @@
|
||||
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.shopId;
|
||||
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 == 'waitConfirm') {
|
||||
$('.title').html('待确认');
|
||||
}
|
||||
if(data_href == 'abnormal') {
|
||||
$('.title').html('退款/售后');
|
||||
}
|
||||
localStorage.setItem('shop_order_class', data_href);
|
||||
var bSize = 64 + (+localStorage.getItem('ipxSizeTop')) + 'px';
|
||||
var sub = plus.webview.create('shop_indentcon.html', data_href, {
|
||||
top: bSize,
|
||||
bottom: '0px',
|
||||
scrollIndicator: 'none',
|
||||
|
||||
},{ shopId:shopId});
|
||||
self.append(sub);
|
||||
|
||||
})
|
||||
831
js/shop_indentcon.js
Normal file
831
js/shop_indentcon.js
Normal file
@@ -0,0 +1,831 @@
|
||||
$('#content').after('<div class="tui"></div>');
|
||||
var pay_name = 0;
|
||||
var token = localStorage.getItem('token');
|
||||
var order_class = localStorage.getItem('shop_order_class');
|
||||
var orderNo;
|
||||
var orderId;
|
||||
var getReasonUrl = '';
|
||||
var priceT = 0;
|
||||
var payCode = '';
|
||||
var shopId = '';
|
||||
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
|
||||
},
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
var count = 1;
|
||||
|
||||
function pullupRefresh() {
|
||||
count += 1;
|
||||
getData(count);
|
||||
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
|
||||
}
|
||||
// //console.log(order_class);
|
||||
/**
|
||||
* 下拉刷新具体业务实现
|
||||
*/
|
||||
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/Shoporders/getSellerOrderList'), {
|
||||
type: order_class,
|
||||
shopId: shopId,
|
||||
page: page,
|
||||
pagesize: 10
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
var data = toJson(data);
|
||||
var html = '',
|
||||
html1 = "";
|
||||
if (1 == data.status) {
|
||||
// console.log(data);
|
||||
if ('' == data.data.Rows) {
|
||||
mui('#pullrefresh').pullRefresh().endPullupToRefresh(true);
|
||||
return;
|
||||
}
|
||||
$.each(data.data.Rows, function() {
|
||||
//this.pay_name = 1;
|
||||
var shopConfirmHtml = '';
|
||||
// console.log(this.orderStatus);
|
||||
// if ( == 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 yellow">' +
|
||||
// this.status + '</div>' + shopConfirmHtml + '<div class="indent_status shopPhone">商家电话:<a href="tel:' +
|
||||
// this.phone + '">'+this.phone+'</a></div></div><div class="row_con clearfix" data-id="' + this.orderId +
|
||||
// '">'
|
||||
html += '<div class="row shadown_wai" data-orderNo="' + this.orderNo + '" data-id="' + this.orderId +
|
||||
'"><div class="row_title"><div class="rtl store_no">订单编号:' + this.orderNo +
|
||||
'</div><div class="rtr indent_time">' + this.createTime +
|
||||
'</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="rc clearfix"><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></del><span>x' + this.goodsNum +
|
||||
'</span></div></div><div class="rcb clearfix"><span>优惠</span><span>优惠:0.52</span><span>优惠:0.52</span></div></div></div>'
|
||||
// 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="row_title clearfix"><div class="rtl user_info">买家信息</div><div class="rtr combination">共' +
|
||||
this.list.length + '件商品 合计:<o>¥' + this.realTotalMoney + '</o>(含运费¥0.00)</div></div>'
|
||||
html +=
|
||||
'<div class="user_info_"><div class="u_address"><div class="pos"><img src="../img/dingwei1.png"></div><div class="pos_c"><p class="pos_c_p">地址:</p><p for="">' +
|
||||
this.userAddress +
|
||||
'</p></div></div><div class="u_address"><div class="pos"><img src="../img/dingwei1.png"></div><div class="pos_c"><p class="">电话:</p><p>' +
|
||||
this.userPhone + '</p><p>' + this.userName + '</p></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 clearfix"><div class="btns_btn ">未付款</div></div>'
|
||||
// html += '<div class="btns_btn ljfk" data-payName="' + this.pay_name +
|
||||
// '">立即付款</div><div class="btns_btn qxdd_js">取消订单</div>';
|
||||
} else if (this.orderStatus == -1) {
|
||||
if (1 == this.isPay) {
|
||||
if (1 == this.isRefund) {
|
||||
//yituikuan
|
||||
// html += '<div class="btns clearfix"><div class="btns_btn ">已退款</div></div>'
|
||||
html +=
|
||||
'<div class="btns clearfix"><div class="btns_btn ">已退款</div><div class="btns_btn ">订单已取消</div></div>'
|
||||
} else {
|
||||
//tuikuancaozuoanniu
|
||||
// html += '<div class="btns clearfix"><div class="btns_btn qrtk">确认退款</div></div>'
|
||||
html +=
|
||||
'<div class="btns clearfix"><div class="btns_btn ">确认退款</div><div class="btns_btn ">订单已取消</div></div>'
|
||||
|
||||
}
|
||||
} else {
|
||||
html += '<div class="btns clearfix"><div class="btns_btn ">订单已取消</div></div>'
|
||||
} //0 daiqueren 1 queren 2 jujue
|
||||
} else if (this.orderStatus == 0) {
|
||||
if (1 == this.shopConfirm) {
|
||||
html += '<div class="btns clearfix"><div class="btns_btn qrfh">确认发货</div></div>'
|
||||
} else if (0 == this.shopConfirm) {
|
||||
html += '<div class="btns clearfix"><div class="btns_btn qrsk">确认收款</div></div>'
|
||||
} else if (2 == this.shopConfirm) {
|
||||
html +=
|
||||
'<div class="btns clearfix"><div class="btns_btn qrsk">确认收款</div><div class="btns_btn ">已拒绝</div></div>'
|
||||
|
||||
}
|
||||
|
||||
// html +='<div class="btns clearfix"><div class="btns_btn qrfh">确认发货</div></div>'
|
||||
//html +=
|
||||
// '<div class="btns clearfix"><div class="btns_btn qrfh">确认发货</div><div class="btns_btn qrsk">确认收款</div></div>'
|
||||
} else if (this.orderStatus == 1) {
|
||||
html += '<div class="btns clearfix"><div class="btns_btn yfh">已发货</div><div class="btns_btn">配送中</div></div>'
|
||||
} else if (this.orderStatus == 2) {
|
||||
html +=
|
||||
'<div class="btns clearfix"><div class="btns_btn finish">已完成</div><div class="btns_btn tjpz">提交凭证</div></div>'
|
||||
} else if (this.orderStatus == -3) {
|
||||
// html += '<div class="btns clearfix"><div class="btns_btn yhjs">用户拒收</div></div>'
|
||||
if (1 == this.isPay) {
|
||||
if (1 == this.isRefund) {
|
||||
//yituikuan
|
||||
html +=
|
||||
'<div class="btns clearfix"><div class="btns_btn ">已退款</div><div class="btns_btn ">用户拒收</div></div>'
|
||||
|
||||
} else {
|
||||
//tuikuancaozuoanniu
|
||||
// html += '<div class="btns clearfix"><div class="btns_btn qrtk">确认退款</div></div>'
|
||||
html +=
|
||||
'<div class="btns clearfix"><div class="btns_btn qrtk">确认退款</div><div class="btns_btn ">用户拒收</div></div>'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if(-1 == this.orderStatus || -3 ==this.orderStatus){
|
||||
// if(1 == this.isPay){
|
||||
// if(1 == this.isRefund){
|
||||
// //yituikuan
|
||||
// html += '<div class="btns clearfix"><div class="btns_btn ">已退款</div></div>'
|
||||
//
|
||||
// }else{
|
||||
// //tuikuancaozuoanniu
|
||||
// html += '<div class="btns clearfix"><div class="btns_btn qrtk">确认退款</div></div>'
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
html1 = '<span>产品券:' + this.productNum + '</span><span>优惠券:' + this.couponsNum + '</span><br/><span>旺旺券:' +
|
||||
this.wangNum + '<span>';
|
||||
html += '</div>'
|
||||
})
|
||||
|
||||
$('.con').append(html);
|
||||
$(".rcb").html(html1)
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
isLoad = false;
|
||||
})
|
||||
}
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
// //console.log(self);
|
||||
shopId = self.shopId;
|
||||
getData(count);
|
||||
// window.addEventListener('refresh', function(e) { //执行刷新
|
||||
// location.reload();
|
||||
// });
|
||||
// //console.log(order_class)
|
||||
if (order_class == 'all') {
|
||||
order_class = '';
|
||||
|
||||
}
|
||||
// 已付款 店家确认收款
|
||||
$('.con').on('tap', '.qrsk', function() {
|
||||
orderId = $(this).parent().parent().attr('data-id');
|
||||
$('.bg').css('display', 'block')
|
||||
$('#querenshoukuan').css('display', 'block')
|
||||
})
|
||||
$('#querenshoukuan').on('tap', '.pay_btn', function() {
|
||||
// orderId = $(this).parent().parent().attr('data-id');
|
||||
var confirmType = $('#querenshoukuan input[type="radio"]:checked').val();
|
||||
//console.log(confirmType,orderId,shopId);
|
||||
JZL.ajax(qlgUrl('app/Shoporders/orderConfirm'), {
|
||||
confirmType: confirmType,
|
||||
shopId: shopId,
|
||||
id: orderId
|
||||
}, function(data) {
|
||||
// console.log(data);
|
||||
if (1 == data.status) {
|
||||
$('.bg').css('display', 'none')
|
||||
$('#querenshoukuan').css('display', 'none')
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'refresh');
|
||||
location.reload()
|
||||
|
||||
// mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
// 店家确认退款
|
||||
var content = "";
|
||||
$('.con').on('tap', '.qrtk', function() {
|
||||
orderId = $(this).parent().parent().attr('data-id');
|
||||
$('.bg').css('display', 'block')
|
||||
$('#querentuikuan').css('display', 'block')
|
||||
})
|
||||
$('#querentuikuan').on('tap', '.pay_btn', function() {
|
||||
// orderId = $(this).parent().parent().attr('data-id');
|
||||
var confirmType = $('#querentuikuan input[type="radio"]:checked').val();
|
||||
content = $("#refuse_con").val()
|
||||
// console.log(confirmType, orderId, shopId, content, $("#refuse_con"));
|
||||
if (-1 == confirmType) {
|
||||
if ('' == $.trim($("#refuse_con").val())) {
|
||||
mui.alert("请输入拒绝原因")
|
||||
return
|
||||
} else {}
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/Shoporders/shopRefund'), {
|
||||
refundStatus: confirmType,
|
||||
content: content,
|
||||
shopId: shopId,
|
||||
id: orderId
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
if (1 == data.status) {
|
||||
$('.bg').css('display', 'none')
|
||||
$('#querentuikuan').css('display', 'none')
|
||||
// location.reload();
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'refresh');
|
||||
location.reload()
|
||||
// mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
// 已付款 店家发货
|
||||
$('.con').on('tap', '.qrfh', function() {
|
||||
orderId = $(this).parent().parent().attr("data-id")
|
||||
$('.bg').show();
|
||||
$('.delivery').show();
|
||||
JZL.ajax(qlgUrl('app/Orders/getExpress'), {}, function(data) {
|
||||
// //console.log(data);
|
||||
if (data.status == 1) {
|
||||
// html = '';
|
||||
var html = '<option value="0">请选择快递公司</option>'
|
||||
mui.each(data.data, function(index, element) {
|
||||
html += '<option value="' + this.expressId + '">' + this.expressName + '</option>'
|
||||
})
|
||||
$('#expressId').append(html)
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
// 选择快递公司名称
|
||||
|
||||
|
||||
|
||||
//确认发货
|
||||
$('.delivery').on('tap', '.pay_btn', function() {
|
||||
if (0 == $('#expressId option:selected').val()) {
|
||||
mui.alert('请选择快递公司名称')
|
||||
return;
|
||||
}
|
||||
if ('' == $('#expressNo').val()) {
|
||||
mui.alert('请输入快递单号')
|
||||
return;
|
||||
}
|
||||
var pargams = {}
|
||||
pargams.expressNo = $('#expressNo').val();
|
||||
pargams.expressId = $('#expressId').val();
|
||||
pargams.id = orderId;
|
||||
pargams.shopId = shopId;
|
||||
JZL.ajax(qlgUrl('app/ShopOrders/deliver'), pargams, function(data) {
|
||||
// console.log(data);
|
||||
if (1 == data.status) {
|
||||
// var data = data.data;
|
||||
mui.toast(data.msg)
|
||||
$('.delivery').css('display', 'none')
|
||||
$('.bg').css('display', 'none')
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'refresh');
|
||||
location.reload()
|
||||
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
// 返回
|
||||
$('.bg').on('tap', '.mui-icon-left-nav', function() {
|
||||
// $('.pay').css('display', 'block');
|
||||
$('.bg').css('display', 'none');
|
||||
$('.pay_way').css('display', 'none');
|
||||
})
|
||||
//提交凭证
|
||||
$('.con').on('tap', '.tjpz', function() {
|
||||
var orderId = $(this).parent().parent().attr("data-id")
|
||||
JZL.openWindow('shoperUploadVoucher.html', 'shoperUploadVoucher.html', {
|
||||
orderIds: orderId,
|
||||
shopId: shopId,
|
||||
});
|
||||
})
|
||||
|
||||
// 关闭
|
||||
$('.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('发生错误请刷新后重试!');
|
||||
// // 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
|
||||
})
|
||||
})
|
||||
$('.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();
|
||||
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
} else if (getReasonUrl == 'getRejectCause') {
|
||||
setReasonUrl = 'reject';
|
||||
mui.ajax(hyhUrl('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();
|
||||
|
||||
}
|
||||
},
|
||||
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(hyhUrl('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();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#select').on('change', function() {
|
||||
if ($(this).val() == '10000') {
|
||||
$('#content').css('display', 'block');
|
||||
} else {
|
||||
$('#content').css('display', 'none');
|
||||
}
|
||||
})
|
||||
})
|
||||
67
js/shoperUploadVoucher.js
Normal file
67
js/shoperUploadVoucher.js
Normal file
@@ -0,0 +1,67 @@
|
||||
mui.init({
|
||||
beforeback: function() { //获得父页面的webview
|
||||
var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(list, 'reload');
|
||||
//返回true,继续页面关闭逻辑
|
||||
return true;
|
||||
},
|
||||
})
|
||||
mui.plusReady(function() {
|
||||
var orderId = '',
|
||||
id = '',
|
||||
shopId = '';
|
||||
|
||||
var self = plus.webview.currentWebview();
|
||||
//console.log(self);
|
||||
orderIds = self.orderIds;
|
||||
shopId = self.shopId;
|
||||
if ('undefined' != typeof self.orderId) {
|
||||
id = self.orderId
|
||||
}
|
||||
if (id > 0) { //bianji
|
||||
JZL.ajax(qlgUrl('app/shopOrders/getCertificateInfo'), {
|
||||
shopId: shopId,
|
||||
id: id
|
||||
}, function(data) {
|
||||
//console.log(data);
|
||||
$('#content').val(data.data.content);
|
||||
$('#img').attr('src', hyhImgUrl(data.data.imgUrl))
|
||||
$('#imgUrl').val(data.data.imgUrl)
|
||||
})
|
||||
}
|
||||
// 上传图片
|
||||
$(".oneImg").on("tap", '#img', function() {
|
||||
// UP.init("accountBookImg", "test", "accountBookImgTag")
|
||||
UP.init("imgUrl", "test", "img")
|
||||
openCamera()
|
||||
})
|
||||
|
||||
var click = false;
|
||||
$(".con").on("tap", '.bc_btn', function() {
|
||||
if (true == click) return;
|
||||
click = true;
|
||||
var params = JZL.getParams(".inp");
|
||||
params.orderIds = orderIds;
|
||||
params.shopId = shopId;
|
||||
if (id > 0) {
|
||||
params.id = id;
|
||||
}
|
||||
if ('' == $.trim($('#content').val())) {
|
||||
mui.alert("请输入凭证说明")
|
||||
return;
|
||||
}
|
||||
if ('' == $('#imgUrl').val()) {
|
||||
mui.alert("请上传凭证图片")
|
||||
return;
|
||||
}
|
||||
JZL.ajax(qlgUrl('app/Shoporders/uploadCertificate'), params, function(data) {
|
||||
//console.log(data);
|
||||
if (-1 == data.status) {
|
||||
mui.alert(data.msg)
|
||||
mui.back();
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
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()
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
586
js/shoppingcart.js
Normal file
586
js/shoppingcart.js
Normal file
@@ -0,0 +1,586 @@
|
||||
var num = 1;
|
||||
var isOver = 1;
|
||||
$('.mui-action-back').show();
|
||||
|
||||
function getMsg(pageNum, pagesizeNum) {
|
||||
|
||||
var data_msg = {
|
||||
page: pageNum ? pageNum : 1,
|
||||
pagesize: pagesizeNum ? pagesizeNum : 10
|
||||
}
|
||||
|
||||
if (isOver == 0) {
|
||||
return;
|
||||
} else {
|
||||
isOver = 0;
|
||||
}
|
||||
mui.ajax(qlgUrl('app/Articles/headLine'), {
|
||||
|
||||
// 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) {
|
||||
$('.recommend_con').html(
|
||||
'<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px; margin-top:10px">没有更多内容</p>');
|
||||
} else if (pageNum > 1) {
|
||||
$('.recommend_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() {
|
||||
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" style="display:none"><span>可用木吉抵扣20%货款</span></div></div><img style="display:none;" class="icon_icon" src="../img/icon_sscl.png" alt="" /></div>';
|
||||
});
|
||||
|
||||
if (pageNum == 1) {
|
||||
$('.recommend_con').html(html);
|
||||
} else if (pageNum > 1) {
|
||||
$('.recommend_con').append(html);
|
||||
}
|
||||
$('.recommend_title').css('display', 'block');
|
||||
$('.rcb_title span').each(function() {
|
||||
if ($(this).attr('data-goodsId') == 1) {
|
||||
$(this).css('display', 'none');
|
||||
}
|
||||
})
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
isOver = 1;
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
mui.plusReady(function() {
|
||||
// var scroll = mui('.mui-scroll-wrapper').scroll({
|
||||
// deceleration: 0.002 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
|
||||
// });
|
||||
window.addEventListener('refresh', function(e) {
|
||||
location.reload();
|
||||
})
|
||||
getMsg(num, 10);
|
||||
|
||||
function getCost() {
|
||||
var cost = 0;
|
||||
$('.check2').each(function() {
|
||||
if ($(this).children().hasClass('check_1')) {
|
||||
|
||||
cost += ((+$(this).siblings('.b_con_r1').children('.bz').children('.cost').children('o').html()) * (+$(this).siblings(
|
||||
'.b_con_r1').children('.bz').children('.num').children('o').html()))
|
||||
}
|
||||
})
|
||||
|
||||
$('.js_r span j').html('¥' + cost.toFixed(2));
|
||||
}
|
||||
|
||||
function isChecks() {
|
||||
|
||||
$('.check1').each(function() {
|
||||
var isChecks = 1;
|
||||
$(this).parent().siblings().children().find('.checks').each(function() {
|
||||
if ($(this).hasClass('check_0')) {
|
||||
isChecks = 0;
|
||||
}
|
||||
})
|
||||
if (isChecks == 0) {
|
||||
$(this).children().removeClass('check_1').addClass('check_0');
|
||||
} else {
|
||||
$(this).children().removeClass('check_0').addClass('check_1');
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
mui.ajax(qlgUrl('app/carts/index'), {
|
||||
// mui.ajax(hyhUrl('app/carts/index'), {
|
||||
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 = '';
|
||||
$('header').html('购物车(' + data.all_carts_num + ')');
|
||||
var allids = [];
|
||||
$.each(data.carts, function() {
|
||||
var ids = [];
|
||||
|
||||
$.each(this.list, function() {
|
||||
ids.push(this.cartId);
|
||||
allids.push(this.cartId);
|
||||
});
|
||||
var idsStr = ids.join(',');
|
||||
html += '<div class="block"><div class="b_title clearfix"><div class="check1" data-idsStr="' + idsStr +
|
||||
'"><div class="checks check_0"></div></div><img src="../img/icon_shop.png" /><div class="b_link"><a href="#" data-shopId="' +
|
||||
this.shopId + '">' + this.shopName +
|
||||
'</a></div><img style="display:none;" src="../img/icon_right.png" /><div class="btn_bj">编辑</div></div><div class="bcon">';
|
||||
$.each(this.list, function() {
|
||||
|
||||
html += '<div class="b_con shadown_wai clearfix"><div class="check2" data-cartId="' + this.cartId +
|
||||
'" data-cartNum="' + this.cartNum + '" data-isCheck="' + this.isCheck +
|
||||
'"><div class="checks check_0"></div></div><img class="s_img" src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" /><div class="b_con_r1" data-goodsId="' + this.goodsId + '" style="display: block;"><p class="p1">' +
|
||||
this.goodsName + '</p><p class="p2">';
|
||||
$.each(this.specNames, function() {
|
||||
html += this.catName + ':' + this.itemName + ';';
|
||||
});
|
||||
var price;
|
||||
if (this.specPrice != null) {
|
||||
price = this.specPrice;
|
||||
} else {
|
||||
price = this.shopPrice;
|
||||
}
|
||||
html += '</p><div class="bz clearfix"><span class="cost">¥<o>' + price +
|
||||
'</o> </span><del stye="display:none;" class="oldcost">¥' + this.marketPrice +
|
||||
'</del><span class="num">×<o>' + this.cartNum +
|
||||
'</o></span></div></div><div class="b_con_r2 clearfix" style="display: none;"><div class="b_con_r2_l"><div class="changenum clearfix" data-cartId="' +
|
||||
this.cartId + '"><img class="jian" src="../img/jian.png" /><input type="number" name="" id="" value="' +
|
||||
this.cartNum +
|
||||
'" /><img class="jia" src="../img/jia.png" /></div></div><div class="b_con_r2_r"><div class="b_con_r2_del" data-cartId="' +
|
||||
this.cartId + '">删除</div></div></div></div>';
|
||||
});
|
||||
|
||||
html += '</div></div>';
|
||||
|
||||
});
|
||||
var allIdsStr = allids.join(',');
|
||||
|
||||
$('.con_').html(html)
|
||||
$('.check').attr('data-allIdsStr', allIdsStr);
|
||||
$('.checks').each(function() {
|
||||
if ($(this).parent().attr('data-isCheck') == '1') {
|
||||
$(this).removeClass('check_0').addClass('check_1');
|
||||
}
|
||||
})
|
||||
getCost();
|
||||
isChecks();
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
$('.con_').on('tap', '.b_link', function() {
|
||||
var shopId = $(this).children('a').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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
$('.con_').on('tap', '.b_con_r1', function() {
|
||||
var data_id = $(this).attr('data-goodsId');
|
||||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$('.check').on('tap', function() {
|
||||
var isCheck;
|
||||
var ids = $(this).attr('data-allIdsStr');
|
||||
if ($('.check').children('.checks').hasClass('check_0')) {
|
||||
$('.check').children('.checks').removeClass('check_0').addClass('check_1');
|
||||
$('.check1').children('.checks').removeClass('check_0').addClass('check_1');
|
||||
$('.check2').children('.checks').removeClass('check_0').addClass('check_1');
|
||||
isCheck = 1;
|
||||
} else {
|
||||
$('.check').children('.checks').removeClass('check_1').addClass('check_0');
|
||||
$('.check1').children('.checks').removeClass('check_1').addClass('check_0');
|
||||
$('.check2').children('.checks').removeClass('check_1').addClass('check_0');
|
||||
isCheck = 0;
|
||||
}
|
||||
getCost();
|
||||
isChecks();
|
||||
mui.ajax(qlgUrl('app/carts/batchChangeCartGoods'), {
|
||||
data: {
|
||||
ids: ids,
|
||||
isCheck: isCheck
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否;登录成功;
|
||||
var data = toJson(data);
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.con_').on('tap', '.check1', function(e) {
|
||||
e.stopPropagation();
|
||||
var that = $(this);
|
||||
var isCheck;
|
||||
var ids = $(this).attr('data-idsStr');
|
||||
$('.check').children('.checks').removeClass('check_1').addClass('check_0');
|
||||
if (that.children('.checks').hasClass('check_0')) {
|
||||
isCheck = 1;
|
||||
that.children('.checks').removeClass('check_0').addClass('check_1');
|
||||
that.parent().siblings().children().find('.check2').children('.checks').removeClass('check_0').addClass(
|
||||
'check_1');
|
||||
} else {
|
||||
isCheck = 0;
|
||||
that.children('.checks').removeClass('check_1').addClass('check_0');
|
||||
that.parent().siblings().children().find('.check2').children('.checks').removeClass('check_1').addClass(
|
||||
'check_0');
|
||||
}
|
||||
getCost();
|
||||
isChecks();
|
||||
that.attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/carts/batchChangeCartGoods'), {
|
||||
data: {
|
||||
ids: ids,
|
||||
isCheck: isCheck
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否;登录成功;
|
||||
var data = toJson(data);
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('.con_').on('tap', '.check2', function(e) {
|
||||
////console.log()
|
||||
e.stopPropagation();
|
||||
var isCheck;
|
||||
var cartId = $(this).attr('data-cartId');
|
||||
var that = $(this);
|
||||
var buyNum = $(this).attr('data-cartNum');
|
||||
$('.check').children('.checks').removeClass('check_1').addClass('check_0');
|
||||
if ($(this).children().hasClass('check_0')) {
|
||||
$(this).parent().parent().siblings().children('.check1').children('.checks').removeClass('check_1').addClass(
|
||||
'check_0');
|
||||
$(this).children('.checks').removeClass('check_0').addClass('check_1');
|
||||
isCheck = 1;
|
||||
} else {
|
||||
$(this).children('.checks').removeClass('check_1').addClass('check_0');
|
||||
isCheck = 0;
|
||||
}
|
||||
getCost();
|
||||
isChecks()
|
||||
$(this).attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/carts/changeCartGoods'), {
|
||||
data: {
|
||||
id: cartId,
|
||||
isCheck: isCheck,
|
||||
buyNum: buyNum
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否;登录成功;
|
||||
var data = toJson(data, 1);
|
||||
that.removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$('.con_').on('tap', '.btn_bj', function(e) {
|
||||
e.stopPropagation()
|
||||
if ($(this).html() == '编辑') {
|
||||
$(this).html('完成');
|
||||
$(this).parent().siblings().children().find('.b_con_r1').css('display', 'none');
|
||||
$(this).parent().siblings().children().find('.b_con_r2').css('display', 'block');
|
||||
} else {
|
||||
$(this).html('编辑');
|
||||
$(this).parent().siblings().children().find('.b_con_r2').css('display', 'none');
|
||||
$(this).parent().siblings().children().find('.b_con_r1').css('display', 'block');
|
||||
var inputArr = $(this).parent().siblings().find('input')
|
||||
|
||||
$(this).parent().siblings().find('.num').each(function(num) {
|
||||
$(this).html('×<o>' + inputArr.eq(num).val() + '</o>');
|
||||
})
|
||||
|
||||
}
|
||||
// //console.log($(this).parent().siblings().find('.commodity_num'))
|
||||
// //console.log($(this).parent().siblings().find('input'));
|
||||
if ($(this).html() == '完成') {
|
||||
return;
|
||||
}
|
||||
getCost()
|
||||
})
|
||||
|
||||
$('.con_').on('tap', '.jia', function() {
|
||||
// //console.log($(this).siblings('input').val())
|
||||
var that = $(this);
|
||||
var cartId = $(this).parent().attr('data-cartId')
|
||||
var num = +$(this).siblings('input').val() + 1;
|
||||
if (num <= 0) {
|
||||
mui.alert('购买数最小为1!');
|
||||
return;
|
||||
}
|
||||
$('.jia').attr('disabled', 'disabled');
|
||||
$('.jian').attr('disabled', 'disabled');
|
||||
$('input').attr('disabled', 'disabled');
|
||||
mui.ajax(hyhUrl('app/carts/changeCartGoods'), {
|
||||
data: {
|
||||
id: cartId,
|
||||
buyNum: num
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否;登录成功;
|
||||
var data = toJson(data, 1);
|
||||
that.siblings('input').val(num);
|
||||
$('.jia').removeAttr('disabled');
|
||||
$('.jian').removeAttr('disabled');
|
||||
$('input').removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
$('.con_').on('tap', '.jian', function() {
|
||||
var that = $(this);
|
||||
var cartId = $(this).parent().attr('data-cartId')
|
||||
var num = +$(this).siblings('input').val() - 1;
|
||||
if (num <= 0) {
|
||||
mui.alert('购买数最小为1!');
|
||||
return;
|
||||
}
|
||||
$('.jia').attr('disabled', 'disabled');
|
||||
$('.jian').attr('disabled', 'disabled');
|
||||
$('input').attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/carts/changeCartGoods'), {
|
||||
data: {
|
||||
id: cartId,
|
||||
buyNum: num
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否;登录成功;
|
||||
var data = toJson(data, 1);
|
||||
that.siblings('input').val(num);
|
||||
$('.jia').removeAttr('disabled');
|
||||
$('.jian').removeAttr('disabled');
|
||||
$('input').removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
$('.con_').on('blur', 'input', function() {
|
||||
var that = $(this);
|
||||
var cartId = $(this).parent().attr('data-cartId')
|
||||
var num = +$(this).val();
|
||||
if (num <= 0) {
|
||||
mui.alert('购买数最小为1!');
|
||||
return;
|
||||
}
|
||||
$('.jia').attr('disabled', 'disabled');
|
||||
$('.jian').attr('disabled', 'disabled');
|
||||
$('input').attr('disabled', 'disabled');
|
||||
mui.ajax(qlgUrl('app/carts/changeCartGoods'), {
|
||||
data: {
|
||||
id: cartId,
|
||||
buyNum: num
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否;登录成功;
|
||||
var data = toJson(data, 1);
|
||||
that.siblings('input').val(num);
|
||||
$('.jia').removeAttr('disabled');
|
||||
$('.jian').removeAttr('disabled');
|
||||
$('input').removeAttr('disabled');
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('.con_').on('tap', '.b_con_r2_del', function() {
|
||||
var cartId = $(this).attr('data-cartId');
|
||||
|
||||
if (confirm('确定删除?')) {
|
||||
mui.ajax(hyhUrl('app/carts/delCart'), {
|
||||
data: {
|
||||
id: cartId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否;登录成功;
|
||||
var data = toJson(data, 1);
|
||||
location.reload();
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
// $('.changeclass').on('tap', '.selectclass', function() {
|
||||
// $('.mui-backdrop').show();
|
||||
// })
|
||||
|
||||
//选择类型
|
||||
// $('.cclass1').on('tap', '.block', function() {
|
||||
// $(this).addClass('on').siblings().removeClass('on');
|
||||
// $(this).parent().attr('data-class', $(this).html());
|
||||
// })
|
||||
|
||||
// $('.closecclass').on('tap', function() {
|
||||
// $('.mui-backdrop').css('display', 'none');
|
||||
// })
|
||||
|
||||
// $('.ensure').on('tap', function() {
|
||||
// $('.mui-backdrop').css('display', 'none');
|
||||
// })
|
||||
|
||||
mui('.js').on('tap', '.btn_tj', function() {
|
||||
var check_length = $('.check_1').length;
|
||||
if (check_length == 0) {
|
||||
mui.alert('请选择商品结算!');
|
||||
return;
|
||||
}
|
||||
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: 0
|
||||
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
JZL.closeWindow(plus.webview.currentWebview().id);
|
||||
}, 1000)
|
||||
})
|
||||
document.querySelector('.mui-scroll-wrapper').addEventListener('scroll', function(e) {
|
||||
if (scroll.y == scroll.maxScrollY) {
|
||||
if (isOver == 1) {
|
||||
num++;
|
||||
getMsg(num, 10);
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
148
js/shopsList.js
Normal file
148
js/shopsList.js
Normal file
@@ -0,0 +1,148 @@
|
||||
var page = 1;
|
||||
var pagesize = 10;
|
||||
var condition = 1;
|
||||
var isjiazai = 1;
|
||||
var desc = 0;
|
||||
|
||||
|
||||
mui.plusReady(function() {
|
||||
var self = plus.webview.currentWebview();
|
||||
keyword = self.data_keyword;
|
||||
goodsType = self.goodsType ? self.goodsType :''
|
||||
function getData(page, pagesize, condition, keyword, desc,goodsType) {
|
||||
var data_set = {
|
||||
page: page,
|
||||
pagesize: pagesize,
|
||||
condition: condition,
|
||||
keyword: keyword,
|
||||
desc: desc,
|
||||
goodsType:goodsType
|
||||
}
|
||||
mui.ajax(qlgUrl('app/shops/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>');
|
||||
isjiazai = 0;
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="block shadown_wai"><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.shopCompany +
|
||||
'</p><div class="btn_gz">进店</div></div><div class="b_con clearfix">';
|
||||
|
||||
$.each(this.goods, function() {
|
||||
html += '<div data-goodId="' + this.goodsId + '" data-goodsType="'+goodsType+'" class="bc_img"><img src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" /><p>¥' + this.shopPrice + '</p></div>';
|
||||
});
|
||||
html += '</div></div>'
|
||||
});
|
||||
if (page == 1) {
|
||||
$('.con').html(html);
|
||||
} else {
|
||||
$('.con').append(html);
|
||||
}
|
||||
isjiazai = 1;
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// alert(type);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getData(page, pagesize, 1, keyword, 0, goodsType )
|
||||
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
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
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 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,
|
||||
goodsType:goodsType
|
||||
// ..... //自定义扩展参数,可以用来处理页面间传值
|
||||
},
|
||||
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) {
|
||||
isjiazai = 0;
|
||||
page++;
|
||||
getData(page, pagesize, 1, keyword, 0)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
19
js/shopsetting.js
Normal file
19
js/shopsetting.js
Normal file
@@ -0,0 +1,19 @@
|
||||
mui.plusReady(function() {
|
||||
|
||||
var self = plus.webview.currentWebview();
|
||||
//console.log(self);
|
||||
var shopId=self.id;
|
||||
var shopIdObj = {
|
||||
id: self.id
|
||||
}
|
||||
$('.row').on("tap", function() {
|
||||
|
||||
var URL = $(this).attr("data-url");
|
||||
//console.log(URL);
|
||||
// JZL.openWindow('income-details.html', 'income-details.html')
|
||||
JZL.openWindow(URL + '.html',parseInt(shopId))
|
||||
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
274
js/start.js
Normal file
274
js/start.js
Normal file
@@ -0,0 +1,274 @@
|
||||
function init(data) {
|
||||
////console.log(data.apk_version)
|
||||
// //console.log(localStorage.getItem('jsUrl'))
|
||||
apk_version = data.apk_version;
|
||||
apkUrl = data.apk_down_url;
|
||||
iosUrl = data.ios_down_url;
|
||||
var must_update = data.must_update;
|
||||
var ios_must_update = data.ios_must_update;
|
||||
mui.plusReady(function() {
|
||||
plus.navigator.setStatusBarStyle('dark');
|
||||
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
|
||||
ver = inf.version;
|
||||
var client;
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if(/iphone|ipad|ipod/.test(ua)) { //苹果手机
|
||||
$.ajax({
|
||||
type: "get",
|
||||
dataType: 'json',
|
||||
url: data.update_url, //获取当前上架APPStore版本信息
|
||||
data: {
|
||||
id: data.ios_appid //APP唯一标识ID
|
||||
},
|
||||
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
|
||||
success: function(data) {
|
||||
|
||||
if(data.results[0].version > ver) {
|
||||
if(ios_must_update == 0) {
|
||||
if(confirm("发现新版本:V" + data.results[0].version + "是否更新")) {
|
||||
document.location.href = iosUrl; //上新APPStore下载地址
|
||||
}
|
||||
} else {
|
||||
mui.alert("发现新版本:V" + data.results[0].version + "是否更新")
|
||||
document.location.href = iosUrl; //上新APPStore下载地址
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if(/android/.test(ua)) {
|
||||
|
||||
if(apk_version > ver) {
|
||||
if(must_update == 0) {
|
||||
if(confirm("发现新版本:V" + apk_version + "是否更新")) {
|
||||
var dtask = plus.downloader.createDownload(apkUrl, {}, function(d, status) {
|
||||
if(status == 200) {
|
||||
plus.nativeUI.toast("正在准备环境,请稍后!");
|
||||
sleep(1000);
|
||||
var path = d.filename; //下载apk
|
||||
plus.runtime.install(path); // 自动安装apk文件
|
||||
} else {
|
||||
mui.alert('版本更新失败:' + status);
|
||||
}
|
||||
});
|
||||
dtask.start();
|
||||
}
|
||||
} else {
|
||||
if(confirm("发现新版本:V" + apk_version + "是否更新")) {
|
||||
var dtask = plus.downloader.createDownload(apkUrl, {}, function(d, status) {
|
||||
if(status == 200) {
|
||||
plus.nativeUI.toast("正在准备环境,请稍后!");
|
||||
sleep(1000);
|
||||
var path = d.filename; //下载apk
|
||||
plus.runtime.install(path); // 自动安装apk文件
|
||||
} else {
|
||||
mui.alert('版本更新失败:' + status);
|
||||
}
|
||||
});
|
||||
dtask.start();
|
||||
} else {
|
||||
plus.runtime.quit();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// //console.log('当前版本号已是最新');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
};
|
||||
|
||||
function jumpPage(ipxSizeBottom) {
|
||||
//跳转页面
|
||||
|
||||
var bSize = 50 + (+ipxSizeBottom) + 'px';
|
||||
var subpages = ['templete/home.html', 'templete/shops.html', '', 'templete/zhuweiba.html',
|
||||
'templete/my.html'
|
||||
];
|
||||
var subpage_style = {
|
||||
top: '0px',
|
||||
bottom: bSize,
|
||||
scrollIndicator: 'none'
|
||||
};
|
||||
var aniShow = {}; //动画显示
|
||||
//首次启动切滑效果
|
||||
mui.plusReady(function() {
|
||||
//刷新
|
||||
window.addEventListener('refresh', function(e) {
|
||||
var my = plus.webview.getWebviewById('templete/my.html'); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
var zhuweiba = plus.webview.getWebviewById('templete/zhuweiba.html'); //触发父页面的自定义事件(refresh),从而进行刷新
|
||||
mui.fire(my, 'refresh');
|
||||
mui.fire(zhuweiba, 'refresh');
|
||||
})
|
||||
// launchScreen();
|
||||
plus.screen.lockOrientation("portrait-primary");
|
||||
// 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 activeTab = subpages[0];
|
||||
//选项卡点击事件
|
||||
mui('.mui-bar-tab').on('tap', 'a', function(e) {
|
||||
var targetTab = this.getAttribute('href');
|
||||
if (targetTab == activeTab) {
|
||||
// var targetTab = plus.webview.getWebviewById(targetTab);
|
||||
// mui.fire(targetTab, 'refresh');
|
||||
return;
|
||||
}
|
||||
//更换标题
|
||||
// title.innerHTML = this.querySelector('.mui-tab-label').innerHTML;
|
||||
//显示目标选项卡
|
||||
//若为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 == 'templete/home.html') {}
|
||||
if (targetTab == 'templete/shops.html') {
|
||||
var targetTab = plus.webview.getWebviewById(targetTab);
|
||||
mui.fire(targetTab, 'refresh');
|
||||
}
|
||||
|
||||
if (targetTab == 'templete/zhuweiba.html') {
|
||||
var targetTab = plus.webview.getWebviewById(targetTab);
|
||||
mui.fire(targetTab, 'refresh');
|
||||
}
|
||||
if (targetTab == 'templete/my.html') {
|
||||
var targetTab = plus.webview.getWebviewById(targetTab);
|
||||
mui.fire(targetTab, 'refresh');
|
||||
var token = localStorage.getItem("token");
|
||||
if (!token) {
|
||||
mui.openWindow({
|
||||
url: 'templete/login.html',
|
||||
id: 'templete/login.html',
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: {},
|
||||
createNew: false,
|
||||
show: {},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function nav(num) {
|
||||
//console.log(num);
|
||||
$('.mui-tab-item span .img').each(function(a) {
|
||||
|
||||
if (a == 2) {
|
||||
|
||||
} else if (num == a && a != 2) {
|
||||
// //console.log(a);
|
||||
$(this).attr('src', 'http://img.zgqlg.com.cn/static/app2/img/nav_' + a + '_1.png?version='+localStorage.getItem('version'));
|
||||
} else {
|
||||
$(this).attr('src', 'http://img.zgqlg.com.cn/static/app2/img/nav_' + a + '_0.png?version='+localStorage.getItem('version'));
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
$('.mui-bar').on('tap', '.mui-tab-item', function(e) {
|
||||
var num = $(this).attr('data-num');
|
||||
if (num == 2) {
|
||||
$('.nav_in').addClass('shun');
|
||||
$('.nav_out').addClass('ni');
|
||||
} else {
|
||||
$('.nav_in').removeClass('shun');
|
||||
$('.nav_out').removeClass('ni');
|
||||
}
|
||||
nav(num);
|
||||
|
||||
})
|
||||
document.addEventListener('plusready', function() {
|
||||
checkArguments();
|
||||
}, false);
|
||||
// 判断启动方式
|
||||
function checkArguments() {
|
||||
var args = plus.runtime.arguments;
|
||||
if (args) {
|
||||
// 处理args参数,如打开新页面等
|
||||
var url;
|
||||
var id;
|
||||
var datago = {};
|
||||
var arrgo = args.slice(args.indexOf('//') + 2).split(': ');
|
||||
// //console.log(args.slice(args.indexOf('//')+2).split(':'))
|
||||
if (arrgo[0] == 'goods_id') {
|
||||
url = 'details.html';
|
||||
id = arrgo[1];
|
||||
datago = {
|
||||
data_id: arrgo[1]
|
||||
}
|
||||
} else if (arrgo[0] == 'shop_id') {
|
||||
url = 'storeout.html';
|
||||
id = arrgo[1];
|
||||
datago = {
|
||||
shopId: arrgo[1]
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
mui.openWindow({
|
||||
url: 'templete/' + url,
|
||||
id: url + id,
|
||||
styles: {
|
||||
top: '0px', //新页面顶部位置
|
||||
bottom: '0px', //新页面底部位置
|
||||
width: '100%', //新页面宽度,默认为100%
|
||||
height: '100%' //新页面高度,默认为100%
|
||||
},
|
||||
extras: datago,
|
||||
createNew: false, //是否重复创建同样id的webview,默认为false:不重复创建,直接显示
|
||||
show: {},
|
||||
waiting: {
|
||||
autoShow: true, //自动显示等待框,默认为true
|
||||
title: '正在加载...', //等待对话框上显示的提示内容
|
||||
options: {}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 处理从后台恢复
|
||||
document.addEventListener('newintent', function() {
|
||||
checkArguments();
|
||||
}, false);
|
||||
305
js/store_commodity.js
Normal file
305
js/store_commodity.js
Normal file
@@ -0,0 +1,305 @@
|
||||
$('.recommend_con').html('');
|
||||
var msort = 1;
|
||||
var shopId = localStorage.getItem('shopId');
|
||||
var nowpage = 1;
|
||||
var condition = 1;
|
||||
var desc = 0;
|
||||
var pagesize = 5;
|
||||
var isload = false;
|
||||
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() {
|
||||
// window.location.reload();
|
||||
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
|
||||
nowpage += 1
|
||||
mui.ajax(qlgUrl('app/Shopping/getShopIndexGoodsList'), {
|
||||
data: {
|
||||
page: nowpage,
|
||||
PerPage: 10,
|
||||
shopId: shopId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
|
||||
|
||||
// var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
//console.log(data);
|
||||
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
if (data.Rows == '') {
|
||||
// $('.recommend_con').append(
|
||||
// '<p style="float: left;width: 100%;text-align: center;padding-bottom: 9px;">没有更多商品</p>');
|
||||
$('.mui-pull-caption').html("没有更多商品")
|
||||
|
||||
return;
|
||||
}
|
||||
$.each(data.Rows, function() {
|
||||
html += '<div class="recommend_con_block shadown_wai" data-goodsId="' + this.goodsId +
|
||||
'"><img class="rcb_img" src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" alt="" /><div class="rcb_con"><div class="rcb_title">' + 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>';
|
||||
});
|
||||
|
||||
$('#recommend_con_').append(html);
|
||||
$('.rcb_title span').each(function() {
|
||||
if ($(this).attr('data-goodsId') == 1) {
|
||||
$(this).css('display', 'none');
|
||||
}
|
||||
})
|
||||
$('.rcb_img').height($('.rcb_img').width());
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
// //console.log(order_class)
|
||||
// mui.ajax(hyhUrl('app/Shops/getShopGoods'), {
|
||||
//
|
||||
// data: {
|
||||
// page: count,
|
||||
// shopId: shopId,
|
||||
// pageSize: 10,
|
||||
// msort: condition,
|
||||
// mdesc: desc
|
||||
// },
|
||||
// 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 = '';
|
||||
// $.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" style="display:none;"src="../img/icon_sscl.png" alt="" /></div>'
|
||||
// });
|
||||
// $('.recommend_con').append(html);
|
||||
//
|
||||
// },
|
||||
// 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;
|
||||
getRecommend(nowpage, pagesize)
|
||||
$('.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 = 0;
|
||||
} else if (costnum % 2 == 0) {
|
||||
$('#cost_btn').html('价格 <img src="../img/cost2.png"/>');
|
||||
desc = 1;
|
||||
}
|
||||
} else {
|
||||
$('#cost_btn').html('价格 <img src="../img/cost1.png"/>')
|
||||
costnum = 0;
|
||||
desc = 1
|
||||
}
|
||||
// mui.ajax(hyhUrl('app/Shops/getShopGoods'), {
|
||||
// data: {
|
||||
// shopId: shopId,
|
||||
// pageSize: 10,
|
||||
// page: 1,
|
||||
// msort: condition,
|
||||
// mdesc: desc
|
||||
// },
|
||||
// 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+'"><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" style="display:none;"src="../img/icon_sscl.png" alt="" /></div>'
|
||||
// });
|
||||
// $('.recommend_con').html(html);
|
||||
// },
|
||||
// error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// // mui.alert(type);
|
||||
// }
|
||||
// });
|
||||
})
|
||||
// mui.ajax(hyhUrl('app/Shops/getShopGoods'), {
|
||||
// data: {
|
||||
// shopId: shopId,
|
||||
// pageSize: 10,
|
||||
// page: 1,
|
||||
// msort: 1,
|
||||
// mdesc: 0
|
||||
// },
|
||||
// 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+'"><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" style="display:none;"src="../img/icon_sscl.png" alt="" /></div>'
|
||||
// });
|
||||
// $('.recommend_con').html(html);
|
||||
// $('.recommend_con_block .img').height($('.recommend_con_block .img').width());
|
||||
//
|
||||
// // $('.recommend_con_block').height($('.recommend_con_block').width() * 266 / 198);
|
||||
// },
|
||||
// error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// // mui.alert(type);
|
||||
// }
|
||||
// });
|
||||
$('.recommend_con').on('tap', '.recommend_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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
function getRecommend(nowpage, pagesize) {
|
||||
var recommenddata = {
|
||||
page: nowpage ? nowpage : 1,
|
||||
PerPage: pagesize ? pagesize : 10
|
||||
}
|
||||
recommenddata.shopId = shopId
|
||||
//console.log(recommenddata);
|
||||
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(recommenddata);
|
||||
|
||||
// var data = toJson(data, 1);
|
||||
if (data.status == 1) {
|
||||
console.log(data);
|
||||
|
||||
var html = '';
|
||||
var data = data.data;
|
||||
if (data.Rows == '') {
|
||||
$('.recommend_con').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 +
|
||||
'"><img class="rcb_img" src="' + hyhImgUrl(this.goodsImg) +
|
||||
'" alt="" /><div class="rcb_con"><div class="rcb_title">' + 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 (nowpage == 1) {
|
||||
//console.log(222);
|
||||
$('#recommend_con_').html(html);
|
||||
} else {
|
||||
$('#recommend_con_').append(html);
|
||||
}
|
||||
$('.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)
|
||||
}
|
||||
isload = false
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
setInterval(function() {
|
||||
$('.recommend_con_block img').height($('.recommend_con_block img').width());
|
||||
// $('.recommend_con_block').height($('.recommend_con_block').width() * 266 / 198);
|
||||
}, 100)
|
||||
306
js/store_home.1.js
Normal file
306
js/store_home.1.js
Normal file
@@ -0,0 +1,306 @@
|
||||
$('.recommend_title img').eq(0).attr('src', hyhImgUrl('static/app2/img/goods_title.png'));
|
||||
$('.recommend_title img').eq(1).attr('src', hyhImgUrl('static/app2/img/coupon_title.png'));
|
||||
$('.recommend_title img').eq(0).css('display', 'none');
|
||||
$('.recommend_title img').eq(1).css('display', 'none');
|
||||
var shopId = localStorage.getItem('shopId');
|
||||
mui.plusReady(function() {
|
||||
// var data = JSON.parse(localStorage.getItem('shop_data'));
|
||||
// var Intent = plus.android.importClass("android.content.Intent");
|
||||
// //console.log(Intent)
|
||||
//
|
||||
mui.ajax(ectUrl('app/Shops/getHome'), {
|
||||
data: {
|
||||
shopId: shopId
|
||||
},
|
||||
dataType: 'json', //服务器返回json格式数据
|
||||
type: 'post', //HTTP请求类型
|
||||
timeout: 10000, //超时时间设置为10秒;
|
||||
success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
|
||||
if (data.status == 1) {
|
||||
var data = data.data;
|
||||
if (data.shop.shopAds.length > 0) {
|
||||
var html = '';
|
||||
$.each(data.shop.shopAds, function() {
|
||||
html += '<div class="swiper-slide"><img src="' + ectImgUrl(this.adImg) + '" /></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() * 420 / 715);
|
||||
$('#top_banner img').height($('#top_banner img').width() * 420 / 715);
|
||||
} else {
|
||||
$('#top_banner').remove()
|
||||
}
|
||||
|
||||
if (data.couponList.coupons.length > 0) {
|
||||
var html_ = '';
|
||||
$.each(data.couponList.coupons, function(num) {
|
||||
html_ += '<div class="swiper-slide home_yhj" data-couponId="' + this.couponId + '"><img src=" ' +
|
||||
ectImgUrl('static/app2/img/bg_' + (num % 3 + 1) + '.png') +
|
||||
'" alt="" /><p class="p1">点击领取</p><p class="p2">满' + this.useMoney + '使用</p><p class="p3">' + this.couponValue +
|
||||
'</p></div>'
|
||||
});
|
||||
$('#timer_swiper .swiper-wrapper').html(html_);
|
||||
$('.recommend_title img').eq(0).css('display', 'block');
|
||||
var swiper = new Swiper('#timer_swiper', {
|
||||
slidesPerView: 2.3,
|
||||
paginationClickable: true,
|
||||
spaceBetween: 0,
|
||||
freeMode: true
|
||||
});
|
||||
$('#timer_swiper .swiper-slide img').height($('#timer_swiper .swiper-slide img').width() * 140 / 300);
|
||||
$('#timer_swiper .swiper-slide').height($('#timer_swiper .swiper-slide').width() * 190 / 300);
|
||||
} else {
|
||||
$('.time').css('display', 'none');
|
||||
}
|
||||
|
||||
// var html3 = '';
|
||||
// $.each(data.shopcats, function() {
|
||||
// html3 += '<div data-catId="' + this.catId + '" class="l_block">' + this.catName + '</div>';
|
||||
// });
|
||||
// $('.label').html(html3);
|
||||
// $('.l_block').each(function(num) {
|
||||
// if((num + 1) % 4 == 0) {
|
||||
// $(this).addClass('lbrr');
|
||||
// }
|
||||
// })
|
||||
var html4 = '';
|
||||
if (data.rec == '') {
|
||||
$('.recommend_title').eq(1).css('display', 'none');
|
||||
} else {
|
||||
$.each(data.rec, function() {
|
||||
html4 += '<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" style="display:none;"src="../img/icon_sscl.png" alt="" /></div>'
|
||||
});
|
||||
$('.recommend_con').html(html4);
|
||||
$('.recommend_title img').eq(1).css('display', 'block');
|
||||
$('.rcb_img').height($('.rcb_img').width())
|
||||
}
|
||||
} else {
|
||||
mui.alert(data.msg)
|
||||
}
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
//领取优惠券
|
||||
$('.time').on('tap', '.home_yhj', 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);
|
||||
mui.alert(data.msg);
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
$('.recommend_con').on('tap', '.recommend_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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
localStorage.setItem('shop_data', '');
|
||||
})
|
||||
|
||||
setInterval(function() {
|
||||
$('.cnxh_block img').height($('.cnxh_block img').width());
|
||||
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
|
||||
}, 200)
|
||||
|
||||
var scheme = "";
|
||||
var arr = [];
|
||||
var title = {};
|
||||
$('.go').on("tap", function() {
|
||||
if (0 == arr.length) {
|
||||
//console.log(111)
|
||||
}
|
||||
//底部弹出选择地图软件
|
||||
plus.nativeUI.actionSheet({
|
||||
title: "请选择!",
|
||||
cancel: "取消",
|
||||
buttons: arr
|
||||
}, function(e) {
|
||||
var title = arr[e.index - 1].title;
|
||||
// var i1 = new Intent();
|
||||
switch (title) {
|
||||
case "百度地图":
|
||||
// plus.runtime.openURL( "baidumap://map/direction?origin=latlng:39.98871,116.43234|name:我的位置&destination=40.007623,116.360582&mode=driving&src=webapp.navi.hanguosoft.yinyijianghu", function(error){ alert("打开百度地图失败")});
|
||||
launchTest()
|
||||
// if (plus.os.name == "Android") {
|
||||
// plus.runtime.launchApplication({
|
||||
// pname: "com.android.browser",
|
||||
// extra: {
|
||||
// // url: "://map/direction?origin=latlng:33,33|name:我的位置&destination=latlng:43.335,39.966|name:beijing&mode=driving",
|
||||
// // url:"://map/direction?destination=latlng:33,44|name:geijign&mode=driving&" + // 导航路线方式
|
||||
// // "region=武汉"
|
||||
//
|
||||
// url:"http://www.html5plus.org"
|
||||
//
|
||||
// // url :"baidumap://map/direction?origin=name:对外经贸大学|latlng:39.98871,116.43234&destination=西直门&coord_type=bd09ll&mode=transit"
|
||||
// // url : "http://api.map.baidu.com/direction?origin=latlng:42.111,111|name:当前位置&destination=latlng:31,111|name:终点&mode=driving®ion=中国&output=html"
|
||||
// }
|
||||
// }, function(e) {
|
||||
// alert("Open system default browser failed: " + e.message);
|
||||
//
|
||||
// });
|
||||
// } else if (plus.os.name == "iOS") {
|
||||
// plus.runtime.launchApplication({
|
||||
// action: "://map/direction?origin=latlng:114,33|name:我的位置&destination=latlng:116.335, 39.966|name:beijing&mode=driving"//"第三方提供的uri"
|
||||
// }, function(e) {
|
||||
// alert("Open system default browser failed: " + e.message);
|
||||
// });
|
||||
// }
|
||||
break;
|
||||
case "高德地图":
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
})
|
||||
var maps=[{pname:'com.baidu.BaiduMap',action:'baidumap',name:'百度地图'},{pname:'com.autonavi.minimap',action:'iosamap',name:'高德地图'},{pname:'com.google.android.apps.maps',action:'com.google.android.apps.maps',name:'谷歌地图'},{pname:'com.tencent.map',action:'com.google.android.apps.maps',name:'腾讯地图'}]
|
||||
// checkApp("com.baidu.BaiduMap", "baidumap", "百度地图")
|
||||
// checkApp("com.autonavi.minimap", "iosamap", "高德地图")
|
||||
// checkApp("com.google.android.apps.maps", "com.google.android.apps.maps", "谷歌地图")
|
||||
// 判断地图软件是否安装
|
||||
// maps= toJson(maps)
|
||||
// //console.log(maps)
|
||||
// $.each(maps,function(i,v){
|
||||
//
|
||||
// var that=this
|
||||
//
|
||||
// checkApp(that.pname, that.action, that.name)
|
||||
// })
|
||||
// function checkApp(pn, ac, name) {
|
||||
// if (plus.runtime.isApplicationExist({
|
||||
// pname: pn,//包名
|
||||
// action: ac //ios包名
|
||||
// })) {
|
||||
// // //console.log("微信应用已安装");
|
||||
// title = {
|
||||
// title: name
|
||||
// };
|
||||
// arr.push(title)
|
||||
// } else {
|
||||
// // //console.log("微信应用未安装");
|
||||
// // title={};
|
||||
// // arr.push(title)
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
function launchTest() {
|
||||
if (plus.os.name == "Android") {
|
||||
plus.runtime.launchApplication( {pname:"com.baidu.BaiduMap"
|
||||
,extra:{url:"://map/direction?origin=name:对外经贸大学|latlng:39.98871,116.43234&destination=西直门&coord_type=bd09ll&mode=transit&sy=3&index=0&target=1&src=andr.baidu.openAPIdemo"}}, function ( e ) {
|
||||
alert( "Open system default browser failed: " + e.message );})
|
||||
// plus.runtime.launchApplication({
|
||||
//
|
||||
// pname: "com.baidu.BaiduMap",
|
||||
// // pname: "bdapp",
|
||||
//
|
||||
// // http://uri.amap.com/navigation?from=" + fromLongitude + "," + fromLatitude + "&to="+ longitude + "," + latitude + "&mode=car&src=nyx_super;
|
||||
//
|
||||
// extra: {
|
||||
// url:"baidumap://map/bikenavi?origin=39.98871,116.43234&destination=39.91441,116.40405&coord_type=bd09ll&src=andr.baidu.openAPIdemo"
|
||||
// // url:"bdapp://map/direction?destination=latlng:31,111|name:终点&mode=driving®ion=中国&src=andr.baidu.openAPIdemo"
|
||||
// // url:"http://baidu.com"
|
||||
// // url:"com.baidu.BaiduMap://map/direction?origin=中关村&destination=五道口&mode=driving®ion=北京 "
|
||||
// // url: "://map/direction?origin=latlng:114,33|name:我的位置&destination=latlng:116.335,39.966|name:beijing&mode=driving"
|
||||
// }
|
||||
// }, function(e) {
|
||||
// alert("Open system default browser failed: " + e.message);
|
||||
//
|
||||
// });
|
||||
} else if (plus.os.name == "iOS") {
|
||||
plus.runtime.launchApplication({
|
||||
action: "第三方提供的uri"
|
||||
}, function(e) {
|
||||
alert("Open system default browser failed: " + e.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
launchTest()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
mui('.gothere').on("tap", ".gt_con", function(e) {
|
||||
var idx = $(this).index();
|
||||
var html = '';
|
||||
|
||||
switch (idx) {
|
||||
case 0:
|
||||
|
||||
break;
|
||||
case 1:
|
||||
|
||||
break;
|
||||
case 2:
|
||||
// $('.gt_con_con1').css('display','none')
|
||||
|
||||
$('.gt_con_con').toggle()
|
||||
html =
|
||||
'<div class="row shadown_wai"><div class="name"><label class="label-idx" for="">姓名:</label><label class="label-val" for="">张三</label></div><div class="name"><label class="label-idx" for="">电话:</label><label class="label-val" for=""><a href="tel:13482378262">13482378262</label></div></div>'
|
||||
$('.row .name').css("width", "60%")
|
||||
$('.gt_con_con').html(html)
|
||||
break;
|
||||
|
||||
}
|
||||
})
|
||||
351
js/store_home.js
Normal file
351
js/store_home.js
Normal file
@@ -0,0 +1,351 @@
|
||||
$('.recommend_title img').eq(0).attr('src', hyhImgUrl('static/app2/img/goods_title.png'));
|
||||
$('.recommend_title img').eq(1).attr('src', hyhImgUrl('static/app2/img/coupon_title.png'));
|
||||
$('.recommend_title img').eq(0).css('display', 'none');
|
||||
$('.recommend_title img').eq(1).css('display', 'none');
|
||||
var shopId = localStorage.getItem('shopId');
|
||||
var shopLat = localStorage.getItem('shopLat');
|
||||
var shopLng = localStorage.getItem('shopLng');
|
||||
var shopName = localStorage.getItem('shopName');
|
||||
var phone = localStorage.getItem('phone');
|
||||
var userName = localStorage.getItem('userName');
|
||||
mui.plusReady(function() {
|
||||
// var data = JSON.parse(localStorage.getItem('shop_data'));
|
||||
var self = plus.webview.currentWebview();
|
||||
var userLat='';
|
||||
var userLng='';
|
||||
var scheme = "";
|
||||
var arr = [];
|
||||
var title = {};
|
||||
var shopAddress="";
|
||||
// 加载地图
|
||||
getLocation(function(data) {
|
||||
// console.log(data);
|
||||
if (1 == data.status) {
|
||||
$('#lng').val(data.lng);
|
||||
$('#lat').val(data.lat);
|
||||
getMap(shopLng, shopLat)
|
||||
// //console.log(JSON.stringify(data));
|
||||
} else {
|
||||
mui.alert(data.errStr);
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.getJSON('http://api.map.baidu.com/geocoder/v2/?ak=Zm7kae5pzZogp8a0uwIOlyyz&callback=?&location='+shopLat+','+shopLng+'&output=json&pois=1',function(res){
|
||||
// //console.log(res);
|
||||
//addressComponent => {city: "广州市", district: "天河区", province: "广东省", street: "广州大道", street_number: "中922号-之101-128"}
|
||||
// //console.log(res.result.addressComponent.city)
|
||||
$(".shopAddress").html(res.result.formatted_address);
|
||||
// $("#location-r").html(res.result.addressComponent.city);
|
||||
|
||||
})
|
||||
// $.getScript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js',function(){
|
||||
// alert(remote_ip_info.country);//国家
|
||||
// alert(remote_ip_info.province);//省份
|
||||
// alert(remote_ip_info.city);//城市
|
||||
// });
|
||||
// 获取用户地址
|
||||
|
||||
plus.geolocation.getCurrentPosition(function (p) {
|
||||
//console.log(p.coords.latitude);
|
||||
//console.log(p.coords.longitude);
|
||||
userLat=p.coords.latitude;
|
||||
userLng=p.coords.longitude
|
||||
},function (err) {
|
||||
|
||||
})
|
||||
// mui.ajax(ectUrl('app/Shops/getHome'), {
|
||||
// data: {
|
||||
// shopId: shopId
|
||||
// },
|
||||
// dataType: 'json', //服务器返回json格式数据
|
||||
// type: 'post', //HTTP请求类型
|
||||
// timeout: 10000, //超时时间设置为10秒;
|
||||
// success: function(data) { //服务器返回响应,根据响应结果,分析是否登录成功;
|
||||
//
|
||||
// if (data.status == 1) {
|
||||
// var data = data.data;
|
||||
// if (data.shop.shopAds.length > 0) {
|
||||
// var html = '';
|
||||
// $.each(data.shop.shopAds, function() {
|
||||
// html += '<div class="swiper-slide"><img src="' + ectImgUrl(this.adImg) + '" /></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() * 420 / 715);
|
||||
// $('#top_banner img').height($('#top_banner img').width() * 420 / 715);
|
||||
// } else {
|
||||
// $('#top_banner').remove()
|
||||
// }
|
||||
//
|
||||
// if (data.couponList.coupons.length > 0) {
|
||||
// var html_ = '';
|
||||
// $.each(data.couponList.coupons, function(num) {
|
||||
// html_ += '<div class="swiper-slide home_yhj" data-couponId="' + this.couponId + '"><img src=" ' +
|
||||
// ectImgUrl('static/app2/img/bg_' + (num % 3 + 1) + '.png') +
|
||||
// '" alt="" /><p class="p1">点击领取</p><p class="p2">满' + this.useMoney + '使用</p><p class="p3">' + this.couponValue +
|
||||
// '</p></div>'
|
||||
// });
|
||||
// $('#timer_swiper .swiper-wrapper').html(html_);
|
||||
// $('.recommend_title img').eq(0).css('display', 'block');
|
||||
// var swiper = new Swiper('#timer_swiper', {
|
||||
// slidesPerView: 2.3,
|
||||
// paginationClickable: true,
|
||||
// spaceBetween: 0,
|
||||
// freeMode: true
|
||||
// });
|
||||
// $('#timer_swiper .swiper-slide img').height($('#timer_swiper .swiper-slide img').width() * 140 / 300);
|
||||
// $('#timer_swiper .swiper-slide').height($('#timer_swiper .swiper-slide').width() * 190 / 300);
|
||||
// } else {
|
||||
// $('.time').css('display', 'none');
|
||||
// }
|
||||
//
|
||||
// // var html3 = '';
|
||||
// // $.each(data.shopcats, function() {
|
||||
// // html3 += '<div data-catId="' + this.catId + '" class="l_block">' + this.catName + '</div>';
|
||||
// // });
|
||||
// // $('.label').html(html3);
|
||||
// // $('.l_block').each(function(num) {
|
||||
// // if((num + 1) % 4 == 0) {
|
||||
// // $(this).addClass('lbrr');
|
||||
// // }
|
||||
// // })
|
||||
// var html4 = '';
|
||||
// if (data.rec == '') {
|
||||
// $('.recommend_title').eq(1).css('display', 'none');
|
||||
// } else {
|
||||
// $.each(data.rec, function() {
|
||||
// html4 += '<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" style="display:none;"src="../img/icon_sscl.png" alt="" /></div>'
|
||||
// });
|
||||
// $('.recommend_con').html(html4);
|
||||
// $('.recommend_title img').eq(1).css('display', 'block');
|
||||
// $('.rcb_img').height($('.rcb_img').width())
|
||||
// }
|
||||
// } else {
|
||||
// mui.alert(data.msg)
|
||||
// }
|
||||
// },
|
||||
// error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// // mui.alert(type);
|
||||
// }
|
||||
// });
|
||||
//领取优惠券
|
||||
$('.time').on('tap', '.home_yhj', 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);
|
||||
mui.alert(data.msg);
|
||||
|
||||
},
|
||||
error: function(xhr, type, errorThrown) { //异常处理;
|
||||
// mui.alert(type);
|
||||
}
|
||||
});
|
||||
})
|
||||
$('.recommend_con').on('tap', '.recommend_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, //等待框背景区域高度,默认根据内容自动计算合适高度
|
||||
// ......
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
localStorage.setItem('shop_data', '');
|
||||
|
||||
|
||||
setInterval(function() {
|
||||
$('.cnxh_block img').height($('.cnxh_block img').width());
|
||||
$('.cnxh_block').height($('.cnxh_block').width() * 266 / 198);
|
||||
}, 200)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('.go').on("tap", function() {
|
||||
isHasApp()
|
||||
})
|
||||
|
||||
|
||||
var maps = [{
|
||||
pname: 'com.baidu.BaiduMap',
|
||||
action: 'baidumap',
|
||||
name: '百度地图'
|
||||
}, {
|
||||
pname: 'com.autonavi.minimap',
|
||||
action: 'iosamap',
|
||||
name: '高德地图'
|
||||
}
|
||||
// , {
|
||||
// pname: 'com.google.android.apps.maps',
|
||||
// action: 'com.google.android.apps.maps',
|
||||
// name: '谷歌地图'
|
||||
// }
|
||||
// , {
|
||||
// pname: 'com.tencent.map',
|
||||
// action: 'com.google.android.apps.maps',
|
||||
// name: '腾讯地图'
|
||||
// },
|
||||
]
|
||||
// checkApp("com.baidu.BaiduMap", "baidumap", "百度地图")
|
||||
// checkApp("com.autonavi.minimap", "iosamap", "高德地图")
|
||||
// checkApp("com.google.android.apps.maps", "com.google.android.apps.maps", "谷歌地图")
|
||||
// 判断地图软件是否安装
|
||||
// maps= toJson(maps)
|
||||
// //console.log(maps)
|
||||
$.each(maps, function(i, v) {//不能写进点击事件函数里 不然点击一次增加一个title
|
||||
var that = this
|
||||
checkApp(that.pname, that.action, that.name)
|
||||
})
|
||||
function isHasApp() {
|
||||
if (0 == arr.length) {
|
||||
// plus.nativeUI.confirm("没有地图软件??请安装", function(i) {
|
||||
// if (0 == i.index) {
|
||||
var startpos= bMapTransQQMap(userLng, userLat)
|
||||
var endpos = bMapTransQQMap(shopLng, shopLat)
|
||||
//console.log(userLng);
|
||||
var urlStr = encodeURI('http://uri.amap.com/navigation?from='+startpos.lng+','+startpos.lat+',startpoint&to='+endpos.lng+','+endpos.lat+',endpoint&mode=car&policy=1&src=mypage&coordinate=gaode&callnative=0')
|
||||
plus.runtime.openURL(urlStr)
|
||||
// plus.runtime.openURL('http://uri.amap.com/navigation?from=116.43234,39.98871,当前位置&to=121,31,站点&mode=car&src=公司名称&callnative=0' // androidMarket('com.baidu.BaiduMap')
|
||||
// // }
|
||||
//
|
||||
// )
|
||||
return false
|
||||
}
|
||||
openMapApp()
|
||||
}
|
||||
|
||||
function openMapApp() {
|
||||
//底部弹出选择地图软件
|
||||
plus.nativeUI.actionSheet({
|
||||
title: "请选择!",
|
||||
cancel: "取消",
|
||||
buttons: arr
|
||||
}, function(e) {
|
||||
|
||||
var title = arr[e.index - 1].title;
|
||||
// var i1 = new Intent();
|
||||
switch (title) {
|
||||
case "百度地图":
|
||||
// if (plus.os.name == "Android") {
|
||||
// plus.runtime.openURL(
|
||||
// "baidumap://map/direction?origin=latlng:39.98871,116.43234|name:我的位置&destination=31.236244,121.480239&mode=driving&src=webapp.navi.hanguosoft.yinyijianghu",
|
||||
// function(error) {
|
||||
// mui.alert('打开' + title + '失败');
|
||||
// });
|
||||
// }
|
||||
goMaps(
|
||||
"baidumap://map/direction?origin=我的位置&destination="+shopLat+","+shopLng+"&mode=driving&src=webapp.navi.hanguosoft.yinyijianghu"
|
||||
)
|
||||
|
||||
break;
|
||||
case "高德地图":
|
||||
|
||||
var endpos = bMapTransQQMap(shopLng, shopLat)
|
||||
// plus.runtime.openURL('androidamap://navi?sourceApplication=nyx_super&lat=' + endpos.lat + '&lon=' + endpos.lng +
|
||||
// '&mode=driving®ion=www&output=html&src="全亮共"',
|
||||
// function(e) {
|
||||
// mui.alert('打开' + title + '失败');
|
||||
// })
|
||||
goMaps('androidamap://navi?sourceApplication=nyx_super&lat=' + endpos.lat + '&lon=' + endpos.lng +
|
||||
'&mode=driving®ion='+shopName+'&output=html&src="全亮共"')
|
||||
|
||||
break;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function goMaps(url) {
|
||||
var mContext = plus.android.runtimeMainActivity();
|
||||
var Uri = plus.android.importClass('android.net.Uri');
|
||||
var Intent = plus.android.importClass('android.content.Intent');
|
||||
var intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
function checkApp(pn, ac, name) { // pname:android 包名 action:ios包名 name:用作底部弹出
|
||||
|
||||
if (plus.runtime.isApplicationExist({
|
||||
pname: pn, //包名
|
||||
action: ac //ios包名
|
||||
})) {
|
||||
// //console.log("微信应用已安装");
|
||||
title = {
|
||||
title: name
|
||||
};
|
||||
arr.push(title)
|
||||
} else {
|
||||
// //console.log("微信应用未安装");
|
||||
// title={};
|
||||
// arr.push(title)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
mui('.gothere').on("tap", ".gt_con", function(e) {
|
||||
var idx = $(this).index();
|
||||
var html = '';
|
||||
switch (idx) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
// $('.gt_con_con1').css('display','none')
|
||||
|
||||
$('.gt_con_con').toggle()
|
||||
html =
|
||||
'<div class="row shadown_wai"><div class="name"><label class="label-idx" for="">姓名:</label><label class="label-val" for="">'+userName+'</label></div><div class="name"><label class="label-idx" for="">电话:</label><label class="label-val" for=""><a href="tel:'+phone+'">'+phone+'</label></div></div>'
|
||||
$('.row .name').css("width", "60%")
|
||||
$('.gt_con_con').html(html)
|
||||
break;
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user