123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636 |
- // 计费详单
- <template>
- <div class="steel_inbound">
- <div class="sache">
- <el-form :inline="true" style="margin-top :5px">
- <el-form-item>
- <el-select
- v-model="screen"
- placeholder="请选择需筛选的内容"
- clearable
- class="elSelect"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- <el-input
- style="width:200px"
- v-model="input"
- placeholder="请输入查询条件"
- clearable
- ></el-input>
- </el-form-item>
- <el-form-item>
- <el-select
- v-model="screen1"
- placeholder="请选择需筛选的内容"
- clearable
- class="elSelect"
- >
- <el-option
- v-for="item in optionsF"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- <el-input
- style="width:200px"
- v-model="input1"
- placeholder="请输入查询条件"
- clearable
- ></el-input>
- </el-form-item>
- <span>净重时间:</span>
- <el-date-picker
- v-model="startTime"
- type="datetime"
- placeholder="选择日期"
- style="width:200px"
- >
- </el-date-picker>
- <span>至</span>
- <el-date-picker
- v-model="endTime"
- type="datetime"
- placeholder="选择日期"
- style="width:200px"
- >
- </el-date-picker>
- <el-button type="primary" class="btn" @click="onclick">
- <i class="el-icon-search"></i>
- </el-button>
- <el-button type="primary" @click="exportAllExcel"
- ><i class="el-icon-download"></i>Excel</el-button
- >
- <el-button type="primary" @click="newSettle">生成详单</el-button>
- </el-form>
- </div>
- <div class="table">
- <el-tabs v-model="activeName" tab-click="handClick">
- <!-- 未结算 -->
- <el-tab-pane label="未结算" name="first">
- <dilTable
- v-bind.sync="options1"
- ref="excelDom"
- @func="func"
- ></dilTable>
- </el-tab-pane>
- <!-- 已结算 -->
- <el-tab-pane label="已结算" name="second">
- <dilTable v-bind.sync="options2" @func="func2"> </dilTable>
- </el-tab-pane>
- <el-tab-pane label="未生成详单" name="third" v-if="isShow">
- <dilTable v-bind.sync="options3" @func="func3"> </dilTable>
- </el-tab-pane>
- </el-tabs>
- </div>
- </div>
- </template>
- <script>
- import { getCookie } from '@/utils/util.js'
- import { sjTime } from '@/utils/sharedJsFile'
- export default {
- data() {
- return {
- options: [
- {
- value: '用车单位',
- label: '用车单位'
- },
- {
- value: '货物名称',
- label: '货物名称'
- },
- {
- value: '车牌号',
- label: '车牌号'
- },
- {
- value: '承运起止范围',
- label: '承运起止范围'
- }
- ],
- optionsF: [
- {
- value: '用车单位',
- label: '用车单位'
- },
- {
- value: '货物名称',
- label: '货物名称'
- },
- {
- value: '车牌号',
- label: '车牌号'
- },
- {
- value: '承运起止范围',
- label: '承运起止范围'
- }
- ],
- screen: null,
- screen1: null,
- startTime: null,
- endTime: null,
- //合计净重
- totalNetWeight: null,
- //合计金额
- totalMoney: null,
- //单价
- Fee: null,
- //加载
- selectLineLoading: false,
- input: null,
- input1: null,
- activeName: 'first',
- ssoId: null,
- //详单Id
- detailsId: null,
- options1: {
- // first请求数据的地址
- requestUrl: ''
- },
- options2: {
- // second请求数据的地址
- requestUrl: ''
- },
- options3: {
- requestUrl: ''
- },
- //是否打开修改详单地址弹出框
- dialogFormVisible: false,
- //原详单单价
- originalPriceValue: null,
- //新详单单价
- newPriceValue: null,
- //原详单地址
- originalAddress: null,
- //新详单地址
- newAddress: null,
- //新单价Id
- priceId: null,
- //运输单价的表格
- Address: {
- requestUrl: '/api/v1/ams/getAddressDeliveryAddress?apiId=255',
- selectionType: 'radio'
- },
- // addressText:null,
- //缓存当前选中的运输单价
- priceMap: {},
- formLabelWidth: '125px',
- tableTitle: '内转计重详单',
- exportAllList: [],
- noSettleDetailsColumn: [],
- settleDetailsColumn: [],
- noDetailsColumn: [],
- orderList1: [],
- orderList2: [],
- orderList3: [],
- loginName: ''
- }
- },
- created() {
- this.loginName = this.loginNames()
- this.options1GetRequestUrl()
- this.options2GetRequestUrl()
- this.options3GetRequestUrl()
- },
- methods: {
- loginNames() {
- return getCookie('loginName')
- },
- handClick() {
- if (this.activeName == 'first') {
- this.options1GetRequestUrl()
- } else if (this.activeName == 'second') {
- this.options2GetRequestUrl()
- } else {
- this.options3GetRequestUrl()
- }
- },
- func(res) {
- console.log(res)
- this.noSettleDetailsColumn = res.columnData
- var totalWeight = 0
- var totalAllMoney = 0
- res.list.forEach(e => {
- totalWeight = totalWeight + e.resultNetWeight
- totalAllMoney = totalAllMoney + e.detailsAmount
- })
- this.totalNetWeight = totalWeight.toFixed(2) + 't'
- this.totalMoney = totalAllMoney.toFixed(2) + '元'
- this.orderList1 = []
- res.list.forEach(e => {
- let map = {
- orderLineSeq: e.orderLineSeq,
- orderId: e.orderId
- }
- this.orderList1.push(map)
- })
- },
- func2(res) {
- this.settleDetailsColumn = res.columnData
- },
- func3(res) {
- console.log(res.list)
- console.log('res')
- this.orderList3 = []
- res.list.forEach(e => {
- let map = {
- orderLineSeq: e.orderLineSeq,
- orderId: e.orderId
- }
- this.orderList3.push(map)
- })
- this.noDetailsColumn = res.columnData
- },
- newSettle() {
- console.log(this.orderList)
- let orderList = []
- if (this.activeName == 'third') {
- orderList = this.orderList3
- } else {
- orderList = this.orderList1
- }
- this.axios
- .post('/api/v1/bms/newInwardSettle', { orderIds: orderList })
- .then(res => {
- console.log(res)
- this.$message.success('生成成功')
- this.options3GetRequestUrl()
- })
- },
- exportAllExcel() {
- let startTime = null
- let endTime = null
- let orgCode = null
- let materialTypeNames = null
- let transRangeValues = null
- let shipperNames = null
- let capacityNo = null
- let carrierSsoId = null
- if (this.startTime && this.endTime) {
- startTime = sjTime(this.startTime)
- endTime = sjTime(this.endTime)
- }
- if (getCookie('orgCode') == 'chengyunshang') {
- carrierSsoId = getCookie('userId')
- }
- if (
- getCookie('orgCode') == 'dagangadmin' ||
- getCookie('orgCode') == 'zidonghuabu' ||
- getCookie('orgCode') == 'wuliuchuyunzhongxin'
- ) {
- orgCode = null
- } else {
- orgCode = getCookie('orgCode')
- }
- if (this.screen == '车牌号') {
- capacityNo = this.input
- }
- if (this.screen == '承运起止范围') {
- transRangeValues = this.input
- }
- if (this.screen == '货物名称') {
- materialTypeNames = this.input
- }
- if (this.screen == '用车单位') {
- shipperNames = this.input
- }
- if (this.screen1 == '车牌号') {
- capacityNo = this.input1
- }
- if (this.screen1 == '承运起止范围') {
- transRangeValues = this.input1
- }
- if (this.screen1 == '货物名称') {
- materialTypeNames = this.input1
- }
- if (this.screen1 == '用车单位') {
- shipperNames = this.input1
- }
- if (this.activeName == 'first') {
- this.tableTitle = '未结算计费详单'
- this.axios
- .post(
- '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=0' +
- '&startTime=' +
- startTime +
- '&endTime=' +
- endTime +
- '&shipperNames=' +
- shipperNames +
- '&materialTypeNames=' +
- materialTypeNames +
- '&transRangeValues=' +
- transRangeValues +
- '&capacityNo=' +
- capacityNo +
- '&i' +
- new Date() +
- '&isPage=yes'
- )
- .then(res => {
- console.log(res.data.data)
- this.exportAllList = res.data.data
- this.exportAllReportToExcel(
- this.tableTitle,
- this.exportAllList,
- this.noSettleDetailsColumn
- )
- })
- } else if (this.activeName == 'second') {
- this.tableTitle = '已结算计费详单'
- this.axios
- .post(
- '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=1' +
- '&startTime=' +
- startTime +
- '&endTime=' +
- endTime +
- '&shipperNames=' +
- shipperNames +
- '&materialTypeNames=' +
- materialTypeNames +
- '&transRangeValues=' +
- transRangeValues +
- '&capacityNo=' +
- capacityNo +
- '&i' +
- new Date() +
- '&isPage=yes' +
- '&userId=' +
- orgCode
- )
- .then(res => {
- this.exportAllList = res.data.data
- this.exportAllReportToExcel(
- this.tableTitle,
- this.exportAllList,
- this.settleDetailsColumn
- )
- })
- } else if (this.activeName == 'third') {
- this.tableTitle = '未生成计费详单数据'
- this.axios
- .post(
- '/api/v1/bms/getNoInwardDetails?apiId=490' +
- '&startTime=' +
- startTime +
- '&endTime=' +
- endTime +
- '&shipperNames=' +
- shipperNames +
- '&materialTypeNames=' +
- materialTypeNames +
- '&transRangeValues=' +
- transRangeValues +
- '&capacityNo=' +
- capacityNo +
- '&i' +
- new Date() +
- '&userId=' +
- orgCode +
- '&isPage=yes'
- )
- .then(res => {
- this.exportAllList = res.data.data
- this.exportAllReportToExcel(
- this.tableTitle,
- this.exportAllList,
- this.noDetailsColumn
- )
- })
- }
- },
- //导出excel
- exportAllReportToExcel(tableTitle, dataArr, columnData) {
- var title = tableTitle
- let tHeader = []
- let filterVal = []
- columnData.forEach(e1 => {
- if (tHeader.indexOf(e1.label) === -1) {
- tHeader.push(e1.label)
- }
- if (filterVal.indexOf(e1.prop) === -1) {
- filterVal.push(e1.prop)
- }
- })
- //导出为excel
- this.downloadLoading = true
- require.ensure([], () => {
- const {
- export_json_to_excel
- } = require('@/assets/excel/Export2Excel.js') //这里必须使用绝对路径,使用@/+存放export2Excel的路径
- // let list = this.$refs.excelDom.dataTabel;
- let data = dataArr.map(v => filterVal.map(j => v[j])) //3.formatJson格式转换
- export_json_to_excel(tHeader, data, title) // (title)导出的表格名称
- })
- },
- //未结算数据
- options1GetRequestUrl() {
- if (getCookie('orgCode') == 'chengyunshang') {
- this.ssoId = getCookie('userId')
- this.options1.requestUrl =
- '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=0&carrierSsoId=' +
- getCookie('userId') +
- '&startTime=null&endTime=null&i=' +
- new Date()
- } else if (
- getCookie('orgCode') == 'dagangadmin' ||
- getCookie('orgCode') == 'zidonghuabu' ||
- getCookie('orgCode') == 'wuliuchuyunzhongxin'
- ) {
- this.options1.requestUrl =
- '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=0&startTime=null&endTime=null&i=' +
- new Date()
- } else {
- this.options1.requestUrl =
- '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=0&userId=' +
- getCookie('orgCode') +
- '&startTime=null&endTime=null&i=' +
- new Date()
- }
- },
- //已结算数据
- options2GetRequestUrl() {
- if (getCookie('orgCode') == 'chengyunshang') {
- this.ssoId = getCookie('userId')
- this.options2.requestUrl =
- '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=1&carrierSsoId=' +
- getCookie('userId') +
- '&startTime=null&endTime=null&i=' +
- new Date()
- } else if (
- getCookie('orgCode') == 'dagangadmin' ||
- getCookie('orgCode') == 'zidonghuabu' ||
- getCookie('orgCode') == 'wuliuchuyunzhongxin'
- ) {
- this.options2.requestUrl =
- '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=1' +
- '&startTime=null&endTime=null&i=' +
- new Date()
- } else {
- this.options2.requestUrl =
- '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=1&userId=' +
- getCookie('orgCode') +
- '&startTime=null&endTime=null&i=' +
- new Date()
- }
- },
- options3GetRequestUrl() {
- this.options3.requestUrl =
- '/api/v1/bms/getNoInwardDetails?apiId=490&i=' + new Date()
- },
- toInsert() {
- this.$router.push('/insertCheckInventory')
- },
- onclick() {
- let startTime = null
- let endTime = null
- let orgCode = null
- let materialTypeNames = null
- let transRangeValues = null
- let shipperNames = null
- let capacityNo = null
- let carrierSsoId = null
- if (this.startTime && this.endTime) {
- startTime = sjTime(this.startTime)
- endTime = sjTime(this.endTime)
- }
- if (getCookie('orgCode') == 'chengyunshang') {
- carrierSsoId = getCookie('userId')
- }
- if (
- getCookie('orgCode') == 'dagangadmin' ||
- getCookie('orgCode') == 'zidonghuabu' ||
- getCookie('orgCode') == 'wuliuchuyunzhongxin'
- ) {
- orgCode = null
- } else {
- orgCode = getCookie('orgCode')
- }
- if (this.screen == '车牌号') {
- capacityNo = this.input
- }
- if (this.screen == '承运起止范围') {
- transRangeValues = this.input
- }
- if (this.screen == '货物名称') {
- materialTypeNames = this.input
- }
- if (this.screen == '用车单位') {
- shipperNames = this.input
- }
- if (this.screen1 == '车牌号') {
- capacityNo = this.input1
- }
- if (this.screen1 == '承运起止范围') {
- transRangeValues = this.input1
- }
- if (this.screen1 == '货物名称') {
- materialTypeNames = this.input1
- }
- if (this.screen1 == '用车单位') {
- shipperNames = this.input1
- }
- if (this.activeName == 'first') {
- this.options1.requestUrl =
- '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=0' +
- '&startTime=' +
- startTime +
- '&endTime=' +
- endTime +
- '&shipperNames=' +
- shipperNames +
- '&materialTypeNames=' +
- materialTypeNames +
- '&transRangeValues=' +
- transRangeValues +
- '&capacityNo=' +
- capacityNo +
- '&i' +
- new Date() +
- '&userId=' +
- orgCode
- }
- if (this.activeName == 'second') {
- this.options2.requestUrl =
- '/api/v1/bms/getInwardWeightDetailsOrder?apiId=461&orderType=11&detailStatus=1' +
- '&startTime=' +
- startTime +
- '&endTime=' +
- endTime +
- '&shipperNames=' +
- shipperNames +
- '&materialTypeNames=' +
- materialTypeNames +
- '&transRangeValues=' +
- transRangeValues +
- '&capacityNo=' +
- capacityNo +
- '&i' +
- new Date() +
- '&userId=' +
- orgCode
- }
- if (this.activeName == 'third') {
- this.options3.requestUrl =
- '/api/v1/bms/getNoInwardDetails?apiId=490' +
- '&startTime=' +
- startTime +
- '&endTime=' +
- endTime +
- '&shipperNames=' +
- shipperNames +
- '&materialTypeNames=' +
- materialTypeNames +
- '&transRangeValues=' +
- transRangeValues +
- '&capacityNo=' +
- capacityNo +
- '&i' +
- new Date() +
- '&userId=' +
- orgCode
- }
- },
- //运输订单点击浏览的事件
- select() {
- this.addressDrawer = true
- },
- //运输单价模态窗口的框计算
- selectAddressClick() {
- this.Price.requestUrl =
- '/api/v1/ams/getAddressDeliveryAddress?apiId=255&con=' +
- this.addressText
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .steel_inbound {
- .sache {
- margin-left: 20px;
- margin-top: 20px;
- .elSelect /deep/ {
- .el-input--suffix .el-input__inner {
- width: 120px !important;
- }
- }
- }
- .table {
- margin-left: 20px;
- margin-top: 20px;
- }
- }
- </style>
|