Authored by 李靖

个人信息联调

... ... @@ -2,11 +2,12 @@
'use strict';
const headerModel = require('../../../doraemon/models/header');
const storeHomeModel = require('../models/store-home');
exports.index = (req, res) => {
exports.photography = (req, res, next) => {
let responseData = {
module: 'activity',
page: 'store-index',
page: 'store-photography',
pageHeader: headerModel.setNav({
navTitle: '个人中心'
}),
... ... @@ -14,10 +15,17 @@ exports.index = (req, res) => {
localCss: true,
};
res.render('store-home/index', responseData);
let params = {
uid: req.user.uid,
shopType: 3
};
req.ctx(storeHomeModel).baseInfo(params).then(result => {
res.render('store-home/photography', Object.assign(responseData, result));
}).catch(next);
};
exports.coffee = (req, res) => {
exports.coffee = (req, res, next) => {
let responseData = {
module: 'activity',
page: 'store-coffee',
... ... @@ -28,10 +36,17 @@ exports.coffee = (req, res) => {
localCss: true,
};
res.render('store-home/coffee', responseData);
let params = {
uid: req.user.uid,
shopType: 1
};
req.ctx(storeHomeModel).baseInfo(params).then(result => {
res.render('store-home/coffee', Object.assign(responseData, result));
}).catch(next);
};
exports.green = (req, res) => {
exports.green = (req, res, next) => {
let responseData = {
module: 'activity',
page: 'store-green',
... ... @@ -42,7 +57,14 @@ exports.green = (req, res) => {
localCss: true,
};
res.render('store-home/green', responseData);
let params = {
uid: req.user.uid,
shopType: 2
};
req.ctx(storeHomeModel).baseInfo(params).then(result => {
res.render('store-home/green', Object.assign(responseData, result));
}).catch(next);
};
exports.history = (req, res) => {
... ... @@ -73,7 +95,7 @@ exports.ewm = (req, res) => {
res.render('store-home/ewm', responseData);
};
exports.coupon = (req, res) => {
exports.coupon = (req, res, next) => {
let responseData = {
module: 'activity',
page: 'store-coupon',
... ... @@ -84,5 +106,12 @@ exports.coupon = (req, res) => {
localCss: true,
};
res.render('store-home/coupon', responseData);
let params = {
uid: req.user.uid,
shopType: req.query.shopType
};
req.ctx(storeHomeModel).baseInfo(params).then(result => {
res.render('store-home/coupon', Object.assign(responseData, result));
}).catch(next);
};
... ...
'use strict';
const camelCase = global.yoho.camelCase;
class storeHome extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
baseInfo(params) {
let options = {
data: {
method: 'extend.trade.userinfo',
uid: params.uid,
shop_type: params.shopType
},
param: {
code: 200
}
};
return this.get(options).then(result => {
let coffee = result.data.vip_type === 1;
let green = result.data.vip_type === 2;
let photography = result.data.vip_type === 3;
Object.assign(result.data, {
photography: photography,
coffee: coffee,
green: green,
process: this.getProcess(result.data.cousume_amount, result.data.vip_type)
});
result = camelCase(result.data);
return result;
});
}
getProcess(amount, type) {
let process = 0;
switch (type) {
case 1:
if (amount < 0) {
amount = 0;
}
if (amount > 2000) {
amount = 2000;
}
process = (amount / 2000) * 100;
return process;
case 2:
amount -= 1000;
if (amount < 0) {
amount = 0;
}
if (amount > 4000) {
amount = 4000;
}
process = (amount / 4000) * 100;
return process;
case 3:
if (amount < 0) {
amount = 0;
}
if (amount > 10000) {
amount = 10000;
}
process = (amount / 10000) * 100;
return process;
default:
return process;
}
}
}
module.exports = storeHome;
... ...
... ... @@ -283,7 +283,7 @@ router.get('/free-mail/list', auth, freeMail.freeMailList); // 免邮券列表
router.get('/free-mail/verify', auth, freeMail.receiveVerify); // 免邮券领取验证
router.get('/free-mail/verifyCoupon', auth, freeMail.receiveCoupon); // 免邮券领取
router.get('/store-home/index', auth, storeHome.index); // 线下店个人中心
router.get('/store-home/photography', auth, storeHome.photography); // 线下店个人中心-摄影
router.get('/store-home/coffee', auth, storeHome.coffee); // 线下店个人中心-咖啡
router.get('/store-home/green', auth, storeHome.green); // 线下店个人中心-绿植
router.get('/store-home/history', auth, storeHome.history); // 线下店个人中心-消费明细
... ...
<div class="store-home">
<div class="coupon-list">
{{# coupons}}
<div class="coupon-item">
<div class="coupon-title">现金券</div>
<div class="coupon-title eps">{{couponName}}</div>
<div class="coupon-main">
<div class="left">
<p class="price">100</p>
<p class="price">{{couponAmount}}</p>
<p class="limit">满399使用</p>
</div>
<div class="right">
<p class="date">2017.7.1-2017.7.30</p>
<p class="detail-btn">详细信息
<span class="iconfont up">&#xe615;</span>
<span class="iconfont down">&#xe616;</span>
</p>
</div>
</div>
<div class="coupon-foot">
<div class="dot-line">
<div class="left-dot"></div>
<div class="right-dot"></div>
<p></p>
</div>
<p>限品牌:VANS</p>
<p>特例商品(秒杀、限定、境外、预售等)暂不支持使用。</p>
</div>
</div>
<div class="coupon-item">
<div class="coupon-title">现金券</div>
<div class="coupon-main">
<div class="left">
<p class="price">100</p>
<p class="limit">满399使用</p>
</div>
<div class="right">
<p class="date">2017.7.1-2017.7.30</p>
<p class="date">{{validateDate}}</p>
<p class="detail-btn">详细信息
<span class="iconfont up">&#xe615;</span>
<span class="iconfont down">&#xe616;</span>
... ... @@ -50,5 +26,6 @@
<p>特例商品(秒杀、限定、境外、预售等)暂不支持使用。</p>
</div>
</div>
{{/ coupons}}
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -3,7 +3,7 @@
<div class="ewm-main">
<img class="user-pic" src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3996494032,1106789965&fm=117&gp=0.jpg" />
<p>KRIS WU</p>
<img class="ewm-pic" src="http://qr.api.cli.im/qr?data=http%253A%252F%252Fwww.lmxhome.cn%252F&level=H&transparent=false&bgcolor=%23ffffff&forecolor=%23000000&blockpixel=12&marginblock=1&logourl=&size=280&kid=cliim&key=23ee10bd965ce63435f9ca73d6c3ddb4" />
<div class="ewm-pic"></div>
</div>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -14,56 +14,56 @@
<div class="ewm-c">
<a class="ewm" href="//m.yohobuy.com/activity/store-home/ewm"></a>
</div>
<div class="id">ID:475247198</div>
<div class="id hide">ID:475247198</div>
</div>
</div>
</div>
<div class="user-info">
<div class="logo coffee"></div>
<div class="logo {{#if coffee}}coffee{{/if}} {{#if photography}}photography{{/if}} {{#if green}}green{{/if}}"></div>
<ul class="info-list">
<li>
<div class="left">消费金额</div>
<a class="right" href="//m.yohobuy.com/activity/store-home/history">¥1224.00
<a class="right" href="//m.yohobuy.com/activity/store-home/history">¥{{cousumeAmount}}
<span class="iconfont">&#xe604;</span>
</a>
</li>
<li>
<div class="left">消费次数</div>
<div class="right">45</div>
<div class="right">{{cousumeNum}}</div>
</li>
<li>
<div class="left">我的积分</div>
<div class="right">188</div>
<div class="right">{{creditPoints}}</div>
</li>
</ul>
<div class="process-c">
<div class="process-line">
<div style="width: 66%;"></div>
<div style="width: {{process}}%;"></div>
</div>
<ul class="level-c">
<li>
<ul class="level-c" data-vip="{{vipLevel}}">
<li class="disable">
<div class="dot"></div>
<span class="vip vip-1"></span>
<div class="price">¥10</div>
<div class="price">¥{{#if coffee}}0{{/if}}{{#if photography}}0{{/if}}{{#if green}}1000{{/if}}</div>
</li>
<li>
<li class="disable">
<div class="dot"></div>
<span class="vip vip-2"></span>
<div class="price">¥1000</div>
<div class="price">¥{{#if coffee}}800{{/if}}{{#if photography}}5000{{/if}}{{#if green}}3000{{/if}}</div>
</li>
<li class="disable">
<div class="dot"></div>
<span class="vip vip-3"></span>
<div class="price">¥2000</div>
<div class="price">¥{{#if coffee}}2000{{/if}}{{#if photography}}10000{{/if}}{{#if green}}5000{{/if}}</div>
</li>
</ul>
</div>
<ul class="list coupon">
<a href="//m.yohobuy.com/activity/store-home/coupon">
<a href="//m.yohobuy.com/activity/store-home/coupon?shopType={{vipType}}">
<li class="list-item">
<span class="title">我的优惠券</span>
<span class="iconfont">&#xe604;</span>
<span class="s-title">2</span>
<span class="s-title">{{couponsNum}}</span>
</li>
</a>
</ul>
... ...
... ... @@ -13,7 +13,7 @@ const isTest = process.env.NODE_ENV === 'test';
const domains = {
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
singleApi: 'http://api-test1.yohops.com:9999/',
global: 'http://global-test-soa.yohops.com:9999',
liveApi: 'http://testapi.live.yohops.com:9999/',
imSocket: 'ws://socket.yohobuy.com:10240',
... ...
require('activity/store-home.page.css');
import $ from 'yoho-jquery';
import Page from 'yoho-page';
class StoreCoupon extends Page {
constructor() {
super();
this.selector = {
$toggleBtn: $('.detail-btn'),
};
this.init();
}
init() {
this.bindEvents();
}
bindEvents() {
this.selector.$toggleBtn.on('click', this.toggle.bind(this));
}
toggle(e) {
let $this = $(e.currentTarget);
$this.parents('.coupon-item').find('.coupon-foot').toggle().find('.up').toggle().find('.down').toggle();
}
}
$(() => {
new StoreCoupon();
});
... ...
require('activity/store-home.page.css');
import Page from 'yoho-page';
import $ from 'yoho-jquery';
import 'yoho-jquery-qrcode';
class PersonDetail extends Page {
constructor() {
super();
this.selector = {
$ewm: $('.ewm-pic')
};
this.init();
}
init() {
this.selector.$ewm.qrcode({
render: 'canvas', // 显示方式,canvas,image和div
text: '20364534', // 二维码的内容
size: parseInt(420, 10), // 大小
ecLevel: 'H', // 纠错级别
});
}
}
$(() => {
new PersonDetail();
});
... ...
import $ from 'yoho-jquery';
import Page from 'yoho-page';
class Photography extends Page {
constructor() {
super();
this.selector = {
$levelC: $('.level-c')
};
this.init();
}
init() {
let vipLevel = this.selector.$levelC.data('vip');
this.selector.$levelC.find(`li:lt(${vipLevel})`).removeClass('disable');
}
}
module.exports = Photography;
... ...
require('activity/store-home.page.css');
const Photography = require('./store-home/index');
new Photography();
... ...
... ... @@ -30,6 +30,12 @@ input::-webkit-calendar-picker-indicator {
.store-home {
position: relative;
.eps {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.edit-title {
font-size: 24px;
color: #b0b0b0;
... ... @@ -198,6 +204,20 @@ input::-webkit-calendar-picker-indicator {
background-image: url("/activity/store-home/coffee.png");
margin: 0 auto;
}
&.photography {
width: 120px;
height: 120px;
background-image: url("/activity/store-home/photography.png");
margin: 0 auto;
}
&.green {
width: 120px;
height: 120px;
background-image: url("/activity/store-home/green.png");
margin: 0 auto;
}
}
.info-list {
... ... @@ -378,6 +398,10 @@ input::-webkit-calendar-picker-indicator {
width: 420px;
height: 420px;
margin: 40px auto 0;
canvas {
width: 100%;
}
}
}
}
... ... @@ -395,7 +419,7 @@ input::-webkit-calendar-picker-indicator {
font-size: 30px;
color: #fff;
line-height: 91px;
padding-left: 30px;
padding: 0 30px;
}
.coupon-main {
... ... @@ -441,14 +465,14 @@ input::-webkit-calendar-picker-indicator {
color: #b0b0b0;
}
.iconfont.down {
.iconfont.up {
display: none;
}
.coupon-foot {
height: 115px;
display: none;
position: relative;
padding: 7px 0;
padding: 8px 0;
line-height: 50px;
font-size: 24px;
background-color: #fff;
... ...