Authored by 郝肖肖

'fix'

... ... @@ -26,7 +26,8 @@ class HaveGain {
}
// 申请开通
apply(req, res) {
apply(req, res, next) {
let uid = req.user.uid;
let socialMediaList = [
{
name: '微信',
... ... @@ -58,37 +59,27 @@ class HaveGain {
},
{
name: 'Instagram',
icon: 'img/activity/have-gain/instagram@2x.png',
icon: 'img/activity/have-gain/ins@2x.png',
type: 5,
account: '',
fans: 0
}
];
return res.render('have-gain/apply', {
module: 'activity',
page: 'have-gain-apply',
width750: true,
localCss: true,
title: '有货有赚',
socialMediaList: socialMediaList,
pageHeader: !req.yoho.isApp && headerModel.setNav({
navTitle: '有货有赚',
navBtn: false
}),
});
}
return req.ctx(haveGainModel).checkApply({uid}).then(result => {
let checkUrl = result.data && result.data.checkUrl || '';
// 审核中
verify(req, res, next) {
return req.ctx(haveGainModel).invitecode({}).then(result => {
return res.render('have-gain/verify', {
if (checkUrl.indexOf('activity/have-gain/apply') === -1) {
// return res.redirect(checkUrl);
}
return res.render('have-gain/apply', {
module: 'activity',
page: 'have-gain-verify',
page: 'have-gain-apply',
width750: true,
localCss: true,
title: '有货有赚',
result,
socialMediaList: socialMediaList,
pageHeader: !req.yoho.isApp && headerModel.setNav({
navTitle: '有货有赚',
navBtn: false
... ... @@ -97,6 +88,21 @@ class HaveGain {
}).catch(next);
}
// 审核中
verify(req, res) {
return res.render('have-gain/verify', {
module: 'activity',
page: 'have-gain-verify',
width750: true,
localCss: true,
title: '有货有赚',
pageHeader: !req.yoho.isApp && headerModel.setNav({
navTitle: '有货有赚',
navBtn: false
}),
});
}
submitApply(req, res, next) {
let body = req.body || {};
let uid = req.user.uid;
... ...
... ... @@ -13,15 +13,6 @@ module.exports = class extends global.yoho.BaseModel {
this.invitecode(params),
this.checkApply(params)
]).then(res => {
let checkStatus = _.get(res[1], 'data.status', 0);
let checkUrl = helpers.urlFormat('/activity/have-gain/apply', {}); // 未申请
if (checkStatus === 1) { // 审核中
checkUrl = helpers.urlFormat('/activity/have-gain/verify', {});
} else if (checkStatus === 2) { // 审核成功
checkUrl = 'https://activity.yoho.cn/feature/2213.html?title=说明详情&openby:yohobuy={"action":"go.h5","params":{"title": "说明详情", url":"https://activity.yoho.cn/feature/2213.html"}}'; // eslint-disable-line
}
let share = (_.get(res[0], 'data.context', '')).match(/(\d+)/g);
let gainList = [
{
... ... @@ -31,7 +22,7 @@ module.exports = class extends global.yoho.BaseModel {
totalCouponNum: _.get(share, '[1]', 0),
isShow: true
}, {
url: checkUrl,
url: _.get(res[1], 'data.checkUrl', ''),
img: '//img10.static.yhbimg.com/article/2017/06/20/12/01a50a1f45b97365e758d6890858998310.jpg?imageView2/{mode}/w/{width}/h/{height}', // eslint-disable-line
isShow: false
}
... ... @@ -66,6 +57,19 @@ module.exports = class extends global.yoho.BaseModel {
data: Object.assign({
method: 'app.union.shareOrder.checkApply'
}, params)
}).then(res => {
let checkStatus = _.get(res, 'data.status', 0);
let checkUrl = helpers.urlFormat('/activity/have-gain/apply', {}); // 未申请
if (checkStatus === 1) { // 审核中
checkUrl = helpers.urlFormat('/activity/have-gain/verify', {});
} else if (checkStatus === 2) { // 审核成功
checkUrl = 'https://activity.yoho.cn/feature/2213.html?title=说明详情&openby:yohobuy={"action":"go.h5","params":{"title": "说明详情", url":"https://activity.yoho.cn/feature/2213.html"}}'; // eslint-disable-line
}
_.set(res, 'data.checkUrl', checkUrl);
return res;
});
}
... ...
... ... @@ -332,7 +332,7 @@ router.get('/grouth-new/init', auth, grouthNew.grouthInit); // æˆé•¿å€¼åˆå§‹åŒ
router.get('/have-gain/index', auth, haveGain.index); // 有货有赚列表
router.get('/have-gain/apply', auth, haveGain.apply); // 有货有赚申请
router.get('/have-gain/verify', auth, haveGain.verify); // 有货有赚审核趾
router.get('/have-gain/verify', haveGain.verify); // 有货有赚审核趾
router.post('/have-gain/submitApply', auth, haveGain.submitApply); // 有货有赚-申请开通
module.exports = router;
... ...
... ... @@ -82,12 +82,21 @@ class HaveGainApplyPage extends Page {
rightBtnText: '去添加'
}
}, function() {
let fans = $('.dialog-fill-in .fans').val() || 0;
let account = $.trim($('.dialog-fill-in .account').val() || '');
let fans = $.trim($('.dialog-fill-in .fans').val() || '');
let fansFix = Math.round((fans / 10000) * 100) / 100; // 保留二个小数
if (!account) {
return tip.show('请输入账号昵称');
}
if (fans === '') {
return tip.show('请输入粉丝数量');
}
fansFix = fansFix >= 10 ? fansFix + '万' : fans;
$accountName.html(`账号:<em>${$('.dialog-fill-in .account').val()}</em>&nbsp;&nbsp;粉丝:<em data-fans="${fans}">${fansFix}</em>`); // eslint-disable-line
$accountName.html(`账号:<em>${account}</em>&nbsp;&nbsp;粉丝:<em data-fans="${fans}">${fansFix}</em>`); // eslint-disable-line
dialog.hideDialog();
$event.text('已填写').addClass('disable');
});
... ... @@ -141,7 +150,7 @@ class HaveGainApplyPage extends Page {
socialMediaList.push({
type: $accountName.data('type'),
account: $accountName.find('em').eq(0).text() || '',
fans: $accountName.find('em').eq(1).data('fans') || ''
fans: parseInt(`0${$accountName.find('em').eq(1).data('fans')}`)
});
});
... ... @@ -166,7 +175,7 @@ class HaveGainApplyPage extends Page {
return tip.show(res.message || '请稍后再试');
}
yoho.invokeMethod('go.copy', {text: '有货有赚'});
yoho.invokeMethod('go.copy', {text: '有货有赚', message: '复制成功'});
dialog.showDialog({
hasHeader: '申请成功',
hasClass: 'dialog-fill-in',
... ...
... ... @@ -23,7 +23,7 @@ class HaveGainVerifyPage extends Page {
}
tapAdded() {
yoho.invokeMethod('go.copy', {text: '有货有赚'});
yoho.invokeMethod('go.copy', {text: '有货有赚', message: '复制成功'});
dialog.showDialog({
dialogText: '“有货有赚”服务号已经复制,请去微信搜索添加',
hasClass: 'dialog-fill-in',
... ...
... ... @@ -13,13 +13,13 @@
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
margin-bottom: 30px;
}
input {
width: 340px;
height: 60px;
line-height: 60px;
height: 80px;
line-height: 80px;
border: 0.5px solid #eee;
padding: 0 10px;
}
... ...