lilei 3 gadi atpakaļ
vecāks
revīzija
20c002da9f

+ 22 - 0
src/api/settle.js

@@ -91,3 +91,25 @@ export const settleInfoQuerySum = (params) => {
     method: 'post'
   })
 }
+
+//详情  打印
+export const settleDetailPrint = params => {
+  const data = {
+    url: `/settle/print/${params.sn}/${params.type}`,
+    method: 'get'
+  }
+  // 喷墨打印
+  if (params.type == 'INK') {
+    data.responseType = 'blob'
+  }
+  return axios.request(data)
+}
+
+// 详情  导出
+export const settleDetailExport = params => {
+  return axios.request({
+    url: `/settle/excel/${params.sn}`,
+    method: 'get',
+    responseType: 'blob'
+  })
+}

+ 30 - 13
src/views/financialManagement/companyReceivablePayable/collectionPayment.vue

@@ -7,6 +7,9 @@
           <a id="collectionPayment-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
           <p style=" display: inline-block;margin: 0 0 0 60px;color: #000;font-size: 16px;font-weight: 600;">客户:{{ $route.params.name || '--' }}</p>
         </template>
+        <template slot="extra">
+          <Print :disabled="chooseLoadData.length==0" @handlePrint="handlePrint"></Print>
+        </template>
       </a-page-header>
       <!-- 已选单据 -->
       <a-card size="small" :bordered="false" class="collectionPayment-cont">
@@ -76,12 +79,11 @@
                 <a-col span="12">
                   <a-form-model-item prop="amountSettled">
                     <template slot="label">
-                      结算金额(<span :class="isPositive ? 'green':'red'">{{ isPositive ? '收款' : '付款' }}</span>)
+                      本次结算金额(<span :class="isPositive ? 'green':'red'">{{ isPositive ? '收款' : '付款' }}</span>)
                     </template>
                     <a-input-number
                       id="collectionPayment-amountSettled"
-                      v-model="amountSettled"
-                      disabled
+                      v-model="form.amountSettled"
                       :precision="2"
                       placeholder=""
                       style="width: 100%;" />
@@ -103,7 +105,7 @@
                 <a-col span="12">
                   <a-form-model-item prop="actualSettlementAmount">
                     <template slot="label">
-                      实结算金额(<span :class="isPositive ? 'green':'red'">{{ isPositive ? '收款' : '付款' }}</span>)
+                      本次结算金额(<span :class="isPositive ? 'green':'red'">{{ isPositive ? '收款' : '付款' }}</span>)
                     </template>
                     <a-input-number
                       id="collectionPayment-actualSettlementAmount"
@@ -151,10 +153,12 @@ import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import chooseBillModal from './chooseBillModal.vue'
 import { settleStyleQueryAll } from '@/api/settleStyle'
