Authored by zhangxiaoru

资讯

... ... @@ -130,11 +130,11 @@ const getProductInfo = (req, res, next) => {
* 换货详情页
*/
const exchangeDeatail = (req, res) => {
let id = parseInt(req.params.applyId, 10),
uid = req.user.uid;
// let id = parseInt(req.params.applyId, 10),
// uid = req.user.uid;
// let id = 125946;
// let uid = 8050560;
let id = 125946;
let uid = 8050560;
returns.getExchangeDetailData(id, uid).then(result => {
... ...
... ... @@ -79,7 +79,7 @@ const changeSubmitAsync = (data, uid) => {
goods: JSON.stringify(data.goods)
});
return api.get('', requestData, {code: 200});
return api.get('', requestData);
};
const setExpressNumberAsync = (uid, param, isChange) => {
... ...
... ... @@ -368,23 +368,34 @@ const _setExpressData = (data) => {
const _setExchangeDetailData = (data) => {
data = camelCase(data);
data.status = 10;
let list = {};
switch (data.status) {
case 0:
list.audit = true;
list.reminder = true;
break;
case 10:
list.through = true;
list.reminder = true;
if (data.deliveryTpyeName === '寄回换货') {
list.courier = true;
list.logistics = true;
list.sendBack = true;
list.exchangeAddress = returnAddress;
} else {
list.inDoor = true;
}
break;
case 30:
if (data.deliveryTpyeName === '寄回换货') {
list.takeGoods = true;
}
break;
case 50:
list.send = true;
list.reminder = true;
list.auditSuccess = true;
break;
case 40:
... ... @@ -392,7 +403,7 @@ const _setExchangeDetailData = (data) => {
list.auditSuccess = true;
break;
case 91:
list.cancel = true;
list.abolish = true;
break;
default:
break;
... ... @@ -576,16 +587,6 @@ const getExchangeDetailData = (id, uid) => {
exchangeDetail: {}
};
// if (result.data) {
// // console.log(_setRefundDetailData(result.data));
// Object.assign(exchangeData.exchangeDetail, _setReturnStatus(result.data.statusList));// 头部
// Object.assign(exchangeData.exchangeDetail, _setExchangeDetailData(result.data));
// Object.assign(exchangeData.exchangeDetail, camelCase(result.data));
// }
if (result[0] && result[0].data) {
let data = result[0].data;
... ... @@ -602,7 +603,6 @@ const getExchangeDetailData = (id, uid) => {
}
// console.log(exchangeData.exchangeDetail.expressList);
return exchangeData;
});
};
... ...
... ... @@ -11,6 +11,10 @@
<p class="state"><span class="iconfont">&#xe60f;</span>换货申请已通过</p>
{{/if}}
{{#if takeGoods}}
<p class="state"><span class="iconfont">&#xe60f;</span>您寄回的商品已收到</p>
{{/if}}
{{#if send}}
<p class="state"><span class="iconfont">&#xe61a;</span>换货商品已发出</p>
{{/if}}
... ... @@ -19,27 +23,37 @@
<p class="state"><span class="iconfont">&#xe60f;</span>换货完成</p>
{{/if}}
{{#if cancel}}
<p class="state">您已取消申请</p>
{{#if abolish}}
<p class="abolish">您已取消申请</p>
{{/if}}
<div class="way">
{{#if finish}}
<p class="contact">如有疑问,请联系<span class="iconfont">&#xe61c;</span>在线客服</p>
{{else}}
{{#if takeGoods}}
<p class="contact">我们会尽快将您的商品发出,请耐心等待,如有疑问,请联系<span class="iconfont">&#xe61c;</span>在线客服</p>
{{/if}}
{{#if reminder}}
{{#if inDoor}}
<p class="way-title">您已选择{{deliveryTpyeName}}</p>
{{/if}}
<p>请将商品连同吊牌、包装、发货单(如无发货单,您可找张白纸上注明订单编号,收货人姓名及手机号码)、发票(如有)、赠品(如有)一并保存,
如有遗漏将影响您的退换货进度,敬请谅解
</p>
{{#if sendBack}}
<p>非我司原因的退换货,寄回运费由您承担。商品客观问题的退换货,请您先行垫付运费,邮费会在退款中补贴给您<b>我们不接受平邮和到付,感谢您的理解与支持。</b></p>
{{/if}}
{{/if}}
{{#if audit}}
<p class="cancel">如果您不想换货了,您可以<span class="cancel-btn">取消申请</span></p>
{{/if}}
{{#if through}}
{{#if finish}}
<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}}">
... ... @@ -73,7 +87,17 @@
</dl>
</div>
</div>
{{/if}}
{{/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">
... ... @@ -83,6 +107,7 @@
{{/if}}
</div>
{{#if location}}
<div class="address">
<p class="address-title">收货地址<span class="modify-btn">修改</span></p>
<div class="address-detail">
... ... @@ -96,6 +121,7 @@
</div>
</div>
{{/if}}
</div>
<span class="exchange-goods">换货商品</span>
... ...
... ... @@ -62,20 +62,20 @@
<div class="application-form">
<div class="input-group">
<span class="asterisk">*</span>
<label for="city">所在区域:</label>
<label for="city" class="change-area">所在区域:</label>
<span id="city" class="cascading-address"></span>
</div>
<div class="input-group">
<div class="input-group require">
<span class="asterisk">*</span>
<label for="person">收货人:</label>
<input id="user" class="input" type="text" name="person">
</div>
<div class="input-group">
<div class="input-group require">
<span class="asterisk">*</span>
<label for="address">详细地址:</label>
<input id="addr" class="input" type="text" name="address">
</div>
<div class="input-group">
<div class="input-group require">
<span class="asterisk">*</span>
<label for="mobile">手机号码:</label>
<input id="mob" class="input" type="text" name="mobile">
... ...
... ... @@ -282,8 +282,12 @@ const setProductData = base => {
total: 0
};
// 目前没有RGB值先以背景图方式实现
group.rgb = `url('${helpers.image(value.colorImage, 30, 30)}')`;
// 有RGB值限时rgb值没有则显示背景图
if (value.colorCode) {
group.rgb = `#${value.colorCode}`;
} else {
group.rgb = `url('${helpers.image(value.colorImage, 30, 30)}')`;
}
// 商品颜色列表
_.forEach(value.goodsImagesList, function(subValue) {
... ... @@ -417,12 +421,18 @@ const setBrandIntro = brand => {
let barndIntro = {};
if (brand) {
let text = _.replace(brand.brandIntro, /<\/?[^>]*>|\s*|(\n)|(\t)|(\r)/g, ''),
more = `... <a href="/product/shop/${brand.brandDomain}?brandIntro=true" class="blue">了解更多>></a>`;
barndIntro = {
brand: {
titleEn: 'BRAND',
titleCn: '品牌介绍',
logo: brand.brandIco,
intro: brand.brandIntro
intro: _.truncate(text, {
length: 300,
omission: more
})
}
};
}
... ...
var colorTpl = require('../../tpl/me/color-list.hbs');
var sizeTpl = require('../../tpl/me/size-list.hbs');
var dialog = require('../plugins/dialog');
var _alert = dialog.Alert;
var addrSelector = require('../plugins/cascading-address');
var addr;
var nameReg = /^[\u4e00-\u9fa5]{2,5}$/;
var addressReg = /^[\s\S]{2,100}$/;
var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
var validate = require('./order/validation');
var validateMap = {
user: {
sl: '#user',
v: {
reg: nameReg,
errMsg: '真实姓名至少2个中文,最多5个中文'
}
},
addr: {
sl: '#addr',
v: {
reg: addressReg,
errMsg: '详细地址不能为空'
}
},
mob: {
sl: '#mob',
v: {
reg: phoneReg,
errMsg: '您输入的联系电话格式不正确'
}
}
};
// 添加.check方法
require('../plugins/check');
... ... @@ -247,18 +280,52 @@ function submitChange(d) {
url: '/me/return/submitExchange',
data: d
}).done(function(result) {
console.log(result);
if (result.code === 200) {
location.href = '/me/return';
} else {
new _alert('<h1>' + result.message + '</h1>').show();
}
}).fail(function(err) {
console.log(err);
});
}
function validateData() {
var $inputs = $('.express-info-box .require input');
var pass = true;
$inputs.each(function(idx, input) {
var k = input.id;
if (k && validateMap[k]) {
if (!validate.do(validateMap[k].sl, validateMap[k].v)) {
pass = false;
}
}
});
// 检查地址
if (!validate.addr(addr.getAreaIds(), {
el: '#city',
errMsg: '请填写完整的省市区信息'
})) {
pass = false;
}
return pass;
}
function bindConfirmEvent() {
$('.confirm').on('click', function() {
var $changeGood = $('.change-info-box.will-change');
var changeGoodsList = [];
var changeData = {};
if (!validateData()) {
return false;
}
$changeGood.each(function(index, good) {
var goodObj = {};
var $good = $(good);
... ... @@ -290,6 +357,17 @@ function bindConfirmEvent() {
});
}
function bindBlurEvent() {
$('.express-info-box .require input').on('blur', function() {
var $this = $(this);
var v = validateMap[this.id];
if ($this.val().length > 0) {
validate.do(v.sl, v.v);
}
});
}
function initAddr() {
addr = addrSelector({
... ... @@ -304,4 +382,5 @@ $(document).on('ready', function() {
bindCheckboxEvent();
bindConfirmEvent();
initAddr();
bindBlurEvent();
});
... ...
... ... @@ -9,6 +9,18 @@
}
}
.abolish {
font-size: 16px;
color: #5cb0de;
padding-bottom: 15px;
border-bottom: 1px solid #eee;
span {
font-size: 20px;
margin-right: 5px;
}
}
.way {
font-size: 14px;
border-bottom: 1px solid #eee;
... ... @@ -22,7 +34,6 @@
p {
line-height: 22px;
height: 22px;
}
.cancel {
... ... @@ -48,6 +59,7 @@
.contact {
line-height: 50px;
height: 50px;
span {
margin-left: 20px;
... ... @@ -61,7 +73,7 @@
}
.order {
margin: 23px 0 10px;
margin-bottom: 10px;
height: 50px;
line-height: 50px;
overflow: hidden;
... ... @@ -288,4 +300,17 @@
margin-bottom: 10px;
}
.return-address {
padding: 40px 0 20px;
border-bottom: 1px solid #eee;
> p {
padding-top: 10px;
}
> p:first-child {
padding-top: 0;
}
}
}
... ...
... ... @@ -109,6 +109,25 @@
color: #c71814 !important;
}
.error-msg {
color: #c71814;
}
.correct-msg {
@extend .blue;
}
.error-msg,
.correct-msg {
font-size: 14px;
padding-left: 5px;
.iconfont {
font-size: 14px;
margin-right: 5px;
}
}
@import "address";
@import "order/index";
@import "return/index";
... ...
... ... @@ -180,24 +180,5 @@
}
}
}
.error-msg {
color: #c71814;
}
.correct-msg {
color: $skyBlue;
}
.error-msg,
.correct-msg {
font-size: $normalSize;
padding-left: 5px;
.iconfont {
font-size: $normalSize;
margin-right: 5px;
}
}
}
}
... ...
... ... @@ -46,6 +46,10 @@
left: 90px;
}
.change-area {
width: 375px !important;
}
.change-type {
padding-bottom: 20px;
border-bottom: 1px solid #f1f1f1;
... ...
... ... @@ -265,8 +265,7 @@
}
.intro-text {
max-height: 100px;
overflow: hidden;
line-height: 2;
}
}
... ...