Authored by 王水玲

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

... ... @@ -183,7 +183,7 @@ const _processHeadData = (list) => {
if (index === 2) {
newData.headData = _.assign(newData.headData, {
commentNum: data.total
commentNum: data.total || 0
});
}
});
... ... @@ -697,7 +697,7 @@ const getDetailData = (id, appType, gender, tag, uid, udid) => {
head: res.headData,
tags: res.tags,
content: result[2],
comment: result[3],
comment: _.assign({total: 0}, result[3]),
brands: result[6],
nextArticle: result[5],
perArticle: result[4]
... ...
... ... @@ -45,8 +45,9 @@ const detail = (req, res, next) => {
const pageData = result[0];
const thumb = result[1];
if (_.has(pageData, 'orderDetail.orderCode')) {
pageData.orderDetail.orderCodeM = crypto.encryption(config.crypto.common, pageData.orderDetail.orderCode);
if (_.has(pageData, 'orderDetail.order_code')) {
pageData.orderDetail.orderCodeM =
crypto.encryption(config.crypto.common, (pageData.orderDetail.order_code).toString());
}
// 转译
... ... @@ -137,14 +138,21 @@ const getCancelOrderReason = (req, res, next) => {
const editOrder = (req, res, next) => {
const uid = req.user.uid;
const query = req.query;
const parameter = req.body;
query.uid = uid;
query.orderCode = crypto.decrypt(config.crypto.common, query.orderCode);
parameter.uid = uid;
parameter.orderCode = parseInt(crypto.decrypt(config.crypto.common, parameter.orderCode), 10);
orderModel.editOrder(query).then(result => {
res.json(result);
}).catch(next);
if (!parameter.uid || !parameter.orderCode) {
res.json({
code: '401',
message: '请输入合法订单号'
});
} else {
orderModel.editOrder(parameter).then(result => {
res.json(result);
}).catch(next);
}
};
const reAdd = (req, res, next) => {
... ...
... ... @@ -6,7 +6,7 @@
'use strict';
const router = require('express').Router(); // eslint-disable-line
const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const auth = require(`${global.middleware}/auth`);
const csurf = require('csurf');
... ... @@ -31,7 +31,7 @@ router.get('/deleteOrder', order.deleteOrder);
router.get('/cancelOrder', order.cancelOrder);
router.get('/getCancelOrderReason', order.getCancelOrderReason);
router.get('/getExpressInfo', order.getExpressInfo);
router.get('/editOrder', order.editOrder);
router.post('/editOrder', order.editOrder);
router.get('/reAdd', order.reAdd);
router.get('/confirmReceive', order.confirmReceive);
... ...
<div class="yoho-list-empty">
<div class="tip-search">
<div class="tip-search-img"></div>
<i class="icon iconfont"></i>
</div>
<p class="tip-cn">抱歉! 未找到{{#if query}}与"<span>{{query}}</span>"{{/if}}相关商品</p>
... ...
... ... @@ -212,7 +212,7 @@
如需纸质发票可自行下载打印。
</div>
<div class="receipt-desc">
<a href="/help?category_id=99" target="_blank">什么是电子发票</a>
<a href="/help/detail?id=33" target="_blank">什么是电子发票</a>
</div>
</div>
<div class="row clearfix">
... ...
<div class="empty-cart">
<div class="empty-cart-bg">
<i class="icon iconfont"></i>
</div>
<p class="empty-cart-info">购物袋空空的哦,去看看心仪的商品吧~</p>
<p class="empty-cart-info">
购物袋空空的哦,去看看心仪的商品吧~</p>
<a href="/" class="go-to-shop">
<span class="btn white">去购物</span>
</a>
... ...
... ... @@ -22,6 +22,6 @@
<span class="btn white cancel">取消</span>
</div>
<div class="right yoho-rule">
<a class="blue" href="/help/?category_id=87" target="_blank">有货币使用规则?</a>
<a class="blue" href="/help/detail?id=105" target="_blank">有货币使用规则?</a>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -53,6 +53,7 @@
</div>
</div>
<div class="bag-content">
<p class="empty-cart"><i class="icon iconfont"></i></p>
<p class="cn">您的购物袋暂无商品</p>
<p class="en">
Your shopping bag is empty ,<br>
... ...
... ... @@ -64,6 +64,7 @@ if ($('.left-time').length) {
}
$('body').on('click', function(e) {
if ($(e.target).hasClass('show-package')) {
return false;
}
... ...
... ... @@ -8,6 +8,7 @@ var validate = require('./validation');
var addressReg = /^[\s\S]{2,100}$/;
var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
var updateAddressMobile = '';
var validateMap = {
name: {
... ... @@ -66,7 +67,6 @@ function getValidateKey(id) {
function validateData() {
var $inputs = $('.edit-dialog .input-row.necessary .validate');
var $phone = $('#user-phone');
var pass = true;
// 检查必填项
... ... @@ -74,7 +74,9 @@ function validateData() {
var k = getValidateKey(input.id);
if (k && validateMap[k]) {
if (!validate.start(validateMap[k].sl, validateMap[k].v)) {
if (k === 'mobile' && updateAddressMobile !== '' && updateAddressMobile === $(this).val()) {
return true;
} else if (!validate.start(validateMap[k].sl, validateMap[k].v)) {
pass = false;
}
}
... ... @@ -151,9 +153,9 @@ function editOrder(onEdit) {
phone: phone
};
$.ajax({
url: '/me/editOrder',
type: 'post',
data: d
}).done(function(result) {
if (result.code === 200) {
... ... @@ -175,9 +177,17 @@ function showDiaglog(tpl, onEdit) {
btnClass: ['confirm'],
name: '确定',
cb: function() {
var b;
if (validateData()) {
editOrder(onEdit);
tip.close();
b = new dialog.Confirm({
content: '单笔订单仅支持一次修改,确定要修改订单吗?',
cb: function() {
editOrder(onEdit);
b.close();
}
}).show();
}
}
},
... ... @@ -186,6 +196,7 @@ function showDiaglog(tpl, onEdit) {
btnClass: ['cancel-btn'],
name: '取消',
cb: function() {
updateAddressMobile = '';
tip.close();
}
}
... ... @@ -206,6 +217,8 @@ function showDiaglog(tpl, onEdit) {
validate.start(v.sl, v.v);
}
});
updateAddressMobile = $('#user-mobile').val();
}
function start(tplData, onEdit) {
... ...
... ... @@ -21,6 +21,9 @@ var makeValidate = {
addr: function(val) {
// 完整的地址应该是长度为三的数组
return val.split(',').length === 3;
},
equal: function(val, val2) {
return val === val2;
}
};
... ...
... ... @@ -20,6 +20,7 @@ var detailErr = '2-100字符。1个中文为2个字符';
var addressDialogTpl;
var addressTpl;
var updateAddressMobile = '';
require('yoho-jquery-placeholder');
require('yoho-jquery-dotdotdot');
... ... @@ -97,7 +98,11 @@ function validateAddress($el, isUpdate) {
field.mobile.push({
regx: /^\d{3}(\d|\*){4}\d{4}$/, // 验证正常数字或者****
err: '手机号码格式不正确'
});
},
{
equal: true,
err: '手机号码格式不正确'
});
} else {
field.mobile.push({
regx: /^\d{11}$/,
... ... @@ -115,7 +120,7 @@ function validateAddress($el, isUpdate) {
vaRegx = field[key][vaKey];
// 非空验证、非空下正则验证、其他正则验证
if ((vaRegx.noEmpty && cur === '') || (vaRegx.regx &&
if ((vaRegx.equal && updateAddressMobile !== cur) || (vaRegx.noEmpty && cur === '') || (vaRegx.regx &&
(vaRegx.skipWhenEmpty ? !(cur === '' || vaRegx.regx.test(cur)) : !vaRegx.regx.test(cur))
)) {
pass = false;
... ... @@ -193,7 +198,7 @@ function addressDialogFactory(opt, $the) {
address: detail,
mobile: mobile,
phone: phone,
'area_code': areaCode // eslint-disable-line
'area_code': areaCode // eslint-disable-line
}
}).then(function(data) {
var updated;
... ... @@ -204,7 +209,7 @@ function addressDialogFactory(opt, $the) {
address: detail,
mobile: mobile.replace(/^(\d{3}).*(\d{4})$/, '$1****$2'),
phone: phone,
area_code: data.data.area_code, // eslint-disable-line
area_code: data.data.area_code, // eslint-disable-line
address_id: opt.id,
focus: $the.hasClass('focus'),
area: $el.address.getAreaLabels().replace(/,/g, ' '),
... ... @@ -237,7 +242,7 @@ function addressDialogFactory(opt, $the) {
address: detail,
mobile: mobile,
phone: phone,
'area_code': areaCode, // eslint-disable-line
'area_code': areaCode, // eslint-disable-line
init: opt.init
}
}).then(function(data) {
... ... @@ -280,6 +285,7 @@ function addressDialogFactory(opt, $the) {
]
});
updateAddressMobile = opt.mobile || '';
return address;
}
... ...
... ... @@ -165,14 +165,18 @@
.bag-content {
font-size: 14px;
line-height: 1.5;
padding: 280px 0 130px;
padding: 80px 0;
text-align: center;
color: #1b1b1b;
background: resolve("layout/empty-bag.svg") no-repeat center 30%;
background-size: 115px 130px;
display: none;
}
.bag-content .empty-cart i {
font-size: 150px;
font-weight: normal;
color: #b0b0b0;
}
.bag-content .cn {
font-size: 20px;
font-weight: bold;
... ...
... ... @@ -139,14 +139,11 @@
box-sizing: border-box;
.title:before {
content: "";
width: 18px;
height: 18px;
background: resolve("help/file.png") no-repeat;
background-size: 18px 18px;
content: "\e6e6";
position: absolute;
left: 3px;
top: 1px;
font-size: 18px;
}
}
}
... ... @@ -194,6 +191,7 @@
color: #989898;
margin-top: 15px;
line-height: 22px;
font-size: 14px;
}
.show-all {
... ... @@ -210,23 +208,17 @@
box-sizing: border-box;
.title:before {
content: "";
width: 18px;
height: 18px;
background: resolve("help/q.png") no-repeat;
background-size: 18px 18px;
content: "\e6e4";
position: absolute;
left: 0;
font-size: 18px;
}
.cont:before {
content: "";
width: 18px;
height: 18px;
background: resolve("help/a.png") no-repeat;
background-size: 18px 18px;
content: "\e6e5";
position: absolute;
left: 0;
font-size: 18px;
}
}
}
... ...
... ... @@ -193,6 +193,8 @@
height: 30px;
line-height: 30px;
margin-top: 5px;
width: 22px;
overflow: hidden;
display: inline-block;
}
... ... @@ -452,11 +454,9 @@
padding-top: 100px;
text-align: center;
.tip-search-img {
height: 100px;
background-image: resolve("product/search.svg");
background-repeat: no-repeat;
background-position-x: 50%;
i {
color: #b0b0b0;
font-size: 70px;
}
}
... ...
... ... @@ -5,10 +5,12 @@
text-align: center;
.empty-cart-bg {
background: resolve("layout/empty-bag.svg") no-repeat center center;
width: 115px;
height: 130px;
margin: 0 auto 30px;
i {
font-size: 115px;
color: #b0b0b0;
}
}
.empty-cart-info {
... ...
... ... @@ -6,14 +6,17 @@
<div class="search-result">关于“<span class="blue">{{keywords}}</span>”,共为您查询到<span class="blue">{{total}}</span>个答案</div>
<ul class="search-list">
{{#helper_list}}
<li class="{{#if problem}}problem-li{{else}}article-li{{/if}}">
<p class="title">{{{caption}}}</p>
{{#if problem}}
{{#if problem}}
<li class="problem-li">
<p class="icon iconfont icon-q title">{{{caption}}}</p>
<div class="icon iconfont icon-a cont">{{{content}}}</div>
</li>
{{else}}
<li class="article-li">
<p class="icon iconfont icon-file title">{{{caption}}}</p>
<div class="cont">{{{content}}}</div>
{{else}}
<div class="cont">{{{content}}}</div>
{{/if}}
</li>
</li>
{{/if}}
{{/helper_list}}
</ul>
{{!-- 分页 --}}
... ...
... ... @@ -22,6 +22,6 @@
<span class="btn white cancel">取消</span>
</div>
<div class="right yoho-rule">
<a class="blue" href="/help/?category_id=87" target="_blank">有货币使用规则?</a>
<a class="blue" href="/help/detail?id=105" target="_blank">有货币使用规则?</a>
</div>
</div>
\ No newline at end of file
... ...