over.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <template>
  2. <div class="over">
  3. <!-- 头部细节部分 -->
  4. <div class="title">
  5. <el-row>
  6. <el-col :span="24">
  7. <div class="top">
  8. <span style="margin-top: 10px;">导入文件:</span>
  9. <el-upload
  10. class="upload-demo"
  11. ref="upload"
  12. action="http://invoice.back.jkcredit.com/dishonestuser/upload"
  13. :on-preview="handlePreview"
  14. :on-remove="handleRemove"
  15. :on-change="handleSuccess"
  16. :auto-upload="false">
  17. <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
  18. <el-button style="margin-left: 10px;" size="small" type="success" @click="batchUpload" v-loading.fullscreen.lock="fullscreenLoading">开票</el-button>
  19. </el-upload>
  20. </div>
  21. </el-col>
  22. </el-row>
  23. <el-row>
  24. <el-col :span="24">
  25. <div class="top">
  26. <el-input placeholder="主体账号名称" class="input-demo" v-model="companyName"></el-input>
  27. <el-input placeholder="批次号" class="input-demo" v-model="batchNumer"></el-input>
  28. <el-button style="margin-left: 1%;" @click="DownloadTemplate">下载模板</el-button>
  29. <el-button type="success" style="margin-left: 1%;" @click="firstLoadData">查询</el-button>
  30. <!-- <el-button type="info" style="margin-left: 1%;">重置</el-button> -->
  31. </div>
  32. </el-col>
  33. </el-row>
  34. </div>
  35. <!-- 头部细节部分结束 -->
  36. <!-- 表格部分 -->
  37. <template>
  38. <el-table
  39. class="table"
  40. v-loading="loading"
  41. ref="multipleTable"
  42. :data="usertable"
  43. :height="heightt"
  44. border
  45. tooltip-effect="dark">
  46. <el-table-column
  47. label="用户名"
  48. prop="customerName"
  49. show-overflow-tooltip>
  50. </el-table-column>
  51. <!-- <el-table-column
  52. label="用户手机号"
  53. prop="customerPhone"
  54. show-overflow-tooltip>
  55. </el-table-column> -->
  56. <el-table-column
  57. prop="company"
  58. label="主账号名称"
  59. show-overflow-tooltip>
  60. </el-table-column>
  61. <el-table-column
  62. prop="batchNumber"
  63. label="批次号"
  64. show-overflow-tooltip>
  65. </el-table-column>
  66. <el-table-column
  67. label="创建时间"
  68. show-overflow-tooltip>
  69. <template slot-scope="scope" show-overflow-tooltip>
  70. <span>{{scope.row.createTime | fmtDate}}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column
  74. label="操作"
  75. width="80">
  76. <template slot-scope="scope" show-overflow-tooltip>
  77. <span style="cursor:pointer;color: blue;" @click="checkLook(scope.row.batchNumber)">查看</span>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. </template>
  82. <!-- 分页 -->
  83. <div class="block">
  84. <el-pagination
  85. @size-change="handleSizeChange"
  86. @current-change="handleCurrentChange"
  87. :current-page="current"
  88. :page-sizes="[6, 8, 10]"
  89. :page-size="pagesize"
  90. layout="total, sizes, prev, pager, next, jumper"
  91. :total="total">
  92. </el-pagination>
  93. </div>
  94. <!-- 查看 -->
  95. <el-dialog
  96. @close="handleEditDialogClose"
  97. :visible.sync="addList"
  98. style="font-size: 0px;">
  99. <template>
  100. <div class="tou">运单列表</div>
  101. <div class="line"></div>
  102. <div class="styleType">
  103. <el-input placeholder="运单编号" class="theinput" v-model="billNum"></el-input>
  104. <el-button type="success" style="margin-left: 1%;" @click="twoLoadData">查询</el-button>
  105. <!-- <el-button type="info" style="margin-left: 1%;">重置</el-button> -->
  106. </div>
  107. <el-table
  108. v-loading="loading"
  109. ref="multipleTable"
  110. :data="usertabletwo"
  111. border
  112. tooltip-effect="dark">
  113. <el-table-column
  114. label="运单编号"
  115. prop="billNum"
  116. show-overflow-tooltip>
  117. </el-table-column>
  118. <el-table-column
  119. prop="destAddr"
  120. label="目的地址"
  121. show-overflow-tooltip>
  122. </el-table-column>
  123. <el-table-column
  124. prop="predictEndTime"
  125. label="结束时间"
  126. show-overflow-tooltip>
  127. </el-table-column>
  128. <el-table-column
  129. label="是否成功"
  130. show-overflow-tooltip>
  131. <template slot-scope="scope">
  132. <span v-if="scope.row.billwayStatus == -2 || scope.row.billwayStatus == -3" style="color: red">失败</span>
  133. <span v-else-if="scope.row.billwayStatus != -2 && scope.row.billwayStatus != -3" style="color: green">成功</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column
  137. prop="failReason"
  138. label="失败原因"
  139. show-overflow-tooltip>
  140. </el-table-column>
  141. </el-table>
  142. </template>
  143. <div class="blocks">
  144. <el-pagination
  145. @size-change="handleSize"
  146. @current-change="handleCurrent"
  147. :current-page="currenttwo"
  148. :page-sizes="[6, 8, 10]"
  149. :page-size="pagesizetwo"
  150. layout="total, sizes, prev, pager, next, jumper"
  151. :total="totaltwo">
  152. </el-pagination>
  153. </div>
  154. </el-dialog>
  155. </div>
  156. </template>
  157. <script>
  158. export default{
  159. data() {
  160. return {
  161. loading: false,
  162. fullscreenLoading: false,
  163. customerName: '',
  164. companyName: '',
  165. batchNumer: '',
  166. batchNumberQ:'',
  167. billNum:'',
  168. num: '',
  169. hightt:'0px',
  170. addList: false,
  171. current: 1,
  172. pagesize: 8,
  173. total: 0,
  174. currenttwo: 1,
  175. pagesizetwo: 8,
  176. totaltwo: 0,
  177. batchId: '',
  178. usertable: [],
  179. usertabletwo: [],
  180. formUserList: {
  181. "customerName": "",
  182. "file": "",
  183. "roleId": ""
  184. },
  185. }
  186. },
  187. created() {
  188. this.heightt = tableHeight;
  189. this.formUserList.customerName = sessionStorage.getItem('userName');
  190. this.loadData();
  191. },
  192. methods: {
  193. firstLoadData(){
  194. this.current = 1;
  195. this.pagesize = 8;
  196. this.loadData();
  197. },
  198. // 列表展示
  199. async loadData() {
  200. const formData = new FormData();
  201. formData.append('current', this.current);
  202. formData.append('size', this.pagesize);
  203. formData.append('customerName',this.formUserList.customerName);
  204. formData.append('company', this.companyName);
  205. formData.append('batchNumber', this.batchNumer);
  206. formData.append('operType', 2);
  207. const response = await this.$http.post(`noCar/findBatchList`, formData);
  208. if (response.data.code === 0) {
  209. this.loading = false;
  210. this.usertable = response.data.data.records;
  211. this.total = response.data.data.total;
  212. }
  213. },
  214. // 下载模板
  215. DownloadTemplate() {
  216. var url = hostUrl+"noCar/templateDownload?fileName=2"
  217. window.location.href= url;
  218. },
  219. // 批量上传模板信息
  220. async batchUpload() {
  221. const isLt50M = this.formUserList.file.size / 1024 / 1024 < 50;
  222. let extName = this.formUserList.file.name.substring(this.formUserList.file.name.lastIndexOf(".")).toLowerCase();
  223. let AllUpExt = ".xlsx";
  224. if( extName != AllUpExt){
  225. this.$message.error('格式错误!请重新选择');
  226. return false;
  227. }
  228. if (!isLt50M) {
  229. this.$message.error('上传文件大小不能超过50MB!');
  230. return false;
  231. }
  232. const loading = this.$loading({
  233. lock: true,
  234. text: '系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...',
  235. spinner: 'el-icon-loading',
  236. background: 'rgba(0, 0, 0, 0.7)'
  237. });
  238. const formData = new FormData();
  239. formData.append('customerName', this.formUserList.customerName);
  240. formData.append('file', this.formUserList.file);
  241. const response = await this.$http.post(`noCar/batchImprotEndBillWay`,formData);
  242. var {data: { code, msg, data }} = response;
  243. if(code === 0 && msg === 'success') {
  244. this.loadData();
  245. loading.close();
  246. this.$message.success('上传成功');
  247. }else if(code === 1 && msg == null && data == null) {
  248. loading.close();
  249. this.$message.error('数据存在错误,请检查文件中数据,金额是否有空的,时间是否全是时间格式');
  250. }else {
  251. loading.close();
  252. this.$message.error(msg);
  253. }
  254. },
  255. // 查看批次数据
  256. async checkLook(id) {
  257. this.addList = true;
  258. this.batchNumberQ = id;
  259. this.loadDataCar();
  260. },
  261. twoLoadData(){
  262. this.currenttwo = 1;
  263. this.pagesizetwo = 8;
  264. this.loadDataCar();
  265. },
  266. // 查看实时数据
  267. async loadDataCar() {
  268. const formData = new FormData();
  269. formData.append('current', this.currenttwo);
  270. formData.append('size', this.pagesizetwo);
  271. formData.append('customerName', this.formUserList.customerName);
  272. formData.append('batchNumEnd', this.batchNumberQ);
  273. formData.append('billNum', this.billNum);
  274. formData.append('hisFlag', 0);
  275. const response = await this.$http.post(`noCar/findImportBillWay`, formData);
  276. if (response.data.code === 0) {
  277. this.loading = false;
  278. this.usertabletwo = response.data.data.records;
  279. this.totaltwo = response.data.data.total;
  280. }
  281. },
  282. // 清空表单数据
  283. handleEditDialogClose() {
  284. this.addList = false;
  285. },
  286. handleRemove(file, fileList) {
  287. },
  288. handlePreview(file) {
  289. },
  290. handleSuccess (a) {
  291. this.formUserList.file = a.raw;
  292. },
  293. // 分页方法
  294. handleSizeChange(val) {
  295. this.pagesize = val;
  296. this.loadData();
  297. },
  298. handleCurrentChange(val) {
  299. this.current = val;
  300. this.loadData();
  301. },
  302. handleSize(val) {
  303. this.pagesizetwo = val;
  304. this.loadDataCar();
  305. },
  306. handleCurrent(val) {
  307. this.currenttwo = val;
  308. this.loadDataCar();
  309. }
  310. }
  311. };
  312. </script>
  313. <style>
  314. .over {
  315. border: 1px solid #d9d9d9;
  316. border-radius: 10px;
  317. }
  318. .over .upload-demo {
  319. display: inline-block;
  320. }
  321. .over .title {
  322. font-size: 5px;
  323. margin-bottom: 20px;
  324. }
  325. .over .top {
  326. padding-top: 20px;
  327. padding-left: 20px;
  328. }
  329. .over .text {
  330. display: inline-block;
  331. color: #000;
  332. font-size: 16px ;
  333. margin-left: 1%;
  334. }
  335. .over .tou {
  336. font-size: 20px;
  337. height: 30px;
  338. line-height: 30px;
  339. padding-top: 15px;
  340. }
  341. .over .line {
  342. margin-top: 15px;
  343. margin-bottom: 15px;
  344. width: 100%;
  345. height: 2px;
  346. background-color: #d9d9d9;
  347. }
  348. .over .theinput {
  349. display: inline-block;
  350. width: 20%;
  351. }
  352. .over .styleType {
  353. margin-top: 20px;
  354. margin-bottom: 20px;
  355. }
  356. .over .input-demo {
  357. display: inline-block;
  358. width: 20%;
  359. margin-left: 1%;
  360. }
  361. .over .block {
  362. font-size: 5px;
  363. text-align: center;
  364. margin-top: 15px;
  365. margin-bottom: 20px;
  366. }
  367. .over .blocks {
  368. font-size: 5px;
  369. text-align: center;
  370. margin-top: 20px;
  371. padding-bottom: 20px;
  372. }
  373. .over .el-dialog {
  374. width: 90%;
  375. }
  376. .over .el-dialog__header, .el-dialog__body {
  377. padding: 0 20px;
  378. }
  379. </style>