lilei 2 년 전
부모
커밋
7445347f18

+ 9 - 2
src/api/data.js

@@ -156,7 +156,14 @@ export const printLogSave = (params) => {
     method: 'post'
   })
 }
-
+// 打印记录-批量新增
+export const printLogSaveBatch = (params) => {
+  return axios({
+    url: `/printLog/saveBatch`,
+    data: params,
+    method: 'post'
+  })
+}
 // 下载模板文件
 export const downLoadTemp = (params) => {
   return axios({
@@ -164,4 +171,4 @@ export const downLoadTemp = (params) => {
     method: 'get',
     responseType: 'blob'
   })
-}
+}

+ 29 - 2
src/api/financeBook.js

@@ -163,7 +163,7 @@ export const financeBookDetailDelete = (params) => {
   })
 }
 
-//修改开票日期
+// 修改开票日期
 export const updateDetailInvoiceDate = (params) => {
   const url = `/financeBook/detail/updateDetailInvoiceDate`
   return axios({
@@ -173,7 +173,7 @@ export const updateDetailInvoiceDate = (params) => {
   })
 }
 
-//修改备注信息
+// 修改备注信息
 export const updateFinanceBookDetail = (params) => {
   const url = `/financeBook/detail/update`
   return axios({
@@ -183,3 +183,30 @@ export const updateFinanceBookDetail = (params) => {
   })
 }
 
+// 保存关联业务
+export const saveSettleReceiptFinanceBook = (params) => {
+  const url = `/financeBook/saveSettleReceiptFinanceBook`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 查询关联业务列表
+export const querySettleReceiptFinanceBookList = (params) => {
+  const url = `/financeBook/querySettleReceiptFinanceBookList/${params.bookSn}`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 删除关联业务
+export const deleteSettleReceiptFinanceBook = (params) => {
+  const url = `/financeBook/deleteSettleReceiptFinanceBook/${params.id}`
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 150 - 141
src/libs/JGPrint.js

@@ -1,7 +1,7 @@
 import confirm from 'ant-design-vue/es/modal/confirm'
 import notification from 'ant-design-vue/es/notification'
 import { getLodop } from '@/libs/LodopFuncs'
-import { printLogSave } from '@/api/data'
+import { printLogSave, printLogSaveBatch } from '@/api/data'
 import moment from 'moment'
 // 打印页签,支持批量打印
 export const JGPrintTag = function (html, width, height, data) {
@@ -14,29 +14,29 @@ export const JGPrintTag = function (html, width, height, data) {
       okType: 'danger',
       cancelText: '暂不打印',
       onOk () {
-        var agent = navigator.userAgent.toLowerCase();
-        if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
-            window.open('http://www.lodop.net/demolist/CLodop_Setup_for_Win32NT.zip')
-        }else if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
-            window.open('http://www.lodop.net/download/CLodop_Setup_for_Win64NT_4.155EN.zip')
+        var agent = navigator.userAgent.toLowerCase()
+        if (agent.indexOf('win32') >= 0 || agent.indexOf('wow32') >= 0) {
+          window.open('http://www.lodop.net/demolist/CLodop_Setup_for_Win32NT.zip')
+        } else if (agent.indexOf('win64') >= 0 || agent.indexOf('wow64') >= 0) {
+          window.open('http://www.lodop.net/download/CLodop_Setup_for_Win64NT_4.155EN.zip')
         }
       }
     })
     return
   }
-  LODOP.PRINT_INIT("")
+  LODOP.PRINT_INIT('')
   LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
   LODOP.SET_PRINT_MODE('POS_BASEON_PAPER', true) // 可使输出以纸张边缘为基点
   LODOP.ADD_PRINT_HTML(0, 0, '100%', '100%', html)
-  LODOP.ADD_PRINT_BARCODE('36%','65%',90,90,"QRCode",data.qrCodeContent)
-  LODOP.SET_PRINT_STYLEA(0,"QRCodeVersion",5)
+  LODOP.ADD_PRINT_BARCODE('36%', '65%', 90, 90, 'QRCode', data.qrCodeContent)
+  LODOP.SET_PRINT_STYLEA(0, 'QRCodeVersion', 5)
   // LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel",'H')
   LODOP.SET_PRINT_COPIES(data.printQty)// 指定份数
   LODOP.SET_PRINT_PAGESIZE(1, width, height)
   LODOP.PRINT()
 }
 // 导出文件
-export const exportExcel = function(url,params,fileName,callback,noShowTime){
+export const exportExcel = function (url, params, fileName, callback, noShowTime) {
   url(params).then(res => {
     if (res.type == 'application/json') {
       var reader = new FileReader()
@@ -49,7 +49,7 @@ export const exportExcel = function(url,params,fileName,callback,noShowTime){
       })
       reader.readAsText(res)
     } else {
-       downloadExcel(res,fileName,noShowTime)
+      downloadExcel(res, fileName, noShowTime)
     }
     callback()
   })
@@ -76,7 +76,7 @@ export const downloadExcel = function (data, fileName, noShowTime) {
 }
 
 // pdf blob 转 base64
-export const blobToBaseByPdf = function(data,callback){
+export const blobToBaseByPdf = function (data, callback) {
   const reader = new FileReader()
   reader.readAsDataURL(new Blob([data], { type: 'application/pdf' }))
   reader.addEventListener('load', () => {
@@ -85,75 +85,75 @@ export const blobToBaseByPdf = function(data,callback){
 }
 
 // 打印html
-export const jGPrint = function (data, type, callback, printLogParams,printPageSize) {
-    if (!data) {
-      return
-    }
-    const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
-    if (!LODOP) {
-      confirm({
-        title: '提示?',
-        content: h => <div>打印控件未安装,请先下载并安装。安装完成后,刷新页面即可打印。</div>,
-        okText: '立即下载',
-        okType: 'danger',
-        cancelText: '暂不打印',
-        onOk () {
-          var agent = navigator.userAgent.toLowerCase();
-          if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
-              window.open('http://www.lodop.net/demolist/CLodop_Setup_for_Win32NT.zip')
-          }else if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
-              window.open('http://www.lodop.net/download/CLodop_Setup_for_Win64NT_4.155EN.zip')
-          }
+export const jGPrint = function (data, type, callback, printLogParams, printPageSize) {
+  if (!data) {
+    return
+  }
+  const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
+  if (!LODOP) {
+    confirm({
+      title: '提示?',
+      content: h => <div>打印控件未安装,请先下载并安装。安装完成后,刷新页面即可打印。</div>,
+      okText: '立即下载',
+      okType: 'danger',
+      cancelText: '暂不打印',
+      onOk () {
+        var agent = navigator.userAgent.toLowerCase()
+        if (agent.indexOf('win32') >= 0 || agent.indexOf('wow32') >= 0) {
+          window.open('http://www.lodop.net/demolist/CLodop_Setup_for_Win32NT.zip')
+        } else if (agent.indexOf('win64') >= 0 || agent.indexOf('wow64') >= 0) {
+          window.open('http://www.lodop.net/download/CLodop_Setup_for_Win64NT_4.155EN.zip')
         }
-      })
-      return
-    }
-    LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
-    //执行该语句之后,PRINT指令不再返回那个所谓“打印成功”,才能获取到打印状态
-    LODOP.SET_PRINT_MODE("CATCH_PRINT_STATUS",true);
-    //TaskID:任务id,Value:job代码
-    LODOP.On_Return=function(TaskID,Value){
-       console.log(TaskID,Value)
-       // 已打印
-       if(Value&&printLogParams){
-         console.log('已打印,统计打印次数')
-         printLog(printLogParams,callback)
-       }else{
-         callback()
-       }
-    };
-    if(printPageSize){
-      LODOP.ADD_PRINT_HTM(0,0,'100%','99%',data);
-      LODOP.SET_PRINT_PAGESIZE(3,'210mm',100,"")
-    }else{
-      LODOP.ADD_PRINT_HTM('1cm',0,'100%','99%',data);
-      LODOP.SET_SHOW_MODE("BKIMG_PRINT",0);
-    }
-    if (type == 'preview') { //  预览
-      LODOP.PREVIEW()
-    } else if (type == 'print') { //  打印
-      LODOP.PRINTA()
+      }
+    })
+    return
+  }
+  LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
+  // 执行该语句之后,PRINT指令不再返回那个所谓“打印成功”,才能获取到打印状态
+  LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
+  // TaskID:任务id,Value:job代码
+  LODOP.On_Return = function (TaskID, Value) {
+    console.log(TaskID, Value)
+    // 已打印
+    if (Value && printLogParams) {
+      console.log('已打印,统计打印次数')
+      printLog(printLogParams, callback)
+    } else {
+      callback()
     }
+  }
+  if (printPageSize) {
+    LODOP.ADD_PRINT_HTM(0, 0, '100%', '99%', data)
+    LODOP.SET_PRINT_PAGESIZE(3, '210mm', 100, '')
+  } else {
+    LODOP.ADD_PRINT_HTM('1cm', 0, '100%', '99%', data)
+    LODOP.SET_SHOW_MODE('BKIMG_PRINT', 0)
+  }
+  if (type == 'preview') { //  预览
+    LODOP.PREVIEW()
+  } else if (type == 'print') { //  打印
+    LODOP.PRINTA()
+  }
 }
 // 浏览器打印pdf功能
-export const winPrintPdf = function(data,type,callback){
+export const winPrintPdf = function (data, type, callback) {
   if (!data) {
     return
   }
   const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
   document.getElementById('print').innerHTML = '<iframe id="printfbod" name="printfbod" src="' + url + '" hidden></iframe>'
-  window.frames['printfbod'].onload = function(){
+  window.frames['printfbod'].onload = function () {
     callback()
   }
-  if(type == 'orginPrint'){
+  if (type == 'orginPrint') {
     window.frames['printfbod'].focus()
     window.frames['printfbod'].print()
-  }else{
+  } else {
     window.open(url)
   }
 }
 // 打印
-export const printFun = function(url,params,type,taskName,callback,printLogParams,hidePrint){
+export const printFun = function (url, params, type, taskName, callback, printLogParams, hidePrint) {
   url(params).then(res => {
     if (res.type == 'application/json') {
       var reader = new FileReader()
@@ -166,95 +166,104 @@ export const printFun = function(url,params,type,taskName,callback,printLogParam
       })
       reader.readAsText(res)
     } else {
-       console.log(res,'printFun')
-       // 使用浏览器自带打印功能
-       if(type == 'orginPrint'||type=='orginPreview'){
-         winPrintPdf(res,type,callback)
-       }else{
-         jGPrintPdf(res,type,taskName,printLogParams,callback,hidePrint)
-       }
+      console.log(res, 'printFun')
+      // 使用浏览器自带打印功能
+      if (type == 'orginPrint' || type == 'orginPreview') {
+        winPrintPdf(res, type, callback)
+      } else {
+        jGPrintPdf(res, type, taskName, printLogParams, callback, hidePrint)
+      }
     }
   })
 }
 // 获取系统信息
-export const getSystemInfo = function (strINFOType,callback){
-     LODOP=getLodop(); 
-     if (LODOP.CVERSION) CLODOP.On_Return=function(TaskID,Value){callback(Value)}; 
-     var strResult=LODOP.GET_SYSTEM_INFO(strINFOType);
-     if (!LODOP.CVERSION) return strResult; else return "";
- }
+export const getSystemInfo = function (strINFOType, callback) {
+  LODOP = getLodop()
+  if (LODOP.CVERSION) CLODOP.On_Return = function (TaskID, Value) { callback(Value) }
+  var strResult = LODOP.GET_SYSTEM_INFO(strINFOType)
+  if (!LODOP.CVERSION) return strResult; else return ''
+}
 // 打印记录保存
-export const printLog = function(data,callback){
-  getSystemInfo('NetworkAdapter.1.IPAddress',function(ret){
-    data.printIp =  ret
-    printLogSave(data).then(res => {
-      callback(res)
-    })
+export const printLog = function (data, callback) {
+  getSystemInfo('NetworkAdapter.1.IPAddress', function (ret) {
+    // 批量处理
+    if (data instanceof Array) {
+      data.map(item => { item.printIp = ret })
+      printLogSaveBatch(data).then(res => {
+        callback(res)
+      })
+    } else {
+      // 单条处理
+      data.printIp = ret
+      printLogSave(data).then(res => {
+        callback(res)
+      })
+    }
   })
 }
 // 打印pdf
-export const jGPrintPdf = function (data, type, taskName, printLogParams,callback,hidePrint) {
-    if (!data) {
-      return
-    }
-    const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
-    if (!LODOP) {
-      confirm({
-        title: '提示?',
-        content: h => <div>打印控件未安装,请先下载并安装。安装完成后,刷新页面即可打印。</div>,
-        okText: '立即下载',
-        okType: 'danger',
-        cancelText: '暂不打印',
-        onOk () {
-          var agent = navigator.userAgent.toLowerCase();
-          if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) {
-              window.open('http://www.lodop.net/demolist/CLodop_Setup_for_Win32NT.zip')
-          }else if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) {
-              window.open('http://www.lodop.net/download/CLodop_Setup_for_Win64NT_4.155EN.zip')
-          }
+export const jGPrintPdf = function (data, type, taskName, printLogParams, callback, hidePrint) {
+  if (!data) {
+    return
+  }
+  const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
+  if (!LODOP) {
+    confirm({
+      title: '提示?',
+      content: h => <div>打印控件未安装,请先下载并安装。安装完成后,刷新页面即可打印。</div>,
+      okText: '立即下载',
+      okType: 'danger',
+      cancelText: '暂不打印',
+      onOk () {
+        var agent = navigator.userAgent.toLowerCase()
+        if (agent.indexOf('win32') >= 0 || agent.indexOf('wow32') >= 0) {
+          window.open('http://www.lodop.net/demolist/CLodop_Setup_for_Win32NT.zip')
+        } else if (agent.indexOf('win64') >= 0 || agent.indexOf('wow64') >= 0) {
+          window.open('http://www.lodop.net/download/CLodop_Setup_for_Win64NT_4.155EN.zip')
         }
-      })
-      return
-    }
-    blobToBaseByPdf(data, function (dataurl) {
-      // console.log(dataurl)
-      LODOP.PRINT_INIT(taskName)
-      LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
-      //执行该语句之后,PRINT指令不再返回那个所谓“打印成功”,才能获取到打印状态
-      LODOP.SET_PRINT_MODE("CATCH_PRINT_STATUS",true);
-      // 隐藏打印按钮
-      if(hidePrint){
-        LODOP.SET_SHOW_MODE("HIDE_PBUTTIN_PREVIEW",true);
-      }
-      //TaskID:任务id,Value:job代码
-      LODOP.On_Return=function(TaskID,Value){
-         console.log(TaskID,Value)
-         // 已打印
-         if(Value&&printLogParams){
-           console.log('已打印,统计打印次数')
-           printLog(printLogParams,callback)
-         }else{
-           callback()
-         }
-      };
-      LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', dataurl.replace('data:application/pdf;base64,', ''))
-      LODOP.SET_PRINT_PAGESIZE(3,2090,30,"");
-      if (type == 'preview') { //  预览
-        LODOP.PREVIEW()
-      } else if (type == 'print') { //  打印
-        LODOP.PRINTA()
       }
     })
+    return
+  }
+  blobToBaseByPdf(data, function (dataurl) {
+    // console.log(dataurl)
+    LODOP.PRINT_INIT(taskName)
+    LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', 1) //  隐藏底图上有模拟走纸板的条纹线
+    // 执行该语句之后,PRINT指令不再返回那个所谓“打印成功”,才能获取到打印状态
+    LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
+    // 隐藏打印按钮
+    if (hidePrint) {
+      LODOP.SET_SHOW_MODE('HIDE_PBUTTIN_PREVIEW', true)
+    }
+    // TaskID:任务id,Value:job代码
+    LODOP.On_Return = function (TaskID, Value) {
+      console.log(TaskID, Value)
+      // 已打印
+      if (Value && printLogParams) {
+        console.log('已打印,统计打印次数')
+        printLog(printLogParams, callback)
+      } else {
+        callback()
+      }
+    }
+    LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', dataurl.replace('data:application/pdf;base64,', ''))
+    LODOP.SET_PRINT_PAGESIZE(3, 2090, 30, '')
+    if (type == 'preview') { //  预览
+      LODOP.PREVIEW()
+    } else if (type == 'print') { //  打印
+      LODOP.PRINTA()
+    }
+  })
 }
 
 // 获取打印机状态
-export const getStatusValue = function (ValueType,ValueIndex,callback){
-		const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
-		if (LODOP.CVERSION) {
-      LODOP.On_Return=function(TaskID,Value){
-        callback(Value)
-      };
+export const getStatusValue = function (ValueType, ValueIndex, callback) {
+  const LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'))
+  if (LODOP.CVERSION) {
+    LODOP.On_Return = function (TaskID, Value) {
+      callback(Value)
     }
-		var strResult=LODOP.GET_VALUE(ValueType,ValueIndex);
-		if (!LODOP.CVERSION) return callback(strResult); else return callback('');
-	}
+  }
+  var strResult = LODOP.GET_VALUE(ValueType, ValueIndex)
+  if (!LODOP.CVERSION) return callback(strResult); else return callback('')
+}

+ 158 - 2
src/views/financialManagement/financialCollection/edit.vue

@@ -99,6 +99,43 @@
           </template>
         </s-table>
       </a-card>
+      <!-- 关联单据 -->
+      <a-card :bordered="false" size="small" class="financialCollectionAddcont" v-if="$route.params.sn">
+        <div slot="title">
+          <div style="display: flex;justify-content: space-between;align-items: center;">
+            <div>关联单据</div>
+            <div>
+              <a-button size="small" class="button-info" type="primary" @click="showGlSalseModal=true">选择销售单</a-button>
+              <a-button size="small" class="button-info" type="primary" @click="showGlAllocaModal=true">选择调拨单</a-button>
+            </div>
+          </div>
+        </div>
+        <a-alert type="info" style="margin-bottom:10px" v-if="detailGlData">
+          <div slot="message">
+            共 {{ detailGlData.total }} 条,
+            总售价:¥{{ detailGlData.totalAmount }}
+          </div>
+        </a-alert>
+        <!-- 列表 -->
+        <s-table
+          class="sTable fixPagination"
+          ref="gltable"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="glcolumns"
+          :data="glloadData"
+          :showPagination="false"
+          bordered>
+          <template slot="action" slot-scope="text,record">
+            <a-button
+              size="small"
+              type="link"
+              class="button-error"
+              @click="handleGlDel(record)"
+            >删除</a-button>
+          </template>
+        </s-table>
+      </a-card>
     </a-spin>
     <div class="affix-cont">
       <a-button
@@ -127,6 +164,25 @@
       @cancel="openFcDetailModal=false"></fcDetailModal>
     <!-- 选择审核人员 -->
     <chooseDepartUserModal :openModal="openDepartUserModal" @close="openDepartUserModal=false" @submit="handleSubmit"></chooseDepartUserModal>
+    <!-- 关联单据 -->
+    <selectGlSalesModal
+      ref="selGlSalesModal"
+      modalTit="选择销售单"
+      :loading="spinning"
+      :dealerSn="detailData&&detailData.dealerSn"
+      :chooseData="glList"
+      :openModal="showGlSalseModal"
+      @choose="addGlOrder"
+      @cancel="showGlSalseModal=false"></selectGlSalesModal>
+    <selectGlAllocatModal
+      ref="selGlAllocatModal"
+      modalTit="选择调拨单"
+      :loading="spinning"
+      :dealerSn="detailData&&detailData.dealerSn"
+      :chooseData="glList"
+      :openModal="showGlAllocaModal"
+      @choose="addGlOrder"
+      @cancel="showGlAllocaModal=false"></selectGlAllocatModal>
   </div>
 </template>
 
@@ -135,12 +191,14 @@ import { commonMixin } from '@/utils/mixin'
 import { VSelect, STable } from '@/components'
 import baseModal from './baseModal.vue'
 import fcDetailModal from './fcDetailModal.vue'
+import selectGlSalesModal from './selectGlSalesModal'
+import selectGlAllocatModal from './selectGlAllocatModal'
 import chooseDepartUserModal from '../../expenseManagement/expenseReimbursement/chooseDepartUserModal.vue'
-import { financeBookFindBySn, financeBookDetailDelete, financeBookDetailQueryList, financeBookSubmit } from '@/api/financeBook.js'
+import { financeBookFindBySn, financeBookDetailDelete, financeBookDetailQueryList, financeBookSubmit, querySettleReceiptFinanceBookList, deleteSettleReceiptFinanceBook, saveSettleReceiptFinanceBook } from '@/api/financeBook.js'
 export default {
   name: 'FinancialCollectionEdit',
   mixins: [commonMixin],
-  components: { VSelect, STable, baseModal, fcDetailModal, chooseDepartUserModal },
+  components: { VSelect, STable, baseModal, fcDetailModal, chooseDepartUserModal, selectGlSalesModal, selectGlAllocatModal },
   data () {
     return {
       spinning: false,
@@ -151,6 +209,8 @@ export default {
       total: 0,
       loadData: parameter => {
         const params = Object.assign(parameter, { bookSn: this.$route.params.sn })
+        this.disabled = true
+        this.spinning = true
         return financeBookDetailQueryList(params).then(res => {
           let data
           if (res.status == 200) {
@@ -195,10 +255,106 @@ export default {
       payCol: [
         { title: '授信还款项目', dataIndex: 'itemName', width: '50%', align: 'center' },
         { title: '授信还款金额', dataIndex: 'itemAmount', width: '50%', align: 'center' }
+      ],
+      // 关联单据
+      detailGlData: {
+        total: 0,
+        totalAmount: 0
+      },
+      glList: [],
+      showGlSalseModal: false,
+      showGlAllocaModal: false,
+      glloadData: parameter => {
+        const params = Object.assign(parameter, { bookSn: this.$route.params.sn })
+        return querySettleReceiptFinanceBookList(params).then(res => {
+          console.log(res)
+          let data
+          let totalAmount = 0
+          if (res.status == 200) {
+            data = res.data
+            this.glList = data
+            for (var i = 0; i < data.length; i++) {
+              data[i].no = i + 1
+              const cons = data[i].bizType == 'DISPATCH' ? {
+                buyerName: data[i].dispatchBill.buyerName,
+                sendNo: data[i].dispatchBill.sendNo,
+                totalCategory: data[i].dispatchBill.totalCategory,
+                totalQty: data[i].dispatchBill.totalQty,
+                totalAmount: data[i].dispatchBill.totalAmount,
+                billStatusDictValue: data[i].dispatchBill.billStatusDictValue,
+                financialStatusDictValue: data[i].dispatchBill.financialStatusDictValue,
+                dispatchBillSn: data[i].dispatchBill.dispatchBillSn,
+                salesBillSn: data[i].dispatchBill.salesBillSn
+              } : {
+                buyerName: data[i].allocateBill.buyerName,
+                receiverName: data[i].allocateBill.receiverName,
+                sendNo: data[i].allocateBill.sendNo,
+                totalCategory: data[i].allocateBill.totalCategory,
+                totalQty: data[i].allocateBill.totalQty,
+                totalAmount: data[i].allocateBill.totalPrice,
+                billStatusDictValue: data[i].allocateBill.stateDictValue,
+                allocateNo: data[i].allocateBill.allocateNo,
+                allocateSn: data[i].allocateBill.allocateSn
+              }
+              data[i] = Object.assign(data[i], cons)
+              totalAmount = totalAmount + Number(data[i].totalAmount)
+            }
+            this.detailGlData.total = data.length
+            this.detailGlData.totalAmount = totalAmount
+          }
+          return data
+        })
+      },
+      glcolumns: [
+        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
+        { title: '单据类型', dataIndex: 'bizTypeDictValue', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
+        { title: '单据创建时间', dataIndex: 'createDate', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '单据号', dataIndex: 'bizNo', align: 'center', width: '10%', customRender: function (text) { return text || '--' } },
+        { title: '客户名称', dataIndex: 'buyerName', align: 'center', width: '13%', customRender: function (text) { return text || '--' } },
+        { title: '收货客户名称', dataIndex: 'receiverName', align: 'center', width: '13%', customRender: function (text) { return text || '--' } },
+        { title: '发货编号', dataIndex: 'sendNo', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
+        { title: '产品款数', dataIndex: 'totalCategory', align: 'center', width: '6%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
+        { title: '产品数量', dataIndex: 'totalQty', align: 'center', width: '6%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
+        { title: '总售价', dataIndex: 'totalAmount', align: 'center', width: '6%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
+        { title: '业务状态', dataIndex: 'billStatusDictValue', align: 'center', width: '6%', customRender: function (text) { return text || '--' } },
+        { title: '财务状态', dataIndex: 'financialStatusDictValue', align: 'center', width: '6%', customRender: function (text) { return (text == 0 || text) ? text : '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
       ]
     }
   },
   methods: {
+    // 新增关联单据
+    addGlOrder (data) {
+      this.spinning = true
+      saveSettleReceiptFinanceBook({
+        bookSn: this.detailData.bookSn,
+        bookNo: this.detailData.bookNo,
+        ...data
+      }).then(res => {
+        if (res.status == 200) {
+          this.$refs.gltable.refresh()
+        } else {
+          if (data.bizType == 'DISPATCH') {
+            this.$refs.selGlSalesModal.handleDel(data)
+          } else {
+            this.$refs.selGlAllocatModal.handleDel(data)
+          }
+        }
+        this.spinning = false
+      })
+    },
+    // 删除关联单据
+    handleGlDel (row) {
+      this.spinning = true
+      deleteSettleReceiptFinanceBook({ id: row.id }).then(res => {
+        if (res.status == 200) {
+          this.$refs.gltable.refresh()
+          this.$message.info(res.message)
+        }
+        this.spinning = false
+      })
+    },
+    // ---------------
     getTotal (data) {
       let ret = 0
       data.map(item => {

+ 243 - 0
src/views/financialManagement/financialCollection/selectGlAllocatModal.vue

@@ -0,0 +1,243 @@
+<template>
+  <a-modal
+    centered
+    class="collection-detail-modal"
+    :footer="null"
+    :maskClosable="false"
+    v-model="isShow"
+    :title="modalTit"
+    :bodyStyle="{padding: modalTit?'25px 32px 20px':'50px 32px 15px'}"
+    @cancel="isShow=false"
+    width="90%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="common-main">
+        <!-- 搜索条件 -->
+        <div ref="tableSearch" class="table-page-search-wrapper">
+          <a-form layout="inline">
+            <a-row :gutter="15">
+              <a-col :md="4" :sm="24">
+                <a-form-item label="调拨单号">
+                  <a-input id="allocateBillList-allocateNo" v-model.trim="queryParam.allocateNo" allowClear placeholder="请输入调拨单号"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                  <dealerSubareaScopeList ref="dealerSubareaScopeList" id="pushOrder-buyerName" @change="custChange" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="收货客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                  <dealerSubareaScopeList ref="shbuyerName" id="pushOrder-shbuyerName" @change="shcustChange" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="4" :sm="24">
+                <span class="table-page-search-submitButtons">
+                  <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
+                  <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
+                </span>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <!-- 表格数据 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :scroll="{ y: 400 }"
+          :pageSize="10"
+          bordered>
+          <!-- 销售单号 -->
+          <template slot="allocateNo" slot-scope="text, record">
+            <span v-if="$hasPermissions('M_transferOut_detail')" class="link-bule" @click="handleDetail(record)">{{ record.allocateNo }}</span>
+            <span v-else>{{ record.allocateNo }}</span>
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <div v-if="record.state=='WAIT_OUT_WAREHOUSE'||record.state=='FINISH'">
+              <a-button
+                size="small"
+                type="link"
+                class="button-warning"
+                v-if="!record.checked"
+                @click="handleChoose(record)"
+              >选择</a-button>
+              <span style="color:#55aa00;" v-else>已选</span>
+            </div>
+            <span style="color:#55aa00;" v-else>
+              {{ record.checked?'已选':'--' }}
+            </span>
+          </template>
+        </s-table>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import { allocateBillList } from '@/api/allocateBill'
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+export default {
+  name: 'SelectGlAllocatModal',
+  components: { STable, VSelect, dealerSubareaScopeList },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    modalTit: { // 弹框标题
+      type: String,
+      default: null
+    },
+    chooseData: {
+      type: Array,
+      default: function () {
+        return []
+      }
+    },
+    loading: {
+      type: Boolean,
+      default: false
+    },
+    dealerSn: {
+      type: String,
+      default: null
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      disabled: false,
+      spinning: false,
+      handlePlData: [],
+      queryParam: {
+        buyerSn: undefined, //  客户名称
+        receiverSn: undefined, // 收货客户
+        allocateNo: '' //  调拨单号
+      },
+      orginData: [],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return allocateBillList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+              const index = this.chooseData.findIndex(item => (data.list[i].allocateSn == item.allocateSn))
+              data.list[i].checked = index >= 0
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          this.orginData = data.list
+          return data
+        })
+      },
+      snList: []
+    }
+  },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '6%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '调拨单号', scopedSlots: { customRender: 'allocateNo' }, width: '13%', align: 'center' },
+        { title: '客户名称', dataIndex: 'buyerName', width: '13%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '收货客户名称', dataIndex: 'receiverName', width: '13%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '发货编号', dataIndex: 'sendNo', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '产品款数', dataIndex: 'totalCategory', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '产品数量', dataIndex: 'totalQty', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '业务状态', dataIndex: 'stateDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
+      ]
+      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
+        arr.splice(8, 0, { title: '总售价', dataIndex: 'totalPrice', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      }
+      return arr
+    }
+  },
+  methods: {
+    custChange (val) {
+      this.queryParam.buyerSn = val.key
+    },
+    shcustChange (val) {
+      this.queryParam.receiverSn = val.key
+    },
+    // 删除
+    handleDel (row) {
+      const oi = this.orginData.findIndex(item => row.bizSn == item.allocateSn)
+      if (oi >= 0) {
+        this.orginData[oi].checked = false
+      }
+    },
+    // 选择
+    handleChoose (row) {
+      row.checked = true
+      this.$emit('choose', {
+        bizType: 'ALLOCATE',
+        bizSn: row.allocateSn,
+        bizNo: row.allocateNo
+      })
+    },
+    // 取消
+    handleCommonCancel () {
+      this.$emit('cancel')
+    },
+    // 重置
+    resetSearchForm (flag) {
+      this.queryParam = {
+        buyerSn: undefined, //  客户名称
+        receiverSn: undefined, // 收货客户
+        allocateNo: '' //  调拨单号
+      }
+      this.orginData = []
+      this.$nextTick(() => {
+        this.$refs.dealerSubareaScopeList.resetForm()
+        this.$refs.shbuyerName.resetForm()
+      })
+      if (this.$refs.table && !flag) {
+        this.$refs.table.refresh(true)
+      }
+    }
+  },
+  watch: {
+    loading (newValue, oldValue) {
+      this.spinning = newValue
+    },
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.handleCommonCancel()
+      } else {
+        if (this.dealerSn) {
+          this.resetSearchForm(1)
+          // 回显客户
+          this.queryParam.buyerSn = this.dealerSn
+          this.$nextTick(() => {
+            this.$refs.dealerSubareaScopeList.getDetail(this.dealerSn)
+            this.$refs.table.refresh(true)
+          })
+        } else {
+          this.resetSearchForm()
+        }
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+
+</style>

+ 258 - 0
src/views/financialManagement/financialCollection/selectGlSalesModal.vue

@@ -0,0 +1,258 @@
+<template>
+  <a-modal
+    centered
+    class="collection-detail-modal"
+    :footer="null"
+    :maskClosable="false"
+    v-model="isShow"
+    :title="modalTit"
+    :bodyStyle="{padding: modalTit?'25px 32px 20px':'50px 32px 15px'}"
+    @cancel="isShow=false"
+    width="90%">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div class="common-main">
+        <!-- 搜索条件 -->
+        <div ref="tableSearch" class="table-page-search-wrapper">
+          <a-form layout="inline">
+            <a-row :gutter="15">
+              <a-col :md="4" :sm="24">
+                <a-form-item label="销售单号">
+                  <a-input id="pushOrder-salesBillNo" v-model.trim="queryParam.salesBillNo" allowClear placeholder="请输入销售单号"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="4" :sm="24">
+                <a-form-item label="备货单号">
+                  <a-input id="pushOrder-dispatchBillNo" v-model.trim="queryParam.dispatchBillNo" allowClear placeholder="请输入备货单号"/>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                  <dealerSubareaScopeList ref="dealerSubareaScopeList" id="pushOrder-buyerName" @change="custChange" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="收货客户名称" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
+                  <dealerSubareaScopeList ref="shbuyerName" id="pushOrder-shbuyerName" @change="shcustChange" />
+                </a-form-item>
+              </a-col>
+              <a-col :md="4" :sm="24">
+                <span class="table-page-search-submitButtons">
+                  <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
+                  <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
+                </span>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
+        <!-- 表格数据 -->
+        <s-table
+          class="sTable"
+          ref="table"
+          size="small"
+          :rowKey="(record) => record.id"
+          :columns="columns"
+          :data="loadData"
+          :defaultLoadData="false"
+          :scroll="{ y: 400 }"
+          :pageSize="10"
+          bordered>
+          <!-- 销售单号 -->
+          <template slot="salesBillNo" slot-scope="text, record">
+            <span class="link-bule" v-if="$hasPermissions('B_salesDetail')" @click="handleDetail(record,0)">{{ record.salesBillNo }}</span>
+            <span v-else>{{ record.salesBillNo }}</span>
+          </template>
+          <!-- 备货单号 -->
+          <template slot="dispatchBillNo" slot-scope="text, record">
+            <span class="link-bule" v-if="$hasPermissions('B_dispatchDetail')" @click="handleDetail(record,1)">{{ record.dispatchBillNo }}</span>
+            <span v-else>{{ record.dispatchBillNo }}</span>
+          </template>
+          <!-- 操作 -->
+          <template slot="action" slot-scope="text, record">
+            <div v-if="record.financialStatus!='FINISH'&&record.billStatus!='STOCK_UP_REJECT'">
+              <a-button
+                size="small"
+                type="link"
+                class="button-warning"
+                v-if="!record.checked"
+                @click="handleChoose(record)"
+              >选择</a-button>
+              <span style="color:#55aa00;" v-else>已选</span>
+            </div>
+            <span style="color:#55aa00;" v-else>
+              {{ record.checked?'已选':'--' }}
+            </span>
+          </template>
+        </s-table>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import { dispatchlList } from '@/api/dispatch'
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
+export default {
+  name: 'SelectGlSalesModal',
+  components: { STable, VSelect, dealerSubareaScopeList },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    modalTit: { // 弹框标题
+      type: String,
+      default: null
+    },
+    chooseData: {
+      type: Array,
+      default: function () {
+        return []
+      }
+    },
+    loading: {
+      type: Boolean,
+      default: false
+    },
+    dealerSn: {
+      type: String,
+      default: null
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      disabled: false,
+      spinning: false,
+      handlePlData: [],
+      queryParam: {
+        buyerSn: undefined, //  客户名称
+        receiverSn: undefined, // 收货客户
+        salesBillNo: '', //  销售单号
+        dispatchBillNo: '' //  备货单号
+      },
+      orginData: [],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        this.spinning = true
+        return dispatchlList(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (var i = 0; i < data.list.length; i++) {
+              data.list[i].no = no + i + 1
+              const index = this.chooseData.findIndex(item => (data.list[i].dispatchBillSn == item.dispatchBillSn && data.list[i].salesBillSn == item.salesBillSn))
+              data.list[i].checked = index >= 0
+            }
+            this.disabled = false
+          }
+          this.spinning = false
+          this.orginData = data.list
+          return data
+        })
+      },
+      snList: []
+    }
+  },
+  computed: {
+    columns () {
+      const arr = [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '创建时间', dataIndex: 'createDate', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '销售单号', scopedSlots: { customRender: 'salesBillNo' }, width: '8%', align: 'center' },
+        { title: '备货单号', scopedSlots: { customRender: 'dispatchBillNo' }, width: '10%', align: 'center' },
+        { title: '客户名称', dataIndex: 'buyerName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '收货客户名称', dataIndex: 'receiverName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '发货编号', dataIndex: 'sendNo', width: '5%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '产品款数', dataIndex: 'totalCategory', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '产品数量', dataIndex: 'totalQty', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '业务状态', dataIndex: 'billStatusDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '财务状态', dataIndex: 'financialStatusDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '6%', align: 'center' }
+      ]
+      if (this.$hasPermissions('B_isShowPrice')) { //  售价权限
+        arr.splice(10, 0, { title: '总售价', dataIndex: 'totalAmount', width: '5%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } })
+      }
+      return arr
+    }
+  },
+  methods: {
+    custChange (val) {
+      this.queryParam.buyerSn = val.key
+    },
+    shcustChange (val) {
+      this.queryParam.receiverSn = val.key
+    },
+    // 删除
+    handleDel (row) {
+      const oi = this.orginData.findIndex(item => row.bizSn == item.dispatchBillSn)
+      if (oi >= 0) {
+        this.orginData[oi].checked = false
+      }
+    },
+    // 选择
+    handleChoose (row) {
+      row.checked = true
+      this.$emit('choose', {
+        bizType: 'DISPATCH',
+        bizSn: row.dispatchBillSn,
+        bizNo: row.dispatchBillNo
+      })
+    },
+    // 取消
+    handleCommonCancel () {
+      this.$emit('cancel')
+    },
+    // 重置
+    resetSearchForm (flag) {
+      this.queryParam = {
+        buyerSn: undefined, //  客户名称
+        receiverSn: undefined, // 收货客户
+        salesBillNo: '', //  销售单号
+        dispatchBillNo: '' //  备货单号
+      }
+      this.orginData = []
+      this.$nextTick(() => {
+        this.$refs.dealerSubareaScopeList.resetForm()
+        this.$refs.shbuyerName.resetForm()
+      })
+      if (this.$refs.table && !flag) {
+        this.$refs.table.refresh(true)
+      }
+    }
+  },
+  watch: {
+    loading (newValue, oldValue) {
+      this.spinning = newValue
+    },
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.handleCommonCancel()
+      } else {
+        if (this.dealerSn) {
+          this.resetSearchForm(1)
+          // 回显客户
+          this.queryParam.buyerSn = this.dealerSn
+          this.$nextTick(() => {
+            this.$refs.dealerSubareaScopeList.getDetail(this.dealerSn)
+            this.$refs.table.refresh(true)
+          })
+        } else {
+          this.resetSearchForm()
+        }
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+
+</style>

+ 16 - 6
src/views/salesManagement/receiptPrint/list.vue

@@ -84,7 +84,7 @@
                 type="link"
                 v-if="(record.printStatus == 'NO_PRINT'||record.printStatus == 'PRINT')&&$hasPermissions('B_SkPrint')"
                 class="button-warning"
-                @click="handlePrint(record)"
+                @click="handlePrint(record,0,record)"
               >收款打印</a-button>
               <a-button
                 size="small"
@@ -238,19 +238,29 @@ export default {
       bookNos.map(item => {
         const rs = rows.filter(a => a.bookNo == item)
         let detailItemUseStr = ''
-        rs[0].detailItemUseList.map(k => {
-          detailItemUseStr = detailItemUseStr + k.itemName
+        rs.map(b => {
+          if (b.detailItemUseList) {
+            b.detailItemUseList.map(k => {
+              detailItemUseStr = detailItemUseStr + k.itemName + '(' + k.itemAmount + ');'
+            })
+          }
         })
         retArr.push({ detail: detailItemUseStr, subList: rs })
       })
       console.log(retArr, '------------')
-      this.handlePrint(retArr, 1)
+      this.handlePrint(retArr, 1, rows)
     },
     // 收款打印
-    handlePrint (row, type) {
+    handlePrint (row, type, list) {
       this.showTipModal = true
+      let detailItemUseStr = ''
       this.$nextTick(() => {
-        this.$refs.printModel.getData(type ? row : [[row]])
+        if (type == 0 && row.detailItemUseList) {
+          row.detailItemUseList.map(k => {
+            detailItemUseStr = detailItemUseStr + k.itemName + '(' + k.itemAmount + ');'
+          })
+        }
+        this.$refs.printModel.getData(type ? row : [{ detail: detailItemUseStr, subList: [row] }], type ? list : [list])
       })
     },
     printOk () {

+ 73 - 67
src/views/salesManagement/receiptPrint/printModel.vue

@@ -1,71 +1,69 @@
 <template>
   <!-- 发货打印 -->
   <div>
-    <a-spin :spinning="spinning" tip="Loading..." style="height: 60vh;overflow: auto;width: 100%;padding:20px 40px;">
-      <div id="sendGood-print" v-if="financeBookList&&financeBookList.length">
-        <table
-          v-for="(fcItem,index) in financeBookList"
-          :key="index+'-fcitem'"
-          ref="printBox"
-          cellspacing="0"
-          cellpadding="0"
-          style="border-collapse: collapse;width: 562pt;margin:0 auto;font-size:14px;">
-          <tr>
-            <td>
-              <div class="print-box" style="width: 562pt;margin:0 auto;">
-                <h1 style="text-align:center;margin:0.2cm 0">收款通知单</h1>
+    <div id="sendGood-print" v-if="financeBookList&&financeBookList.length">
+      <table
+        v-for="(fcItem,index) in financeBookList"
+        :key="index+'-fcitem'"
+        ref="printBox"
+        cellspacing="0"
+        cellpadding="0"
+        style="border-collapse: collapse;width: 562pt;margin:0 auto;font-size:14px;">
+        <tr>
+          <td>
+            <div class="print-box" style="width: 562pt;margin:0 auto;">
+              <h1 style="text-align:center;margin:0.2cm 0">收款通知单</h1>
+              <div>
                 <div>
-                  <div>
-                    <table border="1" style="width: 562pt;border-collapse: collapse;text-align: center;">
-                      <tr>
-                        <th style="line-height: 20pt;width: 50pt;background:#f6f6f6;">日期</th>
-                        <th style="line-height: 20pt;width: 82pt;background:#f6f6f6;">客户名称</th>
-                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">订单金额</th>
-                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">收款金额</th>
-                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">使用授信</th>
-                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">余款抵扣</th>
-                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">汇入银行</th>
-                        <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">足额打款</th>
-                        <th style="line-height: 20pt;width: 70pt;background:#f6f6f6;">说明</th>
-                      </tr>
-                      <tr v-for="item in fcItem.subList" :key="item.bookDetailSn">
-                        <td style="padding:3pt;width: 44pt;">{{ moment(item.receiptDate).format('M月D日') }}</td>
-                        <td style="padding:3pt;width: 76pt;text-align:left;">
-                          {{ item.payerName }}
-                          <div>
-                            {{ item.dealerEntity ? item.dealerEntity.kdMidCustomerFnumber : '' }}
-                          </div>
-                        </td>
-                        <td style="padding:3pt;width: 54pt;text-align:center;">
-                          {{ item.orderAmount?item.orderAmount.toFixed(2):'0.00' }}
-                        </td>
-                        <td style="padding:3pt;width: 54pt;text-align:center;">
-                          {{ item.receiptAmount?item.receiptAmount.toFixed(2):'0.00' }}
-                        </td>
-                        <td style="padding:3pt;width: 54pt;text-align:center;">
-                          {{ getTotal(item.detailItemUseList||[]) }}
-                        </td>
-                        <td style="padding:3pt;width: 54pt;text-align:center;">
-                          {{ item.balanceAmount?item.balanceAmount.toFixed(2):'0.00' }}
-                        </td>
-                        <td style="padding:3pt;width: 54pt;">
-                          {{ item.bankAccount }}<br>
-                          {{ item.bankName }}
-                        </td>
-                        <td style="padding:3pt;width: 54pt;">{{ item.fullPaymentFlagDictValue }}</td>
-                        <td style="padding:3pt;width: 84pt;word-break:break-all;">{{ item.remarks }}</td>
-                      </tr>
-                    </table>
-                    <div style="line-height: 30pt;border-bottom: 1px solid #666;">使用授信明细:{{ fcItem.detail }}</div>
-                    <div style="line-height: 30pt;">审批人员:</div>
-                  </div>
+                  <table border="1" style="width: 562pt;border-collapse: collapse;text-align: center;">
+                    <tr>
+                      <th style="line-height: 20pt;width: 50pt;background:#f6f6f6;">日期</th>
+                      <th style="line-height: 20pt;width: 82pt;background:#f6f6f6;">客户名称</th>
+                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">订单金额</th>
+                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">收款金额</th>
+                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">使用授信</th>
+                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">余款抵扣</th>
+                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">汇入银行</th>
+                      <th style="line-height: 20pt;width: 60pt;background:#f6f6f6;">足额打款</th>
+                      <th style="line-height: 20pt;width: 70pt;background:#f6f6f6;">说明</th>
+                    </tr>
+                    <tr v-for="item in fcItem.subList" :key="item.bookDetailSn">
+                      <td style="padding:3pt;width: 44pt;">{{ moment(item.receiptDate).format('M月D日') }}</td>
+                      <td style="padding:3pt;width: 76pt;text-align:left;">
+                        {{ item.payerName }}
+                        <div>
+                          {{ item.dealerEntity ? item.dealerEntity.kdMidCustomerFnumber : '' }}
+                        </div>
+                      </td>
+                      <td style="padding:3pt;width: 54pt;text-align:center;">
+                        {{ item.orderAmount?item.orderAmount.toFixed(2):'0.00' }}
+                      </td>
+                      <td style="padding:3pt;width: 54pt;text-align:center;">
+                        {{ item.receiptAmount?item.receiptAmount.toFixed(2):'0.00' }}
+                      </td>
+                      <td style="padding:3pt;width: 54pt;text-align:center;">
+                        {{ getTotal(item.detailItemUseList||[]) }}
+                      </td>
+                      <td style="padding:3pt;width: 54pt;text-align:center;">
+                        {{ item.balanceAmount?item.balanceAmount.toFixed(2):'0.00' }}
+                      </td>
+                      <td style="padding:3pt;width: 54pt;">
+                        {{ item.bankAccount }}<br>
+                        {{ item.bankName }}
+                      </td>
+                      <td style="padding:3pt;width: 54pt;">{{ item.fullPaymentFlagDictValue }}</td>
+                      <td style="padding:3pt;width: 84pt;word-break:break-all;">{{ item.remarks }}</td>
+                    </tr>
+                  </table>
+                  <div style="line-height: 30pt;border-bottom: 1px solid #666;">使用授信明细:{{ fcItem.detail }}</div>
+                  <div style="line-height: 30pt;">审批人员:</div>
                 </div>
               </div>
-            </td>
-          </tr>
-        </table>
-      </div>
-    </a-spin>
+            </div>
+          </td>
+        </tr>
+      </table>
+    </div>
     <div class="btn-box" style="display:flex;align-item:center;justify-content: center;">
       <a-button @click="handleCommonCancel">取消</a-button>
       <a-button :loading="spinning" type="primary" @click="handleCommonOk">立即打印</a-button>
@@ -81,7 +79,8 @@ export default {
     return {
       spinning: false,
       detail: null,
-      financeBookList: []
+      financeBookList: [],
+      printNums: []
     }
   },
   methods: {
@@ -99,24 +98,31 @@ export default {
       const html = document.getElementById('sendGood-print').innerHTML
       _this.spinning = true
       // html, type, callback, printLogParams
-      jGPrint(html, 'print', function (res) {
+      jGPrint(html, 'preview', function (res) {
         _this.spinning = false
         _this.handleCommonCancel()
         _this.$emit('printOk')
       })
     },
-    getData (data, flag) {
+    getData (data, list) {
       console.log(data)
       this.financeBookList = data
+      list.map(item => {
+        this.printNums.push({
+          billType: 'FINANCE_BOOK_DETAIL',
+          billSn: item.bookDetailSn,
+          billNo: item.bookNo
+        })
+      })
     },
     handleCommonCancel () {
       this.$emit('cancel')
-      this.detail = null
-      this.financeBookList = []
+      this.clearData()
     },
     clearData () {
       this.detail = null
       this.financeBookList = []
+      this.printNums = []
     }
   }
 }