Authored by 刘传洋

Merge branch 'feature/shoppingCart' of http://git.yoho.cn/fe/yohobuy-node into feature/shoppingCart

... ... @@ -6,6 +6,7 @@
<p class="price">
<span class="sale-price">8888{{salePrice}}</span>
</p>
<button>加入购物车</button>
</div>
<div class="good">
<a href="{{href}}" target="_blank">
... ... @@ -15,6 +16,7 @@
<p class="price">
<span class="sale-price">8888{{salePrice}}</span>
</p>
<button>加入购物车</button>
</div>
<div class="good">
<a href="{{href}}" target="_blank">
... ... @@ -25,6 +27,7 @@
<span class="sale-price sale-price-new">8888{{salePrice}}</span>
<span class="market-price">7777{{marketPrice}}</span>
</p>
<button>加入购物车</button>
</div>
<div class="good">
<a href="{{href}}" target="_blank">
... ... @@ -34,6 +37,7 @@
<p class="price">
<span class="sale-price">8888{{salePrice}}</span>
</p>
<button>加入购物车</button>
</div>
<div class="good">
<a href="{{href}}" target="_blank">
... ... @@ -43,6 +47,7 @@
<p class="price">
<span class="sale-price">8888{{salePrice}}</span>
</p>
<button>加入购物车</button>
</div>
<div class="good">
<a href="{{href}}" target="_blank">
... ... @@ -52,4 +57,5 @@
<p class="price">
<span class="sale-price">8888{{salePrice}}</span>
</p>
<button>加入购物车</button>
</div>
... ...
<!-- 凑单 -->
<div class="detail-body" id="goodsTogetherDetail">
<div class="slide-img">
<p>选赠品:<em><span>1元加价购</span><code>|</code><span>59元加价购</span><code>|</code><span>99元加价购</span></em></p>
<div class="side-img-dd">
<ul class="">
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
</ul>
</div>
</div>
<div class="detail-bigpic">
<div class="bigpic">
<img src="">
... ...
... ... @@ -269,6 +269,13 @@ function renderAndShowSelWin($edit, pinfo) {
var Cart = {
addToCart: function(params) {
<<<<<<< HEAD
$payWapper.find('.cart-item-check').each(function() {
var $item = $(this);
var $chk = $item.find('.cart-item-check');
if ($chk.hasClass('cart-item-checked')) {
=======
},
toggleSelectOne: function() { // 单选
... ... @@ -281,6 +288,7 @@ var Cart = {
goods_type: $pitem.data('goodstype'),
promotion_id: $pitem.data('promotionid') ? $pitem.data('promotionid') : 0
};
>>>>>>> 3a2b8fa435f608cc40704e327ea3ee303f3c3da4
return choiceOut(item);
},
... ...
... ... @@ -6,11 +6,17 @@
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
dialog = require('../common/dialog');
dialog = require('../common/dialog'),
rDialog = require('../cart/rdialog');
require('../plugins/slider');
require('../common/center-slider');
var Dialog = dialog.Dialog,
Confirm = dialog.Confirm,
Alert = dialog.Alert;
// Confirm = dialog.Confirm,
Alert = dialog.Alert,
RConfirm = rDialog.RConfirm,
RAlert = rDialog.RAlert;
var $cartGoodsDetail = $('#goodsTogetherDetail'),
$payWapper = $('.pay-wapper'),
... ... @@ -113,6 +119,26 @@ function cartDel(data, delUrl, cookieList) {
});
}
//购物车表单 删除商品
$payWapper.on('click', '.cart-del-btn', function() {
// new Confirm({
// className: 'shopCart-del-dialog',
// content: '<h4><i class="iconfont">&#xe684;</i>删除商品</h4>' +
// '<small>确定要从购物车中删除该商品吗?</small>'
// }).show();
RConfirm(
'<h3><i class="iconfont">&#xe684;</i>删除商品</h3>'+'<p>确定要从购物车中删除该商品吗?</p>',
function() {
$.ajax({
url: url,
type: 'POST',
dataType: 'json'
}).fail();
}
);
});
// 凑单图片懒加载
var togetherDialog = {};
var dialogTpl = require('hbs/cart/cart-togetherGoods.hbs');
... ... @@ -149,7 +175,6 @@ function showTogetherGoods(id) {
// 凑单弹框 详情切换
$('body').on('click', '.piclist li', function() {
console.log(99999);
pacList = $(this).index();
$('.detail-bigpic:not(.none) .piclist li').removeClass('active');
$(this).addClass('active');
... ... @@ -236,30 +261,38 @@ $('body').on('click', '.cut, .add', function() {
// 凑单弹框 商品信息弹出框,加入收藏夹
$cartGoodsDetail.on('click', '.btn-favCount', function() {
$.ajax({
type: 'POST',
dataType: 'json',
url: '',
data: {
productId: productId,
type: 'add'
}
}).then(function(d) {
if (d.code === 200) {
new Alert(d.message).show();
} else if (d.code === 403) {
if (d.data.url) {
window.location = d.data.url;
}
} else {
new Alert(d.message).show();
}
});
// $.ajax({
// type: 'POST',
// dataType: 'json',
// url: '',
// data: {
// productId: productId,
// type: 'add'
// }
// }).then(function(d) {
// if (d.code === 200) {
// new Alert(d.message).show();
// } else if (d.code === 403) {
// if (d.data.url) {
// window.location = d.data.url;
// }
// } else {
// new Alert(d.message).show();
// }
// });
});
// 购物车列表 赠品
//购物车列表 显示
$('.shop-cart').on('click', '.gift-sell .btn-clear', function() {
var tid = $(this).attr('data-together-id');
showPromotion(tid);
});
// 购物车列表 显示
function showPromotion(id) {
if (!id) {
... ... @@ -383,8 +416,9 @@ $goodsChoose.on('click', '.choose-color .dt', function() {
$('.bigImg').addClass('none').eq($(this).index()).removeClass('none');
});
//结算
$paySum.on('click','.btn-account', function() {
// 结算
$paySum.on('click', '.btn-account', function() {
understock = '';
// if ($('.pay-wapper .cart-item-checked').parents('.tr').find('.tipNoStore').length > 0) {
... ... @@ -435,4 +469,4 @@ $('.shop-cart').on('click', giftBtn, function() {
});
require('./cart-action');
// require('./cart-action');
... ...
/**
* 弹框 dialog 改版
* @author: gxh<xuhui.ge@yoho.cn>
* @date: 2016/01/06
*/
var $ = require('yoho-jquery'),
Dialog = require('../plugins/dialog').Dialog;
function RDialog(opts) {
var option = $.extend(true, {}, {
className: 'r-dialog',
closeIcon: true
}, opts);
option.content = '<div class="dialog-content">' + option.content + '</div>';
option.btns.name = '';
Dialog.call(this, option);
}
RDialog.prototype = new Dialog({
inherit: true
});
RDialog.prototype.constructor = RDialog;
function RConfirm(content, ok, cancel) {
var that = this;
var rd = new RDialog({
content: content,
btns: [{
btnClass: ['alert-sure'],
name: '确定',
cb: function() {
rd.close();
(typeof ok === 'function') && ok();
}
}, {
btnClass: ['btn-cancel'],
name: '取消',
cb: function() {
that.close();
}
}]
});
rd.show();
}
RConfirm.prototype = new Dialog({
inherit: true
});
RConfirm.prototype.constructor = RConfirm;
exports.RConfirm = RConfirm;
function RAlert(content, title) {
var that = this;
var rd = new RDialog({
content: content,
title: title || '提示',
btns: [{
btnClass: ['alert-sure'],
name: '确定',
cb: function() {
that.close();
}
}]
});
rd.show();
}
RAlert.prototype = new Dialog({
inherit: true
});
RAlert.prototype.constructor = RAlert;
exports.RAlert = RAlert;
... ...
... ... @@ -14,11 +14,18 @@
}
}
.detail-body {
width: 610px;
padding: 15px;
margin: 0 auto;
*zoom: 1;
&:after{
content:'';
display: block;
height: 0;
clear: both;
overflow: hidden;
}
.none {
display: none;
}
... ... @@ -362,7 +369,62 @@
text-align: left;
}
}
}
.slide-img {
margin-bottom: 25px;
p {
font-size: 14px;
color: #444;
text-align: left;
height: 20px;
line-height: 20px;
vertical-align: middle;
margin-bottom: 15px;
}
em {
float: right;
display: inline-block;
span {
color: #444;
font-size: 14px;
height: 20px;
line-height: 20px;
vertical-align: middle;
}
code {
font-size: 18px;
font-weight:300;
color: #333;
height: 20px;
line-height: 20px;
vertical-align: middle;
margin-left: 10px;
margin-right: 10px;
}
}
ul {
height: 100%;
li {
float: left;
width: 232px;
height: 410px;
overflow: hidden;
}
.good {
float: left;
width: 225px;
margin-right: 10px;
a {
cursor: pointer;
}
img {
display: block;
width: 222px;
height: 300px;
}
}
}
}
... ...
@red: #d0021b;
.order-ensure-page{
.order-title {
... ... @@ -860,8 +859,8 @@
position: absolute;
top: 50%;
left: 50%;
margin-top: -96px;
margin-left: -70px;
margin-top: -90px;
margin-left: -80px;
padding: 30px 15px;
border: 1px solid #000;
background-color: #fff;
... ... @@ -869,9 +868,8 @@
display:none;
&:after{
position: absolute;
top: 50%;
top: 100px;
left: -16px;
margin-top: -7px;
content: '';
display: inline-block;
width: 0;
... ... @@ -882,9 +880,8 @@
}
&:before{
position: absolute;
top: 50%;
top: 101px;
left: -14px;
margin-top: -6px;
z-index: 20;
content: '';
display: inline-block;
... ... @@ -927,12 +924,14 @@
}
.choose-size {
margin-bottom: 13px;
min-height: 56px;
.dd{
height:18px;
line-height:18px;
}
.dt {
width: 25px;
padding-left: 6px;
padding-right: 6px;
height: 16px;
font-size: 12px;
color: #000;
... ... @@ -981,14 +980,14 @@
margin-left:37px;
button{
width: 50px;
height: 20px;
height: 22px;
border-radius: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
font-size: 12px;
padding: 0;
border: none;
line-height: 20px;
line-height: 22px;
cursor: pointer;
outline: none;
}
... ... @@ -1379,7 +1378,7 @@
.individual-slide {
width: 990px;
height: 343px;
height: 386px;
overflow: hidden;
.individual-item {
width:100%;
... ... @@ -1388,7 +1387,7 @@
.goods {
width: 990px;
height: 310px;
height: 346px;
margin: 20px 0;
overflow: hidden;
}
... ... @@ -1439,6 +1438,64 @@
.market-price {
text-decoration: line-through;
}
button {
display: block;
margin: 0 auto;
color: #3a3a3a;
font-size: 14px;
width: 110px;
height: 28px;
line-height: 28px;
border:1px solid #b0b0b0;
border-radius: 0;
-webkit-border-radius: 0;
-moz-border-radius: 0;
background-color: #fff;
}
}
}
.r-dialog{
min-width: 420px;
padding: 40px 20px;
.close {
top: 20px;
right: 20px;
}
.dialog-content{
font-size: 24px;
color: #444;
font-weight: 300;
i {
display: inline-block;
color: #d0021b;
font-size: 24px;
margin-right: 20px;
vertical-align: middle;
}
h3 {
margin-top: 35px;
height: 35px;
line-height: 35px;
}
p{
margin-top: 40px;
margin-bottom: 30px;
font-size: 14px;
color: #444;
}
}
.btn {
width: 130px;
height: 33px;
line-height: 33px;
margin-left: 10px;
&:nth-child(2) {
margin-left: 20px;
}
}
}
... ...