list.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. <template>
  2. <a-card size="small" :bordered="false" class="actualSalesReportList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div class="table-page-search-wrapper newTableSearchName">
  6. <a-form-model
  7. id="actualSalesReportList-form"
  8. ref="ruleForm"
  9. class="form-model-con"
  10. layout="inline"
  11. :model="queryParam"
  12. :rules="rules"
  13. @keyup.enter.native="handleSearch">
  14. <a-row :gutter="15">
  15. <a-col :md="6" :sm="24">
  16. <a-form-model-item label="销售日期" prop="time">
  17. <rangeDate ref="rangeDate" :value="queryParam.time" @change="dateChange" />
  18. </a-form-model-item>
  19. </a-col>
  20. <a-col :md="6" :sm="24">
  21. <a-form-model-item label="客户名称">
  22. <custList id="actualSalesReportList-allocateTypeSn" ref="custList" @change="custChange"></custList>
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :md="6" :sm="24">
  26. <a-form-model-item label="客户级别">
  27. <v-select
  28. v-model="queryParam.dealer.dealerLevel"
  29. ref="dealerLevel"
  30. id="actualSalesReportList-allocateTypeSn"
  31. code="DEALER_LEVEL"
  32. placeholder="请选择客户级别"
  33. allowClear></v-select>
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :md="6" :sm="24">
  37. <a-form-model-item label="所在区域">
  38. <subarea id="actualSalesReportList-allocateTypeSn" v-model="queryParam.dealer.subareaSn"></subarea>
  39. </a-form-model-item>
  40. </a-col>
  41. <template v-if="advanced">
  42. <a-col :md="6" :sm="24">
  43. <a-form-model-item label="地区">
  44. <AreaList id="actualSalesReportList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
  45. </a-form-model-item>
  46. </a-col>
  47. </template>
  48. <a-col :md="24" :sm="24" style="margin-bottom:10px;text-align:center;">
  49. <a-button type="primary" @click="handleSearch" :disabled="disabled" id="actualSalesReportList-refresh">查询</a-button>
  50. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="actualSalesReportList-reset">重置</a-button>
  51. <a-button
  52. style="margin-left: 10px"
  53. type="primary"
  54. class="button-warning"
  55. @click="handleExport"
  56. :disabled="disabled"
  57. :loading="exportLoading"
  58. v-if="$hasPermissions('B_actualSalesReport_export')"
  59. id="actualSalesReportList-export">导出</a-button>
  60. <a @click="advanced=!advanced" style="margin-left: 8px">
  61. {{ advanced ? '收起' : '展开' }}
  62. <a-icon :type="advanced ? 'up' : 'down'"/>
  63. </a>
  64. </a-col>
  65. </a-row>
  66. </a-form-model>
  67. </div>
  68. <!-- 列表 -->
  69. <s-table
  70. class="sTable"
  71. ref="table"
  72. size="small"
  73. :rowKey="(record) => record.id"
  74. :columns="columns"
  75. :data="loadData"
  76. :scroll="{ x: 2250 }"
  77. :defaultLoadData="false"
  78. bordered>
  79. <template slot="footer">
  80. <a-row>
  81. <a-col span="2">合计:</a-col>
  82. <a-col span="22">
  83. <a-row>
  84. <a-col span="4">箭牌滤清器:{{ (totalData && (totalData.jpLqqAmount || totalData.jpLqqAmount==0)) ? toThousands(totalData.jpLqqAmount) : '--' }}</a-col>
  85. <a-col span="4">箭牌变速箱滤清器:{{ (totalData && (totalData.jpBsxLqqAmount || totalData.jpBsxLqqAmount==0)) ? toThousands(totalData.jpBsxLqqAmount) : '--' }}</a-col>
  86. <a-col span="4">箭牌雨刮片:{{ (totalData && (totalData.jpYgpAmount || totalData.jpYgpAmount==0)) ? toThousands(totalData.jpYgpAmount) : '--' }}</a-col>
  87. <a-col span="4">箭牌喇叭:{{ (totalData && (totalData.jpLbAmount || totalData.jpLbAmount==0)) ? toThousands(totalData.jpLbAmount) : '--' }}</a-col>
  88. <a-col span="4">箭牌刹车片:{{ (totalData && (totalData.jpScpAmount || totalData.jpScpAmount==0)) ? toThousands(totalData.jpScpAmount) : '--' }}</a-col>
  89. <a-col span="4">箭牌感应线:{{ (totalData && (totalData.jpGyxAmount || totalData.jpGyxAmount==0)) ? toThousands(totalData.jpGyxAmount) : '--' }}</a-col>
  90. <a-col span="4">冠牌滤清器:{{ (totalData && (totalData.gpLqqAmount || totalData.gpLqqAmount==0)) ? toThousands(totalData.gpLqqAmount) : '--' }}</a-col>
  91. <a-col span="4">冠牌雨刮片:{{ (totalData && (totalData.gpYgpAmount || totalData.gpYgpAmount==0)) ? toThousands(totalData.gpYgpAmount) : '--' }}</a-col>
  92. <a-col span="4">冠牌刹车片:{{ (totalData && (totalData.gpScpAmount || totalData.gpScpAmount==0)) ? toThousands(totalData.gpScpAmount) : '--' }}</a-col>
  93. <a-col span="4">稳升点火线圈:{{ (totalData && (totalData.wsDhxqAmount || totalData.wsDhxqAmount==0)) ? toThousands(totalData.wsDhxqAmount) : '--' }}</a-col>
  94. <a-col span="4">稳升灯泡:{{ (totalData && (totalData.wsDpAmount || totalData.wsDpAmount==0)) ? toThousands(totalData.wsDpAmount) : '--' }}</a-col>
  95. <a-col span="4">汇箭:{{ (totalData && (totalData.hjAmount || totalData.hjAmount==0)) ? toThousands(totalData.hjAmount) : '--' }}</a-col>
  96. <a-col span="4">德路斯:{{ (totalData && (totalData.dlsAmount || totalData.dlsAmount==0)) ? toThousands(totalData.dlsAmount) : '--' }}</a-col>
  97. <a-col span="4">TBU:{{ (totalData && (totalData.tbuAmount || totalData.tbuAmount==0)) ? toThousands(totalData.tbuAmount) : '--' }}</a-col>
  98. <a-col span="4">TBU-P:{{ (totalData && (totalData.tbupAmount || totalData.tbupAmount==0)) ? toThousands(totalData.tbupAmount) : '--' }}</a-col>
  99. <a-col span="4">布瑞斯:{{ (totalData && (totalData.brsAmount || totalData.brsAmount==0)) ? toThousands(totalData.brsAmount) : '--' }}</a-col>
  100. <a-col span="4">NGK:{{ (totalData && (totalData.ngkAmount || totalData.ngkAmount==0)) ? toThousands(totalData.ngkAmount) : '--' }}</a-col>
  101. <a-col span="4">飞利浦:{{ (totalData && (totalData.flpAmount || totalData.flpAmount==0)) ? toThousands(totalData.flpAmount) : '--' }}</a-col>
  102. <a-col span="4">车仆:{{ (totalData && (totalData.cpAmount || totalData.cpAmount==0)) ? toThousands(totalData.cpAmount) : '--' }}</a-col>
  103. <a-col span="4">瓦尔塔:{{ (totalData && (totalData.wetAmount || totalData.wetAmount==0)) ? toThousands(totalData.wetAmount) : '--' }}</a-col>
  104. <a-col span="4">雷贝斯托:{{ (totalData && (totalData.lbstAmount || totalData.lbstAmount==0)) ? toThousands(totalData.lbstAmount) : '--' }}</a-col>
  105. <a-col span="4">德尔福:{{ (totalData && (totalData.defAmount || totalData.defAmount==0)) ? toThousands(totalData.defAmount) : '--' }}</a-col>
  106. <a-col span="4">巴诺德:{{ (totalData && (totalData.bndAmount || totalData.bndAmount==0)) ? toThousands(totalData.bndAmount) : '--' }}</a-col>
  107. <a-col span="6">实售销售合计金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
  108. </a-row>
  109. </a-col>
  110. </a-row>
  111. </template>
  112. </s-table>
  113. </a-spin>
  114. <!-- 导出提示框 -->
  115. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  116. </a-card>
  117. </template>
  118. <script>
  119. import { commonMixin } from '@/utils/mixin'
  120. import getDate from '@/libs/getDate.js'
  121. import { STable, VSelect } from '@/components'
  122. import rangeDate from '@/views/common/rangeDate.vue'
  123. import custList from '@/views/common/custList.vue'
  124. import reportModal from '@/views/common/reportModal.vue'
  125. import subarea from '@/views/common/subarea.js'
  126. import AreaList from '@/views/common/areaList.js'
  127. import { hdExportExcel } from '@/libs/exportExcel'
  128. import { salesBillRealAmountQueryPageList, salesBillRealReportCount } from '@/api/salesBillReport'
  129. import { actualSalesExport } from '@/api/reportData'
  130. export default {
  131. name: 'ActualSalesReportList',
  132. mixins: [commonMixin],
  133. components: { STable, VSelect, rangeDate, subarea, custList, reportModal, AreaList },
  134. data () {
  135. return {
  136. spinning: false,
  137. advanced: true, // 高级搜索 展开/关闭
  138. tableHeight: 0,
  139. showExport: false, // 导出弹窗初始值
  140. queryParam: { // 查询条件
  141. time: [
  142. getDate.getCurrMonthDays().starttime,
  143. getDate.getCurrMonthDays().endtime
  144. ],
  145. beginDate: getDate.getCurrMonthDays().starttime,
  146. endDate: getDate.getCurrMonthDays().endtime,
  147. dealer: {
  148. 'dealerSn': undefined,
  149. 'provinceSn': undefined,
  150. 'citySn': undefined,
  151. 'districtSn': undefined,
  152. 'subareaSn': undefined,
  153. 'dealerLevel': undefined
  154. }
  155. },
  156. rules: {
  157. 'time': [{ required: true, message: '请选择销售日期', trigger: 'change' }]
  158. },
  159. disabled: false, // 查询、重置按钮是否可操作
  160. exportLoading: false,
  161. // 加载数据方法 必须为 Promise 对象
  162. loadData: parameter => {
  163. this.disabled = true
  164. this.spinning = true
  165. if (this.tableHeight == 0) {
  166. this.tableHeight = window.innerHeight - 380
  167. }
  168. const paramsPage = Object.assign(this.queryParam, { pageNo: parameter.pageNo, pageSize: parameter.pageSize }) // 有分页
  169. return salesBillRealAmountQueryPageList(paramsPage).then(res => {
  170. let data
  171. if (res.status == 200) {
  172. data = res.data
  173. this.getCount(paramsPage)
  174. const no = (data.pageNo - 1) * data.pageSize
  175. for (var i = 0; i < data.list.length; i++) {
  176. data.list[i].no = no + i + 1
  177. }
  178. this.disabled = false
  179. }
  180. this.spinning = false
  181. return data
  182. })
  183. },
  184. totalData: null,
  185. addrProvinceList: [], // 省下拉
  186. addrCityList: [], // 市下拉
  187. addrDistrictList: [] // 区下拉
  188. }
  189. },
  190. computed: {
  191. columns () {
  192. const _this = this
  193. const arr = [
  194. { title: '区域', dataIndex: 'dealer.subareaNameSet', width: 90, align: 'center', customRender: function (text) { return (text && text.length > 0) ? text.join('/') : '--' } },
  195. { title: '省份', dataIndex: 'dealer.provinceName', width: 90, align: 'center', customRender: function (text) { return text || '--' } },
  196. { title: '客户名称', dataIndex: 'dealer.dealerName', width: 100, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  197. { title: '客户级别', dataIndex: 'dealer.dealerLevelDictValue', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
  198. { title: '品牌',
  199. align: 'center',
  200. children: [
  201. {
  202. title: '箭牌',
  203. align: 'center',
  204. children: [
  205. {
  206. title: '滤清器',
  207. dataIndex: 'jpLqqAmount',
  208. align: 'right',
  209. width: 80,
  210. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  211. },
  212. {
  213. title: '变速箱滤清器',
  214. dataIndex: 'jpBsxLqqAmount',
  215. align: 'right',
  216. width: 80,
  217. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  218. },
  219. {
  220. title: '雨刮片',
  221. dataIndex: 'jpYgpAmount',
  222. align: 'right',
  223. width: 80,
  224. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  225. },
  226. {
  227. title: '喇叭',
  228. dataIndex: 'jpLbAmount',
  229. align: 'right',
  230. width: 80,
  231. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  232. },
  233. {
  234. title: '刹车片',
  235. dataIndex: 'jpScpAmount',
  236. align: 'right',
  237. width: 80,
  238. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  239. },
  240. {
  241. title: '感应线',
  242. dataIndex: 'jpGyxAmount',
  243. align: 'right',
  244. width: 80,
  245. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  246. }
  247. ]
  248. },
  249. {
  250. title: '冠牌',
  251. align: 'center',
  252. children: [
  253. {
  254. title: '滤清器',
  255. dataIndex: 'gpLqqAmount',
  256. align: 'right',
  257. width: 80,
  258. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  259. },
  260. {
  261. title: '雨刮片',
  262. dataIndex: 'gpYgpAmount',
  263. align: 'right',
  264. width: 80,
  265. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  266. },
  267. {
  268. title: '刹车片',
  269. dataIndex: 'gpScpAmount',
  270. align: 'right',
  271. width: 80,
  272. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  273. }
  274. ]
  275. },
  276. {
  277. title: '稳升',
  278. align: 'center',
  279. children: [
  280. {
  281. title: '点火线圈',
  282. dataIndex: 'wsDhxqAmount',
  283. align: 'right',
  284. width: 80,
  285. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  286. },
  287. {
  288. title: '灯泡',
  289. dataIndex: 'wsDpAmount',
  290. align: 'right',
  291. width: 80,
  292. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  293. }
  294. ]
  295. },
  296. {
  297. title: '汇箭',
  298. dataIndex: 'hjAmount',
  299. align: 'right',
  300. width: 80,
  301. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  302. },
  303. {
  304. title: '德路斯',
  305. dataIndex: 'dlsAmount',
  306. align: 'right',
  307. width: 80,
  308. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  309. },
  310. {
  311. title: 'TBU',
  312. dataIndex: 'tbuAmount',
  313. align: 'right',
  314. width: 80,
  315. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  316. },
  317. {
  318. title: 'TBU-P',
  319. dataIndex: 'tbupAmount',
  320. align: 'right',
  321. width: 80,
  322. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  323. },
  324. {
  325. title: '布瑞斯',
  326. dataIndex: 'brsAmount',
  327. align: 'right',
  328. width: 80,
  329. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  330. }
  331. ]
  332. },
  333. { title: '代理品牌',
  334. align: 'center',
  335. children: [
  336. {
  337. title: 'NGK',
  338. dataIndex: 'ngkAmount',
  339. align: 'right',
  340. width: 80,
  341. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  342. },
  343. {
  344. title: '飞利浦',
  345. dataIndex: 'flpAmount',
  346. align: 'right',
  347. width: 80,
  348. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  349. },
  350. {
  351. title: '车仆',
  352. dataIndex: 'cpAmount',
  353. align: 'right',
  354. width: 80,
  355. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  356. },
  357. {
  358. title: '瓦尔塔',
  359. dataIndex: 'wetAmount',
  360. align: 'right',
  361. width: 80,
  362. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  363. },
  364. {
  365. title: '雷贝斯托',
  366. dataIndex: 'lbstAmount',
  367. align: 'right',
  368. width: 80,
  369. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  370. },
  371. {
  372. title: '德尔福',
  373. dataIndex: 'defAmount',
  374. align: 'right',
  375. width: 80,
  376. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  377. },
  378. {
  379. title: '巴诺德',
  380. dataIndex: 'bndAmount',
  381. align: 'right',
  382. width: 80,
  383. customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' }
  384. }
  385. ]
  386. }
  387. // { title: '实售销售合计金额', width: 90, dataIndex: 'totalAmount', align: 'center', customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' } }
  388. ]
  389. if (this.$hasPermissions('M_actualSalesReportList_salesPrice')) { // 售价权限
  390. arr.splice(arr.length, 0, { title: '实售销售合计金额', width: 90, dataIndex: 'totalAmount', align: 'right', customRender: function (text) { return (text || text == 0) ? _this.toThousands(text) : '--' } })
  391. }
  392. return arr
  393. }
  394. },
  395. methods: {
  396. // 导出
  397. handleExport () {
  398. const _this = this
  399. this.$refs.ruleForm.validate(valid => {
  400. if (valid) {
  401. _this.showExport = true
  402. const params = _this.queryParam
  403. _this.$store.state.app.curActionPermission = 'B_actualSalesReport_export'
  404. _this.exportLoading = true
  405. _this.spinning = true
  406. hdExportExcel(actualSalesExport, params, '实售销售报表', function () {
  407. _this.exportLoading = false
  408. _this.spinning = false
  409. _this.$store.state.app.curActionPermission = ''
  410. })
  411. } else {
  412. return false
  413. }
  414. })
  415. },
  416. // 总计
  417. getCount (params) {
  418. salesBillRealReportCount(params).then(res => {
  419. if (res.status == 200 && res.data) {
  420. this.totalData = res.data
  421. } else {
  422. this.totalData = null
  423. }
  424. })
  425. },
  426. handleSearch () {
  427. const _this = this
  428. this.$refs.ruleForm.validate(valid => {
  429. if (valid) {
  430. _this.$refs.table.refresh(true)
  431. } else {
  432. _this.$message.error('请选择销售日期')
  433. return false
  434. }
  435. })
  436. },
  437. // 创建时间 change
  438. dateChange (date) {
  439. if (date[0] && date[1]) {
  440. this.queryParam.time = date
  441. } else {
  442. this.queryParam.time = []
  443. }
  444. this.queryParam.beginDate = date[0] || ''
  445. this.queryParam.endDate = date[1] || ''
  446. },
  447. custChange (val) {
  448. this.queryParam.dealer.dealerSn = val.key
  449. },
  450. // 重置
  451. resetSearchForm () {
  452. this.queryParam.time = [
  453. getDate.getCurrMonthDays().starttime,
  454. getDate.getCurrMonthDays().endtime
  455. ]
  456. this.$refs.rangeDate.resetDate(this.queryParam.time)
  457. this.queryParam.beginDate = getDate.getCurrMonthDays().starttime
  458. this.queryParam.endDate = getDate.getCurrMonthDays().endtime
  459. this.queryParam.dealer = {
  460. 'dealerSn': undefined,
  461. 'provinceSn': undefined,
  462. 'citySn': undefined,
  463. 'districtSn': undefined,
  464. 'subareaSn': undefined,
  465. 'dealerLevel': undefined
  466. }
  467. this.totalData = null
  468. if (this.advanced) {
  469. this.$refs.areaList.clearData()
  470. }
  471. this.$refs.custList.resetForm()
  472. this.$refs.ruleForm.resetFields()
  473. this.$refs.table.clearTable()
  474. },
  475. areaChange (val) {
  476. this.queryParam.dealer.provinceSn = val[0] ? val[0] : ''
  477. this.queryParam.dealer.citySn = val[1] ? val[1] : ''
  478. this.queryParam.dealer.districtSn = val[2] ? val[2] : ''
  479. }
  480. },
  481. mounted () {
  482. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  483. this.resetSearchForm()
  484. }
  485. },
  486. activated () {
  487. // 如果是新页签打开,则重置当前页面
  488. if (this.$store.state.app.isNewTab) {
  489. this.resetSearchForm()
  490. }
  491. },
  492. beforeRouteEnter (to, from, next) {
  493. next(vm => {})
  494. }
  495. }
  496. </script>