checkAndPrintReport.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <div class="form-wrap">
  3. <div class="searchBox">
  4. <el-form
  5. ref="form"
  6. :model="form"
  7. :inline="true"
  8. label-width="150px">
  9. <el-form-item
  10. label="首次核销起始时间"
  11. prop="checkTimeBegin">
  12. <el-date-picker
  13. v-model="form.checkTimeBegin"
  14. type="datetime"
  15. placeholder="选择日期时间">
  16. </el-date-picker>
  17. </el-form-item>
  18. <el-form-item
  19. label="首次核销截止时间"
  20. prop="checkTimeEnd">
  21. <el-date-picker
  22. v-model="form.checkTimeEnd"
  23. type="datetime"
  24. placeholder="选择日期时间">
  25. </el-date-picker>
  26. </el-form-item>
  27. <el-form-item
  28. label="分销商名称"
  29. prop="otaSourceNameList"
  30. >
  31. <el-select
  32. v-model="form.otaSourceNameList"
  33. multiple
  34. clearable
  35. placeholder="请选择"
  36. filterable>
  37. <el-option
  38. label="全部"
  39. value="">
  40. </el-option>
  41. <el-option
  42. v-for="item in otaList"
  43. :key="item.id"
  44. :label="item.otaSourceName"
  45. :value="item.otaSourceName">
  46. </el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item
  50. label="票种"
  51. prop="ticketTypeIdList">
  52. <el-select
  53. filterable
  54. multiple
  55. clearable
  56. v-model="form.ticketTypeIdList"
  57. placeholder="请选择">
  58. <el-option
  59. label="全部"
  60. value="">
  61. </el-option>
  62. <el-option
  63. v-for="item in ticketTypeList"
  64. :key="item.id"
  65. :label="item.name"
  66. :value="item.ticketTypeId">
  67. </el-option>
  68. </el-select>
  69. </el-form-item>
  70. </el-form>
  71. <div class="btn-wrap">
  72. <el-button @click="reset">重置</el-button>
  73. <el-button
  74. @click="exportReport"
  75. type="primary">导出</el-button>
  76. <el-button
  77. type="primary"
  78. @click="getData">搜索</el-button>
  79. </div>
  80. </div>
  81. <div class="tableBox">
  82. <!-- <div class="block-title">
  83. 查询信息
  84. <span style="font-size:13px;color:black">(包含检票+取票,与分销商对账请用此报表)</span>
  85. </div> -->
  86. <el-table
  87. :data="tableData"
  88. stripe
  89. row-class-name="is-center"
  90. v-loading="loading">
  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="checkPrice"
  109. label="检票金额">
  110. </el-table-column>
  111. <el-table-column
  112. prop="checkMarketPrice"
  113. label="检票市场金额">
  114. </el-table-column>
  115. <el-table-column
  116. prop="checkSettlementPrice"
  117. label="检票结算金额">
  118. </el-table-column>
  119. </el-table>
  120. </div>
  121. </div>
  122. </template>
  123. <script>
  124. import { getCheckAndPrintStatistics } from '@/api/queryReport'
  125. import { getTicketTypeList } from '@/api/ticketType'
  126. import { getOtaProjectList } from '@/api/ota'
  127. import moment from 'moment'
  128. export default {
  129. name: 'checkAndPrintReport',
  130. data () {
  131. return {
  132. ticketTypeList: [],
  133. otaList: [],
  134. projectName: localStorage.getItem('otaProject'),
  135. form: {
  136. export: false,
  137. checkTimeBegin: new Date(moment().startOf('month')),
  138. checkTimeEnd: new Date(moment().endOf('month')),
  139. otaSourceNameList: [], // 分销商名称
  140. ticketTypeIdList: [], // 票种名称
  141. pageNum: 1,
  142. pageSize: 10
  143. },
  144. tableData: [],
  145. total: 0,
  146. loading: false,
  147. currentItem: {},
  148. orderDialogVisible: false,
  149. guestDialogVisible: false
  150. }
  151. },
  152. computed: {
  153. queryClear () {
  154. return this.$store.state.user.permissionList.includes('stats:clearwx_query')
  155. }
  156. },
  157. created () {
  158. this.getTicketTypeList()
  159. this.getProductList()
  160. this.getData()
  161. },
  162. methods: {
  163. reset () {
  164. this.$refs.form.resetFields()
  165. },
  166. // 获取票种列表
  167. getTicketTypeList () {
  168. return getTicketTypeList({
  169. pageNum: 1,
  170. pageSize: -1
  171. }).then(res => {
  172. this.ticketTypeList = res.data.records || []
  173. })
  174. },
  175. getProductList () {
  176. return getOtaProjectList({
  177. pageNum: 1,
  178. pageSize: -1
  179. }).then(res => {
  180. this.otaList = res.data.records || []
  181. })
  182. },
  183. exportReport () {
  184. this.form.export = true
  185. getCheckAndPrintStatistics(this.form).then(() => {
  186. this.$confirm('导出成功,是否去下载页', '提示', {
  187. confirmButtonText: '确定',
  188. cancelButtonText: '取消',
  189. type: 'warning'
  190. }).then(() => {
  191. this.$router.push('/queryReport/reportExport')
  192. }).catch(() => {})
  193. }, () => {
  194. this.$notify.error({
  195. title: '提示',
  196. message: '导出失败'
  197. })
  198. })
  199. this.form.export = false
  200. },
  201. getData () {
  202. this.loading = true
  203. if (this.form.checkTimeBegin) {
  204. this.form.checkTimeBegin = moment(this.form.checkTimeBegin).format('YYYY-MM-DD HH:mm:ss')
  205. }
  206. if (this.form.checkTimeEnd) {
  207. this.form.checkTimeEnd = moment(this.form.checkTimeEnd).format('YYYY-MM-DD HH:mm:ss')
  208. }
  209. if (!this.form.otaSourceNameList || this.form.otaSourceNameList.length === 0) {
  210. this.form.otaSourceNameList = []
  211. }
  212. if (!this.form.ticketTypeIdList || this.form.ticketTypeIdList.length === 0) {
  213. this.form.ticketTypeIdList = []
  214. }
  215. getCheckAndPrintStatistics(this.form).then(res => {
  216. res.data.forEach(item => {
  217. if (item.ticketTypeName === '总计') {
  218. item.otaSourceName = '总计'
  219. item.ticketTypeName = ''
  220. item.price = ''
  221. } else if (item.ticketTypeName === '小计') {
  222. item.otaSourceName = '小计'
  223. item.ticketTypeName = ''
  224. item.price = ''
  225. }
  226. })
  227. this.tableData = res.data
  228. this.loading = false
  229. }).catch(() => {
  230. this.loading = false
  231. })
  232. }
  233. }
  234. }
  235. </script>
  236. <style scoped>
  237. </style>