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
王水玲
9 years ago
Commit
0faeb6643665363068bb4345bcd0954d7dbbbcd8
1 parent
85b249f3
电子发票
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
45 deletions
static/js/cart/invoice-info.js
static/js/cart/order-ensure.js
template/m.yohobuy.com/actions/cart/index/invoice-info.phtml
static/js/cart/invoice-info.js
View file @
0faeb66
...
...
@@ -11,12 +11,16 @@ var $ = require('jquery'),
var
$invoiceNotice
=
$
(
'.invoice-notice'
),
$companyArea
=
$
(
'.company-area'
),
$editFlag
=
$
(
'.edit-flag'
),
$chooseCont
=
$
(
'.choose-cont'
),
$tel
=
$
(
'.tel'
);
var
myreg
=
/^
(((
13
[
0-9
]{1})
|
(
15
[
0-9
]{1})
|
(
18
[
0-9
]{1}))
+
\d{8})
$/
;
var
myreg
=
/^
(((
13
[
0-9
]{1})
|
(
15
[
0-9
]{1})
|
(
18
[
0-9
]{1}))
+
\d{8})
$/
,
linkUrl
=
'/cart/index/orderEnsure?cartType=ordinary'
;
require
(
'../common'
);
//单选效果
function
chooseAction
(
pDom
,
dom
)
{
if
(
dom
.
hasClass
(
'icon-cb-radio'
))
{
return
;
...
...
@@ -28,12 +32,67 @@ function chooseAction(pDom, dom) {
}
}
// 确认表单事件
function
confirmAction
()
{
var
type
=
$
(
'.invoice-type'
).
find
(
'.on'
).
text
(),
title
=
$
(
'.invoice-top'
).
find
(
'.on'
).
text
(),
tel
=
$tel
.
data
(
'tel'
),
company
=
$
(
'.company'
).
val
(),
cont
=
$chooseCont
.
html
();
if
(
$editFlag
.
val
()
===
'true'
)
{
if
(
!
myreg
.
test
(
$tel
.
data
(
'tel'
)))
{
tip
.
show
(
'请输入正确手机号'
);
$tel
.
focus
();
return
false
;
}
else
{
dialog
.
showDialog
({
dialogText
:
'确认保存修改内容?'
,
hasFooter
:
{
leftBtnText
:
'取消'
,
rightBtnText
:
'确定'
}
},
function
()
{
$
.
ajax
({
method
:
'post'
,
url
:
'/cart/index/del'
,
data
:
{
type
:
type
,
title
:
title
,
tel
:
tel
,
company
:
title
===
'单位'
?
company
:
''
,
cont
:
cont
}
}).
then
(
function
(
data
)
{
if
(
data
.
code
===
200
)
{
dialog
.
showDialog
({
dialogText
:
'修改成功'
,
autoHide
:
true
,
fast
:
true
});
window
.
location
.
href
=
linkUrl
;
}
else
{
tip
.
show
(
data
.
message
);
}
},
function
()
{
tip
.
show
(
'网络异常'
);
window
.
location
.
reload
();
});
},
function
()
{
window
.
location
.
href
=
linkUrl
;
});
}
}
else
{
window
.
location
.
href
=
linkUrl
;
}
}
// 发票抬头、发票内容选择
$
(
'.invoice-top span, .invoice-cont li'
).
on
(
'touchstart'
,
function
(
e
)
{
$
(
'.invoice-top span, .invoice-cont li'
).
not
(
'.invoice-cont .cont-title'
).
on
(
'touchstart'
,
function
(
e
)
{
chooseAction
(
$
(
this
).
parent
(),
$
(
this
).
find
(
'.choose'
));
if
(
$
(
this
).
parent
().
hasClass
(
'invoice-cont'
))
{
$
(
'.choose-cont'
)
.
html
(
$
(
this
).
text
());
$
chooseCont
.
html
(
$
(
this
).
text
());
}
if
(
$
(
this
).
text
()
===
'单位'
)
{
...
...
@@ -61,10 +120,12 @@ $('.invoice-btn').on('touchstart', function() {
return
false
;
});
// 关闭发票须知弹框
$
(
'.think-ok, .mask-bg'
).
on
(
'touchstart'
,
function
()
{
$invoiceNotice
.
fadeOut
();
});
// 电话清空
$
(
'.istel'
).
one
(
'input'
,
function
()
{
$
(
this
).
val
(
''
).
removeClass
(
'istel'
);
});
...
...
@@ -74,45 +135,8 @@ $tel.on('input', function() {
$editFlag
.
val
(
'true'
);
});
$
(
'.confirm-btn'
).
on
(
'touchstart'
,
function
()
{
if
(
$editFlag
.
val
()
===
'true'
)
{
if
(
!
myreg
.
test
(
$tel
.
data
(
'tel'
)))
{
tip
.
show
(
'请输入正确手机号'
);
$tel
.
focus
();
return
false
;
}
else
{
dialog
.
showDialog
({
dialogText
:
'确认保存修改内容?'
,
hasFooter
:
{
leftBtnText
:
'取消'
,
rightBtnText
:
'确定'
}
},
function
()
{
$
.
ajax
({
method
:
'post'
,
url
:
'/cart/index/del'
,
data
:
{
type
:
$
(
'.invoice-type'
).
find
(
'.on'
).
text
(),
title
:
$
(
'.invoice-top'
).
find
(
'.on'
).
text
()
}
}).
then
(
function
(
data
)
{
if
(
data
.
code
===
200
)
{
dialog
.
showDialog
({
dialogText
:
'修改成功'
,
autoHide
:
true
,
fast
:
true
});
window
.
location
.
href
=
'/cart/index/orderEnsure?cartType=ordinary'
;
}
else
{
tip
.
show
(
data
.
message
);
}
},
function
()
{
tip
.
show
(
'网络异常'
);
window
.
location
.
reload
();
});
},
function
()
{
window
.
location
.
href
=
'/cart/index/orderEnsure?cartType=ordinary'
;
});
}
}
// 确认及返回事件
$
(
'.confirm-btn, .nav-back'
).
on
(
'touchstart'
,
function
(
e
)
{
e
.
preventDefault
();
confirmAction
();
});
\ No newline at end of file
...
...
static/js/cart/order-ensure.js
View file @
0faeb66
...
...
@@ -189,6 +189,7 @@ function submitOrder() {
if
(
isSubmiting
)
{
return
false
;
}
// if (orderInfo('invoice')) {
// if (!invoiceText) {
// tip.show('请输入发票抬头');
...
...
@@ -199,6 +200,7 @@ function submitOrder() {
// return;
// }
// }
if
(
msg
)
{
if
(
msg
.
length
>
40
)
{
tip
.
show
(
'留言不得超过40个汉字'
);
...
...
template/m.yohobuy.com/actions/cart/index/invoice-info.phtml
View file @
0faeb66
...
...
@@ -26,7 +26,7 @@
</ul>
<ul class="invoice-cont">
<li>
<li
class="cont-title"
>
<span>发票内容:</span>
<span class="choose-cont">{{invoiceCont}}</span>
</li>
...
...
Please
register
or
login
to post a comment