Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
王洪广
9 years ago
Commit
f38570b6c3f052679a7c775eec28d9df8eeb59ba
1 parent
8d6e5646
fix order problem
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
126 additions
and
54 deletions
template/www.yohobuy.com/partials/home/order-edit-tpl.phtml
web-static/img/home/order-sprite.png
web-static/js/home/order-block.js
web-static/sass/home/_order-block.css
web-static/sass/home/_order-detail.css
template/www.yohobuy.com/partials/home/order-edit-tpl.phtml
View file @
f38570b
...
...
@@ -4,8 +4,8 @@
<ul class="edit-order-info">
<li>
<label><i class="form-required">*</i>收 货 人:</label>
<input type="text" class="inp" name="name" value="{{editInfo.userName}}">
<span class="error"><i class="order-icon icon-error"></i><b>收货人不能为空</b></span>
<input type="text" class="inp" name="name" value="{{editInfo.userName}}" placeholder="请输入您的姓名">
<span class="error"><i class="order-icon icon-error"></i><b>请输入您的姓名</b></span>
</li>
<li>
<label><i class="form-required">*</i>所在区域:</label>
...
...
@@ -15,7 +15,7 @@
</select>
<select name="county">
</select>
<span class="error"><i class="order-icon icon-error"></i><b>请
选择所在区域
</b></span>
<span class="error"><i class="order-icon icon-error"></i><b>请
填写完整的省市区信息
</b></span>
</li>
<li>
<label><i class="form-required">*</i>详细地址:</label>
...
...
@@ -24,14 +24,14 @@
</li>
<li>
<label><i class="form-required">*</i>手机号码:</label>
<input type="text" class="inp" placeholder="请输入手机号码" name="phone" maxlength="11" value="{{editInfo.mobile}}">
<span class="error"><i class="order-icon icon-error"></i><b>请输入手机号码</b></span>
<input type="text" class="inp" placeholder="请输入手机号码(重要必填)" name="phone" maxlength="11" value="{{editInfo.mobile}}">
<span class="error"><i class="order-icon icon-error"></i><b>请输入手机号码(重要必填)</b></span>
</li>
<li>
<label>电话号码:</label>
<input type="text" class="inp w40" placeholder="区号" name="tel-code" value="{{editInfo.phoneCode}}"> -
<input type="text" class="inp" placeholder="请输入电话号码(选填)" name="tel" value="{{editInfo.phoneNum}}">
<span class="error"><i class="order-icon icon-error"></i><b></b></span>
<span class="error"><i class="order-icon icon-error"></i><b>
只能包含数字、- 组合
</b></span>
</li>
</ul>
</script>
\ No newline at end of file
...
...
web-static/img/home/order-sprite.png
View file @
f38570b
2.37 KB
|
W:
|
H:
2.73 KB
|
W:
|
H:
2-up
Swipe
Onion skin
web-static/js/home/order-block.js
View file @
f38570b
...
...
@@ -20,7 +20,8 @@ var active;
var
dialogMessage
=
'<p class="message-title"><i class="order-icon {{messageIcon}}"></i>{{messageTitle}}</p><p class="message-summary">{{messageSummary}}</p>'
;
var
$dialogEdit
=
$
(
'#edit-dialog-tpl'
);
var
$addressManage
,
$province
,
$city
,
$county
,
$selectList
,
$name
,
$phone
,
$address
,
$telCode
,
$tel
,
isProvinceChecked
=
false
;;
var
$addressManage
,
$province
,
$city
,
$county
,
$selectList
,
$name
,
$phone
,
$address
,
$telCode
,
$tel
,
isProvinceChecked
=
false
;
;
function
cancelFactory
(
id
)
{
var
options
=
{
...
...
@@ -175,6 +176,7 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
});
active
.
show
();
}).
on
(
'click'
,
'.edit-order'
,
function
()
{
$
(
this
).
addClass
(
'edit-order-active'
);
active
=
editOrder
(
$
(
this
).
closest
(
'.order, .order-detail'
).
data
(
'id'
))
active
.
show
();
newAddress
(
0
);
...
...
@@ -199,6 +201,8 @@ function newAddress(id) {
$telCode
=
$addressManage
.
find
(
'.inp[name="tel-code"]'
);
$tel
=
$addressManage
.
find
(
'.inp[name="tel"]'
);
var
validate
=
validateForm
();
code
=
$province
.
data
(
"areacode"
)
+
''
;
codeId
=
!!
code
&&
code
.
match
(
addressCodeReg
);
...
...
@@ -271,6 +275,18 @@ function newAddress(id) {
}
}
});
$name
.
on
(
'blur'
,
function
()
{
validate
.
name
(
$name
.
val
());
});
$address
.
on
(
'blur'
,
function
()
{
validate
.
address
(
$address
.
val
());
});
$phone
.
on
(
'blur'
,
function
()
{
validate
.
mobile
(
$phone
.
val
());
});
$tel
.
on
(
'blur'
,
function
()
{
validate
.
tel
(
$telCode
.
val
(),
$tel
.
val
());
})
}
/**
* @description: 改函数会返回地址信息
...
...
@@ -362,11 +378,11 @@ function saveAddress(id) {
telCode
=
$telCode
.
val
(),
tel
=
$tel
.
val
();
var
$err_name
=
$name
.
siblings
(
'.error'
),
$err_province
=
$province
.
siblings
(
'.error'
),
$err_address
=
$address
.
siblings
(
'.error'
),
$err_phone
=
$phone
.
siblings
(
'.error'
),
$err_tel
=
$tel
.
siblings
(
'.error'
);
// var $err_name = $name.siblings('.error'),
// $err_province = $province.siblings('.error'),
// $err_address = $address.siblings('.error'),
// $err_phone = $phone.siblings('.error'),
// $err_tel = $tel.siblings('.error');
var
postData
=
{
orderCode
:
id
,
...
...
@@ -377,49 +393,9 @@ function saveAddress(id) {
phoneCode
:
telCode
,
phoneNum
:
tel
};
var
nameReg
=
/^
[\u
4e00-
\u
9fa5
]{2,5}
$/
;
var
addressReg
=
/^
[\s\S]{2,100}
$/
;
var
phoneReg
=
/^
(
13
[
0-9
]
|15
[
012356789
]
|17
[
678
]
|18
[
0-9
]
|14
[
57
])[
0-9
]{8}
$/
;
var
telCodeReg
=
/^
[
0-9
]{3,5}
$/
;
var
telReg
=
/^
[
0-9
]{5,10}
$/
;
if
(
!
nameReg
.
test
(
name
))
{
$err_name
.
find
(
'b'
).
html
(
'真实姓名至少2个中文,最多5个中文'
);
$err_name
.
show
();
return
;
}
else
{
$err_name
.
hide
();
}
if
(
province
===
'0'
||
city
===
'0'
||
county
===
'0'
)
{
$err_province
.
show
();
return
;
}
else
{
$err_province
.
hide
();
}
if
(
!
addressReg
.
test
(
address
))
{
$err_address
.
find
(
'b'
).
html
(
'你输入的地址格式不正确'
);
$err_address
.
show
();
return
;
}
else
{
$err_address
.
hide
();
}
if
(
!
phoneReg
.
test
(
phone
))
{
$err_phone
.
find
(
'b'
).
html
(
'你输入的联系电话格式不正确'
);
$err_phone
.
show
();
return
;
}
else
{
$err_phone
.
hide
();
}
if
((
!!
telCode
&&
!
telCodeReg
.
test
(
telCode
))
||
(
!!
tel
&&
!
telReg
.
test
(
tel
))
||
(
telCodeReg
.
test
(
telCode
)
&&
!
telReg
.
test
(
tel
))
||
(
!
telCodeReg
.
test
(
telCode
)
&&
telReg
.
test
(
tel
)))
{
$err_tel
.
find
(
'b'
).
html
(
'你输入的电话格式不正确'
);
$err_tel
.
show
();
var
validate
=
validateForm
();
if
(
!
validate
.
name
(
name
)
||
!
validate
.
city
(
province
,
city
,
county
)
||
!
validate
.
address
(
address
)
||
!
validate
.
mobile
(
phone
)
||
!
validate
.
tel
(
telCode
,
tel
))
{
return
;
}
else
{
$err_tel
.
hide
();
}
$
.
ajax
({
...
...
@@ -438,3 +414,89 @@ function saveAddress(id) {
}
})
}
function
validateForm
()
{
var
$err_name
=
$name
.
siblings
(
'.error'
),
$err_province
=
$province
.
siblings
(
'.error'
),
$err_address
=
$address
.
siblings
(
'.error'
),
$err_phone
=
$phone
.
siblings
(
'.error'
),
$err_tel
=
$tel
.
siblings
(
'.error'
);
var
nameReg
=
/^
[\u
4e00-
\u
9fa5
]{2,5}
$/
;
var
addressReg
=
/^
[
a-zA-Z0-9-#()
\u
4e00-
\u
9fa5
]
+$/
;
var
phoneReg
=
/^
(
13
[
0-9
]
|15
[
012356789
]
|17
[
678
]
|18
[
0-9
]
|14
[
57
])[
0-9
]{8}
$/
;
var
telCodeReg
=
/^
[
0-9
]{3,5}
$/
;
var
telReg
=
/^
[
0-9
]{5,10}
$/
;
var
_right_html
=
'<i class="order-icon icon-right"></i>'
;
var
_error_html
=
'<i class="order-icon icon-error"></i><b></b>'
;
return
{
name
:
function
(
name
)
{
if
(
!
nameReg
.
test
(
name
))
{
$err_name
.
html
(
_error_html
);
$err_name
.
find
(
'b'
).
html
(
'真实姓名至少2个中文,最多5个中文'
);
$err_name
.
show
();
return
false
;
}
else
{
$err_name
.
html
(
_right_html
).
show
();
return
true
;
}
},
city
:
function
(
province
,
city
,
county
)
{
if
(
province
===
'0'
||
city
===
'0'
||
county
===
'0'
)
{
$err_province
.
html
(
_error_html
);
$err_province
.
find
(
'b'
).
html
(
'请填写完整的省市区信息'
);
$err_province
.
show
();
return
false
;
}
else
{
$err_province
.
html
(
_right_html
).
show
();
return
true
;
}
},
address
:
function
(
address
)
{
if
(
!
addressReg
.
test
(
address
))
{
var
message
=
'详细地址不能为空'
;
if
(
$
.
trim
(
address
)
!==
''
)
{
message
=
'只能包含数字、字母、汉字、#、-、()及其组合'
;
}
$err_address
.
html
(
_error_html
);
$err_address
.
find
(
'b'
).
html
(
message
);
$err_address
.
show
();
return
false
;
}
else
{
$err_address
.
html
(
_right_html
).
show
();
return
true
;
}
},
mobile
:
function
(
phone
)
{
if
(
!
phoneReg
.
test
(
phone
))
{
var
message
=
'手机号码不能为空'
;
if
(
$
.
trim
(
phone
)
!==
''
)
{
message
=
'你输入的联系电话格式不正确'
;
}
$err_phone
.
html
(
_error_html
);
$err_phone
.
find
(
'b'
).
html
(
message
);
$err_phone
.
show
();
return
false
;
}
else
{
$err_phone
.
html
(
_right_html
).
show
();
return
true
;
}
},
tel
:
function
(
telCode
,
tel
)
{
if
(
telCode
===
''
&&
tel
===
''
){
_right_html
=
''
;
}
if
((
!!
telCode
&&
!
telCodeReg
.
test
(
telCode
))
||
(
!!
tel
&&
!
telReg
.
test
(
tel
))
||
(
telCodeReg
.
test
(
telCode
)
&&
!
telReg
.
test
(
tel
))
||
(
!
telCodeReg
.
test
(
telCode
)
&&
telReg
.
test
(
tel
)))
{
$err_tel
.
html
(
_error_html
);
$err_tel
.
find
(
'b'
).
html
(
'你输入的电话格式不正确'
);
$err_tel
.
show
();
return
false
;
}
else
{
$err_tel
.
html
(
_right_html
).
show
();
return
true
;
}
}
}
}
...
...
web-static/sass/home/_order-block.css
View file @
f38570b
...
...
@@ -564,6 +564,11 @@
height
:
15px
;
background-position
:
0
-33px
;
}
.icon-right
{
width
:
15px
;
height
:
15px
;
background-position
:
-50px
-33px
;
}
.icon-recycle
{
width
:
15px
;
height
:
17px
;
...
...
web-static/sass/home/_order-detail.css
View file @
f38570b
...
...
@@ -32,6 +32,11 @@
}
.edit-order
{
float
:
right
;
background
:
#ebebeb
;
border
:
1px
solid
#c1c1c1
;
color
:
#000
;
}
.edit-order-active
{
background
:
#444
;
border
:
1px
solid
#444
;
color
:
#fff
;
...
...
Please
register
or
login
to post a comment