lilei 3 tahun lalu
induk
melakukan
04677b6e91

+ 2 - 2
src/libs/JGPrint.js

@@ -120,8 +120,8 @@ export const jGPrint = function (data, type, callback, printLogParams) {
          printLog(printLogParams,callback)
        }
     };
-    LODOP.ADD_PRINT_HTM(10, 2, '98%', '100%', data)
-    LODOP.SET_PRINT_PAGESIZE(1,2100,0,"");
+    LODOP.ADD_PRINT_HTM(0, 0, '100%', '100%', data)
+    LODOP.SET_PRINT_PAGESIZE(3,2100,100,"");
     if (type == 'preview') { //  预览
       LODOP.PREVIEW()
     } else if (type == 'print') { //  打印

+ 19 - 0
src/libs/tools.js

@@ -3,6 +3,24 @@ export const getOperationalPrecision = (num1, num2) => {
   const val = ((num1 * 10000) * (num2 * 10000) / 100000000).toFixed(2) || 0
   return val != 0 ? val : 0
 }
+
+// 金额转大写
+export const dealBigMoney = (n) =>{       
+   if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n))
+   return "数据非法";
+   let unit = "千百拾亿千百拾万千百拾元角分", str = "";
+   n += "00";
+   let p = n.indexOf('.');
+   if (p >= 0){
+      n = n.substring(0, p) + n.substr(p+1, 2);
+      unit = unit.substr(unit.length - n.length);
+  }
+   
+   for (var i=0; i < n.length; i++)
+   str += '零壹贰叁肆伍陆柒捌玖'.charAt(n.charAt(i)) + unit.charAt(i);
+   return  str.replace(/零(千|百|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(万|亿|元)/g, "$1").replace(/(亿)万|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "元整");
+}
+
 export const forEach = (arr, fn) => {
   if (!arr.length || !fn) return
   let i = -1
@@ -457,3 +475,4 @@ export const checkIdNumberValid = (tex) => {
   }
   return true
 }
+

+ 4 - 85
src/views/salesManagement/sendOutOrder/detailModal.vue

@@ -65,87 +65,7 @@
         <a-button type="primary" @click="handleCommonOk">{{ okText }}</a-button>
       </div>
       <!-- 发货打印 -->
