Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xuqi
9 years ago
Commit
275def2f053e2e2bdd3a58b03aac47c7c796aae7
1 parent
5f56ead3
BLK-1135
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
public/js/shopping/order/address.js
public/js/shopping/order/address.js
View file @
275def2
...
...
@@ -50,7 +50,7 @@ addressDialogTpl = require('../../../tpl/shopping/address-dialog.hbs');
addressTpl
=
require
(
'../../../tpl/shopping/address-list.hbs'
);
// address dialog 数据验证
function
validateAddress
(
$el
)
{
function
validateAddress
(
$el
,
isUpdate
)
{
var
field
=
{
name
:
[
{
...
...
@@ -72,10 +72,6 @@ function validateAddress($el) {
{
noEmpty
:
true
,
err
:
'手机号码不能为空'
},
{
regx
:
/^
\d{3}(\d
|
\*){4}\d{4}
$/
,
// 验证正常数字或者****
err
:
'手机号码格式不正确'
}
],
phone
:
[
...
...
@@ -95,6 +91,19 @@ function validateAddress($el) {
var
pass
=
true
;
// 新增情况下须验证正确的手机号;编辑情况下可通过****的验证
if
(
isUpdate
)
{
field
.
mobile
.
push
({
regx
:
/^
\d{3}(\d
|
\*){4}\d{4}
$/
,
// 验证正常数字或者****
err
:
'手机号码格式不正确'
});
}
else
{
field
.
mobile
.
push
({
regx
:
/^
\d{11}
$/
,
err
:
'手机号码格式不正确'
});
}
for
(
key
in
field
)
{
if
(
field
.
hasOwnProperty
(
key
))
{
$cur
=
$el
.
find
(
'.address-'
+
key
);
...
...
@@ -160,7 +169,7 @@ function addressDialogFactory(opt, $the) {
areaCode
;
// 验证输入
if
(
validateAddress
(
address
.
$el
))
{
if
(
validateAddress
(
address
.
$el
,
opt
&&
opt
.
id
))
{
// form value
consignee
=
$el
.
find
(
'.address-name'
).
val
();
...
...
Please
register
or
login
to post a comment