-import { settleUnitSave } from '@/api/settle'
+import { settleUnitSave, settleDetailPrint, settleDetailExport } from '@/api/settle'
+import Print from '@/views/common/print.vue'
+import { hdPrint } from '@/libs/JGPrint'
 export default {
   name: 'CollectionPaymentDetail',
-  components: { STable, VSelect, chooseBillModal },
+  components: { STable, VSelect, chooseBillModal, Print },
   mixins: [commonMixin],
   data () {
     return {
@@ -182,11 +186,13 @@ export default {
         wrapperCol: { span: 16 }
       },
       form: {
+        amountSettled: 0,
         discountAmount: 0, //  折让金额
         settleStyleSn: undefined,
         remark: ''
       },
       rules: {
+        amountSettled: [{ required: true, message: '请输入本次结算金额,系统将自动分配到已选单据上', trigger: 'change' }],
         discountAmount: [{ required: true, message: '请输入折让金额', trigger: 'blur' }],
         settleStyleSn: [{ required: true, message: '请选择结算方式', trigger: 'change' }]
       },
@@ -195,6 +201,20 @@ export default {
     }
   },
   computed: {
+    // 打印预览/快捷打印
+    handlePrint (type, printerType) {
+      const _this = this
+      _this.spinning = true
+      let url = settleDetailPrint
+      const params = { sn: this.$route.params.sn }
+      if (type == 'export') { //  导出
+        url = settleDetailExport
+      }
+      // 打印或导出
+      hdPrint(printerType, type, url, params, '销售单', function () {
+        _this.spinning = false
+      })
+    },
     // 本次结算金额合计
     currentTotalBalance () {
       let val = 0
@@ -226,16 +246,13 @@ export default {
         val += (Number(item.settleAmount) * 1000)
       })
       val = val / 1000
-      if (val < 0) {
-        this.isPositive = false
-      } else {
-        this.isPositive = true
-      }
+      this.isPositive = val > 0
+      this.form.amountSettled = Math.abs(val)
       return Math.abs(val)
     },
     // 实结算金额
     actualSettlementAmount () {
-      const val = (this.amountSettled * 1000 - this.form.discountAmount * 1000) / 1000
+      const val = (this.form.amountSettled * 1000 - this.form.discountAmount * 1000) / 1000
       return val
     }
   },
@@ -262,7 +279,7 @@ export default {
           form.settleClientSn = _this.$route.params.sn || undefined
           form.settleClientType = _this.chooseLoadData[0].settleClientType
           form.settleType = _this.isPositive ? 'R' : 'P'
-          form.settleAmount = _this.amountSettled
+          form.settleAmount = _this.form.amountSettled
           form.realSettleAmount = _this.actualSettlementAmount
           form.detailList = []
           _this.chooseLoadData.map(item => {

+ 7 - 4
src/views/financialManagement/financialCollection/list.vue

@@ -71,6 +71,7 @@
         <a-button type="primary" id="financialCollectionList-export" :loading="loading" @click="handleCollection">批量收款</a-button>
         <span style="margin-left: 8px" v-if="$hasPermissions('B_financialCollectionPl')">
           <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
+          <template v-if="selectTotalAmount">,合计¥{{ selectTotalAmount }}</template>
         </span>
       </div>
       <!-- 列表 -->
@@ -233,9 +234,11 @@ export default {
   computed: {
     selectTotalAmount () {
       let ret = 0
-      this.rowSelectionInfo.selectedRows.map(item => {
-        ret = ret + item.unsettleAmount
-      })
+      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows) {
+        this.rowSelectionInfo.selectedRows.map(item => {
+          ret = ret + item.unsettleAmount
+        })
+      }
       return ret
     }
   },
@@ -333,7 +336,7 @@ export default {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '待收款总计' + this.selectTotalAmount + '元,确认批量收款吗?',
+        content: <div><p style="margin-top:20px;">合计金额¥{ this.selectTotalAmount } </p><p>确认批量收款吗?</p></div>,
         centered: true,
         closable: true,
         onOk () {

+ 8 - 5
src/views/financialManagement/financialPayment/list.vue

@@ -70,6 +70,7 @@
         <a-button type="primary" id="finacialPay-export" :loading="loading" @click="handlePayment">批量付款</a-button>
         <span style="margin-left: 8px" v-if="$hasPermissions('B_financialPaymentPl')">
           <template v-if="rowSelectionInfo&&rowSelectionInfo.selectedRowKeys.length>0">{{ `已选 ${rowSelectionInfo.selectedRowKeys.length} 项` }}</template>
+          <template v-if="selectTotalAmount">,合计¥{{ selectTotalAmount }}</template>
         </span>
       </div>
       <!-- 列表 -->
@@ -192,10 +193,12 @@ export default {
   computed: {
     selectTotalAmount () {
       let ret = 0
-      this.rowSelectionInfo.selectedRows.map(item => {
-        ret = ret + item.unsettleAmount
-      })
-      return ret
+      if (this.rowSelectionInfo && this.rowSelectionInfo.selectedRows) {
+        this.rowSelectionInfo.selectedRows.map(item => {
+          ret = ret + item.unsettleAmount
+        })
+      }
+      return ret.toFixed(2)
     }
   },
   methods: {
@@ -276,7 +279,7 @@ export default {
       const _this = this
       this.$confirm({
         title: '提示',
-        content: '待付款总计' + this.selectTotalAmount + '元,确认批量付款吗?',
+        content: <div><p style="margin-top:20px;">合计金额¥{ this.selectTotalAmount } </p><p>确认批量付款吗?</p></div>,
         centered: true,
         closable: true,
         onOk () {