Authored by lijing

开完完成

... ... @@ -9,21 +9,16 @@
const headerModel = require('../../../doraemon/models/header'); // 头部model
const raffleModel = require('../models/raffle');
const _ = require('lodash');
exports.activity = (req, res, next) => {
raffleModel.activity({
uid: req.user.uid
}).then((result) => {
res.render('raffle/activity', Object.assign({test: 'aaaa'}, {
res.render('raffle/activity', Object.assign(result, {
title: 'Yoho!Buy 有货',
width750: true
}));
}).catch(next);
};
/**
... ... @@ -38,7 +33,7 @@ exports.order = (req, res, next) => {
page: req.query.page || 1,
gender: req.query.gender || '1,3',
yh_channel: req.query.channel || 1,
uid: req.user.uid || 10851797 // TODO
uid: req.user.uid
};
raffleModel.order(params).then(result => {
... ... @@ -67,28 +62,56 @@ exports.getOrders = (req, res, next) => {
page: req.query.page || 1,
gender: req.query.gender || '1,3',
yh_channel: req.query.channel || 1,
uid: req.user.uid || 10851797 // TODO
uid: req.user.uid
}).then(result => {
res.json(result);
}).catch(next);
};
/**
* 非首次绑定
* 入口页
* @param req
* @param res
* @param next
*/
exports.tip = (req, res, next) => {
res.render('raffle/tip', {
exports.enter = (req, res) => {
if (!req.user.uid) {
res.redirect('http://m.yohobuy.com/passport/login/wechat?refer=http://m.yohobuy.com/activity/raffle/enter');
} else {
res.render('raffle/enter', {
module: 'activity',
page: 'raffle',
pageHeader: headerModel.setNav({
navTitle: '我的订单'
}),
title: 'Yoho!Buy 有货',
pageFooter: true
uid: req.user.uid
});
}
};
/**
* 抽奖
* @param req
* @param res
* @param next
*/
exports.lucky = (req, res, next) => {
raffleModel.lucky({
lotteryId: req.body.lotteryId,
userId: req.body.userId,
orderCode: req.body.orderCode
}).then(result => {
res.json(result);
}).catch(next);
};
/**
* 送有货币
* @param req
* @param res
* @param next
*/
exports.bind = (req, res, next) => {
raffleModel.bind({
userId: req.query.userId
}).then(result => {
res.json(result);
}).catch(next);
};
\ No newline at end of file
... ...
... ... @@ -11,12 +11,40 @@ const helpers = global.yoho.helpers;
const _ = require('lodash');
const service = global.yoho.ServiceAPI;
const activity = () => {
return service.get('/operations/api/v5/resource/home', {
content_code: '8512bf0755cc549ac323f852c9fd945d',
gender: 1,
limit: 1000,
page: 1
const _activity = () => {
return service.get('/activity/lottery/getLotteryInfo', {
lotteryId: 20
});
};
const _user = (params) => {
return api.get('', {
method: 'app.passport.profile',
uid: params.uid
}, {
code: 200
});
};
const activity = (params) => {
return Promise.all([_activity(params), _user(params)]).then((result) => {
let resu = '';
let mobile = '';
if (result && result[0] && result[1] && result[1].data) {
resu = result[0].data;
mobile = result[1].data.mobile;
Object.assign(resu, {
mobile: mobile.substr(0,3) + '****' + mobile.substr(7)
});
}
return resu;
});
};
... ... @@ -43,7 +71,7 @@ const _formatOrderGoods = (orderGoods, count, haveLink, tickets) => {
color: value.color_name,
size: value.size_name,
price: value.goods_price,
count: value.buy_number
count: value.buy_num
};
/* gift=>是否赠品,advanceBuy=>是否加价购 */
... ... @@ -117,13 +145,9 @@ const _assignExpressInfo = (showLogistics, order) => {
* @param params
*/
const _getOrderData = (params) => {
return api.get('', {
method: 'app.SpaceOrders.get',
type: params.type,
return service.get('/activity/lottery/getValidOrderList', {
page: params.page,
limit: params.limit,
gender: params.gender,
yh_channel: params.yh_channel,
limit: 100,
uid: params.uid
}, {code: 200});
};
... ... @@ -319,19 +343,26 @@ const getOrders = (params) => {
count = 0;
let perOrder = _getOrderStatus(value);
/* 是否是虚拟商品 */
let isTickets = order.virtual_type && parseInt(order.virtual_type, 10) === 3;
Object.assign(perOrder, {
orderNum: value.order_code,
orderStatus: value.status_str,
sumCost: value.amount,
goods: _formatOrderGoods(value.order_goods, count, false, isTickets),
detailUrl: helpers.urlFormat('/home/orderdetail', {order_code: value.order_code}),
count: value.buy_total,
// count: value.buy_total,
isVirtual: isTickets,
isDepositAdvance: value.attribute * 1 === 9// 定金预售
isDepositAdvance: value.attribute * 1 === 9, // 定金预售
status: value.status === 0 ? true : false,
uid: value.uid,
order_code: value.order_code
});
_.forEach(value.order_goods, item => {
Object.assign(perOrder, {
count: item.buy_num
});
});
/* 如果运费大于0,会显示运费 */
... ... @@ -355,9 +386,38 @@ const getOrders = (params) => {
});
};
/**
* 抽奖
* @returns {*}
* @private
* @param params
*/
const lucky = (params) => {
return service.post('/activity/lottery/lucky', {
lotteryId: params.lotteryId,
userId: params.userId,
orderCode: params.orderCode
}, {code: 200});
};
/**
* 送有货币
* @returns {*}
* @private
* @param params
*/
const bind = (params) => {
return service.get('/activity/lottery/giveBindPrize', {
userId: params.userId
}, {code: 200});
};
module.exports = {
order,
getOrders,
activity
activity,
lucky,
bind
};
... ...
... ... @@ -79,7 +79,9 @@ router.get('/market/v2', market.v2); // 市场推广活动å‡çº§ç‰ˆï¼Œè‡ªå®šä¹‰ä
router.get('/raffle/activity', raffle.activity); // 微信免单抽奖活动
router.get('/raffle/orders', raffle.order); // 微信免单抽奖活动订单列表
router.get('/raffle/getOrders', raffle.getOrders); // 微信免单抽奖活动获取订单列表数据
router.get('/raffle/tip', raffle.tip); // 微信免单抽奖活动非首次绑定
router.get('/raffle/enter', raffle.enter); // 微信免单抽奖活动入口页
router.post('/raffle/lucky', raffle.lucky); // 微信免单抽奖按钮
router.get('/raffle/bind', raffle.bind); // 送有货币
router.get(/\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/, invite.checkType, invite.share);
... ...
... ... @@ -2,33 +2,25 @@
<div class="wx-act-c">
<div class="logo"></div>
<div class="title">
<p>·下单后一个月内的成功订单才能参加抽奖·</p>
<p>·成功订单只签收起15日内没有退换货的订单·</p>
<p>·每一笔成功订单均可享有一次抽奖机会·</p>
{{# lottery}}
<p>{{name}}</p>
{{/ lottery}}
</div>
<div class="kind"></div>
<ul class="kind-list">
<li>免单奖:全额免单</li>
<li>现金券:100元、50元、10元</li>
<li>满减卷:满299~50元、满499~100元</li>
{{# prizes}}
<li>{{name}}{{remark}}</li>
{{/ prizes}}
</ul>
<a class="btn" href="./orders"></a>
<div class="account">您已绑定账号:186****1234</div>
<div class="account">{{# mobile}}您已绑定账号:{{.}}{{/ mobile}}</div>
<div class="rule-c">
<p class="rule-title">活动说明</p>
<div class="rule-list-c">
<ul>
<li>1. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
<li>2. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
<li>3. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
<li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
<li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
<li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
<li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
<li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
<li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
<li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
<li>4. 活动说明示例文字示例文字示例文字示例文字示例文字</li>
{{# lottery}}
<li>{{remark}}</li>
{{/ lottery}}
</ul>
</div>
</div>
... ...
<div id="order-container" class="order-container">
<input type="hidden" class="dia-tip" value="{{uid}}" />
<div id="dialog-wrapper" class="dialog-wrapper dia-diy hide" style="touch-action: pan-y; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); display: block;">
<div class="dialog-box" style="top: 50%; margin-top: -94.5px;">
<div class="dialog-content"></div>
<div class="dialog-footer">
<span class="dialog-right-btn tap-hightlight" style="float: none; color: rgb(68, 68, 68); display: inline-block; border: 0px;">我知道了</span>
</div>
</div>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -32,8 +32,9 @@
<div class="dia-bg"></div>
<div class="dia-main">
<span class="close"></span>
<img src="{{imgSrc 'img/activity/raffle/dia-succ.png'}}" />
<img class="hide" src="{{imgSrc 'img/activity/raffle/dia-err.png'}}" />
<div class="lucky hide"></div>
<div class="unlucky hide"></div>
<p class="hide">免单金额会以有货币形式,在订单<span class="code"></span>,发货15天后且无退换货情况,返还至您的有货个人中心账户内,请注意查收!</p>
<a></a>
</div>
</div>
... ...
<div id="order-container" class="order-container">
<input type="hidden" class="dia-tip" />
</div>
\ No newline at end of file
... ... @@ -249,6 +249,9 @@ const bind = {
refer = helpers.urlFormat('/?go=1');
}
// 微信免单活动,判断来源地址 2.16.12.28 by jing.li@yoho.cn
res.cookie('bindUrl', 'http://m.yohobuy.com/passport/bind/success?type=bind');
res.render('bind/success', {
isPassportPage: true,
successTip: type === 'bind' ? '恭喜您,第三方账号绑定手机号码成功!' : '恭喜您,第三方账号关联手机号码成功!',
... ...
<div class="order" data-id="{{orderNum}}" data-href="{{detailUrl}}">
<header class="header">
订单编号:{{orderNum}}
<div class="raffle-btn">参与抽奖</div>
<div class="disable-btn hide">已抽奖</div>
{{#if status}}
<div class="raffle-btn" data-uid="{{uid}}" data-code="{{order_code}}">参加抽奖</div>
{{else}}
<div class="disable-btn">已抽奖</div>
{{/ if}}
<span class="order-status">{{orderStatus}}</span>
</header>
<section class="order-goods">
... ... @@ -17,14 +20,14 @@
{{!-- 对应订单状态的操作逻辑 --}}
{{#if isDepositAdvance}}
<div class="order-opt">
<div class="order-opt hide">
<span class="order-opt-info">请到App完成订单相关操作</span>
</div>
{{^}}
{{!-- 完成和取消订单显示删除按钮 --}}
{{#unless isAdvance}}
{{#unless unpaid}}
<div class="order-opt">
<div class="order-opt hide">
{{#unless unreceived}}
<span class="btn del">删除订单</span>
{{#if isVirtual}}
... ... @@ -45,7 +48,7 @@
{{#unless isAdvance}}
{{#if unpaid}}
<div class="order-opt">
<div class="order-opt hide">
<ul class="count-down hide">
<li>
<span class="iconfont count-down-icon">&#xe64a;</span>
... ... @@ -63,7 +66,7 @@
</div>
{{/if}}
{{^}}
<div class="order-opt">
<div class="order-opt hide">
*定金预售订单只能在APP端操作
</div>
{{/unless}}
... ... @@ -71,7 +74,7 @@
{{!-- 包含未发货和已发货状态,未发货不传logisticsUrl --}}
{{#if unreceived}}
{{#if logisticsUrl}}
<div class="order-opt">
<div class="order-opt hide">
<a class="locHref" href="{{logisticsUrl}}">
<span class="btn check-logistics">查看物流</span>
</a>
... ...

37.8 KB | W: | H:

28.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -34,6 +34,9 @@ var orderHammer,
$reaMask = $('.reason-mask'),
reasonSwiper;
var userId = '',
orderCode = '';
var orderContent = require('activity/raffle/order-content.hbs');
require('../common');
... ... @@ -197,10 +200,47 @@ orderHammer.on('tap', function(e) {
$reaMask.data('orderId', id);
if ($cur.closest('.raffle-btn').length > 0) {
userId = $cur.closest('.raffle-btn').attr('data-uid');
orderCode = $cur.closest('.raffle-btn').attr('data-code');
$.ajax({
type: 'POST',
url: 'lucky',
data: {
lotteryId: 1001,
userId: userId,
orderCode: orderCode
},
success: function(data) {
var lucky = data.data.orderLotteryCode;
switch(lucky){
case 0:
break;
case 1:
$('.lucky').show();
$('.dia-c').show();
$('.dia-main').find('p').show();
var dia_h = $('.dia-main').height() / 2;
$('.dia-main').css('margin-top', '-' + dia_h + 'px');
$('.dia-main').find('.code').text(orderCode);
break;
case 2:
$('.unlucky').show();
$('.dia-c').show();
var dia_h = $('.dia-main').height() / 2;
$('.dia-main').css('margin-top', '-' + dia_h + 'px');
break;
case 3:
tip.show('用户抽奖不能多个客户端一起抽奖');
break;
case 4:
tip.show('不符合抽奖条件');
break;
}
},
error: function(data) {
tip.show(data.message);
}
});
}
if ($cur.closest('.del').length > 0) {
... ... @@ -280,19 +320,44 @@ $(window).scroll(function() {
getOrders();
$(function() {
$('.dia-main').on('click', function () {
window.location.href = '//m.yohobuy.com/activity/raffle/orders'
});
if ($(".dia-tip").length > 0) {
// Order delete
dialog.showDialog({
dialogText: '您不是首次绑定,不能再领有货币啦,去参加免单抽奖吧',
hasFooter: {
leftBtnText: '我知道了'
if ($('.dia-tip').length > 0) {
if(window.cookie('bindUrl') == 'http://m.yohobuy.com/passport/bind/success?type=bind') {
userId = $('.dia-tip').val();
$.ajax({
type: 'GET',
url: 'bind',
data: {
userId: userId
},
success: function(res) {
var LotteryCode = res.data.orderLotteryCode;
switch(LotteryCode){
case 5:
$('.dialog-content').text('首次绑定50个有货币已到账,可以到个人中心查看,去参加抽奖吧');
break;
case 6:
$('.dialog-content').text('首次绑定送有货币失败');
break;
case 7:
$('.dialog-content').text('不是首次绑定,不能赠送有货币');
break;
}
},
error: function(res) {
tip.show(res.message);
}
}, function() {
});
} else {
$('.dialog-content').text('您不是首次绑定,不能再领有货币啦,去参加免单抽奖吧');
};
$(".dialog-left-btn").css({"float":"none","color":"#444","display":"inline-block","border":"0"});
$('.dialog-right-btn').on('click', function () {
window.location.href = '//m.yohobuy.com/activity/raffle/activity'
});
}
reasonSwiper = new Swiper('.box-main', {
... ...
... ... @@ -27,6 +27,9 @@
font-size: 20px;
color: #fff;
line-height: 40px;
padding: 0 30px;
max-height: 160px;
overflow: hidden;
}
}
... ... @@ -147,6 +150,7 @@
bottom: 0;
right: 0;
left: 0;
z-index: 1;
.dia-bg {
width: 100%;
... ... @@ -165,6 +169,41 @@
top: 50%;
left: 50%;
margin-left: -270px;
.lucky {
width: 540px;
height: 421px;
background: resolve("activity/raffle/dia-succ.png");
background-size: 100%;
}
.unlucky {
width: 540px;
height: 421px;
background: resolve("activity/raffle/dia-err.png");
background-size: 100%;
}
p {
width: 540px;
height: 128px;
position: absolute;
bottom: 83px;
left: 0;
font-size: 20px;
color: #444;
padding: 30px;
line-height: 30px;
}
a {
width: 214px;
height: 53px;
display: block;
position: absolute;
left: 162px;
bottom: 30px;
}
}
.close {
... ...