checkStatistic.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <div class="form-wrap">
  3. <el-form
  4. class="search-box"
  5. ref="form"
  6. :model="form"
  7. :inline="true">
  8. <div class="block-title">
  9. 查询条件
  10. </div>
  11. <el-form-item
  12. label="起始时间"
  13. prop="checkTimeBegin">
  14. <el-date-picker
  15. v-model="form.checkTimeBegin"
  16. type="datetime"
  17. placeholder="选择日期时间">
  18. </el-date-picker>
  19. </el-form-item>
  20. <el-form-item
  21. label="截止时间"
  22. prop="checkTimeEnd">
  23. <el-date-picker
  24. default-time="23:59:59"
  25. v-model="form.checkTimeEnd"
  26. type="datetime"
  27. placeholder="选择日期时间">
  28. </el-date-picker>
  29. </el-form-item>
  30. <el-form-item
  31. label="票种"
  32. prop="ticketTypeIdList">
  33. <el-select
  34. v-model="form.ticketTypeIdList"
  35. multiple
  36. clearable>
  37. <el-option
  38. v-for="item in ticketTypeList"
  39. :key="item.id"
  40. :value="item.id"
  41. :label="item.name">
  42. </el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item
  46. label="销售渠道"
  47. prop="sourceList">
  48. <el-select
  49. v-model="form.sourceList"
  50. multiple
  51. clearable>
  52. <el-option
  53. v-for="(item,index) in saleChannels"
  54. :key="index"
  55. :label="item"
  56. :value="item"
  57. >
  58. </el-option>
  59. </el-select>
  60. </el-form-item>
  61. <div
  62. class="btn-wrap"
  63. style="margin-bottom:20px">
  64. <el-button
  65. @click="reportExport">
  66. 导出
  67. </el-button>
  68. <el-button
  69. @click="reset">
  70. 重置
  71. </el-button>
  72. <el-button
  73. :disabled="loading"
  74. type="primary"
  75. @click="getCheckStatistic">
  76. 搜索
  77. </el-button>
  78. </div>
  79. </el-form>
  80. <div class="table-box">
  81. <!-- <div class="block-title">
  82. 统计结果
  83. </div> -->
  84. <el-table
  85. border
  86. stripe
  87. v-loading="loading"
  88. :data="tableData"
  89. :row-class-name="totalRowClassName"
  90. :span-method="objectSpanMethod">
  91. <el-table-column
  92. prop="otaSourceName"
  93. label="订单渠道">
  94. </el-table-column>
  95. <el-table-column
  96. prop="ticketTypeName"
  97. label="票种名称">
  98. </el-table-column>
  99. <el-table-column
  100. prop="unitPrice"
  101. label="单价">
  102. </el-table-column>
  103. <el-table-column
  104. prop="checkCount"
  105. label="检票数量">
  106. </el-table-column>
  107. <el-table-column
  108. prop="checkNum"
  109. label="检票人数">
  110. </el-table-column>
  111. <el-table-column
  112. prop="checkPrice"
  113. label="检票金额">
  114. </el-table-column>
  115. </el-table>
  116. </div>
  117. </div>
  118. </template>
  119. <script>
  120. import { getCheckerVerifyStatistics } from '@/api/queryReport'
  121. import { totalRowClassName } from '@/utils'
  122. import moment from 'moment'
  123. import { getSaleChannelList } from '@/api/order'
  124. // import ReaderInput from '@/components/ReaderInput'
  125. // import draggable from 'vuedraggable'
  126. // import moment from 'moment'
  127. export default {
  128. name: 'checkStatistic',
  129. computed: {
  130. scenicName () {
  131. return this.$localStore.get('scenicName') || this.$store.state.user.scenicName
  132. },
  133. saleChannel () {
  134. return this.$store.state.app.saleChannel
  135. },
  136. scenicList () {
  137. return this.$store.state.app.scenicList
  138. },
  139. ticketTypeList () {
  140. return this.$store.state.app.ticketTypeList
  141. },
  142. userScenic () {
  143. return this.$store.state.app.account.managerScenicMatrix ? this.$store.state.app.account.managerScenicMatrix : this.$store.state.app.scenicList
  144. }
  145. },
  146. components: {
  147. },
  148. data () {
  149. return {
  150. groupKeys: [{ value: 'tagName', label: '票种标签' }, { value: 'otaSourceName', label: '分销商' }],
  151. form: {
  152. checkTimeBegin: new Date(moment().startOf('day').subtract(7, 'day').format('YYYY-MM-DD HH:mm:ss')),
  153. checkTimeEnd: new Date(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss')),
  154. ticketTypeIdList: [], //
  155. sourceList: [],
  156. pageNum: 1,
  157. pageSize: 10
  158. },
  159. selectKeys: [],
  160. finalGroup: [],
  161. tableIndex: 1,
  162. OrderIndexArr: [],
  163. tableData: [],
  164. deviceList: [],
  165. saleChannels: [],
  166. // ticketTypeList: [],
  167. loading: false
  168. }
  169. },
  170. created () {
  171. this.getCheckStatistic()
  172. this.getSaleChannelList()
  173. },
  174. mounted () {
  175. },
  176. methods: {
  177. hideClear () {
  178. if (['铭投山庄'].includes(this.scenicName)) {
  179. if (this.form.keyList2.length === 1) {
  180. return 'hideClear'
  181. } else {
  182. return ''
  183. }
  184. } else {
  185. return ''
  186. }
  187. },
  188. disabled (item) {
  189. if (['铭投山庄'].includes(this.scenicName)) {
  190. if (this.form.keyList2.length > 1) {
  191. return false
  192. } else if (this.form.keyList2.length === 1) {
  193. if (this.form.keyList2.includes(item.id)) {
  194. return true
  195. } else {
  196. return false
  197. }
  198. }
  199. } else {
  200. return false
  201. }
  202. },
  203. totalRowClassName,
  204. reset () {
  205. this.$refs.form.resetFields()
  206. },
  207. getSaleChannelList () {
  208. getSaleChannelList({ pageSize: -1, pageNum: 1 }).then((res) => {
  209. this.saleChannels = res?.data || []
  210. })
  211. },
  212. // 获取表格数据
  213. getCheckStatistic () {
  214. this.loading = true
  215. this.tableIndex++
  216. this.finalGroup = []
  217. this.finalGroup = this.groupKeys.filter(i => {
  218. return this.selectKeys.includes(i.value)
  219. })
  220. if (this.form.checkTimeBegin) {
  221. this.form.checkTimeBegin = moment(this.form.checkTimeBegin).format('YYYY-MM-DD HH:mm:ss')
  222. } else {
  223. this.form.checkTimeBegin = ''
  224. }
  225. if (this.form.checkTimeEnd) {
  226. this.form.checkTimeEnd = moment(this.form.checkTimeEnd).format('YYYY-MM-DD HH:mm:ss')
  227. } else {
  228. this.form.checkTimeEnd = ''
  229. }
  230. if (!this.form.ticketTypeIdList) {
  231. this.form.ticketTypeIdList = []
  232. }
  233. getCheckerVerifyStatistics(this.form).then(res => {
  234. this.tableData = res.data
  235. }).finally(() => {
  236. this.loading = false
  237. })
  238. },
  239. objectSpanMethod ({ row, column, rowIndex, columnIndex }) {
  240. if (columnIndex < this.finalGroup.length) {
  241. if (!(this.OrderIndexArr[columnIndex] && this.OrderIndexArr[columnIndex].length)) return
  242. for (let i = 0; i < this.OrderIndexArr[columnIndex].length; i++) {
  243. let element = this.OrderIndexArr[columnIndex][i]
  244. for (let j = 0; j < element.length; j++) {
  245. let item = element[j]
  246. if (rowIndex === item) {
  247. if (j === 0) {
  248. return {
  249. rowspan: element.length,
  250. colspan: 1
  251. }
  252. } else if (j !== 0) {
  253. return {
  254. rowspan: 0,
  255. colspan: 0
  256. }
  257. }
  258. }
  259. }
  260. }
  261. }
  262. },
  263. reportExport () {
  264. this.$confirm(`是否要导出明细数据`, '确认提示', {
  265. confirmButtonText: '是',
  266. cancelButtonText: '否',
  267. type: 'warning'
  268. }).then(() => {
  269. this.handleExport({
  270. ...this.form,
  271. export: true,
  272. exportDetail: true
  273. })
  274. }).catch(() => {
  275. this.handleExport({
  276. ...this.form,
  277. export: true,
  278. exportDetail: false
  279. })
  280. })
  281. },
  282. handleExport (params) {
  283. getCheckerVerifyStatistics(params).then(() => {
  284. this.$message.success('导出成功。')
  285. this.goToDownload()
  286. }, () => {
  287. this.$message.success('导出失败。')
  288. })
  289. }
  290. }
  291. }
  292. </script>
  293. <style scoped lang="scss">
  294. .hideClear{
  295. ::v-deep .el-tag.el-tag--info .el-tag__close{
  296. display: none;
  297. }
  298. }
  299. </style>