123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565 |
- <template>
- <div class="history">
- <!-- 头部细节部分 -->
- <div class="title">
- <el-row>
- <el-col :span="24">
- <div class="top">
- <span style="margin-top: 10px;">导入文件:</span>
- <el-upload
- class="upload-demo"
- ref="upload"
- action="http://invoice.back.jkcredit.com/"
- :on-preview="handlePreview"
- :on-remove="handleRemove"
- :on-change="handleSuccess"
- :auto-upload="false">
- <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
- <el-button style="margin-left: 10px;" size="small" type="success" @click="showConfirm">开票</el-button>
- </el-upload>
- </div>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <div class="top">
- <el-input placeholder="主体账号名称" class="input-demo" v-model="companyName"></el-input>
- <el-input placeholder="批次号" class="input-demo" v-model="batchNum"></el-input>
- <el-button style="margin-left: 1%;" @click="DownloadTemplate">下载模板</el-button>
- <el-button type="success" style="margin-left: 1%;" @click="firstLoadData">查询</el-button>
- <!-- <el-button type="info" style="margin-left: 1%;">重置</el-button> -->
- </div>
- </el-col>
- </el-row>
- </div>
- <!-- 头部细节部分结束 -->
- <!-- 表格部分 -->
- <template>
- <el-table
- class="table"
- v-loading="loading"
- ref="multipleTable"
- :data="usertable"
- :height="heightt"
- border
- tooltip-effect="dark">
- <el-table-column
- label="用户名"
- prop="customerName"
- show-overflow-tooltip>
- </el-table-column>
- <!-- <el-table-column
- label="用户手机号"
- prop="customerPhone"
- show-overflow-tooltip>
- </el-table-column> -->
- <el-table-column
- prop="company"
- label="主账号名称"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="batchNumber"
- label="批次号"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- label="创建时间"
- show-overflow-tooltip>
- <template slot-scope="scope" show-overflow-tooltip>
- <span>{{scope.row.createTime | fmtDate}}</span>
- </template>
- </el-table-column>
- <el-table-column
- label="状态"
- show-overflow-tooltip>
- <template slot-scope="scope">
- <span v-if="scope.row.batchStatus == 1" style="color: red">上传中</span>
- <span v-else-if="scope.row.batchStatus == 0" style="color: green">上传成功</span>
- </template>
- </el-table-column>
- <el-table-column
- label="操作"
- width="80">
- <template slot-scope="scope" show-overflow-tooltip>
- <span style="cursor:pointer;color: blue;" @click="checkLook(scope.row.batchNumber)">查看</span>
- </template>
- </el-table-column>
- </el-table>
- </template>
- <!-- 分页 -->
- <div class="block">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="current"
- :page-sizes="[6, 8, 10]"
- :page-size="pagesize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
- </div>
- <el-dialog
- title=" ."
- :visible.sync="dialogVisible"
- width="30%"
- >
- <el-form
- label-position="right"
- label-width="150px"
- >
- <el-form-item label="运单文件批次号" prop="fileBatchNum">
- <el-input placeholder="运单文件批次号" v-model="fileBatchNum"></el-input>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="batchUpload" v-loading.fullscreen.lock="fullscreenLoading">确 定</el-button>
- </span>
- </el-dialog>
- <!-- 查看 -->
- <el-dialog
- @close="handleEditDialogClose"
- :visible.sync="addList"
- class="ttt"
- style="font-size: 0px;">
- <template>
- <div class="tou">运单历史列表</div>
- <div class="line"></div>
- <div class="styleType">
- <el-input placeholder="运单编号" class="theinput" v-model="billNum"></el-input>
- <el-input placeholder="车牌号" class="theinput" v-model="plateNum"></el-input>
- <el-input placeholder="税号" class="theinput" v-model="taxPlayerCode"></el-input>
- <el-select v-model="success" placeholder="是否成功">
- <el-option
- v-for="item in optionone"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- <el-button type="success" style="margin-left: 1%;" @click="twoLoadData">查询</el-button>
- <el-button type="success" style="margin-left: 1%;" @click="exportExcel">导出</el-button>
- <!-- <el-button type="info" style="margin-left: 1%;">重置</el-button> -->
- </div>
- <el-table
- v-loading="loading"
- ref="multipleTable"
- :data="usertabletwo"
- border
- tooltip-effect="dark">
- <el-table-column
- label="运单编号"
- prop="billNum"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="taxplayerCode"
- label="税号"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- label="车牌号码"
- prop="plateNum"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="startTime"
- label="运单开始时间"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="sourceAddr"
- label="运单开始地址"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="destAddr"
- label="运单目的地址"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="predictEndTime"
- label="运单预计完成时间"
- show-overflow-tooltip>
- </el-table-column>
- <el-table-column
- prop="fee"
- label="运单费用(元)"
- show-overflow-tooltip>
- <template slot-scope="scope" show-overflow-tooltip>
- <span>{{scope.row.fee / 100}}</span>
- </template>
- </el-table-column>
- <!-- <el-table-column
- prop="billwayStatus"
- label="运单状态"
- show-overflow-tooltip>
- <template slot-scope="scope">
- <span v-if="scope.row.billwayStatus == 1" style="color: green">未结束</span>
- <span v-else-if="scope.row.billwayStatus == -2" style="color: red">上传失败</span>
- <span v-else-if="scope.row.billwayStatus == -3" style="color: red">结束指令上传失败</span>
- <span v-else-if="scope.row.billwayStatus == 2" style="color: green">开票中</span>
- <span v-else-if="scope.row.billwayStatus == 3" style="color: green">开票完成</span>
- <span v-else-if="scope.row.billwayStatus == 4" style="color: red">超时运单</span>
- </template>
- </el-table-column> -->
- <el-table-column
- label="是否成功"
- show-overflow-tooltip>
- <template slot-scope="scope">
- <span v-if="scope.row.billwayStatus == -2 || scope.row.billwayStatus == -3" style="color: red">失败</span>
- <span v-else-if="scope.row.billwayStatus != -2 && scope.row.billwayStatus != -3" style="color: green">成功</span>
- </template>
- </el-table-column>
- <el-table-column
- prop="failReason"
- label="失败原因"
- show-overflow-tooltip>
- </el-table-column>
- </el-table>
- </template>
- <div class="blocks">
- <el-pagination
- @size-change="handleSize"
- @current-change="handleCurrent"
- :current-page="currenttwo"
- :page-sizes="[6, 8, 10]"
- :page-size="pagesizetwo"
- layout="total, sizes, prev, pager, next, jumper"
- :total="totaltwo">
- </el-pagination>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import FileSaver from 'file-saver'
- import XLSX from 'xlsx'
- export default{
- data() {
- return {
- loading: false,
- fullscreenLoading: false,
- dialogVisible: false,
- fileBatchNum: '',
- userName: ``,
- customerName: ``,
- companyName: ``,
- billNum: ``,
- plateNum: ``,
- success: ``,
- taxPlayerCode: ``,
- hightt: `0px`,
- status: ``,
- addList: false,
- current: 1,
- pagesize: 8,
- total: 0,
- currenttwo: 1,
- pagesizetwo: 8,
- totaltwo: 0,
- batchNum: ``,
- batchNumberQ: ``,
- usertable: [],
- usertabletwo: [],
- formUserList: {
- 'customerName': ``,
- 'file': ``,
- 'roleId': ``
- },
- isSuccess: ``,
- optionone: [{
- value: `1`,
- label: `成功`
- }, {
- value: `2`,
- label: `失败`
- }]
- }
- },
- created() {
- this.heightt = tableHeight // eslint-disable-line
- this.formUserList.customerName = sessionStorage.getItem(`userName`)
- this.loadData()
- },
- methods: {
- firstLoadData() {
- this.current = 1
- this.pagesize = 8
- this.loadData()
- },
- // 列表展示
- async loadData() {
- const formData = new FormData()
- formData.append(`current`, this.current)
- formData.append(`size`, this.pagesize)
- formData.append(`customerName`, this.formUserList.customerName)
- formData.append(`company`, this.companyName)
- formData.append(`batchNumber`, this.batchNum)
- formData.append(`operType`, 3)
- const response = await this.$http.post(`noCar/findBatchList`, formData)
- if (response.data.code == 0) {
- this.loading = false
- this.usertable = response.data.data.records
- this.total = response.data.data.total
- }
- },
- showConfirm(){
- this.dialogVisible = true
- this.fileBatchNum = ''
- },
- // 下载模板
- DownloadTemplate() {
- // var url = 'http://invoice.back.jkcredit.com/carFreeCarrierBill/downTemp';
- var url = hostUrl + `noCar/templateDownload?fileName=3`// eslint-disable-line
- window.location.href = url
- },
- // 批量上传模板信息
- async batchUpload() {
- if(this.fileBatchNum == '' || this.fileBatchNum == null){
- this.$message.error(`请输入本次运单所对应的批次号`);
- return
- }
- const isLt50M = this.formUserList.file.size / 1024 / 1024 < 50
- let extName = this.formUserList.file.name.substring(this.formUserList.file.name.lastIndexOf(`.`)).toLowerCase()
- let AllUpExt = `.xlsx`
- if (extName != AllUpExt) {
- this.$message.error(`格式错误!请上传xlsx的文件`)
- return false
- }
- if (!isLt50M) {
- this.$message.error(`上传文件大小不能超过50MB!`)
- return false
- }
- this.dialogVisible = false
- const loading = this.$loading({
- lock: true,
- text: `系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...`,
- spinner: `el-icon-loading`,
- background: `rgba(0, 0, 0, 0.7)`
- })
- const formData = new FormData()
- formData.append(`customerName`, this.formUserList.customerName)
- formData.append(`file`, this.formUserList.file)
- formData.append(`batchNum`, this.fileBatchNum)
- const response = await this.$http.post(`noCar/batchImprotHistoryBillWay`, formData)
- var {data: { code, msg, data }} = response
- if (code == 0 && msg == `success`) {
- this.loadData()
- loading.close()
- this.$message.success(`上传成功`)
- } else if (code == 1 && msg == null && data == null) {
- loading.close()
- this.$message.error(`数据存在错误,请检查文件中数据,金额是否有空的,时间是否全是时间格式`)
- } else {
- loading.close()
- this.$message.error(msg)
- }
- },
- // 查看批次数据
- async checkLook(id) {
- this.addList = true
- this.batchNumberQ = id
- this.loadDataCar()
- },
- twoLoadData() {
- this.currenttwo = 1
- this.pagesizetwo = 8
- this.loadDataCar()
- },
- // 查看历史数据
- async loadDataCar() {
- const formData = new FormData()
- formData.append(`current`, this.currenttwo)
- formData.append(`size`, this.pagesizetwo)
- formData.append(`customerName`, this.formUserList.customerName)
- formData.append(`batchNum`, this.batchNumberQ)
- formData.append(`billNum`, this.billNum)
- formData.append(`success`, this.success)
- formData.append(`plateNum`, this.plateNum)
- formData.append(`taxplayerCode`, this.taxPlayerCode)
- formData.append(`hisFlag`, 1)
- const response = await this.$http.post(`noCar/findImportBillWay`, formData)
- if (response.data.code == 0) {
- this.loading = false
- this.usertabletwo = response.data.data.records
- this.totaltwo = response.data.data.total
- }
- },
- formartNum(wb) {
- var sheet = wb[`Sheets`][`Sheet1`]
- var replaceTemp = []
- for (var i in sheet) {
- if (sheet[i][`v`] == `运单费用(元)`) {
- replaceTemp.push(i.replace(/[0-9]/g, ``))
- continue
- }
- if (replaceTemp.includes(i.replace(/[0-9]/g, ``))) {
- sheet[i][`t`] = `n`
- }
- }
- },
- async exportExcel() {
- const loading = this.$loading({
- lock: true,
- text: `系统正在努力接收中,过程大概需要几分钟的时间,请您耐心等待...`,
- spinner: `el-icon-loading`,
- background: `rgba(0, 0, 0, 0.7)`
- })
- let curr = this.currenttwo
- let pagesize1 = this.pagesizetwo
- this.currenttwo = 1
- this.pagesizetwo = this.totaltwo
- await this.loadDataCar()
- // 设置当前日期
- let time = new Date()
- let year = time.getFullYear()
- let month = time.getMonth() + 1
- let day = time.getDate()
- let name = `历史运单上传列表_` + year + `` + month + `` + day
- /* generate workbook object from table */
- // .table要导出的是哪一个表格
- var wb = XLSX.utils.table_to_book(document.querySelector(`.ttt`), { raw: true })
- this.formartNum(wb)
- /* get binary string as output */
- var wbout = XLSX.write(wb, {
- bookType: `xlsx`,
- bookSST: true,
- type: `array`
- })
- try {
- // name+'.xlsx'表示导出的excel表格名字
- FileSaver.saveAs(
- new Blob([wbout], { type: `application/octet-stream` }),
- name + `.xlsx`
- )
- } catch (e) {
- }
- this.currenttwo = curr
- this.pagesizetwo = pagesize1
- this.loadDataCar()
- loading.close()
- return wbout
- },
- // 清空表单数据
- handleEditDialogClose() {
- this.num = ``
- this.plateNumber = ``
- this.taxPlayerCode = ``
- this.current = 1
- this.pagesize = 8
- this.currenttwo = 1
- this.pagesizetwo = 8
- },
- handleRemove(file, fileList) {
- },
- handlePreview(file) {
- },
- handleSuccess(a) {
- this.formUserList.file = a.raw
- },
- // 分页方法
- handleSizeChange(val) {
- this.pagesize = val
- this.loadData()
- },
- handleCurrentChange(val) {
- this.current = val
- this.loadData()
- },
- handleSize(val) {
- this.pagesizetwo = val
- this.loadDataCar()
- },
- handleCurrent(val) {
- this.currenttwo = val
- this.loadDataCar()
- }
- }
- }
- </script>
- <style>
- .history {
- border: 1px solid #d9d9d9;
- border-radius: 10px;
- }
- .history .upload-demo {
- display: inline-block;
- }
- .history .title {
- font-size: 5px;
- margin-bottom: 20px;
- }
- .history .top {
- padding-top: 20px;
- padding-left: 20px;
- }
- .history .text {
- display: inline-block;
- color: #000;
- font-size: 16px ;
- margin-left: 1%;
- }
- .history .tou {
- font-size: 20px;
- height: 30px;
- line-height: 30px;
- padding-top: 15px;
- }
- .history .line {
- margin-top: 15px;
- margin-bottom: 15px;
- width: 100%;
- height: 2px;
- background-color: #d9d9d9;
- }
- .history .theinput {
- display: inline-block;
- width: 20%;
- }
- .history .styleType {
- margin-top: 20px;
- margin-bottom: 20px;
- }
- .history .input-demo {
- display: inline-block;
- width: 20%;
- margin-left: 1%;
- }
- .history .block {
- font-size: 5px;
- text-align: center;
- margin-top: 15px;
- margin-bottom: 20px;
- }
- .history .blocks {
- font-size: 5px;
- text-align: center;
- margin-top: 20px;
- padding-bottom: 20px;
- }
- .history .el-dialog {
- width: 90%;
- }
- .history .el-dialog__header, .el-dialog__body {
- padding: 0 20px;
- }
- </style>
|