From 9c095258e40d4cb38449c7aefe7c7b9d93d859a5 Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123 <819527061@qq.com>
Date: 星期六, 31 十二月 2022 11:33:57 +0800
Subject: [PATCH] 发票下载
---
src/components/page/invoice/invoiceForm.vue | 138 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 130 insertions(+), 8 deletions(-)
diff --git a/src/components/page/invoice/invoiceForm.vue b/src/components/page/invoice/invoiceForm.vue
index a110051..9e2b5f9 100644
--- a/src/components/page/invoice/invoiceForm.vue
+++ b/src/components/page/invoice/invoiceForm.vue
@@ -3,6 +3,17 @@
<div class="title">璁㈠崟鍙戠エ</div>
<div class="invoiceForm-main">
<div class="invoiceForm-main-inside">
+ <div class="invoice-date-box">
+ <el-date-picker
+ :editable="false"
+ format="yyyy-MM"
+ value-format="yyyy-MM"
+ v-model="date"
+ type="month"
+ @change="changeDate"
+ placeholder="閫夋嫨鏃ユ湡">
+ </el-date-picker>
+ </div>
<van-list
v-model="loading"
:finished="finished"
@@ -15,7 +26,6 @@
<div v-for="(item,index) in invoiceData" :key="index">
<el-checkbox
v-model="item.isShow"
- :label="item.isShow"
class="invoiceForm-block"
@change="handleCheckedCitiesChange(invoiceData)">
<div>
@@ -48,7 +58,10 @@
</van-list>
<div class="fapiao-btn">
<el-checkbox v-model="checkAll" @change="handleCheckAllChange">鍏ㄩ��</el-checkbox>
- <el-button size="mini" @click="seeInvoice">涓嬭浇鍙戠エ</el-button>
+ <div class="fapiao-right">
+ <span class="money">閲戦锛�<font class="big">{{countMoney}}</font>鍏�</span>
+ <el-button size="mini" @click="seeInvoice">涓嬭浇鍙戠エ</el-button>
+ </div>
</div>
</div>
</div>
@@ -65,6 +78,7 @@
},
data() {
return {
+ date:'',
checkedInvoices: [1,2],
invoiceData:[],
checkAll:false,
@@ -72,8 +86,13 @@
finished: false,
current:1,
size:8,
- total:''
+ total:'',
+ filedId: [],
+ countMoney:0
}
+ },
+ created() {
+ this.date = this.$byutil.dateFormat(new Date(), "yyyy-MM");
},
mounted() {
this.getByCarNo()
@@ -86,15 +105,20 @@
},
getByCarNo() {
+ this.invoiceData = []
let url = this.$systemconfig.basePath + '/orderrecord/getByCarNo';
let params = {
carNo: this.$route.query.carNo,
phone: this.$route.query.phone,
current: this.current,
- size: this.size
+ size: this.size,
+ month: this.date
}
this.$byutil.postData(this,url,params,res => {
let row = res.data.records
+ row.forEach(e=>{
+ this.$set(e,'isShow',false)
+ })
this.total = res.data.total
if(row == null) {
this.finished = true
@@ -108,28 +132,105 @@
})
},
handleCheckAllChange(val) {
+ this.filedId = []
let ids = []
+ this.countMoney = 0
this.invoiceData.forEach(item => {
- ids.push(item.id)
+ ids.push(item.fileId)
item.isShow = val
+ this.countMoney += item.money
+ this.filedId.push(item.fileId)
})
},
handleCheckedCitiesChange(value) {
+ this.filedId = []
+ this.countMoney = 0
let checkedCount = value.length;
let ids = value.filter(item => {
return item.isShow == true
})
+
+ if(ids.length > 0) {
+ ids.forEach(item => {
+ this.countMoney += item.money
+ this.filedId.push(item.fileId)
+ })
+ }
this.checkAll = checkedCount === ids.length;
},
seeInvoice() { //鏌ョ湅鍙戠エ
- }
+ if(this.filedId.length == 0){
+ alert("璇疯嚦灏戦�夋嫨涓�椤�")
+ }else {
+ let result = this.filedId.join(",")
+ let url = this.$systemconfig.basePath + '/fileInfo/download/downloadZips';
+ let param = {
+ fileIds : result
+ }
+ this.$byutil.exportData(this,url,param,res => {
+ console.log(res,'res=========')
+ let blob = new Blob([res], {type: 'application/pdf'});
+ let downloadElement = document.createElement("a");
+ let href = window.URL.createObjectURL(blob); //鍒涘缓涓嬭浇鐨勯摼鎺�
+ downloadElement.href = href;
+ downloadElement.download = '鍙戠エ涓嬭浇'
+ document.body.appendChild(downloadElement);
+ downloadElement.click(); //鐐瑰嚮涓嬭浇
+ document.body.removeChild(downloadElement); //涓嬭浇瀹屾垚绉婚櫎鍏冪礌
+ window.URL.revokeObjectURL(href); //閲婃斁鎺塨lob瀵硅薄
+ })
+ }
+ },
+ changeDate(){
+ this.getByCarNo();
+ }
}
}
</script>
+<style lang="scss">
+ .fapiao-btn{
+ .el-checkbox{
+ width: 100px!important;
+
+ }
+ }
+ .invoice-date-box{
+ .el-input__prefix{
+ left: 21vw /* 10/7.5 */!important;
+ top: 2.4vw;
+ }
+ .el-input__inner{
+ border: none!important;
+ color: #303030;
+ font-size: 3.73vw /* 28/7.5 */;
+ font-weight: 500;
+ }
+ .el-icon-date:before{
+ background: url("../../../assets/images/down1.png") no-repeat center;
+ background-size: 100% 100%;
+ width: 2.67vw /* 20/7.5 */;
+ height: 2.67vw /* 20/7.5 */;
+ content: '';
+ display: block;
+ }
+ input::-webkit-input-placeholder{ /*WebKit browsers*/
+ color: #303030;
+ font-size: 3.73vw /* 28/7.5 */;
+ font-weight: 500;
+ }
+ .el-input--prefix .el-input__inner{
+ padding-left: 2.67vw /* 20/7.5 */;
+ }
+ .el-icon-circle-close:before{
+ content: '';
+ }
+ }
+
+</style>
<style lang="scss" scoped>
*{
- font-family: '骞虫柟';
+ font-family: '鑻规柟';
color: #626262;
}
::v-deep{
@@ -184,6 +285,12 @@
height: calc(100% - 11.73vw);
.invoiceForm-main-inside{
padding-bottom: 8vw /* 60/7.5 */;
+ .invoice-date-box{
+ background-color: #fff;
+ padding:1.33vw /* 10/7.5 */ 2.67vw /* 20/7.5 */;
+ display: flex;
+ border-bottom: 1px solid #f5f5f5;
+ }
}
}
@@ -206,6 +313,22 @@
background: #fafafa;
border-top: 1px solid #e5e5e5;
z-index: 9;
+ justify-content: space-between;
+ .fapiao-right{
+ display: flex;
+ }
+ .money{
+ display: flex;
+ align-self: center;
+ justify-content: center;
+ font-size: 3.73vw /* 28/7.5 */;
+ align-items: baseline;
+ margin-right: 4vw /* 30/7.5 */;
+ .big{
+ font-size: 4.8vw /* 36/7.5 */;
+ color: #dd894b;
+ }
+ }
}
.money-main{
align-self: flex-start;
@@ -219,7 +342,6 @@
}
.money-small{
font-size: 3.2vw /* 24/7.5 */;
- font-weight: lighter;
}
}
</style>
--
Gitblit v1.9.1