Authored by biao

update for fix count down bug and mobile validate reg

@@ -10,7 +10,7 @@ var addr; @@ -10,7 +10,7 @@ var addr;
10 10
11 11
12 var addressReg = /^[\s\S]{2,100}$/; 12 var addressReg = /^[\s\S]{2,100}$/;
13 -var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/; 13 +var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])(\*{4}[0-9]{4}|[0-9]{8})$/;
14 14
15 var validate = require('./order/validation'); 15 var validate = require('./order/validation');
16 16
@@ -48,6 +48,9 @@ lazyLoad($('.banner-img')); @@ -48,6 +48,9 @@ lazyLoad($('.banner-img'));
48 // 添加.check方法 48 // 添加.check方法
49 require('../plugins/check'); 49 require('../plugins/check');
50 50
  51 +// 个人中心共用代码加载
  52 +require('./me');
  53 +
51 function setActive($item) { 54 function setActive($item) {
52 var color = $item.find('.color-text').data('color'); 55 var color = $item.find('.color-text').data('color');
53 var size = $item.find('.size-text').data('size'); 56 var size = $item.find('.size-text').data('size');
@@ -269,6 +272,7 @@ function bindConfirmEvent() { @@ -269,6 +272,7 @@ function bindConfirmEvent() {
269 var $specialReason = $changeGood.find('.special-reason'); 272 var $specialReason = $changeGood.find('.special-reason');
270 var $imgs; 273 var $imgs;
271 var imgs = []; 274 var imgs = [];
  275 + var mobile = $('#mob').val();
272 276
273 if ($(this).hasClass('disable')) { 277 if ($(this).hasClass('disable')) {
274 return false; 278 return false;
@@ -315,9 +319,12 @@ function bindConfirmEvent() { @@ -315,9 +319,12 @@ function bindConfirmEvent() {
315 changeData.order_code = $('.returns-wrap>.order').data('code'); 319 changeData.order_code = $('.returns-wrap>.order').data('code');
316 changeData.consignee_name = $('#user').val(); 320 changeData.consignee_name = $('#user').val();
317 changeData.address = $('#addr').val(); 321 changeData.address = $('#addr').val();
318 - changeData.mobile = $('#mob').val();  
319 changeData.delivery_tpye = $('.change-type .type.active').data('type'); 322 changeData.delivery_tpye = $('.change-type .type.active').data('type');
320 323
  324 + if (!/\*/.test(mobile)) {
  325 + changeData.mobile = $('#mob').val();
  326 + }
  327 +
321 submitChange(changeData); 328 submitChange(changeData);
322 }); 329 });
323 } 330 }
@@ -5,6 +5,9 @@ var countDown = require('./order/countdown'); @@ -5,6 +5,9 @@ var countDown = require('./order/countdown');
5 5
6 var lazyLoad = require('yoho-jquery-lazyload'); 6 var lazyLoad = require('yoho-jquery-lazyload');
7 7
  8 +// 个人中心共用代码加载
  9 +require('./me');
  10 +
8 lazyLoad($('img.lazy')); 11 lazyLoad($('img.lazy'));
9 12
10 function reload() { 13 function reload() {
@@ -18,21 +18,22 @@ module.exports = { @@ -18,21 +18,22 @@ module.exports = {
18 var leftTime = $item.data('left'); 18 var leftTime = $item.data('left');
19 var i = that.intervalValue / 1000; 19 var i = that.intervalValue / 1000;
20 20
21 - $item.text(that.convertLeftTime(leftTime - that.count * i)); 21 + $item.text(that.convertLeftTime(leftTime - that.count * i, $item));
22 }); 22 });
23 this.count += 1; 23 this.count += 1;
24 }, 24 },
25 - convertLeftTime: function(src) { 25 + convertLeftTime: function(src, $el) {
26 var sec = parseInt(src, 10) % 60; 26 var sec = parseInt(src, 10) % 60;
27 var min = parseInt(src / 60, 10) % 60; 27 var min = parseInt(src / 60, 10) % 60;
28 var hour = parseInt(src / 3600, 10); 28 var hour = parseInt(src / 3600, 10);
29 var timeStr = min + '分'; 29 var timeStr = min + '分';
30 30
31 31
  32 +
32 if (parseInt(src, 10) <= 0) { 33 if (parseInt(src, 10) <= 0) {
33 timeStr = '已失效'; 34 timeStr = '已失效';
34 - $('.hide-when-invalid').hide();  
35 - $('.user-order .table .common-column .pay-operation .left-time').css('margin-left', '0'); 35 + $el.closest('.order').find('.hide-when-invalid').hide();
  36 + $el.css('margin-left', '0');
36 return timeStr; 37 return timeStr;
37 } 38 }
38 39
@@ -7,7 +7,7 @@ var addr; @@ -7,7 +7,7 @@ var addr;
7 var validate = require('./validation'); 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])(\*{4}[0-9]{4}|[0-9]{8})$/;
11 11
12 var validateMap = { 12 var validateMap = {
13 name: { 13 name: {
@@ -142,9 +142,7 @@ function editOrder(onEdit) { @@ -142,9 +142,7 @@ function editOrder(onEdit) {
142 var mobile = $('#user-mobile').val(); 142 var mobile = $('#user-mobile').val();
143 var phone = $('#user-phone').val(); 143 var phone = $('#user-phone').val();
144 144
145 - $.ajax({  
146 - url: '/me/editOrder',  
147 - data: { 145 + var d = {
148 orderCode: code, 146 orderCode: code,
149 areaCode: areaCode, 147 areaCode: areaCode,
150 userName: userName, 148 userName: userName,
@@ -152,6 +150,20 @@ function editOrder(onEdit) { @@ -152,6 +150,20 @@ function editOrder(onEdit) {
152 mobile: mobile, 150 mobile: mobile,
153 phone: phone 151 phone: phone
154 } 152 }
  153 +
  154 + if (/\*/.test(mobile)) {
  155 + d = {
  156 + orderCode: code,
  157 + areaCode: areaCode,
  158 + userName: userName,
  159 + address: address,
  160 + phone: phone
  161 + }
  162 + }
  163 +
  164 + $.ajax({
  165 + url: '/me/editOrder',
  166 + data: d
155 }).done(function(result) { 167 }).done(function(result) {
156 if (result.code === 200) { 168 if (result.code === 200) {
157 showSuccessMsg(onEdit); 169 showSuccessMsg(onEdit);
@@ -3,6 +3,9 @@ var lazyLoad = require('yoho-jquery-lazyload'); @@ -3,6 +3,9 @@ var lazyLoad = require('yoho-jquery-lazyload');
3 3
4 lazyLoad($('img.banner-img')); 4 lazyLoad($('img.banner-img'));
5 5
  6 +// 个人中心共用代码加载
  7 +require('./me');
  8 +
6 $('.cancel-apply').on('click', function() { 9 $('.cancel-apply').on('click', function() {
7 var id = $(this).data('applyId'); 10 var id = $(this).data('applyId');
8 var type = $(this).data('type'); 11 var type = $(this).data('type');