Authored by 郝肖肖

品牌优惠券

... ... @@ -486,6 +486,8 @@ const userCoupon = (req, res, next) => {
let cryptCouponId = crypto.decrypt('', req.body.couponID);
let uid = req.body.uid || req.user.uid;
let isApp = req.body.app_version || req.body.appVersion || false;
let data = {};
if (uid) {
listModel.receiveCoupon(
... ... @@ -496,32 +498,19 @@ const userCoupon = (req, res, next) => {
return;
}).catch(next);
} else {
data.code = 4401;// 401错误已经被接口占用
let refer = req.get('referer');
let toUrl = helpers.urlFormat('/signin.html', {refer: refer});
if (req.yoho.isApp !== 'false') {
let toUrl = refer + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' +
refer +
if (isApp) {
toUrl += '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + refer +
'","param":{}},"requesturl":{"param":{"method":"app.promotion.getCoupon","couponId":"' +
cryptCouponId +
'"},"url":"' +
_.get(global, 'yoho.API.ApiUrl', '') +
'"},"priority":"Y"}}';
res.json({
code: 4401,
url: toUrl
});
} else {
res.json({
code: 4401,
url: helpers.urlFormat('/signin.html', {refer: refer})
});
cryptCouponId + '"},"url":"' + _.get(global, 'yoho.API.ApiUrl', '') + '"},"priority":"Y"}}';
}
data.url = toUrl;
res.json(data);
}
};
/**
... ... @@ -554,14 +543,14 @@ const getShopCouponsList = (req, res, next) => {
*/
const getBrandCouponsList = (req, res, next) => {
let uid = req.query.uid || req.user.uid;
let shopId = req.query.shopId;
let brandId = req.query.brandId;
let param = {};
if (uid) {
param.uid = uid;
}
param.shop_id = shopId;
param.brand_id = brandId;
listModel.brandCouponsList(param).then(result => {
res.json(result);
... ... @@ -579,5 +568,6 @@ module.exports = {
baseShopFav,
shopCategory,
userCoupon,
getShopCouponsList
getShopCouponsList,
getBrandCouponsList
};
... ...
... ... @@ -877,7 +877,23 @@ const brandCouponsList = (params) => {
let shopCoupons = [];
let couPonstatus;
console.log(result, '====');
if (result.data && result.data.coupons) {
_.forEach(result.data.coupons, value => {
couPonstatus = parseInt(value.status, 10);
if (couPonstatus === 1 || couPonstatus === 3) {
shopCoupons.push({
validity: value.couponValidity,
id: crypto.encryption('', value.coupon_id + ''),
name: value.coupon_name,
pic: value.coupon_pic,
money: parseInt(value.money, 10),
status: couPonstatus === 1
});
}
});
}
return {
couponsOne: shopCoupons.length <= 1,
coupons: shopCoupons
... ...
... ... @@ -127,6 +127,7 @@ router.get('/index/baseShopFav', list.baseShopFav);
router.get('/index/category', list.shopCategory);
router.post('/index/userCoupon', list.userCoupon);
router.get('/index/getShopCouponsList', list.getShopCouponsList);
router.get('/index/getBrandCouponsList', list.getBrandCouponsList);
// 店铺介绍
router.get('/index/intro', list.shopIntro);
... ...
... ... @@ -6,7 +6,6 @@ require('../../common');
var shopCoupon = {};
console.log($('.shop-id').val(), $('.shop-id').val() === '', '===');
shopCoupon = {
common: {
appVersion: window.queryString.app_version || window.queryString.appVersion,
... ... @@ -22,9 +21,9 @@ shopCoupon = {
var that = this, _url = location.protocol + '//m.yohobuy.com';
if (that.common.shopId === '') {
_url = '/product/index/getBrandCouponsList';
_url += '/product/index/getBrandCouponsList';
} else {
_url = '/product/index/getShopCouponsList';
_url += '/product/index/getShopCouponsList';
}
$.ajax({
... ... @@ -64,8 +63,9 @@ shopCoupon = {
$.ajax({
method: 'POST',
url: location.protocol + '//m.yohobuy.com/product/index/userCoupon',
url: '/product/index/userCoupon',
data: {
appVersion: $self.common.appVersion,
couponID: code,
uid: $self.common.uid
},
... ...
... ... @@ -151,7 +151,7 @@
bottom: 0;
background: rgba(0, 0, 0, 0.3);
padding: 88px 0;
z-index: 1;
z-index: 10;
overflow: auto;
.brand-intro {
... ...
... ... @@ -85,7 +85,7 @@
.coupon-left .coupon-left-name {
font-size: 18px;
width: 150px;
height: 45px;
height: 50px;
line-height: 24px;
padding-top: 2px;
overflow: hidden;
... ...