-      <div id="sendGood-print">
-        <div class="print-box" style="width: 100%;padding: 10px;font-size: 12pt;" v-if="detail">
-          <div style="display: flex;align-items: center;justify-content: center;">
-            <img src="@/assets/logo.png" height="50px"/>
-            <h1>东莞市箭冠汽车配件制造有限公司</h1>
-          </div>
-          <div style="text-align: center;padding: 10px 0;position: relative;">
-            <h2>托运单</h2>
-            <span style="position: absolute;top: 10px;right: 0;">No:{{ detail.sendBillNo }}</span>
-          </div>
-          <div style="display: flex;align-items: center;justify-content:space-between;">
-            <span>托运日期:{{ detail.sendDate }}</span>
-            <span>目的地:{{ detail.customerAddress }}</span>
-          </div>
-          <div style="border: 1px solid #000;">
-            <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
-              <span style="width: 60%;border-right: 1px solid #000;">收货人:{{ detail.customerCacateName }}</span>
-              <span style="width: 40%;">电话:{{ detail.customerCacatePhone }}</span>
-            </div>
-            <div style="border-bottom: 1px solid #000;">
-              <span>详细地址:{{ detail.customerAddressDetail }}</span>
-            </div>
-            <table style="width: 100%;border-bottom: 1px solid #000;">
-              <tr style="border-bottom: 1px solid #000;">
-                <td style="border-right: 1px solid #000;">货物名称</td>
-                <td style="border-right: 1px solid #000;">件数</td>
-                <td style="border-right: 1px solid #000;">体积(m³)</td>
-                <td style="border-right: 1px solid #000;">重量(kg)</td>
-                <td style="border-right: 1px solid #000;">计费单价(元)</td>
-                <td style="border-right: 1px solid #000;">运费(元)</td>
-                <td style="border-right: 1px solid #000;">保价(万)</td>
-                <td style="border-right: 1px solid #000;">送货费</td>
-                <td style="border-right: 1px solid #000;">其他</td>
-                <td>合计</td>
-              </tr>
-              <tr v-for="item in tableData" :key="item.id" style="border-bottom: 1px solid #000;">
-                <td style="border-right: 1px solid #000;">{{ item.goodsName }}</td>
-                <td style="border-right: 1px solid #000;">{{ item.goodsQty }}</td>
-                <td style="border-right: 1px solid #000;">{{ item.goodsVolume }}</td>
-                <td style="border-right: 1px solid #000;">{{ item.goodsWeight }}</td>
-                <td style="border-right: 1px solid #000;">{{ item.unitPrice }}</td>
-                <td style="border-right: 1px solid #000;">{{ item.transportAmount }}</td>
-                <td style="border-right: 1px solid #000;">{{ item.supportValue }}</td>
-                <td style="border-right: 1px solid #000;">{{ item.sendAmount }}</td>
-                <td style="border-right: 1px solid #000;">{{ item.otherAmount }}</td>
-                <td>{{ item.totalAmount }}</td>
-              </tr>
-            </table>
-            <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
-              <div style="width: 90%;border-right: 1px solid #000;">费用合计大写:{{ detail.totalSendAmount }}</div>
-              <div style="width: 10%;">¥:{{ detail.totalSendAmount }}</div>
-            </div>
-            <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
-              <div style="width: 50%;border-right: 1px solid #000;">付款方式:{{ detail.payTypeDictValue }}</div>
-              <div style="width: 50%;">交货方式:{{ detail.handoverTypeDictValue }}</div>
-            </div>
-            <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
-              <div style="width: 8%;border-right: 1px solid #000;">备注:</div>
-              <div style="width: 92%;">{{ detail.sendRemark }}</div>
-            </div>
-            <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
-              <div style="width: 30px;text-align: center;">注意事项</div>
-              <div style="flex: 1;">
-                <ol style="margin: 0;border-left: 1px solid #000;padding-left: 30px;">
-                  <li>承运人需按合同规定时间内把货物送达客户所在区域(不得超出十公里).</li>
-                  <li>送货上门的货物,到达目的地后需提前和收货人联系并确定送货时间.</li>
-                  <li>货物必需完整的交接给收货人,并让收货人在物流单上签字并上传回单.</li>
-                  <li>如果发生货物丢失以及其它原因损坏需按价赔偿给客户.</li>
-                </ol>
-              </div>
-            </div>
-            <div style="display: flex;align-items: center;justify-content:space-between;">
-              <div>东莞市箭冠汽车配件制造有限公司</div>
-              <div>中国.广东.东莞.茶山工业园</div>
-              <div>电话:0769-81860196</div>
-              <div>传真:0769-81860108</div>
-            </div>
-          </div>
-        </div>
-      </div>
-
+      <printModel ref="printModel" :detail="detail"></printModel>
     </a-spin>
   </a-modal>
 </template>
@@ -153,11 +73,11 @@
 <script>
 import moment from 'moment'
 import { STable, VSelect } from '@/components'
