|
@@ -219,303 +219,298 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script type="text/javascript">
|
|
|
-import FileSaver from "file-saver";
|
|
|
-import CsvExportor from "csv-exportor";
|
|
|
-import XLSX from "xlsx";
|
|
|
- export default {
|
|
|
- data(){
|
|
|
- return{
|
|
|
- formCondition:{
|
|
|
- cardId:'',
|
|
|
- tradeId:''
|
|
|
- },
|
|
|
- formUserList: {
|
|
|
- "file": ""
|
|
|
- },
|
|
|
- invoiceTable:[],
|
|
|
- hightt:'0px',
|
|
|
- current: 1,
|
|
|
- pagesize: 8,
|
|
|
- total:''
|
|
|
- }
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.heightt = tableHeight-50;
|
|
|
- this.loadData();
|
|
|
- },
|
|
|
- filters: {
|
|
|
- rounding (value) {
|
|
|
- return value.toFixed(2)
|
|
|
- }
|
|
|
- },
|
|
|
- methods:{
|
|
|
- firstLoadData(){
|
|
|
- this.current = 1;
|
|
|
- this.pagesize = 8;
|
|
|
- this.loadData();
|
|
|
- },
|
|
|
- // 列表展示
|
|
|
- async loadData() {
|
|
|
- const formData = new FormData();
|
|
|
- formData.append('current', this.current);
|
|
|
- formData.append('size', this.pagesize);
|
|
|
- for(var i in this.formCondition){
|
|
|
- formData.append(i,this.formCondition[i]);
|
|
|
- }
|
|
|
- const response = await this.$http.post('selfCar/findSelfCarInvoices', formData);
|
|
|
- if (response.data.code === 0) {
|
|
|
- this.invoiceTable = response.data.data.records;
|
|
|
- this.total = response.data.data.total;
|
|
|
- }
|
|
|
- },
|
|
|
-importExcel (content) {
|
|
|
- const file = content.file
|
|
|
- // let file = file.files[0] // 使用传统的input方法需要加上这一步
|
|
|
- const filename = file.name
|
|
|
- if(!filename||typeof filename!='string'){
|
|
|
- this.$message('格式错误!请重新选择')
|
|
|
- return
|
|
|
+import FileSaver from "file-saver"
|
|
|
+import CsvExportor from "csv-exportor"
|
|
|
+import XLSX from "xlsx"
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ formCondition: {
|
|
|
+ cardId: ``,
|
|
|
+ tradeId: ``
|
|
|
+ },
|
|
|
+ formUserList: {
|
|
|
+ "file": ``
|
|
|
+ },
|
|
|
+ invoiceTable: [],
|
|
|
+ hightt: `0px`,
|
|
|
+ current: 1,
|
|
|
+ pagesize: 8,
|
|
|
+ total: ``
|
|
|
}
|
|
|
- let a = filename.split('').reverse().join('');
|
|
|
- let types = a.substring(0,a.search(/\./)).split('').reverse().join('');
|
|
|
-
|
|
|
- const fileType = ['xlsx', 'xlc', 'xlm', 'xls', 'xlt', 'xlw', 'csv'].some(item => item === types)
|
|
|
- if (!fileType) {
|
|
|
- this.$message('格式错误!请重新选择')
|
|
|
- return
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.heightt = tableHeight - 50 // eslint-disable-line
|
|
|
+ this.loadData()
|
|
|
+ },
|
|
|
+ filters: {
|
|
|
+ rounding(value) {
|
|
|
+ return value.toFixed(2)
|
|
|
}
|
|
|
- this.file2Xce(file).then(tabJson => {
|
|
|
- var tradeIds = '';
|
|
|
- var etcIds = '';
|
|
|
- if (tabJson && tabJson.length > 0) {
|
|
|
- this.xlsxJson = tabJson
|
|
|
- this.fileList = this.xlsxJson[0].sheet
|
|
|
- let n = '匹配的字段'
|
|
|
- var i=0;
|
|
|
- var j=0;
|
|
|
- this.fileList.forEach((item, index, arr) => {
|
|
|
- if(item['etc卡号']!=null && item['etc卡号']!='' && typeof item['etc卡号']!='undefined'){
|
|
|
- etcIds+= item['etc卡号'].trim()+',';
|
|
|
- i++;
|
|
|
- }else{
|
|
|
- etcIds+= '#,';
|
|
|
- }
|
|
|
- if(item['交易id']!=null && item['交易id']!='' && typeof item['交易id']!='undefined'){
|
|
|
- tradeIds+= item['交易id'].trim()+',';
|
|
|
- j++;
|
|
|
- }else{
|
|
|
- tradeIds+= '#,';
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ firstLoadData() {
|
|
|
+ this.current = 1
|
|
|
+ this.pagesize = 8
|
|
|
+ this.loadData()
|
|
|
+ },
|
|
|
+ // 列表展示
|
|
|
+ async loadData() {
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append(`current`, this.current)
|
|
|
+ formData.append(`size`, this.pagesize)
|
|
|
+ for (var i in this.formCondition) {
|
|
|
+ formData.append(i, this.formCondition[i])
|
|
|
}
|
|
|
- if(etcIds!='' && i>0){
|
|
|
- this.formCondition.cardId =etcIds.substring(0,etcIds.length-1);
|
|
|
+ const response = await this.$http.post(`selfCar/findSelfCarInvoices`, formData)
|
|
|
+ if (response.data.code === 0) {
|
|
|
+ this.invoiceTable = response.data.data.records
|
|
|
+ this.total = response.data.data.total
|
|
|
}
|
|
|
- if(tradeIds!='' && j>0){
|
|
|
- this.formCondition.tradeId = tradeIds.substring(0,tradeIds.length-1) ;
|
|
|
+ },
|
|
|
+ importExcel(content) {
|
|
|
+ const file = content.file
|
|
|
+ // let file = file.files[0] // 使用传统的input方法需要加上这一步
|
|
|
+ const filename = file.name
|
|
|
+ if (!filename || typeof filename !== `string`) {
|
|
|
+ this.$message(`格式错误!请重新选择`)
|
|
|
+ return
|
|
|
}
|
|
|
+ let a = filename.split(``).reverse().join(``)
|
|
|
+ let types = a.substring(0, a.search(/\./)).split(``).reverse().join(``)
|
|
|
|
|
|
- })
|
|
|
- },
|
|
|
- file2Xce (file) {
|
|
|
- return new Promise(function (resolve, reject) {
|
|
|
- const reader = new FileReader()
|
|
|
- reader.onload = function (e) {
|
|
|
- const data = e.target.result
|
|
|
- this.wb = XLSX.read(data, {
|
|
|
- type: 'binary'
|
|
|
- })
|
|
|
- const result = []
|
|
|
- var are = (this.wb.Sheets.Sheet1)['!ref'];
|
|
|
- var areRe = are.replace('A1','A2');
|
|
|
- (this.wb.Sheets.Sheet1)['!ref'] = areRe;
|
|
|
- this.wb.SheetNames.forEach((sheetName) => {
|
|
|
- result.push({
|
|
|
- sheetName: sheetName,
|
|
|
- sheet: XLSX.utils.sheet_to_json(this.wb.Sheets[sheetName])
|
|
|
- })
|
|
|
- })
|
|
|
- resolve(result)
|
|
|
+ const fileType = [`xlsx`, `xlc`, `xlm`, `xls`, `xlt`, `xlw`, `csv`].some((item) => { return item === types })
|
|
|
+ if (!fileType) {
|
|
|
+ this.$message(`格式错误!请重新选择`)
|
|
|
+ return
|
|
|
}
|
|
|
- // reader.readAsBinaryString(file.raw)
|
|
|
- reader.readAsBinaryString(file) // 传统input方法
|
|
|
- })
|
|
|
- },
|
|
|
- // 下载模板
|
|
|
- DownloadTemplate() {
|
|
|
- var url = hostUrl+"noCar/templateDownload?fileName=7"
|
|
|
- window.location.href= url;
|
|
|
-
|
|
|
- },
|
|
|
- handleRemove(file, fileList) {
|
|
|
- },
|
|
|
+ this.file2Xce(file).then((tabJson) => {
|
|
|
+ var tradeIds = ``
|
|
|
+ var etcIds = ``
|
|
|
+ if (tabJson && tabJson.length > 0) {
|
|
|
+ this.xlsxJson = tabJson
|
|
|
+ this.fileList = this.xlsxJson[0].sheet
|
|
|
+ let n = `匹配的字段`
|
|
|
+ var i = 0
|
|
|
+ var j = 0
|
|
|
+ this.fileList.forEach((item, index, arr) => {
|
|
|
+ if (item[`etc卡号`] !== null && item[`etc卡号`] !== `` && typeof item[`etc卡号`] !== `undefined`) {
|
|
|
+ etcIds += item[`etc卡号`].trim() + `,`
|
|
|
+ i++
|
|
|
+ } else {
|
|
|
+ etcIds += `#,`
|
|
|
+ }
|
|
|
+ if (item[`交易id`] !== null && item[`交易id`] !== `` && typeof item[`交易id`] !== `undefined`) {
|
|
|
+ tradeIds += item[`交易id`].trim() + `,`
|
|
|
+ j++
|
|
|
+ } else {
|
|
|
+ tradeIds += `#,`
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (etcIds !== `` && i > 0) {
|
|
|
+ this.formCondition.cardId = etcIds.substring(0, etcIds.length - 1)
|
|
|
+ }
|
|
|
+ if (tradeIds !== `` && j > 0) {
|
|
|
+ this.formCondition.tradeId = tradeIds.substring(0, tradeIds.length - 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ file2Xce(file) {
|
|
|
+ return new Promise(function(resolve, reject) {
|
|
|
+ const reader = new FileReader()
|
|
|
+ reader.onload = function(e) {
|
|
|
+ const data = e.target.result
|
|
|
+ this.wb = XLSX.read(data, {
|
|
|
+ type: `binary`
|
|
|
+ })
|
|
|
+ const result = []
|
|
|
+ var are = (this.wb.Sheets.Sheet1)[`!ref`]
|
|
|
+ var areRe = are.replace(`A1`, `A2`);
|
|
|
+ (this.wb.Sheets.Sheet1)[`!ref`] = areRe
|
|
|
+ this.wb.SheetNames.forEach((sheetName) => {
|
|
|
+ result.push({
|
|
|
+ sheetName: sheetName,
|
|
|
+ sheet: XLSX.utils.sheet_to_json(this.wb.Sheets[sheetName])
|
|
|
+ })
|
|
|
+ })
|
|
|
+ resolve(result)
|
|
|
+ }
|
|
|
+ // reader.readAsBinaryString(file.raw)
|
|
|
+ reader.readAsBinaryString(file) // 传统input方法
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 下载模板
|
|
|
+ DownloadTemplate() {
|
|
|
+ var url = hostUrl + `noCar/templateDownload?fileName=7` // eslint-disable-line
|
|
|
+ window.location.href = url
|
|
|
+ },
|
|
|
+ handleRemove(file, fileList) {
|
|
|
+ },
|
|
|
|
|
|
- handlePreview(file) {
|
|
|
- },
|
|
|
- handleSuccess (a) {
|
|
|
- this.formUserList.file = a.raw;
|
|
|
- },
|
|
|
+ handlePreview(file) {
|
|
|
+ },
|
|
|
+ handleSuccess(a) {
|
|
|
+ this.formUserList.file = a.raw
|
|
|
+ },
|
|
|
|
|
|
- // 批量上传模板信息
|
|
|
- async batchUpload() {
|
|
|
- const isLt50M = this.formUserList.file.size / 1024 / 1024 < 50;
|
|
|
- let extName = this.formUserList.file.name.substring(this.formUserList.file.name.lastIndexOf(".")).toLowerCase();
|
|
|
- let AllUpExt = ".xlsx";
|
|
|
- if( extName != AllUpExt){
|
|
|
- this.$message.error(extName+'格式错误!请重新选择xlsx文件');
|
|
|
- return false;
|
|
|
- }
|
|
|
+ // 批量上传模板信息
|
|
|
+ async batchUpload() {
|
|
|
+ const isLt50M = this.formUserList.file.size / 1024 / 1024 < 50
|
|
|
+ let extName = this.formUserList.file.name.substring(this.formUserList.file.name.lastIndexOf(`.`)).toLowerCase()
|
|
|
+ let AllUpExt = `.xlsx`
|
|
|
+ if (extName !== AllUpExt) {
|
|
|
+ this.$message.error(extName + `格式错误!请重新选择xlsx文件`)
|
|
|
+ return false
|
|
|
+ }
|
|
|
|
|
|
if (!isLt50M) {
|
|
|
- this.$message.error('上传文件大小不能超过50MB!');
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
+ this.$message.error(`上传文件大小不能超过50MB!`)
|
|
|
+ return false
|
|
|
+ }
|
|
|
|
|
|
- const loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
|
|
|
- spinner: 'el-icon-loading',
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
- });
|
|
|
- const formData = new FormData();
|
|
|
- formData.append('file', this.formUserList.file);
|
|
|
- const response = await this.$http.post(`selfCar/batchImportSelfcarInvoices`,formData);
|
|
|
- var {data: { code, msg, data }} = response;
|
|
|
- if(code === 0 && msg === '1') {
|
|
|
- loading.close();
|
|
|
- this.invoiceTable = response.data.data;
|
|
|
- this.total = response.data.data.length;
|
|
|
- }else {
|
|
|
- loading.close();
|
|
|
- this.$message.error('数据存在错误,请检查文件中数据');
|
|
|
- }
|
|
|
- },
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: `系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...`,
|
|
|
+ spinner: `el-icon-loading`,
|
|
|
+ background: `rgba(0, 0, 0, 0.7)`
|
|
|
+ })
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append(`file`, this.formUserList.file)
|
|
|
+ const response = await this.$http.post(`selfCar/batchImportSelfcarInvoices`, formData)
|
|
|
+ var {data: { code, msg, data }} = response
|
|
|
+ if (code === 0 && msg === `1`) {
|
|
|
+ loading.close()
|
|
|
+ this.invoiceTable = response.data.data
|
|
|
+ this.total = response.data.data.length
|
|
|
+ } else {
|
|
|
+ loading.close()
|
|
|
+ this.$message.error(`数据存在错误,请检查文件中数据`)
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- // 分页方法
|
|
|
- handleSizeChange(val) {
|
|
|
- this.pagesize = val;
|
|
|
- this.loadData();
|
|
|
- },
|
|
|
- handleCurrentChange(val) {
|
|
|
- this.current = val;
|
|
|
- this.loadData();
|
|
|
- },
|
|
|
- formartNum(wb){
|
|
|
- var sheet = wb['Sheets']['Sheet1'];
|
|
|
- var replaceTemp = [];
|
|
|
+ // 分页方法
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.pagesize = val
|
|
|
+ this.loadData()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.current = val
|
|
|
+ this.loadData()
|
|
|
+ },
|
|
|
+ formartNum(wb) {
|
|
|
+ var sheet = wb[`Sheets`][`Sheet1`]
|
|
|
+ var replaceTemp = []
|
|
|
|
|
|
- for(var i in sheet){
|
|
|
- if(sheet[i]['v'] == "价税合计"||sheet[i]['v'] == "税额"||sheet[i]['v'] == "金额"||sheet[i]['v'] == "税率"||sheet[i]['v'] == "交易金额"){
|
|
|
- replaceTemp.push(i.replace(/[0-9]/g,''));
|
|
|
- continue;
|
|
|
- }
|
|
|
- if(replaceTemp.includes(i.replace(/[0-9]/g,''))){
|
|
|
- sheet[i]['t']='n';
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
+ for (var i in sheet) {
|
|
|
+ if (sheet[i][`v`] === `价税合计` || sheet[i][`v`] === `税额` || sheet[i][`v`] === `金额` || sheet[i][`v`] === `税率` || sheet[i][`v`] === `交易金额`) {
|
|
|
+ replaceTemp.push(i.replace(/[0-9]/g, ``))
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if (replaceTemp.includes(i.replace(/[0-9]/g, ``))) {
|
|
|
+ sheet[i][`t`] = `n`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
async exportExcel() {
|
|
|
- const loading = this.$loading({
|
|
|
- lock: true,
|
|
|
- text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
|
|
|
- spinner: 'el-icon-loading',
|
|
|
- background: 'rgba(0, 0, 0, 0.7)'
|
|
|
- });
|
|
|
- var recodes = [];
|
|
|
- debugger;
|
|
|
- for(var j=1;j<=this.total/10000+1;j++){
|
|
|
-
|
|
|
- const formData = new FormData();
|
|
|
- formData.append('current', j);
|
|
|
- formData.append('size', 10000);
|
|
|
- for(var i in this.formCondition){
|
|
|
- formData.append(i,this.formCondition[i]);
|
|
|
- }
|
|
|
- const response = await this.$http.post('selfCar/findSelfCarInvoices', formData);
|
|
|
- if (response.data.code === 0) {
|
|
|
- recodes = recodes.concat(response.data.data.records);
|
|
|
- }
|
|
|
- }
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: `系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...`,
|
|
|
+ spinner: `el-icon-loading`,
|
|
|
+ background: `rgba(0, 0, 0, 0.7)`
|
|
|
+ })
|
|
|
+ var recodes = []
|
|
|
|
|
|
- // 设置当前日期
|
|
|
- let time = new Date();
|
|
|
- let year = time.getFullYear();
|
|
|
- let month = time.getMonth() + 1;
|
|
|
- let day = time.getDate();
|
|
|
- let name = "自有车发票查询列表_"+year + "" + month + "" + day;
|
|
|
- let cloums = [
|
|
|
- {"title":"企业编号","key":"companyNum"},
|
|
|
- {"title":"公司名称","key":"buyerName"},
|
|
|
- {"title":"购方税号","key":"buyerTaxpayerCode"},
|
|
|
- {"title":"车牌号码","key":"plateNum"},
|
|
|
- {"title":"etc卡号","key":"cardId"},
|
|
|
- {"title":"交易Id","key":"tradeId"},
|
|
|
- {"title":"销方税号","key":"sellerTaxpayerCode"},
|
|
|
- {"title":"销方名称","key":"sellerName"},
|
|
|
- {"title":"入口收费站","key":"enStation"},
|
|
|
- {"title":"出口收费站","key":"exStation"},
|
|
|
- {"title":"发票代码","key":"invoiceCode"},
|
|
|
- {"title":"发票号码","key":"invoiceNum"},
|
|
|
- {"title":"开票时间","key":"invoiceMakeTime"},
|
|
|
- {"title":"交易时间","key":"exTime"},
|
|
|
- {"title":"交易金额(元)","key":"fee"},
|
|
|
- {"title":"价税合计(元)","key":"totalAmount"},
|
|
|
- {"title":"税额(元)","key":"totalTaxAmount"},
|
|
|
- {"title":"金额(元)","key":"amount"},
|
|
|
- {"title":"税率","key":"taxRate"},
|
|
|
- {"title":"扣费时间","key":"calculateTime"},
|
|
|
- {"title":"交易状态","key":"tradeStatus"},
|
|
|
- {"title":"预览地址","key":"invoiceHtmlUrl"},
|
|
|
- {"title":"下载地址","key":"invoiceUrl"}
|
|
|
-
|
|
|
- ];
|
|
|
- this.exportExcelComm(cloums,recodes,name,loading)
|
|
|
-
|
|
|
- },
|
|
|
- formatJson (filterVal, jsonData) {
|
|
|
- return jsonData.map(v => filterVal.map(j => {
|
|
|
- if(j == 'tradeStatus'){
|
|
|
- if(v[j] == 1){
|
|
|
- return "待开票";
|
|
|
- } else if(v[j] == 2){
|
|
|
- return "开票中";
|
|
|
- }else if(v[j] == 3){
|
|
|
- return "开票完成";
|
|
|
- }
|
|
|
- }else if(j =='fee'){
|
|
|
- return v[j]/100;
|
|
|
- }else if(j =='totalAmount'){
|
|
|
- return v[j]/100;
|
|
|
- }else if(j =='totalTaxAmount'){
|
|
|
- return v[j]/100;
|
|
|
- }else if(j =='amount'){
|
|
|
- return v[j]/100;
|
|
|
- }else if(j=='sellerTaxpayerCode' || j=='cardId' || j=='invoiceCode' || j=='invoiceNum' ){
|
|
|
- return v[j]+'\t';
|
|
|
- }else{
|
|
|
- return v[j];
|
|
|
- }
|
|
|
+ for (var j = 1; j <= this.total / 10000 + 1; j++) {
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append(`current`, j)
|
|
|
+ formData.append(`size`, 10000)
|
|
|
+ for (var i in this.formCondition) {
|
|
|
+ formData.append(i, this.formCondition[i])
|
|
|
+ }
|
|
|
+ const response = await this.$http.post(`selfCar/findSelfCarInvoices`, formData)
|
|
|
+ if (response.data.code === 0) {
|
|
|
+ recodes = recodes.concat(response.data.data.records)
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }));
|
|
|
- },
|
|
|
- // 导出Excel
|
|
|
- exportExcelComm(columns,list,excelName,loading){
|
|
|
- let tHeader = []
|
|
|
- let filterVal = []
|
|
|
- columns.forEach(item =>{
|
|
|
- tHeader.push(item.title)
|
|
|
- filterVal.push(item.key)
|
|
|
- })
|
|
|
+ // 设置当前日期
|
|
|
+ let time = new Date()
|
|
|
+ let year = time.getFullYear()
|
|
|
+ let month = time.getMonth() + 1
|
|
|
+ let day = time.getDate()
|
|
|
+ let name = `自有车发票查询列表_` + year + `` + month + `` + day
|
|
|
+ let cloums = [
|
|
|
+ {"title": `企业编号`, "key": `companyNum`},
|
|
|
+ {"title": `公司名称`, "key": `buyerName`},
|
|
|
+ {"title": `购方税号`, "key": `buyerTaxpayerCode`},
|
|
|
+ {"title": `车牌号码`, "key": `plateNum`},
|
|
|
+ {"title": `etc卡号`, "key": `cardId`},
|
|
|
+ {"title": `交易Id`, "key": `tradeId`},
|
|
|
+ {"title": `销方税号`, "key": `sellerTaxpayerCode`},
|
|
|
+ {"title": `销方名称`, "key": `sellerName`},
|
|
|
+ {"title": `入口收费站`, "key": `enStation`},
|
|
|
+ {"title": `出口收费站`, "key": `exStation`},
|
|
|
+ {"title": `发票代码`, "key": `invoiceCode`},
|
|
|
+ {"title": `发票号码`, "key": `invoiceNum`},
|
|
|
+ {"title": `开票时间`, "key": `invoiceMakeTime`},
|
|
|
+ {"title": `交易时间`, "key": `exTime`},
|
|
|
+ {"title": `交易金额(元)`, "key": `fee`},
|
|
|
+ {"title": `价税合计(元)`, "key": `totalAmount`},
|
|
|
+ {"title": `税额(元)`, "key": `totalTaxAmount`},
|
|
|
+ {"title": `金额(元)`, "key": `amount`},
|
|
|
+ {"title": `税率`, "key": `taxRate`},
|
|
|
+ {"title": `扣费时间`, "key": `calculateTime`},
|
|
|
+ {"title": `交易状态`, "key": `tradeStatus`},
|
|
|
+ {"title": `预览地址`, "key": `invoiceHtmlUrl`},
|
|
|
+ {"title": `下载地址`, "key": `invoiceUrl`}
|
|
|
|
|
|
- const data = this.formatJson(filterVal,list);
|
|
|
- data.unshift(tHeader);
|
|
|
- CsvExportor.downloadCsv(data, { tHeader }, excelName+".csv");
|
|
|
- loading.close();
|
|
|
+ ]
|
|
|
+ this.exportExcelComm(cloums, recodes, name, loading)
|
|
|
+ },
|
|
|
+ formatJson(filterVal, jsonData) {
|
|
|
+ return jsonData.map((v) => {
|
|
|
+ return filterVal.map((j) => {
|
|
|
+ if (j === `tradeStatus`) {
|
|
|
+ if (v[j] === 1) {
|
|
|
+ return `待开票`
|
|
|
+ } else if (v[j] === 2) {
|
|
|
+ return `开票中`
|
|
|
+ } else if (v[j] === 3) {
|
|
|
+ return `开票完成`
|
|
|
}
|
|
|
- }
|
|
|
- };
|
|
|
+ } else if (j === `fee`) {
|
|
|
+ return v[j] / 100
|
|
|
+ } else if (j === `totalAmount`) {
|
|
|
+ return v[j] / 100
|
|
|
+ } else if (j === `totalTaxAmount`) {
|
|
|
+ return v[j] / 100
|
|
|
+ } else if (j === `amount`) {
|
|
|
+ return v[j] / 100
|
|
|
+ } else if (j === `sellerTaxpayerCode` || j === `cardId` || j === `invoiceCode` || j === `invoiceNum`) {
|
|
|
+ return v[j] + `\t`
|
|
|
+ } else {
|
|
|
+ return v[j]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 导出Excel
|
|
|
+ exportExcelComm(columns, list, excelName, loading) {
|
|
|
+ let tHeader = []
|
|
|
+ let filterVal = []
|
|
|
+ columns.forEach((item) => {
|
|
|
+ tHeader.push(item.title)
|
|
|
+ filterVal.push(item.key)
|
|
|
+ })
|
|
|
+
|
|
|
+ const data = this.formatJson(filterVal, list)
|
|
|
+ data.unshift(tHeader)
|
|
|
+ CsvExportor.downloadCsv(data, { tHeader }, excelName + `.csv`)
|
|
|
+ loading.close()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
<style>
|
|
|
.invoice_container {
|