Invoice.tsx
7.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
import styled from 'styled-components';
const InvoiceTmpDiv = styled.div`
font-size: 12px;
width: 1120px;
.title {
font-size: 26px;
color: #b16363;
text-align: center;
line-height: 56px;
padding-top: 0;
}
.extra {
color: #b15b16;
.content {
color: #181818;
}
}
.height84 {
height: 110px;
}
.row {
border: 2px solid #b16363;
border-bottom: none;
color: #b15b16;
.content {
color: #181818;
}
}
.last-row {
.content {
color: #181818;
}
color: #b15b16;
border-top: 2px solid #b16363;
}
.label {
width: 78px;
display: inline-block;
text-align-last: justify;
text-align: justify;
}
.longLabel {
width: 178px;
display: inline-block;
text-align-last: justify;
text-align: justify;
}
.title-label {
width: 52px;
}
`;
const Row = styled.div`
.col_1 {
width: 2.65%;
borderleft: none;
}
.col_4 {
width: 3.75%;
}
.col_9 {
width: 7.4%;
}
.col_2 {
width: 8.33%;
}
.col_3 {
width: 12.5%;
}
.col_5 {
width: 20.83%;
}
.col_6 {
width: 42.5%;
}
.col_7 {
width: 29.16%;
}
.col_8 {
width: 33.33%;
}
.col_14 {
width: 58.33%;
}
.col_15 {
width: 42.5%;
}
.col_17 {
width: 70.83%;
}
.col_18 {
width: 100%;
}
.col_24 {
width: 100%;
}
`;
const Col = styled.span`
display: inline-block;
padding: 8px;
box-sizing: border-box;
vertical-align: middle;
border-left: 2px solid #b16363;
height: 100%;
&.no-border {
border-left: none;
}
.text-center {
text-align: center;
border-left: none;
border-right: none;
}
&.transparent-border {
border-left: 2px solid rgba(0, 0, 0, 0);
}
&.invoice-number {
border-left: none;
color: #b16363;
padding: 0 0 0 800px;
font-size: 14px;
}
`;
const UnderLine = styled.div`
border: 2px solid #b16363;
width: 325px;
height: 8px;
margin: -1% 0 2% 35%;
border-left: none;
border-right: none;
`;
const InvoiceInfo = styled.span`
color: black;
`;
const TitleDescription = styled.div`
margin-top: 4.2%;
`;
const ProjectContainer = styled.div`
width: 100%;
height: 160px;
border-top: 2px solid #b16363;
border-right: 2px solid #b16363;
border-left: 2px solid #b16363;
max-height: 500px; /* 设置最大高度,根据需要调整 */
overflow: auto;
.single-project {
width: 100%;
height: 30px;
}
`;
export default ({ data }) => {
return (
<div>
<InvoiceTmpDiv>
<Row>
<Col className="col_18 invoice-number">
发票号码:<InvoiceInfo>{data.invoiceNumber}</InvoiceInfo>
</Col>
<Col className="title col_18 no-border">
电子发票(
{data.type === 'SPECIAL_TICKET' ? '增值税专用发票' : '普通发票'})
</Col>
<UnderLine className="UnderLine">
<div></div>
</UnderLine>
</Row>
<Row className="row height84">
<Col className="col_1 no-border">购买方信息</Col>
<Col className="col_15">
<TitleDescription>
<span className="label">名称</span>:
<span className="content">{data.partyAName}</span>
</TitleDescription>
<TitleDescription>
<span className="longLabel">统一社会信用代码/纳税人识别号</span>:
<span className="content">{data.partyATaxid}</span>
</TitleDescription>
</Col>
<Col className="col_1">销售方信息</Col>
<Col className="col_6">
<TitleDescription>
<span className="label">名称</span>:
<span className="content">{data.partyBName}</span>
</TitleDescription>
<TitleDescription>
<span className="longLabel">统一社会信用代码/纳税人识别号</span>:
<span className="content">{data.partyBTaxid}</span>
</TitleDescription>
</Col>
</Row>
<Row className="row">
<Col className="col_7 no-border">
<div className="text-center">项目名称</div>
</Col>
<Col className="col_5">
<div className="text-center">规格型号</div>
</Col>
<Col className="">
<div className="text-center">单位</div>
</Col>
<Col className="col_2">
<div className="text-center">数量</div>
</Col>
<Col className="col_2">
<div className="text-center">单价</div>
</Col>
<Col className="col_2">
<div className="text-center">金额</div>
</Col>
<Col className="">
<div className="text-center">税率/征收率</div>
</Col>
<Col className="col_2">
<div className="text-center">税额</div>
</Col>
</Row>
<Row>
<ProjectContainer>
{data &&
data.invoiceDetails?.map((item) => {
const {
taxPrice,
totalPrice,
specification,
projectName,
quantity,
price,
taxRate,
unit,
} = item;
return (
<div className="single-project" key={item.id}>
<Col
className="col_7 transparent-border"
key={'projectName'}
>
<div className="text-center">{projectName}</div>
</Col>
<Col
className="col_5 transparent-border"
key={'specification'}
>
<div className="text-center">{specification}</div>
</Col>
<Col className=" transparent-border" key={'unit'}>
<div className="text-center">{unit}</div>
</Col>
<Col className="col_2 transparent-border" key={'quantity'}>
<div className="text-center">{quantity}</div>
</Col>
<Col className="col_2 transparent-border" key={'price'}>
<div className="text-center">{price}</div>
</Col>
<Col
className="col_2 transparent-border"
key={'totalPrice'}
>
<div className="text-center">{totalPrice}</div>
</Col>
<Col className=" transparent-border" key={'taxRate'}>
<div className="text-center">{taxRate}</div>
</Col>
<Col className="col_2 transparent-border" key={'taxPrice'}>
<div className="text-center">{taxPrice}</div>
</Col>
</div>
);
})}
</ProjectContainer>
</Row>
<Row className="row">
<Col className="col_15 no-border">
价税合计(大写)
<InvoiceInfo>{data.totalPriceText}</InvoiceInfo>
</Col>
<Col className="no-border">
(小写)<InvoiceInfo>¥{data.totalPrice}</InvoiceInfo>
</Col>
</Row>
<Row className="row height84">
<Col className="col_1 no-border">备注</Col>
<Col className="col_7">
<InvoiceInfo>{data.comment}</InvoiceInfo>
</Col>
</Row>
<Row className="last-row">
<Col className="col_6 no-border">
开票人:<InvoiceInfo>{data.invoicingPerson}</InvoiceInfo>
</Col>
</Row>
</InvoiceTmpDiv>
</div>
);
};