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) => { @@ -183,7 +183,7 @@ const _processHeadData = (list) => {
183 183
184 if (index === 2) { 184 if (index === 2) {
185 newData.headData = _.assign(newData.headData, { 185 newData.headData = _.assign(newData.headData, {
186 - commentNum: data.total 186 + commentNum: data.total || 0
187 }); 187 });
188 } 188 }
189 }); 189 });
@@ -697,7 +697,7 @@ const getDetailData = (id, appType, gender, tag, uid, udid) => { @@ -697,7 +697,7 @@ const getDetailData = (id, appType, gender, tag, uid, udid) => {
697 head: res.headData, 697 head: res.headData,
698 tags: res.tags, 698 tags: res.tags,
699 content: result[2], 699 content: result[2],
700 - comment: result[3], 700 + comment: _.assign({total: 0}, result[3]),
701 brands: result[6], 701 brands: result[6],
702 nextArticle: result[5], 702 nextArticle: result[5],
703 perArticle: result[4] 703 perArticle: result[4]
@@ -45,8 +45,9 @@ const detail = (req, res, next) => { @@ -45,8 +45,9 @@ const detail = (req, res, next) => {
45 const pageData = result[0]; 45 const pageData = result[0];
46 const thumb = result[1]; 46 const thumb = result[1];
47 47
48 - if (_.has(pageData, 'orderDetail.orderCode')) {  
49 - pageData.orderDetail.orderCodeM = crypto.encryption(config.crypto.common, pageData.orderDetail.orderCode); 48 + if (_.has(pageData, 'orderDetail.order_code')) {
  49 + pageData.orderDetail.orderCodeM =
  50 + crypto.encryption(config.crypto.common, (pageData.orderDetail.order_code).toString());
50 } 51 }
51 52
52 // 转译 53 // 转译
@@ -137,14 +138,21 @@ const getCancelOrderReason = (req, res, next) => { @@ -137,14 +138,21 @@ const getCancelOrderReason = (req, res, next) => {
137 138
138 const editOrder = (req, res, next) => { 139 const editOrder = (req, res, next) => {
139 const uid = req.user.uid; 140 const uid = req.user.uid;
140 - const query = req.query; 141 + const parameter = req.body;
141 142
142 - query.uid = uid;  
143 - query.orderCode = crypto.decrypt(config.crypto.common, query.orderCode); 143 + parameter.uid = uid;
  144 + parameter.orderCode = parseInt(crypto.decrypt(config.crypto.common, parameter.orderCode), 10);
144 145
145 - orderModel.editOrder(query).then(result => {  
146 - res.json(result);  
147 - }).catch(next); 146 + if (!parameter.uid || !parameter.orderCode) {
  147 + res.json({
  148 + code: '401',
  149 + message: '请输入合法订单号'
  150 + });
  151 + } else {
  152 + orderModel.editOrder(parameter).then(result => {
  153 + res.json(result);
  154 + }).catch(next);
  155 + }
148 }; 156 };
149 157
150 const reAdd = (req, res, next) => { 158 const reAdd = (req, res, next) => {
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 6
7 'use strict'; 7 'use strict';
8 8
9 -const router = require('express').Router(); // eslint-disable-line 9 +const router = require('express').Router(); // eslint-disable-line
10 const cRoot = './controllers'; 10 const cRoot = './controllers';
11 const auth = require(`${global.middleware}/auth`); 11 const auth = require(`${global.middleware}/auth`);
12 const csurf = require('csurf'); 12 const csurf = require('csurf');
@@ -31,7 +31,7 @@ router.get('/deleteOrder', order.deleteOrder); @@ -31,7 +31,7 @@ router.get('/deleteOrder', order.deleteOrder);
31 router.get('/cancelOrder', order.cancelOrder); 31 router.get('/cancelOrder', order.cancelOrder);
32 router.get('/getCancelOrderReason', order.getCancelOrderReason); 32 router.get('/getCancelOrderReason', order.getCancelOrderReason);
33 router.get('/getExpressInfo', order.getExpressInfo); 33 router.get('/getExpressInfo', order.getExpressInfo);
34 -router.get('/editOrder', order.editOrder); 34 +router.post('/editOrder', order.editOrder);
35 router.get('/reAdd', order.reAdd); 35 router.get('/reAdd', order.reAdd);
36 router.get('/confirmReceive', order.confirmReceive); 36 router.get('/confirmReceive', order.confirmReceive);
37 37
1 <div class="yoho-list-empty"> 1 <div class="yoho-list-empty">
2 2
3 <div class="tip-search"> 3 <div class="tip-search">
4 - <div class="tip-search-img"></div> 4 + <i class="icon iconfont"></i>
5 </div> 5 </div>
6 6
7 <p class="tip-cn">抱歉! 未找到{{#if query}}与"<span>{{query}}</span>"{{/if}}相关商品</p> 7 <p class="tip-cn">抱歉! 未找到{{#if query}}与"<span>{{query}}</span>"{{/if}}相关商品</p>
@@ -212,7 +212,7 @@ @@ -212,7 +212,7 @@
212 如需纸质发票可自行下载打印。 212 如需纸质发票可自行下载打印。
213 </div> 213 </div>
214 <div class="receipt-desc"> 214 <div class="receipt-desc">
215 - <a href="/help?category_id=99" target="_blank">什么是电子发票</a> 215 + <a href="/help/detail?id=33" target="_blank">什么是电子发票</a>
216 </div> 216 </div>
217 </div> 217 </div>
218 <div class="row clearfix"> 218 <div class="row clearfix">
1 <div class="empty-cart"> 1 <div class="empty-cart">
2 <div class="empty-cart-bg"> 2 <div class="empty-cart-bg">
  3 + <i class="icon iconfont"></i>
3 </div> 4 </div>
4 - <p class="empty-cart-info">购物袋空空的哦,去看看心仪的商品吧~</p> 5 + <p class="empty-cart-info">
  6 + 购物袋空空的哦,去看看心仪的商品吧~</p>
5 <a href="/" class="go-to-shop"> 7 <a href="/" class="go-to-shop">
6 <span class="btn white">去购物</span> 8 <span class="btn white">去购物</span>
7 </a> 9 </a>
@@ -22,6 +22,6 @@ @@ -22,6 +22,6 @@
22 <span class="btn white cancel">取消</span> 22 <span class="btn white cancel">取消</span>
23 </div> 23 </div>
24 <div class="right yoho-rule"> 24 <div class="right yoho-rule">
25 - <a class="blue" href="/help/?category_id=87" target="_blank">有货币使用规则?</a> 25 + <a class="blue" href="/help/detail?id=105" target="_blank">有货币使用规则?</a>
26 </div> 26 </div>
27 </div> 27 </div>
@@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
53 </div> 53 </div>
54 </div> 54 </div>
55 <div class="bag-content"> 55 <div class="bag-content">
  56 + <p class="empty-cart"><i class="icon iconfont"></i></p>
56 <p class="cn">您的购物袋暂无商品</p> 57 <p class="cn">您的购物袋暂无商品</p>
57 <p class="en"> 58 <p class="en">
58 Your shopping bag is empty ,<br> 59 Your shopping bag is empty ,<br>
@@ -64,6 +64,7 @@ if ($('.left-time').length) { @@ -64,6 +64,7 @@ if ($('.left-time').length) {
64 } 64 }
65 65
66 $('body').on('click', function(e) { 66 $('body').on('click', function(e) {
  67 +
67 if ($(e.target).hasClass('show-package')) { 68 if ($(e.target).hasClass('show-package')) {
68 return false; 69 return false;
69 } 70 }
@@ -8,6 +8,7 @@ var validate = require('./validation'); @@ -8,6 +8,7 @@ var validate = require('./validation');
8 8
9 var addressReg = /^[\s\S]{2,100}$/; 9 var addressReg = /^[\s\S]{2,100}$/;
10 var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/; 10 var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
  11 +var updateAddressMobile = '';
11 12
12 var validateMap = { 13 var validateMap = {
13 name: { 14 name: {
@@ -66,7 +67,6 @@ function getValidateKey(id) { @@ -66,7 +67,6 @@ function getValidateKey(id) {
66 function validateData() { 67 function validateData() {
67 var $inputs = $('.edit-dialog .input-row.necessary .validate'); 68 var $inputs = $('.edit-dialog .input-row.necessary .validate');
68 var $phone = $('#user-phone'); 69 var $phone = $('#user-phone');
69 -  
70 var pass = true; 70 var pass = true;
71 71
72 // 检查必填项 72 // 检查必填项
@@ -74,7 +74,9 @@ function validateData() { @@ -74,7 +74,9 @@ function validateData() {
74 var k = getValidateKey(input.id); 74 var k = getValidateKey(input.id);
75 75
76 if (k && validateMap[k]) { 76 if (k && validateMap[k]) {
77 - if (!validate.start(validateMap[k].sl, validateMap[k].v)) { 77 + if (k === 'mobile' && updateAddressMobile !== '' && updateAddressMobile === $(this).val()) {
  78 + return true;
  79 + } else if (!validate.start(validateMap[k].sl, validateMap[k].v)) {
78 pass = false; 80 pass = false;
79 } 81 }
80 } 82 }
@@ -151,9 +153,9 @@ function editOrder(onEdit) { @@ -151,9 +153,9 @@ function editOrder(onEdit) {
151 phone: phone 153 phone: phone
152 }; 154 };
153 155
154 -  
155 $.ajax({ 156 $.ajax({
156 url: '/me/editOrder', 157 url: '/me/editOrder',
  158 + type: 'post',
157 data: d 159 data: d
158 }).done(function(result) { 160 }).done(function(result) {
159 if (result.code === 200) { 161 if (result.code === 200) {
@@ -175,9 +177,17 @@ function showDiaglog(tpl, onEdit) { @@ -175,9 +177,17 @@ function showDiaglog(tpl, onEdit) {
175 btnClass: ['confirm'], 177 btnClass: ['confirm'],
176 name: '确定', 178 name: '确定',
177 cb: function() { 179 cb: function() {
  180 + var b;
  181 +
178 if (validateData()) { 182 if (validateData()) {
179 - editOrder(onEdit);  
180 tip.close(); 183 tip.close();
  184 + b = new dialog.Confirm({
  185 + content: '单笔订单仅支持一次修改,确定要修改订单吗?',
  186 + cb: function() {
  187 + editOrder(onEdit);
  188 + b.close();
  189 + }
  190 + }).show();
181 } 191 }
182 } 192 }
183 }, 193 },
@@ -186,6 +196,7 @@ function showDiaglog(tpl, onEdit) { @@ -186,6 +196,7 @@ function showDiaglog(tpl, onEdit) {
186 btnClass: ['cancel-btn'], 196 btnClass: ['cancel-btn'],
187 name: '取消', 197 name: '取消',
188 cb: function() { 198 cb: function() {
  199 + updateAddressMobile = '';
189 tip.close(); 200 tip.close();
190 } 201 }
191 } 202 }
@@ -206,6 +217,8 @@ function showDiaglog(tpl, onEdit) { @@ -206,6 +217,8 @@ function showDiaglog(tpl, onEdit) {
206 validate.start(v.sl, v.v); 217 validate.start(v.sl, v.v);
207 } 218 }
208 }); 219 });
  220 +
  221 + updateAddressMobile = $('#user-mobile').val();
209 } 222 }
210 223
211 function start(tplData, onEdit) { 224 function start(tplData, onEdit) {
@@ -21,6 +21,9 @@ var makeValidate = { @@ -21,6 +21,9 @@ var makeValidate = {
21 addr: function(val) { 21 addr: function(val) {
22 // 完整的地址应该是长度为三的数组 22 // 完整的地址应该是长度为三的数组
23 return val.split(',').length === 3; 23 return val.split(',').length === 3;
  24 + },
  25 + equal: function(val, val2) {
  26 + return val === val2;
24 } 27 }
25 }; 28 };
26 29
@@ -20,6 +20,7 @@ var detailErr = '2-100字符。1个中文为2个字符'; @@ -20,6 +20,7 @@ var detailErr = '2-100字符。1个中文为2个字符';
20 20
21 var addressDialogTpl; 21 var addressDialogTpl;
22 var addressTpl; 22 var addressTpl;
  23 +var updateAddressMobile = '';
23 24
24 require('yoho-jquery-placeholder'); 25 require('yoho-jquery-placeholder');
25 require('yoho-jquery-dotdotdot'); 26 require('yoho-jquery-dotdotdot');
@@ -97,7 +98,11 @@ function validateAddress($el, isUpdate) { @@ -97,7 +98,11 @@ function validateAddress($el, isUpdate) {
97 field.mobile.push({ 98 field.mobile.push({
98 regx: /^\d{3}(\d|\*){4}\d{4}$/, // 验证正常数字或者**** 99 regx: /^\d{3}(\d|\*){4}\d{4}$/, // 验证正常数字或者****
99 err: '手机号码格式不正确' 100 err: '手机号码格式不正确'
100 - }); 101 + },
  102 + {
  103 + equal: true,
  104 + err: '手机号码格式不正确'
  105 + });
101 } else { 106 } else {
102 field.mobile.push({ 107 field.mobile.push({
103 regx: /^\d{11}$/, 108 regx: /^\d{11}$/,
@@ -115,7 +120,7 @@ function validateAddress($el, isUpdate) { @@ -115,7 +120,7 @@ function validateAddress($el, isUpdate) {
115 vaRegx = field[key][vaKey]; 120 vaRegx = field[key][vaKey];
116 121
117 // 非空验证、非空下正则验证、其他正则验证 122 // 非空验证、非空下正则验证、其他正则验证
118 - if ((vaRegx.noEmpty && cur === '') || (vaRegx.regx && 123 + if ((vaRegx.equal && updateAddressMobile !== cur) || (vaRegx.noEmpty && cur === '') || (vaRegx.regx &&
119 (vaRegx.skipWhenEmpty ? !(cur === '' || vaRegx.regx.test(cur)) : !vaRegx.regx.test(cur)) 124 (vaRegx.skipWhenEmpty ? !(cur === '' || vaRegx.regx.test(cur)) : !vaRegx.regx.test(cur))
120 )) { 125 )) {
121 pass = false; 126 pass = false;
@@ -193,7 +198,7 @@ function addressDialogFactory(opt, $the) { @@ -193,7 +198,7 @@ function addressDialogFactory(opt, $the) {
193 address: detail, 198 address: detail,
194 mobile: mobile, 199 mobile: mobile,
195 phone: phone, 200 phone: phone,
196 - 'area_code': areaCode // eslint-disable-line 201 + 'area_code': areaCode // eslint-disable-line
197 } 202 }
198 }).then(function(data) { 203 }).then(function(data) {
199 var updated; 204 var updated;
@@ -204,7 +209,7 @@ function addressDialogFactory(opt, $the) { @@ -204,7 +209,7 @@ function addressDialogFactory(opt, $the) {
204 address: detail, 209 address: detail,
205 mobile: mobile.replace(/^(\d{3}).*(\d{4})$/, '$1****$2'), 210 mobile: mobile.replace(/^(\d{3}).*(\d{4})$/, '$1****$2'),
206 phone: phone, 211 phone: phone,
207 - area_code: data.data.area_code, // eslint-disable-line 212 + area_code: data.data.area_code, // eslint-disable-line
208 address_id: opt.id, 213 address_id: opt.id,
209 focus: $the.hasClass('focus'), 214 focus: $the.hasClass('focus'),
210 area: $el.address.getAreaLabels().replace(/,/g, ' '), 215 area: $el.address.getAreaLabels().replace(/,/g, ' '),
@@ -237,7 +242,7 @@ function addressDialogFactory(opt, $the) { @@ -237,7 +242,7 @@ function addressDialogFactory(opt, $the) {
237 address: detail, 242 address: detail,
238 mobile: mobile, 243 mobile: mobile,
239 phone: phone, 244 phone: phone,
240 - 'area_code': areaCode, // eslint-disable-line 245 + 'area_code': areaCode, // eslint-disable-line
241 init: opt.init 246 init: opt.init
242 } 247 }
243 }).then(function(data) { 248 }).then(function(data) {
@@ -280,6 +285,7 @@ function addressDialogFactory(opt, $the) { @@ -280,6 +285,7 @@ function addressDialogFactory(opt, $the) {
280 ] 285 ]
281 }); 286 });
282 287
  288 + updateAddressMobile = opt.mobile || '';
283 return address; 289 return address;
284 } 290 }
285 291
@@ -165,14 +165,18 @@ @@ -165,14 +165,18 @@
165 .bag-content { 165 .bag-content {
166 font-size: 14px; 166 font-size: 14px;
167 line-height: 1.5; 167 line-height: 1.5;
168 - padding: 280px 0 130px; 168 + padding: 80px 0;
169 text-align: center; 169 text-align: center;
170 color: #1b1b1b; 170 color: #1b1b1b;
171 - background: resolve("layout/empty-bag.svg") no-repeat center 30%;  
172 - background-size: 115px 130px;  
173 display: none; 171 display: none;
174 } 172 }
175 173
  174 + .bag-content .empty-cart i {
  175 + font-size: 150px;
  176 + font-weight: normal;
  177 + color: #b0b0b0;
  178 + }
  179 +
176 .bag-content .cn { 180 .bag-content .cn {
177 font-size: 20px; 181 font-size: 20px;
178 font-weight: bold; 182 font-weight: bold;
@@ -139,14 +139,11 @@ @@ -139,14 +139,11 @@
139 box-sizing: border-box; 139 box-sizing: border-box;
140 140
141 .title:before { 141 .title:before {
142 - content: "";  
143 - width: 18px;  
144 - height: 18px;  
145 - background: resolve("help/file.png") no-repeat;  
146 - background-size: 18px 18px; 142 + content: "\e6e6";
147 position: absolute; 143 position: absolute;
148 left: 3px; 144 left: 3px;
149 top: 1px; 145 top: 1px;
  146 + font-size: 18px;
150 } 147 }
151 } 148 }
152 } 149 }
@@ -194,6 +191,7 @@ @@ -194,6 +191,7 @@
194 color: #989898; 191 color: #989898;
195 margin-top: 15px; 192 margin-top: 15px;
196 line-height: 22px; 193 line-height: 22px;
  194 + font-size: 14px;
197 } 195 }
198 196
199 .show-all { 197 .show-all {
@@ -210,23 +208,17 @@ @@ -210,23 +208,17 @@
210 box-sizing: border-box; 208 box-sizing: border-box;
211 209
212 .title:before { 210 .title:before {
213 - content: "";  
214 - width: 18px;  
215 - height: 18px;  
216 - background: resolve("help/q.png") no-repeat;  
217 - background-size: 18px 18px; 211 + content: "\e6e4";
218 position: absolute; 212 position: absolute;
219 left: 0; 213 left: 0;
  214 + font-size: 18px;
220 } 215 }
221 216
222 .cont:before { 217 .cont:before {
223 - content: "";  
224 - width: 18px;  
225 - height: 18px;  
226 - background: resolve("help/a.png") no-repeat;  
227 - background-size: 18px 18px; 218 + content: "\e6e5";
228 position: absolute; 219 position: absolute;
229 left: 0; 220 left: 0;
  221 + font-size: 18px;
230 } 222 }
231 } 223 }
232 } 224 }
@@ -193,6 +193,8 @@ @@ -193,6 +193,8 @@
193 height: 30px; 193 height: 30px;
194 line-height: 30px; 194 line-height: 30px;
195 margin-top: 5px; 195 margin-top: 5px;
  196 + width: 22px;
  197 + overflow: hidden;
196 display: inline-block; 198 display: inline-block;
197 } 199 }
198 200
@@ -452,11 +454,9 @@ @@ -452,11 +454,9 @@
452 padding-top: 100px; 454 padding-top: 100px;
453 text-align: center; 455 text-align: center;
454 456
455 - .tip-search-img {  
456 - height: 100px;  
457 - background-image: resolve("product/search.svg");  
458 - background-repeat: no-repeat;  
459 - background-position-x: 50%; 457 + i {
  458 + color: #b0b0b0;
  459 + font-size: 70px;
460 } 460 }
461 } 461 }
462 462
@@ -5,10 +5,12 @@ @@ -5,10 +5,12 @@
5 text-align: center; 5 text-align: center;
6 6
7 .empty-cart-bg { 7 .empty-cart-bg {
8 - background: resolve("layout/empty-bag.svg") no-repeat center center;  
9 - width: 115px;  
10 - height: 130px;  
11 margin: 0 auto 30px; 8 margin: 0 auto 30px;
  9 +
  10 + i {
  11 + font-size: 115px;
  12 + color: #b0b0b0;
  13 + }
12 } 14 }
13 15
14 .empty-cart-info { 16 .empty-cart-info {
@@ -6,14 +6,17 @@ @@ -6,14 +6,17 @@
6 <div class="search-result">关于“<span class="blue">{{keywords}}</span>”,共为您查询到<span class="blue">{{total}}</span>个答案</div> 6 <div class="search-result">关于“<span class="blue">{{keywords}}</span>”,共为您查询到<span class="blue">{{total}}</span>个答案</div>
7 <ul class="search-list"> 7 <ul class="search-list">
8 {{#helper_list}} 8 {{#helper_list}}
9 - <li class="{{#if problem}}problem-li{{else}}article-li{{/if}}">  
10 - <p class="title">{{{caption}}}</p>  
11 - {{#if problem}} 9 + {{#if problem}}
  10 + <li class="problem-li">
  11 + <p class="icon iconfont icon-q title">{{{caption}}}</p>
  12 + <div class="icon iconfont icon-a cont">{{{content}}}</div>
  13 + </li>
  14 + {{else}}
  15 + <li class="article-li">
  16 + <p class="icon iconfont icon-file title">{{{caption}}}</p>
12 <div class="cont">{{{content}}}</div> 17 <div class="cont">{{{content}}}</div>
13 - {{else}}  
14 - <div class="cont">{{{content}}}</div>  
15 - {{/if}}  
16 - </li> 18 + </li>
  19 + {{/if}}
17 {{/helper_list}} 20 {{/helper_list}}
18 </ul> 21 </ul>
19 {{!-- 分页 --}} 22 {{!-- 分页 --}}
@@ -22,6 +22,6 @@ @@ -22,6 +22,6 @@
22 <span class="btn white cancel">取消</span> 22 <span class="btn white cancel">取消</span>
23 </div> 23 </div>
24 <div class="right yoho-rule"> 24 <div class="right yoho-rule">
25 - <a class="blue" href="/help/?category_id=87" target="_blank">有货币使用规则?</a> 25 + <a class="blue" href="/help/detail?id=105" target="_blank">有货币使用规则?</a>
26 </div> 26 </div>
27 </div> 27 </div>