Bläddra i källkod

收据下载调整

LAPTOP-FO2T5SIU\35838 5 månader sedan
förälder
incheckning
707a186103

+ 30 - 4
src/views/customerManagement/intentionalDeposit/addIntentionalDeposit.vue

@@ -145,7 +145,7 @@
                 </el-form-item>
               </el-col>
               <el-col :span="6" class="col-input">
-                <el-button v-if="isView" type="text" style="float: right" @click="downLoad()">意向金收据下载</el-button>
+                <el-button v-if="isView" :loading="downLoadFlag" type="text" style="float: right" @click="downLoad()">意向金收据下载</el-button>
               </el-col>
             </el-row>
             <el-row>
@@ -173,6 +173,7 @@ import Base from '@/views/base/base'
 import BaseData from '@/views/base/baseData'
 import { upload } from '@/static/utils/channel'
 import constant from '@/static/utils/constant'
+import axios from 'axios'
 
 export default {
     name: 'AddIntentionalDepositVue',
@@ -202,7 +203,8 @@ export default {
             bankObject: '',
             customerForm: {
 
-            }
+            },
+            downLoadFlag: false
         }
     },
     mounted() {
@@ -312,8 +314,32 @@ export default {
             })
         },
         downLoad() {
-            const url = constant.BASE_URI + '/IntentionalDepositController/downLoadReceipt?id=' + this.form.id
-            window.open(url, '_blank')
+            // const url = constant.BASE_URI + '/IntentionalDepositController/downLoadReceipt?id=' + this.form.id
+            // window.open(url, '_blank')
+            this.downLoadFlag = true
+            axios({
+                headers: {
+                    'MVVM-Key': String(new Date().getTime()),
+                    xx: 'anything'
+                },
+                method: 'get',
+                url: constant.BASE_URI + '/IntentionalDepositController/downLoadReceipt?id=' + this.form.id,
+                responseType: 'blob'
+            }).then(res => {
+                this.previewPDF(res.data)
+            }).catch((err) => {
+                this.downLoadFlag = false
+                console.log(err)
+            })
+        },
+        previewPDF(blobPart, filename) {
+            const binaryData = []
+            binaryData.push(blobPart)
+            // 获取blob链接
+            let pdfUrl = ''
+            pdfUrl = window.URL.createObjectURL(new Blob(binaryData, { type: 'application/pdf' }))
+            window.open(pdfUrl)
+            this.downLoadFlag = false
         },
         getBankOptions() {
             this.bankRequest('listAll', {}).then(res => {

+ 30 - 4
src/views/invoice/receiptManage.vue

@@ -81,7 +81,7 @@
           <el-table-column label="票面金额" prop="receiptMoney" />
           <el-table-column label="票据编号" prop="receiptNumber" width="200">
             <template scope="scope">
-              <el-button size="mini" type="text" @click="downLoad(scope.row)">
+              <el-button size="mini" type="text" :loading="downLoadFlag" @click="downLoad(scope.row)">
                 {{ scope.row.receiptNumber }}
               </el-button>
             </template>
@@ -128,6 +128,7 @@
 import Base from '@/views/base/base'
 import BaseData from '@/views/base/baseData'
 import constant from '@/static/utils/constant'
+import axios from 'axios'
 
 export default {
     name: 'ReceiptManage',
@@ -147,7 +148,8 @@ export default {
             selected: [],
             excelFlag: false,
             dialogBatchVisible: false,
-            dialogBatchTitle: ''
+            dialogBatchTitle: '',
+            downLoadFlag: false
         }
     },
     mounted() {
@@ -208,8 +210,32 @@ export default {
             this.dialogVisible = false
         },
         downLoad(row) {
-            const url = constant.BASE_URI + '/ReceiptManageController/downLoadReceipt?id=' + row.id
-            window.open(url, '_blank')
+            // const url = constant.BASE_URI + '/ReceiptManageController/downLoadReceipt?id=' + row.id
+            // window.open(url, '_blank')
+            this.downLoadFlag = true
+            axios({
+                headers: {
+                    'MVVM-Key': String(new Date().getTime()),
+                    xx: 'anything'
+                },
+                method: 'get',
+                url: constant.BASE_URI + '/ReceiptManageController/downLoadReceipt?id=' + row.id,
+                responseType: 'blob'
+            }).then(res => {
+                this.previewPDF(res.data)
+            }).catch((err) => {
+                this.downLoadFlag = false
+                console.log(err)
+            })
+        },
+        previewPDF(blobPart, filename) {
+            const binaryData = []
+            binaryData.push(blobPart)
+            // 获取blob链接
+            let pdfUrl = ''
+            pdfUrl = window.URL.createObjectURL(new Blob(binaryData, { type: 'application/pdf' }))
+            window.open(pdfUrl)
+            this.downLoadFlag = false
         },
         baseRequest(opUrl, postData) {
             return this.$channel.globeRequest('ReceiptManageController', opUrl, postData, 'project')

+ 30 - 4
src/views/receiveRefundsManagement/intentionalDepositManagement/index.vue

@@ -63,7 +63,7 @@
             <template scope="scope">
               <el-button :disabled="scope.row.status !== 1" size="mini" type="text" @click="handleToDeposit(scope.row)">转定金</el-button>
               <el-button size="mini" type="text" @click="handleView(scope.row)">查看</el-button>
-              <el-button :disabled="scope.row.status === 1" size="mini" type="text" @click="downLoad(scope.row)">意向金收据</el-button>
+              <el-button :disabled="scope.row.status === 1" :loading="downLoadFlag" size="mini" type="text" @click="downLoad(scope.row)">意向金收据</el-button>
               <el-button :disabled="scope.row.status === 2" size="mini" type="text" @click="handleRefund(scope.row)">退意向金</el-button>
               <el-button :disabled="!(scope.row.status === 1)" size="mini" type="text" @click="handleEdit(scope.row)">编辑</el-button>
             </template>
@@ -144,6 +144,7 @@ import ToDeposit from '@/views/receiveRefundsManagement/intentionalDepositManage
 import RefundIntentionalDeposit from '@/views/receiveRefundsManagement/intentionalDepositManagement/refundIntentionalDeposit.vue'
 import constant from '@/static/utils/constant'
 import AddIntentionalDeposit from '@/views/customerManagement/intentionalDeposit/addIntentionalDeposit.vue'
+import axios from 'axios'
 
 export default {
     name: 'Index',
@@ -161,7 +162,8 @@ export default {
             dialogVisible: false,
             dialogTitle: '新增',
             dialogRefundVisible: false,
-            dialogIntentionalVisible: false
+            dialogIntentionalVisible: false,
+            downLoadFlag: false
         }
     },
     mounted() {
@@ -237,8 +239,32 @@ export default {
             })
         },
         downLoad(row) {
-            const url = constant.BASE_URI + '/IntentionalDepositController/downLoadReceipt?id=' + row.id
-            window.open(url, '_blank')
+            // const url = constant.BASE_URI + '/IntentionalDepositController/downLoadReceipt?id=' + row.id
+            // window.open(url, '_blank')
+            this.downLoadFlag = true
+            axios({
+                headers: {
+                    'MVVM-Key': String(new Date().getTime()),
+                    xx: 'anything'
+                },
+                method: 'get',
+                url: constant.BASE_URI + '/IntentionalDepositController/downLoadReceipt?id=' + row.id,
+                responseType: 'blob'
+            }).then(res => {
+                this.previewPDF(res.data)
+            }).catch((err) => {
+                this.downLoadFlag = false
+                console.log(err)
+            })
+        },
+        previewPDF(blobPart, filename) {
+            const binaryData = []
+            binaryData.push(blobPart)
+            // 获取blob链接
+            let pdfUrl = ''
+            pdfUrl = window.URL.createObjectURL(new Blob(binaryData, { type: 'application/pdf' }))
+            window.open(pdfUrl)
+            this.downLoadFlag = false
         },
         handleRefund(val) {
             this.dialogRefundVisible = true

+ 31 - 4
src/views/receiveRefundsManagement/intentionalDepositManagement/toDeposit.vue

@@ -81,7 +81,7 @@
                 </el-form-item>
               </el-col>
               <el-col :span="6" class="col-input">
-                <el-button type="text" style="float: right" @click="downLoad()">意向金收据下载</el-button>
+                <el-button type="text" :loading="downLoadFlag" style="float: right" @click="downLoad()">意向金收据下载</el-button>
               </el-col>
             </el-row>
             <el-row>
@@ -126,6 +126,7 @@ import BaseData from '@/views/base/baseData'
 import { upload } from '@/static/utils/channel'
 import AddHouse from '@/views/customerManagement/roomChose/addHouse.vue'
 import constant from '@/static/utils/constant'
+import axios from 'axios'
 
 export default {
     name: 'ToDeposit',
@@ -146,7 +147,8 @@ export default {
             username: '',
             dialogHouseVisible: false,
             isView: false,
-            fromAddress: ''
+            fromAddress: '',
+            downLoadFlag: false
         }
     },
     mounted() {
@@ -259,8 +261,33 @@ export default {
             })
         },
         downLoad() {
-            const url = constant.BASE_URI + '/IntentionalDepositController/downLoadReceipt?id=' + this.form.id
-            window.open(url, '_blank')
+            // const url = constant.BASE_URI + '/IntentionalDepositController/downLoadReceipt?id=' + this.form.id
+            // window.open(url, '_blank')
+
+            this.downLoadFlag = true
+            axios({
+                headers: {
+                    'MVVM-Key': String(new Date().getTime()),
+                    xx: 'anything'
+                },
+                method: 'get',
+                url: constant.BASE_URI + '/IntentionalDepositController/downLoadReceipt?id=' + this.form.id,
+                responseType: 'blob'
+            }).then(res => {
+                this.previewPDF(res.data)
+            }).catch((err) => {
+                this.downLoadFlag = false
+                console.log(err)
+            })
+        },
+        previewPDF(blobPart, filename) {
+            const binaryData = []
+            binaryData.push(blobPart)
+            // 获取blob链接
+            let pdfUrl = ''
+            pdfUrl = window.URL.createObjectURL(new Blob(binaryData, { type: 'application/pdf' }))
+            window.open(pdfUrl)
+            this.downLoadFlag = false
         },
         baseRequest(opUrl, postData) {
             return this.$channel.globeRequest('IntentionalDepositController', opUrl, postData, 'project')

+ 31 - 4
src/views/receiveRefundsManagement/paymentManagement/paymentRegistration.vue

@@ -98,7 +98,7 @@
                       type="text"
                       @click="handleDelete(scope.row)"
                     >删除</el-button>
-                    <el-button size="mini" type="text" @click="downLoad(scope.row)">电子收据</el-button>
+                    <el-button :loading="downLoadFlag" size="mini" type="text" @click="downLoad(scope.row)">电子收据</el-button>
                     <el-button v-if="scope.row.contentType == '1'" size="mini" type="text" @click="handleConvert(scope.row,1)">转首款</el-button>
                     <el-button v-if="scope.row.contentType == '1'" size="mini" type="text" @click="handleConvert(scope.row,2)">转房款</el-button>
                   </template>
@@ -139,6 +139,7 @@ import Base from '@/views/base/base'
 import BaseData from '@/views/base/baseData'
 import AddPayment from '@/views/receiveRefundsManagement/paymentManagement/addPayment.vue'
 import constant from '@/static/utils/constant'
+import axios from 'axios'
 
 export default {
     name: 'PaymentRegistration',
@@ -159,7 +160,8 @@ export default {
             contractId: '',
             houseId: '',
             customerManagementId: '',
-            isView: false
+            isView: false,
+            downLoadFlag: false
         }
     },
     computed: {
@@ -230,8 +232,33 @@ export default {
             this.dialogVisible = false
         },
         downLoad(row) {
-            const url = constant.BASE_URI + '/PayLogController/downLoadReceipt?id=' + row.id
-            window.open(url, '_blank')
+            // const url = constant.BASE_URI + '/PayLogController/downLoadReceipt?id=' + row.id
+            // window.open(url, '_blank')
+
+            this.downLoadFlag = true
+            axios({
+                headers: {
+                    'MVVM-Key': String(new Date().getTime()),
+                    xx: 'anything'
+                },
+                method: 'get',
+                url: constant.BASE_URI + '/PayLogController/downLoadReceipt?id=' + row.id,
+                responseType: 'blob'
+            }).then(res => {
+                this.previewPDF(res.data)
+            }).catch((err) => {
+                this.downLoadFlag = false
+                console.log(err)
+            })
+        },
+        previewPDF(blobPart, filename) {
+            const binaryData = []
+            binaryData.push(blobPart)
+            // 获取blob链接
+            let pdfUrl = ''
+            pdfUrl = window.URL.createObjectURL(new Blob(binaryData, { type: 'application/pdf' }))
+            window.open(pdfUrl)
+            this.downLoadFlag = false
         },
         handleAdd() {
             this.dialogVisible = true