list.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. <template>
  2. <div class="list">
  3. <!-- 头部细节部分 -->
  4. <div class="title">
  5. <el-row>
  6. <el-col :span="24">
  7. <div class="top">
  8. <el-input placeholder="运单编号" class="input-demo" v-model="waybillNum"></el-input>
  9. <el-input placeholder="车牌号" class="input-demo" v-model="plateNum"></el-input>
  10. <el-input placeholder="发票号码" class="input-demo" v-model="invoiceNum"></el-input>
  11. <el-input placeholder="发票代码" class="input-demo" v-model="invoiceCode"></el-input>
  12. </div>
  13. </el-col>
  14. </el-row>
  15. <el-row>
  16. <el-col :span="24">
  17. <div class="top">
  18. <el-date-picker style="margin-left:1%;" v-model="invoiceMakeTime" type="daterange" value-format="yyyy-MM-dd HH:mm:SS" range-separator="至" start-placeholder="开票时间始" end-placeholder="开票时间止"></el-date-picker>
  19. <el-date-picker v-model="calculateTime" type="daterange" value-format="yyyy-MM-dd HH:mm:SS" range-separator="至" start-placeholder="扣费时间始" end-placeholder="扣费时间止"></el-date-picker>
  20. </div>
  21. </el-col>
  22. </el-row>
  23. <el-row>
  24. <el-col :span="24">
  25. <div class="top">
  26. <label style="margin-left: 1%;">发票抬头:</label>
  27. <el-select v-model="taxPlayerCode" placeholder="请选择发票抬头">
  28. <el-option
  29. v-for="item in companyList"
  30. :key="item.companyName"
  31. :label="item.companyName"
  32. :value="item.companyName">
  33. </el-option>
  34. </el-select>
  35. <el-button type="success" style="margin-left: 1%;" @click="firstLoadData">查询</el-button>
  36. <el-button type="success" style="margin-left: 1%;" @click="exportOut">导出</el-button>
  37. <!-- <el-button type="success" style="margin-left: 1%;" @click="packDownload"-->
  38. <!-- v-loading.fullscreen.lock="fullscreenLoading">打包下载-->
  39. <!-- </el-button>-->
  40. </div>
  41. </el-col>
  42. </el-row>
  43. </div>
  44. <!-- 头部细节部分结束 -->
  45. <!-- 表格部分 -->
  46. <template>
  47. <div class="tou">统计列表</div>
  48. <el-table
  49. v-loading="loading"
  50. ref="multipleTabletwo"
  51. :data="allmeterList"
  52. border
  53. tooltip-effect="dark"
  54. style="margin-bottom: 20px;">
  55. <el-table-column
  56. label="总金额(元)"
  57. show-overflow-tooltip>
  58. <template slot-scope="scope" show-overflow-tooltip>
  59. <span>{{scope.row.fee / 100}}</span>
  60. </template>
  61. </el-table-column>
  62. <el-table-column
  63. label="抵税金额(元)"
  64. show-overflow-tooltip>
  65. <template slot-scope="scope" show-overflow-tooltip>
  66. <span>{{scope.row.totalTaxAmount / 100}}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column
  70. prop="feeCount"
  71. label="计费条数"
  72. show-overflow-tooltip>
  73. </el-table-column>
  74. </el-table>
  75. </template>
  76. <template >
  77. <div class="tou">运单发票列表</div>
  78. <el-table
  79. class="table"
  80. v-loading="loading"
  81. ref="multipleTable"
  82. :data="usertable"
  83. :height="heightt"
  84. border
  85. tooltip-effect="dark">
  86. <el-table-column
  87. label="企业编号"
  88. prop="companyNum"
  89. show-overflow-tooltip>
  90. </el-table-column>
  91. <el-table-column
  92. prop="companyName"
  93. label="公司名称"
  94. show-overflow-tooltip>
  95. </el-table-column>
  96. <el-table-column
  97. prop="buyerTaxpayerCode"
  98. label="购方税号"
  99. show-overflow-tooltip>
  100. </el-table-column>
  101. <el-table-column
  102. prop="waybillNum"
  103. label="运单编号"
  104. show-overflow-tooltip>
  105. </el-table-column>
  106. <el-table-column
  107. prop="plateNum"
  108. label="车牌号"
  109. show-overflow-tooltip>
  110. </el-table-column>
  111. <el-table-column
  112. prop="exTime"
  113. label="交易时间"
  114. show-overflow-tooltip>
  115. </el-table-column>
  116. <el-table-column
  117. prop="sellerTaxpayerCode"
  118. label="销方税号"
  119. show-overflow-tooltip>
  120. </el-table-column>
  121. <el-table-column
  122. prop="sellerName"
  123. label="销方名称"
  124. show-overflow-tooltip>
  125. </el-table-column>
  126. <el-table-column
  127. prop="invoiceNum"
  128. label="发票号码"
  129. show-overflow-tooltip>
  130. </el-table-column>
  131. <el-table-column
  132. prop="invoiceCode"
  133. label="发票代码"
  134. show-overflow-tooltip>
  135. </el-table-column>
  136. <el-table-column
  137. prop="invoiceMakeTime"
  138. label="开票时间"
  139. show-overflow-tooltip>
  140. </el-table-column>
  141. <el-table-column
  142. prop="enStation"
  143. label="入口收费站"
  144. width="120"
  145. show-overflow-tooltip>
  146. </el-table-column>
  147. <el-table-column
  148. prop="exStation"
  149. label="出口收费站"
  150. width="120"
  151. show-overflow-tooltip>
  152. </el-table-column>
  153. <el-table-column
  154. prop="invoiceCode"
  155. label="发票代码"
  156. show-overflow-tooltip>
  157. </el-table-column>
  158. <el-table-column
  159. prop="invoiceNum"
  160. label="发票号码"
  161. show-overflow-tooltip>
  162. </el-table-column>
  163. <el-table-column
  164. prop="transactionId"
  165. label="交易ID"
  166. show-overflow-tooltip>
  167. </el-table-column>
  168. <el-table-column
  169. label="交易金额(元)"
  170. width="120"
  171. show-overflow-tooltip>
  172. <template slot-scope="scope" show-overflow-tooltip>
  173. <span>{{scope.row.fee / 100}}</span>
  174. </template>
  175. </el-table-column>
  176. <el-table-column
  177. label="价税合计(元)"
  178. width="120"
  179. show-overflow-tooltip>
  180. <template slot-scope="scope" show-overflow-tooltip>
  181. <span>{{scope.row.totalAmount / 100}}</span>
  182. </template>
  183. </el-table-column>
  184. <el-table-column
  185. label="税额(元)"
  186. show-overflow-tooltip>
  187. <template slot-scope="scope" show-overflow-tooltip>
  188. <span>{{scope.row.totalTaxAmount / 100}}</span>
  189. </template>
  190. </el-table-column>
  191. <el-table-column
  192. prop="amount"
  193. label="金额"
  194. show-overflow-tooltip>
  195. <template slot-scope="scope">
  196. <span>{{scope.row.amount/100| rounding}}</span>
  197. </template>
  198. </el-table-column>
  199. <el-table-column
  200. prop="taxRate"
  201. label="税率"
  202. show-overflow-tooltip>
  203. </el-table-column>
  204. <el-table-column
  205. prop="invoiceHtmlUrl"
  206. label="预览地址"
  207. show-overflow-tooltip>
  208. </el-table-column>
  209. <el-table-column
  210. prop="invoiceUrl"
  211. label="下载地址"
  212. show-overflow-tooltip>
  213. </el-table-column>
  214. <el-table-column
  215. prop="billStatus"
  216. label="运单状态"
  217. show-overflow-tooltip>
  218. <template slot-scope="scope">
  219. <span v-if="scope.row.billStatus == 1" style="color: green">未结束</span>
  220. <span v-else-if="scope.row.billStatus == 2" style="color: green">开票中</span>
  221. <span v-else-if="scope.row.billStatus == 3" style="color: green">开票完成</span>
  222. <span v-else-if="scope.row.billStatus == 4" style="color: red">超时运单</span>
  223. </template>
  224. </el-table-column>
  225. <el-table-column
  226. prop="calculateTime"
  227. label="扣费时间"
  228. show-overflow-tooltip>
  229. </el-table-column>
  230. <el-table-column
  231. label="操作"
  232. width="80">
  233. <template slot-scope="scope" show-overflow-tooltip>
  234. <span style="cursor:pointer;color:blue" @click="checkLook(scope.row.invoiceUrl)">下载</span>
  235. </template>
  236. </el-table-column>
  237. </el-table>
  238. </template>
  239. <!-- 分页 -->
  240. <div class="block">
  241. <el-pagination
  242. @size-change="handleSizeChange"
  243. @current-change="handleCurrentChange"
  244. :current-page="current"
  245. :page-sizes="[6, 8, 10]"
  246. :page-size="pagesize"
  247. layout="total, sizes, prev, pager, next, jumper"
  248. :total="total">
  249. </el-pagination>
  250. </div>
  251. </div>
  252. </template>
  253. <script>
  254. import FileSaver from "file-saver";
  255. import XLSX from "xlsx";
  256. export default{
  257. data() {
  258. return {
  259. loading: false,
  260. fullscreenLoading: false,
  261. addList: false,
  262. heightt:'0px',
  263. current: 1,
  264. pagesize: 8,
  265. total: 0,
  266. usertable: [],
  267. companyList: [],
  268. waybillNum: "",
  269. taxPlayerCode: "",
  270. plateNum: "",
  271. invoiceNum: "",
  272. invoiceCode: "",
  273. invoiceMakeTime:'',
  274. calculateTime:'',
  275. endTime: "",
  276. batchNumber: '',
  277. invoiceUrl: '',
  278. allmeterList:[],
  279. formUserList: {
  280. "userName":"",
  281. "roleId":"",
  282. "userId":""
  283. },
  284. packDownloadDisabled: false,
  285. }
  286. },
  287. created() {
  288. this.heightt = tableHeight*0.5+150;
  289. console.log(this.heightt)
  290. this.initCompanyList();
  291. },
  292. methods: {
  293. firstLoadData(){
  294. this.current = 1;
  295. this.pagesize = 8;
  296. this.loadData();
  297. },
  298. // 列表展示
  299. async loadData() {
  300. const formData = new FormData();
  301. formData.append('current', this.current);
  302. formData.append('size', this.pagesize);
  303. formData.append('waybillNum', this.waybillNum);
  304. formData.append('plateNum', this.plateNum);
  305. formData.append('companyName', this.taxPlayerCode);
  306. formData.append('customerName', sessionStorage.getItem('userName'));
  307. formData.append('invoiceNum', this.invoiceNum);
  308. formData.append('invoiceCode', this.invoiceCode);
  309. formData.append('invoiceMakeTime', this.invoiceMakeTime);
  310. formData.append('interType', 5);
  311. formData.append('calculateTime', this.calculateTime);
  312. const response = await this.$http.post(`noCar/findNocarInvoices`, formData);
  313. if (response.data.code === 0) {
  314. this.loading = false;
  315. this.usertable = response.data.data.records;
  316. this.total = response.data.data.total;
  317. this.loadAllMeter();
  318. };
  319. },
  320. //打包下载
  321. async packDownload() {
  322. this.fullscreenLoading = true;
  323. var url = `http://invoice.back.jkcredit.com/package/download?&userId=${this.formUserList.userId}
  324. &startTime=${this.startTime}&endTime=${this.endTime}&waybillNum=${this.waybillNum}&plateNum=${this.plateNum}
  325. &invoiceNum=${this.invoiceNum}&taxpayerCode=${this.taxPlayerCode}&batchNumber=${this.batchNumber}`;
  326. window.location.href = url;
  327. this.packDownloadDisabled = true;
  328. this.$message({type: 'info', message: '正在下载,请稍等,请勿重复下载。'});
  329. this.fullscreenLoading = false;
  330. // console.log(this.formList.nums);
  331. } ,
  332. async initCompanyList(){
  333. const response = await this.$http.post(`lowerService/customeRecQueryList`, {"customerName":sessionStorage.getItem('userName')});
  334. if (response.data.code === 0) {
  335. this.companyList = response.data.data;
  336. } if(this.companyList == null || typeof this.companyList == 'undefined' || this.companyList =='' || this.companyList.length==0){
  337. this.companyList = [{'companyName':'.'}];
  338. }
  339. this.taxPlayerCode = this.companyList[0]['companyName'];
  340. this.loadData();
  341. },
  342. // 查询发票统计
  343. async loadAllMeter() {
  344. const formData = new FormData();
  345. formData.append('waybillNum', this.waybillNum);
  346. formData.append('plateNum', this.plateNum);
  347. formData.append('companyName', this.taxPlayerCode);
  348. formData.append('invoiceNum', this.invoiceNum);
  349. formData.append('customerName', sessionStorage.getItem('userName'));
  350. formData.append('invoiceCode', this.invoiceCode);
  351. formData.append('batchNumber', this.batchNumber);
  352. formData.append('invoiceMakeTime', this.invoiceMakeTime);
  353. formData.append('calculateTime', this.calculateTime);
  354. const response = await this.$http.post(`noCar/findNocarInvoicesStatic`, formData);
  355. if (response.data.code === 0) {
  356. this.loading = false;
  357. var allmeter = response.data.data;
  358. this.allmeterList = [];
  359. this.allmeterList.push(allmeter);
  360. console.log(this.allmeterList)
  361. };
  362. },
  363. // 展示发票全部信息
  364. checkLook(user) {
  365. window.location.href= user;
  366. },
  367. formartNum(wb){
  368. var sheet = wb['Sheets']['Sheet1'];
  369. var replaceTemp = [];
  370. debugger;
  371. for(var i in sheet){
  372. if(sheet[i]['v'] == '税额(元)' || sheet[i]['v'] == '价税合计(元)' || sheet[i]['v'] == '交易金额(元)' || sheet[i]['v'] == '税率'){
  373. replaceTemp.push(i.replace(/[0-9]/g,''));
  374. continue;
  375. }
  376. if(replaceTemp.includes(i.replace(/[0-9]/g,''))){
  377. sheet[i]['t']='n';
  378. }
  379. }
  380. },
  381. //导出功能
  382. async exportExcel () {
  383. const loading = this.$loading({
  384. lock: true,
  385. text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
  386. spinner: 'el-icon-loading',
  387. background: 'rgba(0, 0, 0, 0.7)'
  388. });
  389. let curr = this.current;
  390. let pagesize1 = this.pagesize;
  391. this.current = 1;
  392. this.pagesize = this.total;
  393. await this.loadData();
  394. // 设置当前日期
  395. let time = new Date();
  396. //console.log(time);
  397. let year = time.getFullYear();
  398. let month = time.getMonth() + 1;
  399. let day = time.getDate();
  400. let name = "运单发票列表_"+year + "" + month + "" + day;
  401. // console.log(name)
  402. /* generate workbook object from table */
  403. // .table要导出的是哪一个表格
  404. var wb = XLSX.utils.table_to_book(document.querySelector(".table"),{ raw: true });
  405. this.formartNum(wb);
  406. /* get binary string as output */
  407. var wbout = XLSX.write(wb, {
  408. bookType: "xlsx",
  409. bookSST: true,
  410. type: "array"
  411. });
  412. try {
  413. // name+'.xlsx'表示导出的excel表格名字
  414. FileSaver.saveAs(
  415. new Blob([wbout], { type: "application/octet-stream" }),
  416. name + ".xlsx"
  417. );
  418. } catch (e) {
  419. if (typeof console !== "undefined") console.log(e, wbout);
  420. }
  421. this.current = curr;
  422. this.pagesize = pagesize1;
  423. this.loadData();
  424. loading.close();
  425. return wbout;
  426. },
  427. async exportOut() {
  428. const loading = this.$loading({
  429. lock: true,
  430. text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
  431. spinner: 'el-icon-loading',
  432. background: 'rgba(0, 0, 0, 0.7)'
  433. });
  434. const formData = new FormData();
  435. formData.append('current', 1);
  436. formData.append('size', this.total);
  437. formData.append('waybillNum', this.waybillNum);
  438. formData.append('plateNum', this.plateNum);
  439. formData.append('companyName', this.taxPlayerCode);
  440. formData.append('customerName', sessionStorage.getItem('userName'));
  441. formData.append('invoiceNum', this.invoiceNum);
  442. formData.append('invoiceCode', this.invoiceCode);
  443. formData.append('invoiceMakeTime', this.invoiceMakeTime);
  444. formData.append('interType', 5);
  445. formData.append('calculateTime', this.calculateTime);
  446. const response = await this.$http.post(`noCar/findNocarInvoices`, formData);
  447. if (response.data.code === 0) {
  448. // 设置当前日期
  449. let time = new Date();
  450. //console.log(time);
  451. let year = time.getFullYear();
  452. let month = time.getMonth() + 1;
  453. let day = time.getDate();
  454. let name = "无车发票查询列表_"+year + "" + month + "" + day;
  455. let cloums = [
  456. {"title":"企业编号","key":"companyNum"},
  457. {"title":"公司名称","key":"companyName"},
  458. {"title":"运单号","key":"waybillNum"},
  459. {"title":"购方税号","key":"buyerTaxpayerCode"},
  460. {"title":"车牌号码","key":"plateNum"},
  461. {"title":"运单开始时间","key":"waybillStartTime"},
  462. {"title":"运单结束时间","key":"waybillEndTime"},
  463. {"title":"销方税号","key":"sellerTaxpayerCode"},
  464. {"title":"销方名称","key":"sellerName"},
  465. {"title":"入口收费站","key":"enStation"},
  466. {"title":"出口收费站","key":"exStation"},
  467. {"title":"发票代码","key":"invoiceCode"},
  468. {"title":"发票号码","key":"invoiceNum"},
  469. {"title":"交易Id","key":"transactionId"},
  470. {"title":"开票时间","key":"invoiceMakeTime"},
  471. {"title":"交易时间","key":"exTime"},
  472. {"title":"交易金额(元)","key":"fee"},
  473. {"title":"价税合计(元)","key":"totalAmount"},
  474. {"title":"税额(元)","key":"totalTaxAmount"},
  475. {"title":"金额(元)","key":"amount"},
  476. {"title":"税率","key":"taxRate"},
  477. {"title":"扣费时间","key":"calculateTime"},
  478. {"title":"运单状态","key":"billStatus"},
  479. {"title":"预览地址","key":"invoiceHtmlUrl"},
  480. {"title":"下载地址","key":"invoiceUrl"}
  481. ];
  482. debugger;
  483. await this.exportExcelComm(cloums,response.data.data.records,name,loading);
  484. }
  485. },
  486. formatJson (filterVal, jsonData) {
  487. return jsonData.map(v => filterVal.map(j => {
  488. if(j == 'billStatus'){
  489. if(v[j] == 1){
  490. return "未结束";
  491. } else if(v[j] == -2){
  492. return "上传失败";
  493. }else if(v[j] == -3){
  494. return "指令结束上传失败";
  495. }else if(v[j] == 2){
  496. return "开票中";
  497. }else if(v[j] == 3){
  498. return "开票完成";
  499. }else {
  500. return "超时运单";
  501. }
  502. }else if(j =='fee'){
  503. return v[j]/100;
  504. }else if(j =='totalAmount'){
  505. return v[j]/100;
  506. }else if(j =='totalTaxAmount'){
  507. return v[j]/100;
  508. }else if(j =='amount'){
  509. return v[j]/100;
  510. }else{
  511. return v[j];
  512. }
  513. }));
  514. },
  515. // 导出Excel
  516. exportExcelComm(columns,list,excelName,loading){
  517. require.ensure([], () => {
  518. const { export_json_to_excel } = require('@/vendor/Export2Excel');
  519. let tHeader = []
  520. let filterVal = []
  521. columns.forEach(item =>{
  522. tHeader.push(item.title)
  523. filterVal.push(item.key)
  524. })
  525. const data = this.formatJson(filterVal, list);
  526. debugger;
  527. export_json_to_excel(tHeader, data, excelName);
  528. loading.close();
  529. })
  530. },
  531. // 分页方法
  532. handleSizeChange(val) {
  533. this.pagesize = val;
  534. this.loadData();
  535. console.log(`每页 ${val} 条`);
  536. },
  537. handleCurrentChange(val) {
  538. this.current = val;
  539. this.loadData();
  540. console.log(`当前页: ${val}`);
  541. },
  542. }
  543. };
  544. </script>
  545. <style>
  546. .list {
  547. border: 1px solid #d9d9d9;
  548. border-radius: 10px;
  549. overflow-y: scroll;
  550. height:100%;
  551. }
  552. .list .title {
  553. font-size: 5px;
  554. margin-bottom: 20px;
  555. }
  556. .list .top {
  557. padding-top: 20px;
  558. padding-left: 20px;
  559. }
  560. .list .block {
  561. font-size: 5px;
  562. text-align: center;
  563. margin-top: 15px;
  564. margin-bottom: 20px;
  565. }
  566. .list .input-demo {
  567. display: inline-block;
  568. width: 20%;
  569. margin-left: 1%;
  570. }
  571. .list .tou {
  572. text-align: center;
  573. margin-bottom: 10px;
  574. font-size: 20px;
  575. height: 20px;
  576. line-height: 20px;
  577. padding-top: 5px;
  578. }
  579. .list .line {
  580. margin-top: 15px;
  581. margin-bottom: 15px;
  582. width: 100%;
  583. height: 2px;
  584. background-color: #d9d9d9;
  585. }
  586. </style>