monthQueryList.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="monthQueryList-wrap searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div class="table-page-search-wrapper" ref="tableSearch">
  6. <a-form-model
  7. id="monthQueryList-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="monthQueryList-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. <AreaList id="monthQueryList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
  28. </a-form-model-item>
  29. </a-col>
  30. <a-col :md="6" :sm="24">
  31. <a-form-item label="区域/分区">
  32. <subarea id="monthQueryList-subarea" ref="subarea" @change="subareaChange"></subarea>
  33. </a-form-item>
  34. </a-col>
  35. <template v-if="advanced">
  36. <a-col :md="6" :sm="24">
  37. <a-form-model-item label="客户名称">
  38. <dealerSubareaScopeList ref="dealerSubareaScopeList" id="monthQueryList-dealerName" @change="custChange" />
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :md="6" :sm="24">
  42. <a-form-model-item label="轮胎省仓名称">
  43. <dealerSubareaScopeList ref="provinceDealerList" placeholder="请输入轮胎省仓名称" id="monthQueryList-provinceDealerName" @change="custProvinceChange" />
  44. </a-form-model-item>
  45. </a-col>
  46. <a-col :md="6" :sm="24">
  47. <a-form-model-item label="客户级别">
  48. <v-select
  49. v-model="queryParam.dealerLevel"
  50. ref="dealerLevel"
  51. id="monthQueryList-dealerLevel"
  52. code="DEALER_LEVEL"
  53. placeholder="请选择客户级别"
  54. allowClear></v-select>
  55. </a-form-model-item>
  56. </a-col>
  57. <a-col :md="6" :sm="24">
  58. <a-form-model-item label="轮胎省仓">
  59. <v-select
  60. v-model="queryParam.provinceFlag"
  61. ref="provinceFlag"
  62. id="monthQueryList-provinceFlag"
  63. code="FlAG"
  64. placeholder="请选择是否是轮胎省仓"
  65. allowClear></v-select>
  66. </a-form-model-item>
  67. </a-col>
  68. </template>
  69. <a-col :md="6" :sm="24">
  70. <a-button
  71. type="primary"
  72. @click="handleSearch"
  73. :disabled="disabled"
  74. id="monthQueryList-refresh">查询</a-button>
  75. <a-button
  76. style="margin-left: 8px"
  77. @click="resetSearchForm"
  78. :disabled="disabled"
  79. id="monthQueryList-reset">重置</a-button>
  80. <a-button
  81. style="margin-left: 10px"
  82. type="primary"
  83. class="button-warning"
  84. @click="handleExport"
  85. :disabled="disabled"
  86. :loading="exportLoading"
  87. v-if="$hasPermissions('B_tireFeeExport')"
  88. id="monthQueryList-export">导出</a-button>
  89. <a @click="advanced=!advanced" style="margin-left: 5px">
  90. {{ advanced ? '收起' : '展开' }}
  91. <a-icon :type="advanced ? 'up' : 'down'" />
  92. </a>
  93. </a-col>
  94. </a-row>
  95. </a-form-model>
  96. </div>
  97. </a-card>
  98. <a-card size="small" :bordered="false">
  99. <a-spin :spinning="spinning" tip="Loading...">
  100. <!-- 列表 -->
  101. <s-table
  102. class="sTable fixPagination"
  103. ref="table"
  104. size="small"
  105. :rowKey="(record) => record.no"
  106. rowKeyName="no"
  107. :style="{ height: tableHeight+70+'px' }"
  108. :columns="columns"
  109. :data="loadData"
  110. :scroll="{ y: tableHeight-120}"
  111. :defaultLoadData="false"
  112. bordered>
  113. <!-- 地区 -->
  114. <template slot="addressInfo" slot-scope="text, record">
  115. <span v-if="record.dealerEntity&&record.dealerEntity.provinceName">
  116. {{ record.dealerEntity.provinceName }}{{ '/'+record.dealerEntity.cityName }}{{ '/'+record.dealerEntity.districtName }}
  117. </span>
  118. <span v-else>--</span>
  119. </template>
  120. <!-- 是否是省仓客户 -->
  121. <template slot="provinceFlag" slot-scope="text, record">
  122. {{ record.provinceFlag?record.provinceFlag==0?'否':'是':'--' }}
  123. </template>
  124. <template slot="footer">
  125. <a-row :gutter="15">
  126. <a-col :md="4" :sm="24">总量提升奖励:{{ (totalData && (totalData.increaseRewardAmount || totalData.increaseRewardAmount==0)) ? toThousands(totalData.increaseRewardAmount): '--' }}</a-col>
  127. <a-col :md="4" :sm="24">总量工厂承担60%:{{ (totalData && (totalData.increaseRewardShareFactory || totalData.increaseRewardShareFactory==0)) ? toThousands(totalData.increaseRewardShareFactory): '--' }}</a-col>
  128. <a-col :md="5" :sm="24">总量供应链管理部承担40%:{{ (totalData && (totalData.increaseRewardShareSys || totalData.increaseRewardShareSys==0)) ? toThousands(totalData.increaseRewardShareSys): '--' }}</a-col>
  129. <a-col :md="4" :sm="24">运费补贴:{{ (totalData && (totalData.transSubsidy || totalData.transSubsidy==0)) ? toThousands(totalData.transSubsidy): '--' }}</a-col>
  130. <a-col :md="4" :sm="24">累计积分:{{ (totalData && (totalData.totalPoint || totalData.totalPoint==0)) ? toThousands(totalData.totalPoint): '--' }}</a-col>
  131. <a-col :md="4" :sm="24">当期积分返利券:{{ (totalData && (totalData.currentPoint || totalData.currentPoint==0)) ? toThousands(totalData.currentPoint): '--' }}</a-col>
  132. <a-col :md="4" :sm="24">积分工厂承担60%:{{ (totalData && (totalData.currentPointShareFactory || totalData.currentPointShareFactory==0)) ? toThousands(totalData.currentPointShareFactory): '--' }}</a-col>
  133. <a-col :md="5" :sm="24">积分供应链管理部承担40%:{{ (totalData && (totalData.currentPointShareSys || totalData.currentPointShareSys==0)) ?toThousands(totalData.currentPointShareSys): '--' }}</a-col>
  134. <a-col :md="4" :sm="24">平台服务费:{{ (totalData && (totalData.serviceAmountSys || totalData.serviceAmountSys==0)) ? toThousands(totalData.serviceAmountSys): '--' }}</a-col>
  135. <a-col :md="4" :sm="24">轮胎省仓服务费:{{ (totalData && (totalData.serviceAmountProvince || totalData.serviceAmountProvince==0)) ? toThousands(totalData.serviceAmountProvince): '--' }}</a-col>
  136. </a-row>
  137. </template>
  138. </s-table>
  139. </a-spin>
  140. </a-card>
  141. <!-- 导出提示框 -->
  142. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  143. </div>
  144. </template>
  145. <script>
  146. import { commonMixin } from '@/utils/mixin'
  147. import { hdExportExcel } from '@/libs/exportExcel'
  148. import moment from 'moment'
  149. // 组件
  150. import { STable, VSelect } from '@/components'
  151. import subarea from '@/views/common/subarea.js'
  152. import AreaList from '@/views/common/areaList.js'
  153. import reportModal from '@/views/common/reportModal.vue'
  154. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  155. // 接口
  156. import { tireFeeReportList, tireFeeReportCount, tireFeeListExport } from '@/api/reportData'
  157. export default {
  158. name: 'MonthQueryList',
  159. mixins: [commonMixin],
  160. components: { STable, VSelect, subarea, AreaList, dealerSubareaScopeList, reportModal },
  161. data () {
  162. return {
  163. spinning: false,
  164. disabled: false, // 查询、重置按钮是否可操作
  165. advanced: true, // 高级搜索 展开/关闭
  166. tableHeight: 0, // 表格高度
  167. exportLoading: false, // 导出按钮加载状态
  168. showExport: false, // 导出弹窗
  169. monthVal: moment().format('YYYY-MM'), // 初始化月份值
  170. // 查询条件
  171. queryParam: {
  172. queryType: 'month', // 轮胎月度费用报表
  173. queryDate: moment().format('YYYYMM'), // 选择月份
  174. dealerLevel: undefined, // 客户等级
  175. customSn: undefined, // 客户sn
  176. parentDealerSn: undefined, // 轮胎省仓sn
  177. dealerEntity: {
  178. dealerName: undefined, // 客户名称
  179. provinceSn: undefined, // 省
  180. citySn: undefined, // 市
  181. districtSn: undefined // 区
  182. },
  183. parentDealerEntity: {
  184. dealerName: undefined // 轮胎省仓名称
  185. },
  186. subareaArea: {
  187. subareaSn: '', // 区域
  188. subareaAreaSn: '' // 分区
  189. },
  190. provinceFlag: undefined// 是否是轮胎省仓 1是 0否
  191. },
  192. totalData: null, // 合计
  193. rules: {
  194. 'queryDate': [{ required: true, message: '请选择查询月份', trigger: 'change' }]
  195. },
  196. // 加载数据方法 必须为 Promise 对象
  197. loadData: parameter => {
  198. this.disabled = true
  199. this.spinning = true
  200. const params = Object.assign(parameter, this.queryParam)
  201. // 获取列表数据 有分页
  202. return tireFeeReportList(params).then(res => {
  203. let data
  204. if (res.status == 200) {
  205. data = res.data
  206. // 计算表格序号
  207. const no = (data.pageNo - 1) * data.pageSize
  208. for (var i = 0; i < data.list.length; i++) {
  209. data.list[i].no = no + i + 1
  210. }
  211. this.disabled = false
  212. this.getCount(params)
  213. }
  214. this.spinning = false
  215. return data
  216. })
  217. }
  218. }
  219. },
  220. watch: {
  221. advanced (newValue, oldValue) {
  222. const _this = this
  223. this.$nextTick(() => { // 页面渲染完成后的回调
  224. _this.setTableH()
  225. })
  226. },
  227. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  228. this.setTableH()
  229. }
  230. },
  231. computed: {
  232. columns () {
  233. const _this = this
  234. const arr = [
  235. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  236. { title: '地区', scopedSlots: { customRender: 'addressInfo' }, width: '12%', align: 'center' },
  237. { title: '区域', dataIndex: 'subareaArea.subareaName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  238. { title: '客户名称', dataIndex: 'dealerEntity.dealerName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  239. { title: '客户级别', dataIndex: 'dealerEntity.dealerLevelDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  240. { title: '轮胎省仓', dataIndex: 'provinceFlag', scopedSlots: { customRender: 'provinceFlag' }, width: '8%', align: 'center' },
  241. { title: '轮胎省仓名称', dataIndex: 'parentDealerEntity.dealerName', width: '15%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  242. { title: '总量提升奖励', dataIndex: 'increaseRewardAmount', width: '11%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  243. { title: <div>总量工厂<div>承担60%</div></div>, dataIndex: 'increaseRewardShareFactory', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  244. { title: <div>总量供应链管理部<div>承担40%</div></div>, dataIndex: 'increaseRewardShareSys', width: '13%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  245. { title: <a-tooltip placement='top' title='轮胎省仓出库加盟商数量*5'>运费补贴&nbsp;<a-icon type="question-circle" /></a-tooltip>, dataIndex: 'transSubsidy', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  246. { title: <a-tooltip placement='top' title='截止当前时间的往期累计积分'>累计积分&nbsp;<a-icon type="question-circle" /></a-tooltip>, dataIndex: 'totalPoint', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  247. { title: <div>当期积分<div>返利券</div></div>, dataIndex: 'currentPoint', width: '9%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  248. { title: <div>积分工厂<div>承担60%</div></div>, dataIndex: 'currentPointShareFactory', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  249. { title: <div>积分供应链管理部<div>承担40%</div></div>, dataIndex: 'currentPointShareSys', width: '15%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  250. { title: '平台服务费', dataIndex: 'serviceAmountSys', width: '10%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  251. { title: '轮胎省仓服务费', dataIndex: 'serviceAmountProvince', width: '11%', align: 'right', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  252. ]
  253. return arr
  254. }
  255. },
  256. methods: {
  257. // 根据月份获取第一天和最后一天
  258. // getMonthDetailDay (dateInfo) {
  259. // let nowDate = ''
  260. // if (!dateInfo) {
  261. // nowDate = moment().format('YYYY-MM')
  262. // } else {
  263. // nowDate = dateInfo
  264. // }
  265. // 月份的第一天
  266. // const firstDayOfMonth = moment(nowDate).format('YYYY-MM-DD') + ' 00:00:00'
  267. // // 月份的最后一天
  268. // const lastDayOfMonth = moment(nowDate).endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
  269. // return { firstDay: firstDayOfMonth, lastDay: lastDayOfMonth }
  270. // },
  271. // 选择月份 禁用选择当月以后日期
  272. disabledDate (current) {
  273. return current && current >= moment().endOf('day')
  274. },
  275. // 选择月份 change
  276. onChangeMonth (date, dateString) {
  277. this.monthVal = dateString
  278. if (date && dateString != '') {
  279. this.queryParam.queryDate = dateString.replace('-', '')
  280. } else {
  281. this.queryParam.queryDate = void 0
  282. }
  283. },
  284. // 查询
  285. handleSearch () {
  286. const _this = this
  287. this.$refs.ruleForm.validate(valid => {
  288. if (valid) {
  289. _this.$refs.table.refresh(true)
  290. } else {
  291. _this.$message.error('请选择查询月份')
  292. return false
  293. }
  294. })
  295. },
  296. // 客户名称 change
  297. custChange (val) {
  298. this.queryParam.dealerEntity.dealerName = val.name
  299. this.queryParam.customSn = val.key
  300. },
  301. // 轮胎省仓客户名称 change
  302. custProvinceChange (val) {
  303. this.queryParam.parentDealerEntity.dealerName = val.name
  304. this.queryParam.parentDealerSn = val.key
  305. },
  306. // 统计
  307. getCount (params) {
  308. tireFeeReportCount(params).then(res => {
  309. if (res.status == 200 && res.data) {
  310. this.totalData = res.data
  311. } else {
  312. this.totalData = null
  313. }
  314. })
  315. },
  316. // 地区
  317. areaChange (val) {
  318. this.queryParam.dealerEntity.provinceSn = val[0] ? val[0] : undefined
  319. this.queryParam.dealerEntity.citySn = val[1] ? val[1] : undefined
  320. this.queryParam.dealerEntity.districtSn = val[2] ? val[2] : undefined
  321. },
  322. // 区域分区 change
  323. subareaChange (val) {
  324. this.queryParam.subareaArea.subareaSn = val[0] ? val[0] : ''
  325. this.queryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : ''
  326. },
  327. // 重置
  328. resetSearchForm () {
  329. this.queryParam.queryType = 'month'
  330. this.monthVal = moment().format('YYYY-MM')
  331. this.queryParam.queryDate = moment().format('YYYYMM')
  332. this.queryParam.dealerEntity.provinceSn = undefined
  333. this.queryParam.dealerEntity.citySn = undefined
  334. this.queryParam.dealerEntity.districtSn = undefined
  335. this.queryParam.dealerEntity.dealerName = undefined
  336. this.queryParam.parentDealerEntity.dealerName = undefined
  337. this.queryParam.customSn = undefined
  338. this.queryParam.parentDealerSn = undefined
  339. this.queryParam.subareaArea.subareaSn = ''
  340. this.queryParam.subareaArea.subareaAreaSn = ''
  341. this.queryParam.dealerLevel = undefined
  342. this.queryParam.provinceFlag = undefined
  343. this.$refs.subarea.clearData()
  344. if (this.advanced) {
  345. this.$refs.dealerSubareaScopeList.resetForm()
  346. this.$refs.provinceDealerList.resetForm()
  347. }
  348. this.totalData = null
  349. this.$refs.areaList.clearData()
  350. this.$refs.table.clearTable()
  351. this.$refs.ruleForm.resetFields()
  352. },
  353. // 导出 必填判断
  354. handleExport () {
  355. const _this = this
  356. this.$refs.ruleForm.validate(valid => {
  357. if (valid) {
  358. _this.exportList()
  359. } else {
  360. _this.$message.error('请选择查询月份')
  361. return false
  362. }
  363. })
  364. },
  365. // 导出
  366. exportList () {
  367. const _this = this
  368. const params = JSON.parse(JSON.stringify(_this.queryParam))
  369. _this.exportLoading = true
  370. _this.spinning = true
  371. _this.showExport = true
  372. hdExportExcel(tireFeeListExport, params, '轮胎月度费用报表', function () {
  373. _this.exportLoading = false
  374. _this.spinning = false
  375. })
  376. },
  377. // 初始化
  378. pageInit () {
  379. this.$nextTick(() => { // 页面渲染完成后的回调
  380. this.setTableH()
  381. })
  382. this.resetSearchForm()
  383. },
  384. // 计算表格高度
  385. setTableH () {
  386. const tableSearchH = this.$refs.tableSearch.offsetHeight
  387. this.tableHeight = window.innerHeight - tableSearchH - 280
  388. }
  389. },
  390. mounted () {
  391. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  392. this.pageInit()
  393. }
  394. },
  395. activated () {
  396. // 如果是新页签打开,则重置当前页面
  397. if (this.$store.state.app.isNewTab) {
  398. this.pageInit()
  399. }
  400. }
  401. }
  402. </script>
  403. <style lang="less" scoped>
  404. .monthBox{
  405. width: 100%;
  406. /deep/.ant-calendar-picker-icon{
  407. display:none !important;
  408. }
  409. /deep/.ant-calendar-picker input{
  410. text-align:center;
  411. }
  412. }
  413. </style>