waybillList.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <div class="waybillList">
  3. <!-- 头部细节部分 -->
  4. <div class="title">
  5. <el-row>
  6. <el-col :span="24">
  7. <div class="top">
  8. <el-select v-model="companyName" placeholder="请选择公司名称">
  9. <el-option
  10. v-for="item in companyList"
  11. :key="item.companyName"
  12. :label="item.companyName"
  13. :value="item.companyName">
  14. </el-option>
  15. </el-select>
  16. <el-input placeholder="运单编号" class="theinput" v-model="billNum"></el-input>
  17. <el-input placeholder="车牌号" class="theinput" v-model="plateNum"></el-input>
  18. <el-select v-model="success" placeholder="是否成功">
  19. <el-option
  20. v-for="item in optionone"
  21. :key="item.value"
  22. :label="item.label"
  23. :value="item.value">
  24. </el-option>
  25. </el-select>
  26. <el-button type="success" style="margin-left: 1%;" @click="firstLoadData">查询</el-button>
  27. <el-button type="success" style="margin-left: 1%;" @click="exportExcel">导出</el-button>
  28. <!-- <el-button type="info" style="margin-left: 1%;">重置</el-button> -->
  29. </div>
  30. </el-col>
  31. </el-row>
  32. <el-row>
  33. <el-col :span="24">
  34. <div class="top">
  35. <el-date-picker
  36. v-model="startBegin"
  37. type="datetime"
  38. value-format="yyyy-MM-dd HH:mm:SS"
  39. placeholder="运单上传开始指令始">
  40. </el-date-picker>
  41. <el-date-picker
  42. class="input-demo"
  43. v-model="startEnd"
  44. type="datetime"
  45. value-format="yyyy-MM-dd HH:mm:SS"
  46. placeholder="运单上传开始指令止">
  47. </el-date-picker>
  48. <el-date-picker
  49. class="input-demo"
  50. v-model="endBegin"
  51. type="datetime"
  52. value-format="yyyy-MM-dd HH:mm:SS"
  53. placeholder="运单上传结束指令始">
  54. </el-date-picker>
  55. <el-date-picker
  56. class="input-demo"
  57. v-model="endEnd"
  58. type="datetime"
  59. value-format="yyyy-MM-dd HH:mm:SS"
  60. placeholder="运单上传结束指令止">
  61. </el-date-picker>
  62. </div>
  63. </el-col>
  64. </el-row>
  65. </div>
  66. <!-- 头部细节部分结束 -->
  67. <!-- 表格部分 -->
  68. <template>
  69. <el-table
  70. class="table"
  71. v-loading="loading"
  72. ref="multipleTable"
  73. :data="usertabletwo"
  74. :height="heightt"
  75. border
  76. tooltip-effect="dark">
  77. <el-table-column
  78. label="运单编号"
  79. prop="billNum"
  80. show-overflow-tooltip>
  81. </el-table-column>
  82. <el-table-column
  83. prop="taxplayerCode"
  84. label="税号"
  85. show-overflow-tooltip>
  86. </el-table-column>
  87. <el-table-column
  88. label="车牌号码"
  89. prop="plateNum"
  90. show-overflow-tooltip>
  91. </el-table-column>
  92. <el-table-column
  93. label="车牌颜色"
  94. show-overflow-tooltip>
  95. <template slot-scope="scope">
  96. <span v-if="scope.row.plateColor == 0">蓝色</span>
  97. <span v-else-if="scope.row.plateColor == 1">黄色</span>
  98. <span v-else-if="scope.row.plateColor == 2">黑色</span>
  99. <span v-else-if="scope.row.plateColor == 3">白色</span>
  100. <span v-else-if="scope.row.plateColor == 4">渐变绿色</span>
  101. <span v-else-if="scope.row.plateColor == 5">黄绿渐变色</span>
  102. <span v-else-if="scope.row.plateColor == 6">蓝白渐变色</span>
  103. <span v-else-if="scope.row.plateColor == 9">未确定</span>
  104. </template>
  105. </el-table-column>
  106. <el-table-column
  107. prop="startTime"
  108. label="运单开始时间"
  109. show-overflow-tooltip>
  110. </el-table-column>
  111. <el-table-column
  112. prop="sourceAddr"
  113. label="运单开始地址"
  114. show-overflow-tooltip>
  115. </el-table-column>
  116. <el-table-column
  117. prop="destAddr"
  118. label="运单目的地址"
  119. show-overflow-tooltip>
  120. </el-table-column>
  121. <el-table-column
  122. prop="predictEndTime"
  123. label="运单预计完成时间"
  124. show-overflow-tooltip>
  125. </el-table-column>
  126. <el-table-column
  127. prop="fee"
  128. label="运单费用(元)"
  129. show-overflow-tooltip>
  130. <template slot-scope="scope" show-overflow-tooltip>
  131. <span>{{scope.row.fee / 100}}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column
  135. label="运单状态"
  136. show-overflow-tooltip>
  137. <template slot-scope="scope">
  138. <span v-if="scope.row.billwayStatus == 1" style="color: green">未结束</span>
  139. <span v-else-if="scope.row.billwayStatus == -2" style="color: red">失败</span>
  140. <span v-else-if="scope.row.billwayStatus == -3" style="color: red">指令上传失败</span>
  141. <span v-else-if="scope.row.billwayStatus == 2" style="color: green">开票中</span>
  142. <span v-else-if="scope.row.billwayStatus == 3" style="color: green">开票完成</span>
  143. <span v-else-if="scope.row.billwayStatus == 4" style="color: red">超时运单</span>
  144. </template>
  145. </el-table-column>
  146. <el-table-column
  147. label="是否成功"
  148. show-overflow-tooltip>
  149. <template slot-scope="scope">
  150. <span v-if="scope.row.billwayStatus == -2 || scope.row.billwayStatus == -3" style="color: red">失败</span>
  151. <span v-else-if="scope.row.billwayStatus != -2 && scope.row.billwayStatus != -3" style="color: green">成功</span>
  152. </template>
  153. </el-table-column>
  154. <el-table-column
  155. prop="failReason"
  156. label="失败原因"
  157. show-overflow-tooltip>
  158. </el-table-column>
  159. </el-table>
  160. </template>
  161. <div class="blocks">
  162. <el-pagination
  163. @size-change="handleSize"
  164. @current-change="handleCurrent"
  165. :current-page="currenttwo"
  166. :page-sizes="[6, 8, 10]"
  167. :page-size="pagesizetwo"
  168. layout="total, sizes, prev, pager, next, jumper"
  169. :total="totaltwo">
  170. </el-pagination>
  171. </div>
  172. </div>
  173. </template>
  174. <script>
  175. import FileSaver from "file-saver";
  176. import XLSX from "xlsx";
  177. export default{
  178. data() {
  179. return {
  180. loading: false,
  181. billNum: '',
  182. plateNum: '',
  183. batchNumber: '',
  184. startBegin: '',
  185. startEnd: '',
  186. endBegin: '',
  187. success:'',
  188. endEnd: '',
  189. hightt:'0px',
  190. // taxPlayerCode: '',
  191. // status: '',
  192. currenttwo: 1,
  193. pagesizetwo: 8,
  194. totaltwo: 0,
  195. optionone: [{
  196. value: '1',
  197. label: '成功'
  198. }, {
  199. value: '2',
  200. label: '失败'
  201. }],
  202. // batch: '',
  203. companyList:[],
  204. companyName:'',
  205. usertabletwo: [],
  206. customerName:'',
  207. }
  208. },
  209. created() {
  210. this.heightt = tableHeight;
  211. this.customerName = sessionStorage.getItem('userName');
  212. this.initCompanyList();
  213. },
  214. methods: {
  215. firstLoadData(){
  216. this.currenttwo = 1;
  217. this.pagesizetwo = 8;
  218. this.loadDataCar();
  219. },
  220. // 列表展示
  221. async loadDataCar() {
  222. const formData = new FormData();
  223. formData.append('current', this.currenttwo);
  224. formData.append('size', this.pagesizetwo);
  225. formData.append('success', this.success);
  226. formData.append('customerName', this.customerName);
  227. formData.append('companyName', this.companyName);
  228. formData.append('billNum', this.billNum);
  229. formData.append('billNumN', this.billNum);
  230. formData.append('plateNum', this.plateNum);
  231. // formData.append('batchNumber', this.batchNumber);
  232. formData.append('startBegin', this.startBegin);
  233. formData.append('startEnd', this.startEnd);
  234. formData.append('endBegin', this.endBegin);
  235. formData.append('endEnd', this.endEnd);
  236. // formData.append('isSuccess', 1);
  237. const response = await this.$http.post(`noCar/findBillWayCust`, formData);
  238. if (response.data.code === 0) {
  239. this.loading = false;
  240. this.usertabletwo = response.data.data.records;
  241. this.totaltwo = response.data.data.total;
  242. }
  243. },
  244. async initCompanyList(){
  245. const response = await this.$http.post(`lowerService/customeRecQueryList`, {"customerName":sessionStorage.getItem('userName')});
  246. if (response.data.code === 0) {
  247. this.companyList = response.data.data;
  248. } if(this.companyList == null || typeof this.companyList == 'undefined' || this.companyList =='' || this.companyList.length==0){
  249. this.companyList = [{'companyName':'.'}];
  250. }
  251. this.companyName = this.companyList[0]['companyName'];
  252. this.loadDataCar();
  253. },
  254. //查看
  255. //导出功能
  256. exportOut() {
  257. var url = `http://invoice.back.jkcredit.com/carFreeCarrierBill/billExport?&userId=${this.formUserList.userId}`;
  258. window.location.href= url;
  259. },
  260. formartNum(wb){
  261. var sheet = wb['Sheets']['Sheet1'];
  262. var replaceTemp = [];
  263. debugger;
  264. for(var i in sheet){
  265. if(sheet[i]['v'] == '运单费用(元)'){
  266. replaceTemp.push(i.replace(/[0-9]/g,''));
  267. continue;
  268. }
  269. if(replaceTemp.includes(i.replace(/[0-9]/g,''))){
  270. sheet[i]['t']='n';
  271. }
  272. }
  273. },
  274. async exportExcel() {
  275. const loading = this.$loading({
  276. lock: true,
  277. text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
  278. spinner: 'el-icon-loading',
  279. background: 'rgba(0, 0, 0, 0.7)'
  280. });
  281. const formData = new FormData();
  282. formData.append('current', 1);
  283. formData.append('size', this.totaltwo);
  284. formData.append('success', this.success);
  285. formData.append('customerName', this.customerName);
  286. formData.append('companyName', this.companyName);
  287. formData.append('billNum', this.billNum);
  288. formData.append('billNumN', this.billNum);
  289. formData.append('plateNum', this.plateNum);
  290. // formData.append('batchNumber', this.batchNumber);
  291. formData.append('startBegin', this.startBegin);
  292. formData.append('startEnd', this.startEnd);
  293. formData.append('endBegin', this.endBegin);
  294. formData.append('endEnd', this.endEnd);
  295. // formData.append('isSuccess', 1);
  296. const response = await this.$http.post(`noCar/findBillWayCust`, formData);
  297. if (response.data.code === 0) {
  298. // 设置当前日期
  299. let time = new Date();
  300. //console.log(time);
  301. let year = time.getFullYear();
  302. let month = time.getMonth() + 1;
  303. let day = time.getDate();
  304. let name = "无车运单查询列表_"+year + "" + month + "" + day;
  305. let cloums = [
  306. {"title":"公司名称","key":"companyName"},
  307. {"title":"运单号","key":"billNum"},
  308. {"title":"税号","key":"taxplayerCode"},
  309. {"title":"车牌号码","key":"plateNum"},
  310. {"title":"运单开始时间","key":"startTime"},
  311. {"title":"运单结束时间","key":"predictEndTime"},
  312. {"title":"运单开始地址","key":"sourceAddr"},
  313. {"title":"运单结束地址","key":"destAddr"},
  314. {"title":"运单费用(元)","key":"fee"},
  315. {"title":"运单状态","key":"billwayStatus"},
  316. {"title":"失败原因","key":"failReason"},
  317. {"title":"运单类型","key":"hisFlag"},
  318. ];
  319. this.exportExcelComm(cloums,response.data.data.records,name,loading)
  320. }
  321. },
  322. formatJson (filterVal, jsonData) {
  323. return jsonData.map(v => filterVal.map(j => {
  324. if(j == 'billwayStatus'){
  325. if(v[j] == 1){
  326. return "未结束";
  327. } else if(v[j] == -2){
  328. return "上传失败";
  329. }else if(v[j] == -3){
  330. return "指令结束上传失败";
  331. }else if(v[j] == 2){
  332. return "开票中";
  333. }else if(v[j] == 3){
  334. return "开票完成";
  335. }else {
  336. return "超时运单";
  337. }
  338. }else if(j=='hisFlag'){
  339. if(v[j] == 0){
  340. return "实时运单";
  341. }else{
  342. return "历史运单";
  343. }
  344. }else if(j =='fee'){
  345. return v[j]/100;
  346. }else{
  347. return v[j];
  348. }
  349. }));
  350. },
  351. // 导出Excel
  352. exportExcelComm(columns,list,excelName,loading){
  353. require.ensure([], () => {
  354. const { export_json_to_excel } = require('@/vendor/Export2Excel');
  355. let tHeader = []
  356. let filterVal = []
  357. columns.forEach(item =>{
  358. tHeader.push(item.title)
  359. filterVal.push(item.key)
  360. })
  361. const data = this.formatJson(filterVal, list);
  362. export_json_to_excel(tHeader, data, excelName);
  363. console.log(1111);
  364. console.log(new Date().getMilliseconds)
  365. loading.close();
  366. debugger
  367. })
  368. },
  369. // 分页方法
  370. handleSize(val) {
  371. this.pagesizetwo = val;
  372. this.loadDataCar();
  373. console.log(`每页 ${val} 条`);
  374. },
  375. handleCurrent(val) {
  376. this.currenttwo = val;
  377. this.loadDataCar();
  378. console.log(`当前页: ${val}`);
  379. }
  380. }
  381. };
  382. </script>
  383. <style>
  384. .waybillList {
  385. border: 1px solid #d9d9d9;
  386. border-radius: 10px;
  387. }
  388. .waybillList .upload-demo {
  389. display: inline-block;
  390. }
  391. .waybillList .title {
  392. font-size: 5px;
  393. margin-bottom: 20px;
  394. }
  395. .waybillList .top {
  396. padding-top: 20px;
  397. padding-left: 20px;
  398. }
  399. .waybillList .text {
  400. display: inline-block;
  401. color: #000;
  402. font-size: 16px ;
  403. margin-left: 1%;
  404. }
  405. .waybillList .tou {
  406. font-size: 20px;
  407. height: 30px;
  408. line-height: 30px;
  409. padding-top: 15px;
  410. }
  411. .waybillList .line {
  412. margin-top: 15px;
  413. margin-bottom: 15px;
  414. width: 100%;
  415. height: 2px;
  416. background-color: #d9d9d9;
  417. }
  418. .waybillList .theinput {
  419. display: inline-block;
  420. width: 20%;
  421. }
  422. .waybillList .styleType {
  423. margin-top: 20px;
  424. margin-bottom: 20px;
  425. }
  426. .waybillList .input-demo {
  427. display: inline-block;
  428. width: 20%;
  429. margin-left: 1%;
  430. }
  431. .waybillList .block {
  432. font-size: 5px;
  433. text-align: center;
  434. margin-top: 15px;
  435. margin-bottom: 20px;
  436. }
  437. .waybillList .blocks {
  438. font-size: 5px;
  439. text-align: center;
  440. margin-top: 20px;
  441. padding-bottom: 20px;
  442. }
  443. </style>