...
|
...
|
@@ -4,7 +4,10 @@ |
|
|
* @date: 2016/7/15
|
|
|
*/
|
|
|
var $ = require('yoho-jquery'),
|
|
|
lazyload = require('yoho-jquery-lazyload');
|
|
|
handlebars = require('yoho-handlebars'),
|
|
|
lazyload = require('yoho-jquery-lazyload'),
|
|
|
Dialog = require('../plugins/dialog').Dialog,
|
|
|
regx = require('../passport/common/mail-phone-regx').phoneRegx;
|
|
|
|
|
|
var $main = $('.product-main'),
|
|
|
$mainThumb = $('#main-thumb'),
|
...
|
...
|
@@ -26,6 +29,9 @@ var $thumbCur = $('.thumb-wrap .cur'); // 当前选中展示图片 |
|
|
|
|
|
var SLIDETIME = 200;
|
|
|
|
|
|
var noticeFn = handlebars.compile($('#arrival-notice-tpl').html() || ''),
|
|
|
noticeSuccFn = handlebars.compile($('#arrival-notice-success-tpl').html() || '');
|
|
|
|
|
|
var thumbsLoaded = [],
|
|
|
id = $main.data('id');
|
|
|
|
...
|
...
|
@@ -94,6 +100,34 @@ function chooseColor(index) { |
|
|
$sizeText.text('');
|
|
|
}
|
|
|
|
|
|
function arrivalNotice() {
|
|
|
// $.ajax({
|
|
|
// type: 'POST',
|
|
|
// url: '/shopping/cart/add',
|
|
|
// data: {
|
|
|
// productSku: sku,
|
|
|
// buyNumber: 1
|
|
|
// }
|
|
|
// }).then(function(data) {
|
|
|
// if (data.code === 200) {
|
|
|
// }
|
|
|
// });
|
|
|
var tip = new Dialog({
|
|
|
className: 'arr-notice-dialog',
|
|
|
content: noticeSuccFn(),
|
|
|
btns: [
|
|
|
{
|
|
|
id: 'sure',
|
|
|
btnClass: ['sure'],
|
|
|
name: '确定',
|
|
|
cb: function() {
|
|
|
tip.close();
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
}).show();
|
|
|
}
|
|
|
|
|
|
// 缩略图垂直居中
|
|
|
$thumbWrap.each(function() {
|
|
|
var $this = $(this),
|
...
|
...
|
@@ -161,6 +195,40 @@ $('.size-list').on('click', 'li', function() { |
|
|
}
|
|
|
});
|
|
|
|
|
|
// 到货通知
|
|
|
$('.arr-notice').click(function() {
|
|
|
var tip = new Dialog({
|
|
|
className: 'arr-notice-dialog',
|
|
|
content: noticeFn({}),
|
|
|
btns: [
|
|
|
{
|
|
|
id: 'apply',
|
|
|
btnClass: ['apply'],
|
|
|
name: '订阅',
|
|
|
cb: function() {
|
|
|
var dom = tip.$el.find('.notice-phone'),
|
|
|
num = dom.val ? dom.val() : '';
|
|
|
|
|
|
if (regx['+86'].test(num)) {
|
|
|
arrivalNotice(num);
|
|
|
tip.close();
|
|
|
} else {
|
|
|
dom.addClass('err');
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
id: 'cancel',
|
|
|
btnClass: ['cancel'],
|
|
|
name: '取消',
|
|
|
cb: function() {
|
|
|
tip.close();
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
}).show();
|
|
|
});
|
|
|
|
|
|
// 加入购物袋
|
|
|
$addToBag.click(function() {
|
|
|
var sku = getBuyProduct();
|
...
|
...
|
|