Authored by ccbikai(👎🏻🍜)

Merge branch 'feature/coupons' into release/5.7

... ... @@ -14,16 +14,11 @@ const couponData = (params) => {
return result.data.couponList.map(function(elem) {
delete elem.id;
elem.isNoLimit = elem.isNoLimit === 'true';// 全场通用
elem.isDiscount = (`,${elem.shopPriceLimits},`).indexOf(',1,') !== -1;// 三折以下
elem.isLimited = (`,${elem.shopPriceLimits},`).indexOf(',2,') !== -1;// 限量
elem.brandNameLimits = elem.brandNameLimit && elem.brandNameLimit.join('、');
elem.sortNameLimits = elem.sortNameLimit && elem.sortNameLimit.join('、');
if (status0) {
elem.bestowLink = helpers.urlFormat('/product/index/index',
{
coupon_id: elem.couponId,
coupon_code: elem.couponCode,
title: '优惠活动商品',
intro_text: `以下商品可使用【${elem.couponDetailInfomation}】优惠券`
}
... ...
... ... @@ -36,19 +36,9 @@
</div>
</div>
<div class="coupon-footer hide">
{{#if isNoLimit}}
<p>全场通用</p>
{{/if}}
{{#if brandNameLimits}}
<p>限品牌:{{brandNameLimits}}</p>
{{/if}}
{{#if sortNameLimits}}
<p>限品类:{{sortNameLimits}}</p>
{{/if}}
<p>特例商品(秒杀、限定、境外、预售{{#if isDiscount}}、3折以下{{/if}}{{#if isLimited}}、限量{{/if}}等)暂不支持使用优惠券。</p>
{{#if explains}}<p>说明:{{explains}}</p>{{/if}}
{{#notes}}
<p>{{.}}</p>
{{/notes}}
</div>
</div>
{{/each}}
... ...
... ... @@ -249,9 +249,18 @@ const search = (req, res, next) => {
* 筛选
*/
let filter = (req, res, next) => {
res.header('Access-Control-Allow-Origin', '*');
let allowOrigin = _.get(req, 'headers.origin', null) ?
req.headers.origin : req.protocol + '://' + req.headers.host;
res.setHeader('Access-Control-Allow-Origin', allowOrigin);
res.setHeader('Access-Control-Allow-Credentials', 'true');
let params = Object.assign({}, req.query);
let uid = req.user.uid || 0;
if (uid) {
params.uid = uid;
}
searchModel.getFilterData(params).then((result) => {
res.render('search/filter', {
... ...
... ... @@ -178,7 +178,7 @@ const _searchGoods = (params) => {
}
// 个人中心优惠券立即使用 - 商品列表
if (params.coupon_id) {
if (params.coupon_id || params.coupon_code) {
method = 'app.search.coupon';
}
... ...
... ... @@ -26,20 +26,9 @@
</div>
</div>
<div class="coupon-footer hide">
{{#if isNoLimit}}
<p>全场通用</p>
{{/if}}
{{#if brandNameLimits}}
<p>限品牌:{{brandNameLimits}}</p>
{{/if}}
{{#if sortNameLimits}}
<p>限品类:{{sortNameLimits}}</p>
{{/if}}
<p>特例商品(秒杀、限定、境外、预售{{#if isDiscount}}、3折以下{{/if}}{{#if isLimited}}、限量{{/if}}等)暂不支持使用优惠券。</p>
{{#if explains}}<p>说明:{{explains}}</p>{{/if}}
{{#notes}}
<p>{{.}}</p>
{{/notes}}
</div>
</div>
{{/each}}
... ...
... ... @@ -38,6 +38,7 @@ let $input = $('#search-input').find('input[name="query"]'),
let shopId, sort, brand, outlets, app_type, age_level, msort, misort, coin, app_version, students, couponId, searchFrom;
let size, color, style, standard, gender, price, p_d, oldquery, query, limited, specialoffer, specialsale_id, promotion;
let couponCode;
// 默认筛选条件
let defaultOpt = require('common/query-param');
... ... @@ -248,6 +249,7 @@ specialsale_id = getQueryString('specialsale_id');
promotion = getQueryString('promotion');
students = getQueryString('students');
couponId = getQueryString('coupon_id');
couponCode = getQueryString('coupon_code');
searchFrom = getQueryString('from');
if ($fsgc.children().length > 0) {
... ... @@ -523,6 +525,10 @@ function search(opt) {
params.coupon_id = couponId;
}
if (couponCode) {
params.coupon_code = couponCode;
}
if (searchFrom) {
params.from = searchFrom;
}
... ... @@ -856,10 +862,17 @@ if ($brandHeader.data('isbaseshop') === true) {
pars.coupon_id = couponId;
}
if (couponCode) {
pars.coupon_code = couponCode;
}
$.extend(defaultOpt, pars);
$.ajax({
type: 'GET',
url: location.protocol + '//m.yohobuy.com/product/search/filter',
xhrFields: {
withCredentials: true
},
data: defaultOpt,
success: function(data) {
if (data === '') {
... ...