Authored by 姜枫

fix some bug

... ... @@ -74,7 +74,7 @@ const list = {
let retData = {
module: 'product',
page: 'list',
title: '列表'
title: '新品'
};
Promise.all([Resouces.newProductBanner(), Search.queryAllSort(), Search.queryNewProduct(q)]).then(result => {
... ...
... ... @@ -28,7 +28,9 @@ const Query = {
query: query
};
Promise.all([Search.queryAllSort(), Search.queryProduct(q)]).then(allResult => {
Promise.all([Search.queryAllSort({
query: query
}), Search.queryProduct(q)]).then(allResult => {
let allSort = camelCase(allResult[0]);
let result = allResult[1];
... ...
... ... @@ -109,49 +109,51 @@ const shop = {
nav.push({
name: result.name
});
} else {
res.status(404);
return Promise.reject('brand-not-found');
}
}).then(() => {
return Promise.all([Search.queryAllSort({
brand: q.brand,
shop: q.shop_id,
small_sort: 1
}), Search.queryProductOfBrand(q)]).then(allResult => {
let allSort = camelCase(allResult[0]);
let result = allResult[1];
if (result && result.code === 200 && result.data) {
let ret = camelCase(result.data);
if (ret.filter) {
delete q.brand;
ret.filter.groupSort = DataHelper.sortConvert(allSort.data.sort);
data.filter = DataHelper.filterHandle(ret.filter, req.query);
data.filter.showPrice = ret.total > 10;
return result.brandId;
}).then((brandId) => {
if (brandId) {
return Promise.all([Search.queryAllSort({
brand: q.brand,
shop: q.shop_id,
small_sort: 1
}), Search.queryProductOfBrand(q)]).then(allResult => {
let allSort = camelCase(allResult[0]);
let result = allResult[1];
if (result && result.code === 200 && result.data) {
let ret = camelCase(result.data);
if (ret.filter) {
delete q.brand;
ret.filter.groupSort = DataHelper.sortConvert(allSort.data.sort);
data.filter = DataHelper.filterHandle(ret.filter, req.query);
data.filter.showPrice = ret.total > 10;
}
data.paginationData = {
page: q.page,
limit: ret.limit || 45,
total: ret.total,
pageTotal: ret.pageTotal,
queryParams: req.query
};
data.navPath = {
nav: nav
};
res.display('shop-list', _.assign(data, {
products: DataHelper.handleProductList(ret.productList),
order: q.order
}));
} else {
return Promise.reject('query shop index error');
}
data.paginationData = {
page: q.page,
limit: ret.limit || 45,
total: ret.total,
pageTotal: ret.pageTotal,
queryParams: req.query
};
data.navPath = {
nav: nav
};
res.display('shop-list', _.assign(data, {
products: DataHelper.handleProductList(ret.productList),
order: q.order
}));
} else {
return Promise.reject('query shop index error');
}
});
});
} else {
return next();
}
}).catch(next);
},
... ...
... ... @@ -70,6 +70,9 @@ const Search = {
queryAllSort(params) {
return api.get('', _.assign({
method: 'web.regular.groupsort',
sales: 'Y',
status: 1,
stocknumber: 1,
app_type: 1
}, params), {code: 200});
}
... ...
... ... @@ -140,7 +140,7 @@ const ShopService = {
info.menus = shopMenu(domain);
} else {
let brandId = domainInfo.id;
let brandInfo = yield BrandService.getBrandInfo(brandId, uid);
let brandInfo = yield BrandService.getBrandInfo(brandId, uid)
info.name = brandInfo.brandName;
info.info = brandInfo.brandIntro;
... ...
... ... @@ -137,6 +137,7 @@
</div>
{{/if}}
{{#if colors}}
<div class="yoho-ui-accordion">
<h3>颜色</h3>
<div class="body">
... ... @@ -152,3 +153,4 @@
</div>
</div>
</div>
{{/if}}
... ...
... ... @@ -13,10 +13,6 @@ const camelCase = global.yoho.camelCase;
const helpers = global.yoho.helpers;
const Payments = {
alipay: 2
};
/**
* 支付页
* @param req
... ... @@ -76,7 +72,7 @@ const toPay = (req, res, next) => {
*/
const callback = (req, res) => {
let type = req.params.type;
let payId = Payments[type];
let payId = PayData.payments[type];
let query = req.query;
PayHelpers.afterPay(query, payId, req.user).then(result => {
... ...
... ... @@ -24,7 +24,7 @@ const Payment = {
};
if (payInfo && payInfo.id === method) {
if (method === 2) {
if (method === PayData.payments.alipay) {
result = Alipay.pay(user, order, payInfo);
}
}
... ... @@ -77,7 +77,7 @@ const Payment = {
let payInfo = yield PayData.getPaymentInfo(payId);
let payResult = {};
if (payId === 2) {
if (payId === PayData.payments.alipay) {
payResult = Alipay.notify(query, payInfo);
payResult.bankName = payResult.bankName || payInfo.payName || '';
... ...
... ... @@ -17,6 +17,10 @@ const logger = global.yoho.logger;
const _ = require('lodash');
const payments = {
alipay: 33
};
/**
* 获取在线支付方式
* @returns {*|Promise.<TResult>}
... ... @@ -28,13 +32,13 @@ const getOnlinePayProvider = () => {
}
let online = _(result.data)
.filter(i => _.includes(['Alipay'], i.payCode))
.filter(i => _.includes([33], i.id))
.map(i => {
return {
id: i.id,
name: i.payName,
img: i.payIcon,
selected: i.payCode === 'Alipay'
selected: i.id === 33
};
})
.value();
... ... @@ -223,6 +227,7 @@ module.exports = {
setOrderPayBank,
updateOrderPayBank,
sendPayConfirm,
procOrderData
procOrderData,
payments
};
... ...
... ... @@ -65,7 +65,7 @@ module.exports = {
}
},
pay: {
serviceNotify: 'http://testservice.yoho.cn:28077/'
serviceNotify: 'http://devservice.yoho.cn:58077/'
}
};
... ...
... ... @@ -3,11 +3,11 @@
{
"name": "yohoblk-node",
"script": "app.js",
"instances": "max",
"instances": "0",
"exec_mode": "cluster",
"env": {
"PORT": 6003
}
}
]
}
\ No newline at end of file
}
... ...
... ... @@ -25,8 +25,9 @@ function _favBrand(brandId, isAdd) {
}
$('#brand-fav').click(function() {
var shopId = $(this).parents('.brand-banner').data('shop');
var brandId = $(this).parents('.brand-banner').data('brand');
var $banner = $(this).parents('.brand-banner');
var shopId = $banner.data('shop');
var brandId = $banner.data('brand');
var isAdd = $(this).hasClass('coled');
if (shopId) {
... ...