-import { jGPrint } from '@/libs/JGPrint.js'
+import printModel from './printModel.vue'
 import { updateTransportInfo, sendBillFindBySn } from '@/api/sendBill'
 export default {
   name: 'CommonModal',
-  components: { STable, VSelect },
+  components: { STable, VSelect, printModel },
   props: {
     openModal: { //  弹框显示状态
       type: Boolean,
@@ -223,8 +143,7 @@ export default {
   methods: {
     // 打印
     printOrder () {
-      const html = document.getElementById('sendGood-print').innerHTML
-      jGPrint(html, 'print')
+      this.$refs.printModel.printDom()
     },
     // 编辑
     getDetail (data, type, title) {

+ 114 - 0
src/views/salesManagement/sendOutOrder/printModel.vue

@@ -0,0 +1,114 @@
+<template>
+  <!-- 发货打印 -->
+  <div id="sendGood-print" style="height: 0;overflow: hidden;">
+    <div class="print-box" style="width: 100%;font-size: 12pt;" v-if="detail">
+      <div style="display: flex;align-items: center;justify-content: center;">
+        <img src="@/assets/logo.png" height="50px"/>
+        <h1 style="margin:0;">东莞市箭冠汽车配件制造有限公司</h1>
+      </div>
+      <div style="text-align: center;padding: 5px 0;position: relative;">
+        <h2 style="margin:0;">托运单</h2>
+        <span style="position: absolute;top: 10px;right: 0;">No:{{ detail.sendBillNo }}</span>
+      </div>
+      <div style="display: flex;align-items: center;justify-content:space-between;padding: 5px;">
+        <span style="width: 70%;">托运日期:{{ detail.sendDate }}</span>
+        <span style="width: 30%;">目的地:{{ detail.customerAddress }}</span>
+      </div>
+      <div style="border: 1px solid #000;">
+        <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
+          <span style="width: 60%;border-right: 1px solid #000;padding: 5px;">收货人:{{ detail.customerCacateName }}</span>
+          <span style="width: 40%;padding: 5px;">电话:{{ detail.customerCacatePhone }}</span>
+        </div>
+        <div style="border-bottom: 1px solid #000;padding: 5px;">
+          <span>详细地址:{{ detail.customerAddressDetail }}</span>
+        </div>
+        <table style="width: 100%;border-collapse: collapse;text-align: center;">
+          <tr style="padding: 0;">
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 5px 0;width:14%;">货物名称</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;width:9%;">件数</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;width:9%;">体积(m³)</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;width:9%;">重量(kg)</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;width:9%;">计费单价(元)</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;width:9%;">运费(元)</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;width:9%;">保价(万)</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;width:9%;">送货费</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;width:9%;">其他</td>
+            <td style="border-bottom: 1px solid #000;padding: 0;width:14%;">合计</td>
+          </tr>
+          <tr style="padding: 0;" v-for="item in detail.detailList" :key="item.id">
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 5px 0;">{{ item.goodsName }}</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;">{{ item.goodsQty }}</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;">{{ item.goodsVolume.toFixed(2) }}</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;">{{ item.goodsWeight.toFixed(2) }}</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;">{{ item.unitPrice.toFixed(2) }}</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;">{{ item.transportAmount.toFixed(2) }}</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;">{{ item.supportValue.toFixed(2) }}</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;">{{ item.sendAmount.toFixed(2) }}</td>
+            <td style="border-right: 1px solid #000;border-bottom: 1px solid #000;padding: 0;">{{ item.otherAmount.toFixed(2) }}</td>
+            <td style="border-bottom: 1px solid #000;padding: 0;">{{ item.totalAmount.toFixed(2) }}</td>
+          </tr>
+        </table>
+        <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
+          <div style="width: 80%;border-right: 1px solid #000;padding: 5px;">费用合计大写:{{ dealBigMoney(detail.totalSendAmount.toFixed(2)) }}</div>
+          <div style="width: 20%;padding: 5px;">¥:{{ detail.totalSendAmount.toFixed(2) }}</div>
+        </div>
+        <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
+          <div style="border-right: 1px solid #000;flex:1;text-align: center;padding: 5px;">付款方式:</div>
+          <div style="border-right: 1px solid #000;flex:2;padding: 5px;">{{ detail.payTypeDictValue||'--' }}</div>
+          <div style="border-right: 1px solid #000;flex:1;text-align: center;padding: 5px;">交货方式:</div>
+          <div style="flex:2;padding: 5px;">{{ detail.handoverTypeDictValue||'--' }}</div>
+        </div>
+        <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
+          <div style="border-right: 1px solid #000;flex:1;padding: 8px 5px;">发货人签字:</div>
+          <div style="flex:1;padding: 8px 5px;">承运人签字:</div>
+        </div>
+        <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
+          <div style="width: 8%;border-right: 1px solid #000;padding: 5px;">备注:</div>
+          <div style="width: 92%;padding: 5px;">{{ detail.sendRemark||'--' }}</div>
+        </div>
+        <div style="border-bottom: 1px solid #000;display: flex;align-items: center;justify-content:space-between;">
+          <div style="width: 30px;text-align: center;">注意事项</div>
+          <div style="flex: 1;padding: 5px;border-left: 1px solid #000;">
+            <ol style="margin: 0;padding-left: 30px;">
+              <li>承运人需按合同规定时间内把货物送达客户所在区域(不得超出十公里).</li>
+              <li>送货上门的货物,到达目的地后需提前和收货人联系并确定送货时间.</li>
+              <li>货物必需完整的交接给收货人,并让收货人在物流单上签字并上传回单.</li>
+              <li>如果发生货物丢失以及其它原因损坏需按价赔偿给客户.</li>
+            </ol>
+          </div>
+        </div>
+        <div style="display: flex;align-items: center;justify-content:space-between;padding: 5px;">
+          <div>东莞市箭冠汽车配件制造有限公司</div>
+          <div>中国.广东.东莞.茶山工业园</div>
+          <div>电话:0769-81860196</div>
+          <div>传真:0769-81860108</div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { jGPrint } from '@/libs/JGPrint.js'
+import { dealBigMoney } from '@/libs/tools.js'
+export default {
+  props: {
+    detail: {
+      type: Object,
+      default: function () {
+        return null
+      }
+    }
+  },
+  methods: {
+    dealBigMoney: dealBigMoney,
+    printDom () {
+      const html = document.getElementById('sendGood-print').innerHTML
+      jGPrint(html, 'preview')
+    }
+  }
+}
+</script>
+
+<style>
+</style>