Authored by Rock Zhang

Merge branch 'feature/order' of git.dev.yoho.cn:web/yohobuy into feature/order

... ... @@ -7956,6 +7956,13 @@ optHammer.on('tap', function(e) {
}
});
function phoneHidden(phone) {
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
}
$('.name-phone span').html(phoneHidden($('.name-phone span').html()));
});
define("js/me/fav", ["jquery","hammer","swiper","handlebars","source-map","index"], function(require, exports, module){
/**
... ... @@ -9528,6 +9535,13 @@ $action.on('touchstart', 'a,span', function() {
$(this).css('background', 'transparent');
});
function phoneHidden(phone) {
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
}
$('.tel').each(function(index) {
$('.tel').eq(index).html(phoneHidden($('.tel').eq(index).html()));
});
});
define("js/me/browse-record", ["jquery","lazyload","handlebars","source-map","hammer"], function(require, exports, module){
/**
... ... @@ -9895,6 +9909,7 @@ $('.phone').on('touchend', function() {
$('input[name = "mobile"]').on('blur', function() {
$('.phone').css('display', 'block');
$('.phone').html($('input[name = "mobile"]').val());
$('input[name = "mobile"]').attr('type', 'hidden');
});
});
... ... @@ -10498,7 +10513,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
goodInfo.hasPromotion = promotion;
goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
goodsList.push(new GoodInfo(goodInfo));
console.log(goodInfo);
$.ajax({
type: 'post',
url: 'select',
... ... @@ -10844,7 +10858,8 @@ var $invoice = $('.invoice'),
queryString = $.queryString(),
orderInfo = order.orderInfo,
isSubmiting,
dispatchInfo;
dispatchInfo,
total;
require("js/common");
... ... @@ -10902,36 +10917,36 @@ if (queryString.cartType || queryString.carttype || !orderInfo('cartType')) {
orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary');
}
function dispacthTapEvt(e) {
var $cur = $(e.target).closest('li');
// function dispacthTapEvt(e) {
// var $cur = $(e.target).closest('li');
if ($cur.length === 0 || $cur.hasClass('chosed')) {
return;
}
// if ($cur.length === 0 || $cur.hasClass('chosed')) {
// return;
// }
$cur.siblings('li.chosed').removeClass('chosed');
$cur.addClass('chosed');
}
// $cur.siblings('li.chosed').removeClass('chosed');
// $cur.addClass('chosed');
// }
$('.checkbox').on('touchstart', function() {
var $this = $(this);
if ($this.hasClass('icon-cb-checked')) {
$this.removeClass('icon-cb-checked').addClass('icon-checkbox');
if ($this.hasClass('icon-cb-radio')) {
$this.removeClass('icon-cb-radio').addClass('icon-radio');
return;
}
if ($this.hasClass('icon-checkbox')) {
$this.removeClass('icon-checkbox').addClass('icon-cb-checked');
if ($this.hasClass('icon-radio')) {
$this.removeClass('icon-radio').addClass('icon-cb-radio');
}
});
$invoice.on('touchend', '.checkbox', function() {
var $this = $(this);
if ($this.hasClass('icon-cb-checked')) {
if ($this.hasClass('icon-cb-radio')) {
$invoice.addClass('focus');
}
if ($this.hasClass('icon-checkbox')) {
if ($this.hasClass('icon-radio')) {
$invoice.removeClass('focus');
}
});
... ... @@ -10952,11 +10967,10 @@ function orderCompute() {
skuList: isLimitGood() ? orderInfo('skuList') : undefined
}
}).then(function(res) {
if ($.type(res) !== 'object') {
window.location.reload();
} else {
if (res.last_order_amount) {
if (typeof res.last_order_amount !== undefined) {
res.last_order_amount = (+res.last_order_amount).toFixed(2);
}
if (res.use_yoho_coin) {
... ... @@ -10965,6 +10979,18 @@ function orderCompute() {
$coinCheck.find('em').show();
$coinUsed.show();
}
total = '';
if (res.promotion_formula_list) {
$.each(res.promotion_formula_list, function(index, value) {
total += '<li>' +
'<p>' + value.promotion + '</p>' +
'<span>' + value.promotion_amount + '</span>' +
'</li>';
});
$('.price-cost span').html('¥' + res.last_order_amount);
$('.bill span').html('¥' + res.last_order_amount);
$('.total').html(total);
}
}
}).fail(function() {
window.location.reload();
... ... @@ -10977,10 +11003,6 @@ function submitOrder() {
var invoiceText = $invoice.find('[name="invoice-title"]').val() || orderInfo('invoiceText'),
msg = $('#msg').find('input').val() || orderInfo('msg');
if (orderInfo('deliveryId') === 2 && !$addressWrap.data('support')) {
tip.show('当前地址不支持顺丰快递');
return;
}
if (isSubmiting) {
return false;
}
... ... @@ -11055,17 +11077,8 @@ if (!orderInfo('addressId')) {
}
$('.dispatch-mode').on('touchend', 'li', function() {
var $defaultMode = $('.dispatch-mode [data-id="1"]');
if (!$addressWrap.data('support') && $(this).data('id') === 2) {
dispacthTapEvt({
target: $defaultMode
});
tip.show('当前地址不支持顺丰快递');
} else {
orderInfo('deliveryId', $(this).data('id'));
orderCompute();
}
orderInfo('deliveryId', $(this).data('id'));
orderCompute();
});
$('.dispatch-time').on('touchend', 'li', function() {
... ... @@ -11075,7 +11088,7 @@ $('.dispatch-time').on('touchend', 'li', function() {
$('.coin').on('touchend', function() {
var $this = $(this);
if ($this.find('.checkbox').hasClass('icon-cb-checked')) {
if ($this.find('.checkbox').hasClass('icon-cb-radio')) {
orderInfo('yohoCoin', $this.data('yoho-coin'));
$this.find('.can-use').hide();
} else {
... ... @@ -11090,7 +11103,7 @@ $('.coin').on('touchend', function() {
$invoice.on('touchend', '.checkbox', function(e) {
var $this = $(this);
orderInfo('invoice', $this.hasClass('icon-cb-checked'));
orderInfo('invoice', $this.hasClass('icon-cb-radio'));
e.preventDefault();
e.stopPropagation();
});
... ... @@ -11119,34 +11132,46 @@ $('form').on('submit', function() {
// xwg 2016/3/21 13:22
$('.dispatch').on('touchend', 'h3', function() {
if ($(this).siblings('ul').find('li').length === 1) {
return false;
}
if ($(this).siblings('ul').is(':hidden')) {
$('.dispatch h3').removeClass('border-none');
$(this).addClass('border-none');
$('.down').removeClass('hide');
$('.up').addClass('hide');
$('.up', this).removeClass('hide');
$('.down', this).addClass('hide');
$('.dispatch ul').hide();
$(this).siblings('ul').show();
} else {
$(this).removeClass('border-none');
$('.down', this).removeClass('hide');
$('.up', this).addClass('hide');
$(this).siblings('ul').hide();
}
});
$subBlock.on('touchstart', 'i', function() {
$subBlock.on('touchstart', 'li', function() {
$.each($(this).parents('ul').find('i'), function() {
$(this).removeClass('icon-cb-radio').addClass('icon-radio');
$(this).parents('ul').find('i').removeClass('icon-cb-radio').addClass('icon-radio');
});
dispatchInfo = $(this).siblings('span').html();
$(this).parents('ul').hide();
$('.down').removeClass('hide');
$('.up').addClass('hide');
$('.dispatch h3').removeClass('border-none');
dispatchInfo = $(this).find('span').html();
$(this).parents('.sub-block').find('h3 span').html(dispatchInfo);
if ($(this).hasClass('icon-cb-radio')) {
$(this).addClass('icon-radio');
} else if ($(this).hasClass('icon-radio')) {
$(this).addClass('icon-cb-radio');
if ($(this).find('i').hasClass('icon-cb-radio')) {
$(this).find('i').addClass('icon-radio');
} else if ($(this).find('i').hasClass('icon-radio')) {
$(this).find('i').addClass('icon-cb-radio');
}
});
$('.bill a').on('touchstart', function() {
orderInfo('paymentTypeId', $('.delivery-id .icon-cb-radio').data('id'));
orderInfo('paymentType', $('.delivery-time .icon-cb-radio').data('id'));
orderInfo('paymentType', $('.payment-type .icon-cb-radio').data('id'));
payType = $('.payment-type .icon-cb-radio').data('id');
submitOrder();
});
... ... @@ -11157,6 +11182,7 @@ function phoneHidden(phone) {
$('.info-phone').html(phoneHidden($('.info-phone').html()));
});
define("js/cart/order-info", ["jquery","hammer"], function(require, exports, module){
/**
... ... @@ -11483,7 +11509,7 @@ function phoneHidden(phone) {
}
$('.tel').each(function(index) {
$('.tel').eq(index).html(phoneHidden($('.tel').html()));
$('.tel').eq(index).html(phoneHidden($('.tel').eq(index).html()));
});
});
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -60,7 +60,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
goodInfo.hasPromotion = promotion;
goodInfo.buy_number = $good.find('.count').eq(0).text().trim().replace('×', '');
goodsList.push(new GoodInfo(goodInfo));
console.log(goodInfo);
$.ajax({
type: 'post',
url: 'select',
... ... @@ -97,17 +96,21 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
* @return false or undefined
*
*/
function showEditPannelWithSku(html, id, isSelected, isEditNum) {
if (html.length < 2) {
function showEditPannelWithSku(html, id, isSelected, isEditNum, skn) {
var $html = $(html);
if (!$html.hasClass('chose-panel')) {
tip.show('出错啦!');
return false;
}
// 记录成功加载的选择框
previousEditSkn = skn;
//删掉页面上原有的pannel
chosePanel.remove();
$(html).appendTo('#mainCart');
$html.appendTo('#mainCart');
chosePanel.init();
chosePanel.setEditModeWithSknId(id, isSelected);
... ... @@ -142,9 +145,6 @@ $('.icon-edit').on('touchstart', function(e) {
return;
}
previousEditSkn = skn;
$checkBox = $this.closest('.info').siblings('.checkbox');
$tag = $this.closest('.deps').siblings('.few-tag');
... ... @@ -158,7 +158,6 @@ $('.icon-edit').on('touchstart', function(e) {
loading.showLoadingMask();
$.ajax({
url: '/cart/index/goodinfo',
data: {
... ... @@ -166,7 +165,7 @@ $('.icon-edit').on('touchstart', function(e) {
buy_num: count
},
success: function(res) {
showEditPannelWithSku(res, id, $checkBox.hasClass('icon-cb-checked'), canEditNum);
showEditPannelWithSku(res, id, $checkBox.hasClass('icon-cb-checked'), canEditNum, skn);
},
error: function() {
tip.show('网络异常');
... ...
... ... @@ -10,7 +10,9 @@
background-color: transparent;
z-index: 99;
}
.none{
display: none;
}
.checkbox {
position: absolute;
top: 50%;
... ...
... ... @@ -57,7 +57,7 @@
</span>
{{/if}}
<span class="iconfont icon-edit" data-count="{{count}}">&#xe61e;</span>
<span class="iconfont icon-edit {{#if isAdvanceBuy}}none{{/if}} {{#if isGift}}none{{/if}}" data-count="{{count}}">&#xe61e;</span>
<span class="iconfont icon-del" data-count="{{count}}">&#xe621;</span>
</p>
... ...