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
lore-w
9 years ago
Commit
507fecb88ccdd9e893e7b8dce491077ffc6eeecb
1 parent
6280b9d0
订单确认优化
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
32 deletions
template/www.yohobuy.com/actions/order/save/index.phtml
web-static/js/order/address.js
web-static/js/order/save.js
web-static/sass/order/_save.scss
yohobuy/www.yohobuy.com/application/modules/Order/controllers/Save.php
template/www.yohobuy.com/actions/order/save/index.phtml
View file @
507fecb
...
...
@@ -14,16 +14,16 @@
<h
2
class=
"title"
>请填写并核对以下信息</h
2
>
<div
class=
"order-content"
>
<div
class=
"order-selection address-list"
>
<h
2
>收货地址:<span>
[
不保存并关闭
]
</span></h
2
>
<h
2
>收货地址:<span>
[
修改
]
</span></h
2
>
<div
class=
"address-list-inner"
>
<ul
class=
"exist-address-list"
>
{
{#each
hasAddress
}
}
<li
class=
"
active
has-exist-address"
>
<li
class=
"has-exist-address"
>
<input
class=
"radio"
type=
"radio"
name=
"exist-address"
id=
"{{id}}"
{
{#if
checked
}
}checked
{
{/if
}
}/>
<label
for=
"{{id}}"
>
<strong>
{
{user
}
}</strong>
<span>
{
{address
}
}</span>
<
a
href=
"javascript:void(0);"
>设为默认地址</a
>
<
b
class=
"default-address"
>设为默认地址</b
>
<div
class=
"order-modify-btn"
>
<span
class=
"address-modify"
>
[
修改
]
</span>
<span
class=
"address-del"
>
[
删除
]
</span>
...
...
web-static/js/order/address.js
View file @
507fecb
...
...
@@ -12,7 +12,7 @@ var $addressManage = $('.address-manage'),
$city
=
$addressManage
.
find
(
'.text-input[name="city"]'
),
$county
=
$addressManage
.
find
(
'.text-input[name="county"]'
),
$selectList
=
$addressManage
.
find
(
'.text-input[name="province"], .text-input[name="city"]'
),
$
btn
=
$
(
'.order-modify-btn
'
),
$
addressList
=
$
(
'.address-list
'
),
$name
=
$addressManage
.
find
(
'.text-input[name="name"]'
),
$phone
=
$addressManage
.
find
(
'.text-input[name="phone"]'
),
$telCode
=
$addressManage
.
find
(
'.text-input[name="code-tel"]'
),
...
...
@@ -108,9 +108,9 @@ function getUserInfo(id) {
for
(
key
in
data
)
{
if
(
data
.
hasOwnProperty
[
key
]
)
{
if
(
data
.
hasOwnProperty
(
key
)
)
{
if
(
!!
data
[
key
])
{
window
(
'$'
+
key
).
val
(
data
[
key
]);
eval
(
'$'
+
key
).
val
(
data
[
key
]);
}
}
}
...
...
@@ -182,15 +182,13 @@ exports.newAddress = function(id) {
//修改地址
exports
.
modifyAddress
=
function
()
{
$btn
.
click
(
function
(
event
)
{
$addressList
.
click
(
function
(
event
)
{
var
$this
=
$
(
event
.
target
),
id
=
$this
.
closest
(
'li'
).
find
(
'.radio'
).
attr
(
'id'
);
if
(
$this
.
hasClass
(
'address-modify'
))
{
$addressManage
.
removeClass
(
'hide'
);
exports
.
newAddress
(
id
);
}
else
if
(
$this
.
hasClass
(
'address-del'
))
{
$
.
ajax
({
...
...
@@ -208,6 +206,24 @@ exports.modifyAddress = function() {
//todo
});
}
else
if
(
$this
.
hasClass
(
'default-address'
))
{
// 设为默认地址
$
.
ajax
({
type
:
'post'
,
url
:
'/order/save/defaultAddress'
,
data
:
{
id
:
id
}
}).
then
(
function
(
data
)
{
if
(
!!
data
.
status
)
{
$this
.
remove
();
}
}).
fail
(
function
()
{
//todo
});
}
});
};
...
...
web-static/js/order/save.js
View file @
507fecb
...
...
@@ -35,6 +35,7 @@ var Order = {
$spanPayTypeLegend
:
$
(
'span.pay-type-legend'
),
$supportType
:
$
(
'.support-type'
),
$existAddressList
:
$
(
'.exist-address-list'
).
find
(
'li'
),
$existAddress
:
$
(
'.exist-address-list'
).
find
(
'input[name="exist-address"]'
),
$payTimeModify
:
$
(
'.pay-time-modify'
),
$switchPayModify
:
$
(
'.switch-pay-modify'
)
},
...
...
@@ -118,26 +119,27 @@ var Order = {
if
(
!
$
(
this
).
data
(
'expand'
))
{
$
(
'.address-list-inner'
).
addClass
(
'hide'
);
$
(
this
).
data
(
'expand'
,
'expand'
).
text
(
'[
修改
]'
);
$
(
this
).
data
(
'expand'
,
'expand'
).
text
(
'[
不保存并关闭
]'
);
}
else
{
$
(
'.address-list-inner'
).
removeClass
(
'hide'
);
$
(
this
).
removeData
(
'expand'
).
text
(
'[
不保存并关闭
]'
);
$
(
this
).
removeData
(
'expand'
).
text
(
'[
修改
]'
);
}
});
//展开新地址填写表单
e
.
$addAddress
.
click
(
function
()
{
if
(
e
.
$addressManage
.
hasClass
(
'hide'
))
{
//支付及送货时间
e
.
$switchPayModify
.
click
(
function
()
{
e
.
$addressManage
.
removeClass
(
'hide'
);
if
(
e
.
$payTimeModify
.
hasClass
(
'hide'
))
{
e
.
$payTimeModify
.
removeClass
(
'hide'
);
$
(
this
).
text
(
'[不保存并关闭]'
);
}
else
{
return
;
e
.
$payTimeModify
.
addClass
(
'hide'
);
$
(
this
).
text
(
'[修改]'
);
}
});
e
.
$spanPayTypeLegend
.
click
(
function
()
{
...
...
@@ -146,20 +148,17 @@ var Order = {
e
.
$supportType
.
toggleClass
(
'hide'
);
});
e
.
$existAddressList
.
click
(
function
(
event
)
{
$
(
document
).
on
(
'click'
,
'.exist-address-list li'
,
function
()
{
e
.
$existAddressList
.
removeClass
(
'active'
);
$
(
this
).
addClass
(
'active'
);
e
.
$existAddress
.
removeAttr
(
'checked'
);
$
(
this
).
find
(
'input[name="exist-address"]'
).
attr
(
'checked'
,
'checked'
);
if
(
$
(
this
).
hasClass
(
'use-new-address'
))
{
e
.
$addAddress
.
attr
(
'checked'
,
true
);
// 必须在trigger前
e
.
$addAddress
.
trigger
(
'click'
);
e
.
$addressManage
.
removeClass
(
'hide'
);
}
event
.
stopPropagation
();
});
e
.
$switchPayModify
.
click
(
function
()
{
e
.
$payTimeModify
.
toggleClass
(
'hide'
);
});
},
...
...
web-static/sass/order/_save.scss
View file @
507fecb
...
...
@@ -118,11 +118,20 @@
display
:
inline-block
;
float
:
right
;
color
:
#e8044f
;
width
:
80px
;
padding-right
:
20px
;
height
:
auto
;
overflow
:
hidden
;
span
{
text-decoration
:
underline
;
margin
:
0
10px
;
cursor
:
pointer
;
float
:
right
;
&
.address-modify
{
float
:
left
;
}
}
}
...
...
@@ -130,6 +139,7 @@
li
{
border
:
1px
solid
#fff
;
padding-left
:
15px
;
&
.active
{
background
:
#dbedf7
;
...
...
@@ -137,9 +147,10 @@
}
&
.has-exist-address
{
a
{
.default-address
{
color
:
#468fa2
;
text-decoration
:
underline
;
cursor
:
pointer
;
}
}
}
...
...
yohobuy/www.yohobuy.com/application/modules/Order/controllers/Save.php
View file @
507fecb
...
...
@@ -102,7 +102,7 @@ class SaveController extends AbstractAction
array
(
'name'
=>
'111省'
,
'value'
=>
11
,
'checked'
=>
fals
e
'checked'
=>
tru
e
),
array
(
'name'
=>
'222省'
,
...
...
@@ -128,7 +128,7 @@ class SaveController extends AbstractAction
array
(
'name'
=>
'222市'
,
'value'
=>
22
,
'checked'
=>
fals
e
'checked'
=>
tru
e
),
array
(
'name'
=>
'333市'
,
...
...
@@ -154,7 +154,7 @@ class SaveController extends AbstractAction
array
(
'name'
=>
'333县'
,
'value'
=>
33
,
'checked'
=>
fals
e
'checked'
=>
tru
e
)
);
...
...
@@ -196,4 +196,14 @@ class SaveController extends AbstractAction
$this
->
echoJson
(
$data
);
}
//设为默认地址
public
function
defaultAddressAction
()
{
$data
=
array
(
'status'
=>
true
);
$this
->
echoJson
(
$data
);
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment