Authored by htoooth

update page

... ... @@ -8,39 +8,7 @@ const api = require('./coupon-api');
const _ = require('lodash');
const decrypt = _.partial(global.yoho.crypto.decrypt, null);
const _acquireAsync = _.overArgs(api.acquireAsync, [decrypt, _ => _]);
const acquireAsync = (cid, uid) => {
return _acquireAsync(cid, uid).then(result => {
switch (result.code) {
case 200:
return {
code: 200,
message: '恭喜您,成功领取优惠券'
};
case 401:
return {
code: 401,
message: '您已领取过优惠券'
};
case 315:
return {
code: 315,
message: '优惠券已过期'
};
case 300:
return {
code: 300,
message: '请求参数错误'
};
default:
return {
code: 500,
message: '领券失败!'
};
}
});
};
const acquireAsync = _.overArgs(api.acquireAsync, [decrypt, _1 => _1]);
module.exports = {
acquireAsync,
... ...
... ... @@ -164,7 +164,7 @@ bindEvent.add(function() {
} else if (result.code === 400) {
defer.reject({refer: window.signinUrl()});
} else {
defer.reject();
defer.reject(result);
}
return defer.promise();
... ... @@ -646,7 +646,7 @@ bindEvent.add(function() {
return window.jumpUrl(err.refer);
}
alert('抱歉,您不符合领用条件');
alert(err.message);
});
break;
default:
... ...