...
|
...
|
@@ -3188,9 +3188,10 @@ require("js/product/newsale/newarrival"); |
|
|
require("js/product/newsale/discount");
|
|
|
require("js/product/list");
|
|
|
require("js/product/detail/detail");
|
|
|
require("js/product/detail/desc");
|
|
|
require("js/product/detail/loadmore");
|
|
|
require("js/product/detail/consultform");
|
|
|
});
|
|
|
define("js/product/newsale/newarrival", ["jquery","swiper","lazyload","index"], function(require, exports, module){
|
|
|
define("js/product/newsale/newarrival", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){
|
|
|
/**
|
|
|
* 新品到着
|
|
|
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
|
...
|
...
|
@@ -3578,7 +3579,7 @@ $listNav.on('touchstart', 'li', function(e) { |
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/plugin/filter", ["jquery"], function(require, exports, module){
|
|
|
define("js/plugin/filter", ["jquery","hammer"], function(require, exports, module){
|
|
|
/**
|
|
|
* 筛选JS
|
|
|
* 暴露三个接口:注册回调、显示filter、隐藏filter
|
...
|
...
|
@@ -3586,9 +3587,8 @@ define("js/plugin/filter", ["jquery"], function(require, exports, module){ |
|
|
* @date: 2015/10/19
|
|
|
*/
|
|
|
|
|
|
var $ = require("jquery");
|
|
|
|
|
|
// Hammer = require('yoho.hammer');
|
|
|
var $ = require("jquery"),
|
|
|
Hammer = require("hammer");
|
|
|
|
|
|
var $filter;
|
|
|
|
...
|
...
|
@@ -3694,8 +3694,7 @@ function subClassifyTapEvt($this) { |
|
|
|
|
|
//初始化筛选
|
|
|
function initFilter(opt) {
|
|
|
|
|
|
// var filterHammer;
|
|
|
var filterHammer;
|
|
|
|
|
|
//注册回调
|
|
|
fCbFn = opt.fCbFn;
|
...
|
...
|
@@ -3708,8 +3707,8 @@ function initFilter(opt) { |
|
|
|
|
|
$filter = $('.filter-mask');
|
|
|
|
|
|
// filterHammer = new Hammer($filter[0]);
|
|
|
$filter.on('touchend', function(e) {
|
|
|
filterHammer = new Hammer($filter[0]);
|
|
|
filterHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target),
|
|
|
$cur;
|
|
|
|
...
|
...
|
@@ -3728,7 +3727,7 @@ function initFilter(opt) { |
|
|
//tap classify
|
|
|
$cur = $this.closest('.classify-item');
|
|
|
|
|
|
e.stopPropagation();
|
|
|
e.srcEvent.stopPropagation();
|
|
|
|
|
|
classifyTapEvt($cur);
|
|
|
}
|
...
|
...
|
@@ -3765,6 +3764,7 @@ exports.showFilter = showFilter; |
|
|
exports.hideFilter = hideFilter;
|
|
|
|
|
|
exports.resetFilter = resetFilter;
|
|
|
|
|
|
});
|
|
|
define("js/product/extract-url", [], function(require, exports, module){
|
|
|
/**
|
...
|
...
|
@@ -3833,7 +3833,7 @@ $.ajax({ |
|
|
}
|
|
|
});
|
|
|
});
|
|
|
define("js/product/newsale/discount", ["jquery","swiper","lazyload","index"], function(require, exports, module){
|
|
|
define("js/product/newsale/discount", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){
|
|
|
/**
|
|
|
* 商品列表页
|
|
|
* @author: xuqi<qi.xu@yoho.cn>
|
...
|
...
|
@@ -4709,7 +4709,7 @@ if (0 === $('.goodsDiscount .discount-folder').children().length) { |
|
|
}
|
|
|
|
|
|
//goods-discount下拉按钮点击事件
|
|
|
$('.goodsDiscount .dropdown').on('click', function() {
|
|
|
$('.goodsDiscount .dropdown').on('touchend', function(e) {
|
|
|
if ($discountFolder.is(':hidden')) {
|
|
|
$discountArrow.removeClass('icon-down').addClass('icon-up').html('');
|
|
|
$discountFolder.slideDown();
|
...
|
...
|
@@ -4717,6 +4717,8 @@ $('.goodsDiscount .dropdown').on('click', function() { |
|
|
$discountArrow.removeClass('icon-up').addClass('icon-down').html('');
|
|
|
$discountFolder.slideUp();
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
});
|
|
|
require("js/product/detail/like");
|
|
|
|
...
|
...
|
@@ -4912,10 +4914,9 @@ var $ = require("jquery"), |
|
|
Hammer = require("hammer"),
|
|
|
tip = require("js/plugin/tip");
|
|
|
|
|
|
var likeHammer = new Hammer(document.getElementById('likeBtn'));
|
|
|
var addToCartHammer = new Hammer(document.getElementById('addtoCart'));
|
|
|
|
|
|
var productId = $('#productId').val();
|
|
|
var likeHammer = new Hammer(document.getElementById('likeBtn')),
|
|
|
addToCartHammer = new Hammer(document.getElementById('addtoCart')),
|
|
|
productId = $('#productId').val();
|
|
|
|
|
|
likeHammer.on('tap', function(e) {
|
|
|
var opt,
|
...
|
...
|
@@ -4981,6 +4982,190 @@ addToCartHammer.on('tap', function(e) { |
|
|
|
|
|
|
|
|
});
|
|
|
define("js/product/detail/loadmore", [], function(require, exports, module){
|
|
|
/**
|
|
|
* 商品详情 --滚动页面加载
|
|
|
* @author: Lynnic
|
|
|
* @date: 2015/11/25
|
|
|
*/
|
|
|
|
|
|
// var $ = require('jquery'),
|
|
|
// loading = require('../../plugin/loading'),
|
|
|
// tip = require('../../plugin/tip');
|
|
|
|
|
|
// var loadMoreUrl = $('#loadMoreUrl').val(),
|
|
|
// $commentsDiv = $('#goods-comments'),
|
|
|
// $consultsDiv = $('#goods-consults'),
|
|
|
// winH = $(window).height(),
|
|
|
// searching = false,
|
|
|
// end = false;
|
|
|
|
|
|
// var jsonObj;
|
|
|
|
|
|
// //插入评论列表底部
|
|
|
// function insertCommentsDiv(json) {
|
|
|
// var html = '';
|
|
|
// var i;
|
|
|
|
|
|
|
|
|
// for (i = 0; i < json.length; i++) {
|
|
|
// html += '<div class="comment-item">';
|
|
|
// html += '<span class="user-name">' + json[i].userName + '</span>';
|
|
|
// html += '<span class="goods-spec">' + json[i].desc + '</span>';
|
|
|
// html += '<span class="goods-spec">' + json[i].content + '</span>';
|
|
|
// html += '<span class="goods-spec">' + json[i].time + '</span>';
|
|
|
// }
|
|
|
// $commentsDiv.append(html);
|
|
|
// }
|
|
|
|
|
|
// //插入咨询列表底部
|
|
|
// function insertConsultsDiv(json) {
|
|
|
// var html = '';
|
|
|
// var i;
|
|
|
|
|
|
|
|
|
// for (i = 0; i < json.length; i++) {
|
|
|
// html += '<div class="consult-item"> ';
|
|
|
// html += '<div class="question"> ';
|
|
|
// html += '<span class="iconfont"></span> ';
|
|
|
// html += '<p> ';
|
|
|
// html += json[i].question + '<br> ';
|
|
|
// html += '<span class="time">' + json[i].time + '</span> ';
|
|
|
// html += '</p> ';
|
|
|
// html += '</div> ';
|
|
|
|
|
|
// html += '<div class="answer"> ';
|
|
|
// html += '<span class="iconfont"></span> ';
|
|
|
// html += '<p>' + json[i].answer + '</p> ';
|
|
|
// html += '</div> ';
|
|
|
// html += '</div> ';
|
|
|
// }
|
|
|
// $consultsDiv.append(html);
|
|
|
// }
|
|
|
|
|
|
// function search() {
|
|
|
// if (searching || end) {
|
|
|
// return;
|
|
|
// }
|
|
|
// searching = true;
|
|
|
|
|
|
// loading.showLoadingMask();
|
|
|
|
|
|
// $.ajax({
|
|
|
// type: 'GET',
|
|
|
// url: loadMoreUrl,
|
|
|
// success: function(data) {
|
|
|
// if (data.length > 0) {
|
|
|
// jsonObj = JSON.parse(data);
|
|
|
// if ($commentsDiv.length > 0) {
|
|
|
// insertCommentsDiv(jsonObj);
|
|
|
// } else if ($consultsDiv.length > 0) {
|
|
|
// insertConsultsDiv(jsonObj);
|
|
|
// }
|
|
|
// }
|
|
|
// searching = false;
|
|
|
// end = true;
|
|
|
// loading.hideLoadingMask();
|
|
|
// },
|
|
|
// error: function() {
|
|
|
// tip.show('网络断开连接了~');
|
|
|
// searching = false;
|
|
|
// loading.hideLoadingMask();
|
|
|
// }
|
|
|
// });
|
|
|
// }
|
|
|
|
|
|
|
|
|
// function scrollHandler() {
|
|
|
// if (!end || $(window).scrollTop() + winH >= $(document).height() - 50) {
|
|
|
// search();
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// //srcoll to load more
|
|
|
// $(window).scroll(function() {
|
|
|
// window.requestAnimationFrame(scrollHandler);
|
|
|
// });
|
|
|
});
|
|
|
define("js/product/detail/consultform", ["jquery"], function(require, exports, module){
|
|
|
/**
|
|
|
* 我要咨询提交页面
|
|
|
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
|
|
|
* @date: 2015/12/01
|
|
|
*/
|
|
|
var $ = require("jquery"),
|
|
|
tip = require("js/plugin/tip"),
|
|
|
loading = require("js/plugin/loading");
|
|
|
|
|
|
var $consultForm = $('.consult-form'),
|
|
|
$submit = $('#submit'),
|
|
|
$content = $('#content'),
|
|
|
productId = $('#product_id').val(),
|
|
|
isSubmiting;
|
|
|
|
|
|
$submit.on('touchend', function() {
|
|
|
$content.blur();
|
|
|
$consultForm.submit();
|
|
|
return false;
|
|
|
}).on('touchstart', function() {
|
|
|
$(this).addClass('highlight');
|
|
|
}).on('touchend touchcancel', function() {
|
|
|
$(this).removeClass('highlight');
|
|
|
});
|
|
|
|
|
|
$content.on('focus', function() {
|
|
|
if ($content.val() === '请输入咨询内容') {
|
|
|
$content.val('');
|
|
|
}
|
|
|
}).on('blur', function() {
|
|
|
if ($content.val() === '') {
|
|
|
$content.val('请输入咨询内容');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 提交表单请求
|
|
|
$consultForm.on('submit', function() {
|
|
|
var content;
|
|
|
|
|
|
if (isSubmiting) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
// 简单的表单校验
|
|
|
content = $content.val();
|
|
|
if (!content || content === '请输入咨询内容') {
|
|
|
tip.show('咨询内容不能为空');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
isSubmiting = true;
|
|
|
loading.showLoadingMask();
|
|
|
$.ajax({
|
|
|
method: 'POST',
|
|
|
url: '/product/detail/consultsubmit',
|
|
|
data: {
|
|
|
product_id: productId,
|
|
|
content: content
|
|
|
}
|
|
|
}).then(function(res) {
|
|
|
if ($.type(res) !== 'object') {
|
|
|
res = {};
|
|
|
}
|
|
|
if (res.code !== 200) {
|
|
|
tip.show(res.message || '网络出了点问题~');
|
|
|
isSubmiting = false;
|
|
|
loading.hideLoadingMask();
|
|
|
} else {
|
|
|
window.history.go(-1);
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
tip.show('网络出了点问题~');
|
|
|
isSubmiting = false;
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/me/entry", ["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"], function(require, exports, module){
|
|
|
/**
|
|
|
* 个人中心js打包入口文件
|
...
|
...
|
@@ -4999,6 +5184,8 @@ require("js/me/address"); |
|
|
require("js/me/suggest");
|
|
|
require("js/me/browse-record");
|
|
|
require("js/me/address-act");
|
|
|
require("js/me/logistic");
|
|
|
require("js/me/pay");
|
|
|
|
|
|
});
|
|
|
define("js/me/order", ["jquery","hammer","lazyload","handlebars","source-map"], function(require, exports, module){
|
...
|
...
|
@@ -5131,10 +5318,22 @@ orderHammer.on('tap', function(e) { |
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
dialog.showDialog({
|
|
|
dialogText: '删除订单成功',
|
|
|
autoHide: true,
|
|
|
fast: true
|
|
|
});
|
|
|
|
|
|
//删除订单页面刷新
|
|
|
history.go(0);
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
dialog.showDialog({
|
|
|
dialogText: '删除订单失败',
|
|
|
autoHide: true,
|
|
|
fast: true
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -5156,10 +5355,22 @@ orderHammer.on('tap', function(e) { |
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
dialog.showDialog({
|
|
|
dialogText: '取消订单成功',
|
|
|
autoHide: true,
|
|
|
fast: true
|
|
|
});
|
|
|
|
|
|
//取消订单页面刷新
|
|
|
history.go(0);
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
dialog.showDialog({
|
|
|
dialogText: '取消订单失败',
|
|
|
autoHide: true,
|
|
|
fast: true
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -5189,6 +5400,7 @@ $(window).scroll(function() { |
|
|
|
|
|
//初始化请求第一页数据
|
|
|
getOrders();
|
|
|
|
|
|
});
|
|
|
define("js/me/dialog", ["jquery","handlebars","source-map","hammer"], function(require, exports, module){
|
|
|
/*
|
...
|
...
|
@@ -5275,6 +5487,7 @@ exports.showDialog = function(data, callback) { |
|
|
exports.hideDialog = function() {
|
|
|
$dialogWrapper.fadeOut();
|
|
|
};
|
|
|
|
|
|
});
|
|
|
define("js/me/order-detail", ["jquery","lazyload","hammer"], function(require, exports, module){
|
|
|
/**
|
...
|
...
|
@@ -5654,6 +5867,9 @@ headerNavHammer.on('tap', function(e) { |
|
|
autoHide: true,
|
|
|
dialogText: '提交成功'
|
|
|
});
|
|
|
setTimeout(function() {
|
|
|
location.pathname = 'home/suggest';
|
|
|
}, 2000);
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
|
...
|
...
|
@@ -5688,7 +5904,8 @@ $likeBtn.bind('click', function() { |
|
|
method: 'post',
|
|
|
url: '/home/upAndDown',
|
|
|
data: {
|
|
|
suggest_id: id
|
|
|
suggest_id: id,
|
|
|
reliable: 1
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200) {
|
...
|
...
|
@@ -5715,7 +5932,8 @@ $disLikeBtn.bind('click', function() { |
|
|
method: 'post',
|
|
|
url: '/home/upAndDown',
|
|
|
data: {
|
|
|
suggest_id: id
|
|
|
suggest_id: id,
|
|
|
reliable: 2
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200) {
|
...
|
...
|
@@ -6839,7 +7057,6 @@ var end = false, |
|
|
var winH = $(window).height();
|
|
|
|
|
|
load.init();
|
|
|
|
|
|
function moreRecord(cb) {
|
|
|
var count = $page.children('.browse-record-good').length;
|
|
|
|
...
|
...
|
@@ -6875,7 +7092,7 @@ function moreRecord(cb) { |
|
|
|
|
|
lazyLoad($page.find('.browse-record-good:gt(' + (count - 1) + ') .lazy'));
|
|
|
}
|
|
|
|
|
|
window.rePosFooter();
|
|
|
page++;
|
|
|
|
|
|
if (cb) {
|
...
|
...
|
@@ -6913,6 +7130,7 @@ $page.on('touchstart', '.del-icon', function() { |
|
|
rightBtnText: '确定'
|
|
|
}
|
|
|
}, function() {
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/home/delRecord',
|
...
|
...
|
@@ -6921,7 +7139,12 @@ $page.on('touchstart', '.del-icon', function() { |
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
window.history.go(0);
|
|
|
dialog.showDialog({
|
|
|
dialogText: '删除浏览记录成功',
|
|
|
autoHide: true,
|
|
|
fast: true
|
|
|
});
|
|
|
setTimeout(function(){window.history.go(0);},1000);
|
|
|
}
|
|
|
},
|
|
|
complete: function() {
|
...
|
...
|
@@ -6947,7 +7170,6 @@ var $addressForm = $('.edit-address'), |
|
|
$submit = $('.submit'),
|
|
|
$editAddressPage = $('.my-edit-address-page'),
|
|
|
$addressListPage = $('.my-address-list-page'),
|
|
|
$footer = $('#yoho-footer'),
|
|
|
$backBtn = $('.nav-back'),
|
|
|
$navTitle = $('.nav-title'),
|
|
|
$input = $('input, textarea'),
|
...
|
...
|
@@ -7045,12 +7267,6 @@ $submit.on('touchend', function() { |
|
|
$(this).removeClass('highlight');
|
|
|
});
|
|
|
|
|
|
$input.on('focus', function() {
|
|
|
$footer.hide();
|
|
|
}).on('blur', function() {
|
|
|
$footer.show();
|
|
|
});
|
|
|
|
|
|
// 省市区列表异步加载
|
|
|
$.get('/home/locationList').then(function(html) {
|
|
|
$addressListPage.html(html);
|
...
|
...
|
@@ -7058,9 +7274,7 @@ $.get('/home/locationList').then(function(html) { |
|
|
// 省市区
|
|
|
$area.on('touchend', function() {
|
|
|
$editAddressPage.hide();
|
|
|
$addressListPage.show(1, function() {
|
|
|
$footer.hide();
|
|
|
});
|
|
|
$addressListPage.show();
|
|
|
currentPage = 'list';
|
|
|
$navTitle.html('地区选择');
|
|
|
});
|
...
|
...
|
@@ -7099,7 +7313,6 @@ $.get('/home/locationList').then(function(html) { |
|
|
$editAddressPage.show();
|
|
|
currentPage = 'edit';
|
|
|
$navTitle.html(navTitle);
|
|
|
$footer.show();
|
|
|
|
|
|
// 恢复默认的三级选择
|
|
|
$addressListPage.hide();
|
...
|
...
|
@@ -7122,3 +7335,125 @@ $.get('/home/locationList').then(function(html) { |
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/me/logistic", ["jquery"], function(require, exports, module){
|
|
|
/**
|
|
|
* 物流信息页面
|
|
|
* @author: 赵彪<bill.zhao@yoho.cn>
|
|
|
* @date: 2015/12/02
|
|
|
*/
|
|
|
|
|
|
var $ = require("jquery"),
|
|
|
$footer = $('#yoho-footer');
|
|
|
|
|
|
var winH = window.outerHeight,
|
|
|
bodyH = document.body.offsetHeight,
|
|
|
footH = $footer.height();
|
|
|
|
|
|
function addFooterTopBorder() {
|
|
|
if (footH + bodyH > winH) {
|
|
|
window.rePosFooter();
|
|
|
} else {
|
|
|
$footer.css('border-top', '1px solid #f1f1f1');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$(document).ready(addFooterTopBorder);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
define("js/me/pay", ["jquery"], function(require, exports, module){
|
|
|
/**
|
|
|
* 支付页面
|
|
|
* @author: 赵彪<bill.zhao@yoho.cn>
|
|
|
* @date: 2015/12/03
|
|
|
*/
|
|
|
var loading = require("js/plugin/loading");
|
|
|
|
|
|
function isWXOpen() {
|
|
|
var ua = navigator.userAgent.toLowerCase();
|
|
|
|
|
|
if (ua.match(/MicroMessenger/i) === 'micromessenger') {
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function hideWeChatPay() {
|
|
|
var payApps = document.getElementsByClassName('app');
|
|
|
|
|
|
[].forEach.call(payApps, function(app, index) {
|
|
|
if (app.innerHTML.indexOf('微信') !== -1) {
|
|
|
app.parentNode.style.display = 'none';
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function handleForWX() {
|
|
|
if (!isWXOpen()) {
|
|
|
hideWeChatPay();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function setIcon(div, appName) {
|
|
|
|
|
|
if (appName.indexOf('百度') !== -1) {
|
|
|
div.style.backgroundPositionY = '-2.7rem';
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (appName.indexOf('微信') !== -1) {
|
|
|
div.style.backgroundPositionY = '-1.2rem';
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (appName.indexOf('银联') !== -1) {
|
|
|
div.style.backgroundPositionY = '-4rem';
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (appName.indexOf('QQ') !== -1) {
|
|
|
div.style.backgroundPositionY = '-5.4rem';
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function loadIcon() {
|
|
|
var boxs = document.getElementsByClassName('box');
|
|
|
var div = null;
|
|
|
var appName = null;
|
|
|
|
|
|
[].forEach.call(boxs, function(box, index) {
|
|
|
div = box.getElementsByClassName('icon')[0].getElementsByTagName('div')[0];
|
|
|
if (div) {
|
|
|
appName = box.getElementsByClassName('app')[0].innerHTML;
|
|
|
setIcon(div, appName);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function showPage() {
|
|
|
var pageList = document.getElementsByClassName('payapp-list')[0];
|
|
|
|
|
|
pageList.style.visibility = 'visible';
|
|
|
}
|
|
|
|
|
|
function main() {
|
|
|
handleForWX();
|
|
|
loading.hideLoadingMask();
|
|
|
showPage();
|
|
|
loadIcon();
|
|
|
}
|
|
|
|
|
|
loading.showLoadingMask();
|
|
|
|
|
|
window.onload = main;
|
|
|
|
|
|
}); |
...
|
...
|
|