Authored by jinhu.tung

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

... ... @@ -322,6 +322,7 @@ const _getUserOrder = (uid, type, page) => {
item.refundUrl = helpers.urlFormat('/me/return/refund/' + item.orderCode);
item.exchangeUrl = helpers.urlFormat('/me/return/exchange/' + item.orderCode);
item.detailUrl = helpers.urlFormat('/me/order/detail/' + item.orderCode);
});
return {
... ...
... ... @@ -10,6 +10,6 @@
<span>尺码:
<span class="bold">{{sizeName}}</span>
</span>
<p class="bold buy-number">{{> icon/error-round}}{{buyNumber}}</p>
<p class="bold buy-number"><span class="iconfont">&#xe61d;</span>{{buyNumber}}</p>
</div>
</div>
... ...
... ... @@ -14,7 +14,7 @@
</div>
<div class="common-column special-border status">
<p class="bold status-str">{{statusStr}}</p>
<a href="/me/order/detail?code={{orderCode}}">
<a href="{{detailUrl}}" target="_blank">
<p class="subtext check-detail">查看详情</p>
</a>
</div>
... ...
{{# refundDetail}}
<div class="refund-datail-wrap" data-id="{{id}}">
<a href="/help?id=43" class="refund-notice">退货须知</a>
<a href="/help?id=43" class="refund-notice" target="_blank">退货须知</a>
{{> returns/returns-status}}
{{# orderReview}}
... ...
{{# refund}}
<div class="refund-wrap">
<a href="/help?id=43" class="refund-notice">退货须知</a>
<a href="/help?id=43" class="refund-notice" target="_blank">退货须知</a>
{{> returns/returns-status}}
<h4 class="third-title">选择退货商品</h4>
... ...
... ... @@ -24,7 +24,7 @@
<p class="subtext cancel-apply" data-type="{{type}}" data-apply-id="{{id}}">取消申请</p>
{{/ ../this}}
{{/isY}}
<a href="{{detailUrl}}">
<a href="{{detailUrl}}" target="_blank">
<p class="subtext">查看详情</p>
</a>
</div>
... ...
... ... @@ -2,10 +2,10 @@
<div class="center-content">
<ul class="about-us clearfix">
<li><a href="{{siteUrl}}">BLK首页</a></li>
<li><a href="{{siteUrl}}/help">客户服务</a></li>
<li><a href="{{siteUrl}}/help?id=2">支付方式</a></li>
<li><a href="{{siteUrl}}/help?id=31">配送方式</a></li>
<li><a href="{{siteUrl}}/help?id=41">售后服务</a></li>
<li><a href="{{siteUrl}}/help" target="_blank">客户服务</a></li>
<li><a href="{{siteUrl}}/help?id=2" target="_blank">支付方式</a></li>
<li><a href="{{siteUrl}}/help?id=31" target="_blank">配送方式</a></li>
<li><a href="{{siteUrl}}/help?id=41" target="_blank">售后服务</a></li>
</ul>
<div class="record-info">
<p>
... ...
... ... @@ -5,13 +5,67 @@
*/
var $ = require('yoho-jquery');
var $bagNum = $('.bag-num'),
$bagGoodsList = $('.mini-goods-list');
var $searchWrap = $('.search-wrapper'),
$searchForm = $('#search-form'),
$searchKey = $('#search-key'),
$clearInput = $('.clear-input');
var goodsTpl = require('../../tpl/common/bag-goods.hbs');
var delayer;
function handelProduct(data) {
var goods = [],
list = ['commonPros', 'preSalePros', 'noStorage'];
var i, total = 0;
for (i = 0; i < list.length; i++) {
if (data[list[i]].length) {
goods = goods.concat(data[list[i]]);
}
}
$.each(goods, function(key) {
total += +goods[key].buy_number || 0;
});
return {
total: total,
goods: goods
};
}
function refreshBag() {
$.ajax({
type: 'GET',
url: '/shopping/cart/data',
data: {},
success: function(result) {
var data;
if (result.code === 200) {
data = handelProduct(result);
if (data.total) {
$bagNum.text(data.total);
$bagGoodsList.html(goodsTpl(data));
$bagGoodsList.parent().removeClass('bag-empty');
} else {
$bagNum.text('');
$bagGoodsList.empty();
$bagGoodsList.parent().addClass('bag-empty');
}
}
}
})
};
refreshBag();
$('.yoho-group a').hover(function() {
var data = $(this).data();
... ... @@ -89,3 +143,7 @@ $(document).click(function(e) {
$searchWrap.hide();
}
});
module.exports = {
refreshBag
};
... ...
... ... @@ -8,7 +8,6 @@ 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}$/;
... ... @@ -21,8 +20,10 @@ var validateMap = {
user: {
sl: '#user',
v: {
reg: nameReg,
errMsg: '真实姓名至少2个中文,最多5个中文'
maxLength: 12,
minLength: 2,
necessary: true,
errMsg: '真实姓名至少2个字符,最多12个字符'
}
},
addr: {
... ... @@ -44,79 +45,6 @@ var validateMap = {
// 添加.check方法
require('../plugins/check');
// var numCtrl = {
// valueEl: $('.number .value'),
// btn: {
// minus: $('.number .minus'),
// plus: $('.number .plus')
// },
// scope: {
// 1: {
// min: true,
// do: function(t) {
// t.btn.minus.addClass('disable');
// }
// }
// },
// initNumberScope: function() {
// var maxValue = this.valueEl.text();
//
// this.btn.plus.addClass('disable');
//
// this.scope[maxValue] = {
// max: true,
// do: function(t) {
// t.btn.plus.addClass('disable');
// }
// };
// },
// bindNumberEvent: function() {
// var $val = this.valueEl;
// var val = parseInt($val.text(), 10);
// var scope = this.scope;
// var that = this;
//
//
// this.btn.minus.on('click', function() {
// if ($(this).hasClass('disable')) {
// return;
// }
//
// if (that.btn.plus.hasClass('disable')) {
// that.btn.plus.removeClass('disable');
// }
//
// val -= 1;
// $val.text(val);
//
// if (scope[val] && scope[val].min) {
// scope[val].do(that);
// }
// });
//
// this.btn.plus.on('click', function() {
// if ($(this).hasClass('disable')) {
// return;
// }
//
// if (that.btn.minus.hasClass('disable')) {
// that.btn.minus.removeClass('disable');
// }
//
// val += 1;
// $val.text(val);
//
// if (scope[val] && scope[val].max) {
// scope[val].do(that);
// }
// });
// },
// init: function() {
// this.initNumberScope();
// this.bindNumberEvent();
// }
// };
function setActive($item) {
var color = $item.find('.color-text').data('color');
var size = $item.find('.size-text').data('size');
... ... @@ -313,7 +241,7 @@ function validateData() {
var k = input.id;
if (k && validateMap[k]) {
if (!validate.do(validateMap[k].sl, validateMap[k].v)) {
if (!validate.start(validateMap[k].sl, validateMap[k].v)) {
pass = false;
}
}
... ... @@ -397,7 +325,7 @@ function bindBlurEvent() {
var v = validateMap[this.id];
if ($this.val().length > 0) {
validate.do(v.sl, v.v);
validate.start(v.sl, v.v);
}
});
}
... ...
... ... @@ -6,7 +6,6 @@ var addr;
var validate = require('./validation');
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}$/;
... ... @@ -14,8 +13,10 @@ var validateMap = {
name: {
sl: '#user-name',
v: {
reg: nameReg,
errMsg: '真实姓名至少2个中文,最多5个中文'
maxLength: 12,
minLength: 2,
necessary: true,
errMsg: '真实姓名至少2个字符,最多12个字符'
}
},
address: {
... ... @@ -73,14 +74,14 @@ function validateData() {
var k = getValidateKey(input.id);
if (k && validateMap[k]) {
if (!validate.do2(validateMap[k].sl, validateMap[k].v)) {
if (!validate.start(validateMap[k].sl, validateMap[k].v)) {
pass = false;
}
}
});
// 检查选填项
if ($phone.val().length > 0 && !validate.do2(validateMap.phone.sl, validateMap.phone.v)) {
if ($phone.val().length > 0 && !validate.start(validateMap.phone.sl, validateMap.phone.v)) {
pass = false;
}
... ... @@ -199,7 +200,7 @@ function showDiaglog(tpl, onEdit) {
var v = validateMap[getValidateKey($this.get(0).id)];
if ($this.val().length > 0) {
validate.do2(v.sl, v.v);
validate.start(v.sl, v.v);
}
});
}
... ...
var common = require('../../common');
var makeValidate = {
reg: function(val, reg) {
return reg.test(val);
},
minLength: function(val, l) {
return val.length >= l;
return common.getStrLength(val) >= l;
},
maxLength: function(val, l) {
return common.getStrLength(val) <= l;
},
isNumber: function(val, bl) {
return bl && !isNaN(parseInt(val, 10));
},
necessary: function(val, bl) {
return bl && val.length > 0;
return bl && common.getStrLength(val) > 0;
},
addr: function(val) {
// 完整的地址应该是长度为三的数组
... ... @@ -58,11 +65,15 @@ function validate(selector, conditions) {
if (makeValidate[c] && !makeValidate[c].call(null, $el.val(), conditions[c])) {
pass = false;
showMsg({
el: selector,
err: true,
msg: conditions.errMsg
});
return false;
} else if (c !== 'errMsg') {
showMsg({
el: selector
... ... @@ -93,7 +104,7 @@ function validateAddr(val, conditions) {
}
module.exports = {
do2: validate,
start: validate,
addr: validateAddr
};
... ...
... ... @@ -5,7 +5,6 @@
*/
var $ = require('yoho-jquery'),
lazyload = require('yoho-jquery-lazyload'),
handlebars = require('yoho-handlebars'),
upload = require('../plugins/upload'),
Alert = require('../plugins/dialog').Alert;
... ... @@ -23,14 +22,7 @@ var orderCode = $('#order-code').val() || 0,
type: $refundType.find('.type-item.cur').data('id') // 1--原卡返回 2--银行卡 3--支付宝 4--yoho币
};
var tpl = '<div class="img-wrap" data-img="{{data}}">' +
'<div class="img-opt">' +
'<span class="review-upimg">查看</span>' +
'<span class="cancel-upimg">删除</span>' +
'</div>' +
'<div class="img-view"><img src="{{data}}"></div>' +
'</div>',
imgFn = handlebars.compile(tpl);
var imgBoxTpl = require('../../tpl/me/thumbnail.hbs');
var checked;
... ... @@ -139,7 +131,7 @@ function packApplyInfo() {
}
good.evidence_images = [];
$special.find('.img-wrap').each(function() {
$special.find('.thumb-box').each(function() {
var img = $(this).data('img');
if (img) {
... ... @@ -223,7 +215,7 @@ $refundTable.on('change', '.refund-reason', function() {
num = $this.data('num') || 0;
if (num > 3) {
new Alert('<h1>最多上传4张凭证</h1>').show();
$this.addClass('hide');
return;
}
... ... @@ -232,26 +224,28 @@ $refundTable.on('change', '.refund-reason', function() {
if (result && result.code === 200) {
// 避免异步上传导致数量不统一
num = $this.data('num') || 0;
if (num > 3) {
$this.addClass('hide');
return;
} else if (num === 3) {
$this.addClass('hide');
}
$this.siblings('.img-up-tip').text(++num + '/4');
$this.data('num', num);
$this.before(imgFn(result));
$this.before(imgBoxTpl({src: result.data}));
}
}
});
}).on('click', '.img-opt > span', function() {
}).on('click', '.thumb-box .delete', function() {
var $this = $(this),
$wrap = $this.closest('.img-wrap'),
$wrap = $this.closest('.thumb-box'),
$upBtn = $wrap.siblings('.img-upload'),
num = $upBtn.data('num') || 0;
if ($this.hasClass('cancel-upimg')) {
$wrap.siblings('.img-up-tip').text(--num + '/4');
$wrap.remove();
$upBtn.data('num', num);
}
$wrap.siblings('.img-up-tip').text(--num + '/4');
$wrap.remove();
$upBtn.removeClass('hide').data('num', num);
});
$refundType.on('click', '.type-item', function() {
... ...
... ... @@ -20,6 +20,7 @@ var detailErr = '2-100字符。1个中文为2个字符';
var addressDialogTpl;
var addressTpl;
require('yoho-jquery-placeholder');
require('yoho-jquery-dotdotdot');
// dot someone
... ... @@ -29,6 +30,11 @@ function dotYou($el) {
});
}
// place holder
function placeHolderYou($el) {
$el.placeholder();
}
// set address-all show or not
function setAllOfAddress() {
... ... @@ -290,6 +296,9 @@ function initAddressContent($el, areaCode) {
$cur.siblings('.error-tips').hide();
}
});
// place holder
placeHolderYou($el.find('[placeholder]'));
}
/**
... ...
... ... @@ -102,7 +102,7 @@
.icon-bag {
background-image: url('/layout/bag.png');
line-height: 22px;
line-height: 24px;
text-align: center;
}
... ... @@ -166,6 +166,13 @@
background: #fff;
}
.mini-goods-list {
width: 340px;
max-height: 350px;
display: block;
overflow-x: hidden;
}
.go-bag-btn {
font-size: 20px;
line-height: 1;
... ... @@ -198,6 +205,15 @@
height: 64px;
}
.name {
width: 150px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display: block;
cursor: pointer;
}
.info {
width: 160px;
padding-left: 10px;
... ... @@ -207,6 +223,10 @@
width: 100px;
text-align: right;
}
.del-good-btn {
cursor: pointer;
}
}
}
}
... ...
... ... @@ -121,12 +121,8 @@
font-weight: normal;
.iconfont {
outline: 3px solid #fff;
outline-offset: -3px;
border-radius: 100%;
background: #000;
font-weight: normal;
color: #fff;
color: #000000;
}
&.last {
... ...
... ... @@ -93,17 +93,13 @@
margin-right: 20px;
}
.img-wrap,
.img-upload {
width: 60px;
height: 60px;
border: 1px dashed #eee;
line-height: 60px;
float: left;
border: 1px dashed #eee;
margin-right: 10px;
}
.img-upload {
line-height: 60px;
text-align: center;
color: #dfdfdf;
cursor: pointer;
... ... @@ -112,31 +108,35 @@
font-size: 34px;
}
}
}
.img-wrap {
position: relative;
}
.img-wrap:hover .img-opt {
display: block;
}
.thumb-box {
position: relative;
float: left;
.img-opt {
width: 100%;
height: 20px;
line-height: 20px;
background: #555;
font-size: 12px;
color: #fff;
opacity: 0.7;
.operation-box {
display: none;
width: 60px;
padding: 5px 0;
position: absolute;
top: 0;
background-color: rgba(0, 0, 0, 0.6);
text-align: center;
display: none;
font-size: 12px;
> * {
display: inline-block;
.delete {
cursor: pointer;
}
* {
color: #fff !important;
}
}
&:hover {
.operation-box {
display: block;
}
}
}
... ...
... ... @@ -130,6 +130,7 @@
.address-chosed {
position: absolute;
bottom: 0;
bottom: -1px\9; /* stylelint-disable-line */
right: 0;
}
... ...
{{# goods}}
<dd class="goods-item clearfix">
<div class="thumb">
<a href="/product/pro_{{product_id}}_{{goods_id}}/{{cn_alphabet}}.html" target="_blank">
<img src="{{image goods_images 48 64}}">
</a>
</div>
<div class="info">
<a href="/product/pro_{{product_id}}_{{goods_id}}/{{cn_alphabet}}.html" class="name" target="_blank">{{product_name}}</a>
<p>颜色:{{color_name}} 尺码:{{size_name}}</p>
</div>
<div class="price">
<p>¥{{round sales_price 2}} X{{buy_number}}</p>
<span class="del-good-btn">删除</span>
</div>
</dd>
{{/ goods}}
\ No newline at end of file
... ...
<div class="thumb-box">
<div class="thumb-box" data-img="{{src}}">
<img class="envidence" src="{{src}}" alt="凭证图片">
<div class="operation-box">
<a href="{{src}}" target="_blank">查看</a>
... ...