over.vue 12 KB

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