Authored by 梁志锋

Merge remote-tracking branch 'origin/feature/ticket' into feature/ticket

# Conflicts:
#	static/dist/myohobuy/4.7.6/index.css
#	static/dist/myohobuy/4.7.6/index.js
#	static/dist/myohobuy/4.8.1/index-debug.js
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -1490,16 +1490,26 @@ function initInfosEvt($container) {
type: 'POST',
url: '/guang/opt/collectArticle',
data: {
id: $info.data('id'),
id: getUrlParam('id'),
opt: opt,
yh_channel: yhChannel,
uid: getUrlParam('uid')
},
success: function(data) {
if (data.code && data.code === 200) {
if (data.data.jump) {
if ($('#intimacy-link').length <= 0) {
$('body').append('<a href=\'' + data.data.jumpUrl +
'\' style="display:none;" id="intimacy-link">' +
'<span class="intimacy-link"></span></a>');
}
//切换收藏状态
$btn.toggleClass('collected');
$('.intimacy-link').click();
} else {
//切换收藏状态
$btn.toggleClass('collected');
}
}
},
error: function() {
... ... @@ -2109,11 +2119,6 @@ window.onload = function() {
myScroll && myScroll.refresh();
};
// 图片加载完成之后重新 refresh iscroll
$('img').on('load', function() {
myScroll && myScroll.refresh();
});
//初始化页面,包括是否使用iscorll初始化页面
//接口暴露在HTML中,使用压缩名
exports.i = function(useIscroll) {
... ... @@ -3882,9 +3887,8 @@ module.exports = function(specificGender) {
//The kidsType can be specified by the parameter. Add by @ZhaoBiao
var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
lifestyleType = specificGender === 'lifestyle' ||
$('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false,
yohoCoinType = $('.coin').length ? true : false,
logisticType = $('.logistic-page').length ? true : false;
$('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false;
var $curNav,
index,
$navList = $('#maybe-like-nav');
... ... @@ -3895,25 +3899,14 @@ module.exports = function(specificGender) {
//ajax url
if (kidsType) {
url = '/product/recom/maylikekids';
} else if (lifestyleType) {
//有货币页面加载男生首页的数据
url = specificGender === 'lifestyle' ? '/product/recom/maylike?gender=1,3&rec_pos=100001' : '/product/recom/maylikelife';
} else if (yohoCoinType) {
gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
'1,3&rec_pos=100009' : '2,3&rec_pos=100009',
url = '/product/recom/maylike?gender=' + gender;
} else if (logisticType) { //物流页面
gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
'1,3&rec_pos=100006' : '2,3&rec_pos=100006',
url = '/product/recom/maylike?gender=' + gender;
url = specificGender === 'lifestyle' ? '/product/recom/maylike?gender=1,3' : '/product/recom/maylikelife';
} else {
gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
'1,3&rec_pos=100001' : '2,3&rec_pos=100002',
'1,3' : '2,3',
url = '/product/recom/maylike?gender=' + gender;
}
... ... @@ -4096,17 +4089,28 @@ var $historySearch = $('.history-search');
var $clearHistory = $('#clear-history');
var $buriedpoint = $('.buriedpoint');
var $search = $('#search');
var searchUrl = $search.closest('form').attr('action');
var writeSearch = require("js/index/write-search");
var ranToken = writeSearch.getRanToken();
var historyval = writeSearch.getHistoryval();
var chHammer, cHammer;
chHammer = new Hammer($clearHistory[0]);
function isLocalStorageSupported() {
var testKey = 'test',
storage = Window.prototype.localStorage;
try {
storage.setItem(testKey, 'testValue');
storage.removeItem(testKey);
return true;
} catch (error) {
return false;
}
}
chHammer.on('tap', function() {
dialog.showDialog({
dialogText: '您确定要删除您的最近搜索吗?',
... ... @@ -4115,9 +4119,8 @@ chHammer.on('tap', function() {
rightBtnText: '确定'
}
}, function() {
if (localStorage) {
localStorage.removeItem(historyval);
if (isLocalStorageSupported()) {
localStorage.removeItem('historys');
}
$history.html('');
... ... @@ -4177,7 +4180,8 @@ function inputAction() {
}
$searchAssociate.find('li').on('touchend', function() {
GoSearch($(this).find('.keyword').html());
$buriedpoint.val($(this).find('.keyword').html());
$search.closest('form').submit();
});
},
error: function() {
... ... @@ -4187,28 +4191,6 @@ function inputAction() {
});
}
//跳到搜索页
function GoSearch(query) {
//保存搜索的内容
writeSearch.setHistoryValFun(query);
document.location.href = searchUrl + '?query=' + query;
}
//热门搜索、最近搜索事件
$('.search-items .search-group').on('click', 'li', function(event) {
var query = '';
if (event.target.nodeName === 'A') {
query = $(event.target).html();
}
if (event.target.nodeName === 'LI') {
query = $(event.target).find('a').html();
}
GoSearch(query);
});
inputAction();
cHammer = new Hammer($clear[0]);
... ... @@ -4217,19 +4199,13 @@ cHammer.on('tap', function() {
});
$search.on('touchend', function() {
var $buriedpoint = $form.find('.buriedpoint');
if ($buriedpoint.val() === '') {
if ($buriedpoint.val() === '' && $('#default-terms').val() !== '') {
$buriedpoint.val($('#default-terms').val());
}
//保存搜索的内容
writeSearch.setHistoryValFun($buriedpoint.val());
if (security.hasDangerInput()) {
return false;
}
$(this).closest('form').submit();
return false;
});
... ... @@ -4238,10 +4214,13 @@ $search.on('touchend', function() {
(function() {
var html = '',
history,
historys, i, num = 1;
historys, i, num = 1, searchUrl = '';
if (localStorage) {
historys = localStorage.getItem(historyval);
if (isLocalStorageSupported()) {
historys = localStorage.getItem('historys');
}
searchUrl = $form.attr('action');
if (historys && historys.length > 0) {
historys = historys.split(ranToken);
... ... @@ -4256,7 +4235,7 @@ $search.on('touchend', function() {
break;
}
html += '<li><a href="javascript:void(0);">' + history + '</li>';
html += '<li><a href="' + searchUrl + '/?query=' + history + '">' + history + '</li>';
}
$history.html(html);
... ... @@ -4268,6 +4247,11 @@ $search.on('touchend', function() {
}
}
}());
if (isLocalStorageSupported()) {
writeSearch.bindWirteLocal($form);
}
});
define("js/plugin/security", ["jquery"], function(require, exports, module){
/**
... ... @@ -4449,47 +4433,56 @@ define("js/index/write-search", [], function(require, exports, module){
* @date: 2015/10/29
*/
var ranToken = ',',
historyval = 'historys1';
var ranToken = ' ??++ ';
function isLocalStorageSupported() {
var testKey = 'test',
storage = Window.prototype.localStorage;
try {
storage.setItem(testKey, 'testValue');
storage.removeItem(testKey);
return true;
} catch (error) {
return false;
}
}
//获取分隔符
function getRanToken() {
return ranToken;
}
//存变量
function getHistoryval() {
return historyval;
}
//绑定提交前的存local操作
function bindWirteLocal($form) {
$form.on('submit', function() {
var query = this.query.value;
var query = this.query.value,
historys;
setHistoryValFun(query);
});
}
if (localStorage) {
if (isLocalStorageSupported()) {
historys = localStorage.getItem('historys');
}
function setHistoryValFun(query) {
var historys;
if (localStorage) {
historys = localStorage.getItem(historyval);
historys = historys ? historys : '';
historys = historys ? historys.replace(new RegExp((query + ranToken), 'g'), '') : '';
if (historys.indexOf(ranToken + query + ranToken) > -1) {
return;
}
if (historys === '') {
query = ranToken + query;
}
if (historys === '') {
query = ranToken + query;
}
historys += query + ranToken;
localStorage.setItem(historyval, historys);
}
historys += query + ranToken;
if (isLocalStorageSupported()) {
localStorage.setItem('historys', historys);
}
}
});
}
exports.getRanToken = getRanToken;
exports.getHistoryval = getHistoryval;
exports.setHistoryValFun = setHistoryValFun;
exports.bindWirteLocal = bindWirteLocal;
});
... ... @@ -5809,6 +5802,7 @@ function nextStep(url, mobileNo, areaCode) {
},
success: function(res) {
// console.log(res.data);
if (res.code === 200) {
// 统计代码:用于统计从哪个渠道登录
... ... @@ -5870,6 +5864,19 @@ $btnNext.on('touchstart', function() {
nickname: nickname
},
success: function(res) {
// console.log(res);
//res : {
// code: 'xxx',
// data: {
// isReg: 0,
// next: 'xxxx'
// },
// message: 'xxxx',
//}
if (res.code === 200) {
if (res.data.isReg === 1) {
dialog.showDialog({
... ... @@ -6154,11 +6161,6 @@ function search(opt) {
color: opt.id
};
break;
case 'ageLevel':
ext = {
age_level: opt.id
};
break;
case 'size':
ext = {
size: opt.id
... ... @@ -6778,11 +6780,6 @@ function search(opt) {
brand: opt.id
};
break;
case 'ageLevel':
ext = {
age_level: opt.id
};
break;
case 'sort':
ext = {
sort: opt.id
... ... @@ -7216,7 +7213,6 @@ function getQueryString(name) {
shopId = getQueryString('shop_id');
sort = getQueryString('sort');
outlets = getQueryString('outlets');
age_level = outlets = getQueryString('ageLevel');
/**
* 筛选注册的回调,筛选子项点击后逻辑
... ... @@ -7275,11 +7271,6 @@ function search(opt) {
color: opt.id
};
break;
case 'ageLevel':
ext = {
age_level: opt.id
};
break;
case 'size':
ext = {
size: opt.id
... ... @@ -7335,10 +7326,6 @@ function search(opt) {
params.shop_id = shopId;
}
if (age_level) {
params.age_level = age_level
}
if (sort) {
params.sort = sort;
}
... ... @@ -7827,6 +7814,9 @@ var productId = $('#productId').val();
var skn = $('#productSkn').val(),
productCode = $('#limitProductCode').val();
//门票 限购数量
var ticketsLimit = $('#limitNum').val() || 0;
$('#likeBtn').on('touchstart', function() {
var opt,
favorite;
... ... @@ -7880,6 +7870,14 @@ $('#likeBtn').on('touchstart', function() {
});
$('#addtoCart').on('touchstart', function() {
//门票验证登录
if (ticketsLimit) {
if (!ticketCheckLogin()) {
return false;
}
}
$('.cart-bar').hide();
productCode && chosePanel.setLimitGoodModeWithSknId(productCode, skn);
... ... @@ -7896,11 +7894,32 @@ $('#addtoCart').on('touchstart', function() {
return false;
});
ticketCheckOpen();
$('#buyLimit').on('touchstart', function() {
tip.show('打开APP可抢购该商品哦~');
return false;
});
//门票立即购买验证登录
function ticketCheckLogin() {
if (!window.getUid()) {
var urlArray = window.location.href.split('?');
window.location.href = '//m.yohobuy.com/signin.html?refer=' + urlArray[0] + '?product_type=ticket';
return false;
}
return true;
}
// 门票登录后自动弹出
function ticketCheckOpen() {
var showPannel = $('#showPannel').val();
if (showPannel) {
chosePanel.show();
}
}
});
define("js/cart/chose-panel", ["jquery"], function(require, exports, module){
/**
... ... @@ -7942,7 +7961,13 @@ var $chosePanel = $('#chose-panel'),
$choseArea,
$cartBar,
$soonSoldOut = $('.soonSoldOut-tag'),
$yohoPage = $('.yoho-page');
$yohoPage = $('.yoho-page'),
//门票 限购数量
ticketsLimit = $('#limitNum').val() || 0,
single = $('#single').val() || 0;
$productSku = $('#productSku'),
$buyNumber = $('#buyNumber'),
$buyNowForm = $('#buyNowForm');
// 购物车编辑标相关变量
var isEdit,
... ... @@ -8031,6 +8056,14 @@ function removePannel() {
}
function checkColorSizeNum() {
if (ticketsLimit) {
//门票
if (!checkTickets()) {
return;
}
}
if (!hasChooseColor && !hasChooseSize) {
tip.show('请选择颜色和尺码~');
return false;
... ... @@ -8044,6 +8077,24 @@ function checkColorSizeNum() {
return true;
}
//检查门票选择
function checkTickets() {
if (!hasChooseColor && !hasChooseSize) {
if (single) {
tip.show('请选择日期~');
} else {
tip.show('请选择日期和区域~');
};
return false;
} else if (!hasChooseColor) {
tip.show('请选择日期~');
return false;
} else if (!hasChooseSize && !single) {
tip.show('请选择区域~');
return false;
}
return true;
}
function show(html, cb) {
... ... @@ -8078,7 +8129,7 @@ function updateConformButtonClassAndText() {
$chosed = $allChoseItems.find('.chosed');
if (2 === $chosed.closest('.zero-stock').length) {
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
} else if (limitProductCode) {
} else if (limitProductCode || ticketsLimit) {
$('#chose-btn-sure').css('background-color', '#eb0313').html('立即购买');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车');
... ... @@ -8088,7 +8139,14 @@ function updateConformButtonClassAndText() {
//显示剩余件数
function displayGoodNum(curGoodNum) {
//数量大于0
//门票限购
if (ticketsLimit) {
$allChoseItems.find('.num .left-num').html('限购' + ticketsLimit + '件');
$leftNum.val(curGoodNum);
return;
}
//数量大于
if (curGoodNum > 0) {
if ($soonSoldOut.length > 0) {
$allChoseItems.find('.num .left-num').html('即将售罄');
... ... @@ -8152,6 +8210,39 @@ function changeColorChosed(newColorIndex) {
return 0;
}
//添加门票
function addTickets(productSku, buyNumber) {
var data = {
productSku: productSku,
buyNumber: buyNumber
};
//校验电子票
$.ajax({
url: '/cart/index/checkTickets',
dataType: 'json',
data: data,
type: 'post',
success: function (addRestult) {
if (addRestult.code != 200) {
if (addRestult.code == 401) {
var refer = window.location.href;
window.location.href = '//m.yohobuy.com/signin.html?refer=' + refer;
}
tip.show(addRestult.message);
} else {
$productSku.val(productSku);
$buyNumber.val(buyNumber);
$buyNowForm.submit();
}
},
error: function () {
tip.show('网络异常~');
}
});
}
init();
... ... @@ -8201,7 +8292,6 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
//老的选中尺码去掉勾选,新的选中尺码加上勾选
curGoodNum = changeSizeChosed(index + 1);
// 显示剩余数量
displayGoodNum(curGoodNum);
... ... @@ -8232,6 +8322,19 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 设置按钮的样式和文字
updateConformButtonClassAndText();
//展览票
if (ticketsLimit && single) {
//选中日期
$curSizeBlock = $('.size-list .size-row .block').eq(index + 1);
$curSizeBlock.addClass('chosed');
// 显示剩余数量
displayGoodNum($curColorBlock.data('num'));
hasChooseSize = true;
return false;
}
}).on('touchstart', '.size-list .block', function() {
var $this = $(this),
index,
... ... @@ -8307,9 +8410,10 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
$num.val(num - 1);
}).on('touchstart', '.btn-plus', function() {
var num = parseInt($num.val(), 10);
var num = parseInt($num.val(), 10),
maxTips = ticketsLimit ? '每人只可购买' + ticketsLimit + '张当日门票' : '您选择的数量超过了最大库存量~';
leftNum = $('#left-num').val();
leftNum = ticketsLimit || $('#left-num').val();
if (!checkColorSizeNum()) {
return;
... ... @@ -8321,7 +8425,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
//TODO:库存数验证
if (num > leftNum - 1) {
tip.show('您选择的数量超过了最大库存量~');
tip.show(maxTips);
return;
}
$num.val(num + 1);
... ... @@ -8363,9 +8467,18 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
return false;
}
confirming = true;
if (!ticketsLimit) {
confirming = true;
}
loading.showLoadingMask();
//立即购买门票
if (ticketsLimit) {
addTickets(productSku, buyNumber);
return;
}
//针对是否处于编辑模式设置不同的url和需要post的数据
if (isEdit) {
cartGoodData = {
... ... @@ -9269,6 +9382,7 @@ var winH = $(window).height(),
var defaultOpt = require("js/product/query-param");
var $listNav = $('#list-nav'),
$posList = $('#pos-list'),
//导航数据信息
navInfo = {
... ... @@ -9643,9 +9757,7 @@ function search(opt) {
}
}
$listNav.children('.active').removeClass('active');
$pre.addClass('active');
if (opt.hasOwnProperty('id')) {
if (opt.id) {
switch (opt.type) {
case 'shop_id':
ext = {
... ... @@ -9687,11 +9799,6 @@ function search(opt) {
discount: opt.id
};
break;
case 'ageLevel':
ext = {
age_level: opt.id
};
break;
}
$.extend(defaultOpt, ext); //扩展筛选项
}
... ... @@ -9815,6 +9922,11 @@ $.ajax({
success: function(data) {
$goodsContainer.append(data);
setTimeout(function() {
myScroll.refresh();
scH = $('#scroller').outerHeight();
}, 1000);
//初始化filter&注册filter回调
filter.initFilter({
fCbFn: search,
... ... @@ -9826,11 +9938,6 @@ $.ajax({
},
missStatus: true
});
setTimeout(function() {
myScroll.refresh();
scH = $('#scroller').outerHeight();
}, 1000);
}
});
... ... @@ -9838,6 +9945,10 @@ $listNav.bind('contextmenu', function(e) {
return false;
});
$posList.bind('contextmenu', function(e) {
return false;
});
$subNav.on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li'),
cname,
... ... @@ -10005,11 +10116,12 @@ $listNav.on('touchstart', 'li', function(e) {
myScroll.refresh();
});
$nav2.on('touchstart', 'li', function(e) {
$posList.on('touchstart', 'li', function(e) {
$(this).addClass('bytouch');
}).on('touchend touchcancel', function() {
$nav2.find('li').removeClass('bytouch');
$posList.find('li').removeClass('bytouch');
myScroll.refresh();
myScroll.scrollTo(0, -(imgH + nav1H + main1oH + 5));
});
//底部导航点击
... ... @@ -12026,7 +12138,7 @@ var jQuery = require("jquery");
})(jQuery);
});
define("js/me/index", ["jquery","swiper","lazyload","index"], function(require, exports, module){
define("js/me/index", ["jquery","swiper","index"], function(require, exports, module){
/**
* 个人中心首页
* @author: bikai<kai.bi@yoho.cn>
... ... @@ -12040,7 +12152,7 @@ var $userAvatar = $('.user-avatar'),
var myImage = new Image(),
avatar;
require("js/product/recommend-for-you-user-center");
require("js/product/recommend-for-you");
require("js/product/suspend-cart");
// 部分老用户没有头像,显示默认头像
... ... @@ -12060,7 +12172,7 @@ $('.yoho-page').on('touchstart', '.list-item, .type-item, .order-title', functio
});
});
define("js/product/recommend-for-you-user-center", ["swiper","jquery","lazyload","index"], function(require, exports, module){
define("js/product/recommend-for-you", ["swiper","jquery","index"], function(require, exports, module){
/**
* 为您优选
* @author: bikai<kai.bi@yoho.cn>
... ... @@ -12069,15 +12181,22 @@ define("js/product/recommend-for-you-user-center", ["swiper","jquery","lazyload"
var Swiper = require("swiper"),
$ = require("jquery"),
lazyLoad = require("lazyload");
$ = require("jquery");
var $recommendForYou = $('.recommend-for-you');
var recommendSwiper,
$recommendForYou = $('.recommend-for-you');
$.get('/product/recommend-for-you/userCenter').then(function(html) {
$.get('/home/preference').then(function(html) {
$recommendForYou.html(html).show();
lazyLoad($('img.lazy'));
if ($('#swiper-recommend').length) {
recommendSwiper = new Swiper('#swiper-recommend', {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'a',
lazyLoading: true,
watchSlidesVisibility: true
});
}
}).fail(function() {
$recommendForYou.hide();
});
... ... @@ -13109,7 +13228,6 @@ require("js/cart/order-ensure");
require("js/cart/invoice-info");
require("js/cart/select-coupon");
require("js/cart/select-address");
require("js/cart/jit-detail");
});
define("js/cart/cart", ["jquery","mlellipsis","hammer","handlebars","source-map","swiper","lazyload","index"], function(require, exports, module){
... ... @@ -13149,11 +13267,15 @@ function needLoadRecommandForYou() {
$('.cart-goods').length <= 0 && !isRefreshByDelete :
$('.cart-goods').length <= 0;
}
require("js/product/recommend-for-you-cart");
if (!needLoadRecommandForYou()) {
if (needLoadRecommandForYou()) {
require("js/product/recommend-for-you");
} else {
if (isRefreshByDelete) {
$('body').css('background-color', '#f0f0f0');
}
require("js/cart/good");
}
}
$cartPage.css('display', 'block');
loading.hideLoadingMask();
... ... @@ -13356,27 +13478,6 @@ if ($('.invalid-goods').find('.shopping-cart-good').length === 0) {
$('#failure-goods').removeClass('invalid-goods');
}
});
define("js/product/recommend-for-you-cart", ["swiper","jquery","lazyload","index"], function(require, exports, module){
/**
* 为您优选
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/16
*/
var Swiper = require("swiper"),
$ = require("jquery"),
lazyLoad = require("lazyload");
var $recommendForYou = $('.recommend-for-you');
$.get('/product/recommend-for-you/cart').then(function(html) {
$recommendForYou.html(html).show();
lazyLoad($('img.lazy'));
}).fail(function() {
$recommendForYou.hide();
});
});
define("js/cart/good", ["jquery","mlellipsis","lazyload","handlebars","source-map","hammer"], function(require, exports, module){
/**
* 购物车商品
... ... @@ -13781,41 +13882,21 @@ var $invoice = $('.invoice'),
$coinCheck = $('.coin-check'),
$coinUsed = $('.coin .used'),
$subBlock = $('.sub-block'),
$ticketsMobile = $('#mobile'),
payType,
queryString = $.queryString(),
orderInfo = order.orderInfo,
isSubmiting,
dispatchInfo,
total;
var orderCont = window.cookie('order-info') && JSON.parse(window.cookie('order-info'));
var invoiceCont = {
7: '服装',
1: '图书',
9: '配件',
11: '日用品',
3: '办公用品',
6: '体育用品',
10: '数码产品'
},
invoicesType = {
1: '纸质',
2: '电子'
};
total,
isTickets = $('#ticketsPage').val(),
productSku = $('#productSku').val(),
buyNumber = $('#buyNumber').val();
require("js/common");
lazyLoad();
// 初始化发票信息
function invoiceInit() {
if (orderCont.invoiceType) {
$('.invoice-type').text(invoiceCont[orderCont.invoiceType] + '(' + invoicesType[orderCont.invoicesType] + ')');
} else {
$('.invoice-type').text('服装(电子)');
}
}
function getQueryParam() {
var queryArray = location.search.substr(1).split('&'),
i,
... ... @@ -13896,23 +13977,10 @@ $invoice.on('touchend', '.checkbox', function() {
if ($this.hasClass('icon-cb-radio')) {
$invoice.addClass('focus');
orderInfo('invoiceText', '');
orderInfo('invoiceType', '7');
orderInfo('receiverMobile', $('.user-mobile').val());
orderInfo('invoicesType', '2');
orderInfo('invoiceTitle', '个人');
}
if ($this.hasClass('icon-radio')) {
$invoice.removeClass('focus');
orderInfo('invoiceText', null);
orderInfo('invoiceType', null);
orderInfo('receiverMobile', null);
orderInfo('invoicesType', null);
orderInfo('invoiceTitle', null);
}
orderCont = window.cookie('order-info') && JSON.parse(window.cookie('order-info'));
invoiceInit();
});
... ... @@ -13935,20 +14003,30 @@ function updateDeliverId(id) {
function orderCompute() {
var yohoCoin = orderInfo('yohoCoin'),
deliverId = orderInfo('deliveryId');
loading.showLoadingMask();
$.ajax({
method: 'POST',
url: '/cart/index/orderCompute',
data: {
deliverId = orderInfo('deliveryId'),
data = {
cartType: orderInfo('cartType') || 'ordinary',
deliveryId: orderInfo('deliveryId'),
paymentTypeId: orderInfo('paymentTypeId'),
couponCode: orderInfo('couponCode'),
yohoCoin: yohoCoin,
skuList: isLimitGood() ? orderInfo('skuList') : undefined
};
//门票
if (isTickets) {
data = {
type: 'tickets',
productSku: productSku,
buyNumber: buyNumber,
yohoCoin: yohoCoin
}
};
loading.showLoadingMask();
$.ajax({
method: 'POST',
url: '/cart/index/orderCompute',
data: data
}).then(function(res) {
if ($.type(res) !== 'object') {
window.location.reload();
... ... @@ -13992,16 +14070,16 @@ function submitOrder() {
return false;
}
// if (orderInfo('invoice')) {
// if (!invoiceText) {
// tip.show('请输入发票抬头');
// return;
// }
// if (invoiceText.length > 30) {
// tip.show('发票抬头不得超过30个汉字');
// return;
// }
// }
if (orderInfo('invoice')) {
if (!invoiceText) {
tip.show('请输入发票抬头');
return;
}
if (invoiceText.length > 30) {
tip.show('发票抬头不得超过30个汉字');
return;
}
}
if (msg) {
if (msg.length > 40) {
... ... @@ -14159,6 +14237,10 @@ $subBlock.on('touchstart', 'li', function() {
$('.bill a').on('touchstart', function() {
if (isTickets) {
ticketsConfirm();
return ;
}
orderInfo('paymentTypeId', $('.delivery-id .icon-cb-radio').data('id'));
orderInfo('paymentType', $('.payment-type .icon-cb-radio').data('id'));
... ... @@ -14177,9 +14259,48 @@ if (orderInfo('address') && orderInfo('address').is_support === 'N') {
orderInfo('deliveryId', $('.delivery-id .icon-cb-radio').data('id'));
orderCompute();
}
//电子票下单
function ticketsConfirm () {
if(!$ticketsMobile.val()) {
tip.show('手机号必填');
return;
}
var data = {
productSku: productSku,
buyNumber: buyNumber,
mobile: $ticketsMobile.val(),
useYohoCoin: orderInfo('yohoCoin')
};
$.ajax({
url: '/cart/index/submitTicket',
type: 'POST',
dataType: 'json',
data: data,
success: function(ticket) {
//下单成功调整支付页面
if (ticket.code === 200) {
window.location.href = '/home/orders/pay?order_code=' + ticket.data.order_code
} else {
tip.show(ticket.message);
}
},
error: function () {
tip.show('网络异常~');
}
});
}
// 初始化发票信息内容
invoiceInit();
//校验手机号
$ticketsMobile.blur(function function_name (e) {
var reg = /^[0123456789]{1,30}$/;
var mobile = $ticketsMobile.val();
if (!reg.test(mobile)) {
tip.show('手机号码不正确!');
}
})
});
define("js/cart/order-info", ["jquery","hammer"], function(require, exports, module){
/**
... ... @@ -14207,7 +14328,6 @@ function init() {
invoiceType: null,
invoiceTitle: null,
receiverMobile: null,
isModifyTel: false,
invoicesType: null,
msg: null,
cartType: 'ordinary'
... ... @@ -14255,13 +14375,10 @@ var $invoiceNotice = $('.invoice-notice'),
$invoiceType = $('.invoice-type'),
$tel = $('.tel'),
$company = $('.company'),
$telArea = $('.tel-area'),
orderInfo = order.orderInfo,
$chooseContLi = $('.invoice-cont').find('.icon-cb-radio').parent(),
$copyTel = $('.copy-tel'),
isModifyTel = false;
$chooseContLi = $('.invoice-cont').find('.icon-cb-radio').parent();
var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/,
var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/,
linkUrl = '/cart/index/orderEnsure?cartType=ordinary';
require("js/common");
... ... @@ -14293,7 +14410,7 @@ function confirmAction() {
cont = $chooseCont.data('id');
if ($editFlag.val() === 'true') {
if (type === 2 && !myreg.test($tel.attr('data-tel'))) {
if (!myreg.test($tel.attr('data-tel'))) {
tip.show('请输入正确手机号');
$tel.focus();
return false;
... ... @@ -14319,12 +14436,6 @@ function confirmAction() {
orderInfo('invoicesType', type);
orderInfo('invoiceTitle', title);
if (isModifyTel && $copyTel !== tel) {
orderInfo('isModifyTel', true);
} else {
orderInfo('isModifyTel', false);
}
dialog.showDialog({
dialogText: '保存成功',
autoHide: true,
... ... @@ -14366,13 +14477,6 @@ $('.invoice-type span').on('touchstart', function() {
} else {
$(this).addClass('on').siblings().removeClass('on');
$editFlag.val('true');
// 纸质发票不显示手机号
if ($(this).index() === 1) {
$telArea.slideUp();
} else {
$telArea.slideDown();
}
}
});
... ... @@ -14395,7 +14499,6 @@ $('.istel').one('input', function() {
$tel.on('input', function() {
$(this).attr('data-tel', $(this).val());
$editFlag.val('true');
isModifyTel = true;
});
$company.on('input', function() {
... ... @@ -14630,6 +14733,7 @@ $('.address-item').on('touchend', function() {
orderInfo('addressId', addressId);
orderInfo('address', address);
console.log($this.data('href') + (orderInfo('limitUrlSufix') || ''));
window.location.href = $this.data('href') + (orderInfo('limitUrlSufix') || '');
}).on('touchend', '.edit', function() {
window.location.href = $(this).data('href');
... ... @@ -14646,40 +14750,6 @@ $confim.on('touchend', '.confim', function() {
});
});
define("js/cart/jit-detail", ["swiper","jquery","index"], function(require, exports, module){
/**
* jit拆单配送信息页面
* @author: zhaobiao<bill.zhao@yoho.cn>
* @date: 2016/04/26
*/
var Swiper = require("swiper"),
$ = require("jquery");
var height = $(window).height() - $('#yoho-header').height();
// 为了展示页面背景色,需要把页面根据窗口大小撑开
$('.jit-detail-page').css('height', height);
$('.jit-detail-page>div').show();
// 内容展示之后,再根据document高度,调整一次容器高度
height = $(document).height() - $('#yoho-header').height();
$('.jit-detail-page').css('height', height);
(function() {
return new Swiper('.swiper-container', {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'a',
lazyLoading: true,
watchSlidesVisibility: true
});
})();
});
define("js/life/entry", ["jquery","hammer"], function(require, exports, module){
/*
* To change this license header, choose License Headers in Project Properties.
... ...
... ... @@ -216,7 +216,7 @@ function updateConformButtonClassAndText() {
function displayGoodNum(curGoodNum) {
//门票限购
if (ticketsLimit && curGoodNum > ticketsLimit) {
if (ticketsLimit) {
$allChoseItems.find('.num .left-num').html('限购' + ticketsLimit + '件');
$leftNum.val(curGoodNum);
return;
... ...
... ... @@ -413,9 +413,7 @@ class DetailModel
public static function getSizeInfo($productSkn, $uid, $udid)
{
$result = array();
//虚拟商品(门票)
$ticketsSkn = array('single' => TicketsConfig::SINGLE_TICKETS_SKN,'package' => TicketsConfig::PACKAGE_TICKETS_SKN);
$colorName = in_array($productSkn, $ticketsSkn) ? '日期' : '颜色';
if (is_numeric($productSkn)) {
// 调用服务
$sizeInfo = DetailData::sizeInfo($productSkn, $uid, $udid);
... ... @@ -437,7 +435,7 @@ class DetailModel
'detail' => array(
'list' => array(
array('param' => '编号:' . $sizeInfo['productDescBo']['erpProductId']),
array('param' => $colorName. ':' . $sizeInfo['productDescBo']['colorName']),
array('param' => '颜色:' . $sizeInfo['productDescBo']['colorName']),
array('param' => '性别:' . $sex),
)
),
... ... @@ -621,11 +619,6 @@ class DetailModel
$sizeInfo = array();
}
//虚拟门票隐藏(100正品/7天无理由/便捷)
if (in_array($productSkn, $ticketsSkn)) {
$result['hideService'] = true;
}
return $result;
}
... ...