Authored by htoooth

add fix

... ... @@ -7,6 +7,7 @@ const helpers = global.yoho.helpers;
const brandService = require('../models/favorite-brand-service');
const productService = require('../models/favorite-product-service');
const fav = require('../models/favorite');
const _ = require('lodash');
/**
* 收藏品牌ajax请求
... ... @@ -142,8 +143,8 @@ const isFavShop = (req, res, next) => {
};
const num = (req, res, next) => {
let bid = req.query.bid;
let sid = req.query.sid;
let bid = _.parseInt(req.query.bid) || 0;
let sid = _.parseInt(req.query.sid) || 0;
if (sid) {
return brandService.getShopFavNumAsync(sid).then((result) => {
... ...
... ... @@ -201,11 +201,11 @@ const _getProductActivityBanner = (additionalData) => {
};
};
const _getBundleAsync = (data) => {
const _getBundleAsync = (result) => {
return {
count: _.get(data, 'bundleInfo.bundleCount', 1),
phrase: _.get(data, 'bundleInfo.promotionPhrase', ''),
type: _.get(data, 'bundleInfo.discountType', 1)
count: _.get(result, 'data.bundleInfo.bundleCount', 1),
phrase: _.get(result, 'data.bundleInfo.promotionPhrase', ''),
type: _.get(result, 'data.bundleInfo.discountType', 1)
};
};
... ... @@ -839,10 +839,10 @@ const _getDetailDataBySizeInfo = (sizeInfo) => {
// 图片换成懒加载方式
const replacePairs = {
'<img src=': '<img class="lazy img-responsive" width="765" height="200" ' +
'<img src=': '<img class="lazy img-responsive" width="800" height="200" ' +
'src="data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==" ' +
'data-original=',
'<img border="0" src=': '<img border="0" class="lazy img-responsive" width="756" height="200" ' +
'<img border="0" src=': '<img border="0" class="lazy img-responsive" width="800" height="200" ' +
'src="data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==" ' +
'data-original='
};
... ...
... ... @@ -16,16 +16,18 @@ const addFavAsync = _.partial(api.addFavAsync, _, _, 'brand');
const cancelFavAsync = _.partial(api.cancelFavAsync, _, _, 'brand');
const getShopFavNumAsync = (sid) => {
return serviceApi.get('brower/favorite/queryFavoriteCountByShopIds', {
favIds: `[${sid}]`,
type: 'shop'
return serviceApi.post('favorite/queryFavoriteCountByShopIds', {
favIds: sid,
type: 'shop',
method: 'app.favorite.queryFavoriteCountByShopIds'
});
};
const getBrandIdNumAsync = (bid) => {
return serviceApi.get('brower/favorite/queryBrandFavoriteCountByBrandId', {
return serviceApi.post('favorite/queryFavoriteCountByBrandId', {
brandId: bid,
type: 'brand'
type: 'brand',
method: 'app.favorite.queryFavoriteCountByBrandId'
});
};
... ...
... ... @@ -13,7 +13,7 @@
</a>
<span id="brand-favour" class="brand-fav{{#if isCollect}} coled{{/if}}" data-id="{{brandId}}">
<i class="iconfont">&#xe611;</i>
<span></span>
<span class="fav-num"></span>
</span>
</div>
</div>
... ... @@ -172,10 +172,7 @@
</p>
<div class="model-content">
<div class="reference info-block">
{{# reference}}
<table class="reference-table">
<thead>
... ... @@ -406,7 +403,7 @@
<div class="common-question">
<textarea id="textbox" placeholder="请输入您的问题"></textarea>
<span id="submit-consult" class="btn">提交咨询</span>
</div>
</div>
... ...
<span class="minus-plus pull-left">
<i id="minus-num" class="minus dis iconfont">&#xe63c;</i>
</span>
<span id="num" class="num pull-left">1</span>
<span id="num" class="num pull-left">{{bundle.count}}</span>
<span class="minus-plus pull-left">
<i id="plus-num" class="plus iconfont">&#xe644;</i>
</span>
... ...
... ... @@ -18,7 +18,7 @@ module.exports = {
domains: {
// test2
singleApi: 'http://192.168.102.27:8092/brower',
singleApi: 'http://192.168.102.27:8092/brower/',
api: 'http://api-test2.yohops.com:9999/',
service: 'http://service-test2.yohops.com:9999/',
... ...
<div>
<div>
<i class="iconfont ring">&#xe701; </i>
<span class="title">到货通知</span>
</div>
<div class="content">
商品订阅到货通知成功!
</div>
<div class="row">
<a class='ok2 btn-close'>确定</a>
</div>
</div>
... ...
... ... @@ -57,10 +57,11 @@ var BRAND_FAV = {
var $saleReturn = $('#saleReturn');
var dialogTpl = require('hbs/product/coupon-dialog.hbs');
var consultsuccessTpl = require('hbs/product/consult-success.hbs');
var consultSuccessTpl = require('hbs/product/consult-success.hbs');
var pkgData;// 套餐数据
var notifyTpl = require('hbs/product/notify.hbs');
var notifySuccessTpl = require('hbs/product/notify-ok.hbs');
var $goodsIdArr = [];
... ... @@ -533,8 +534,15 @@ bindEvent.add(function() {
content: notifyTpl({pid: id, sku: getSku()})
};
var opt2 = {
className: 'notify-goods-wrapper',
closeIcon: true,
content: notifySuccessTpl()
};
var dialog = new Dialog(opt); // eslint-disable-line
var FAV = { //eslint-disable-line
checked: '&#xe613;',
unchecked: '&#xe612;'
... ... @@ -550,6 +558,10 @@ bindEvent.add(function() {
$('#collect-product').triggerHandler('click');
}
dialog.close();
new Dialog(opt2).show();
$enableNotifyYou.addClass('dis');
$enableNotifyYou.find('span').text('已订阅到货通知');
}).fail(function(err) {
... ... @@ -604,7 +616,7 @@ bindEvent.add(function() {
}
// 数目为1时点+则移除-不可点状态
if (num === 1) {
if (num === goodsBaseNum) {
$minusNum.removeClass('dis');
}
... ... @@ -621,7 +633,7 @@ bindEvent.add(function() {
return;
}
if (num === 2) {
if (num === (goodsBaseNum + 1)) {
$(this).addClass('dis');
}
... ... @@ -1195,7 +1207,7 @@ function fetchComment() {
if (code === 200) {
$textarea.removeClass('err');
new Dialog({
content: consultsuccessTpl({success: consultdata}),
content: consultSuccessTpl({success: consultdata}),
className: 'consult-alert',
btns: [
{
... ... @@ -1583,7 +1595,7 @@ bindEvent.fire();
});
favorite.getFavNum(shopId, brandId).then(function(result) {
$('#brand-favour').find('span').html(result.count);
$('#brand-favour').find('span').html(result);
});
favorite.statusFav(shopId, brandId).then(function() {
... ...
var $ = require('yoho-jquery');
function statusAsync(sku) {
exports.statusAsync = function(sku) {
var uid = getUid();
if (!uid) {
... ... @@ -21,12 +21,12 @@ function statusAsync(sku) {
result.data.sku = sku;
return result;
} else {
return $.Deferred().reject(result).promise(); // eslint-disable-line
return $.Deferred().reject({data:{sku:sku}}).promise(); // eslint-disable-line
}
});
}
};
function addAsync(skn, sku) {
exports.addAsync = function(skn, sku) {
var uid = getUid();
if (!uid) {
... ... @@ -39,16 +39,19 @@ function addAsync(skn, sku) {
}
if (skn && sku) {
return $.post('/product/detail/notify/add', {skn: skn, sku: sku});
return $.post('/product/detail/notify/add', {skn: skn, sku: sku})
.then(function(result) {
if (result.code === 200) {
return $.Deferred().resolve().promise();
} else {
return $.Deferred().reject().promise();
}
});
} else {
return $.Deferred().reject({ // eslint-disable-line
code: 403,
message: '商品错误'
}).promise();
}
}
exports = {
statusAsync: statusAsync,
addAsync: addAsync
};
... ...
... ... @@ -40,6 +40,11 @@
cursor: pointer;
}
.fav-num {
font-size: 13px;
color: white;
}
.home {
margin-right: 5px;
... ... @@ -1208,7 +1213,7 @@
}
.details-html {
width: 750px;
width: 800px;
text-align: center;
margin: 0 auto;
... ... @@ -2453,6 +2458,18 @@
cursor: pointer;
}
.ok2 {
display: inline-block;
background-color: black;
color: white;
width: 150px;
height: 33px;
font-size: 15px;
line-height: 33px;
margin-right: 20px;
cursor: pointer;
}
.cancel {
display: inline-block;
border: 1px solid black;
... ...