Too many changes to show.

To preserve performance only 28 of 28+ files are displayed.

... ... @@ -101,21 +101,13 @@ const cart = (req, res, next) => {
});
}
service.getCartData(uid, shoppingKey, cartDelList)
service.getCartData(uid, shoppingKey)
.then(ret => {
if (req.query.json === '1') {
return res.send(ret);
}
if (req.query.page === '1') {
return res.render('cart_bak', {
cart: {
}
});
}
return res.render('cart', {
title: '购物车 | ' + (res.locals.title || ''),
module: 'cart',
... ... @@ -142,8 +134,11 @@ const cartAdd = (req, res) => {
let goodsType = req.body.goodsType || 0;
let promotionId = req.body.promotionId || 0;
let isEdit = req.body.isEdit || 0;
let cartDelList = req.cookies['cart-del-list'];
let result = yield service.addToCart(productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey);
let result = yield service.addToCart(productSku, buyNumber,
goodsType, isEdit, promotionId,
uid, shoppingKey, cartDelList);
// 设置加入购物车凭证到客户端浏览器
if (!shoppingKey && result && result.data && result.data.shopping_key) {
... ... @@ -187,8 +182,9 @@ const selectProduct = (req, res) => {
let productId = req.body.skuList;
let hasPromotion = req.body.hasPromotion || false;
let shoppingKey = helper.getShoppingKeyByCookie(req);
let cartDelList = req.cookies['cart-del-list'];
service.selectGoods(uid, productId, shoppingKey, hasPromotion)
service.selectGoods(uid, productId, shoppingKey, hasPromotion, cartDelList)
.then(ret => {
res.send(ret);
}).catch(() => {
... ... @@ -208,8 +204,9 @@ const modifyProductNum = (req, res, next) => {
let sku = req.body.sku;
let increaseNum = req.body.increaseNum || null;
let decreaseNum = req.body.decreaseNum || null;
let cartDelList = req.cookies['cart-del-list'];
return service.modifyProductNum(uid, sku, increaseNum, decreaseNum, shoppingKey)
return service.modifyProductNum(uid, sku, increaseNum, decreaseNum, shoppingKey, cartDelList)
.then(ret => {
if (ret && ret.code === 200) {
return setShoppingCookie(req, res).then(() => {
... ... @@ -235,11 +232,20 @@ const removeProduct = (req, res) => {
let shoppingKey = helper.getShoppingKeyByCookie(req);
let skuList = req.body.skuList;
let hasPromotion = true;
let cartDelList = req.body.cartDelList;
let ret = yield service.removeFromCart(uid, shoppingKey, skuList, hasPromotion);
// let cartDelList = req.cookies['cart-del-list'];
let ret = yield service.removeFromCart(uid, shoppingKey, skuList, hasPromotion, cartDelList);
if (ret && ret.code === 200) {
yield setShoppingCookie(req, res);
res.cookie('cart-del-list', cartDelList, {
domain: '.yohobuy.com',
path: '/'
});
}
return res.send(ret);
... ... @@ -258,8 +264,9 @@ const moveToFav = (req, res) => {
// let shoppingKey = helper.getShoppingKeyByCookie(req);
let skuList = req.body.skuList;
let hasPromotion = req.body.hasPromotion || false;
let cartDelList = req.cookies['cart-del-list'];
let ret = yield service.addToFav(uid, skuList, hasPromotion);
let ret = yield service.addToFav(uid, skuList, hasPromotion, cartDelList);
if (ret && ret.code === 200) {
yield setShoppingCookie(req, res);
... ... @@ -356,11 +363,12 @@ const getIncreasePurchase = (req, res) => {
const modifyProduct = (req, res, next) => {
const uid = req.user && req.user.uid;
const shoppingKey = helper.getShoppingKeyByCookie(req);
let cartDelList = req.cookies['cart-del-list'];
// swapData => [{"buy_number":"1","selected":"Y","new_product_sku":"735172","old_product_sku":"735171"}]
const swapData = req.body.swapData;
service.modifyProduct({swapData, shoppingKey, uid}).then((result) => {
service.modifyProduct({swapData, shoppingKey, uid}, uid, shoppingKey, cartDelList).then((result) => {
/* if (result.code === 200) {
} else {
... ... @@ -378,8 +386,9 @@ const swapGift = (req, res, next) => {
let promotionId = req.body.promotionId;
let newSkn = req.body.newSkn;
let newSku = req.body.newSku;
let cartDelList = req.cookies['cart-del-list'];
service.swapGift(uid, shoppingKey, promotionId, newSkn, newSku)
service.swapGift(uid, shoppingKey, promotionId, newSkn, newSku, cartDelList)
.then(ret => {
res.send(ret);
}).catch(next);
... ...
... ... @@ -23,7 +23,7 @@ app.use(global.yoho.hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial')],
partialsDir: [path.join(__dirname, 'views/partial'), path.join(__dirname, '../../mix')],
views: path.join(__dirname, 'views/action'),
helpers: Object.assign(require('./utils/helper'), global.yoho.helpers)
}));
... ...
... ... @@ -76,10 +76,11 @@ const addToCart = (productSku, buyNumber,
* @param bool $hasPromotion 是否有促销ID
* @return array 购物车接口返回的数据
*/
const selectGoods = (uid, sku, shoppingKey, hasPromotion) => {
const selectGoods = (uid, sku, shoppingKey /* , hasPromotion*/) => {
let param = {
method: hasPromotion ? 'app.Shopping.selectedAndCart' : 'app.Shopping.selected',
// method: hasPromotion ? 'app.Shopping.selectedAndCart' : 'app.Shopping.selected',
method: 'app.Shopping.selectedAndQryCart',
product_sku_list: sku
};
... ... @@ -104,10 +105,11 @@ const selectGoods = (uid, sku, shoppingKey, hasPromotion) => {
* @param bool $hasPromotion 是否有促销ID
* @return array 接口返回的数据
*/
const removeFromCart = (uid, shoppingKey, skuList, hasPromotion) =>{
const removeFromCart = (uid, shoppingKey, skuList /* , hasPromotion*/) =>{
let param = {
method: hasPromotion ? 'app.Shopping.removeAndCart' : 'app.Shopping.remove',
// method: hasPromotion ? 'app.Shopping.removeAndCart' : 'app.Shopping.remove',
method: 'app.Shopping.removeAndQryCart',
product_sku_list: skuList
};
... ... @@ -129,10 +131,11 @@ const removeFromCart = (uid, shoppingKey, skuList, hasPromotion) =>{
* @param bool $hasPromotion 是否有促销ID
* @return array 接口返回的数据
*/
const addToFav = (uid, skuList, hasPromotion) =>{
const addToFav = (uid, skuList /* , hasPromotion*/) =>{
let param = {
method: hasPromotion ? 'app.Shopping.addfavoriteAndCart' : 'app.Shopping.addfavorite',
// method: hasPromotion ? 'app.Shopping.addfavoriteAndCart' : 'app.Shopping.addfavorite',
method: 'app.Shopping.addfavoriteAndQryCart',
product_sku_list: skuList,
uid: uid
};
... ...
... ... @@ -6,6 +6,7 @@
const _ = require('lodash');
const helpers = global.yoho.helpers;
const md5 = require('md5');
const logger = global.yoho.logger;
const PROMOTION_TYPE_TAG_MAP = {
Cashreduce: '满减', // 满减
... ... @@ -429,6 +430,148 @@ const formatPromotionPools = (pools, selectedGiftsList, isAdvance) => {
});
};
const formatCart = (cartDataRet, uid, shoppingKey, cartDelList) => {
let analysisData = {
ids: [],
criteo: []
}; // 存放分析用的数据
let result = {
isEmpty: false,
isLogin: !!uid,
searchUrl: helpers.urlFormat('', null, 'search'), // 搜索链接(再逛逛)
listUrl: helpers.urlFormat('', null, 'list'),
viewOrderUrl: helpers.urlFormat('/home/orders', {
t: new Date().getTime()
})
};
// 未登录
if (!uid) {
result.loginUrl = helpers.urlFormat('/signin.html', {
refer: helpers.urlFormat('/shopping/cart')
});
}
// 调用接口,获取购物车数据
// let cartDataRet = yield cartApi.cartData(uid, shoppingKey);
let cartData = cartDataRet && cartDataRet.data;
let advCartData = _.get(cartData, 'advance_cart_data');
let ordCartData = _.get(cartData, 'ordinary_cart_data');
// 接口异常时,购物车置为空
if (!cartData) {
result.isEmpty = true;
// UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'shoppingKey:' . $shoppingKey);
return result;
}
result.advanceCart = {
// 未参加活动的商品
// goodsList: chelper.formatCartGoods(_.get(advCartData, 'goods_list'), true, false, false, analysisData),
pools: formatPromotionPools(_.get(advCartData, 'goods_pool_list'), null, true),
offShelves: formatOffShelves(_.get(advCartData, 'off_shelves_goods_list'), true, analysisData),
soldOuts: formatSoldOuts(_.get(advCartData, 'sold_out_goods_list'), true, analysisData),
promotionInfos: formatPromotionInfos(_.get(advCartData, 'promotion_info')),
stat: formatShoppingCartData(_.get(advCartData, 'shopping_cart_data')),
ensureUrl: helpers.urlFormat('/cart/ensure', {
type: 2
})
};
let giftsList = formatPriceGifts(_.get(ordCartData, 'gift_list'));
let priceGifts = formatPriceGifts(_.get(ordCartData, 'price_gift'));
let goodsList = formatCartGoods(_.get(ordCartData, 'goods_list'), false, false, false, analysisData);
result.ordinaryCart = {
// 全场可选的赠品
gifts: giftsList, // chelper.formatGifts(_.get(ordCartData, 'gift_list')),
// 全场可选的加价购商品列表
priceGifts: priceGifts, // chelper.formatPriceGifts(_.get(ordCartData, 'price_gift')),
// 已选择的全场加价购和赠品
goodsList: goodsList,
pools: formatPromotionPools(_.get(ordCartData, 'goods_pool_list'), goodsList),
offShelves: formatOffShelves(_.get(ordCartData, 'off_shelves_goods_list'), false, analysisData),
soldOuts: formatSoldOuts(_.get(ordCartData, 'sold_out_goods_list'), false, analysisData),
promotionInfos: formatPromotionInfos(_.get(ordCartData, 'promotion_info'), goodsList),
stat: formatShoppingCartData(_.get(ordCartData, 'shopping_cart_data')),
ensureUrl: helpers.urlFormat('/cart/ensure')
};
let advStat = result.advanceCart.stat;
let ordStat = result.ordinaryCart.stat;
// 为空
if (!_.get(advStat, 'goodsCount', 0)) {
result.advanceCart = false;
}
if (!_.get(ordStat, 'goodsCount', 0)) {
result.ordinaryCart = false;
}
if (!result.advanceCart && !result.ordinaryCart) {
result.isEmpty = true;
}
// promotionInfos, gifts, priceGifts 放一起展示
let hasGifts = result.ordinaryCart.gifts && result.ordinaryCart.gifts.length;
let hasPrices = result.ordinaryCart.priceGifts && result.ordinaryCart.priceGifts.length;
let hasPromo = result.ordinaryCart.promotionInfos && result.ordinaryCart.promotionInfos.length;
if (result.ordinaryCart) {
result.ordinaryCart.hasGlobalBlock = hasGifts || hasPrices || hasPromo;
}
result.stat = {
orderAmount: (parseFloat(_.get(advStat, 'orderAmount', 0)) +
parseFloat(_.get(ordStat, 'orderAmount', 0))).toFixed(2),
discountAmount: (parseFloat(_.get(advStat, 'discountAmount', 0)) +
parseFloat(_.get(ordStat, 'discountAmount', 0))).toFixed(2),
lastOrderAmount: (parseFloat(_.get(advStat, 'lastOrderAmount', 0)) +
parseFloat(_.get(ordStat, 'lastOrderAmount', 0))).toFixed(2),
gainYohoCoin: parseFloat(_.get(advStat, 'gainYohoCoin', 0)) + parseFloat(_.get(ordStat, 'gainYohoCoin', 0)),
goodsCount: _.get(advStat, 'goodsCount', 0) + _.get(ordStat, 'goodsCount', 0),
selectedGoodsCount: _.get(advStat, 'selectedGoodsCount', 0) + _.get(ordStat, 'selectedGoodsCount', 0)
};
/* 移除的商品列表 */
if (cartDelList) {
try {
result.deleteShop = JSON.parse(cartDelList);
} catch (err) {
logger.error(err);
}
}
// 普通购物车和预售购物车都为空
/* if (ordinaryCount === 0 && advanceCount === 0 && ordinarySoldOut && advanceSoldOut) {
result.isEmpty = true;
return result;
}*/
// 预售和普通都有商品
if (result.advanceCart && _.get(result, 'advanceCart.stat.selectedGoodsCount') > 0 &&
result.ordinaryCart && _.get(result, 'ordinaryCart.stat.selectedGoodsCount') > 0) {
result.stat.mix = true;
} else if (result.advanceCart && _.get(result, 'advanceCart.stat.selectedGoodsCount') > 0) {
result.stat.ensureUrl = result.advanceCart.ensureUrl;
} else if (result.ordinaryCart && _.get(result, 'ordinaryCart.stat.selectedGoodsCount') > 0) {
result.stat.ensureUrl = result.ordinaryCart.ensureUrl;
}
Object.assign(result, {
ids: _.isArray(analysisData.ids) ? analysisData.ids.join(',') : '',
criteo: analysisData.criteo || ''
});
return result;
};
module.exports = {
transPrice,
getShoppingKeyByCookie,
... ... @@ -442,5 +585,6 @@ module.exports = {
formatPromotionPools,
formatPromotionInfos,
formatOffShelves,
formatSoldOuts
formatSoldOuts,
formatCart
};
... ...
... ... @@ -11,7 +11,6 @@ const co = Promise.coroutine;
const _ = require('lodash');
const api = global.yoho.API;
const helpers = global.yoho.helpers;
const logger = global.yoho.logger;
const md5 = require('md5');
const ERROR_400_MESSAGE = '系统繁忙,请稍候再试!';
... ... @@ -412,144 +411,8 @@ const getCoupons = (uid) => api.get('', {
});
const getCartData = (uid, shoppingKey, cartDelList) => {
let analysisData = {
ids: [],
criteo: []
}; // 存放分析用的数据
return co(function * () {
let result = {
isEmpty: false,
isLogin: !!uid,
searchUrl: helpers.urlFormat('', null, 'search'), // 搜索链接(再逛逛)
listUrl: helpers.urlFormat('', null, 'list'),
viewOrderUrl: helpers.urlFormat('/home/orders', {
t: new Date().getTime()
})
};
// 未登录
if (!uid) {
result.loginUrl = helpers.urlFormat('/signin.html', {
refer: helpers.urlFormat('/shopping/cart')
});
}
// 调用接口,获取购物车数据
let cartDataRet = yield cartApi.cartData(uid, shoppingKey);
let cartData = cartDataRet && cartDataRet.data;
let advCartData = _.get(cartData, 'advance_cart_data');
let ordCartData = _.get(cartData, 'ordinary_cart_data');
// 接口异常时,购物车置为空
if (!cartData) {
result.isEmpty = true;
// UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'shoppingKey:' . $shoppingKey);
return result;
}
result.advanceCart = {
// 未参加活动的商品
// goodsList: chelper.formatCartGoods(_.get(advCartData, 'goods_list'), true, false, false, analysisData),
pools: chelper.formatPromotionPools(_.get(advCartData, 'goods_pool_list'), null, true),
offShelves: chelper.formatOffShelves(_.get(advCartData, 'off_shelves_goods_list'), true, analysisData),
soldOuts: chelper.formatSoldOuts(_.get(advCartData, 'sold_out_goods_list'), true, analysisData),
promotionInfos: chelper.formatPromotionInfos(_.get(advCartData, 'promotion_info')),
stat: chelper.formatShoppingCartData(_.get(advCartData, 'shopping_cart_data')),
ensureUrl: helpers.urlFormat('/cart/ensure', {
type: 2
})
};
let giftsList = chelper.formatPriceGifts(_.get(ordCartData, 'gift_list'));
let priceGifts = chelper.formatPriceGifts(_.get(ordCartData, 'price_gift'));
let goodsList = chelper.formatCartGoods(_.get(ordCartData, 'goods_list'), false, false, false, analysisData);
result.ordinaryCart = {
// 全场可选的赠品
gifts: giftsList, // chelper.formatGifts(_.get(ordCartData, 'gift_list')),
// 全场可选的加价购商品列表
priceGifts: priceGifts, // chelper.formatPriceGifts(_.get(ordCartData, 'price_gift')),
// 已选择的全场加价购和赠品
goodsList: goodsList,
pools: chelper.formatPromotionPools(_.get(ordCartData, 'goods_pool_list'), goodsList),
offShelves: chelper.formatOffShelves(_.get(ordCartData, 'off_shelves_goods_list'), false, analysisData),
soldOuts: chelper.formatSoldOuts(_.get(ordCartData, 'sold_out_goods_list'), false, analysisData),
promotionInfos: chelper.formatPromotionInfos(_.get(ordCartData, 'promotion_info'), goodsList),
stat: chelper.formatShoppingCartData(_.get(ordCartData, 'shopping_cart_data')),
ensureUrl: helpers.urlFormat('/cart/ensure')
};
let advStat = result.advanceCart.stat;
let ordStat = result.ordinaryCart.stat;
// 为空
if (!_.get(advStat, 'goodsCount', 0)) {
result.advanceCart = false;
}
if (!_.get(ordStat, 'goodsCount', 0)) {
result.ordinaryCart = false;
}
// promotionInfos, gifts, priceGifts 放一起展示
let hasGifts = result.ordinaryCart.gifts && result.ordinaryCart.gifts.length;
let hasPrices = result.ordinaryCart.priceGifts && result.ordinaryCart.priceGifts.length;
let hasPromo = result.ordinaryCart.promotionInfos && result.ordinaryCart.promotionInfos.length;
if (result.ordinaryCart) {
result.ordinaryCart.hasGlobalBlock = hasGifts || hasPrices || hasPromo;
}
result.stat = {
orderAmount: (parseFloat(_.get(advStat, 'orderAmount', 0)) + parseFloat(_.get(ordStat, 'orderAmount', 0))).toFixed(2),
discountAmount: (parseFloat(_.get(advStat, 'discountAmount', 0)) + parseFloat(_.get(ordStat, 'discountAmount', 0))).toFixed(2),
lastOrderAmount: (parseFloat(_.get(advStat, 'lastOrderAmount', 0))+parseFloat( _.get(ordStat, 'lastOrderAmount', 0))).toFixed(2),
gainYohoCoin: parseFloat(_.get(advStat, 'gainYohoCoin', 0)) + parseFloat(_.get(ordStat, 'gainYohoCoin', 0)),
goodsCount: _.get(advStat, 'goodsCount', 0) + _.get(ordStat, 'goodsCount', 0),
selectedGoodsCount: _.get(advStat, 'selectedGoodsCount', 0) + _.get(ordStat, 'selectedGoodsCount', 0)
};
/* 移除的商品列表 */
if (cartDelList) {
try {
result.deleteShop = JSON.parse(cartDelList);
} catch (err) {
logger.error(err);
}
}
// 普通购物车和预售购物车都为空
/* if (ordinaryCount === 0 && advanceCount === 0 && ordinarySoldOut && advanceSoldOut) {
result.isEmpty = true;
return result;
}*/
// 预售和普通都有商品
if (result.advanceCart && _.get(result, 'advanceCart.stat.selectedGoodsCount') > 0 &&
result.ordinaryCart && _.get(result, 'ordinaryCart.stat.selectedGoodsCount') > 0) {
result.stat.mix = true;
} else if(result.advanceCart && _.get(result, 'advanceCart.stat.selectedGoodsCount') > 0) {
result.stat.ensureUrl = result.advanceCart.ensureUrl;
} else if(result.ordinaryCart && _.get(result, 'ordinaryCart.stat.selectedGoodsCount') > 0) {
result.stat.ensureUrl = result.ordinaryCart.ensureUrl;
}
return result;
})().then(ret => {
// 增加第三方分析用的数据
// ret['ids'] = empty($analysisData['ids']) ? '' : implode(',', $analysisData['ids']);
// $result['criteo'] = empty($analysisData['criteo']) ? "''" : json_encode($analysisData['criteo']);
return Object.assign(ret, {
ids: _.isArray(analysisData.ids) ? analysisData.ids.join(',') : '',
criteo: analysisData.criteo || ''
// empty($analysisData['criteo']) ? "''" : json_encode($analysisData['criteo']);
});
return cartApi.cartData(uid, shoppingKey).then(cartDataRet => {
return chelper.formatCart(cartDataRet, uid, shoppingKey, cartDelList);
});
};
... ... @@ -576,7 +439,7 @@ const getCartCount = (uid, shoppingKey) => {
* @param string $shoppingKey 购物车在浏览器的唯一识别码,可以不传
* @return array 加入购物车接口返回的数据
*/
const addToCart = (productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey) => {
const addToCart = (productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey, cartDelList) => {
return co(function * () {
let result = {
... ... @@ -591,9 +454,13 @@ const addToCart = (productSku, buyNumber, goodsType, isEdit, promotionId, uid, s
let ret = yield cartApi.addToCart(productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey);
if (ret && ret.code) {
result = ret;
result = {
code: ret.code,
data: yield getCartData(uid, shoppingKey, cartDelList)
};
}
/* if (empty($addCart) || (isset($addCart['code']) && $addCart['code'] !== 200) ) {
UdpLog::info('【购物车】校验参数传递auth','productSku:'.$productSku.'buyNumber:'.$buyNumber.
'goodsType:'.$goodsType,'isEdit:'.$isEdit.'promotionId:'.$promotionId.'uid:'.$uid.'shoppingKey:'.$shoppingKey);
... ... @@ -612,7 +479,7 @@ const addToCart = (productSku, buyNumber, goodsType, isEdit, promotionId, uid, s
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
* @return array 处理之后的数据的数据
*/
const selectGoods = (uid, skuList, shoppingKey, hasPromotion) => {
const selectGoods = (uid, skuList, shoppingKey, hasPromotion, cartDelList) => {
return co(function * () {
let result = {
... ... @@ -628,7 +495,13 @@ const selectGoods = (uid, skuList, shoppingKey, hasPromotion) => {
let select = yield cartApi.selectGoods(uid, skuList, shoppingKey, hasPromotion);
if (select && select.code) {
result = select;
result = {
code: select.code,
data: chelper.formatCart(select, uid, shoppingKey, cartDelList)
};
// result = select;
}/* else {
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:'
. $skuList . 'shoppingKey:' . $shoppingKey . 'hasPromotion:' . $hasPromotion);
... ... @@ -648,7 +521,7 @@ const selectGoods = (uid, skuList, shoppingKey, hasPromotion) => {
* @param string $shoppingKey 未登录用户唯一识别码
* @return array 接口返回的数据
*/
const modifyProductNum = (uid, sku, increaseNum, decreaseNum, shoppingKey) => {
const modifyProductNum = (uid, sku, increaseNum, decreaseNum, shoppingKey, cartDelList) => {
return co(function * () {
let result = {
... ... @@ -661,10 +534,13 @@ const modifyProductNum = (uid, sku, increaseNum, decreaseNum, shoppingKey) => {
return result;
}
let modify = yield cartApi.modifyProductNum(uid, sku, increaseNum, decreaseNum, shoppingKey);
let ret = yield cartApi.modifyProductNum(uid, sku, increaseNum, decreaseNum, shoppingKey);
if (modify && modify.code) {
result = modify;
if (ret && ret.code) {
result = {
code: ret.code,
data: yield getCartData(uid, shoppingKey, cartDelList)
};
}/* else {
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'sku:' . $sku, 'increaseNum:'
. $increaseNum . 'decreaseNum:' . $decreaseNum . 'shoppingKey:' . $shoppingKey);
... ... @@ -685,7 +561,7 @@ const modifyProductNum = (uid, sku, increaseNum, decreaseNum, shoppingKey) => {
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
* @return array 接口返回的数据
*/
const removeFromCart = (uid, shoppingKey, skuList, hasPromotion) => {
const removeFromCart = (uid, shoppingKey, skuList, hasPromotion, cartDelList) => {
return co(function * () {
let result = {
... ... @@ -698,14 +574,13 @@ const removeFromCart = (uid, shoppingKey, skuList, hasPromotion) => {
return result;
}
let remove = yield cartApi.removeFromCart(uid, shoppingKey, skuList, hasPromotion);
let ret = yield cartApi.removeFromCart(uid, shoppingKey, skuList, hasPromotion);
if (remove && remove.code) {
result.code = remove.code;
result.message = remove.message;
if (remove.data && remove.data.goods_count) {
result.totalGoodsNum = remove.data.goods_count;
}
if (ret && ret.code) {
result = {
code: ret.code,
data: chelper.formatCart(ret, uid, shoppingKey, cartDelList)
};
}/* else {
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:' .
$skuList . 'shoppingKey:' . $shoppingKey . 'hasPromotion:' . $hasPromotion);
... ... @@ -723,7 +598,7 @@ const removeFromCart = (uid, shoppingKey, skuList, hasPromotion) => {
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
* @return array 接口返回的数据
*/
const addToFav = (uid, skuList, hasPromotion) => {
const addToFav = (uid, skuList, hasPromotion, cartDelList) => {
return co(function * () {
let result = {
... ... @@ -748,10 +623,13 @@ const addToFav = (uid, skuList, hasPromotion) => {
return result;
}
let add = yield cartApi.addToFav(uid, skuList, hasPromotion);
let ret = yield cartApi.addToFav(uid, skuList, hasPromotion);
if (add && add.code) {
result = add;
if (ret && ret.code) {
result = {
code: ret.code,
data: chelper.formatCart(ret, uid, null, cartDelList)
};
}/* else {
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:' . $skuList . 'hasPromotion:' . $hasPromotion);
}*/
... ... @@ -962,13 +840,47 @@ const getTogetherProduct = (page) => {
})();
};
const modifyProduct = (param) => {
const modifyProduct = (param, uid, shoppingKey, cartDelList) => {
return co(function * () {
let result = {
code: 400,
message: ERROR_400_MESSAGE
};
let ret = yield cartApi.modifyProduct(param);
if (ret && ret.code) {
result = {
code: ret.code,
data: yield getCartData(uid, shoppingKey, cartDelList)
};
}
return cartApi.modifyProduct(param);
return result;
})();
};
const swapGift = (uid, shoppingKey, promotionId, newSkn, newSku) => {
return cartApi.swapGift(uid, shoppingKey, promotionId, newSkn, newSku);
const swapGift = (uid, shoppingKey, promotionId, newSkn, newSku, cartDelList) => {
return co(function * () {
let result = {
code: 400,
message: ERROR_400_MESSAGE
};
let ret = yield cartApi.swapGift(uid, shoppingKey, promotionId, newSkn, newSku);
if (ret && ret.code) {
result = {
code: ret.code,
data: yield getCartData(uid, shoppingKey, cartDelList)
};
}
return result;
})();
};
const queryUserPromotionGift = (promotionId, uid, shoppingKey) => {
... ...
... ... @@ -19,333 +19,10 @@
</div>
</div>
{{/unless}}
<div class="order-pay">
{{#if cart.isEmpty}}
<div class="pay-wapper">
<div class="shop-cart-empty">
<i class="iconfont"></i>
<p>购物车空空的哦,去看看心仪的商品吧~</p>
<a href="{{cart.listUrl}}">去购物</a>
</div>
</div>
<div class="dev-revocation {{#unless cart.deleteShop}}none{{/unless}}">
<table>
{{# cart.deleteShop}}
<tr data-productnum="{{productNum}}" data-productsku="{{productSku}}">
<td style="width:35%; text-align: left;">成功删除<a class="title" href="{{link}}"
target="_blank">{{productTitle}}</a>
</td>
<td style="width:14%;"><span class="productPrice">{{productPrice}}</span></td>
<td style="width:15%;">{{productNum}}</td>
<td style="width:16%;"></td>
<td style="width:11.8%; border-right: none; text-align: right;">
<a href="javascript:void(0);"><span class="goBack">撤销本次删除</span></a>
</td>
</tr>
{{/ cart.deleteShop}}
</table>
</div>
{{^}}
<!-- 购物车商品列表 -->
{{#cart}}
<div class="pay-wapper">
<div class="cart-title">
<p class="left" style="width:6%;">
<i class="cart-item-check iconfont"></i>&nbsp;&nbsp;全选
</p>
<p style="width:35%">商品信息</p>
<p style="width:14%">单价</p>
<p style="width:15%;">数量</p>
<p style="width:16%;">小计</p>
<p class="right" style="width:11.8%;">操作</p>
</div>
{{#advanceCart}}
<div class="mb40">
<!-- 预售商品 -->
<div class="pre-sell">
<code>预售商品</code>预售商品不参加活动,不可使用优惠券,不同上市期的商品我们将为您先到先发。
</div>
{{#pools}}
{{#if goodsList}}
<div class="cart-table">
<ul class="table">
{{#goodsList}}
{{> cart-item}}
{{/goodsList}}
</ul>
</div>
{{/if}}
{{/pools}}
{{#if offShelves}}
<div class="cart-table">
<ul class="table table-group">
{{#each offShelves}}
{{>cart-item}}
{{/each}}
</ul>
</div>
{{/if}}
{{#if soldOuts}}
<div class="cart-table">
<ul class="table table-group">
{{#each soldOuts}}
{{>cart-item}}
{{/each}}
</ul>
</div>
{{/if}}
{{#if promotionInfos}}
<div class="gift-sell">
{{#promotionInfos}}
<p class="gift-sell-info"><code class="order-pay-mark">{{tag}}</code>{{promotionTitle}}
<!--<a class="btn-clear blue" data-together-id="6">去凑单&nbsp;&gt;</a>-->
</p>
{{/promotionInfos}}
</div>
{{/if}}
</div>
{{/advanceCart}}
{{#ordinaryCart}}
{{#pools}}
<div class="promotion-pool" data-role="promotion-pool">
{{#if promotionInfos}}
<div class="gift-sell mt20">
{{#promotionInfos}}
<div class="gift-sell-info"
data-role="promotion-wrap"
data-promotionid="{{promotionId}}">
<code class="order-pay-mark
{{#unless isReach}}order-pay-mark-white{{/unless}}">
{{tag}}
</code>{{promotionTitle}}
{{>cart-promotion-btn}}
{{!--{{#if isPriceGift}}
{{#if isNotReach}}
<a class="btn-clear blue order-pay-link" target="_blank" href="{{promotionPageUrl}}">去凑单&nbsp;></a>
{{/if}}
{{/if}}--}}
{{#if isNotReach}}
<a class="btn-clear blue order-pay-link" target="_blank" href="{{promotionPageUrl}}">去凑单&nbsp;></a>
{{/if}}
{{!--{{> cart-sel-gift-tpl }}--}}
{{!--<textarea data-role="gifts-cansel" class="hide" data-promotionid="{{promotionId}}">{{{giftGoodsListStr}}}</textarea>--}}
</div>
{{/promotionInfos}}
</div>
{{/if}}
{{#if subs}}
<div class="cart-table">
{{#each subs}}
<ul class="table {{#isBrandGroup}}table-group{{/isBrandGroup}}">
{{#each goodsList}}
{{> cart-item}}
{{/each}}
</ul>
{{/each}}
</div>
{{/if}}
{{#if goodsList}}
<div class="cart-table">
<ul class="table {{#isBrandGroup}}table-group{{/isBrandGroup}}">
{{#goodsList}}
{{> cart-item}}
{{/goodsList}}
</ul>
</div>
{{/if}}
</div>
{{/pools}}
{{#if offShelves}}
<div class="mt20">
<div class="cart-table">
<ul class="table">
{{#offShelves}}
{{> cart-item}}
{{/offShelves}}
</ul>
</div>
</div>
{{/if}}
<!-- -->
{{#if soldOuts}}
<div class="mt20">
<div class="cart-table">
<ul class="table">
{{#soldOuts}}
{{> cart-item}}
{{/soldOuts}}
</ul>
</div>
</div>
{{/if}}
<!--可选的加价购商品 -->
<!--priceGifts-->
<!--可选择的赠品-->
<!--gifts-->
{{#if hasGlobalBlock}}
<div class="gift-sell mt20">
{{#gifts}}
<div class="gift-sell-info"
data-role="promotion-wrap"
data-promotionid="{{promotionId}}">
<code class="order-pay-mark order-pay-mark-white">
{{tag}}
</code>{{promotionTitle}}
{{#if isGift}}
<a class="order-pay-link" href="javascript:void(0);"
data-role="gift-sel-btn">领赠品</a>
{{/if}}
{{#if isPriceGift}}
<a href="javascript:void(0);"
class="order-pay-link"
data-role="pg-sel-btn">去换购</a>
<a class="btn-clear blue order-pay-link" target="_blank" href="{{promotionPageUrl}}">去凑单&nbsp;></a>
{{/if}}
{{!--{{> cart-sel-gift-tpl }}--}}
{{!--<textarea data-role="gifts-cansel" class="hide" data-promotionid="{{promotionId}}">{{{giftGoodsListStr}}}</textarea>--}}
</div>
{{/gifts}}
{{#priceGifts}}
<div class="gift-sell-info"
data-role="promotion-wrap"
data-promotionid="{{promotionId}}">
<code class="order-pay-mark">
{{tag}}
</code>{{promotionTitle}}
{{#if isGift}}
<a class="order-pay-link" href="javascript:void(0);"
data-role="gift-sel-btn">领赠品</a>
{{/if}}
{{#if isPriceGift}}
<a href="javascript:void(0);"
class="order-pay-link"
data-role="pg-sel-btn">去换购</a>
<a class="btn-clear blue order-pay-link" target="_blank" href="{{promotionPageUrl}}">去凑单&nbsp;></a>
{{/if}}
{{!--{{> cart-sel-gift-tpl }}--}}
{{!--<textarea data-role="gifts-cansel" class="hide" data-promotionid="{{promotionId}}">{{{giftGoodsListStr}}}</textarea>--}}
</div>
{{/priceGifts}}
{{#promotionInfos}}
<p class="gift-sell-info"><code class="order-pay-mark">{{tag}}</code>{{promotionTitle}}
<!--<a class="btn-clear blue" data-together-id="6">去凑单&nbsp;&gt;</a>-->
</p>
{{/promotionInfos}}
</div>
{{/if}}
<!-- 全场已选择的 加价购+赠品 -->
{{#if goodsList}}
<div class="cart-table">
<ul class="table">
{{#each goodsList}}
{{> cart-item}}
{{/each}}
</ul>
</div>
{{/if}}
{{/ordinaryCart}}
{{#stat}}
<!-- 总价计算 -->
<div class="cartnew-sum">
{{#unless cart.isEmpty}}
<div class="left">
<a href="javascript:void(0);" class="btn_h"
style="display:none;"><span>清空商品</span></a>
<i class="cart-item-check iconfont" id="cbSelAllGoods"></i>
<span>全选</span>
<a class="delAll delete-all-sel" href="javascript:void(0);">删除选中商品</a>
<a class="removeAll remove-all-2fav" href="javascript:void(0);">移入收藏夹</a>
<a class="emptyDisabled clean-all-disable"
href="javascript:void(0);">清空失效商品</a>
</div>
{{/unless}}
<div class="right">
<p>
{{#if gainYohoCoin}}
<a href="/help/?category_id=87" class="yoho-coin" target="_blank"></a>
共返有货币:{{gainYohoCoin}}&#12288;&#12288;{{/if}}
已选商品<strong class="ins">{{selectedGoodsCount}}</strong>&#12288;&#12288;
商品金额:<b>¥&nbsp;{{orderAmount}}</b>
</p>
{{#if discountAmount}}<p>活动优惠:<b>&nbsp;{{discountAmount}}</b></p>{{/if}}
<!--<p>优惠码/优惠券:<b>¥&nbsp;8888.00</b></p>-->
<p class="sum">
应付金额(不含邮费):<strong><kbd>¥&nbsp;</kbd>{{lastOrderAmount}}</strong></p>
</div>
</div>
<div class="cartnew-submit" id="pay-sum">
<span>添加礼品袋</span>
<a href="javascript:void(0);"
id="Y_SubmitBtn"
class="btn-account"
{{#if mix}}data-mix="true"{{/if}}
{{#if ensureUrl}}data-ensureurl="{{ensureUrl}}"{{/if}}
{{#if noSelectGiftTip}}data-noSelectGiftTip="true"{{/if}}>去结算</a>
</div>
{{/stat}}
{{#if deleteShop}}
<div class="cart-del-goods">
<div class="cart-del-goods-title">已删除商品,您可以重新购买或移入收藏:</div>
<ul id="Y_delReselWrap">
{{#each deleteShop}}
<li data-sku="{{productSku}}"
data-promotionid="{{promotionId}}"
data-num="{{productNum}}">
<span class="good-name" style="width: 392px;">
<a href="{{link}}" target="_blank">{{productTitle}}</a>
</span>
<span class="good-price" style="width: 148px;">{{productPrice}}</span>
<span class="good-num" style="width: 128px;">{{productNum}}</span>
<span class="good-operate" style="width: 260px;">
<a href="javascript:void(0);" data-role="readd2cart">重新购买</a>
<a href="javascript:void(0);" data-role="reFav">移入收藏</a>
</span>
</li>
{{/each}}
</ul>
</div>
{{/if}}
{{> cart-pre-sell-tpl }}
</div>
{{/cart}}
{{!--{{#cart.salesPromotion}}
<div class="salesPromotion">
<p>
{{#if salesTitle}}
<b>{{salesTitle}}</b>
{{/if}}
{{salesMessage}}</p>
<span><i></i>已参与</span>
</div>
{{/cart.salesPromotion}} --}}
{{/if}}
<div class="order-pay" id="Y_CartListWrap">
{{#cart}}
{{> mix/cart/cart-list}}
{{/cart}}
</div>
</div>
... ...
<div class="order-ensure-page shop-cart yoho-page clearfix">
<div class="order-edit order-cart" id="cart-page">
<div class="order-title cart-page-title order-ensure-title">
<ul>
<li class="first active">查看购物车</li>
<li>填写订单</li>
<li class="end">付款,完成购买</li>
</ul>
</div>
{{#if cart.loginUrl}}
<div class="cartnew-tips">
<div class="tipsbox" id="tipsbox">
<a href="javascript:void(0);" class="btn_close" title="关闭"></a>
<strong>温馨提示:</strong>亲爱的顾客,您还没有 <a href="{{cart.loginUrl}}" class="a_eu">登录</a> 哦,所有商品价格、活动信息以登录后显示为准.
</div>
</div>
{{^}}
<div class="cartnew-tips">
<div class="tipsbox" id="tipsbox">
<a href="javascript:void(0);" class="btn_close" title="关闭"></a>
<strong>温馨提示:</strong>1. 选购单中的商品不保留库存,请及时结算。 2. 商品的价格、相关活动信息及库存以订单提交时为准。
</div>
</div>
{{/if}}
<div class="order-pay">
{{#if cart.isEmpty}}
<div class="pay-wapper">
<table>
<thead>
<tr>
<th style="width:7%;">
全选
</th>
<th style="width:40%;">
商品信息
</th>
<th style="width:13%;">单价</th>
<th style="width:10%;">数量</th>
<th style="width:10%;">小计(元)</th>
<th style="width:20%;">操作</th>
</tr>
</thead>
<tbody>
<tr class="pre-sell-box">
<td colspan="6" class="cart-empty">
<a href="{{cart.guangUrl}}">选购商品</a>
<a href="{{cart.viewOrderUrl}}">查看订单</a>
</td>
</tr>
</tbody>
</table>
</div>
<div class="dev-revocation {{#unless cart.deleteShop}}none{{/unless}}">
<table>
{{# cart.deleteShop}}
<tr data-productnum="{{productNum}}" data-productsku="{{productSku}}">
<td style="width:40%; text-align: left;">成功删除<a class="title" href="{{link}}" target="_blank">{{productTitle}}</a></td>
<td style="width:10%;"><span class="productPrice">{{productPrice}}</span></td>
<td style="width:10%;"></td>
<td style="width:10%;">{{productNum}}</td>
<td style="width:10%;"></td>
<td style="width:20%; border-right: none; text-align: right;">
<a href="javascript:void(0);"><span class="goBack">撤销本次删除</span></a>
</td>
</tr>
{{/ cart.deleteShop}}
</table>
</div>
{{^}}
<!-- 购物车商品列表 -->
{{#cart}}
<div class="pay-wapper">
<div class="cart-title">
<p class="left" style="width:6%;">
<input type="checkbox"/>
全选
</p>
<p style="width:40%">商品信息</p>
<p style="width:14%">单价</p>
<p style="width:13%;">数量</p>
<p style="width:16%;">小计(元)</p>
<p class="right" style="width:11%;">操作</p>
</div>
<!-- 预售商品 -->
<div class="pre-sell">
<code>预售商品</code>预售商品不参加活动,不可使用优惠券,不同上市期的商品我们将为您先到先发。
</div>
<div class="cart-table">
<ul class="table table-group">
<li class="pre-sell-box tr tr-group" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="td pay-pro" style="width: 45%;">
<sub class="out-of-stock">您勾选的商品库存不足</sub>
<input class="cart-item-check cart-item-checked" readonly="readonly" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
<span class="presell">上市期:2016-09-01{{preSellDate}}</span>
</p>
</div>
<div class="td productPrice" style="width:17%;">¥66666{{productPrice}}</div>
<div style="width:10%;" class="td adjust-cart-num">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="td sub-total red">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="td cart-operation">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width:45%;">
<input readonly="readonly" class="cart-item-check" name="" id="" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
<span class="presell">上市期:2016-09-01{{preSellDate}}</span>
</p>
</div>
<div class="productPrice td" style="width:17%;">¥{{productPrice}}</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width:45%;">
<input readonly="readonly" class="cart-item-check" name="" id="" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
<span class="presell">上市期:2016-09-01{{preSellDate}}</span>
</p>
</div>
<div class="productPrice td" style="width:17%;">¥{{productPrice}}</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="1{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">库存不足{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
</ul>
</div>
<!-- 加价购 -->
<div class="gift-sell mt40">
<p><code class="order-pay-mark-white">加价购</code>【全场热销】活动商品已购满¥398.00,可加价换购商品<a>去换购</a><button class="btn-clear blue" data-together-id="1" >去凑单&nbsp;></button></p>
<p><code class="order-pay-mark-white">满减</code>【热销满减】活动商品已购满¥498.00,享优惠¥49<button class="btn-clear blue" data-together-id="2" >去凑单&nbsp;></button></p>
</div>
<div class="cart-table">
<ul class="table">
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width: 45%;">
<input class="cart-item-check cart-item-checked" readonly="readonly" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive red">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
</p>
</div>
<div class="product-price td" style="width:17%;">¥66666{{productPrice}}
<div class="sale-info">
<span class="sale-info-title">促销信息<i></i></span>
<ul class="none">
<li>[Levi's]活动商品已满购¥398.00,可加价换购商品<a>去换购</a></li>
<li class="invalid">【Life·After Life】满¥300元享7折</li>
</ul>
</div>
</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width: 45%;" >
<input class="cart-item-check cart-item-checked" readonly="readonly" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive red">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
</p>
</div>
<div class="product-price td" style="width:17%;">¥66666{{productPrice}}
<div class="sale-info">
<span class="sale-info-title">促销信息<i></i></span>
<ul class="none">
<li>[Levi's]活动商品已满购¥398.00,可加价换购商品<a>去换购</a></li>
<li class="invalid">【Life·After Life】满¥300元享7折</li>
</ul>
</div>
</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
</ul>
</div>
<!-- 折扣 -->
<div class="gift-sell mt20">
<p><code>折扣</code>【New Balance】活动商品已购满2件,享优惠¥261.00<button class="btn-clear" data-together-id="3" >去凑单&nbsp;></button></p>
</div>
<div class="cart-table">
<ul class="table">
<li class="pre-sell-box tr active" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width: 45%;">
<input class="cart-item-check cart-item-checked" readonly="readonly" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
</p>
</div>
<div class="product-price td" style="width:17%;">¥66666{{productPrice}}</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
<li class="pre-sell-box tr active" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width: 45%;">
<input class="cart-item-check cart-item-checked" readonly="readonly" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
</p>
</div>
<div class="product-price td" style="width:17%;">¥66666{{productPrice}}</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
</ul>
</div>
<!-- 折扣 赠品 -->
<div class="gift-sell mt20">
<p><code class="order-pay-mark-white">折扣</code>【New Balance】活动商品已购满2件,享优惠¥261.00<button class="btn-clear" data-together-id="4" >去凑单&nbsp;></button></p>
<p><code>赠品</code>【Life·After Life】活动商品已购满1件,可领取赠品<a>领赠品</a><button class="btn-clear" data-together-id="5" >去凑单&nbsp;></button></p>
</div>
<div class="cart-table">
<ul class="table">
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width: 45%;">
<input class="cart-item-check cart-item-checked" readonly="readonly" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
</p>
</div>
<div class="product-price td" style="width:17%;">¥66666{{productPrice}}</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
</ul>
</div>
<!-- 其他 -->
<div class="cart-table mb20">
<ul class="table table-group">
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width: 45%;">
<input class="cart-item-check cart-item-checked" readonly="readonly" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
</p>
</div>
<div class="product-price td" style="width:17%;">
¥66666{{productPrice}}
<p class="tip-message">(VIP)</p>
</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message">仅剩2件</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width: 45%;">
<input class="cart-item-check cart-item-checked" readonly="readonly" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
</p>
</div>
<div class="product-price td" style="width:17%;">¥66666{{productPrice}}</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">
¥888{{productSubtotal}}
<p class="tip-message tip-message-coin"><i class="yoho-coin"></i>返100YOHO币</p>
</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width: 45%;">
<input class="cart-item-check cart-item-checked" readonly="readonly" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
</p>
</div>
<div class="product-price td" style="width:17%;">¥66666{{productPrice}}</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
</ul>
</div>
<!-- 失效 -->
<div class="cart-table">
<ul class="table">
<li class="pre-sell-box tr tr-disabled" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width: 45%;">
<i class="cart-item-disabled iconfont"></i>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
</p>
</div>
<div class="product-price td" style="width:17%;">
¥66666{{productPrice}}
<p class="tip-message">(VIP)</p>
</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message">仅剩2件</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width: 45%;">
<input class="cart-item-disabled" readonly="readonly"/>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
</p>
</div>
<div class="product-price td" style="width:17%;">¥66666{{productPrice}}</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">
¥888{{productSubtotal}}
<p class="tip-message tip-message-coin"><i class="yoho-coin"></i>返100YOHO币</p>
</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
</ul>
</div>
<!-- 失效 -->
<div class="gift-sell mt20">
<p><code>加价购</code>【全场热销】活动商品已购满¥398.00,可加价换购商品<a>去换购</a><button class="btn-clear blue" data-together-id="6">去凑单&nbsp;&gt;</button></p>
<p><code>赠品</code>【热销满减】活动商品已购满¥498.00,享优惠¥49<a>领赠品</a><button class="btn-clear blue" data-together-id="7" >去凑单&nbsp;&gt;</button></p>
<p><code>免运费</code>【热销满减】活动商品已购满¥498.00,享优惠¥49</p>
</div>
{{/cart}}
{{#cart.salesPromotion}}
<div class="salesPromotion">
<p>
{{#if salesTitle}}
<b>{{salesTitle}}</b>
{{/if}}
{{salesMessage}}</p>
<span><i></i>已参与</span>
</div>
{{/cart.salesPromotion}}
<!-- 总价计算 -->
<div class="cartnew-sum">
{{#unless cart.isEmpty}}
<div class="left">
<a href="javascript:void(0);" class="btn_h" style="display:none;"><span>清空商品</span></a>
<input type="checkbox" id="cbSelAllGoods" {{#if cart.isCheckedAll}}checked="checked"{{/if}}>
<span>全选</span>
<a class="delAll" href="javascript:void(0);">删除选中商品</a>
<a class="removeAll" href="javascript:void(0);">移入收藏夹</a>
<a class="emptyDisabled" href="javascript:void(0);">清空失效商品</a>
<!--<div class="cartsnew-sale-info">-->
<!--<div class="sale-info">-->
<!--<span class="sale-info-title">使用优惠券<i></i></span>-->
<!--<ul class="none">-->
<!--<li>[Levi's]活动商品已满购¥398.00,可加价换购商品<a>去换购</a></li>-->
<!--<li class="invalid">【Life·After Life】满¥300元享7折</li>-->
<!--</ul>-->
<!--</div>-->
<!--<div class="sale-info">-->
<!--<span class="sale-info-title">使用优惠码<i></i></span>-->
<!--<ul class="none">-->
<!--<li>[Levi's]活动商品已满购¥398.00,可加价换购商品<a>去换购</a></li>-->
<!--<li class="invalid">【Life·After Life】满¥300元享7折</li>-->
<!--</ul>-->
<!--</div>-->
<!--</div>-->
</div>
{{/unless}}
<div class="right">
<p>
<a href="/help/?category_id=87" class="yoho-coin" target="_blank"></a>
共返有货币:666{{cart.getYoho}}&#12288;&#12288;
已选商品<strong class="ins">24件</strong>&#12288;&#12288;
商品金额:<b>¥&nbsp;8888.00</b>
</p>
<p>活动优惠:<b>&nbsp;100.00</b></p>
<p>优惠码/优惠券:<b>¥&nbsp;8888.00</b></p>
<p class="sum">
应付金额(不含邮费):<strong><kbd>¥&nbsp;</kbd>8888.00{{cart.productAllA}}</strong></p>
</div>
</div>
<div class="cartnew-submit" id="payDiv">
<span>添加礼品袋</span>
<a href="javascript:void(0);" class="btn-account">去结算</a>
</div>
{{/if}}
</div>
</div>
{{#unless @root.pc.product.removeRecentView}}
<div class="lazy-load-object">
<textarea class="datalazyload" style="visibility: hidden;">
<script>
fetchRecommend();
</script>
</textarea>
</div>
<div class="bottom-tab bottom-tab-slide">
<span class="bottom-title cur">凑单商品</span>
<span class="bottom-title">为您优选</span>
<span class="bottom-title">最近浏览</span>
<span class="change">换一批
<span class="iconfont change-icon">&#xe639;</span>
</span>
</div>
<div class="individual-slide">
<div class="individual-item individual-item-togetherGoods">
<input id="" type="hidden" value="">
<div id="" class="goods clearfix">
{{>individual-slide}}
</div>
</div>
<div class="individual-item individual-item-recommendGoods none">
<input id="" type="hidden" value="{{latestWalk}}">
<div id="" class="goods clearfix">
{{>individual-slide}}
</div>
</div>
<div class="individual-item individual-item-latestWalk none">
<input id="latest-walk-count" type="hidden" value="">
<div id="latest-walk-goods" class="goods clearfix">
{{>individual-slide}}
</div>
</div>
</div>
{{/unless}}
<div class="loading"><span></span>请稍后...</div>
</div>
</div>
<!-- 商品详细信息窗口 -->
<script type="text/javascript">
(function (d) {
window.bd_cpro_rtid="P1fsPWc";
var s = d.createElement("script");s.type = "text/javascript";s.async = true;s.src = location.protocol + "//cpro.baidu.com/cpro/ui/rt.js";
var s0 = d.getElementsByTagName("script")[0];s0.parentNode.insertBefore(s, s0);
})(document);
</script>
<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{event:"setAccount", account: 16184},
{event:"setCustomerId", id: "{{uid}}"},
{event:"setSiteType", type: "d"},
{event:"viewBasket", item: {{{cart.criteo}}} }
);
</script>
<!-- 聚效 -->
<script type="text/javascript">
var _mvq = window._mvq || [];
window._mvq = _mvq;
_mvq.push(['$setAccount', 'm-23428-1']);
_mvq.push(['$setGeneral', 'cartview', '', /*用户名*/ '', '{{uid}}']);
_mvq.push(['$logConversion']);
_mvq.push(['$addItem', '', /*商品id*/ '{{cart.ids}}', '', '']);
_mvq.push(['$logData']);
</script>
<div class="order-ensure-page shop-cart yoho-page clearfix">
<div class="order-edit order-cart" id="cart-page">
<div class="order-title cart-page-title order-ensure-title">
<ul>
<li class="first active">查看购物车</li>
<li>填写订单</li>
<li class="end">付款,完成购买</li>
</ul>
</div>
{{#unless cart.isLogin}}
<div class="cartnew-tips">
<div class="tipsbox" id="tipsbox">
<a href="javascript:void(0);" class="btn_close" title="关闭"></a>
<strong>温馨提示:</strong>亲爱的顾客,您还没有 <a href="{{cart.loginUrl}}" class="a_eu">登录</a> 哦,所有商品价格、活动信息以登录后显示为准.
</div>
</div>
{{^}}
<div class="cartnew-tips">
<div class="tipsbox" id="tipsbox">
<a href="javascript:void(0);" class="btn_close" title="关闭"></a>
<strong>温馨提示:</strong>1. 选购单中的商品不保留库存,请及时结算。 2. 商品的价格、相关活动信息及库存以订单提交时为准。
</div>
</div>
{{/unless}}
<div class="order-pay">
{{#if cart.isEmpty}}
<div class="pay-wapper">
<div class="shop-cart-empty">
<p>购物车空空的哦,去看看心仪的商品吧~</p>
</div>
</div>
<div class="dev-revocation {{#unless cart.deleteShop}}none{{/unless}}">
<table>
{{# cart.deleteShop}}
<tr data-productnum="{{productNum}}" data-productsku="{{productSku}}">
<td style="width:40%; text-align: left;">成功删除<a class="title" href="{{link}}" target="_blank">{{productTitle}}</a></td>
<td style="width:10%;"><span class="productPrice">{{productPrice}}</span></td>
<td style="width:10%;"></td>
<td style="width:10%;">{{productNum}}</td>
<td style="width:10%;"></td>
<td style="width:20%; border-right: none; text-align: right;">
<a href="javascript:void(0);"><span class="goBack">撤销本次删除</span></a>
</td>
</tr>
{{/ cart.deleteShop}}
</table>
</div>
{{^}}
<!-- 购物车商品列表 -->
{{#cart}}
<div class="pay-wapper">
<div class="cart-title">
<p class="left" style="width:6%;">
<i class="cart-item-check iconfont cart-item-checked"></i> 全选
</p>
<p style="width:40%">商品信息</p>
<p style="width:14%">单价</p>
<p style="width:13%;">数量</p>
<p style="width:16%;">小计(元)</p>
<p class="right" style="width:11%;">操作</p>
</div>
{{#advanceCart}}
<!-- 预售商品 -->
<div class="pre-sell">
<code>预售商品</code>预售商品不参加活动,不可使用优惠券,不同上市期的商品我们将为您先到先发。
</div>
{{#advanceCart}}
<!-- 预售商品 -->
<div class="pre-sell">
<code>预售商品</code>预售商品不参加活动,不可使用优惠券,不同上市期的商品我们将为您先到先发。
</div>
<div class="td pay-pro" style="width: 45%;">
<i class="cart-item-check iconfont cart-item-checked" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}></i>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
<span class="presell">上市期:2016-09-01{{preSellDate}}</span>
</p>
</div>
<div class="td productPrice" style="width:17%;">¥66666{{productPrice}}</div>
<div style="width:10%;" class="td adjust-cart-num">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="td sub-total red">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="td cart-operation">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width:45%;">
<i class="cart-item-check iconfont cart-item-checked" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}></i>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
<span class="presell">上市期:2016-09-01{{preSellDate}}</span>
</p>
</div>
<div class="productPrice td" style="width:17%;">¥{{productPrice}}</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="sub-total red td">¥{{productSubtotal}}</div>
<div style="width:11%;" class="cart-operation td">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
</li>
<li class="pre-sell-box tr" {{#if pid}}data-pid="{{pid}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} {{#if skn}}data-skn="{{skn}}"{{/if}} {{#if sku}}data-sku="{{sku}}"{{/if}} {{#if productNum}}data-productnum="{{productNum}}"{{/if}} {{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="pay-pro td" style="width:45%;">
<i class="cart-item-check iconfont cart-item-checked" id="" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}></i>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
<span class="incentive">预售</span>
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}</span>
<span class="presell">上市期:2016-09-01{{preSellDate}}</span>
</p>
</div>
<div class="productPrice td" style="width:17%;">¥{{productPrice}}</div>
<div style="width:10%;" class="adjust-cart-num td">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="1{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">库存不足{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
{{/if}}
{{#if goodsList}}
<div class="cart-table">
<ul class="table">
{{#goodsList}}
{{> cart-item}}
{{/goodsList}}
</ul>
</div>
{{/if}}
{{/pools}}
<!--可选的加价购商品 -->
<!--priceGifts-->
<!--可选择的赠品-->
<!--gifts-->
<!-- -->
{{#if offShelves}}
<div class="cart-table">
<ul class="table">
{{#offShelves}}
{{> cart-item}}
{{/offShelves}}
</ul>
</div>
{{/if}}
<!-- -->
{{#if soldOuts}}
<div class="cart-table">
<ul class="table">
{{#soldOuts}}
{{> cart-item}}
{{/soldOuts}}
</ul>
</div>
{{/if}}
<!-- 全场已选择的 加价购+赠品 -->
{{#if goodsList}}
<div class="cart-table">
<ul class="table">
{{#each goodsList}}
{{> cart-item}}
{{/each}}
</ul>
</div>
{{/if}}
{{#if promotionInfos}}
<div class="gift-sell mt20">
{{#promotionInfos}}
<p><code>{{tag}}</code>{{promotionTitle}}<a class="btn-clear blue" data-together-id="6">去凑单&nbsp;&gt;</a></p>
{{/promotionInfos}}
</div>
{{/if}}
{{/ordinaryCart}}
{{#stat}}
<!-- 总价计算 -->
<div class="cartnew-sum">
{{#unless cart.isEmpty}}
<div class="left">
<a href="javascript:void(0);" class="btn_h" style="display:none;"><span>清空商品</span></a>
<i class="cart-item-check iconfont" id="cbSelAllGoods" {{#if cart.isCheckedAll}}checked="checked"{{/if}}></i>
<span>全选</span>
<a class="delAll" href="javascript:void(0);">删除选中商品</a>
<a class="removeAll" href="javascript:void(0);">移入收藏夹</a>
<a class="emptyDisabled" href="javascript:void(0);">清空失效商品</a>
</div>
</div>
</div>
<div class="cartnew-submit" id="payDiv">
<span>添加礼品袋</span>
<a href="javascript:void(0);" class="btn-account">去结算</a>
</div>
{{/stat}}
<!-- 普通商品 -->
<div class="pre-sell">
普通商品
</div>
<div class="cart-table">
<ul class="table table-group">
<li class="pre-sell-box tr"
{{#if pid}}data-pid="{{pid}}"{{/if}}
{{#if id}}data-id="{{id}}"{{/if}}
{{#if skn}}data-skn="{{skn}}"{{/if}}
{{#if sku}}data-sku="{{sku}}"{{/if}}
{{#if productNum}}data-productnum="{{productNum}}"{{/if}}
{{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="td pay-pro" style="width: 45%;">
<i class="cart-item-check iconfont" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}></i>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}<i class="iconfont">&#xe6c7;</i></span>
</p>
</div>
<div class="td productPrice" style="width:17%;">¥66666{{productPrice}}</div>
<div style="width:10%;" class="td adjust-cart-num">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="td sub-total red">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="td cart-operation">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
<div class="goods-choose-box none" id="goodsChoose">
<div class="goods-info">
<div class="dl choose-color">
<div class="dd">颜色:</div>
<div class="dt active">
<img src="#"/>
</div>
<div class="dt">
<img src="#"/>
</div>
<div class="dt">
<img src="#"/>
</div>
</div>
<div class="dl choose-size">
<div class="dd">尺码:</div>
<div class="dt active">
40
</div>
<div class="dt">
42
</div>
<div class="dt">
44
</div>
<div class="dt">
46
</div>
<div class="dt disabled">
48
</div>
</div>
<div class="button-group">
<button class="button-sure">确定</button>
<button class="button-cancel">取消</button>
</div>
</div>
<div class="goods-info-bigImg">
<div class="bigImg">
<img src="#"/>
</div>
<div class="bigImg none">
<img src="#"/>
</div>
<div class="bigImg none">
<img src="#"/>
</div>
<div class="bigImg none">
<img src="#"/>
</div>
<div class="bigImg none">
<img src="#"/>
</div>
</div>
</div>
</li>
<li class="pre-sell-box tr"
{{#if pid}}data-pid="{{pid}}"{{/if}}
{{#if id}}data-id="{{id}}"{{/if}}
{{#if skn}}data-skn="{{skn}}"{{/if}}
{{#if sku}}data-sku="{{sku}}"{{/if}}
{{#if productNum}}data-productnum="{{productNum}}"{{/if}}
{{#if goodsType}}data-goodstype="{{goodsType}}"{{/if}}>
<div class="td pay-pro" style="width: 45%;">
<i class="cart-item-check iconfont" data-goodstype="{{goodsType}}" {{#if isChecked}}checked{{/if}}></i>
<a class="pay-pro-icon" href="{{link}}" target="_blank">
<img src="{{imgCover}}">
</a>
<p class="pay-pro-info">
<a href="{{link}}" target="_blank">哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈
{{productTitle}}</a>
<span><b title="{{productColor}}">颜色:红色{{productColor}}</b> 尺码:L{{productSize}}<i class="iconfont">&#xe6c7;</i></span>
</p>
</div>
<div class="td productPrice" style="width:17%;">¥66666{{productPrice}}</div>
<div style="width:10%;" class="td adjust-cart-num">
{{#if isGift}}
<div>{{productNum}}</div>
{{^}}
{{#if isPriceGift}}
<div>{{productNum}}</div>
{{^}}
<div class="cart-num-cont">
<span class="minus"></span>
<input type="text" value="67{{productNum}}" readonly="readonly"/>
<span class="plus"></span>
</div>
<p class="tip-message {{#isTipNoStore}}tipNoStore{{/isTipNoStore}}">{{tipMessage}}</p>
{{/if}}
{{/if}}
</div>
<div style="width:17%;" class="td sub-total red">¥888{{productSubtotal}}</div>
<div style="width:11%;" class="td cart-operation">
<span class="cart-del-btn">删除</span>
<span class="cart-col-btn">移入收藏</span>
</div>
<div class="goods-choose-box none" id="goodsChoose">
<div class="goods-info">
<div class="dl choose-color">
<div class="dd">颜色:</div>
<div class="dt active">
<img src="#"/>
</div>
<div class="dt">
<img src="#"/>
</div>
<div class="dt">
<img src="#"/>
</div>
</div>
<div class="dl choose-size">
<div class="dd">尺码:</div>
<div class="dt active">
40
</div>
<div class="dt">
42
</div>
<div class="dt">
44
</div>
<div class="dt">
46
</div>
<div class="dt disabled">
48
</div>
</div>
<div class="button-group">
<button class="button-sure">确定</button>
<button class="button-cancel">取消</button>
</div>
</div>
<div class="goods-info-bigImg">
<div class="bigImg">
<img src="#"/>
</div>
<div class="bigImg none">
<img src="#"/>
</div>
<div class="bigImg none">
<img src="#"/>
</div>
<div class="bigImg none">
<img src="#"/>
</div>
<div class="bigImg none">
<img src="#"/>
</div>
</div>
</div>
</li>
</ul>
</div>
{{/cart}}
{{!--{{#cart.salesPromotion}}
<div class="salesPromotion">
<p>
{{#if salesTitle}}
<b>{{salesTitle}}</b>
{{/if}}
{{salesMessage}}</p>
<span><i></i>已参与</span>
</div>
{{/cart.salesPromotion}} --}}
{{/if}}
</div>
</div>
{{#unless @root.pc.product.removeRecentView}}
<div class="lazy-load-object">
<textarea class="datalazyload" style="visibility: hidden;">
<script>
fetchRecommend();
</script>
</textarea>
</div>
<div class="bottom-tab bottom-tab-slide">
<span class="bottom-title cur">凑单商品</span>
<span class="bottom-title">为您优选</span>
<span class="bottom-title">最近浏览</span>
<span class="change">换一批
<span class="iconfont change-icon">&#xe639;</span>
</span>
</div>
<div class="individual-slide">
<div class="individual-item individual-item-togetherGoods">
<input id="" type="hidden" value="">
<div id="" class="goods clearfix">
{{>individual-slide}}
</div>
</div>
<div class="individual-item individual-item-recommendGoods none">
<input id="" type="hidden" value="{{latestWalk}}">
<div id="" class="goods clearfix">
{{>individual-slide}}
</div>
</div>
<div class="individual-item individual-item-latestWalk none">
<input id="latest-walk-count" type="hidden" value="">
<div id="latest-walk-goods" class="goods clearfix">
{{>individual-slide}}
</div>
</div>
</div>
{{/unless}}
<div class="loading"><span></span>请稍后...</div>
</div>
<script type="text/javascript">
/*<textarea data-role="gifts-cansel" class="hide" data-promotionid="{{promotionId}}">{{{giftGoodsListStr}}}</textarea>*/
</script>
<!-- 商品详细信息窗口 -->
<script type="text/javascript">
(function (d) {
window.bd_cpro_rtid="P1fsPWc";
var s = d.createElement("script");s.type = "text/javascript";s.async = true;s.src = location.protocol + "//cpro.baidu.com/cpro/ui/rt.js";
var s0 = d.getElementsByTagName("script")[0];s0.parentNode.insertBefore(s, s0);
})(document);
</script>
<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{event:"setAccount", account: 16184},
{event:"setCustomerId", id: "{{uid}}"},
{event:"setSiteType", type: "d"},
{event:"viewBasket", item: {{{cart.criteo}}} }
);
</script>
<!-- 聚效 -->
<script type="text/javascript">
var _mvq = window._mvq || [];
window._mvq = _mvq;
_mvq.push(['$setAccount', 'm-23428-1']);
_mvq.push(['$setGeneral', 'cartview', '', /*用户名*/ '', '{{uid}}']);
_mvq.push(['$logConversion']);
_mvq.push(['$addItem', '', /*商品id*/ '{{cart.ids}}', '', '']);
_mvq.push(['$logData']);
</script>
<div class="yoho-dialog cart-togetherGoods"
data-role="cart-gift-win"
style="margin-top: -374.5px; margin-left: -350px; display:none;">
<span class="close">
<i class="iconfont"></i>
</span>
<div class="content">
<div class="detail-body">
<div class="slide-img">
<p class="sell-class-title">选赠品:
<em class="slide-img-title"><span
class="active">1元加价购</span>
<code class="spacing">|</code>
<span>59元加价购</span>
<code class="spacing">|</code>
<span>99元加价购</span>
</em>
</p>
<div class="side-img-dd">
<ul class="img-list">
{{#each giftGoodsList}}
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="javascript:void(0)" target="_blank"> {{!--{{link}}--}}
<img class="lazy" src="{{imgCover}}"/>
</a>
</div>
</li>
{{/each}}
</ul>
<div class="img-brand-switch">
<a class="prev iconfont" href="javascript:;">&#xe609;</a>
<a class="next iconfont" href="javascript:;">&#xe608;</a>
</div>
</div>
</div>
<div class="detail-goods">
<div class="detail-bigpic">
<div class="bigpic">
<img src="">
</div>
<div class="bigpic none">
<img src="">
</div>
<div class="bigpic none">
<img src="">
</div>
<div class="bigpic none">
<img src="">
</div>
<div class="bigpic none">
<img src="">
</div>
<div class="bigpic none">
<img src="">
</div>
<div class="piclist">
<span class="pre"></span>
<div class="con">
<ul>
<li class="active"><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
</ul>
</div>
<span class="next"></span>
</div>
</div>
<div class="detail-bigpic none">
<div class="bigpic">
<img src="">
</div>
<div class="bigpic none">
<img src="">
</div>
<div class="bigpic none">
<img src="">
</div>
<div class="bigpic none">
<img src="">
</div>
<div class="bigpic none">
<img src="">
</div>
<div class="bigpic none">
<img src="">
</div>
<div class="piclist">
<span class="pre"></span>
<div class="con">
<ul>
<li class="active"><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
<li><img src=""></li>
</ul>
</div>
<span class="next"></span>
</div>
</div>
<div class="detail-info">
<div class="title">
<h2>哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈{{name}}</h2>
</div>
<div class="price">
<span class="newprice">现价:<b class="promotion-price">¥7777{{salePrice}}</b></span>
<span class="activityprice">活动价:<b class="promotion-price">¥5555{{marketPrice}}</b></span>
</div>
<div class="order">
<dl>
<dd class="colorBox">选颜色:</dd>
<dt>
<div class="colorBox">
<ul>
<li class="color active">
<p class="{{#if focus}}atcive{{/if}}"><span></span><img src=""></p>
<span>{{name}}</span>
</li>
<li class="color">
<p class="{{#if focus}}atcive{{/if}}"><span></span><img src=""></p>
<span>{{name}}</span>
</li>
</ul>
</div>
</dt>
</dl>
<dl>
<dd class="showSizeBox">选尺码:</dd>
<dt>
<div class="showSizeBox">
<span data-sku="{{sku}}" data-num="{{num}}" class="disabled">40码{{name}}</span>
<span data-sku="{{sku}}" data-num="{{num}}">40码{{name}}</span>
<span data-sku="{{sku}}" data-num="{{num}}">40码{{name}}</span>
<span data-sku="{{sku}}" data-num="{{num}}">40码{{name}}</span>
</div>
<p class="size-p">内长&nbsp;25.5com</p>
</dt>
</dl>
<dl>
<dd>选件数:</dd>
<dt>
<div class="amount_wrapper">
<input type="text" id="num" class="num" value="1" readonly="readonly">
<a class="amount cut"><i class="iconfont">&#xe6c0;</i></a>
<a class="amount add"><i class="iconfont">&#xe6c1;</i></a>
</div>
</dt>
</dl>
</div>
<div class="submit">
<button class="btn-red"><i class="addCart iconfont">&#xe600;</i>添加到购物车</button>
<button class="btn-favCount"><i class="favCount iconfont">&#xe68f;</i>收藏商品</button>
</div>
</div>
<div class="detail-size">
<h3>尺码信息(单位:厘米)</h3>
<table>
<thead>
<tr>
<th width="{{width}}">吊牌吃吗</th>
<th width="{{width}}">吊牌吃吗
</td>
<th width="{{width}}">吊牌吃吗
</td>
<th width="{{width}}">吊牌吃吗
</td>
<th width="{{width}}">吊牌吃吗
</td>
<th width="{{width}}">吊牌吃吗
</td>
</tr>
</thead>
<tbody>
<tr>
<td>6666{{.}}</td>
</tr>
<tr>
<td>4444{{.}}</td>
</tr>
</tbody>
</table>
<div class="size-info">
※ 以上尺寸为实物实际测量,因测量方式不同会有略微误差,相关数据仅作参考,以收到实物为准。
</div>
</div>
</div>
</div>
</div>
</div>
... ... @@ -114,7 +114,7 @@
</dt>
</dl>
<dl>
<dd class="showNumBox">选件数:</dd>
<dd>选件数:</dd>
<dt>
<div class="amount_wrapper">
<input type="text" id="num" class="num" value="1" readonly="readonly">
... ... @@ -135,11 +135,16 @@
<thead>
<tr>
<th width="{{width}}">吊牌吃吗</th>
<th width="{{width}}">吊牌吃吗</th>
<th width="{{width}}">吊牌吃吗</th>
<th width="{{width}}">吊牌吃吗</th>
<th width="{{width}}">吊牌吃吗</th>
<th width="{{width}}">吊牌吃吗</th>
<th width="{{width}}">吊牌吃吗
</td>
<th width="{{width}}">吊牌吃吗
</td>
<th width="{{width}}">吊牌吃吗
</td>
<th width="{{width}}">吊牌吃吗
</td>
<th width="{{width}}">吊牌吃吗
</td>
</tr>
</thead>
<tbody>
... ...
<li class="good img-item">
<span class="hide goods-id">{{goods_id}}</span>
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{img}}"/>
</a>
<a class="name" href="{{href}}" target="_blank">哈哈哈哈哈哈哈哈哈哈{{name}}</a>
<p class="price">
<span class="sale-price">8888{{salePrice}}</span>
</p>
<a class="btn-add-cart" data-together-id=" ">加入购物车</a>
</li>
<li class="good img-item">
<span class="hide goods-id">{{goods_id}}</span>
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{img}}"/>
</a>
<a class="name" href="{{href}}" target="_blank">哈哈哈哈哈哈哈哈哈哈{{name}}</a>
<p class="price">
<span class="sale-price">8888{{salePrice}}</span>
</p>
<a class="btn-add-cart" data-together-id=" ">加入购物车</a>
</li>
<li class="good img-item">
<span class="hide goods-id">{{goods_id}}</span>
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{img}}"/>
</a>
<a class="name" href="{{href}}" target="_blank">哈哈哈哈哈哈哈哈哈哈{{name}}</a>
<p class="price">
<span class="sale-price sale-price-new">8888{{salePrice}}</span>
<span class="market-price">7777{{marketPrice}}</span>
</p>
<a class="btn-add-cart" data-together-id=" ">加入购物车</a>
</li>
<li class="good img-item">
<span class="hide goods-id">{{goods_id}}</span>
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{img}}"/>
</a>
<a class="name" href="{{href}}" target="_blank">哈哈哈哈哈哈哈哈哈哈{{name}}</a>
<p class="price">
<span class="sale-price">8888{{salePrice}}</span>
</p>
<a class="btn-add-cart" data-together-id=" ">加入购物车</a>
</li>
<li class="good img-item">
<span class="hide goods-id">{{goods_id}}</span>
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{img}}"/>
</a>
<a class="name" href="{{href}}" target="_blank">哈哈哈哈哈哈哈哈哈哈{{name}}</a>
<p class="price">
<span class="sale-price">8888{{salePrice}}</span>
</p>
<a class="btn-add-cart" data-together-id=" ">加入购物车</a>
</li>
<li class="good img-item">
<span class="hide goods-id">{{goods_id}}</span>
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{img}}"/>
</a>
<a class="name" href="{{href}}" target="_blank">哈哈哈哈哈哈哈哈哈哈{{name}}</a>
<p class="price">
<span class="sale-price">8888{{salePrice}}</span>
</p>
<a class="btn-add-cart" data-together-id=" ">加入购物车</a>
</li>
... ... @@ -52,7 +52,7 @@
<ul class="none">
{{#promotionInfos}}
<li>{{promotionTitle}}
{{>cart-promotion-btn}}
{{>mix/cart/cart-promotion-btn}}
{{#if isNotReach}}
<a class="btn-clear blue order-pay-link" target="_blank" href="{{promotionPageUrl}}">去凑单&nbsp;></a>
{{/if}}
... ...
{{#if isEmpty}}
<div class="pay-wapper">
<div class="shop-cart-empty">
<i class="iconfont"></i>
<p>购物车空空的哦,去看看心仪的商品吧~</p>
<a href="{{listUrl}}">去购物</a>
</div>
</div>
<div class="dev-revocation {{#unless deleteShop}}none{{/unless}}">
<table>
{{# deleteShop}}
<tr data-productnum="{{productNum}}" data-productsku="{{productSku}}">
<td style="width:35%; text-align: left;">成功删除<a class="title" href="{{link}}"
target="_blank">{{productTitle}}</a>
</td>
<td style="width:14%;"><span class="productPrice">{{productPrice}}</span></td>
<td style="width:15%;">{{productNum}}</td>
<td style="width:16%;"></td>
<td style="width:11.8%; border-right: none; text-align: right;">
<a href="javascript:void(0);"><span class="goBack">撤销本次删除</span></a>
</td>
</tr>
{{/ deleteShop}}
</table>
</div>
{{^}}
<!-- 购物车商品列表 -->
<div class="pay-wapper">
<div class="cart-title">
<p class="left" style="width:6%;">
<i class="cart-item-check iconfont"></i>&nbsp;&nbsp;全选
</p>
<p style="width:35%">商品信息</p>
<p style="width:14%">单价</p>
<p style="width:15%;">数量</p>
<p style="width:16%;">小计</p>
<p class="right" style="width:11.8%;">操作</p>
</div>
{{#advanceCart}}
<div class="mb40">
<!-- 预售商品 -->
<div class="pre-sell">
<code>预售商品</code>预售商品不参加活动,不可使用优惠券,不同上市期的商品我们将为您先到先发。
</div>
{{#pools}}
{{#if goodsList}}
<div class="cart-table">
<ul class="table">
{{#goodsList}}
{{> mix/cart/cart-item}}
{{/goodsList}}
</ul>
</div>
{{/if}}
{{/pools}}
{{#if offShelves}}
<div class="cart-table">
<ul class="table table-group">
{{#each offShelves}}
{{> mix/cart/cart-item}}
{{/each}}
</ul>
</div>
{{/if}}
{{#if soldOuts}}
<div class="cart-table">
<ul class="table table-group">
{{#each soldOuts}}
{{> mix/cart/cart-item}}
{{/each}}
</ul>
</div>
{{/if}}
{{#if promotionInfos}}
<div class="gift-sell">
{{#promotionInfos}}
<p class="gift-sell-info"><code class="order-pay-mark">{{tag}}</code>{{promotionTitle}}
<!--<a class="btn-clear blue" data-together-id="6">去凑单&nbsp;&gt;</a>-->
</p>
{{/promotionInfos}}
</div>
{{/if}}
</div>
{{/advanceCart}}
{{#ordinaryCart}}
{{#pools}}
<div class="promotion-pool" data-role="promotion-pool">
{{#if promotionInfos}}
<div class="gift-sell mt20">
{{#promotionInfos}}
<div class="gift-sell-info"
data-role="promotion-wrap"
data-promotionid="{{promotionId}}">
<code class="order-pay-mark
{{#unless isReach}}order-pay-mark-white{{/unless}}">
{{tag}}
</code>{{promotionTitle}}
{{>mix/cart/cart-promotion-btn}}
{{!--{{#if isPriceGift}}
{{#if isNotReach}}
<a class="btn-clear blue order-pay-link" target="_blank" href="{{promotionPageUrl}}">去凑单&nbsp;></a>
{{/if}}
{{/if}}--}}
{{#if isNotReach}}
<a class="btn-clear blue order-pay-link" target="_blank" href="{{promotionPageUrl}}">去凑单&nbsp;></a>
{{/if}}
{{!--{{> cart-sel-gift-tpl }}--}}
{{!--<textarea data-role="gifts-cansel" class="hide" data-promotionid="{{promotionId}}">{{{giftGoodsListStr}}}</textarea>--}}
</div>
{{/promotionInfos}}
</div>
{{/if}}
{{#if subs}}
<div class="cart-table">
{{#each subs}}
<ul class="table {{#isBrandGroup}}table-group{{/isBrandGroup}}">
{{#each goodsList}}
{{> mix/cart/cart-item}}
{{/each}}
</ul>
{{/each}}
</div>
{{/if}}
{{#if goodsList}}
<div class="cart-table">
<ul class="table {{#isBrandGroup}}table-group{{/isBrandGroup}}">
{{#goodsList}}
{{> mix/cart/cart-item}}
{{/goodsList}}
</ul>
</div>
{{/if}}
</div>
{{/pools}}
{{#if offShelves}}
<div class="mt20">
<div class="cart-table">
<ul class="table">
{{#offShelves}}
{{> mix/cart/cart-item}}
{{/offShelves}}
</ul>
</div>
</div>
{{/if}}
<!-- -->
{{#if soldOuts}}
<div class="mt20">
<div class="cart-table">
<ul class="table">
{{#soldOuts}}
{{> mix/cart/cart-item}}
{{/soldOuts}}
</ul>
</div>
</div>
{{/if}}
<!--可选的加价购商品 -->
<!--priceGifts-->
<!--可选择的赠品-->
<!--gifts-->
{{#if hasGlobalBlock}}
<div class="gift-sell mt20">
{{#gifts}}
<div class="gift-sell-info"
data-role="promotion-wrap"
data-promotionid="{{promotionId}}">
<code class="order-pay-mark order-pay-mark-white">
{{tag}}
</code>{{promotionTitle}}
{{#if isGift}}
<a class="order-pay-link" href="javascript:void(0);"
data-role="gift-sel-btn">领赠品</a>
{{/if}}
{{#if isPriceGift}}
<a href="javascript:void(0);"
class="order-pay-link"
data-role="pg-sel-btn">去换购</a>
<a class="btn-clear blue order-pay-link" target="_blank" href="{{promotionPageUrl}}">去凑单&nbsp;></a>
{{/if}}
{{!--{{> cart-sel-gift-tpl }}--}}
{{!--<textarea data-role="gifts-cansel" class="hide" data-promotionid="{{promotionId}}">{{{giftGoodsListStr}}}</textarea>--}}
</div>
{{/gifts}}
{{#priceGifts}}
<div class="gift-sell-info"
data-role="promotion-wrap"
data-promotionid="{{promotionId}}">
<code class="order-pay-mark">
{{tag}}
</code>{{promotionTitle}}
{{#if isGift}}
<a class="order-pay-link" href="javascript:void(0);"
data-role="gift-sel-btn">领赠品</a>
{{/if}}
{{#if isPriceGift}}
<a href="javascript:void(0);"
class="order-pay-link"
data-role="pg-sel-btn">去换购</a>
<a class="btn-clear blue order-pay-link" target="_blank" href="{{promotionPageUrl}}">去凑单&nbsp;></a>
{{/if}}
{{!--{{> cart-sel-gift-tpl }}--}}
{{!--<textarea data-role="gifts-cansel" class="hide" data-promotionid="{{promotionId}}">{{{giftGoodsListStr}}}</textarea>--}}
</div>
{{/priceGifts}}
{{#promotionInfos}}
<p class="gift-sell-info"><code class="order-pay-mark">{{tag}}</code>{{promotionTitle}}
<!--<a class="btn-clear blue" data-together-id="6">去凑单&nbsp;&gt;</a>-->
</p>
{{/promotionInfos}}
</div>
{{/if}}
<!-- 全场已选择的 加价购+赠品 -->
{{#if goodsList}}
<div class="cart-table">
<ul class="table">
{{#each goodsList}}
{{> mix/cart/cart-item}}
{{/each}}
</ul>
</div>
{{/if}}
{{/ordinaryCart}}
{{#stat}}
<!-- 总价计算 -->
<div class="cartnew-sum">
{{#unless ../isEmpty}}
<div class="left">
<a href="javascript:void(0);" class="btn_h"
style="display:none;"><span>清空商品</span></a>
<i class="cart-item-check iconfont" id="cbSelAllGoods"></i>
<span>全选</span>
<a class="delAll delete-all-sel" href="javascript:void(0);">删除选中商品</a>
<a class="removeAll remove-all-2fav" href="javascript:void(0);">移入收藏夹</a>
<a class="emptyDisabled clean-all-disable"
href="javascript:void(0);">清空失效商品</a>
</div>
{{/unless}}
<div class="right">
<p>
{{#if gainYohoCoin}}
<a href="/help/?category_id=87" class="yoho-coin" target="_blank"></a>
共返有货币:{{gainYohoCoin}}&#12288;&#12288;{{/if}}
已选商品<strong class="ins">{{selectedGoodsCount}}</strong>&#12288;&#12288;
商品金额:<b>¥&nbsp;{{orderAmount}}</b>
</p>
{{#if discountAmount}}<p>活动优惠:<b>&nbsp;{{discountAmount}}</b></p>{{/if}}
<!--<p>优惠码/优惠券:<b>¥&nbsp;8888.00</b></p>-->
<p class="sum">
应付金额(不含邮费):<strong><kbd>¥&nbsp;</kbd>{{lastOrderAmount}}</strong></p>
</div>
</div>
<div class="cartnew-submit" id="pay-sum">
<span>添加礼品袋</span>
<a href="javascript:void(0);"
id="Y_SubmitBtn"
class="btn-account"
{{#if mix}}data-mix="true"{{/if}}
{{#if ensureUrl}}data-ensureurl="{{ensureUrl}}"{{/if}}
{{#if noSelectGiftTip}}data-noSelectGiftTip="true"{{/if}}>去结算</a>
</div>
{{/stat}}
{{#if deleteShop}}
<div class="cart-del-goods">
<div class="cart-del-goods-title">已删除商品,您可以重新购买或移入收藏:</div>
<ul id="Y_delReselWrap">
{{#each deleteShop}}
<li data-sku="{{productSku}}"
data-promotionid="{{promotionId}}"
data-num="{{productNum}}">
<span class="good-name" style="width: 392px;">
<a href="{{link}}" target="_blank">{{productTitle}}</a>
</span>
<span class="good-price" style="width: 148px;">{{productPrice}}</span>
<span class="good-num" style="width: 128px;">{{productNum}}</span>
<span class="good-operate" style="width: 260px;">
<a href="javascript:void(0);" data-role="readd2cart">重新购买</a>
<a href="javascript:void(0);" data-role="reFav">移入收藏</a>
</span>
</li>
{{/each}}
</ul>
</div>
{{/if}}
{{> mix/cart/cart-pre-sell-tpl }}
</div>
{{/if}}
... ...
... ... @@ -3,17 +3,14 @@
*/
var $ = require('yoho-jquery'),
capi = require('./cart-api');
var rDialog = require('./rdialog');
var RConfirm = rDialog.RConfirm;
var RAlert = rDialog.RAlert;
var Cart;
rDialog = require('./rdialog'),
RConfirm = rDialog.RConfirm,
RAlert = rDialog.RAlert,
capi = require('./cart-api'),
Cart;
var $cartnewTips = $('.cartnew-tips'),
$payWapper = $('.pay-wapper'),
$cartnewSum = $('.cartnew-sum');
$cartListWrap = $('#Y_CartListWrap');
// 关闭温馨提示
$cartnewTips.find('.btn_close').click(function() {
... ... @@ -22,7 +19,7 @@ $cartnewTips.find('.btn_close').click(function() {
// 滚动到第一个选中的商品
/* function scrollToFirst() {
var $selected = $payWapper.find('li[data-role="pitem"] .cart-item-check.cart-item-checked:eq(0)');
var $selected = $cartListWrap.find('li[data-role="pitem"] .cart-item-check.cart-item-checked:eq(0)');
var top = 0;
if ($selected.length > 0) {
... ... @@ -60,11 +57,11 @@ Cart = {
return;
}
$this.toggleClass('cart-item-checked');
// $this.toggleClass('cart-item-checked');
item = {
product_sku: $pitem.data('id'),
selected: $this.hasClass('cart-item-checked') ? 'Y' : 'N',
selected: $this.hasClass('cart-item-checked') ? 'N' : 'Y', // 'Y' : 'N',
buy_number: $pitem.data('productnum'),
goods_type: $pitem.data('goodstype'),
promotion_id: $pitem.data('promotionid') ? $pitem.data('promotionid') : 0
... ... @@ -77,12 +74,12 @@ Cart = {
var $this = $(this);
var selected;
var selectArray = [];
var $noStores = $payWapper.find('[data-role=cart-item-check][data-tipnostore]');
var $noStores = $cartListWrap.find('[data-role=cart-item-check][data-tipnostore]');
$this.toggleClass('cart-item-checked');
selected = $this.hasClass('cart-item-checked') ? 'Y' : 'N';
$payWapper.find('li[data-role=pitem]').each(function() {
$cartListWrap.find('li[data-role=pitem]').each(function() {
var $t = $(this);
if ($t.data('id')) {
... ... @@ -153,7 +150,7 @@ Cart = {
var PromotionArray = [];
var content = '<div><i class="iconfont">&#xe684;</i>删除商品</div><p>确定从购物车中删除所有选中商品?</p>'; //eslint-disable-line
$payWapper.find('[data-role=cart-item-check]').each(function() {
$cartListWrap.find('[data-role=cart-item-check]').each(function() {
var $chk = $(this);
var $item = $chk.closest('[data-role=pitem]');
... ... @@ -194,7 +191,7 @@ Cart = {
var selectArray = [];
var PromotionArray = [];
$payWapper.find('.tr-disabled[data-role=pitem]').each(function() {
$cartListWrap.find('.tr-disabled[data-role=pitem]').each(function() {
var $item = $(this);
... ... @@ -252,7 +249,7 @@ Cart = {
var selectArray = [];
$payWapper.find('[data-role=cart-item-check]').each(function() {
$cartListWrap.find('[data-role=cart-item-check]').each(function() {
var $chk = $(this);
var $item = $chk.closest('li[data-role=pitem]');
... ... @@ -403,19 +400,27 @@ Cart = {
}
};
$payWapper.on('click', 'li[data-role="pitem"] .cart-item-check', Cart.toggleSelectOne); // 单选
$payWapper.on('click', '[data-role=cart-del-btn]', Cart.del); // 删除商品
$payWapper.on('click', '[data-role=cart-mov2fav-btn]', Cart.toFav); // 移入收藏夹
$payWapper.on('click', '.minus, .plus', Cart.modNum); // 修改购物车数量
$payWapper.on('click', '.cart-title .cart-item-check', Cart.toggleSelectAll); // 全选
$cartnewSum.on('click', '.cart-item-check', Cart.toggleSelectAll); // 全选
$cartnewSum.on('click', '.delete-all-sel', Cart.delAll); // 批量删除商品
$cartnewSum.on('click', '.remove-all-2fav', Cart.toFavAll); // 批量移入收藏夹商品
$cartnewSum.on('click', '.clean-all-disable', Cart.cleanAllDisable);
$('#Y_SubmitBtn').on('click', Cart.submit); // 结算
$cartListWrap.on('click', 'li[data-role="pitem"] .cart-item-check', Cart.toggleSelectOne); // 单选
$cartListWrap.on('click', '[data-role=cart-del-btn]', Cart.del); // 删除商品
$cartListWrap.on('click', '[data-role=cart-mov2fav-btn]', Cart.toFav); // 移入收藏夹
$cartListWrap.on('click', '.minus, .plus', Cart.modNum); // 修改购物车数量
$cartListWrap.on('click', '.cart-title .cart-item-check', Cart.toggleSelectAll); // 全选
$cartListWrap.on('click', '.cartnew-sum .cart-item-check', Cart.toggleSelectAll); // 全选
$cartListWrap.on('click', '.cartnew-sum .delete-all-sel', Cart.delAll); // 批量删除商品
$cartListWrap.on('click', '.cartnew-sum .remove-all-2fav', Cart.toFavAll); // 批量移入收藏夹商品
$cartListWrap.on('click', '.cartnew-sum .clean-all-disable', Cart.cleanAllDisable);
$cartListWrap.on('click', '#Y_SubmitBtn', Cart.submit); // 结算
// 重新加入购物车
$('#Y_delReselWrap').on('click', '[data-role=readd2cart]', Cart.reAdd2Cart);
$('#Y_delReselWrap').on('click', '[data-role=reFav]', Cart.reFav);
$cartListWrap.on('click', '#Y_delReselWrap [data-role=readd2cart]', Cart.reAdd2Cart);
$cartListWrap.on('click', '#Y_delReselWrap [data-role=reFav]', Cart.reFav);
// 商品子优惠显示和隐藏
$cartListWrap.on('mouseenter', '.sale-info', function() {
$(this).addClass('active').children('ul').removeClass('none');
});
$cartListWrap.on('mouseleave', '.sale-info', function() {
$(this).removeClass('active').children('ul').addClass('none');
});
module.exports = Cart;
... ...
/**
* Created by yoho on 2017-01-05.
*/
var $ = require('yoho-jquery');
var dialog = require('../common/dialog');
var Dialog = dialog.Dialog;
var Alert = dialog.Alert;
var Confirm = dialog.Confirm;
var $cartnewTips = $('.cartnew-tips'),
$payWapper = $('.pay-wapper'),
$cartnewSum = $('.cartnew-sum'),
CART_ITEM_DEL_URL = '/cart/index/remove',
CART_ITEM_FAV_URL = '/cart/index/fav',
selColorWinTpl = require('hbs/cart/select-color-panel.hbs'),
giftsWinTpl = require('hbs/cart/cart-gifts-win-tpl.hbs'),
productInfoTpl = require('hbs/cart/cart-product-info-tpl.hbs'),
$goodsSelWin = $('#Y_goodsSelectWin');
// 关闭温馨提示
$cartnewTips.find('.btn_close').click(function() {
$cartnewTips.fadeOut();
});
// 滚动到第一个选中的商品
function scrollToFirst() {
var $selected = $payWapper.find('li[data-role="pitem"] .cart-item-check.cart-item-checked:eq(0)');
var top = 0;
if ($selected.length > 0) {
top = $selected.offset().top - 36;
$('html,body').scrollTop(top);
}
return false;
}
function toggleCheckAllPros() {
}
// checkbox提交ajax
function choiceOut(items) {
var skuList = $.isArray(items) ? items : [items];
var hasPromotion = false;
$.each(skuList, function(idx, it) {
if (it.promotion_id) {
hasPromotion = true;
return false;
}
});
return $.ajax({
type: 'POST',
dataType: 'json',
url: '/cart/index/select',
data: {
skuList: JSON.stringify(skuList),
hasPromotion: hasPromotion
},
beforeSend: function() {
$('.loading').css({
top: $(document).scrollTop() + 200
});
$('.loading').show();
}
}).then(function(d) {
if (d.code === 200) {
window.history.go(0);
}
});
}
/*
* 1. 删除购物车商品,把删除的商品移入cookie中
* 2. 移到收藏夹
* data: 数据
* tpe: true - 删除,默认 移入收藏夹
*/
function cartItemDel(items, type, cookieList) {
var selList = $.isArray(items) ? items : [items];
var hasPromotion = false;
$.each(selList, function(idx, it) {
if (it.promotion_id) {
hasPromotion = true;
return false;
}
});
return $.ajax({
type: 'POST',
dataType: 'json',
url: type === true ? CART_ITEM_DEL_URL : CART_ITEM_FAV_URL,
data: {
skuList: JSON.stringify(selList),
hasPromotion: hasPromotion
},
beforeSend: function() {
$('.loading').css({
top: $(document).scrollTop() + 200
});
$('.loading').show();
}
}).then(function(d) {
if (d.code === 200) {
if (cookieList) {
window.setCookie('cart-del-list', JSON.stringify(cookieList), {
domain: '.yohobuy.com',
path: '/'
});
}
window.history.go(0);
} else if (d.code === 300) {
$('.loading').hide();
new Alert(d.message).show();
} else if (d.code === 403) {
if (d.data.url) {
window.location = d.data.url;
}
}
});
}
// 购物车商品增减
var cartItemNumChg = (function(data) {
var countBusy = false; // 保证一次只请求完成前不能再次发起
return function(data) {
if (countBusy) {
return;
}
countBusy = true;
$.ajax({
type: 'POST',
dataType: 'json',
url: '/cart/index/modifyNum',
data: data
}).then(function(d) {
if (d.code === 200) {
window.history.go(0);
} else {
new Alert(d.message === '' ? '加入购物车失败哦~~' : d.message).show();
}
countBusy = false;
});
};
})();
function getProductInfo(pid, skn) {
return $.ajax({
type: 'GET',
url: '/cart/index/getProductData', // '/product/item/getProductInfo',
data: {
productId: pid,
skn: skn
}
}).done(function(res) {
return res;
});
}
// 根据id获取商品信息
function getProductHtmlInfo(productId) {
return $.ajax({
type: 'GET',
dataType: 'html',
url: '/cart/index/getProductInfo',
data: {
productId: productId
}
}).then(function(d) {
return d;
/* pacList = 0;
$goodsDetail.html(' ');
$goodsDetail.append(d);
$goodsDetail.show();
$('.detail-bigpic:not(.none) .con li:first').addClass('active');
if ($('.showSizeBox:not(.none) span').length < 2) {
$('.showSizeBox:not(.none) span:first').addClass('atcive');
}
if (Number($('#addToCart').val()) !== 1) {
$('.showSizeBox span').data('num', 0);
}
$.each($('.showSizeBox span'), function() {
if ($(this).data('num') <= 0) {
$(this).addClass('null-atcivec');
console.log($('.showSizeBox:not(.none) span:first'));
$('.showSizeBox:not(.none) span:first').removeClass('atcive');
}
});
if (typeof promotionPrice !== 'undefined') {
oldprice = $('.detail-info .oldprice del').html() ? $('.detail-info .oldprice del').html() : wapperPrice;
htmlInfo = '<span class="oldprice">现价:<del>' + oldprice + '</del></span>' +
'<span class="newprice">活动价:<b class="promotion-price">' + promotionPrice + '</b></span>';
$('.detail-info .price').html(htmlInfo);
}
$('.detail-bigpic:not(.none) .bigpic:gt(0)').hide();
$('.showSizeBox:not(.none)').find('span').each(function() {
if ($(this).hasClass('null-atcivec')) {
$('.addcart').addClass('none');
$('.btn_sellout').removeClass('none');
} else {
$('.addcart').removeClass('none');
$('.btn_sellout').addClass('none');
return false;
}
});*/
});
}
// 加入购物车,弹出框中加入购物车
function addcart(data, cookieList) {
$.ajax({
type: 'POST',
url: '/cart/index/add',
data: data
}).then(function(d) {
if (d.code === 200) {
window.history.go(0);
if (cookieList) {
window.setCookie('cart-del-list', JSON.stringify(cookieList), {
domain: '.yohobuy.com',
path: '/'
});
}
} else {
new Alert(d.message === '' ? '加入购物车失败哦~~' : d.message).show();
}
});
}
function parseProductInfo(productInfo, defaultInfo) {
var index = 0;
var colors;
var colorsLen;
var color;
// 前端处理后的集合
var filterSet = [];
var sizeIdx;
var curColor;
var curSize;
var hasActiveColor = false;
var defaultColor = defaultInfo.color;
var defaultSize = defaultInfo.size;
var defaultImg;
// 没有res.code
if (productInfo.colors) {
// 获取成功
colors = productInfo.colors;
colorsLen = colors.length;
for (index; index < colorsLen; index++) {
color = colors[index];
// 迭代每一种颜色
filterSet.push({
pid: productInfo.productId,
skn: productInfo.skn,
name: color.name,
src: color.src,
focus: color.focus,
title: color.title,
sizes: color.size,
pic: color.thumbs[0].shower,
selectable: color.total > 0
});
}
}
// 默认选中用户选择的sku,若已售罄或下架,则选中列表中第一个非售罄的sku
for (index = 0; index < filterSet.length; index++) {
curColor = filterSet[index];
if (!hasActiveColor && String(curColor.name) === String(defaultInfo.color)) {
curColor.active = true;
curColor.hasActiveColor = hasActiveColor = true;
defaultImg = curColor.pic;
}
curSize = curColor.sizes;
for (sizeIdx = 0; sizeIdx < curSize.length; sizeIdx++) {
if (curColor.hasActiveColor && curSize[sizeIdx].sku === defaultInfo.sku) {
// console.log(curSize[sizeIdx]);
curSize[sizeIdx].sizeActive = true;
break;
}
}
}
// 若无对应颜色,则选中第一个颜色
if (!hasActiveColor) {
filterSet[0].active = true;
defaultColor = filterSet[0].color;
defaultImg = filterSet[0].pic;
}
return {
skn: productInfo.skn,
colors: filterSet,
defaultColor: defaultColor,
defaultSize: defaultSize,
defaultImg: defaultImg
};
}
function updateCartItem(newSku, oldSku) {
$.ajax({
type: 'POST',
url: '/cart/index/updateProduct',
data: {
swapData: JSON.stringify([{
buy_number: '1',
selected: 'Y',
new_product_sku: newSku,
old_product_sku: oldSku
}])
}
}).then(function(d) {
if (d.code === 200) {
window.history.go(0);
} else {
new Alert(d.message === '' ? '修改商品失败哦~~' : d.message).show();
}
});
}
function updateCartGiftItem(promotionId, newSkn, newSku) {
$.ajax({
type: 'POST',
url: '/cart/index/swapGift',
data: {
promotionId: promotionId,
newSkn: newSkn,
newSku: newSku
}
}).then(function(d) {
if (d.code === 200) {
window.history.go(0);
} else {
new Alert(d.message === '' ? '修改商品失败哦~~' : d.message).show();
}
});
}
function renderAndShowSelWin($item, pinfo) {
$item.find('.goods-choose-box').remove();
var $selWin = $(selColorWinTpl(pinfo)).appendTo($item);
$selWin.show();
}
function getProductByPromotionId(promotionId) {
return $.ajax({
type: 'GET',
url: '/cart/index/queryPromotionGift',
data: {
promotionId: promotionId
}
}).done(function(res) {
return res;
});
}
function renderAndShowGiftWin(plist) {
$goodsSelWin.find('.content').empty().html(giftsWinTpl(plist));
$goodsSelWin.show();
/* var d = new Dialog({
content: giftsWinTpl(plist),
className: 'cart-togetherGoods'
});
d.show();*/
// bindGiftWinAction(d.$el);
}
var Cart = {
addToCart: function(params) {
},
toggleSelectOne: function() { // 单选
var $this = $(this);
var $pitem = $this.closest('li[data-role="pitem"]');
var item;
$this.toggleClass('cart-item-checked');
item = {
product_sku: $pitem.data('id'),
selected: $this.hasClass('cart-item-checked') ? 'Y' : 'N',
buy_number: $pitem.data('productnum'),
goods_type: $pitem.data('goodstype'),
promotion_id: $pitem.data('promotionid') ? $pitem.data('promotionid') : 0
};
return choiceOut(item);
},
toggleSelectAll: function() { // 全选
var $this = $(this);
var selected = $this.hasClass('cart-item-checked') ? 'Y' : 'N';
var selectArray = [];
$payWapper.find('.cart-item-check').each(function() {
var $t = $(this);
if ($t.data('id')) {
selectArray.push({
product_sku: $t.data('id'),
selected: selected,
buy_number: $t.data('productnum'),
goods_type: $t.data('goodstype'),
promotion_id: $t.data('promotionid') || 0
});
}
});
choiceOut(selectArray);
},
del: function() {
var $this = $(this);
var $item = $this.closest('li[data-role="pitem"]');
var selectArray = [];
var content = '<div><span></span>删除商品</div><p>确定从购物车中删除此商品?</p>';
var countJSON;
selectArray.push({
product_sku: $item.data('id'),
buy_number: $item.data('productnum'),
promotion_id: $item.data('promotionid') || 0
});
if (!$this.data('gift')) {
countJSON = {
productPrice: $item.find('.productPrice').text(),
productTitle: $item.find('.pay-pro-info a').text(),
link: $item.find('.pay-pro-info a').attr('href'),
productNum: $item.data('productnum'),
productSku: $item.data('id'),
promotionId: $item.data('promotionid')
};
}
new Confirm({
content: content,
cb: function() {
cartItemDel(selectArray, true, countJSON);
}
}).show();
},
delAll: function() {
var selectArray = [];
var PromotionArray = [];
var content = '<div><span></span>删除商品</div><p>确定从购物车中删除所有选中商品?</p>';
$payWapper.find('.cart-item-check').each(function() {
var $item = $(this);
var $chk = $item.find('.cart-item-check');
if ($chk.hasClass('cart-item-checked')) {
if ($item.data('id')) {
selectArray.push({
product_sku: $item.data('id'),
buy_number: $item.data('productnum'),
promotion_id: $item.data('promotionid') || 0
});
PromotionArray.push({
productPrice: $item.find('.productPrice').text(),
productTitle: $item.find('.pay-pro-info a').text(),
link: $item.find('.pay-pro-info a').attr('href'),
productNum: $item.data('productnum'),
productSku: $item.data('id'),
promotionId: $item.data('promotionid')
});
}
}
});
if (!$.isEmptyObject(selectArray)) {
new Confirm({
content: content,
cb: function() {
cartItemDel(selectArray, true, PromotionArray);
}
}).show();
} else {
new Alert('请至少选择一件商品').show();
}
},
toFav: function() {
var $this = $(this);
var $item = $this.closest('li[data-role="pitem"]');
var item = {
product_sku: $item.data('id'),
buy_number: $item.data('productnum'),
promotion_id: $item.data('promotionid') ? $item.data('promotionid') : 0
};
cartItemDel(item);
},
toFavAll: function() {
var selectArray = [];
$payWapper.find('.cart-item-check').each(function() {
var $item = $(this);
var $chk = $item.find('.cart-item-check');
if ($chk.hasClass('cart-item-checked')) {
if ($item.data('id')) {
selectArray.push({
product_sku: $(this).data('id'),
buy_number: $(this).data('productnum'),
promotion_id: $item.data('promotionid') || 0
});
}
}
});
if (!$.isEmptyObject(selectArray)) {
cartItemDel(selectArray);
} else {
new Alert('请至少选择一件商品').show();
}
},
modNum: function() {
var $this = $(this);
var countJSON = {};
var oprType = $this.hasClass('minus') ? 'decreaseNum' : 'increaseNum';
countJSON[oprType] = 1;
if ($this.siblings('input').val() === '1' && $this.hasClass('minus')) {
return false;
}
cartItemNumChg($.extend(countJSON, {
sku: $this.closest('li[data-role="pitem"]').data('id')
}));
},
cleanAllDisable: function() {
var selectArray = [];
var PromotionArray = [];
var content = '<div><span></span>删除商品</div><p>确定从购物车中删除所有选中商品?</p>';
$payWapper.find('.cart-item-check').each(function() {
var $item = $(this);
var $chk = $item.find('.cart-item-check');
if ($chk.hasClass('cart-item-checked')) {
if ($item.data('id')) {
selectArray.push({
product_sku: $item.data('id'),
buy_number: $item.data('productnum'),
promotion_id: $item.data('promotionid') || 0
});
PromotionArray.push({
productPrice: $item.find('.productPrice').text(),
productTitle: $item.find('.pay-pro-info a').text(),
link: $item.find('.pay-pro-info a').attr('href'),
productNum: $item.data('productnum'),
productSku: $item.data('id'),
promotionId: $item.data('promotionid')
});
}
}
});
if (!$.isEmptyObject(selectArray)) {
new Confirm({
content: content,
cb: function() {
cartItemDel(selectArray, true, PromotionArray);
}
}).show();
} else {
new Alert('请至少选择一件商品').show();
}
},
showColorSizePanel: function() {
var $this = $(this);
var $item = $this.closest('li[data-role="pitem"]');
var pinfo = $this.data('_p_info');
var $selWin = $item.find('.goods-choose-box');
var pid = $item.data('pid');
var skn = $item.data('skn');
var sku = $item.data('id');
var defaultInfo = {
color: $item.data('color'),
size: $item.data('size'),
pid: pid,
sku: sku,
skn: skn
};
$payWapper.find('.pay-pro-detail').removeClass('active');
if ($selWin && $selWin.length && $selWin.is(':visible')) {
$selWin.hide();
return;
}
$item.find('.pay-pro-detail').addClass('active');
$payWapper.find('.goods-choose-box').hide();
if (!pinfo) {
getProductInfo(pid, skn).done(function(productInfo) {
pinfo = parseProductInfo(productInfo, defaultInfo);
$this.data('_p_info', pinfo);
renderAndShowSelWin($item, pinfo);
}).fail(function() {
new Alert('此商品无法编辑颜色和尺寸').show();
});
return;
}
renderAndShowSelWin($item, pinfo);
},
editColorOrSize: function() {
var $this = $(this);
var $item = $this.closest('li[data-role="pitem"]');
var pid = $item.data('pid');
var oldSku = $item.data('id');
var $size = $this.closest('.goods-choose-box').find('.choose-size .dt.active');
var newSku = $size.data('sku');
var newSkn = $this.closest('.goods-info').data('skn');
var promotionId = $item.data('promotionid');
// 没有重新选择颜色-尺码,则不用重新请求显示
if (!oldSku || !newSku || oldSku === newSku) {
Cart._hideColorSizePanel($item);
return false;
}
// 加价购更换
if ($item.data('isgift') || $item.data('ispricegift')) {
return updateCartGiftItem(promotionId, newSkn, newSku);
}
updateCartItem(newSku, oldSku);
},
_hideColorSizePanel: function($item) {
$item.find('.goods-choose-box').hide();
$item.find('.pay-pro-detail').removeClass('active');
},
hideColorSizePanel: function(event) {
var $this = $(this);
event.stopPropagation();
Cart._hideColorSizePanel($this.closest('li[data-role="pitem"]'));
},
selectColor: function() {
var $this = $(this);
var index = $this.index($this.parent().find('.dt'));
var $srows = $this.closest('.goods-info').find('.choose-size .size-row');
var $bigImgs = $this.closest('.goods-choose-box').find('.goods-info-bigImg .bigImg');
if ($this.hasClass('active')) return;
$this.siblings('.dt').removeClass('active');
$this.addClass('active');
$srows.find('.dt').removeClass('active');
$srows.addClass('hide');
$srows.eq(index).removeClass('hide');
$bigImgs.addClass('hide');
$bigImgs.eq(index).removeClass('hide');
},
selectSize: function() {
var $this = $(this);
$this.siblings('.dt').removeClass('active');
$this.addClass('active');
},
showGiftWin: function() {
var $this = $(this);
var $wrap = $this.closest('[data-role="promotion-wrap"]');
var promotionid = $wrap.data('promotionid');
var promotionInfo = $wrap.data('_promotionInfo');
var role = $this.data('role');
var isSwap = role === 'pg-resel-btn' || role === 'gift-resel-btn';
if (!promotionInfo) {
getProductByPromotionId(promotionid).done(function(pinfo) {
if (!pinfo && pinfo.code !== 200) {
return new Alert('获取商品失败,请稍后再试!').show();
}
promotionInfo = pinfo.data;
promotionInfo.isSwap = isSwap;
$wrap.data('_promotionInfo', promotionInfo);
renderAndShowGiftWin(promotionInfo);
}).fail(function() {
new Alert('获取商品失败,请稍后再试!').show();
});
return;
}
renderAndShowGiftWin(promotionInfo);
},
submit: function() {
/* understock = '';
if ($('.pay-wapper input:checked').parents('tr').find('.tipNoStore').length > 0) {
shopName = $('.pay-wapper input:checked').parents('tr').find('.tipNoStore');
$.each(shopName.parents('tr').find('.pay-pro-info a'), function() {
understock += $(this).html();
});
new Alert(understock + '库存不足').show();
} else {
if ($('.zp').length > 0 && !$(this).attr('title')) {
$(this).attr('title', '1');
new Alert('您有赠品没有选择,请选择完再结算!').show();
} else {
if ($('input:checked').length > 0) {
// 添加埋点
var productId = [];
$('.pay-wapper input:checked').parents('tr').each(function() {
if ($(this).attr('data-pid')) {
productId.push($(this).attr('data-pid'));
}
});
// 结算点击埋点
window.addPoint('YB_SC_TOBUY_CLICK', {PRD_ID: productId.join(',')});
if ($('.pre-sell-box input:checked').length > 0) {
window.location.href = '/cart/index/orderEnsure?type=2';
} else {
window.location.href = '/cart/index/orderEnsure?type=1';
}
} else {
new Alert('请至少选择一件商品').show();
}
}
}*/
}
};
module.exports = Cart;
$payWapper.one('click', 'li[data-role="pitem"] .cart-item-check', Cart.toggleSelectOne); // 单选
$cartnewSum.one('click', '.cart-item-check', Cart.toggleSelectAll); // 全选
$payWapper.on('click', '.cart-del-btn', Cart.del); // 删除商品
$cartnewSum.on('click', '.delAll', Cart.delAll); // 批量删除商品
$payWapper.on('click', '.cart-remove-btn', Cart.toFav); // 移入收藏夹
$cartnewSum.on('click', '.removeAll', Cart.toFavAll); // 批量移入收藏夹商品
$payWapper.on('click', '.minus, .plus', Cart.modNum); // 修改购物车数量
$cartnewSum.on('click', '.clean-all-disable', Cart.cleanAllDisable);
$('.btn_account').on('click', Cart.submit); // 结算
/** 重新选择商品颜色尺码 **/
$payWapper.on('click', 'li[data-role="pitem"] .pay-pro-detail', Cart.showColorSizePanel);
$payWapper.on('click', 'li[data-role="pitem"] .button-cancel', Cart.hideColorSizePanel);
$payWapper.on('click', 'li[data-role="pitem"] .button-sure', Cart.editColorOrSize);
$payWapper.find('li[data-role="pitem"]').on('click', '.goods-choose-box .choose-color .dt', Cart.selectColor);
$payWapper.find('li[data-role="pitem"]').on('click', '.goods-choose-box .choose-size .dt', Cart.selectSize);
/** 赠品加价购弹窗 **/
// 显示赠品
var giftBtn = ['[data-role=gift-view-btn]',
'[data-role=gift-resel-btn]',
'[data-role=gift-sel-btn]',
'[data-role=pg-sel-btn]',
'[data-role=pg-resel-btn]'];
$payWapper./* find('li[data-role="pitem"]').*/on('click', giftBtn.join(','), Cart.showGiftWin);
/*
$('.shop-cart').on('click', giftBtn.join(','), function() {
var $this = $(this);
var $win = $this.closest('[data-role=promotion-wrap]').find('[data-role=cart-gift-win]');
console.log($win.length);
$win.show();
});
$('.shop-cart').on('click', '[data-role="cart-gift-win"] .close', function() {
$(this).closest('[data-role="cart-gift-win"]').hide();
});*/
var GoodsWinAction = {
closeWin: function() {
// console.log($goodsSelWin);
$goodsSelWin.hide();
},
changeGoods: function() {
var $this = $(this);
var id = $this.data('id');
var skn = $this.data('skn');
$this.sibling('li').removeClass('active');
$this.addClass('active');
getProductInfo(id, skn).then(res => {
$goodsSelWin.find('.product-detail-info').empty().append(productInfoTpl(res));
});
},
selThumb: function() {
var $this = $(this);
var idx = $(this).index();
$goodsSelWin.find('.detail-bigpic:not(.none) .piclist li').removeClass('active');
$this.addClass('active');
$goodsSelWin.find('.detail-bigpic:not(.none) .bigpic').hide().eq(idx).show();
},
selThumbPrevNext: function() {
var $this = $(this);
var $detailBigpic = $this.closest('.detail-bigpic');
var curIndex = Number($detailBigpic.data('_index') || 0);
var $lis = $this.siblings('.con').find('li');
if ($this.hasClass('next')) {
if (curIndex >= $lis.length - 1) {
return false;
}
curIndex++;
} else {
if (curIndex < 1) {
return false;
}
curIndex--;
}
$detailBigpic.data('_index', curIndex);
$lis.removeClass('active').eq(curIndex).addClass('active');
$detailBigpic.find('.bigpic').hide().eq(curIndex).show();
},
selColor: function() {
var $this = $(this);
var idx = $this.index();
var $detail = $this.closest('.detail-goods');
var $sizes = $detail.find('[data-role=sizes] .size-row');
var $detailBigpic = $detail.find('.detail-bigpic');
var $curSize = $sizes.eq(idx);
var $curDetailBig = $detailBigpic.eq(idx);
var bigPicIndex = 0; // 默认显示大图中的第一个图
$curDetailBig.data('_index', bigPicIndex);
$this.siblings('.color').find('p').removeClass('active');
$this.find('p').addClass('active');
$sizes.addClass('none');
$curSize.removeClass('none');
if ($curSize.find('span').length < 2) {
$curSize.find('span:first').addClass('active');
}
$detailBigpic.addClass('none');
$curDetailBig.removeClass('none');
$curDetailBig.find('.bigpic').hide();
$curDetailBig.find('.bigpic').eq(bigPicIndex).show();
$curDetailBig.find('.con li').removeClass('active');
$curDetailBig.find('.con li').eq(bigPicIndex).addClass('active');
$sizes.eq(idx).find('span').each(function() {
if ($(this).hasClass('null-atcivec')) {
$goodsSelWin.find('.addcart').addClass('none');
$goodsSelWin.find('.btn_sellout').removeClass('none');
} else {
$goodsSelWin.find('.addcart').removeClass('none');
$goodsSelWin.find('.btn_sellout').addClass('none');
return false;
}
});
},
selSize: function() {
var $this = $(this);
// var idx = $this.index();
var shopNumAll = $this.data('num');
$this.siblings('span').removeClass('active');
$this.addClass('active');
if (shopNumAll > 0) {
$goodsSelWin.find('.addcart').removeClass('none');
$goodsSelWin.find('.btn_sellout').addClass('none');
} else {
$goodsSelWin.find('.addcart').addClass('none');
$goodsSelWin.find('.btn_sellout').removeClass('none');
}
},
changeNum: function() {
var $this = $(this);
var $pinfo = $this.closest('.product-detail-info');
// var count = $this.hasClass('minus') ? 'decreaseNum' : 'increaseNum';
var promotionId = $pinfo.data('promotionid');
var $num = $goodsSelWin.find('#num');
var shopNum = Number($num.val() || 1);
if (promotionId) {
if ($this.hasClass('cut')) {
new Alert('-_-,已经是最后一件,不能再减了!').show();
} else {
new Alert('最多只能购买一件,您好像购买的太多了!').show();
}
} else {
if ($this.hasClass('add')) {
shopNum++;
} else {
shopNum--;
}
if (shopNum < 1) {
new Alert('-_-,已经是最后一件,不能在减了!').show();
shopNum = 1;
return false;
}
$num.val(shopNum);
}
},
add2Cart: function() {
var $this = $(this);
var $curSize = $goodsSelWin.find('[data-role=sizes] .size-row:not(.none) .active');
var $num = $goodsSelWin.find('#num');
var allNum = $curSize.data('num');
var sku = $curSize.data('sku');
var promotionId = $this.closest('.product-detail-info').data('promotionid') || 0;
var isSwap = $this.closest('.product-detail-info').data('swap');
if ($curSize.length <= 0) {
new Alert('请选择尺码').show();
return false;
}
if ($num.val() > allNum) {
new Alert('库存不足,目前还有' + allNum + '个库存').show();
} else {
/* if (Number($('#addToCart').val()) === 1) {
addcart(dataJSON);
} else {
new Alert('该商品无法加入购物车').show();
}*/
// 替换促销商品
if (isSwap) {
updateCartGiftItem(promotionId, newSkn, sku);
} else {
addcart({
productSku: sku,
buyNumber: $num.val(),
promotionId: promotionId
});
}
}
}
};
/** 弹窗事件绑定 **/
$goodsSelWin.on('click', '.close', GoodsWinAction.closeWin);
$goodsSelWin.on('click', '.slide-img .img-list .img-item', GoodsWinAction.changeGoods);
$goodsSelWin.on('click', '.piclist li', GoodsWinAction.selThumb);
$goodsSelWin.on('click', '.pre, .next', GoodsWinAction.selThumbPrevNext);
$goodsSelWin.on('click', '[data-role=colors] .color', GoodsWinAction.selColor);
$goodsSelWin.on('click', '[data-role=sizes] .size-row span', GoodsWinAction.selSize);
$goodsSelWin.on('click', '.cut, .add', GoodsWinAction.changeNum);
$goodsSelWin.on('click', '.addcart', GoodsWinAction.add2Cart);
... ... @@ -7,7 +7,92 @@ var $ = require('yoho-jquery'),
Alert = dialog.Alert,
CART_ITEM_DEL_URL = '/cart/cart/remove',
CART_ITEM_FAV_URL = '/cart/cart/fav',
cartItemNumChg;
cartItemNumChg,
cartListTpl = require('mix/cart/cart-list.hbs');
// 设置全选按钮的状态
function isCheckAll() {
var isAllCheck = true;
$('[data-role=pitem] [data-role=cart-item-check]').each(function() {
var $chk = $(this);
// 有一个没选中,跳出循环
if (!$(this).hasClass('cart-item-checked') && !$chk.data('tipnostore')) {
isAllCheck = false;
return false;
}
});
if (isAllCheck) {
// 头部全选
$('.cart-title .cart-item-check').addClass('cart-item-checked');
// 底部全选
$('#cbSelAllGoods').addClass('cart-item-checked');
}
}
// 判断商品是否已收藏,是否全选
function isCheckFav() {
var pidArray = [];
var $sellBox = $('.cart-table .pre-sell-box');
$sellBox.each(function() {
pidArray.push($(this).data('pid'));
});
$.ajax({
type: 'POST',
url: '/cart/cart/checkFav',
data: {
pidList: pidArray.join(',')
}
}).done(function(result) {
$.each(result.data, function(pid, obj) {
if (obj.code !== 200) {
return false;
}
if (obj.data) {
$sellBox.each(function() {
if (String($(this).data('pid')) === String(pid)) {
$(this).find('.cart-col-btn').addClass('has-col-btn').html('已收藏');
return false;
}
});
}
});
});
}
// 初始化全选,是否收藏等
function cartInit() {
var $itemChecked = $('[data-role=pitem] .cart-item-checked');
if ($itemChecked.length === 0) {
$('#Y_SubmitBtn').addClass('btn-account-disable');
}
$('#Y_CartSelectDialog .side-img-dd').each(function() {
$(this).slider2({
shownum: 5,
isCircle: true
});
});
isCheckAll();
isCheckFav();
}
function refreshCart(data) {
$('#Y_CartListWrap').html(cartListTpl(data));
cartInit();
}
// checkbox提交ajax
function choiceOut(items) {
... ... @@ -39,8 +124,11 @@ function choiceOut(items) {
}
}).then(function(d) {
if (d.code === 200) {
window.history.go(0);
// window.history.go(0);
refreshCart(d.data);
}
}).always(function() {
$('.loading').hide();
});
}
... ... @@ -68,7 +156,8 @@ function cartItemDel(items, type, cookieList) {
url: type === true ? CART_ITEM_DEL_URL : CART_ITEM_FAV_URL,
data: {
skuList: JSON.stringify(selList),
hasPromotion: hasPromotion
hasPromotion: hasPromotion,
cartDelList: JSON.stringify(cookieList)
},
beforeSend: function() {
$('.loading').css({
... ... @@ -78,21 +167,23 @@ function cartItemDel(items, type, cookieList) {
}
}).then(function(d) {
if (d.code === 200) {
if (cookieList) {
/* if (cookieList) {
window.setCookie('cart-del-list', JSON.stringify(cookieList), {
domain: '.yohobuy.com',
path: '/'
});
}
window.history.go(0);
}*/
// window.history.go(0);
refreshCart(d.data);
} else if (d.code === 300) {
$('.loading').hide();
new Alert(d.message).show();
} else if (d.code === 403) {
if (d.data.url) {
window.location = d.data.url;
}
}
}).always(function() {
$('.loading').hide();
});
}
... ... @@ -116,7 +207,8 @@ cartItemNumChg = (function() {
}).then(function(d) {
if (d.code === 200) {
window.history.go(0);
// window.history.go(0);
refreshCart(d.data);
} else {
new Alert(d.message === '' ? '加入购物车失败哦~~' : d.message).show();
}
... ... @@ -140,13 +232,14 @@ function getProductInfo(pid, skn) {
// 加入购物车,弹出框中加入购物车
function addcart(data, cookieList) {
$.ajax({
return $.ajax({
type: 'POST',
url: '/cart/cart/add',
data: data
}).then(function(d) {
if (d.code === 200) {
window.history.go(0);
// window.history.go(0);
refreshCart(d.data);
if (cookieList) {
window.setCookie('cart-del-list', JSON.stringify(cookieList), {
domain: '.yohobuy.com',
... ... @@ -241,7 +334,7 @@ function parseProductInfo(productInfo, defaultInfo) {
function updateCartItem(newSku, oldSku) {
$.ajax({
return $.ajax({
type: 'POST',
url: '/cart/cart/updateProduct',
data: {
... ... @@ -254,7 +347,8 @@ function updateCartItem(newSku, oldSku) {
}
}).then(function(d) {
if (d.code === 200) {
window.history.go(0);
// window.history.go(0);
$('#Y_CartListWrap').html(cartListTpl(d.data));
} else {
new Alert(d.message === '' ? '修改商品失败哦~~' : d.message).show();
}
... ... @@ -263,7 +357,7 @@ function updateCartItem(newSku, oldSku) {
function updateCartGiftItem(promotionId, newSkn, newSku) {
$.ajax({
return $.ajax({
type: 'POST',
url: '/cart/cart/swapGift',
data: {
... ... @@ -273,7 +367,8 @@ function updateCartGiftItem(promotionId, newSkn, newSku) {
}
}).then(function(d) {
if (d.code === 200) {
window.history.go(0);
// window.history.go(0);
$('#Y_CartListWrap').html(cartListTpl(d.data));
} else {
new Alert(d.message === '' ? '修改商品失败哦~~' : d.message).show();
}
... ... @@ -421,5 +516,6 @@ module.exports = {
getTogetherProduct: getTogetherProduct,
showMDialog: showMDialog,
hideMDialog: hideMDialog,
productCollect: productCollect
productCollect: productCollect,
cartInit: cartInit
};
... ...
... ... @@ -6,7 +6,7 @@ var $ = require('yoho-jquery'),
capi = require('./cart-api'),
dialog = require('../common/dialog'),
Alert = dialog.Alert,
$payWapper = $('.pay-wapper'),
$cartListWrap = $('#Y_CartListWrap'),
selColorWinTpl = require('hbs/cart/select-color-panel.hbs'),
ColorPanelAction;
... ... @@ -42,7 +42,7 @@ ColorPanelAction = {
skn: skn
};
$payWapper.find('.pay-pro-detail').removeClass('active');
$cartListWrap.find('.pay-pro-detail').removeClass('active');
if ($selWin && $selWin.length && $selWin.is(':visible')) {
$selWin.hide();
... ... @@ -50,7 +50,7 @@ ColorPanelAction = {
}
$item.find('.pay-pro-detail').addClass('active');
$payWapper.find('.goods-choose-box').hide();
$cartListWrap.find('.goods-choose-box').hide();
if (!pinfo) {
capi.getProductInfo(pid, skn).done(function(productInfo) {
... ... @@ -134,8 +134,8 @@ ColorPanelAction = {
};
/** 重新选择商品颜色尺码 **/
$payWapper.on('click', 'li[data-role="pitem"] .pay-pro-detail', ColorPanelAction.showColorSizePanel);
$payWapper.on('click', 'li[data-role="pitem"] .button-cancel', ColorPanelAction.hideColorSizePanel);
$payWapper.on('click', 'li[data-role="pitem"] .button-sure', ColorPanelAction.editColorOrSize);
$payWapper.on('click', 'li[data-role="pitem"] .goods-choose-box .choose-color .dt', ColorPanelAction.selectColor);
$payWapper.on('click', 'li[data-role="pitem"] .goods-choose-box .choose-size .dt', ColorPanelAction.selectSize);
$cartListWrap.on('click', 'li[data-role="pitem"] .pay-pro-detail', ColorPanelAction.showColorSizePanel);
$cartListWrap.on('click', 'li[data-role="pitem"] .button-cancel', ColorPanelAction.hideColorSizePanel);
$cartListWrap.on('click', 'li[data-role="pitem"] .button-sure', ColorPanelAction.editColorOrSize);
$cartListWrap.on('click', 'li[data-role="pitem"] .goods-choose-box .choose-color .dt', ColorPanelAction.selectColor);
$cartListWrap.on('click', 'li[data-role="pitem"] .goods-choose-box .choose-size .dt', ColorPanelAction.selectSize);
... ...
... ... @@ -8,7 +8,7 @@ var $ = require('yoho-jquery'),
giftsWinTpl = require('hbs/cart/cart-gifts-win-tpl.hbs'),
productInfoTpl = require('hbs/cart/cart-product-info-tpl.hbs');
var $payWapper = $('.pay-wapper'),
var $cartListWrap = $('#Y_CartListWrap'),
$goodsSelWin = $('#Y_goodsSelectWin'),
GoodsWinAction,
... ... @@ -353,12 +353,16 @@ GoodsWinAction = {
// 替换促销商品
if (isSwap) {
capi.updateCartGiftItem(promotionId, skn, sku);
capi.updateCartGiftItem(promotionId, skn, sku).then(function() {
capi.hideMDialog('#Y_goodsSelectWinDialog');
});
} else {
capi.addcart({
productSku: sku,
buyNumber: $num.val(),
promotionId: promotionId
}).then(function() {
capi.hideMDialog('#Y_goodsSelectWinDialog');
});
}
}
... ... @@ -367,7 +371,7 @@ GoodsWinAction = {
/** 弹窗事件绑定 **/
$payWapper./* find('li[data-role="pitem"]').*/on('click', giftBtn.join(','), GoodsWinAction.showGiftWin);
$cartListWrap./* find('li[data-role="pitem"]').*/on('click', giftBtn.join(','), GoodsWinAction.showGiftWin);
// $goodsSelWin.on('click', '.close', GoodsWinAction.closeWin);
$goodsSelWin.on('click', '.slide-img .img-list .img-item', GoodsWinAction.changeGoods);
... ...
... ... @@ -5,103 +5,16 @@
*/
var $ = require('yoho-jquery'),
$sellBox = $('.cart-table .pre-sell-box');
capi = require('./cart-api');
require('../plugins/slider');
require('../common/center-slider');
require('../common');
require('../simple-header');
function isCheckAll() {
var isAllCheck = true;
$('[data-role=pitem] [data-role=cart-item-check]').each(function() {
var $chk = $(this);
// 有一个没选中,跳出循环
if (!$(this).hasClass('cart-item-checked') && !$chk.data('tipnostore')) {
isAllCheck = false;
return false;
}
});
if (isAllCheck) {
// 头部全选
$('.cart-title .cart-item-check').addClass('cart-item-checked');
// 底部全选
$('#cbSelAllGoods').addClass('cart-item-checked');
}
}
// 判断商品是否已收藏,是否全选
function isCheckFav() {
var pidArray = [];
$sellBox.each(function() {
pidArray.push($(this).data('pid'));
});
$.ajax({
type: 'POST',
url: '/cart/cart/checkFav',
data: {
pidList: pidArray.join(',')
}
}).done(function(result) {
$.each(result.data, function(pid, obj) {
if (obj.code !== 200) {
return false;
}
if (obj.data) {
$sellBox.each(function() {
if (String($(this).data('pid')) === String(pid)) {
$(this).find('.cart-col-btn').addClass('has-col-btn').html('已收藏');
return false;
}
});
}
});
});
}
$(function() {
var $itemChecked = $('[data-role=pitem] .cart-item-checked');
$('.bottom-tab .change').click(function() {
$('.img-brand-switch .next').trigger('click');
});
// 商品子优惠显示和隐藏
$('.sale-info').mouseenter(function() {
$(this).addClass('active').children('ul').removeClass('none');
}).mouseleave(function() {
$(this).removeClass('active').children('ul').addClass('none');
});
$('.side-img-dd').each(function() {
$(this).slider2({
shownum: 5,
isCircle: true
});
});
isCheckAll();
isCheckFav();
if ($itemChecked.length === 0) {
$('#Y_SubmitBtn').addClass('btn-account-disable');
}
});
require('./cart-action');
require('./cart-color-panel');
require('./cart-goods-win');
require('./cart-together');
$(capi.cartInit);
... ...
/**
* 订单结算页
* @author: gxh<xuhui.ge@yoho.cn>
* @date: 2016/12/27
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
dialog = require('../common/dialog'),
rDialog = require('./rdialog');
require('../plugins/slider');
require('../common/center-slider');
require('../common');
var Dialog = dialog.Dialog,
// Confirm = dialog.Confirm,
Alert = dialog.Alert,
RConfirm = rDialog.RConfirm,
RAlert = rDialog.RAlert;
var $cartGoodsDetail = $('#goodsTogetherDetail'),
$paySum = $('#pay-sum'),
shopNum = 1,
productId,
promotionId,
understock,
$sellBox = $('.cart-table .pre-sell-box');
// 优惠券 显示和隐藏
$('.sale-info').mouseenter(function() {
$(this).addClass('active').children('ul').removeClass('none');
}).mouseleave(function() {
$(this).removeClass('active').children('ul').addClass('none');
});
$('.side-img-dd').slider2({
shownum: 5,
isCircle: true
});
// var dialogTpl = require('hbs/cart/cart-togetherGoods.hbs');
lazyLoad($('#details-html img'));
// ----------------底部 为你优选,最近浏览 begin--------------
// 推荐、优选、浏览切换
$(function() {
var $togetherGoods = $('.individual-item-togetherGoods'),
$recommendGoods = $('.individual-item-recommendGoods'),
$latestWalk = $('.individual-item-latestWalk');
if ($togetherGoods.hasClass('none')) {
$recommendGoods.show();
}
$('.bottom-tab-slide').on('click', '.bottom-title', function() {
var $this = $(this),
index = $this.index();
console.log(index);
$togetherGoods.hide();
$recommendGoods.hide();
if ($this.hasClass('change')) {
return;
}
if ($this.hasClass('cur')) {
return;
}
$this.addClass('cur');
$this.siblings('.cur').removeClass('cur');
switch (index) {
case 0: {
$togetherGoods.slideDown();
$recommendGoods.hide();
$latestWalk.hide();
break;
}
case 1: {
$togetherGoods.hide();
$recommendGoods.slideDown();
$latestWalk.hide();
break;
}
case 2: {
$togetherGoods.hide();
$recommendGoods.hide();
$latestWalk.slideDown();
break;
}
}
});
});
// 凑单 底部 轮播
function loadSlideGoods() {
$.ajax({
type: 'GET',
url: '',
data: {
// skn: skn,
size: 20,
num: 1
}
}).then(function(data) {
// var pro = data.data.products;
// if (data.code === 200) {
// if (pro.length === 0) {
// return;
// }
$('#recommend-shop').removeClass('none');
$('.individual-item ').slider2({
shownum: 5,
isCircle: true
});
// } else {
// $('.bottom-title').filter('.change').addClass('none');
// }
});
}
loadSlideGoods();
$(function() {
$('.bottom-tab .change').click(function() {
$('.img-brand-switch .next').trigger('click');
});
// 判断商品是否已收藏,是否全选
function isCheckFav() {
var pidArray = [],
isAllCheck = true;
$sellBox.each(function() {
var $checkItem = $(this).find('.cart-item-check');
//有一个没选中,跳出循环
if (!$checkItem.hasClass('cart-item-checked')) {
isAllCheck = false;
return false;
}
});
if (isAllCheck) {
//头部全选
$('.cart-title .cart-item-check').addClass('cart-item-checked');
//底部全选
$('#cbSelAllGoods').addClass('cart-item-checked');
}
$sellBox.each(function () {
pidArray.push($(this).data('pid'));
});
$.ajax({
type: 'POST',
url: '/cart/index/checkFav',
data: {
pidList: pidArray.join(',')
}
}).then(function(result) {
$.each(result.data,function(pid,obj) {
if (obj.code !== 200) {
return false;
}
if (obj.data) {
$sellBox.each(function () {
if (String($(this).data('pid')) === String(pid)) {
$(this).find('.cart-col-btn').addClass('has-col-btn').html('已收藏');
return false;
}
});
}
});
});
}
isCheckFav();
});
$('body').on('click', '.cut, .add', function() {
count = $(this).hasClass('minus') ? 'decreaseNum' : 'increaseNum';
if (promotionId) {
if ($(this).hasClass('cut')) {
new Alert('-_-,已经是最后一件,不能再减了!').show();
} else {
new Alert('最多只能购买一件,您好像购买的太多了!').show();
}
} else {
if ($(this).hasClass('add')) {
shopNum++;
} else {
shopNum--;
}
if (shopNum < 1) {
new Alert('-_-,已经是最后一件,不能在减了!').show();
shopNum = 1;
return false;
}
$('#num').val(shopNum);
}
});
// 凑单弹框 商品信息弹出框,加入收藏夹
$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();
}
});
});
// 结算
$paySum.on('click', '.btn-account', function() {
// 结算
understock = '';
// if ($('.pay-wapper .cart-item-checked').parents('.tr').find('.tipNoStore').length > 0) {
// shopName = $('.pay-wapper .cart-item-checked').parents('.tr').find('.tipNoStore');
// $.each(shopName.parents('.tr').find('.pay-pro-info a'), function() {
// understock += $(this).html();
// });
// new Alert(understock + '库存不足').show();
// } else {
// if ($('.zp').length > 0 && !$(this).attr('title')) {
// $(this).attr('title', '1');
// new Confirm({
// className: 'shopCart-del-dialog',
// content: '<h4><i class="iconfont">&#xe6c2;</i>您还未选择赠品</h4>' +
// '<small>是否去选择赠品?</small>',
// }).show();
// } else {
// if ($('input:checked').length > 0) {
//
// if ($('.pre-sell-box .cart-item-checked').length > 0) {
// window.location.href = '/cart/index/orderEnsure?type=2';
// } else {
// window.location.href = '/cart/index/orderEnsure?type=1';
// }
// } else {
// new Alert('请至少选择一件商品').show();
// }
// }
// }
$('.cart-preSell-dialog').show();
// $('.togethor').show();
$('.cart-togetherGoods').show();
});
$('.shop-cart').on('click', '[data-role="cart-gift-win"] .close', function() {
$(this).closest('[data-role="cart-gift-win"]').hide();
});
require('./cart-action');
require('./cart-color-panel');
require('./cart-goods-win');
/**
* Created by LiuChuanYang on 2017/01/19.
*/
'use strict';
module.exports = function() {
var options = arguments[arguments.length - 1];
var ret = false;
var len = arguments.length - 1;
var i = 1;
if (len > 0) {
ret = arguments[0];
while (i < len) {
ret = ret && arguments[i];
i++;
}
}
if (options.fn) {
if (ret) {
return options.fn(this);
} else {
return options.inverse(this);
}
} else {
return ret;
}
};
... ...
/**
* Created by LiuChuanYang on 2017/01/19.
*/
'use strict';
module.exports = function(v1, v2, options) {
var ret = v1 === v2;
if (options.fn) {
if (ret) {
return options.fn(this);
} else {
// 不满足条件执行{{else}}部分
return options.inverse(this);
}
} else {
return ret;
}
};
... ...
/**
* Created by LiuChuanYang on 2017/01/19.
*/
'use strict';
module.exports = function(v1, v2, options) {
var ret = v1 >= v2;
if (options.fn) {
if (ret) {
return options.fn(this);
} else {
// 不满足条件执行{{else}}部分
return options.inverse(this);
}
} else {
return ret;
}
};
... ...
... ... @@ -2,6 +2,8 @@
* Created by LiuChuanYang on 2017/01/19.
*/
'use strict';
module.exports = function(v1, v2, options) {
var ret = v1 > v2;
... ...
/**
* Created by LiuChuanYang on 2017/01/19.
*/
'use strict';
module.exports = function(v1, v2, options) {
var ret = v1 <= v2;
if (options.fn) {
if (ret) {
return options.fn(this);
} else {
// 不满足条件执行{{else}}部分
return options.inverse(this);
}
} else {
return ret;
}
};
... ...
/**
* Created by LiuChuanYang on 2017/01/19.
*/
'use strict';
module.exports = function(v1, v2, options) {
var ret = v1 < v2;
if (options.fn) {
if (ret) {
return options.fn(this);
} else {
// 不满足条件执行{{else}}部分
return options.inverse(this);
}
} else {
return ret;
}
};
... ...