Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
weiqingting
9 years ago
Commit
99aa9bc7d2e3da60bef7c561b09aaea38ed8e144
1 parent
c457ab2e
订单确认
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
145 deletions
web-static/js/order/save.js
web-static/js/order/save.js
deleted
100644 → 0
View file @
c457ab2
/**
* @description: 订单保存
* @time: 2015/12/21
*/
var
$
=
require
(
'yoho.jquery'
);
var
Order
=
{
Data
:{
product
:
0
,
activity
:
0
,
carriage
:
0
,
juan
:
0
,
yohocoin
:
0
},
UI
:{
e
:{
$pan
:
$
(
'.pan'
),
$jc
:
$
(
"#juancode"
),
$bp
:
$
(
"#biprice"
),
$statistics
:
$
(
"li"
,
".play-total"
),
$tobi
:
$
(
"p em"
,
".play-bi-pan .play-pan"
),
$cancel
:
$
(
".cancel"
,
".btn-group"
)
},
init
:
function
(){
var
e
=
this
.
e
;
/*初始化价格*/
this
.
render
();
/*点击pan dt 打开dd*/
e
.
$pan
.
find
(
"dt"
).
click
(
function
()
{
var
pan
=
$
(
this
).
parent
(
"dl.pan"
);
if
(
pan
.
find
(
"dd"
).
is
(
":hidden"
)){
pan
.
find
(
"dd"
).
show
();
if
(
pan
.
attr
(
"class"
).
match
(
/
(
-bi-
)
|
(
-juan-
)
/g
)){
$
(
this
).
hide
();
}
}
else
{
pan
.
find
(
"dd"
).
hide
();
}
});
/*使用优惠卷支付 下面的文本框*/
e
.
$jc
.
focus
(
function
(){
$
(
this
).
prev
(
"label"
).
prev
(
":radio"
).
attr
(
"checked"
,
true
);
}).
change
(
function
(){
$
(
this
).
prev
(
"label"
).
prev
(
":radio"
).
val
(
$
(
this
).
val
());
});
/*使用YOHO币支付*/
e
.
$bp
.
data
(
"tobi"
,
e
.
$tobi
.
html
())
e
.
$bp
.
keyup
(
function
(){
var
bi
=
Order
.
Common
.
enterNUM
(
$
(
this
).
val
(),
$
(
this
).
data
(
"tobi"
));
$
(
this
).
val
(
bi
);
}).
change
(
function
(){
var
bi
=
Order
.
Common
.
enterNUM
(
$
(
this
).
val
(),
$
(
this
).
data
(
"tobi"
));
$
(
this
).
val
(
bi
);
});
/*取消关闭小窗口*/
e
.
$cancel
.
click
(
function
(){
var
p
=
$
(
this
).
parents
(
".pan"
);
p
.
find
(
"dt"
).
show
();
p
.
find
(
"dd"
).
hide
();
});
},
render
:
function
(){
var
e
=
this
.
e
,
d
=
Order
.
Data
;
e
.
$statistics
.
slice
(
3
,
5
).
hide
();
e
.
$statistics
.
slice
(
2
,
5
).
find
(
"em"
).
html
(
"0.00"
);
if
(
d
.
carriage
){
e
.
$statistics
.
eq
(
2
).
find
(
"em"
).
html
(
d
.
carriage
);
}
if
(
d
.
juan
){
e
.
$statistics
.
eq
(
3
).
show
().
find
(
"em"
).
html
(
d
.
juan
);
}
if
(
d
.
yohocoin
){
e
.
$statistics
.
eq
(
4
).
show
().
find
(
"em"
).
html
(
d
.
yohocoin
);
}
}
},
Common
:{
enterNUM
:
function
(
str1
,
str2
){
str1
=
str1
.
replace
(
/
[^\d]
/g
,
''
);
if
(
str1
&&
str2
){
str1
=
parseInt
(
str1
);
str2
=
parseInt
(
str2
);
if
(
str1
>
str2
){
str1
=
str2
;
}
}
return
str1
;
},
calucate
:
function
(){
var
p
=
Order
.
Data
;
$
.
each
(
Order
.
Data
,
function
(
key
,
index
){
p
[
key
]
=
parseFloat
(
Order
.
Data
[
key
]);
});
return
p
.
product
-
p
.
activity
+
p
.
carriage
-
p
.
juan
-
p
.
yohocoin
;
}
},
Submit
:{
e
:{
$juanok
:
$
(
"#juansubmit"
),
$juantip
:
$
(
".errtip"
,
".play-juan-pan"
),
$biok
:
$
(
"#juansubmit"
)
},
init
:
function
(){
var
e
=
this
.
e
;
e
.
$juanok
.
click
(
function
(){
$jgroup
=
$
(
'input[name="juangroup"]:checked'
);
var
pan
=
$
(
this
).
parents
(
".pan"
);
if
(
$jgroup
.
val
()){
var
options
=
{
url
:
'/Order/save/priceByCode'
,
type
:
'post'
,
data
:{
code
:
$jgroup
.
val
()},
success
:
function
(
data
){
if
(
data
.
code
===
200
){
if
(
data
.
price
){
Order
.
Data
.
juan
=
data
.
price
;
}
Order
.
UI
.
render
();
pan
.
hide
();
}
e
.
$juantip
.
html
(
data
.
msg
);
},
error
:
function
(){
e
.
$juantip
.
html
(
data
.
msg
);
}
}
$
.
ajax
(
options
);
}
});
}
}
}
Order
.
UI
.
init
();
Order
.
Submit
.
init
();
Please
register
or
login
to post a comment