list.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. <template>
  2. <a-spin :spinning="spinning" tip="Loading...">
  3. <div class="productInfoList-wrap">
  4. <a-card size="small" :bordered="false" class="promotionSalesRealTimeReport-wrap searchBox">
  5. <!-- 查询 -->
  6. <div ref="tableSearch" class="table-page-search-wrapper newTableSearchName">
  7. <a-form-model id="promotionSalesRealTimeList-form" layout="inline" ref="ruleForm" :rules="rules" :model="newQueryParam">
  8. <a-row :gutter="15">
  9. <a-col :md="6" :sm="24">
  10. <a-form-model-item label="下推时间" prop="salesDate">
  11. <rangeDate id="promotionSalesRealTimeList-salesDate" ref="rangeDate" :value="newQueryParam.salesDate" @change="salesDateChange" />
  12. </a-form-model-item>
  13. </a-col>
  14. <a-col :md="6" :sm="24">
  15. <a-form-model-item label="促销名称">
  16. <a-input
  17. id="promotionSalesRealTimeList-title"
  18. v-model.trim="newQueryParam.promoRuleReport.title"
  19. allowClear
  20. placeholder="请输入促销名称" />
  21. </a-form-model-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-model-item label="促销类型">
  25. <v-select
  26. v-model="newQueryParam.promoRuleReport.promotionRuleType"
  27. ref="ruleType"
  28. id="promotionSalesRealTimeList-ruleType"
  29. code="PROMOTION_RULE_TYPE"
  30. placeholder="请选择促销类型"
  31. allowClear></v-select>
  32. </a-form-model-item>
  33. </a-col>
  34. <template v-if="advanced">
  35. <a-col :md="6" :sm="24">
  36. <a-form-model-item label="销售单号">
  37. <a-input
  38. id="promotionSalesRealTimeList-salesBillNo"
  39. v-model.trim="newQueryParam.salesBillNo"
  40. allowClear
  41. placeholder="请输入销售单号" />
  42. </a-form-model-item>
  43. </a-col>
  44. <a-col :md="6" :sm="24">
  45. <a-form-model-item label="促销开始时间">
  46. <a-range-picker
  47. style="width:100%"
  48. v-model="time"
  49. :format="dateFormat"
  50. id="promotionSalesRealTimeList-time"
  51. :placeholder="['开始时间', '结束时间']"
  52. @change="dateChange"></a-range-picker>
  53. </a-form-model-item>
  54. </a-col>
  55. <a-col :md="6" :sm="24">
  56. <a-form-model-item label="规则">
  57. <a-input
  58. id="promotionSalesRealTimeList-ruleInfo"
  59. v-model.trim="newQueryParam.promoRuleReport.ruleInfo"
  60. allowClear
  61. placeholder="请输入规则关键字" />
  62. </a-form-model-item>
  63. </a-col>
  64. <a-col :md="6" :sm="24">
  65. <a-form-model-item label="客户级别">
  66. <v-select
  67. v-model="newQueryParam.buyerLevel"
  68. ref="buyerLevel"
  69. id="promotionSalesRealTimeList-buyerLevel"
  70. code="DEALER_LEVEL"
  71. placeholder="请选择客户级别"
  72. allowClear></v-select>
  73. </a-form-model-item>
  74. </a-col>
  75. <a-col :md="6" :sm="24">
  76. <a-form-model-item label="客户名称">
  77. <a-input
  78. id="promotionSalesRealTimeList-buyerName"
  79. v-model.trim="newQueryParam.buyerName"
  80. allowClear
  81. placeholder="请输入客户名称" />
  82. </a-form-model-item>
  83. </a-col>
  84. <a-col :md="6" :sm="24">
  85. <a-form-model-item label="所在区域">
  86. <subarea ref="subarea" id="promotionSalesRealTimeList-subarea" @change="subareaChange"></subarea>
  87. </a-form-model-item>
  88. </a-col>
  89. <a-col :md="6" :sm="24">
  90. <a-form-model-item label="地区">
  91. <AreaList id="promotionSalesRealTimeList-areaList" changeOnSelect ref="areaList" @change="areaChange" defValKey="id"></AreaList>
  92. </a-form-model-item>
  93. </a-col>
  94. <a-col :md="6" :sm="24" v-show="isShowCustomerSearch">
  95. <a-form-model-item label="客服">
  96. <customerService ref="customerName" id="promotionSalesRealTimeList-customerName" v-model="newQueryParam.bizUserSn"></customerService>
  97. </a-form-model-item>
  98. </a-col>
  99. <a-col :md="6" :sm="24">
  100. <a-form-model-item label="新/老客户">
  101. <a-select id="promotionSalesRealTimeList-dealerNewFlag" v-model="newQueryParam.dealerNewFlag" placeholder="请选择" allowClear>
  102. <a-select-option value="1">新客户</a-select-option>
  103. <a-select-option value="0">老客户</a-select-option>
  104. </a-select>
  105. </a-form-model-item>
  106. </a-col>
  107. </template>
  108. <a-col :md="isShowCustomerSearch&&advanced?24:6" :sm="24" style="margin-bottom: 10px;" :style="{textAlign: isShowCustomerSearch&&advanced?'center':''}">
  109. <span class="table-page-search-submitButtons">
  110. <a-button type="primary" id="promotionSalesRealTimeList-refresh":disabled="disabled" @click="testForm('search')">查询</a-button>
  111. <a-button style="margin-left: 8px" id="promotionSalesRealTimeList-reset" :disabled="disabled" @click="resetSearchForm">重置</a-button>
  112. <a-button
  113. style="margin-left: 10px"
  114. type="primary"
  115. class="button-warning"
  116. @click="testForm('export')"
  117. :disabled="disabled"
  118. :loading="exportLoading"
  119. id="promotionSalesRealTimeList-export"
  120. v-if="$hasPermissions('B_promotionSalesExport')">导出</a-button>
  121. <a @click="advanced=!advanced" style="margin-left: 8px">
  122. {{ advanced ? '收起' : '展开' }}
  123. <a-icon :type="advanced ? 'up' : 'down'" />
  124. </a>
  125. </span>
  126. </a-col>
  127. </a-row>
  128. </a-form-model>
  129. </div>
  130. </a-card>
  131. <!-- 列表 -->
  132. <a-card size="small" :bordered="false">
  133. <s-table
  134. class="sTable fixPagination"
  135. ref="table"
  136. size="small"
  137. :rowKey="(record) => record.no"
  138. rowKeyName="no"
  139. :columns="columns"
  140. :data="loadData"
  141. :pageSize="30"
  142. :style="{ height: tableHeight+84.5+'px' }"
  143. :scroll="{ x:1890,y: tableHeight-34}"
  144. :defaultLoadData="false"
  145. bordered>
  146. <!-- 促销时间 -->
  147. <template slot="promotionTime" slot-scope="text, record">
  148. <span v-if="record.promotion && record.promotion.promotionDateStart">{{ record.promotion.promotionDateStart }}-{{ record.promotion.promotionDateEnd }}</span>
  149. <span v-else>--</span>
  150. </template>
  151. <!-- 规则 -->
  152. <template slot="promotionDesc" slot-scope="text, record">
  153. <div v-if="record.promotionRule&&record.promotionRule.ruleInfo" v-html="record.promotionRule.ruleInfo"></div>
  154. <span v-else>--</span>
  155. </template>
  156. <template slot="footer">
  157. <a-row>
  158. <a-col span="24">
  159. <a-row>
  160. <a-col
  161. span="3">实时数量(非促):{{ (totalData && (totalData.notGiftQty || totalData.notGiftQty==0)) ? totalData.notGiftQty : '--' }}</a-col>
  162. <a-col
  163. span="3">实时数量(促):{{ (totalData && (totalData.giftQty || totalData.giftQty==0)) ? totalData.giftQty : '--' }}</a-col>
  164. <a-col
  165. span="3">实时实售金额:{{ (totalData && (totalData.totalRealAmount || totalData.totalRealAmount==0)) ? toThousands(totalData.totalRealAmount) : '--' }}</a-col>
  166. <a-col
  167. span="3">实时开单金额:{{ (totalData && (totalData.totalAmount || totalData.totalAmount==0)) ? toThousands(totalData.totalAmount) : '--' }}</a-col>
  168. <a-col
  169. span="3">实时成本金额:{{ (totalData && (totalData.totalRealCost || totalData.totalRealCost==0)) ? toThousands(totalData.totalRealCost) : '--' }}</a-col>
  170. <a-col
  171. span="4">实时损失成本:{{ (totalData && (totalData.lossCost || totalData.lossCost==0)) ? toThousands(totalData.lossCost) : '--' }}</a-col>
  172. <a-col
  173. span="5">实时损失费用:{{ (totalData && (totalData.lossAmount || totalData.lossAmount==0)) ? toThousands(totalData.lossAmount) : '--' }}</a-col>
  174. </a-row>
  175. </a-col>
  176. </a-row>
  177. </template>
  178. </s-table>
  179. </a-card>
  180. </div>
  181. <!-- 导出提示框 -->
  182. <reportModal :visible="showExport" @close="showExport=false"></reportModal>
  183. </a-spin>
  184. </template>
  185. <script>
  186. import { commonMixin } from '@/utils/mixin'
  187. import { hdExportExcel } from '@/libs/exportExcel'
  188. import getDate from '@/libs/getDate.js'
  189. // 组件
  190. import { STable, VSelect } from '@/components'
  191. import reportModal from '@/views/common/reportModal.vue'
  192. import rangeDate from '@/views/common/rangeDate.vue'
  193. import customerService from '@/views/common/customerService.vue'
  194. import subarea from '@/views/common/subarea.js'
  195. import AreaList from '@/views/common/areaList.js'
  196. // 接口
  197. import { salesPromoRealReportList, salesPromoRealReportCount, exportSalesPromoRealReport } from '@/api/reportData'
  198. export default {
  199. name: 'PromotionSalesRealTimeList',
  200. mixins: [commonMixin],
  201. components: { STable, VSelect, reportModal, AreaList, rangeDate, subarea, customerService },
  202. data () {
  203. return {
  204. spinning: false,
  205. advanced: true, // 高级搜索 展开/关闭
  206. disabled: false, // 查询、重置按钮是否可操作
  207. tableHeight: 0, // 表格高度
  208. exportLoading: false, // 导出按钮加载状态
  209. showExport: false, // 导出弹窗
  210. time: undefined, // 促销开始时间
  211. // 查询条件
  212. newQueryParam: {
  213. // 下推时间 默认值
  214. salesDate: [
  215. getDate.getCurrMonthDays().starttime, // 下推开始时间
  216. getDate.getCurrMonthDays().endtime// 下推结束时间
  217. ],
  218. beginAuditDate: getDate.getCurrMonthDays().starttime, // 审核开始时间
  219. endAuditDate: getDate.getCurrMonthDays().endtime, // 审核结束时间
  220. promoRuleReport: {
  221. promotionDateStart: undefined, // 促销时间-开始
  222. promotionDateEnd: undefined, // 促销时间-结束
  223. title: '', // 促销名称
  224. promotionRuleType: undefined, // 促销类型
  225. ruleInfo: '' // 规则
  226. },
  227. salesBillNo: '', // 销售单号
  228. buyerLevel: undefined, // 客户级别
  229. buyerName: '', // 客户名称
  230. subareaArea: {
  231. subareaSn: '', // 区域
  232. subareaAreaSn: ''// 分区
  233. },
  234. dealerProvinceSn: undefined, // 省份编码
  235. dealerCitySn: undefined, // 城市编码
  236. dealerDistrictSn: undefined, // 区域编码
  237. bizUserSn: undefined, // 客服
  238. dealerNewFlag: undefined // 客户类型
  239. },
  240. rules: {
  241. salesDate: [{ required: true, message: '请选择下推时间', trigger: 'change' }]
  242. },
  243. dateFormat: 'YYYY-MM-DD', // 时间格式
  244. totalData: null, // 统计合计
  245. // 加载数据方法 必须为 Promise 对象
  246. loadData: parameter => {
  247. this.spinning = true
  248. this.disabled = true
  249. const params = Object.assign(parameter, this.newQueryParam)
  250. // 促销销售单实时报表 列表 有分页
  251. return salesPromoRealReportList(params).then(res => {
  252. let data
  253. if (res.status == 200) {
  254. data = res.data
  255. // 序号计算
  256. const no = (data.pageNo - 1) * data.pageSize
  257. for (var i = 0; i < data.list.length; i++) {
  258. data.list[i].no = no + i + 1
  259. data.list[i].addressInfo = data.list[i].provinceName + '/' + data.list[i].cityName + '/' + data.list[i].districtName
  260. }
  261. data.list = this.getMixData(data.list)
  262. }
  263. this.spinning = false
  264. this.disabled = false
  265. return data
  266. })
  267. }
  268. }
  269. },
  270. computed: {
  271. columns () {
  272. const _this = this
  273. const rowspanMix = function (value, row, index) {
  274. const obj = {
  275. children: value || '--',
  276. attrs: {}
  277. }
  278. if (row.rowspan != undefined) {
  279. obj.attrs.rowSpan = row.rowspan
  280. }
  281. return obj
  282. }
  283. const rowspanMix1 = function (value, row, index) {
  284. const obj = {
  285. children: (value || value == 0) ? value : '--',
  286. attrs: {}
  287. }
  288. if (row.rowspan1 != undefined) {
  289. obj.attrs.rowSpan = row.rowspan1
  290. }
  291. return obj
  292. }
  293. const rowspanMix2 = function (value, row, index) {
  294. const obj = {
  295. children: (value || value == 0) ? _this.toThousands(value) : '--',
  296. attrs: {}
  297. }
  298. if (row.rowspan1 != undefined) {
  299. obj.attrs.rowSpan = row.rowspan1
  300. }
  301. return obj
  302. }
  303. return [
  304. {
  305. title: '销售单号',
  306. dataIndex: 'salesBillNo',
  307. width: '120px',
  308. align: 'center',
  309. customRender: rowspanMix
  310. },
  311. {
  312. title: '区域',
  313. dataIndex: 'subareaArea.subareaName',
  314. width: '80px',
  315. align: 'center',
  316. customRender: rowspanMix
  317. },
  318. {
  319. title: '分区',
  320. dataIndex: 'subareaArea.subareaAreaName',
  321. width: '80px',
  322. align: 'center',
  323. customRender: rowspanMix
  324. },
  325. {
  326. title: '地区',
  327. dataIndex: 'addressInfo',
  328. width: '160px',
  329. align: 'center',
  330. customRender: rowspanMix
  331. },
  332. {
  333. title: '客户名称',
  334. dataIndex: 'buyerName',
  335. width: '140px',
  336. align: 'center',
  337. customRender: rowspanMix,
  338. ellipsis: true
  339. },
  340. {
  341. title: '客户级别',
  342. dataIndex: 'buyerLevelDictValue',
  343. width: '80px',
  344. align: 'center',
  345. customRender: rowspanMix
  346. },
  347. {
  348. title: '销售审核时间',
  349. dataIndex: 'auditDate',
  350. width: '120px',
  351. align: 'center',
  352. customRender: rowspanMix
  353. },
  354. {
  355. title: '促销名称',
  356. dataIndex: 'promotion.title',
  357. width: '160px',
  358. align: 'left',
  359. customRender: function (text) {
  360. return text || '--'
  361. },
  362. ellipsis: true
  363. },
  364. {
  365. title: '促销时间',
  366. scopedSlots: {
  367. customRender: 'promotionTime'
  368. },
  369. width: '130px',
  370. align: 'center'
  371. },
  372. {
  373. title: '费用所属部门',
  374. dataIndex: 'departmentName',
  375. width: '160px',
  376. align: 'center',
  377. customRender: function (text) {
  378. return text || '--'
  379. },
  380. ellipsis: true
  381. },
  382. {
  383. title: '促销类型',
  384. dataIndex: 'promotionRule.promotionRuleTypeDictValue',
  385. width: '100px',
  386. align: 'center',
  387. customRender: function (text) {
  388. return text || '--'
  389. }
  390. },
  391. { title: '规则', dataIndex: 'promotionRule.ruleInfo', width: '180px', align: 'left', scopedSlots: { customRender: 'promotionDesc' } },
  392. {
  393. title: '数量(非促)',
  394. dataIndex: 'notGiftQtySum',
  395. width: '100px',
  396. align: 'center',
  397. customRender: rowspanMix1
  398. },
  399. {
  400. title: '数量(促)',
  401. dataIndex: 'giftQtySum',
  402. width: '100px',
  403. align: 'center',
  404. customRender: rowspanMix1
  405. },
  406. {
  407. title: '实售金额',
  408. dataIndex: 'totalRealAmountSum',
  409. width: '100px',
  410. align: 'right',
  411. customRender: rowspanMix2
  412. },
  413. {
  414. title: '开单金额',
  415. dataIndex: 'totalAmountSum',
  416. width: '100px',
  417. align: 'right',
  418. customRender: rowspanMix2
  419. },
  420. {
  421. title: '成本金额',
  422. dataIndex: 'totalRealCostSum',
  423. width: '100px',
  424. align: 'right',
  425. customRender: rowspanMix2
  426. },
  427. {
  428. title: '规则数量(非促)',
  429. dataIndex: 'notGiftQty',
  430. width: '100px',
  431. align: 'center',
  432. customRender: function (text) {
  433. return ((text || text == 0) ? text : '--')
  434. }
  435. },
  436. {
  437. title: '规则数量(促)',
  438. dataIndex: 'giftQty',
  439. width: '100px',
  440. align: 'center',
  441. customRender: function (text) {
  442. return ((text || text == 0) ? text : '--')
  443. }
  444. },
  445. {
  446. title: '规则实售金额',
  447. dataIndex: 'totalRealAmount',
  448. width: '100px',
  449. align: 'right',
  450. customRender: function (text) {
  451. return ((text || text == 0) ? _this.toThousands(text) : '--')
  452. }
  453. },
  454. {
  455. title: '规则开单金额',
  456. dataIndex: 'totalAmount',
  457. width: '100px',
  458. align: 'right',
  459. customRender: function (text) {
  460. return ((text || text == 0) ? _this.toThousands(text) : '--')
  461. }
  462. },
  463. {
  464. title: '规则成本金额',
  465. dataIndex: 'totalRealCost',
  466. width: '100px',
  467. align: 'right',
  468. customRender: function (text) {
  469. return ((text || text == 0) ? _this.toThousands(text) : '--')
  470. }
  471. },
  472. {
  473. title: '损失成本',
  474. dataIndex: 'lossCost',
  475. width: '100px',
  476. align: 'right',
  477. customRender: function (text) {
  478. return ((text || text == 0) ? _this.toThousands(text) : '--')
  479. }
  480. },
  481. {
  482. title: '损失费用',
  483. dataIndex: 'lossAmount',
  484. width: '100px',
  485. align: 'right',
  486. customRender: function (text) {
  487. return ((text || text == 0) ? _this.toThousands(text) : '--')
  488. }
  489. }
  490. ]
  491. }
  492. },
  493. watch: {
  494. // 展开关闭
  495. advanced (newValue, oldValue) {
  496. const _this = this
  497. this.$nextTick(() => { // 页面渲染完成后的回调
  498. _this.setTableH()
  499. })
  500. },
  501. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  502. this.setTableH()
  503. }
  504. },
  505. methods: {
  506. // 标记rowspan
  507. getMixData (data) {
  508. let ret = []
  509. ret = this.markRowspan(data, 'salesBillNo')
  510. ret = this.markMutiRowspan(ret, 'salesBillNo', 'stackFlag')
  511. return ret
  512. },
  513. markRowspan (array, key = 'no') {
  514. // 统计每个key值的出现次数
  515. const countMap = {}
  516. array.forEach(item => {
  517. const value = item[key]
  518. countMap[value] = (countMap[value] || 0) + 1
  519. })
  520. // 标记rowspan
  521. const result = []
  522. const processedKeys = {}
  523. array.forEach(item => {
  524. const value = item[key]
  525. const newItem = { ...item, rowspan: 0 }
  526. if (!processedKeys[value]) {
  527. // 每组第一项标记总数
  528. newItem.rowspan = countMap[value]
  529. processedKeys[value] = true
  530. }
  531. result.push(newItem)
  532. })
  533. return result
  534. },
  535. markMutiRowspan (array, key = 'no', flagKey = 'stackFlag') {
  536. // 统计每个key值的出现次数
  537. const countMap = {}
  538. array.forEach(item => {
  539. const value = item[key] + '-' + item[flagKey]
  540. countMap[value] = (countMap[value] || 0) + 1
  541. })
  542. // 标记rowspan
  543. const result = []
  544. const processedKeys = {}
  545. array.forEach(item => {
  546. const value = item[key] + '-' + item[flagKey]
  547. const newItem = { ...item, rowspan1: 0 }
  548. if (!processedKeys[value]) {
  549. // 每组第一项标记总数
  550. newItem.rowspan1 = countMap[value]
  551. processedKeys[value] = true
  552. }
  553. result.push(newItem)
  554. })
  555. return result
  556. },
  557. // 下推时间 change
  558. salesDateChange (date) {
  559. if (date[0] && date[1]) {
  560. this.newQueryParam.salesDate = date
  561. } else {
  562. this.newQueryParam.salesDate = []
  563. }
  564. this.newQueryParam.beginAuditDate = date[0] || ''
  565. this.newQueryParam.endAuditDate = date[1] || ''
  566. },
  567. // 地区
  568. areaChange (val) {
  569. this.newQueryParam.dealerProvinceSn = val[0] ? val[0] : ''
  570. this.newQueryParam.dealerCitySn = val[1] ? val[1] : ''
  571. this.newQueryParam.dealerDistrictSn = val[2] ? val[2] : ''
  572. },
  573. // 促销开始时间
  574. dateChange (date, dateString) {
  575. this.time = date
  576. if (dateString[0] != '' && dateString[1] != '') {
  577. this.newQueryParam.promoRuleReport.promotionDateStart = dateString[0] + ' 00:00:00'
  578. this.newQueryParam.promoRuleReport.promotionDateEnd = dateString[1] + ' 23:59:59'
  579. } else {
  580. this.$set(this.newQueryParam.promoRuleReport, 'promotionDateStart', undefined)
  581. this.$set(this.newQueryParam.promoRuleReport, 'promotionDateEnd', undefined)
  582. }
  583. },
  584. // 区域分区
  585. subareaChange (val) {
  586. this.newQueryParam.subareaArea.subareaSn = val[0] ? val[0] : undefined
  587. this.newQueryParam.subareaArea.subareaAreaSn = val[1] ? val[1] : undefined
  588. },
  589. // 查询
  590. testForm (type) {
  591. const _this = this
  592. if (!_this.newQueryParam.salesDate && (!_this.newQueryParam.salesDate[0] || !_this.newQueryParam.salesDate[1])) {
  593. _this.$message.error('请选择下推时间')
  594. return
  595. }
  596. _this.$refs.ruleForm.validate(valid => {
  597. if (valid) {
  598. if (type == 'search') {
  599. _this.resetCurForm()
  600. } else {
  601. _this.handleExport()
  602. }
  603. } else {
  604. _this.$message.error('请选择下推时间')
  605. return false
  606. }
  607. })
  608. },
  609. // 统计
  610. getCount (params) {
  611. salesPromoRealReportCount(params).then(res => {
  612. if (res.status == 200) {
  613. this.totalData = res.data
  614. } else {
  615. this.totalData = null
  616. }
  617. })
  618. },
  619. // 刷新当前页面
  620. resetCurForm () {
  621. const params = JSON.parse(JSON.stringify(this.newQueryParam))
  622. delete params.salesDate
  623. this.$nextTick(() => {
  624. this.getCount(params)
  625. this.$refs.table.refresh(true)
  626. })
  627. },
  628. // 导出
  629. handleExport () {
  630. const _this = this
  631. const params = this.newQueryParam
  632. _this.exportLoading = true
  633. _this.spinning = true
  634. hdExportExcel(exportSalesPromoRealReport, params, '促销销售单实时报表导出', function () {
  635. _this.exportLoading = false
  636. _this.spinning = false
  637. _this.showExport = true
  638. })
  639. },
  640. // 重置
  641. resetSearchForm () {
  642. this.$refs.ruleForm.resetFields()
  643. this.newQueryParam = {
  644. beginAuditDate: getDate.getCurrMonthDays().starttime, // 审核开始时间
  645. endAuditDate: getDate.getCurrMonthDays().endtime, // 审核结束时间
  646. promoRuleReport: {
  647. promotionDateStart: undefined, // 促销时间-开始
  648. promotionDateEnd: undefined, // 促销时间-结束
  649. title: '', // 促销名称
  650. promotionRuleType: undefined, // 促销类型
  651. ruleInfo: '' // 规则
  652. },
  653. salesBillNo: '', // 销售单号
  654. buyerLevel: undefined, // 客户级别
  655. buyerName: '', // 客户名称
  656. subareaArea: {
  657. subareaSn: '',
  658. subareaAreaSn: ''
  659. },
  660. dealerProvinceSn: undefined, // 省份编码
  661. dealerCitySn: undefined, // 城市编码
  662. dealerDistrictSn: undefined, // 区域编码
  663. bizUserSn: undefined,
  664. dealerNewFlag: undefined
  665. }
  666. this.$set(this.newQueryParam, 'salesDate', [
  667. getDate.getCurrMonthDays().starttime,
  668. getDate.getCurrMonthDays().endtime
  669. ])
  670. this.time = undefined
  671. this.$refs.subarea.clearData()
  672. this.$refs.areaList.clearData()
  673. this.$refs.rangeDate.resetDate(this.newQueryParam.salesDate)
  674. this.$refs.table.clearTable()
  675. this.totalData = null
  676. },
  677. // 初始化
  678. pageInit () {
  679. const _this = this
  680. this.$nextTick(() => { // 页面渲染完成后的回调
  681. _this.setTableH()
  682. })
  683. },
  684. // 计算表格高度
  685. setTableH () {
  686. const tableSearchH = this.$refs.tableSearch.offsetHeight
  687. this.tableHeight = window.innerHeight - tableSearchH - 270
  688. }
  689. },
  690. mounted () {
  691. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  692. this.pageInit()
  693. }
  694. },
  695. activated () {
  696. // 如果是新页签打开,则重置当前页面
  697. if (this.$store.state.app.isNewTab) {
  698. this.pageInit()
  699. }
  700. }
  701. }
  702. </script>
  703. <style lang="less" scoped>
  704. .productInfoList-wrap {
  705. .ellipsisCon {
  706. display: flex;
  707. justify-content: space-between;
  708. align-items: center;
  709. .ellipsisText {
  710. width: 100%;
  711. overflow: hidden;
  712. text-overflow: ellipsis;
  713. display: box;
  714. display: -webkit-box;
  715. -webkit-line-clamp: 1;
  716. -webkit-box-orient: vertical;
  717. }
  718. }
  719. }
  720. </style>