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
55b6d60351157e326a3a2781f8493bbd2cedda51
1 parent
e5f23974
remove le invoice
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
71 additions
and
148 deletions
apps/shopping/controllers/order.js
apps/shopping/views/action/order.hbs
public/js/shopping/order.page.js
public/js/shopping/order/invoice.js
public/scss/shopping/_order.css
apps/shopping/controllers/order.js
View file @
55b6d60
...
...
@@ -21,7 +21,6 @@ const index = (req, res, next) => {
{
name
:
'个人'
,
value
:
1
,
checked
:
true
,
myClass
:
'personal'
},
{
...
...
@@ -30,8 +29,6 @@ const index = (req, res, next) => {
}
];
result
.
data
.
invoices
.
invoiceContentList
[
0
].
checked
=
true
;
// 发票类型默认选中第一项
// 返回购物车链接
result
.
data
.
goCartLink
=
helper
.
urlFormat
(
'/shopping/cart'
);
...
...
apps/shopping/views/action/order.hbs
View file @
55b6d60
...
...
@@ -241,15 +241,10 @@
<script
id=
"invoice-dialog-tpl"
type=
"text/html"
>
<p class="dialog-title">发票信息</p>
<ul class="invoice-tab">
<li class="btn el-invoice no-focus hide">电子发票</li>
<li class="btn paper-invoice">纸质发票</li>
</ul>
<div class="invoice-entity el">
<p class="tip hide">
※ 电子发票是税务局认可的有效凭证,其法律效力、基本用途及使用规定同纸质发票,如需纸质发票可自行下载。
<a class="what-is-el-invoice" href="" target="_blank">什么是电子发票</a>
</p>
<div class="row clearfix">
<span class="label">
<em class="required-mark">*</em>
...
...
@@ -289,19 +284,6 @@
<
/div
>
<
/div
>
<
/div
>
<
div
class
=
"row phone-row clearfix hide"
>
<
span
class
=
"label"
>
<
em
class
=
"required-mark"
>*<
/em
>
收票人手机:
<
/span
>
<
div
class
=
"row-content"
>
<
input
class
=
"input receiver-phone"
type
=
"text"
>
<
span
class
=
"input-tip invoice-phone-tip blue hide"
>
<
span
class
=
"iconfont"
>&
#
xe60c
;
<
/span
>
<
em
><
/em
>
<
/span
>
<
/div
>
<
/div
>
<
/div
>
</script>
...
...
@@ -392,10 +374,9 @@
\{{/if}}
<label>发票开具</label>
</div>
\{{#if type}}
<p class="invoice-detail"
data-type="\{{type}}" data-title="\{{invoiceTitle}}" data-content="\{{content}}" data-phone="\{{phone}}">
<em>\{{invoiceTypeText}}</em><em>\{{invoiceTitle}}</em><em>\{{invoiceContent}}</em>
\{{#if invoiceTitle}}
<p class="invoice-detail" data-title="\{{invoiceTitle}}" data-content="\{{content}}">
<em>\{{invoiceTitle}}</em><em>\{{invoiceContent}}</em>
<span class="modify-invoice btn white">修改</span>
</p>
\{{
/
if
}}
...
...
public/js/shopping/order.page.js
View file @
55b6d60
...
...
@@ -196,11 +196,6 @@ $('#submit-order').click(function() {
$invoiceDetail
=
$invoice
.
find
(
'.invoice-detail'
);
$
.
extend
(
reqParam
,
{
// 电子发票
// invoices_type: $invoiceDetail.data('type'),
// invoices_title: $invoiceDetail.data('title'),
// invoices_content: $invoiceDetail.data('content'),
// recevierMobile: $invoiceDetail.data('phone')
invoices_title
:
$invoiceDetail
.
data
(
'title'
),
invoices_type_id
:
$invoiceDetail
.
data
(
'content'
)
});
...
...
public/js/shopping/order/invoice.js
View file @
55b6d60
...
...
@@ -12,47 +12,13 @@ var checkedInvoiceTpl = hbs.compile($('#checked-invoice-show-tpl').html());
var
$invoiceContent
=
$
(
'#invoice-content'
);
var
$invoiceTitleInput
,
$invoiceTip
,
$invoceTab
,
$invoiceEntity
,
invoiceDialog
;
var
$invoiceTitleInput
;
// 发票信息验证
function
validateInvoice
(
$el
)
{
var
pass
=
true
;
var
phone
=
$
.
trim
(
$el
.
find
(
'.receiver-phone'
).
val
());
var
name
=
$
.
trim
(
$el
.
find
(
'.invoice-title-input'
).
val
());
var
phoneRegx
=
[
{
noEmpty
:
true
,
err
:
'请填写手机号码'
},
{
regx
:
/
\d{11}
/
,
err
:
'手机号码不正确'
}
];
var
key
,
vaRegx
;
// 电子发票
if
(
$el
.
find
(
'.paper-invoice'
).
hasClass
(
'no-focus'
))
{
for
(
key
=
0
;
key
<
phoneRegx
.
length
;
key
++
)
{
vaRegx
=
phoneRegx
[
key
];
if
(
vaRegx
.
noEmpty
&&
phone
===
''
||
vaRegx
.
regx
&&
!
vaRegx
.
regx
.
test
(
phone
))
{
pass
=
false
;
$el
.
find
(
'.invoice-phone-tip'
).
removeClass
(
'hide'
).
find
(
'em'
).
text
(
vaRegx
.
err
);
break
;
}
}
}
// 发票抬头为单位
if
(
$el
.
invoiceTitleType
===
2
&&
name
===
''
)
{
pass
=
false
;
...
...
@@ -74,17 +40,12 @@ function invoiceDialogFactory() {
name
:
'保存发票信息'
,
cb
:
function
()
{
var
$el
=
invoice
.
$el
;
var
invoiceType
;
if
(
validateInvoice
(
$el
))
{
invoiceType
=
$invoceTab
.
children
().
not
(
'no-focus'
).
hasClass
(
'el-invoice'
)
?
1
:
2
;
$invoiceContent
.
html
(
checkedInvoiceTpl
({
type
:
invoiceType
,
invoiceTypeText
:
invoiceType
===
2
?
'电子发票'
:
'纸质发票'
,
invoiceTitle
:
$el
.
invoiceTitleType
===
1
?
'个人'
:
$invoiceTitleInput
.
val
(),
content
:
$el
.
invoiceContent
,
invoiceContent
:
$el
.
find
(
'.invoice-content-radio .checked'
).
next
(
'label'
).
text
(),
phone
:
$el
.
find
(
'.receiver-phone'
).
val
(),
checked
:
true
// 发票开具radio选中
}));
...
...
@@ -101,57 +62,84 @@ function invoiceDialogFactory() {
invoice
.
close
();
}
}
],
keep
:
true
]
});
return
invoice
;
}
invoiceDialog
=
invoiceDialogFactory
();
function
showInvoiceDialog
()
{
var
$invoceDetail
=
$invoiceContent
.
find
(
'.invoice-detail'
);
var
dialog
=
invoiceDialogFactory
();
// 存储发票参数
$
.
extend
(
invoiceDialog
.
$el
,
{
invoiceTitleType
:
1
,
invoiceContent
:
$
(
'.invoice-content-radio .checked'
).
parent
().
data
(
'value'
)
// 默认选中项的值
});
var
$invoiceTip
=
$
(
'.yoho-dialog.invoice .input-tip'
);
$invoiceTitleInput
=
$
(
'.yoho-dialog.invoice .invoice-title-input'
);
$invoiceTip
=
$
(
'.yoho-dialog.invoice .input-tip'
);
$invoceTab
=
$
(
'.invoice-tab'
);
$invoiceEntity
=
$
(
'.invoice-entity'
);
// 初始化发票抬头radio
$
(
'.invoice-title-radio'
).
check
({
type
:
'radio'
,
group
:
'invoice-title'
,
onChange
:
function
(
el
,
checked
,
value
)
{
// 只处理选中的change逻辑
if
(
checked
)
{
if
(
$
(
el
).
hasClass
(
'personal'
))
{
$invoiceTitleInput
.
addClass
(
'hide'
);
}
else
{
$invoiceTitleInput
.
removeClass
(
'hide'
);
}
var
isEditInvoice
=
$invoceDetail
.
length
>
0
;
// radio默认值
var
invoiceTitleType
=
1
,
invoiceContent
=
$
(
'.invoice-content-radio'
).
first
().
data
(
'value'
);
var
title
;
$invoiceTitleInput
=
$
(
'.yoho-dialog.invoice .invoice-title-input'
);
if
(
isEditInvoice
)
{
title
=
$invoceDetail
.
data
(
'title'
);
$invoiceTip
.
addClass
(
'hide'
);
// 切换时隐藏提示
invoiceDialog
.
$el
.
invoiceTitleType
=
value
;
// 1-个人;2-单位
invoiceTitleType
=
title
===
'个人'
?
1
:
2
;
invoiceContent
=
$invoceDetail
.
data
(
'content'
);
if
(
invoiceTitleType
===
2
)
{
$invoiceTitleInput
.
removeClass
(
'hide'
).
val
(
title
);
}
}
});
// 初始化发票内容radio
$
(
'.invoice-content-radio'
).
check
({
type
:
'radio'
,
group
:
'invoice-content'
,
onChange
:
function
(
el
,
checked
,
value
)
{
// 设置radio选中
$
(
'[data-value='
+
invoiceTitleType
+
'].invoice-title-radio'
).
find
(
'.radio'
).
addClass
(
'checked'
);
$
(
'[data-value='
+
invoiceContent
+
'].invoice-content-radio'
).
find
(
'.radio'
).
addClass
(
'checked'
);
// 存储发票参数
$
.
extend
(
dialog
.
$el
,
{
invoiceTitleType
:
invoiceTitleType
,
invoiceContent
:
invoiceContent
});
if
(
checked
)
{
invoiceDialog
.
$el
.
invoiceContent
=
value
;
// 初始化发票抬头radio
$
(
'.invoice-title-radio'
).
check
({
type
:
'radio'
,
group
:
'invoice-title'
,
onChange
:
function
(
el
,
checked
,
value
)
{
// 只处理选中的change逻辑
if
(
checked
)
{
if
(
$
(
el
).
hasClass
(
'personal'
))
{
$invoiceTitleInput
.
addClass
(
'hide'
);
}
else
{
$invoiceTitleInput
.
removeClass
(
'hide'
);
}
$invoiceTip
.
addClass
(
'hide'
);
// 切换时隐藏提示
dialog
.
$el
.
invoiceTitleType
=
value
;
// 1-个人;2-单位
}
}
}
});
});
// 初始化发票内容radio
$
(
'.invoice-content-radio'
).
check
({
type
:
'radio'
,
group
:
'invoice-content'
,
onChange
:
function
(
el
,
checked
,
value
)
{
if
(
checked
)
{
dialog
.
$el
.
invoiceContent
=
value
;
}
}
});
dialog
.
show
();
}
$invoiceContent
.
on
(
'click'
,
'.invoice-radio'
,
function
()
{
if
(
$
(
this
).
find
(
'.checked'
).
length
>
0
)
{
...
...
@@ -163,23 +151,8 @@ $invoiceContent.on('click', '.invoice-radio', function() {
}
else
{
// 选中
invoiceDialog
.
show
();
showInvoiceDialog
();
}
}).
on
(
'click'
,
'.modify-invoice'
,
function
()
{
invoiceDialog
.
show
();
});
// 纸质发票和电子发票的切换
$invoceTab
.
on
(
'click'
,
'.btn'
,
function
()
{
var
$this
=
$
(
this
);
if
(
$this
.
hasClass
(
'no-focus'
))
{
$invoceTab
.
children
(
'.btn'
).
toggleClass
(
'no-focus'
);
if
(
$this
.
hasClass
(
'el-invoice'
))
{
$invoiceEntity
.
addClass
(
'el'
);
}
else
{
$invoiceEntity
.
removeClass
(
'el'
);
}
}
showInvoiceDialog
();
});
...
...
public/scss/shopping/_order.css
View file @
55b6d60
...
...
@@ -599,17 +599,6 @@
.yoho-dialog.invoice
{
width
:
702px
;
/* 纸质发票不显示提示和收票人手机 */
.tip,
.phone-row
{
display
:
none
;
}
.el
.tip
,
.el
.phone-row
{
display
:
block
;
}
.dialog-title
{
color
:
#777
;
line-height
:
50px
;
...
...
@@ -623,12 +612,6 @@
width
:
85px
;
height
:
26px
;
line-height
:
26px
;
&.no-focus
{
background
:
#fff
;
color
:
#999
;
border-color
:
#eee
;
}
}
}
...
...
@@ -639,12 +622,6 @@
line-height
:
18px
;
}
.what-is-el-invoice
{
display
:
block
;
font-weight
:
bold
;
margin-top
:
20px
;
}
.required-mark
{
color
:
#f00
;
}
...
...
Please
register
or
login
to post a comment