You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
558 lines
21 KiB
558 lines
21 KiB
<template>
|
|
<div class="app-container">
|
|
<!-- Start 列表页面 -->
|
|
<div v-show="viewState == 1">
|
|
<button-bar view-title="车辆销售台账" ref="btnbar" :btndisabled="btndisabled" @btnhandle="btnHandle"/>
|
|
<div class="main-content">
|
|
<div class="searchcon">
|
|
<el-button size="small" class="searchbtn" @click="clicksearchShow">{{ searchxianshitit }}</el-button>
|
|
<div v-show="isSearchShow" class="search">
|
|
<el-form ref="listQueryform" :inline="true" :model="listQuery" label-width="100px" class="tab-header">
|
|
<el-form-item label="车架号">
|
|
<el-input v-model="listQuery.params.vinNo" placeholder="请输入车架号" clearable/>
|
|
</el-form-item>
|
|
<el-form-item label="销售类型">
|
|
<el-select v-model="listQuery.params.typeKey" placeholder="" filterable>
|
|
<el-option v-for="item in payType_list" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="销售日期">
|
|
<div class="block" style="float: left;">
|
|
<el-date-picker v-model="listQuery.params.saleDateStart" type="date" clearable value-format="yyyy-MM-dd" placeholder="选择日期"/>
|
|
</div>
|
|
<div style="float: left;margin: 0px 10px">至</div>
|
|
<div class="block" style="float: left;">
|
|
<el-date-picker v-model="listQuery.params.saleDateEnd" type="date" clearable value-format="yyyy-MM-dd" placeholder="选择日期"/>
|
|
</div>
|
|
</el-form-item>
|
|
<el-form-item label="合同编号">
|
|
<el-input v-model="listQuery.params.concatNo" placeholder="" clearable/>
|
|
</el-form-item>
|
|
<el-form-item label="客户名称">
|
|
<el-input v-model="listQuery.params.customerName" placeholder="" clearable/>
|
|
</el-form-item>
|
|
<el-form-item label="销售部门">
|
|
<el-select v-model="listQuery.params.orgDeptSid" class="addinputw" placeholder="" @change="changeOrg">
|
|
<el-option v-for="item in org_list" :key="item.orgDeptSid" :label="item.orgDeptName" :value="item.orgDeptSid"/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="销售专员">
|
|
<el-select v-model="listQuery.params.staffSid" class="addinputw" placeholder="">
|
|
<el-option v-for="item in staff_list" :key="item.staffSid" :label="item.staffName" :value="item.staffSid"/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="分公司">
|
|
<el-select v-model="listQuery.params.orgSid" class="addinputw" placeholder="">
|
|
<el-option v-for="item in userOrg_list" :key="item.sid" :label="item.name" :value="item.sid"/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="内部编码">
|
|
<el-input v-model="listQuery.params.insideCode" placeholder="" clearable/>
|
|
</el-form-item>
|
|
</el-form>
|
|
<div class="btn" style="text-align: center;">
|
|
<el-button type="primary" icon="el-icon-search" @click="handleFilter" size="small">查询</el-button>
|
|
<el-button type="primary" icon="el-icon-refresh" @click="handleReset" size="small">重置</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="listtop">
|
|
<div class="tit">车辆销售列表</div>
|
|
<pageye v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/>
|
|
</div>
|
|
<div class="">
|
|
<el-table :key="tableKey" v-loading="listLoading" :data="list" border style="width: 100%;" @selection-change="handleSelectionChange">
|
|
<el-table-column width="50" fixed type="selection" align="center"/>
|
|
<el-table-column width="60" fixed label="序号" type="index" :index="indexMethod" align="center"/>
|
|
<el-table-column label="操作" fixed width="130" align="center">
|
|
<template slot-scope="scope">
|
|
<el-button type="primary" size="mini" @click="handleDownLoad(scope.row)">下载</el-button>
|
|
<el-button type="primary" size="mini" @click="toInfo(scope.row)">查看</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="分公司" align="center" width="90">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.createOrgName }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="车架号" align="center" width="90">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.vinNo }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="车型(配置简述)" align="center" width="130">
|
|
<template slot-scope="scope">
|
|
<span class="bluezi" @click="handleLook(scope.row)">{{ scope.row.modelName }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="内部编码" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.insideCode }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="销售类型" align="center" width="100">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.type }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="采购类型" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.manPurOrderTypeValue }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="销售日期" align="center" width="100">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.saleDate }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="成交价(元)" align="center" width="110">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.price }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="销售部门" align="center" width="100">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.orgName }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="销售专员" align="center" width="100">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.staffName }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="合同编号" align="center" width="100">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.concatNo }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="是否为终端客户" align="center" width="140">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.isTerminal }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="客户名称" align="center" width="100">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.customerName }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="手机号码" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.mobile }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="上装/挂车" align="center" width="100">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.trailerOrInstallName }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="物料编码" align="center" width="100">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.trailerOrInstallCode }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="上装/挂车成交价" align="center" width="140">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.trailerOrInstallDealPrice }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="赠品价值(元)" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.giftsDescription }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="销售折让" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.salesAllowance }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="中介人1" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.middleOne }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="返利金额1" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.rebateMoneyOne }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="中介人2" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.middleTwo }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="返利金额2" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.rebateMoneyTwo }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="内部引荐人" align="center" width="120">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.innerName }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
<div class="pages">
|
|
<!-- 翻页 -->
|
|
<pagination v-show="list.length > 0" :total="listQuery.total" :page.sync="listQuery.current" :limit.sync="listQuery.size" class="pagination" @pagination="getList"/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<el-dialog center :visible.sync="dialogVisible" width="40%">
|
|
<el-form class="formadd">
|
|
<el-row style="border-top: 1px solid #E0E3EB">
|
|
<el-col :span="6" class="tleftb">
|
|
<span>打印机类型</span>
|
|
</el-col>
|
|
<el-col :span="18">
|
|
<el-form-item>
|
|
<el-radio-group v-model="print">
|
|
<el-radio label="针孔式打印机">针孔式打印机</el-radio>
|
|
<el-radio label="激光打印机">激光打印机</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button size="small" :disabled="visibleDisabled" type="primary" @click="handleConfirm">确定</el-button>
|
|
<el-button size="small" :disabled="visibleDisabled" @click="dialogVisible = false">取消</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
<chelaingxiaoshouInfo v-show="viewState == 2" ref="divInfo" @doback="resetState"/>
|
|
<vehicleconfiguration v-show="viewState == 3" ref="divPeizhi" @doback="resetState"/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { pagerList, createPdf, delBySid, exportExcel } from '@/api/cheliang/cheliangxiaoshou'
|
|
import Pagination from '@/components/pagination'
|
|
import pageye from '@/components/pagination/pageye'
|
|
import ButtonBar from '@/components/ButtonBar'
|
|
import { typeValues, getOrgSidByPath, selectOrgList, selectOrgByLevel, getButtonPermissions } from '@/api/cheliang/dictcommons'
|
|
import chelaingxiaoshouInfo from './chelaingxiaoshouInfo'
|
|
import vehicleconfiguration from '@/views/cheliang/cheliangtaizhang/relation/vehicleconfiguration'
|
|
import { getStorage } from '@/utils/auth'
|
|
|
|
export default {
|
|
name: 'cheliangxiaoshou',
|
|
components: {
|
|
Pagination,
|
|
pageye,
|
|
ButtonBar,
|
|
chelaingxiaoshouInfo,
|
|
vehicleconfiguration
|
|
},
|
|
data() {
|
|
return {
|
|
btndisabled: false,
|
|
viewState: 1,
|
|
dialogVisible: false,
|
|
visibleDisabled: false,
|
|
printSid: '',
|
|
print: '',
|
|
btnList: [
|
|
{
|
|
type: 'danger',
|
|
size: 'small',
|
|
icon: 'del',
|
|
btnKey: 'doDel',
|
|
btnLabel: '删除'
|
|
},
|
|
{
|
|
type: 'success',
|
|
size: 'small',
|
|
icon: 'export',
|
|
btnKey: 'doExport',
|
|
btnLabel: '导出'
|
|
},
|
|
{
|
|
type: 'info',
|
|
size: 'small',
|
|
icon: 'cross',
|
|
btnKey: 'doClose',
|
|
btnLabel: '关闭'
|
|
}
|
|
],
|
|
isSearchShow: false,
|
|
searchxianshitit: '显示查询条件',
|
|
// 查询条件 -----------
|
|
tableKey: 0,
|
|
sids: [],
|
|
list: [],
|
|
org_list: [],
|
|
userOrg_list: [],
|
|
staff_list: [],
|
|
payType_list: [],
|
|
FormLoading: false,
|
|
listLoading: false,
|
|
listQuery: {
|
|
params: {
|
|
concatNo: '',
|
|
customerName: '',
|
|
saleDateEnd: '',
|
|
saleDateStart: '',
|
|
typeKey: '',
|
|
vinNo: '',
|
|
createOrgSid: '',
|
|
orgDeptSid: '',
|
|
staffSid: '',
|
|
orgSidPath: '',
|
|
orgSid: '',
|
|
insideCode: ''
|
|
},
|
|
current: 1,
|
|
size: 5,
|
|
total: 0
|
|
},
|
|
rules: {}
|
|
}
|
|
},
|
|
created() {
|
|
// 加载列表
|
|
this.init()
|
|
},
|
|
mounted() {
|
|
getButtonPermissions({ userSid: window.sessionStorage.getItem('userSid'), url: this.$route.path, type: 0 }).then((res) => {
|
|
if (res.success) {
|
|
for (var i = 0; i < res.data.length; i++) {
|
|
for (var k = 0; k < this.btnList.length; k++) {
|
|
if (res.data[i].buttonId === this.btnList[k].btnKey) {
|
|
this.btnList.splice(k, 1)
|
|
}
|
|
}
|
|
}
|
|
this.$refs['btnbar'].setButtonList(this.btnList)
|
|
}
|
|
})
|
|
},
|
|
methods: {
|
|
init() {
|
|
typeValues({ type: 'payType' }).then((res) => {
|
|
if (res.success) {
|
|
this.payType_list = res.data
|
|
}
|
|
})
|
|
getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((resp) => {
|
|
if (resp.success) {
|
|
this.listQuery.params.createOrgSid = resp.data
|
|
this.getList()
|
|
}
|
|
})
|
|
selectOrgList({ userSid: window.sessionStorage.getItem('userSid'), orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => {
|
|
if (res.success) {
|
|
this.org_list = res.data
|
|
}
|
|
})
|
|
selectOrgByLevel({ orgSidPath: window.sessionStorage.getItem('defaultOrgPath') }).then((resp) => {
|
|
if (resp.success) {
|
|
this.userOrg_list = resp.data
|
|
}
|
|
})
|
|
},
|
|
// 搜索条件效果
|
|
clicksearchShow() {
|
|
this.isSearchShow = !this.isSearchShow
|
|
if (this.isSearchShow) {
|
|
this.searchxianshitit = '隐藏查询条件'
|
|
} else {
|
|
this.searchxianshitit = '显示查询条件'
|
|
}
|
|
},
|
|
btnHandle(btnKey) {
|
|
console.log('XXXXXXXXXXXXXXX ' + btnKey)
|
|
switch (btnKey) {
|
|
case 'doDel':
|
|
this.doDel()
|
|
break
|
|
case 'doExport':
|
|
this.doExport()
|
|
break
|
|
case 'doClose':
|
|
this.doClose()
|
|
break
|
|
default:
|
|
break
|
|
}
|
|
},
|
|
// 序号
|
|
indexMethod(index) {
|
|
var pagestart = (this.listQuery.current - 1) * this.listQuery.size
|
|
var pageindex = index + 1 + pagestart
|
|
return pageindex
|
|
},
|
|
// 查询列表信息
|
|
getList() {
|
|
this.listLoading = true
|
|
this.listQuery.params.orgSidPath = window.sessionStorage.getItem('defaultOrgPath')
|
|
pagerList(this.listQuery).then((response) => {
|
|
console.log('列表查询结果:', response)
|
|
this.listLoading = false
|
|
if (response.success && response.data && response.data.total > 0) {
|
|
this.list = response.data.records
|
|
this.listQuery.total = response.data.total
|
|
} else {
|
|
this.list = []
|
|
this.listQuery.total = 0
|
|
}
|
|
})
|
|
},
|
|
handleSelectionChange(row) {
|
|
const aa = []
|
|
row.forEach((element) => {
|
|
aa.push(element.sid)
|
|
})
|
|
this.sids = aa
|
|
},
|
|
// 查询按钮
|
|
handleFilter() {
|
|
this.listQuery.current = 1
|
|
this.getList()
|
|
},
|
|
handleReset() {
|
|
this.listQuery = {
|
|
params: {
|
|
concatNo: '',
|
|
customerName: '',
|
|
saleDateEnd: '',
|
|
saleDateStart: '',
|
|
typeKey: '',
|
|
vinNo: '',
|
|
createOrgSid: '',
|
|
orgDeptSid: '',
|
|
staffSid: '',
|
|
orgSidPath: '',
|
|
orgSid: '',
|
|
insideCode: ''
|
|
},
|
|
current: 1,
|
|
size: 5,
|
|
total: 0
|
|
}
|
|
this.init()
|
|
},
|
|
changeOrg(value) {
|
|
const choosetItem = this.org_list.filter((item) => item.orgDeptSid === value)
|
|
this.staff_list = choosetItem[0].staffinfoVoList
|
|
},
|
|
handleDownLoad(row) {
|
|
this.printSid = row.sid
|
|
this.print = ''
|
|
this.dialogVisible = true
|
|
},
|
|
handleConfirm() {
|
|
this.visibleDisabled = true
|
|
createPdf({ xsckdSid: this.printSid, printerType: this.print }).then((resp) => {
|
|
if (resp.success && resp.data.pdfPath !== '') {
|
|
var xhr = new XMLHttpRequest()
|
|
xhr.open('GET', process.env.VUE_APP_BASE_API + '/base/file/download?filePath=' + resp.data.pdfPath + '&outFileName=' + '销售出库单', true)
|
|
xhr.setRequestHeader('token', getStorage())
|
|
xhr.responseType = 'blob'
|
|
xhr.onload = function(e) {
|
|
// 如果请求执行成功
|
|
var blob = this.response
|
|
var filename = '销售出库单.pdf'
|
|
var a = document.createElement('a')
|
|
// blob.type="application/octet-stream";
|
|
// 创键临时url对象
|
|
var url = URL.createObjectURL(blob)
|
|
a.href = url
|
|
a.download = filename
|
|
a.click()
|
|
// 释放之前创建的URL对象
|
|
window.URL.revokeObjectURL(url)
|
|
}
|
|
// 发送请求
|
|
xhr.send()
|
|
this.dialogVisible = false
|
|
this.printSid = ''
|
|
this.visibleDisabled = false
|
|
} else {
|
|
this.visibleDisabled = false
|
|
}
|
|
}).catch(() => {
|
|
this.visibleDisabled = false
|
|
})
|
|
},
|
|
toInfo(row) {
|
|
this.viewState = 2
|
|
this.$refs['divInfo'].showInfo(row)
|
|
},
|
|
handleLook(row) {
|
|
this.viewState = 3
|
|
this.$refs['divPeizhi'].showInfo(row)
|
|
},
|
|
doDel() {
|
|
if (this.sids.length === 1) {
|
|
const tip = '请确认是否删除所选 ' + this.sids.length + ' 条记录?'
|
|
this.$confirm(tip, '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: 'Loading',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
})
|
|
delBySid({ sid: this.sids[0] }).then((resp) => {
|
|
if (resp.success) {
|
|
loading.close()
|
|
this.$message({ showClose: true, type: 'success', message: '删除成功' })
|
|
this.getList()
|
|
} else {
|
|
loading.close()
|
|
}
|
|
}).catch(() => {
|
|
loading.close()
|
|
})
|
|
})
|
|
} else {
|
|
this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行删除操作'})
|
|
return
|
|
}
|
|
},
|
|
// 导出
|
|
doExport() {
|
|
if (this.sids.length > 0) {
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: 'Loading',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
})
|
|
exportExcel(this.sids).then((resp) => {
|
|
loading.close()
|
|
const blob = new Blob([resp], {
|
|
type: 'application/vnd.ms-excel'
|
|
})
|
|
const fileName = '车辆销售台账表' + '.xls'
|
|
const elink = document.createElement('a')
|
|
elink.download = fileName
|
|
elink.style.display = 'nonde'
|
|
elink.href = URL.createObjectURL(blob)
|
|
document.body.appendChild(elink)
|
|
elink.click()
|
|
URL.revokeObjectURL(elink.href)
|
|
document.body.removeChild(elink)
|
|
}).catch(() => {
|
|
loading.close()
|
|
})
|
|
} else {
|
|
this.$message({ showClose: true, type: 'error', message: '请至少选择一条记录进行导出操作' })
|
|
return
|
|
}
|
|
},
|
|
resetState() {
|
|
this.viewState = 1
|
|
},
|
|
doClose() {
|
|
this.$store.dispatch('tagsView/delView', this.$route)
|
|
this.$router.go(-1)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
</style>
|
|
|