Authored by 刘传洋

m

... ... @@ -62,7 +62,7 @@
</div>
</div>
</div>
<a class="btn-account btn-account-black" href="{{ensureUrl}}">去结算</a>
<a class="btn-account" href="{{ensureUrl}}">去结算</a>
{{/ordinaryCart}}
<p class="pre-sell-tip">温馨提示:您需要分开结算【预售商品】和【普通商品】</p>
</div>
... ...
... ... @@ -4,12 +4,11 @@
var $ = require('yoho-jquery');
var dialog = require('../common/dialog');
var Dialog = dialog.Dialog;
var Alert = dialog.Alert;
var Confirm = dialog.Confirm;
var rDialog = require('./rdialog');
var RConfirm = rDialog.RConfirm;
var RAlert = rDialog.RAlert;
var Cart;
var $cartnewTips = $('.cartnew-tips'),
$payWapper = $('.pay-wapper'),
... ... @@ -22,7 +21,7 @@ $cartnewTips.find('.btn_close').click(function() {
});
// 滚动到第一个选中的商品
function scrollToFirst() {
/*function scrollToFirst() {
var $selected = $payWapper.find('li[data-role="pitem"] .cart-item-check.cart-item-checked:eq(0)');
var top = 0;
... ... @@ -32,7 +31,7 @@ function scrollToFirst() {
}
return false;
}
}*/
function toastNoStore(parent) {
... ... @@ -45,10 +44,10 @@ function toastNoStore(parent) {
}, 2000);
}
var Cart = {
addToCart: function(params) {
Cart = {
/* addToCart: function(params) {
},
},*/
toggleSelectOne: function() { // 单选
var $this = $(this);
... ... @@ -143,6 +142,7 @@ var Cart = {
var $chk = $(this);
var $item = $chk.closest('[data-role=pitem]');
if ($chk.hasClass('cart-item-checked')) {
if ($item.data('id')) {
... ... @@ -240,6 +240,7 @@ var Cart = {
var $item = $(this);
var $chk = $item.find('.cart-item-check');
if ($chk.hasClass('cart-item-checked')) {
if ($item.data('id')) {
... ... @@ -299,11 +300,23 @@ var Cart = {
},
submit: function() {
if ($('[data-role="gift-sel-btn"]').length) {
alert('还有赠品未领取!');
var content = '<div><i class="iconfont">&#xe6c2;</i>您还未选择赠品</div><p>是否去选择赠品?</p>';
if ($(this).hasClass('btn-account-disable')) {
return false;
}
if ($('[data-role="gift-sel-btn"]').length) {
new RConfirm(content, function() {
var firstGift = $('[data-role="gift-sel-btn"]')[0];
$('html,body').animate({scrollTop: $(firstGift).offset().top + 'px'}, 500);
}, function(){
capi.showMDialog('#Y_CartSelectDialog');
}, '去选择', '不要赠品');
}
// $('.cart-preSell-dialog').show();
// $('.cart-togetherGoods').show();
... ...
... ... @@ -6,7 +6,6 @@
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
dialog = require('../common/dialog'),
$sellBox = $('.cart-table .pre-sell-box');
require('../plugins/slider');
... ... @@ -25,6 +24,7 @@ lazyLoad($('#details-html img'));
function isCheckAll() {
var isAllCheck = true;
$('[data-role=pitem] [data-role=cart-item-check]').each(function() {
// 有一个没选中,跳出循环
... ... @@ -79,6 +79,8 @@ function isCheckFav() {
$(function() {
var $itemChecked = $('[data-role=pitem] .cart-item-checked');
$('.bottom-tab .change').click(function() {
$('.img-brand-switch .next').trigger('click');
});
... ... @@ -93,6 +95,10 @@ $(function() {
isCheckAll();
isCheckFav();
if ($itemChecked.length === 0) {
$('#Y_SubmitBtn').addClass('btn-account-disable');
}
});
require('./cart-action');
... ...
... ... @@ -23,13 +23,13 @@ RDialog.prototype = new Dialog({
});
RDialog.prototype.constructor = RDialog;
function RConfirm(content, ok, cancel) {
function RConfirm(content, ok, cancel, okName, cancelName) {
var rd = new RDialog({
content: content,
btns: [{
id: 'confirm-btn-ok',
btnClass: ['alert-sure'],
name: '确定',
name: okName || '确定',
cb: function() {
rd.close();
(typeof ok === 'function') && ok();
... ... @@ -37,9 +37,10 @@ function RConfirm(content, ok, cancel) {
}, {
id: 'confirm-btn-cencel',
btnClass: ['btn-cancel'],
name: '取消',
name: cancelName || '取消',
cb: function() {
rd.close();
(typeof cancel === 'function') && cancel();
}
}]
});
... ...
... ... @@ -632,6 +632,10 @@
box-sizing: border-box;
background-color: #fff;
cursor: pointer;
&:hover {
background-color: #000;
color: #fff;
}
}
.btn-account-black {
background-color: #000;
... ...
... ... @@ -1125,6 +1125,9 @@
cursor: pointer;
float: right;
}
.btn-account-disable {
background-color: #b0b0b0;
}
}
.shop-cart-empty {
... ...