Authored by yyq

Merge branch 'release/1.0' of git.yoho.cn:fe/yoho-blk into release/1.0

... ... @@ -6,7 +6,7 @@
'use strict';
const serviceAPI = global.yoho.ServiceAPI;
// const api = global.yoho.API;
const api = global.yoho.API;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
const Promise = require('bluebird');
... ... @@ -258,31 +258,33 @@ const _processHeadData = (list) => {
// 推荐商品
// const _getRelatedData = (id) => {
// return api.get('', {
// query: id,
// method: 'app.search.li'
// }).then((result) => {
// let productList = {};
// if (result && result.code === 200) {
// // console.log(result);
// _.forEach(result.data. product_list, function(data) {
// // console.log(data)
// productList.name = data.product_name;
// productList.price = data.sales_price;
// productList.id = data.product_id;
// productList.cnAlphabet = data.cn_alphabet;
// });
const _getRelatedData = () => {
// console.log(id);
return api.get('', {
query: '51152761,51178582,51146105,51149561,51149414,51082157,51079256',
method: 'app.search.li'
}).then((result) => {
let productList = [];
// // console.log(productList)
// return productList;
// } else {
// logger.error('推荐商品 cood 不是 200');
// return {};
// }
// });
// };
if (result && result.code === 200) {
_.forEach(result.data.product_list, function(data) {
productList.push({
name: data.product_name,
price: data.sales_price,
id: data.product_id,
cnAlphabet: data.cn_alphabet
});
});
// console.log(productList)
return productList;
} else {
logger.error('推荐商品 cood 不是 200');
return {};
}
});
};
/**
* 详情页文章内容数据处理
... ... @@ -294,7 +296,8 @@ const _processContentData = (list) => {
list = camelCase(list);
let contentData = {
contents: []
contents: [],
collecation: []
};
_.forEach(list, function(value) {
... ... @@ -313,45 +316,58 @@ const _processContentData = (list) => {
contentData.contents = list;
// console.log(list)
// let collocation = {};
// let idList = '';
let formatData = [];
// _.forEach(contentData.contents, function(value) {
// // console.log(value)
_.forEach(contentData.contents, function(value) {
// if (value.goods) {
// console.log(value);
if (value.goods) {
// _.forEach(value.goods.data, function(data) {
_.forEach(value.goods.data, function(data) {
// _getRelatedData(51152761).then((result) => {
// idList += data.id + ',';
// idList = '51152761';
formatData.push(data);
});
}
});
// data = _.assign(data, result);
// data = _.assign(data, {
// link: `${config.siteUrl}/product/pro_${result.id}_${data.productSkc}/${result.cnAlphabet}`
// });
// });
// });
// }
// if (value.goodsGroup) {
// _.forEach(value.goodsGroup.data, function(data) {
// // console.log(data)
// _.forEach(data.list, function(value) {
// // console.log(value)
// _getRelatedData(51152761).then((result) => {
// // console.log(result)
// value = _.assign(value, result);
// value = _.assign(value, {
// link: `${config.siteUrl}/product/pro_${result.id}_${value.productSkc}/${result.cnAlphabet}`
// });
// // console.log(value)
// console.log(formatData)
_getRelatedData().then((result) => {
// formatData.push(result);
// console.log(formatData);
_.forEach(formatData, function(data, index) {
data[index] = _.assign(result[index]);
});
// console.log(formatData);
return formatData;
}).then(() => {
});
// if (value.goodsGroup) {
// _.forEach(value.goodsGroup.data, function(data) {
// // console.log(data)
// _.forEach(data.list, function(value) {
// // console.log(value)
// _getRelatedData(51152761).then((result) => {
// // console.log(result)
// value = _.assign(value, result);
// value = _.assign(value, {
// link: `${config.siteUrl}/product/pro_${result.id}_${value.productSkc}/${result.cnAlphabet}`
// });
// });
// });
// }
// });
// // console.log(value)
// });
// });
// });
// }
return contentData;
};
... ...
... ... @@ -42,7 +42,7 @@
</div>
{{/ text}}
{{!-- {{# goods}}
{{# goods}}
<div class="related-reco">
<div class="article-title">
<div class="title-line"></div>
... ... @@ -80,7 +80,7 @@
{{/ data}}
</div>
</div>
{{/ goodsGroup}} --}}
{{/ goodsGroup}}
{{/ content}}
{{#if brands}}
... ...
... ... @@ -143,6 +143,7 @@ const exchangeDeatail = (req, res) => {
navigation: mcHandler.getSideMenu('我的退/换货'),
banner: 'http://placehold.it/{width}x{height}',
returns: {
title: '换货详情',
exchange: result.exchangeDetail
}
}
... ...
... ... @@ -400,69 +400,6 @@ const _setExpressData = (data) => {
};
/**
* 设置换货详情数据
* @function _setExchangeDetailData
* @param { Object } data 接口返回换货订单数据
* @return { Object } 模板渲染换货数据
*/
const _setExchangeDetailData = (data) => {
data = camelCase(data);
let list = {};
switch (data.status) {
case 0:
Object.assign(list, {
audit: true,
reminder: true
});
break;
case 10:
Object.assign(list, {
through: true,
reminder: true
});
if (data.deliveryTpyeName === '寄回换货') {
Object.assign(list, {
logistics: true,
sendBack: true,
exchangeAddress: returnAddress
});
} else {
list.inDoor = true;
}
break;
case 30:
if (data.deliveryTpyeName === '寄回换货') {
list.takeGoods = true;
}
break;
case 50:
Object.assign(list, {
send: true,
reminder: true,
auditSuccess: true
});
break;
case 40:
Object.assign(list, {
finish: true,
auditSuccess: true
});
break;
case 91:
list.abolish = true;
break;
default:
break;
}
return list;
};
/**
* 获取退货商品信息
* @function getRefundGoodsData
* @param { number } orderCode 订单号
... ... @@ -637,6 +574,93 @@ const getChangeGoodsList = (orderCode, uid) => {
};
/**
* 设置换货详情数据
* @function _setExchangeDetailData
* @param { Object } data 接口返回换货订单数据
* @return { Object } 模板渲染换货数据
*/
const _setExchangeDetailData = (data) => {
data = camelCase(data);
console.log(data);
let list = {};
switch (data.status) {
case 0:
if (data.deliveryTpyeName === '寄回换货') {
Object.assign(list, {
audit: true,
reminder: true,
inDoor: false,
sendBack: true,
cancel: true,
location: true
});
} else {
Object.assign(list, {
audit: true,
reminder: true
});
}
break;
case 10:
Object.assign(list, {
through: true,
reminder: true
});
if (data.deliveryTpyeName === '寄回换货') {
Object.assign(list, {
logistics: true,
sendBack: true,
exchangeAddress: returnAddress,
cancel: true,
location: true
});
} else {
list.inDoor = true;
}
break;
case 20:
if (data.deliveryTpyeName === '寄回换货') {
Object.assign(list, {
logistics: true
});
}
break;
case 30:
if (data.deliveryTpyeName === '寄回换货') {
list.takeGoods = true;
list.auditSuccess = true;
}
break;
case 50:
Object.assign(list, {
send: true,
doubt: true,
auditSuccess: true
});
break;
case 40:
Object.assign(list, {
finish: true,
auditSuccess: true
});
break;
case 91:
list.abolish = true;
break;
default:
break;
}
return list;
};
/**
* 获取换货详情信息
* @function getExchangeDetailData
* @param { number } id 换货申请单号
... ...
... ... @@ -30,7 +30,7 @@
<div class="way">
{{#if takeGoods}}
<p class="contact">我们会尽快将您的商品发出,请耐心等待,如有疑问,请联系<span class="iconfont">&#xe61c;</span>在线客服</p>
<p class="contact">我们会尽快将您的商品发出,请耐心等待,如有疑问,请联系<a href="http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409"><span class="iconfont">&#xe61c;</span>在线客服</p></a>
{{/if}}
{{#if reminder}}
... ... @@ -45,67 +45,68 @@
{{/if}}
{{/if}}
{{#if audit}}
{{#if cancel}}
<p class="cancel">如果您不想换货了,您可以<span class="cancel-btn">取消申请</span></p>
{{/if}}
{{#if finish}}
{{#if doubt}}
<p class="contact">如有疑问,请联系<span class="iconfont">&#xe61c;</span>在线客服</p>
{{/if}}
{{#if logistics}}
<div class="return-express">
{{#if number}}
<div class="show-content" data-id="{{id}}">
<h4 class="third-title">寄回物流信息 <label class="reset-express btn white">修改</label></h4>
<p>请您耐心等待,我们会在收到货物后快速为您处理</p>
<p>物流公司:{{company}}</p>
<p>快递单号:{{number}}</p>
</div>
{{/if}}
<div class="edit-content{{#if number}} hide{{/if}}"{{# expressList}} data-{{id}}="{{name}}"{{/ expressList}}>
<h4 class="third-title">填写物流</h4>
<p>请您在<span class="blue">7月30日24:00</span>前将商品寄回并填写物流,逾期将自动取消申请</p>
<dl class="express-wrap">
<dd>
物流公司:
<select class="express-company">
{{# expressList}}
<option value="{{id}}">{{name}}</option>
{{/ expressList}}
</select>
</dd>
<dd>
快递单号:
<input type="text" class="express-code" value="{{number}}">
</dd>
<dd>
<span class="submit-express btn">提交</span>
<span class="error-tip blue hide">请填写完整寄回物流信息</span>
</dd>
</dl>
</div>
</div>
{{/if}}
{{# exchangeAddress}}
<div class="return-address">
<h4 class="third-title">寄回地址</h4>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址:{{address}}</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;人:{{name}}</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编:{{code}}</p>
<p>联系电话:{{phone}}</p>
</div>
{{/ exchangeAddress}}
{{#if auditSuccess}}
<div class="order">
<span class="check">查看</span>
<span class="exchange-order">换货订单</span>
</div>
{{/if}}
</div>
{{#if logistics}}
<div class="return-express">
{{#if expressNumber}}
<div class="show-content" data-id="{{id}}">
<h4 class="third-title">寄回物流信息 <label class="reset-express btn white">修改</label></h4>
<p>请您耐心等待,我们会在收到货物后快速为您处理</p>
<p>物流公司:{{ expressCompany}}</p>
<p>快递单号:{{expressNumber}}</p>
</div>
{{/if}}
<div class="edit-content{{#if expressNumber}} hide{{/if}}"{{# expressList}} data-{{id}}="{{name}}"{{/ expressList}}>
<h4 class="third-title">填写物流</h4>
<p>请您在<span class="blue">七天内</span>将商品寄回并填写物流,逾期将自动取消申请</p>
<dl class="express-wrap">
<dd>
物流公司:
<select class="express-company">
{{# expressList}}
<option value="{{id}}">{{name}}</option>
{{/ expressList}}
</select>
</dd>
<dd>
快递单号:
<input type="text" class="express-code" value="{{number}}">
</dd>
<dd>
<span class="submit-express btn">提交</span>
<span class="error-tip blue hide">请填写完整寄回物流信息</span>
</dd>
</dl>
</div>
</div>
{{/if}}
{{# exchangeAddress}}
<div class="return-address">
<h4 class="third-title">寄回地址</h4>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址:{{address}}</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;人:{{name}}</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编:{{code}}</p>
<p>联系电话:{{phone}}</p>
</div>
{{/ exchangeAddress}}
{{#if location}}
<div class="address">
... ...
... ... @@ -31,7 +31,6 @@
</div>
{{/if}}
{{#if showEditOption}}
<p class="subtext">评价晒单</p>
<a href="{{refundUrl}}" class="{{#if hideChange}}disable{{/if}}">
<p class="subtext">申请退货</p>
</a>
... ...
var lazyload = require('yoho-jquery-lazyload');
var Handlebars = require('yoho-handlebars');
var tpl = '{{#each products}}' +
'<div class="goods-info" data-skn="{{productSkn}}">' +
'<a href="{{url}}" target="_blank">' +
'<img class="lazy thumb" src="{{defaultImages}}" style="display: block;">' +
'</a>' +
'<div class="desc">' +
'<a class="name" href="{{url}}" target="_blank">{{productName}}</a>' +
'<p class="price">¥{{salesPrice}}</p>' +
'</div>' +
'</div>' +
'{{/each}}';
var tplFn = Handlebars.compile(tpl);
require('../common/header');
require('./list/favorite');
var tplFn = require('../../tpl/product/shop-goods.hbs');
// require('../common/header');
// require('./list/favorite');
lazyload();
$(function() {
... ...
... ... @@ -2,6 +2,11 @@
.state {
font-size: 16px;
color: #5cb0de;
margin-top: 45px;
display: block;
height: 35px;
line-height: 35px;
margin-bottom: 10px;
span {
font-size: 20px;
... ... @@ -33,12 +38,12 @@
}
p {
line-height: 22px;
line-height: 25px;
display: block;
}
.cancel {
display: block;
margin-top: 18px;
width: 220px;
height: 50px;
line-height: 50px;
... ... @@ -133,6 +138,8 @@
font-size: 16px;
height: 50px;
line-height: 50px;
margin-top: 10px;
display: block;
}
.table {
... ... @@ -153,13 +160,13 @@
}
.info {
width: 496px;
width: 507px;
text-align: left;
}
.st,
.op {
width: 206px;
width: 200px;
}
}
}
... ... @@ -293,7 +300,20 @@
}
.edit-content {
margin: 30px 0;
margin: 30px 0 10px;
border-bottom: 1px solid #eee;
p {
height: 32px;
line-height: 32px;
display: block;
}
}
.third-title {
height: 35px;
line-height: 35px;
display: block;
}
.submit-express {
... ... @@ -313,4 +333,43 @@
}
}
.express-wrap {
margin-bottom: 10px;
dd {
height: 35px;
}
.submit-express {
margin-left: 70px;
}
}
.show-content {
margin-top: 25px;
padding-bottom: 20px;
border-bottom: 1px solid #eee;
h4 {
dislay: block;
width: 160px;
height: 30px;
line-height: 30px;
}
p {
display: block;
height: 25px;
line-height: 25px;
}
.reset-express {
width: 40px;
height: 20px;
float: right;
line-height: 20px;
margin-top: 5px;
}
}
}
... ...
{{#each products}}
<div class="goods-info" data-skn="{{productSkn}}">
<a href="{{url}}" target="_blank">
<img class="lazy thumb" src="{{defaultImages}}" style="display: block;">
</a>
<div class="desc">
<a class="name" href="{{url}}" target="_blank">{{productName}}</a>
<p class="price">{{salesPrice}}</p>
</div>
</div>
{{/each}}
... ...