diff --git a/anrui-scm/anrui-scm-ui/src/api/bikerebate/bicyclerebatecheck.js b/anrui-scm/anrui-scm-ui/src/api/bikerebate/bicyclerebatecheck.js index 268fddfd68..8d5e15cd84 100644 --- a/anrui-scm/anrui-scm-ui/src/api/bikerebate/bicyclerebatecheck.js +++ b/anrui-scm/anrui-scm-ui/src/api/bikerebate/bicyclerebatecheck.js @@ -10,6 +10,26 @@ export default { headers: { 'Content-Type': 'application/json' } }) }, + // 一次导出 + excelListOne: function(data) { + return request({ + url: '/scm/v1/scmvehrebate/excelListOne', + method: 'post', + data: data, + responseType: 'blob', // 表明返回服务器返回的数据类型 + headers: { 'Content-Type': 'application/json' } + }) + }, + // 二次导出 + excelListTwo: function(data) { + return request({ + url: '/scm/v1/scmvehrebate/excelListTwo', + method: 'post', + data: data, + responseType: 'blob', // 表明返回服务器返回的数据类型 + headers: { 'Content-Type': 'application/json' } + }) + }, // 单车返利核对(待核对)列表保存修改记录 updateDate: function(data) { return request({ diff --git a/anrui-scm/anrui-scm-ui/src/views/bikerebate/bicyclerebatecheck/bicyclerebatetobechecked.vue b/anrui-scm/anrui-scm-ui/src/views/bikerebate/bicyclerebatecheck/bicyclerebatetobechecked.vue index 1934a13c6e..4015ec0c19 100644 --- a/anrui-scm/anrui-scm-ui/src/views/bikerebate/bicyclerebatecheck/bicyclerebatetobechecked.vue +++ b/anrui-scm/anrui-scm-ui/src/views/bikerebate/bicyclerebatecheck/bicyclerebatetobechecked.vue @@ -48,10 +48,10 @@
单车返利待核对列表
- 一次导出 - 一次导入 - 二次导出 - 二次导入 + 一次导出 + 一次导入 + 二次导出 + 二次导入
@@ -274,6 +274,41 @@
+ + + +
+ + 选取文件 + 上传 + +
+
+

文件上传结果

+ +
{{ uploadResultMesssage }}
+
+
+
+ +
@@ -378,6 +413,18 @@ export default { secondRebate: '', adjustmentMoney: '', cost: '' + }, + dialogFileVisible: false, + updateAction: '', + fileList: [], + uploadResultMesssage: '', + uploadData: { + sid: '', + userSid: '', + orgPath: '' + }, + headers: { + token: window.sessionStorage.getItem('token') } } }, @@ -422,9 +469,6 @@ export default { case 'toAdd': this.toAdd() break - case 'doImport': - this.doImport() - break case 'doClose': this.doClose() break @@ -510,8 +554,8 @@ export default { }, isAdjustmentInput(row) { let money = '0' - // 上传金额 - 费用 - 待确定金额 - 预提返利 - money = parseFloat(row.uploadMoney !== '' ? row.uploadMoney : 0) - parseFloat(row.money !== '' ? row.money : 0) - parseFloat(row.stayDetermineMoney !== '' ? row.stayDetermineMoney : 0) - parseFloat(row.estimateRebate !== '' ? row.estimateRebate : 0) + // 上传金额(一次上传金额 + 二次上传金额) - 费用 - 待确定金额 - 预提返利 + money = parseFloat(row.uploadMoney !== '' ? row.uploadMoney : 0) + parseFloat(row.secondaryUploadMoney !== '' ? row.secondaryUploadMoney : 0) - parseFloat(row.money !== '' ? row.money : 0) - parseFloat(row.stayDetermineMoney !== '' ? row.stayDetermineMoney : 0) - parseFloat(row.estimateRebate !== '' ? row.estimateRebate : 0) if (row.stayDetermineMoney === '0') { if (parseFloat(money) > 0) { row.isAdjustment = '是' @@ -536,7 +580,7 @@ export default { }, isAdjustmentChange(val, row) { if (val === '是') { - row.adjustmentMoney = parseFloat(row.uploadMoney !== '' ? row.uploadMoney : 0) - parseFloat(row.money !== '' ? row.money : 0) - parseFloat(row.stayDetermineMoney !== '' ? row.stayDetermineMoney : 0) - parseFloat(row.estimateRebate !== '' ? row.estimateRebate : 0) + row.adjustmentMoney = parseFloat(row.uploadMoney !== '' ? row.uploadMoney : 0) + parseFloat(row.secondaryUploadMoney !== '' ? row.secondaryUploadMoney : 0) - parseFloat(row.money !== '' ? row.money : 0) - parseFloat(row.stayDetermineMoney !== '' ? row.stayDetermineMoney : 0) - parseFloat(row.estimateRebate !== '' ? row.estimateRebate : 0) } else if (val === '否') { row.adjustmentMoney = '0' row.adjustmentRemarks = '' @@ -657,6 +701,96 @@ export default { doClose() { this.$store.dispatch('tagsView/delView', this.$route) this.$router.go(-1) + }, + exportByFirst() { + const loading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + req.excelListOne(this.listQuery.params).then((resp) => { + loading.close() + const blob = new Blob([resp], { + type: 'application/vnd.ms-excel' + }) + const fileName = '一次导入模版' + '.xls' + const elink = document.createElement('a') + elink.download = fileName + elink.style.display = 'nonde' + elink.href = URL.createObjectURL(blob) + document.body.appendChild(elink) + elink.click() + URL.revokeObjectURL(elink.href) + document.body.removeChild(elink) + }).catch(() => { + loading.close() + }) + }, + importByFirst() { + this.dialogFileVisible = true + this.updateAction = process.env.VUE_APP_BASE_API + '/scm/v1/scmvehrebate/getExcelOneInfo' + this.fileList = [] + this.uploadResultMesssage = '' + }, + exportBySecond() { + const loading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + req.excelListTwo(this.listQuery.params).then((resp) => { + loading.close() + const blob = new Blob([resp], { + type: 'application/vnd.ms-excel' + }) + const fileName = '二次导入模版' + '.xls' + const elink = document.createElement('a') + elink.download = fileName + elink.style.display = 'nonde' + elink.href = URL.createObjectURL(blob) + document.body.appendChild(elink) + elink.click() + URL.revokeObjectURL(elink.href) + document.body.removeChild(elink) + }).catch(() => { + loading.close() + }) + }, + importBySecond() { + this.dialogFileVisible = true + this.updateAction = process.env.VUE_APP_BASE_API + '/scm/v1/scmvehrebate/getExcelTwoInfo' + this.fileList = [] + this.uploadResultMesssage = '' + }, + handleRemove() { + this.uploadResultMesssage = '' + }, + submitUpload() { + this.uploadData.userSid = window.sessionStorage.getItem('userSid') + this.uploadData.orgPath = window.sessionStorage.getItem('defaultOrgPath') + this.$refs.upload.submit() + }, + handleSuccess(resp, file, fileList) { + const _this = this + if (resp.success) { + _this.uploadResultMesssage = resp.msg + } else { + _this.uploadResultMesssage = resp.msg + } + }, + handleConfirm() { + if (this.uploadResultMesssage === '') { + this.$message({ showClose: true, type: 'error', message: '请先上传单车返利模版' }) + return + } else { + this.dialogFileVisible = false + this.updateAction = '' + this.uploadData.userSid = '' + this.uploadData.orgPath = '' + this.getList() + } } } }