|
@@ -1,20 +1,20 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <a-card size="small" :bordered="false" class="provinceFeeList-wrap searchBoxNormal">
|
|
|
+ <a-card size="small" :bordered="false" class="promotionFeeList-wrap searchBoxNormal">
|
|
|
<!-- 搜索条件 -->
|
|
|
<div class="table-page-search-wrapper" ref="tableSearch">
|
|
|
<a-form-model
|
|
|
- id="provinceFeeList-form"
|
|
|
+ id="promotionFeeList-form"
|
|
|
ref="ruleForm"
|
|
|
class="form-model-con"
|
|
|
layout="inline"
|
|
|
:rules="rules"
|
|
|
:model="queryParam">
|
|
|
<a-row :gutter="15">
|
|
|
- <a-col :md="5" :sm="24">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
<a-form-model-item label="月份" prop="beginDate">
|
|
|
<a-month-picker
|
|
|
- id="provinceFeeList-monthBox"
|
|
|
+ id="promotionFeeList-monthBox"
|
|
|
class="monthBox"
|
|
|
:disabled-date="disabledDate"
|
|
|
v-model="monthVal"
|
|
@@ -22,32 +22,50 @@
|
|
|
@change="onChangeMonth" />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="5" :sm="24">
|
|
|
- <a-form-model-item label="地区">
|
|
|
- <Area id="provinceFeeList-areaList" v-model="queryParam.provinceSn" placeholder="请选择省份"></Area>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="客户名称">
|
|
|
+ <dealerSubareaScopeList ref="dealerSubareaScopeList" id="promotionFeeList-dealerName" @change="custChange" />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="5" :sm="24">
|
|
|
- <a-form-item label="所在区域">
|
|
|
- <subarea id="provinceFeeList-subarea" ref="subarea" @change="subareaChange"></subarea>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="5" :sm="24">
|
|
|
- <a-form-model-item label="区域负责人">
|
|
|
- <BizUser id="provinceFeeList-bizUserSn" v-model="queryParam.subareaArea.bizUserSn"></BizUser>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="客户级别">
|
|
|
+ <v-select
|
|
|
+ v-model="queryParam.dealerLevel"
|
|
|
+ ref="dealerLevel"
|
|
|
+ id="promotionFeeList-dealerLevel"
|
|
|
+ code="DEALER_LEVEL"
|
|
|
+ placeholder="请选择客户级别"
|
|
|
+ allowClear></v-select>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="4" :sm="24">
|
|
|
+ <template v-if="advanced">
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-item label="所在区域">
|
|
|
+ <subarea id="promotionFeeList-subarea" ref="subarea" @change="subareaChange"></subarea>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="区域负责人">
|
|
|
+ <BizUser id="promotionFeeList-bizUserSn" v-model="queryParam.subareaArea.bizUserSn"></BizUser>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
+ <a-form-model-item label="地区">
|
|
|
+ <AreaList id="promotionFeeList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
|
|
|
+ </a-form-model-item>
|
|
|
+ </a-col>
|
|
|
+ </template>
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
<a-button
|
|
|
type="primary"
|
|
|
@click="handleSearch"
|
|
|
:disabled="disabled"
|
|
|
- id="provinceFeeList-refresh">查询</a-button>
|
|
|
+ id="promotionFeeList-refresh">查询</a-button>
|
|
|
<a-button
|
|
|
style="margin-left: 8px"
|
|
|
@click="resetSearchForm"
|
|
|
:disabled="disabled"
|
|
|
- id="provinceFeeList-reset">重置</a-button>
|
|
|
+ id="promotionFeeList-reset">重置</a-button>
|
|
|
<a-button
|
|
|
style="margin-left: 10px"
|
|
|
type="primary"
|
|
@@ -56,7 +74,11 @@
|
|
|
:disabled="disabled"
|
|
|
:loading="exportLoading"
|
|
|
v-if="$hasPermissions('B_tireFeeExport')"
|
|
|
- id="provinceFeeList-export">导出</a-button>
|
|
|
+ id="promotionFeeList-export">导出</a-button>
|
|
|
+ <a @click="advanced=!advanced" style="margin-left: 5px">
|
|
|
+ {{ advanced ? '收起' : '展开' }}
|
|
|
+ <a-icon :type="advanced ? 'up' : 'down'" />
|
|
|
+ </a>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
</a-form-model>
|
|
@@ -69,14 +91,24 @@
|
|
|
class="sTable fixPagination"
|
|
|
ref="table"
|
|
|
size="small"
|
|
|
- :rowKey="(record) => record.id"
|
|
|
+ :rowKey="(record) => record.no"
|
|
|
+ rowKeyName="no"
|
|
|
:style="{ height: tableHeight+70+'px' }"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
:scroll="{x:2200, y: tableHeight-120}"
|
|
|
:defaultLoadData="false"
|
|
|
- :showPagination="false"
|
|
|
bordered>
|
|
|
+ <template slot="footer" v-if="totalData&&totalData.length">
|
|
|
+ <a-row :gutter="15">
|
|
|
+ <a-col span="2">合计:</a-col>
|
|
|
+ <a-col span="22">
|
|
|
+ <a-col span="4" v-for="item in totalData" :key="item.key">
|
|
|
+ {{ item.title }}:{{ item[item.key] ||item[item.key] ==0?toThousands(item[item.key]) :'--' }}
|
|
|
+ </a-col>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </template>
|
|
|
</s-table>
|
|
|
</a-spin>
|
|
|
</a-card>
|
|
@@ -90,36 +122,45 @@ import moment from 'moment'
|
|
|
// 组件
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import subarea from '@/views/common/subarea.js'
|
|
|
-import Area from '@/views/common/area.js'
|
|
|
+import AreaList from '@/views/common/areaList.js'
|
|
|
+import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
|
|
|
import BizUser from '@/views/common/bizUser.js'
|
|
|
-import customerService from '@/views/common/customerService.vue'
|
|
|
// 接口
|
|
|
-import { promoProvinceList, promoProvinceTableTitle, promoProvinceCount, promoProvinceExport } from '@/api/reportData'
|
|
|
+import { promoSalesExpenseList, promoSalesExpenseTitle, promoSalesExpenseCount, promoSalesExpenseExport } from '@/api/reportData'
|
|
|
export default {
|
|
|
- name: 'ProvinceFeeList',
|
|
|
+ name: 'PromotionFeeList',
|
|
|
mixins: [commonMixin],
|
|
|
- components: { STable, VSelect, subarea, Area, BizUser, customerService },
|
|
|
+ components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, BizUser },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
|
disabled: false, // 查询、重置按钮是否可操作
|
|
|
+ advanced: true, // 高级搜索 展开/关闭
|
|
|
tableHeight: 0, // 表格高度
|
|
|
exportLoading: false, // 导出按钮加载状态
|
|
|
- // 查询条件
|
|
|
monthVal: moment().format('YYYY-MM'), // 初始化月份值
|
|
|
+ // 查询条件
|
|
|
queryParam: {
|
|
|
+ amountType: 'sales_promo',
|
|
|
beginDate: moment().startOf('month').format('YYYY-MM-DD') + ' 00:00:00', // 月份开始时间
|
|
|
endDate: moment().endOf('month').format('YYYY-MM-DD') + ' 23:59:59', // 月份结束时间
|
|
|
- provinceSn: undefined, // 省
|
|
|
+ dealerLevel: undefined, // 客户级别
|
|
|
+ customSn: undefined, // 客户sn
|
|
|
+ dealerEntity: {
|
|
|
+ dealerName: undefined, // 客户名称
|
|
|
+ provinceSn: undefined, // 省
|
|
|
+ citySn: undefined, // 市
|
|
|
+ districtSn: undefined // 区
|
|
|
+ },
|
|
|
subareaArea: {
|
|
|
subareaSn: '', // 区域
|
|
|
subareaAreaSn: '', // 分区
|
|
|
bizUserSn: undefined// 区域负责人
|
|
|
}
|
|
|
},
|
|
|
- countLabel: null, // 统计名称合集
|
|
|
- totalData: null, // 统计数据
|
|
|
- columns: [], // 表格列
|
|
|
+ columns: [], // 表头
|
|
|
+ countLabel: null, // 合计名称
|
|
|
+ totalData: null, // 合计
|
|
|
rules: {
|
|
|
'beginDate': [{ required: true, message: '请选择查询月份', trigger: 'change' }]
|
|
|
},
|
|
@@ -129,17 +170,18 @@ export default {
|
|
|
this.spinning = true
|
|
|
const params = Object.assign(parameter, this.queryParam)
|
|
|
// 获取列表数据 有分页
|
|
|
- return promoProvinceList(params).then(res => {
|
|
|
+ return promoSalesExpenseList(params).then(res => {
|
|
|
let data
|
|
|
if (res.status == 200) {
|
|
|
data = res.data
|
|
|
// 计算表格序号
|
|
|
- for (var i = 0; i < data.length; i++) {
|
|
|
- data[i].no = i + 1
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
+ for (var i = 0; i < data.list.length; i++) {
|
|
|
+ data.list[i].no = no + i + 1
|
|
|
}
|
|
|
this.disabled = false
|
|
|
// 统计
|
|
|
- // this.getCount(params)
|
|
|
+ this.getCount(params)
|
|
|
}
|
|
|
this.spinning = false
|
|
|
return data
|
|
@@ -147,6 +189,17 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ advanced (newValue, oldValue) {
|
|
|
+ const _this = this
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
+ _this.setTableH()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
|
|
|
+ this.setTableH()
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 选择月份 禁用选择当月以后日期
|
|
|
disabledDate (current) {
|
|
@@ -174,7 +227,7 @@ export default {
|
|
|
// 获取表头
|
|
|
async getTableTitle () {
|
|
|
const _this = this
|
|
|
- const tableTitle = await promoProvinceTableTitle().then(res => res.data)
|
|
|
+ const tableTitle = await promoSalesExpenseTitle().then(res => res.data)
|
|
|
this.columns = tableTitle.list
|
|
|
this.columns.unshift({ title: '序号', customRender: 'no', dataIndex: 'no', fixed: 'left', align: 'center' })
|
|
|
this.countLabel = tableTitle.count
|
|
@@ -195,9 +248,26 @@ export default {
|
|
|
})
|
|
|
this.resetSearchForm()
|
|
|
},
|
|
|
+ // 查询
|
|
|
+ handleSearch () {
|
|
|
+ const _this = this
|
|
|
+ this.$refs.ruleForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ _this.$refs.table.refresh(true)
|
|
|
+ } else {
|
|
|
+ _this.$message.error('请选择查询月份')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 客户名称 change
|
|
|
+ custChange (val) {
|
|
|
+ this.queryParam.dealerEntity.dealerName = val.name
|
|
|
+ this.queryParam.customSn = val.key
|
|
|
+ },
|
|
|
// 统计
|
|
|
getCount (params) {
|
|
|
- promoProvinceCount(params).then(res => {
|
|
|
+ promoSalesExpenseCount(params).then(res => {
|
|
|
if (res.status == 200 && res.data) {
|
|
|
const mergedList = this.countLabel.map(item => {
|
|
|
const key = item.key
|
|
@@ -211,18 +281,6 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 查询
|
|
|
- handleSearch () {
|
|
|
- const _this = this
|
|
|
- this.$refs.ruleForm.validate(valid => {
|
|
|
- if (valid) {
|
|
|
- _this.$refs.table.refresh(true)
|
|
|
- } else {
|
|
|
- _this.$message.error('请选择查询月份')
|
|
|
- return false
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 地区
|
|
|
areaChange (val) {
|
|
|
this.queryParam.dealerEntity.provinceSn = val[0] ? val[0] : undefined
|
|
@@ -239,13 +297,21 @@ export default {
|
|
|
this.queryParam.beginDate = moment().startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
|
|
|
this.queryParam.endDate = moment().endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
|
|
|
this.monthVal = moment().format('YYYY-MM')
|
|
|
- this.queryParam.provinceSn = undefined
|
|
|
+ this.queryParam.dealerEntity.provinceSn = undefined
|
|
|
+ this.queryParam.dealerEntity.citySn = undefined
|
|
|
+ this.queryParam.dealerEntity.districtSn = undefined
|
|
|
+ this.queryParam.dealerEntity.dealerName = undefined
|
|
|
+ this.queryParam.customSn = undefined
|
|
|
this.queryParam.subareaArea.subareaSn = ''
|
|
|
this.queryParam.subareaArea.subareaAreaSn = ''
|
|
|
this.queryParam.subareaArea.bizUserSn = undefined
|
|
|
- this.$refs.subarea.clearData()
|
|
|
+ this.queryParam.dealerLevel = undefined
|
|
|
+ this.$refs.dealerSubareaScopeList.resetForm()
|
|
|
+ if (this.advanced) {
|
|
|
+ this.$refs.subarea.clearData()
|
|
|
+ this.$refs.areaList.clearData()
|
|
|
+ }
|
|
|
this.totalData = null
|
|
|
- this.$refs.areaList.clearData()
|
|
|
this.$refs.table.clearTable()
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
},
|
|
@@ -267,7 +333,7 @@ export default {
|
|
|
const params = JSON.parse(JSON.stringify(_this.queryParam))
|
|
|
_this.exportLoading = true
|
|
|
_this.spinning = true
|
|
|
- hdExportExcel(promoProvinceExport, params, '促销费用报表(省份)', function () {
|
|
|
+ hdExportExcel(promoSalesExpenseExport, params, '促销费用报表', function () {
|
|
|
_this.exportLoading = false
|
|
|
_this.spinning = false
|
|
|
})
|
|
@@ -294,8 +360,8 @@ export default {
|
|
|
activated () {
|
|
|
// 如果是新页签打开,则重置当前页面
|
|
|
if (this.$store.state.app.isNewTab) {
|
|
|
- this.pageInit()
|
|
|
this.getTableTitle()
|
|
|
+ this.pageInit()
|
|
|
}
|
|
|
}
|
|
|
}
|