Blame view

src/pages/OrderPrint/components/DalangPrinter.tsx 11.3 KB
1
import '@/pages/OrderPrint/index.less';
zhongnanhuang authored
2
import { formatDateTime, formatSalesCode } from '@/utils';
3
4

export default ({ mainOrder, subOrders }) => {
zhongnanhuang authored
5
6
7
8
9
10
11
12
13
  //业务员:英文名称(销售代码)
  let salesCode = mainOrder.salesCode;
  salesCode = formatSalesCode(salesCode);
  //订单总额计算
  let totalPayment = 0;
  for (let order of subOrders) {
    let subOrderPayment = order.subOrderPayment;
    totalPayment += subOrderPayment === undefined ? 0 : subOrderPayment;
  }
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  let columns = [];
  for (let i = 0; i < subOrders.length; i++) {
    let subOrder = subOrders[i];
    columns.push(
      <tr height="30" style={{ height: '15.00pt' }}>
        <td height="30" colSpan={1} style={{ height: '15.00pt' }}></td>
        <td className="xl72" colSpan={3}>
          {subOrder.productName}
        </td>
        <td className="xl72" colSpan={3}>
          {subOrder.parameters}
        </td>
        <td className="xl72" colSpan={1}>
          {subOrder.unit}
        </td>
        <td className="xl72" colSpan={1}>
          {subOrder.quantity}
        </td>
        <td className="xl72" colSpan={1}>
zhongnanhuang authored
33
          {subOrder.productPrice}
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
        </td>
        <td className="xl72" colSpan={1}>
          {subOrder.subOrderPayment}
        </td>
        <td className="xl72" colSpan={3} style={{ textAlign: 'left' }}>
          {subOrder.notes}
        </td>
      </tr>,
    );
  }

  //补充空白行,使表格不少于六行
  for (let i = subOrders.length; i < 6; i++) {
    columns.push(
      <tr height="30" style={{ height: '15.00pt' }}>
        <td height="30" style={{ height: '15.00pt' }} colSpan={1}></td>
        <td className="xl72" colSpan={3}></td>
        <td className="xl72" colSpan={3}></td>
        <td className="xl72" colSpan={1}></td>
        <td className="xl72" colSpan={1}></td>
        <td className="xl72" colSpan={1}></td>
        <td className="xl72" colSpan={1}></td>
        <td className="xl72" colSpan={3}></td>
      </tr>,
    );
  }

  return (
zhongnanhuang authored
62
    <div className="flex items-center justify-center bg-gray-100">
63
64
      <div className="w-full max-w-4xl p-10 my-10 bg-white border border-gray-300">
        <table
zhongnanhuang authored
65
          id="printArea"
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
          className="p-10"
          width="855"
          border={0}
          cellPadding={0}
          cellSpacing={0}
          style={{
            width: '423.00pt',
            borderCollapse: 'collapse',
            tableLayout: 'fixed',
          }}
        >
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
          <col width="57" />
zhongnanhuang authored
92
          <tr height="42" style={{ height: '15.00pt' }}></tr>
93
94
95
          <tr height="42" style={{ height: '21.00pt' }}>
            <td height="42" colSpan={5} style={{ height: '21.00pt' }}></td>
            <td
zhongnanhuang authored
96
              id="title"
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
              className="xl65"
              colSpan={5}
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
              科 路 得
            </td>
            <td height="42" colSpan={5} style={{ height: '21.00pt' }}></td>
          </tr>
          <tr height="30" style={{ height: '15.00pt' }}>
            <td height="30" colSpan={3} style={{ height: '15.00pt' }}></td>
            <td
              className="xl66"
              colSpan={5}
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
              网址:www.canrd.com
            </td>
            <td
              className="xl66"
              colSpan="4"
              style={{
                borderRight: 'none',
                borderBottom: 'none',
                textAlign: 'left',
              }}
            >
              QQ:2902385824
            </td>
          </tr>
          <tr height="35" style={{ height: '17.50pt' }}>
            <td height="35" colSpan={5} style={{ height: '17.50pt' }}></td>
            <td
              className="xl67"
              colSpan={5}
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
              销售出货单
            </td>
            <td height="35" colSpan={5} style={{ height: '17.50pt' }}></td>
          </tr>
          <tr height="30" style={{ height: '15.00pt' }}>
            <td
              className="xl69"
              colSpan={1}
              style={{ borderRight: 'none', borderBottom: 'none' }}
            ></td>
            <td
              className="xl69"
zhongnanhuang authored
145
              colSpan="5"
146
147
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
zhongnanhuang authored
148
              单位名称:{mainOrder.institution}
149
150
151
152
153
154
155
156
            </td>
            <td
              className="xl69"
              colSpan={2}
              style={{ borderRight: 'none', borderBottom: 'none' }}
            ></td>
            <td
              className="xl69"
zhongnanhuang authored
157
              colSpan={7}
158
159
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
zhongnanhuang authored
160
              单号:{mainOrder.id}
161
162
163
164
165
166
            </td>
          </tr>
          <tr height="30" style={{ height: '15.00pt' }}>
            <td height="30" colSpan={1} style={{ height: '15.00pt' }}></td>
            <td
              className="xl69"
zhongnanhuang authored
167
              colSpan={5}
168
169
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
zhongnanhuang authored
170
              联系人:{mainOrder.customerName}
171
172
173
174
            </td>
            <td height="30" colSpan={2} style={{ height: '15.00pt' }}></td>
            <td
              className="xl69"
zhongnanhuang authored
175
              colSpan={7}
176
177
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
zhongnanhuang authored
178
              开单日期:{formatDateTime(mainOrder.createTime)}
179
180
181
182
183
184
            </td>
          </tr>
          <tr height="30" style={{ height: '15.00pt' }}>
            <td height="30" colSpan={1} style={{ height: '15.00pt' }}></td>
            <td
              className="xl69"
zhongnanhuang authored
185
              colSpan={5}
186
187
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
zhongnanhuang authored
188
              联系电话:{mainOrder.customerContactNumber}
189
190
191
192
193
194
195
            </td>
            <td className="xl70"></td>
          </tr>
          <tr height="30" style={{ height: '15.00pt' }}>
            <td height="30" colSpan={1} style={{ height: '15.00pt' }}></td>
            <td
              className="xl69"
zhongnanhuang authored
196
              colSpan={5}
197
198
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
zhongnanhuang authored
199
              送货地址:{mainOrder.customerShippingAddress}
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
            </td>
          </tr>
          <tr height="30" style={{ height: '15.00pt' }}>
            <td height="30" colSpan={1} style={{ height: '15.00pt' }}></td>
            <td className="xl71" colSpan={3}>
              货品名称
            </td>
            <td className="xl71" colSpan={3}>
              规格
            </td>
            <td className="xl71" colSpan={1}>
              单位
            </td>
            <td className="xl71" colSpan={1}>
              数量
            </td>
            <td className="xl71" colSpan={1}>
              单价
            </td>
            <td className="xl71" colSpan={1}>
              货款
            </td>
            <td className="xl71" colSpan={3}>
              备注
            </td>
          </tr>

          {columns}

          <tr style={{ height: '19.00pt' }}>
            <td height="30" colSpan={1} style={{ height: '15.00pt' }}></td>
            <td
              className="xl74"
              colSpan={3}
              style={{
                borderRight: '0.5pt solid windowtext',
                borderBottom: '0.5pt solid windowtext',
              }}
            >
              合计
            </td>
            <td
              className="xl74"
              colSpan={10}
              style={{
                textAlign: 'left',
                borderRight: '0.5pt solid windowtext',
                borderBottom: '0.5pt solid windowtext',
              }}
            >
zhongnanhuang authored
250
              {totalPayment}
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
            </td>
          </tr>

          <tr style={{ height: '19.00pt' }}>
            <td height="30" colSpan={1} style={{ height: '15.00pt' }}></td>
            <td
              className="xl74"
              colSpan={3}
              style={{
                borderRight: '0.5pt solid windowtext',
                borderBottom: '0.5pt solid windowtext',
              }}
            >
              摘要
            </td>
            <td
              className="xl74"
              colSpan={10}
              style={{
                textAlign: 'left',
                borderRight: '0.5pt solid windowtext',
                borderBottom: '0.5pt solid windowtext',
              }}
            ></td>
          </tr>

          <tr style={{ height: '19.00pt' }}>
            <td style={{ height: '19.00pt' }}></td>
            <td className="xl73">销货单位</td>
            <td
              className="xl74"
              colSpan={2}
              style={{
                borderRight: '0.5pt solid windowtext',
                borderBottom: '0.5pt solid windowtext',
              }}
            >
              发货地址
            </td>
            <td
              className="xl74"
              colSpan={4}
              style={{
                textAlign: 'left',
                borderRight: '0.5pt solid windowtext',
                borderBottom: '0.5pt solid windowtext',
              }}
            >
              广东省东莞市大朗镇松木山祥明路38号
            </td>
            <td className="xl73" colSpan={2}>
              开户银行及账号
            </td>
            <td
              className="xl74"
              colSpan={4}
              style={{
                textAlign: 'left',
                borderRight: '0.5pt solid windowtext',
                borderBottom: '0.5pt solid windowtext',
              }}
            >
              招商银行股份有限公司东美东骏路支行
              <br />
              769906437110802
            </td>
          </tr>

          <tr style={{ height: 30 }}>
            <td height="30" style={{ height: '15.00pt' }}></td>
            <td className="xl76" colSpan={3} style={{ msoIgnore: 'colSpan' }}>
              客户签名:
            </td>
            <td className="xl76" colSpan={3}>
              仓管员:Luo YH
            </td>
            <td
              className="xl78"
              colSpan={4}
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
zhongnanhuang authored
332
              业务员:{salesCode}
333
334
335
336
337
338
            </td>
            <td
              className="xl78"
              colSpan={2}
              style={{ borderRight: 'none', borderBottom: 'none' }}
            >
zhongnanhuang authored
339
              开单人:莫丽娟
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
            </td>
          </tr>
          <tr style={{ display: 'none', width: 0 }}>
            <td width="26" style={{ width: 13 }}></td>
            <td width="53" style={{ width: 26 }}></td>
            <td width="116" style={{ width: 58 }}></td>
            <td width="170" style={{ width: 85 }}></td>
            <td width="165" style={{ width: 83 }}></td>
            <td width="96" style={{ width: 48 }}></td>
            <td width="114" style={{ width: 57 }}></td>
          </tr>
        </table>
      </div>
    </div>
  );
};