Authored by 王水玲

分期3

... ... @@ -26,9 +26,12 @@ const _reviewStatus = (res, req, uid, status) => {
}
};
} else if (status === '2') {
return Promise.all([installmentModel.getSearchIntallment({
page: 1
}), installmentModel.getQueryCreditInfo(uid)]).then((result) => { //eslint-disable-line
return Promise.all([
installmentModel.getSearchIntallment({
page: 1
}),
installmentModel.getQueryCreditInfo(uid)
]).then((result) => { //eslint-disable-line
return {
success: {
price: result[1].currCreditLimit,
... ... @@ -108,21 +111,16 @@ const index = (req, res) => {
};
if (openStatus === '0') {
return installmentModel.getResources('0876085ff46bed27f1a1eb6ee8b68987').then(data => {
//if (data[0] && data[0].data[0]) {
// data[0].data[0].url = 'javascript:void(0)'; //eslint-disable-line
//}
console.log(data);
_.forEach(data, (item) => {
return Promise.all([installmentModel.getResources('0876085ff46bed27f1a1eb6ee8b68987'), installmentModel.getNotices()]).then(data => {
_.forEach(data[0], (item) => {
if (item.singleOne) {
item.data[0].url = 'javascript:void(0)'; //eslint-disable-line
}
});
return {
content: data,
content: data[0],
notice: data[1],
notOpen: true,
installmentOnly: installmentOnly
};
... ... @@ -131,12 +129,14 @@ const index = (req, res) => {
return Promise.all([
installmentModel.getQueryCreditInfo(uid),
installmentModel.getQueryAmtInfo(uid),
installmentModel.getResources('0876085ff46bed27f1a1eb6ee8b68987')
installmentModel.getResources('c233ad4ca91fef45ed7d0b26d9953e61'),
installmentModel.getNotices()
]).then((data) => {
let params = _.assign({
isOverdue: false,
installmentOnly: installmentOnly,
content: data[2]
content: data[2],
notice: data[3]
}, data[0], data[1]);
// status: 1 正常 2 逾期 3 不可用 4 未开通
... ... @@ -490,7 +490,9 @@ const orderDetail = (req, res) => {
navBtn: false,
currAmtCount: 0,
currFeeCount: 0,
isCurrFee: true,
isInstallmentPage: true,
isCurrFee: true
}, {
helpers: {
isPaymentComplete: function(status, options) {
if (status === 2 || status === 4 || status === 5) { // 已结清/已取消
... ... @@ -621,7 +623,6 @@ const bankCard = (req, res) => {
const cardDetail = (req, res) => {
installmentModel.getCardDetail(req.cookies.installmentUid, req.query.cardIdNo).then(result => {
console.log(result);
res.render('installment/card-detail', {
module: 'home',
page: 'card-detail',
... ...
... ... @@ -191,54 +191,12 @@ const _processCardDetail = (list, cardIdNo) => {
*/
const getResources = (code) => {
return serviceAPI.get('/operations/api/v5/resource/get', {
content_code: code
content_code: code,
platform: 'iphone'
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
result.data = [
{
data: [
{
alt: "",
src: "http://img11.static.yhbimg.com/yhb-img01/2016/08/18/14/01064654393c04d83721d16b36f3a0d896.jpg?imageView2/{mode}/w/{width}/h/{height}",
title: "",
url: "http://www.yohobuy.com"
}
],
template_id: '11272',
template_intro: '一张图片',
template_name: 'single_image',
singleImage: true,
singleOne: true
},
{
data: [
{
url: "#",
title: "部分银行服务时间调整通知"
},
{
url: "#",
title: "aaa"
},
{
url: "#",
title: "bbb"
},
{
url: "#",
title: "ccc"
}
],
template_id: '11272',
template_intro: '公告',
template_name: 'notice',
time: 3,
announcement: true
}
];
return resourcesProcess(result.data);
} else {
logger.error('get resources data return code is not 200');
... ... @@ -275,6 +233,12 @@ const getQueryCreditInfo = (uid) => {
}, {
timeout: API_TIMEOUT
}).then((result) => {
result = {
code: 200,
data: {
currCreditLimit: 5000
}
};
if (result && result.code === 200) {
return result.data;
} else {
... ... @@ -546,25 +510,26 @@ const getCardDetail = (uid, cardIdNo) => {
method: 'user.instalment.getBankCards',
uid: uid
}, {
timeout: API_TIMEOUT
timeout: API_TIMEOUT,
cache: true
}).then((result) => {
result = {
alg: "SALT_MD5",
alg: 'SALT_MD5',
code: 200,
data: [
{
id: "1",
userName: "*三",
cardNo: "0000",
bankCode: "ABC",
bankName: "农业银行",
mobile: "18021200000",
cardIdNo: "BK201610204789114",
masterType: "1"
id: '1',
userName: '*三',
cardNo: '0000',
bankCode: 'ABC',
bankName: '农业银行',
mobile: '18021200000',
cardIdNo: 'BK201610204789114',
masterType: '1'
}
],
md5: "6d729d4b35f10fc73531210bd7ecff91",
message: "success"
md5: '6d729d4b35f10fc73531210bd7ecff91',
message: 'success'
};
if (result && result.code === 200) {
return _processCardDetail(result.data, cardIdNo);
... ... @@ -593,6 +558,26 @@ const setMasterCard = (params) => {
});
};
// 公告
const getNotices = () => {
return api.get('', {
method: 'app.resources.getNotices',
position: 8
}, {
cache: true
}).then((res) => {
if (res && res.code === 200) {
if (res.data && res.data.list.length < 1) {
return false;
} else {
return res.data;
}
} else {
return false;
}
});
};
module.exports = {
getStauts,
getQueryCreditInfo,
... ... @@ -612,5 +597,6 @@ module.exports = {
postAccount,
getCardDetail,
delBankCard,
setMasterCard
setMasterCard,
getNotices
};
... ...
... ... @@ -8,10 +8,10 @@
{{#if singleImage}}
{{> resources/banner}}
{{/if}}
{{#announcement}}
{{> installment/installment-notice}}
{{/announcement}}
{{/ content}}
{{#notice}}
{{> installment/installment-notice}}
{{/notice}}
<div class="open-index">
<ul class="open-info">
<li>
... ... @@ -49,11 +49,9 @@
{{/if}}
<a href="/home/installment/repay/7daylist" class="see-btn nav-bit" data-id="2">明细</a>
</div>
{{# content}}
{{#announcement}}
{{> installment/installment-notice}}
{{/announcement}}
{{/ content}}
{{#notice}}
{{> installment/installment-notice}}
{{/notice}}
<ul class="group-list">
<li><a href="/home/installment/repay/month" class="nav-bit" data-id="3">本月待还金额:<div class="list-right"><span class="list-r-txt">¥{{monthAmt}}</span><span class="iconfont"> &#xe604;</span></div></a></li>
<li><a href="/home/installment/repay/total" class="nav-bit" data-id="4">待还总金额:<div class="list-right"><span class="list-r-txt">¥{{totalAmt}}</span><span class="iconfont"> &#xe604;</span></div></a></li>
... ...
... ... @@ -17,6 +17,13 @@
{{# installmentOnly}}
{{> installment/installment-only}}
{{/ installmentOnly}}
<div class="advertisement-area">
<div class="mask-bg"></div>
<a class="advertisement-box" href="{{url}}">
<i class="close-box"></i>
<img src="{{img}}"/>
</a>
</div>
{{/ success}}
{{# error}}
<div class="error">
... ...
... ... @@ -80,7 +80,6 @@
</ul>
</div>
{{/order}}
{{> installment/repayment-bottom}}
{{#isRefundedAll order.status}}
... ...
... ... @@ -11,13 +11,12 @@
<div class="date-box">{{../create_time}}</div>
</div>
{{/order_goods}}
<div class="right-box">
<div class="amount">¥{{amount}}</div>
<div class="status">{{install_status}}</div>
</div>
<div class="clearfix"></div>
</a>
<div class="right-box">
<div class="amount">¥{{amount}}</div>
<div class="status">{{install_status}}</div>
</div>
<div class="clearfix"></div>
</li>
{{/each}}
{{/if}}
... ...
<div class="notice-wrap clearfix">
<div class="notice" data-time="{{time}}">
<span class="notice-icon"></span>
{{#data}}
{{#list}}
<a class="notice-item item-{{@index}}" href="{{url}}">
{{title}}
</a>
{{/data}}
{{/list}}
</div>
</div>
... ...
... ... @@ -17,20 +17,31 @@ module.exports = {
siteUrl: '//m.yohobuy.com',
assetUrl: '//localhost:5001',
domains: {
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/'
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/'
// favApi: 'http://192.168.102.31:8092/brower',
// api: 'http://192.168.102.205:8080/gateway/',
// service: 'http://192.168.102.205:8080/gateway/',
// search: 'http://192.168.102.216:8080/yohosearch/'
// api: 'http://api.yoho.yohoops.org/',
// service: 'http://service.yoho.yohoops.org/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
// api: 'http://dev-api.yohops.com:9999/',
// service: 'http://dev-service.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test1.yohops.com:9999/'
},
subDomains: {
host: '.m.yohobuy.com',
... ...
... ... @@ -8,8 +8,7 @@
var $ = require('yoho-jquery'),
tip = require('../plugin/tip'),
bp = require('./burying-point'),
loading = require('../plugin/loading'),
lazyLoad = require('yoho-jquery-lazyload');
loading = require('../plugin/loading');
var ListData = function(opt) {
var self = this;
... ... @@ -38,6 +37,8 @@ var ListData = function(opt) {
});
};
require('yoho-jquery-lazyload');
ListData.prototype.getListData = function(page) {
var self = this;
... ... @@ -85,7 +86,9 @@ ListData.prototype.getListData = function(page) {
REC_ID: self.opt.uuid
});
lazyLoad($('img.lazy'));
$('img.lazy').lazyload({
effect: 'fadeIn'
});
}
}
... ...
... ... @@ -42,7 +42,6 @@ require('./overdue-notice');
repayment.setTotal(0);
repayment.setFee(0);
/**
* 订单状态样式
*/
... ... @@ -91,7 +90,6 @@ $(CHECKBOX_SELECTOR + ':checkbox').click(function() {
repayment.update();
});
// 默认选择第一个
$(CHECKBOX_SELECTOR + ':checkbox:first').click();
... ...
... ... @@ -43,6 +43,10 @@ var loadOrderList = function(pageIndex, type) {
$('#order-list').append(result);
$('#order-list li').on('click', function() {
loading.showLoadingMask();
});
// 订单状态样式
$('.status').each(function() {
... ...
/**
* ajax 分期首页
* @author: wsl<shuiling.wang@yoho.cn>
* @date: 2016/08/17
*/
var $ = require('yoho-jquery'),
ellipsis = require('yoho-mlellipsis'),
ListData = require('./installment-goods'),
bp = require('./burying-point'),
PullRefresh = require('../plugin/pull-refresh'),
noticeScroll = require('../plugin/notice-scroll'),
uuid = require('uuid'),
lazyLoad = require('yoho-jquery-lazyload');
uuid = require('uuid');
var uuidVal = uuid.v4(),
$tab = $('.detail-tab span'),
$isOpen = $('.is-open'),
$installmentCont = $('.installment-cont');
var installment = {
init: function() {
var self = this;
var starIScroll;
self.paramsInit();
require('../common');
$(window).on('mousewheel', false);
noticeScroll('.notice', $('.notice').data('time') * 1000);
ellipsis.init();
self.setDetailText();
noticeScroll('.notice', $('.notice').data('time') * 1000);
lazyLoad($('img.lazy'));
ellipsis.init();
$('img.lazy').lazyload({
effect: 'fadeIn'
});
$(window).on('mousewheel', false);
if (self.$isOpen.val() === 'true') {
self.iscrollAction();
}
if ($isOpen.val() === 'true') {
// 下拉刷新
starIScroll = new PullRefresh('.installment-main', {
pullDown: function() {
if($('.detail-tab .on').index() === 0) {
location.href = '/home/installment/index?uid=20000184&tab=1';
} else {
location.href = '/home/installment/index?uid=20000184&tab=2';
}
// 商品列表翻页加载数据
new ListData({
url: '/home/installment/get-goods',
page: 1,
boxArea: $('#goods-list'),
uuid: self.uuidVal
});
if (self.cookieTab && window.queryString.refresh) {
self.$tab.eq(self.cookieTab).addClass('on').siblings().removeClass('on');
self.$installmentCont.hide().eq(self.cookieTab).show();
}
});
starIScroll.iScroll.on('scroll', function() {
$(window).trigger('scroll');
});
}
// 商品列表翻页加载数据
new ListData({
url: '/home/installment/get-goods',
page: 1,
boxArea: $('#goods-list'),
uuid: uuidVal
});
// 标题限制行数
function setDetailText() {
var $this, $title;
// 已开通tab 切换
self.$tab.on('click', function() {
self.tabChangeAction(this);
});
$('.good-detail-text .name').each(function() {
$this = $(this);
$title = $this.find('a');
// 统计:开通按钮点击时
$('.open-btn').on('click', function() {
bp.setContYas('YB_INST_OPEN', {});
});
$title[0].mlellipsis(2);
});
}
$(document).on('click', '.good-info', function() {
setDetailText();
// 统计:商品点击时
bp.setContYas('YB_INST_HOME_GDS_LIST', {
PRD_NUM: parseInt($(this).index()) + 1, //eslint-disable-line
PRD_ID: $(this).data('goodId'),
ACTION_ID: 1,
REC_ID: self.uuidVal
});
});
if (window.queryString.tab === '2') {
$tab.eq(1).addClass('on').siblings().removeClass('on');
$installmentCont.hide().eq(1).show();
starIScroll.iScroll.refresh();
}
// 统计:开通后模块位点击时
$('.nav-bit').on('click', function() {
bp.setContYas('YB_INST_REPAYMENT_CLICK', {
POS_ID: $(this).data('id')
});
});
// 已开通tab 切换
$tab.on('click', function() {
var labId = 1;
if (window.queryString.status === '2') {
setTimeout(function() {
$('.advertisement-area').fadeIn();
}, 2000);
$(this).addClass('on').siblings().removeClass('on');
$installmentCont.hide().eq($(this).index()).show();
$('.advertisement-area .close-box, .advertisement-area .mask-bg').on('click', function() {
$('.advertisement-area').fadeOut();
return false;
});
}
if ($(this).index() === 1) {
setDetailText();
labId = 2;
lazyLoad($('img.lazy'));
}
self.setCookies();
},
setDetailText: function() { // 标题限制行数
var $this, $title;
// 统计:开通成功后首页头部tab切换
bp.setContYas('YB_INST_OPENED_HOME_CLICK', {
LAB_ID: labId
});
$('.good-detail-text .name').each(function() {
$this = $(this);
$title = $this.find('a');
starIScroll.iScroll.refresh();
});
$title[0].mlellipsis(2);
});
},
tabChangeAction: function(dom) {
var self = this,
labId = 1,
index = $(dom).index();
$(dom).addClass('on').siblings().removeClass('on');
self.$installmentCont.hide().eq(index).show();
window.setCookie('installmentTab', index);
if (index === 1) {
self.setDetailText();
labId = 2;
$('img.lazy').lazyload({
effect: 'fadeIn'
});
}
// 统计:开通按钮点击时
$('.open-btn').on('click', function() {
bp.setContYas('YB_INST_OPEN', {});
});
// 统计:开通成功后首页头部tab切换
bp.setContYas('YB_INST_OPENED_HOME_CLICK', {
LAB_ID: labId
});
$(document).on('click', '.good-info', function() {
self.starIScroll.iScroll.refresh();
},
iscrollAction: function() {
// 下拉刷新
var starIScroll = new PullRefresh('.installment-main', {
pullDown: function() {
window.setCookie('installmentTab', $('.detail-tab .on').index());
location.href = '/home/installment/index?uid=' + window.queryString.uid + '&refresh=1';
}
});
// 统计:商品点击时
bp.setContYas('YB_INST_HOME_GDS_LIST', {
PRD_NUM: parseInt($(this).index()) + 1, //eslint-disable-line
PRD_ID: $(this).data('goodId'),
ACTION_ID: 1,
REC_ID: uuidVal
});
});
starIScroll.iScroll.on('scroll', function() {
$(window).trigger('scroll');
});
// 统计:开通后模块位点击时
$('.nav-bit').on('click', function() {
bp.setContYas('YB_INST_REPAYMENT_CLICK', {
POS_ID: $(this).data('id')
});
});
$('img').on('load', function() {
starIScroll && starIScroll.iScroll.refresh();
});
this.starIScroll = starIScroll;
},
paramsInit: function() {
var self = this;
$.extend(self, {
uuidVal: uuid.v4(),
$tab: $('.detail-tab span'),
$isOpen: $('.is-open'),
$installmentCont: $('.installment-cont'),
cookieTab: window.cookie('installmentTab') + 0,
starIScroll: ''
});
},
setCookies: function() {
window.setCookie('installmentUid', window.queryString.uid);
window.setCookie('yhChannel', window.queryString.yh_channel);
window.setCookie('udid', window.queryString.udid);
window.setCookie('clientType', window.queryString.client_type);
}
};
require('../common');
require('yoho-jquery-lazyload');
$(window).load(function() {
if ($('.installment-only').length > 0) {
// 统计:进入页面时
bp.setContYas('YB_INST_HOME', {
IS_OPEN: $isOpen.val()
IS_OPEN: installment.$isOpen.val()
});
// 统计:商品第一页加载时
... ... @@ -124,10 +174,10 @@ $(window).load(function() {
PRD_NUM: $('.installment-only .good-info').length,
PRD_ID: bp.countGoodsId(),
ACTION_ID: 0,
REC_ID: uuidVal
REC_ID: installment.uuidVal
});
if ($isOpen.val() === 'true') {
if (installment.$isOpen.val() === 'true') {
// 统计:待还款金额默认页面加载时
bp.setContYas('YB_INST_OPENED_HOME_LOAD', {
... ... @@ -137,7 +187,6 @@ $(window).load(function() {
}
});
window.setCookie('installmentUid', window.queryString.uid);
window.setCookie('yhChannel', window.queryString.yh_channel);
window.setCookie('udid', window.queryString.udid);
window.setCookie('clientType', window.queryString.client_type);
$(function() {
installment.init();
});
... ...
... ... @@ -20,7 +20,6 @@
left: 0;
top: 0;
width: 100%;
height: 100%;
height: calc(100vh);
}
... ... @@ -137,6 +136,13 @@
}
#goods-list {
position: relative;
padding-left: 15px;
padding-top: 8px;
}
/*
#goods-list {
padding: 0 15px;
margin: 15px 0 0;
width: 100%;
... ... @@ -160,6 +166,7 @@
height: 100%;
}
}
*/
}
.review-icon {
... ... @@ -243,6 +250,55 @@
border-bottom: 1px solid #dedee0;
}
.advertisement-area {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 9;
display: none;
.mask-bg {
background: rgba(0, 0, 0, 0.4);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.close-box {
width: 44px;
height: 44px;
background: #000;
border-radius: 50%;
position: absolute;
top: 10px;
right: 10px;
z-index: 10;
}
.advertisement-box {
width: 540px;
height: 550px;
background: rgba(255, 255, 255, 0.6);
border-radius: 15px;
position: absolute;
top: 50%;
left: 50%;
margin: -275px 0 0 -270px;
img {
position: absolute;
width: 100%;
left: 50%;
top: 50%;
transform: translateY(-50%) translateX(-50%);
}
}
}
.error {
p {
text-align: center;
... ... @@ -408,6 +464,7 @@
.usable {
display: none;
background: #efefef;
}
.usable-area {
... ...
.installment-order-page {
background: #f0f0f0;
font-weight: 300;
position: relative;
.all-completed {
text-align: center;
... ... @@ -72,6 +73,11 @@
height: 160px;
border-bottom: 1px solid #e1e1e1;
}
a {
float: left;
width: 100%;
}
}
.image-box,
... ... @@ -112,6 +118,7 @@
.status {
font-size: 24px;
margin-top: 10px;
&.faded {
color: #b1b1b1;
}
... ... @@ -216,7 +223,6 @@
&.faded {
color: #b0b0b0;
}
&.expired {
... ...