customerFeeList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="customerFeeList-wrap searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div class="table-page-search-wrapper" ref="tableSearch">
  6. <a-form-model
  7. id="customerFeeList-form"
  8. ref="ruleForm"
  9. class="form-model-con"
  10. layout="inline"
  11. :rules="rules"
  12. :model="queryParam">
  13. <a-row :gutter="15">
  14. <a-col :md="6" :sm="24">
  15. <a-form-model-item label="月份" prop="queryDate">
  16. <a-month-picker
  17. id="customerFeeList-monthBox"
  18. class="monthBox"
  19. :disabled-date="disabledDate"
  20. v-model="monthVal"
  21. placeholder="请选择月份"
  22. @change="onChangeMonth" />
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-model-item label="客户名称">
  27. <dealerSubareaScopeList ref="dealerSubareaScopeList" id="customerFeeList-dealerName" @change="custChange" />
  28. </a-form-model-item>
  29. </a-col>
  30. <a-col :md="6" :sm="24">
  31. <a-form-model-item label="客户级别">
  32. <v-select
  33. v-model="queryParam.dealerLevel"
  34. ref="dealerLevel"
  35. id="customerFeeList-dealerLevel"
  36. code="DEALER_LEVEL"
  37. placeholder="请选择客户级别"
  38. allowClear></v-select>
  39. </a-form-model-item>
  40. </a-col>
  41. <template v-if="advanced">
  42. <a-col :md="6" :sm="24">
  43. <a-form-item label="所在区域">
  44. <subarea id="customerFeeList-subarea" ref="subarea" @change="subareaChange"></subarea>
  45. </a-form-item>
  46. </a-col>
  47. <a-col :md="6" :sm="24">
  48. <a-form-model-item label="区域负责人">
  49. <BizUser id="customerFeeList-bizUserSn" v-model="queryParam.subareaArea.bizUserSn"></BizUser>
  50. </a-form-model-item>
  51. </a-col>
  52. <a-col :md="6" :sm="24">
  53. <a-form-model-item label="地区">
  54. <AreaList id="customerFeeList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
  55. </a-form-model-item>
  56. </a-col>
  57. <a-col :md="6" :sm="24">
  58. <a-form-model-item label="客服">
  59. <customerService ref="customerName" id="customerFeeList-customerName" v-model="queryParam.bizUserSn"></customerService>
  60. </a-form-model-item>
  61. </a-col>
  62. </template>
  63. <a-col :md="6" :sm="24">
  64. <a-button
  65. type="primary"
  66. @click="handleSearch"
  67. :disabled="disabled"
  68. id="customerFeeList-refresh">查询</a-button>
  69. <a-button
  70. style="margin-left: 8px"
  71. @click="resetSearchForm"
  72. :disabled="disabled"
  73. id="customerFeeList-reset">重置</a-button>
  74. <a-button
  75. style="margin-left: 10px"
  76. type="primary"
  77. class="button-warning"
  78. @click="handleExport"
  79. :disabled="disabled"
  80. :loading="exportLoading"
  81. v-if="$hasPermissions('B_tireFeeExport')"
  82. id="customerFeeList-export">导出</a-button>
  83. <a @click="advanced=!advanced" style="margin-left: 5px">
  84. {{ advanced ? '收起' : '展开' }}
  85. <a-icon :type="advanced ? 'up' : 'down'" />
  86. </a>
  87. </a-col>
  88. </a-row>
  89. </a-form-model>
  90. </div>
  91. </a-card>
  92. <a-card size="small" :bordered="false">
  93. <a-spin :spinning="spinning" tip="Loading...">
  94. <!-- 列表 -->
  95. <s-table
  96. class="sTable fixPagination"
  97. ref="table"
  98. size="small"
  99. :rowKey="(record) => record.no"
  100. rowKeyName="no"
  101. :style="{ height: tableHeight+70+'px' }"
  102. :columns="columns"
  103. :data="loadData"
  104. :scroll="{x:2200, y: tableHeight-120}"
  105. :defaultLoadData="false"
  106. bordered>
  107. </s-table>
  108. </a-spin>
  109. </a-card>
  110. </div>
  111. </template>
  112. <script>
  113. import { commonMixin } from '@/utils/mixin'
  114. import { hdExportExcel } from '@/libs/exportExcel'
  115. import moment from 'moment'
  116. // 组件
  117. import { STable, VSelect } from '@/components'
  118. import subarea from '@/views/common/subarea.js'
  119. import AreaList from '@/views/common/areaList.js'
  120. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  121. import BizUser from '@/views/common/bizUser.js'
  122. import customerService from '@/views/common/customerService.vue'
  123. // 接口
  124. import { tireFeeReportList, tireFeeReportCount, tireFeeListExport } from '@/api/reportData'
  125. export default {
  126. name: 'CustomerFeeList',
  127. mixins: [commonMixin],
  128. components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, BizUser, customerService },
  129. data () {
  130. return {
  131. spinning: false,
  132. disabled: false, // 查询、重置按钮是否可操作
  133. advanced: true, // 高级搜索 展开/关闭
  134. tableHeight: 0, // 表格高度
  135. exportLoading: false, // 导出按钮加载状态
  136. monthVal: moment().format('YYYY-MM'), // 初始化月份值
  137. // 查询条件
  138. queryParam: {
  139. queryType: 'month', // 开单统计报表(客户)
  140. queryDate: moment().format('YYYYMM'), // 选择月份
  141. dealerLevel: undefined, // 客户等级
  142. customSn: undefined, // 客户sn
  143. dealerEntity: {
  144. dealerName: undefined, // 客户名称
  145. provinceSn: undefined, // 省
  146. citySn: undefined, // 市
  147. districtSn: undefined // 区
  148. },
  149. subareaArea: {
  150. subareaSn: '', // 区域
  151. subareaAreaSn: '', // 分区
  152. bizUserSn: undefined// 区域负责人
  153. },
  154. bizUserSn: undefined// 客服
  155. },
  156. totalData: null, // 合计
  157. rules: {
  158. 'queryDate': [{ required: true, message: '请选择查询月份', trigger: 'change' }]
  159. },
  160. // 加载数据方法 必须为 Promise 对象
  161. loadData: parameter => {
  162. this.disabled = true
  163. this.spinning = true
  164. const params = Object.assign(parameter, this.queryParam)
  165. // 获取列表数据 有分页
  166. return tireFeeReportList(params).then(res => {
  167. let data
  168. if (res.status == 200) {
  169. data = res.data
  170. // 计算表格序号
  171. const no = (data.pageNo - 1) * data.pageSize
  172. for (var i = 0; i < data.list.length; i++) {
  173. data.list[i].no = no + i + 1
  174. }
  175. this.disabled = false
  176. }
  177. this.spinning = false
  178. return data
  179. })
  180. }
  181. }
  182. },
  183. watch: {
  184. advanced (newValue, oldValue) {
  185. const _this = this
  186. this.$nextTick(() => { // 页面渲染完成后的回调
  187. _this.setTableH()
  188. })
  189. },
  190. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  191. this.setTableH()
  192. }
  193. },
  194. computed: {
  195. columns () {
  196. const _this = this
  197. const arr = [
  198. { title: '序号', dataIndex: 'no', width: '40px', align: 'center', fixed: 'left' },
  199. { title: '月份', dataIndex: 'monthData', width: '80px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
  200. { title: '区域', dataIndex: 'subareaArea.subareaName', width: '80px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
  201. { title: '分区', dataIndex: 'subareaArea.subareaAreaName', width: '80px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
  202. { title: '区域负责人', dataIndex: 'subareaArea.bizUserName', width: '80px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
  203. { title: '省份', dataIndex: 'dealerEntity.provinceName', width: '80px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
  204. { title: '客户名称', dataIndex: 'dealerEntity.dealerName', width: '100px', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true, fixed: 'left' },
  205. { title: '客户级别', dataIndex: 'dealerEntity.dealerLevelDictValue', width: '80px', align: 'center', customRender: function (text) { return text || '--' }, fixed: 'left' },
  206. { title: '箭牌滤清器', dataIndex: 'serviceAmountProvince', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  207. { title: '箭牌变速箱滤清器', dataIndex: 'serviceAmountProvince1', width: '110px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  208. { title: '冠牌滤清器', dataIndex: 'serviceAmountProvince2', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  209. { title: '滤清器合计', dataIndex: 'serviceAmountProvince3', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  210. { title: '箭牌雨刮片', dataIndex: 'serviceAmountProvince4', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  211. { title: '箭牌雨燕雨刮片', dataIndex: 'serviceAmountProvince5', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  212. { title: '冠牌雨刮片', dataIndex: 'serviceAmountProvince6', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  213. { title: '雨刮片合计', dataIndex: 'serviceAmountProvince7', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  214. { title: '箭牌喇叭', dataIndex: 'serviceAmountProvince8', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  215. { title: '箭牌刹车片', dataIndex: 'serviceAmountProvince9', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  216. { title: 'TBU+箭牌感应线', dataIndex: 'serviceAmountProvincea', width: '110px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  217. { title: '冠牌刹车片', dataIndex: 'serviceAmountProvincec', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  218. { title: 'TBU刹车片', dataIndex: 'serviceAmountProvinceb', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  219. { title: 'TBU至惠刹车片', dataIndex: 'serviceAmountProvinced', width: '110px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  220. { title: 'TBU刹车油', dataIndex: 'serviceAmountProvincee', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  221. { title: 'TBU-P刹车盘', dataIndex: 'serviceAmountProvincef', width: '110px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  222. { title: '制动系统合计', dataIndex: 'serviceAmountProvinceg', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  223. { title: '汇箭蓄电池', dataIndex: 'serviceAmountProvinceh', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  224. { title: '布瑞斯蓄电池', dataIndex: 'serviceAmountProvincei', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  225. { title: '蓄电池合计', dataIndex: 'serviceAmountProvincej', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  226. { title: '德路斯机油', dataIndex: 'serviceAmountProvincek21', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  227. { title: '德路斯变速箱油', dataIndex: 'serviceAmountProvincek', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  228. { title: '德路斯刹车油', dataIndex: 'serviceAmountProvincel', width: '90px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  229. { title: '德路斯汽车养护产品', dataIndex: 'serviceAmountProvincem', width: '120px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  230. { title: '科润星机油', dataIndex: 'serviceAmountProvince12', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  231. { title: '油品合计', dataIndex: 'serviceAmountProvince13', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  232. { title: '稳升点火线圈', dataIndex: 'serviceAmountProvince14', width: '100px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  233. { title: '稳升LED灯', dataIndex: 'serviceAmountProvince15', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  234. { title: '稳升合计', dataIndex: 'serviceAmountProvince16', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  235. { title: '全品类', dataIndex: 'serviceAmountProvince17', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  236. { title: '品牌合计', dataIndex: 'serviceAmountProvince99', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  237. { title: '轮胎', dataIndex: 'serviceAmountProvince18', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  238. { title: 'NGk火花塞', dataIndex: 'serviceAmountProvince19', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  239. { title: '全品类(含轮胎、NGM)', dataIndex: 'serviceAmountProvince22', width: '80px', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  240. ]
  241. return arr
  242. }
  243. },
  244. methods: {
  245. // 选择月份 禁用选择当月以后日期
  246. disabledDate (current) {
  247. return current && current >= moment().endOf('day')
  248. },
  249. // 选择月份 change
  250. onChangeMonth (date, dateString) {
  251. this.monthVal = dateString
  252. if (date && dateString != '') {
  253. this.queryParam.queryDate = dateString.replace('-', '')
  254. } else {
  255. this.queryParam.queryDate = void 0
  256. }
  257. },
  258. // 查询
  259. handleSearch () {
  260. const _this = this
  261. this.$refs.ruleForm.validate(valid => {
  262. if (valid) {
  263. _this.$refs.table.refresh(true)
  264. } else {
  265. _this.$message.error('请选择查询月份')
  266. return false
  267. }
  268. })
  269. },
  270. // 客户名称 change
  271. custChange (val) {
  272. this.queryParam.dealerEntity.dealerName = val.name
  273. this.queryParam.customSn = val.key
  274. },
  275. // 地区
  276. areaChange (val) {
  277. this.queryParam.dealerEntity.provinceSn = val[0] ? val[0] : undefined
  278. this.queryParam.dealerEntity.citySn = val[1] ? val[1] : undefined
  279. this.queryParam.dealerEntity.districtSn = val[2] ? val[2] : undefined
  280. },
  281. // 区域分区 change
  282. subareaChange (val) {
  283. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : ''
  284. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : ''
  285. },
  286. // 重置
  287. resetSearchForm () {
  288. this.queryParam.queryType = 'month'
  289. this.monthVal = moment().format('YYYY-MM')
  290. this.queryParam.queryDate = moment().format('YYYYMM')
  291. this.queryParam.dealerEntity.provinceSn = undefined
  292. this.queryParam.dealerEntity.citySn = undefined
  293. this.queryParam.dealerEntity.districtSn = undefined
  294. this.queryParam.dealerEntity.dealerName = undefined
  295. this.queryParam.customSn = undefined
  296. this.queryParam.bizUserSn = undefined
  297. this.queryParam.subareaArea.subareaSn = ''
  298. this.queryParam.subareaArea.subareaAreaSn = ''
  299. this.queryParam.subareaArea.bizUserSn = undefined
  300. this.queryParam.dealerLevel = undefined
  301. this.queryParam.provinceFlag = undefined
  302. this.$refs.subarea.clearData()
  303. if (this.advanced) {
  304. this.$refs.dealerSubareaScopeList.resetForm()
  305. }
  306. this.totalData = null
  307. this.$refs.areaList.clearData()
  308. this.$refs.table.clearTable()
  309. this.$refs.ruleForm.resetFields()
  310. },
  311. // 导出 必填判断
  312. handleExport () {
  313. const _this = this
  314. this.$refs.ruleForm.validate(valid => {
  315. if (valid) {
  316. _this.exportList()
  317. } else {
  318. _this.$message.error('请选择查询月份')
  319. return false
  320. }
  321. })
  322. },
  323. // 导出
  324. exportList () {
  325. const _this = this
  326. const params = JSON.parse(JSON.stringify(_this.queryParam))
  327. _this.exportLoading = true
  328. _this.spinning = true
  329. hdExportExcel(tireFeeListExport, params, '轮胎月度费用报表', function () {
  330. _this.exportLoading = false
  331. _this.spinning = false
  332. })
  333. },
  334. // 初始化
  335. pageInit () {
  336. this.$nextTick(() => { // 页面渲染完成后的回调
  337. this.setTableH()
  338. })
  339. this.resetSearchForm()
  340. },
  341. // 计算表格高度
  342. setTableH () {
  343. const tableSearchH = this.$refs.tableSearch.offsetHeight
  344. this.tableHeight = window.innerHeight - tableSearchH - 280
  345. }
  346. },
  347. mounted () {
  348. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  349. this.pageInit()
  350. }
  351. },
  352. activated () {
  353. // 如果是新页签打开,则重置当前页面
  354. if (this.$store.state.app.isNewTab) {
  355. this.pageInit()
  356. }
  357. }
  358. }
  359. </script>
  360. <style lang="less" scoped>
  361. .monthBox{
  362. width: 100%;
  363. /deep/.ant-calendar-picker-icon{
  364. display:none !important;
  365. }
  366. /deep/.ant-calendar-picker input{
  367. text-align:center;
  368. }
  369. }
  370. </style>