123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- function getRandomNum(num = 8) {
- let str = "";
- for (var i = 0; i < num; i++) {
- str += parseInt(Math.random() * 10);
- }
- return str;
- }
- function receiptDocuments(data, domId) {
- let yy = new Date().getFullYear();
- let mm = new Date().getMonth() + 1;
- if (mm < 10) {
- mm = "0" + mm;
- }
- let dd = new Date().getDate();
- if (dd < 10) {
- dd = "0" + dd;
- }
- let { customerName, customName, productCodeListVOList, noticeNumber, printUser, drawer, salesman } = data;
- let printContent = `<div class="table" style="display: flex;flex-direction: column;align-items: center;width: 1000px;">
- <div class="tableName" style="margin: 0 auto;font-size: 30px;font-weight: bold;">
- 诸暨市新丝维纤维有限公司送货单
- </div>
- <div class="title" style="width: 100%; padding: 0 10px;position: relative;">
- <div style="display: flex;justify-content: space-between;width: 100%;padding: 0 10px;box-sizing: border-box;">
- <span>通知单号 ${noticeNumber}</span>
- <span>单号 ${getRandomNum()}</span>
- </div>
- <div
- style="display: flex;justify-content: space-between;width: 100%; padding: 0 10px;box-sizing: border-box;margin-bottom: 5px;">
- <span>客户名称 <span class="name" style="display: inline-block;
- width: 300px;
- border-bottom: 2px solid black;
- padding-bottom: 3px;">${customerName || customName}</span>
- </span>
- <span>时间 ${yy} 年 ${mm} 月 ${dd} 日</span>
- </div>
- <div class="aside" style="position: absolute;right: -40px;top: 1px;">
- <span style="writing-mode: vertical-lr;">白联财务联,红联仓库联,黄联客户联</span>
- </div>
- <div class="tableContext" style="width: 100%;">
- <table style="width:100%; border-collapse:collapse;" border="1" cellpadding="10" align="center">
- <tbody>
- <tr align="center">
- <td width="200px">品名</td>
- <td width="200px">规格</td>
- <td width="50px">等级</td>
- <td width="150px">色泽</td>
- <td width="60px">批号</td>
- <td width="90px">实发箱数</td>
- <td width="120px">数量(公斤)</td>
- <td width="50px">单价</td>
- <td width="100px">金额</td>
- </tr>`;
- let myTotalBoxNum = 0, totalWeight = 0, totalPrice = 0;
- for (let i = 0; i < productCodeListVOList.length; i++) {
- let item = productCodeListVOList[i];
- if (item.totalBoxNum) {
- myTotalBoxNum += Number(item.totalBoxNum);
- }
- if (item.totalSuttle) {
- totalWeight += Number(item.totalSuttle);
- }
- let price = 0
- if (item.totalSuttle && item.productUnitPrice) {
- price = Number(item.totalSuttle) * Number(item.productUnitPrice);
- totalPrice += price
- }
- price = price.toFixed(2);
- printContent += `<tr align="center">
- <td>${item.productName}</td>
- <td>${item.productSpecifications}</td>
- <td>${item.levels}</td>
- <td>${item.productColor}</td>
- <td>${item.lotNum}</td>
- <td>${item.totalBoxNum}</td>
- <td>${item.totalSuttle}</td>
- <td>${item.productUnitPrice}</td>
- <td>${price}</td>
- </tr>`
- }
- totalWeight = totalWeight.toFixed(2);
- totalPrice = totalPrice.toFixed(2);
- printContent += `<tr align="center">
- <td colspan="5">合计</td>
- <td>${myTotalBoxNum}</td>
- <td>${totalWeight}</td>
- <td></td>
- <td>${totalPrice}</td>
- </tr>`
- printContent += `</tbody>
- </table>
- </div>
- <div class="tableBottom" style='width: 100%;
- padding: 0 10px;
- margin: 0 auto;
- position: relative;
- top: 200px;
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- justify-content: space-between;'>
- <span style="width: 100%;">备注:</span>
- <span>制单员 ${printUser}</span>
- <span>销货员 ${salesman}</span>
- <span>提货人</span>
- <span>收货单位签名或盖章:</span>
- <span style="width: 100%;">客户收货员签名,即视为已收到本单货物和对欠款金额的确认。则该送货单上的期末欠款金额作为欠款法律凭证。</span>
- <span style="width: 100%">不同批号,不得混用。发现质量问题请在10天内提告本公司。如有后道编织物品,恕不负责退还及赔偿</span>
- </div>
- </div>`
- document.body.innerHTML = document.getElementById(domId).innerHTML = printContent;
- window.print(); //打印
- window.location.reload();
- return false;
- }
- export default receiptDocuments
|