Authored by biao

update for fix count down bug and mobile validate reg

... ... @@ -10,7 +10,7 @@ var addr;
var addressReg = /^[\s\S]{2,100}$/;
var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
var phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])(\*{4}[0-9]{4}|[0-9]{8})$/;
var validate = require('./order/validation');
... ... @@ -48,6 +48,9 @@ lazyLoad($('.banner-img'));
// 添加.check方法
require('../plugins/check');
// 个人中心共用代码加载
require('./me');
function setActive($item) {
var color = $item.find('.color-text').data('color');
var size = $item.find('.size-text').data('size');
... ... @@ -269,6 +272,7 @@ function bindConfirmEvent() {
var $specialReason = $changeGood.find('.special-reason');
var $imgs;
var imgs = [];
var mobile = $('#mob').val();
if ($(this).hasClass('disable')) {
return false;
... ... @@ -315,9 +319,12 @@ function bindConfirmEvent() {
changeData.order_code = $('.returns-wrap>.order').data('code');
changeData.consignee_name = $('#user').val();
changeData.address = $('#addr').val();
changeData.mobile = $('#mob').val();
changeData.delivery_tpye = $('.change-type .type.active').data('type');
if (!/\*/.test(mobile)) {
changeData.mobile = $('#mob').val();
}
submitChange(changeData);
});
}
... ...
... ... @@ -5,6 +5,9 @@ var countDown = require('./order/countdown');
var lazyLoad = require('yoho-jquery-lazyload');
// 个人中心共用代码加载
require('./me');
lazyLoad($('img.lazy'));
function reload() {
... ...
... ... @@ -18,21 +18,22 @@ module.exports = {
var leftTime = $item.data('left');
var i = that.intervalValue / 1000;
$item.text(that.convertLeftTime(leftTime - that.count * i));
$item.text(that.convertLeftTime(leftTime - that.count * i, $item));
});
this.count += 1;
},
convertLeftTime: function(src) {
convertLeftTime: function(src, $el) {
var sec = parseInt(src, 10) % 60;
var min = parseInt(src / 60, 10) % 60;
var hour = parseInt(src / 3600, 10);
var timeStr = min + '分';
if (parseInt(src, 10) <= 0) {
timeStr = '已失效';
$('.hide-when-invalid').hide();
$('.user-order .table .common-column .pay-operation .left-time').css('margin-left', '0');
$el.closest('.order').find('.hide-when-invalid').hide();
$el.css('margin-left', '0');
return timeStr;
}
... ...
... ... @@ -7,7 +7,7 @@ var addr;
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 phoneReg = /^(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])(\*{4}[0-9]{4}|[0-9]{8})$/;
var validateMap = {
name: {
... ... @@ -142,16 +142,28 @@ function editOrder(onEdit) {
var mobile = $('#user-mobile').val();
var phone = $('#user-phone').val();
$.ajax({
url: '/me/editOrder',
data: {
var d = {
orderCode: code,
areaCode: areaCode,
userName: userName,
address: address,
mobile: mobile,
phone: phone
}
if (/\*/.test(mobile)) {
d = {
orderCode: code,
areaCode: areaCode,
userName: userName,
address: address,
mobile: mobile,
phone: phone
}
}
$.ajax({
url: '/me/editOrder',
data: d
}).done(function(result) {
if (result.code === 200) {
showSuccessMsg(onEdit);
... ...
... ... @@ -3,6 +3,9 @@ var lazyLoad = require('yoho-jquery-lazyload');
lazyLoad($('img.banner-img'));
// 个人中心共用代码加载
require('./me');
$('.cancel-apply').on('click', function() {
var id = $(this).data('applyId');
var type = $(this).data('type');
... ...