...
|
...
|
@@ -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) {
|
...
|
...
|
|