cancelReport.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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="timeBegin">
  12. <el-date-picker
  13. v-model="form.timeBegin"
  14. type="datetime"
  15. placeholder="选择日期时间">
  16. </el-date-picker>
  17. </el-form-item>
  18. <el-form-item
  19. label="截止时间"
  20. prop="timeEnd">
  21. <el-date-picker
  22. v-model="form.timeEnd"
  23. type="datetime"
  24. placeholder="选择日期时间">
  25. </el-date-picker>
  26. </el-form-item>
  27. <el-form-item
  28. label="票种"
  29. prop="ticketTypeIdList">
  30. <el-select
  31. filterable
  32. v-model="form.ticketTypeIdList"
  33. multiple
  34. clearable
  35. placeholder="请选择">
  36. <el-option
  37. v-for="item in ticketTypeList"
  38. :key="item.id"
  39. :label="item.name"
  40. :value="item.ticketTypeId">
  41. </el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item
  45. label="销售来源"
  46. prop="otaSourceNameList">
  47. <el-select
  48. filterable
  49. multiple
  50. v-model="form.otaSourceNameList"
  51. placeholder="请选择">
  52. <el-option
  53. v-for="item in otaSourceList"
  54. :key="item.otaSourceCode"
  55. :label="item.otaSourceName"
  56. :value="item.otaSourceName">
  57. </el-option>
  58. </el-select>
  59. </el-form-item>
  60. </el-form>
  61. <div class="btn-wrap">
  62. <el-button
  63. @click="reset">重置</el-button>
  64. <el-button
  65. type="primary"
  66. @click="getCancelOrderList($event,true)">搜索</el-button>
  67. <el-button
  68. type="primary"
  69. @click="handleExport">导出</el-button>
  70. </div>
  71. </div>
  72. <div class="tableBox">
  73. <div class="block-title">
  74. 查询信息
  75. </div>
  76. <el-table
  77. :data="tableData"
  78. v-loading="loading">
  79. <el-table-column
  80. prop="otaSourceName"
  81. label="订单渠道">
  82. </el-table-column>
  83. <el-table-column
  84. prop="ticketTypeName"
  85. label="票种">
  86. </el-table-column>
  87. <el-table-column
  88. prop="unitPrice"
  89. label="单价">
  90. </el-table-column>
  91. <el-table-column
  92. prop="cancelCount"
  93. label="检票数量">
  94. </el-table-column>
  95. <el-table-column
  96. prop="cancelNum"
  97. label="退票张数">
  98. </el-table-column>
  99. <el-table-column
  100. prop="cancelPrice"
  101. label="退票金额">
  102. </el-table-column>
  103. <!-- <el-table-column
  104. width="260"
  105. fixed="right"
  106. label="操作">
  107. <template slot-scope="scope">
  108. <el-button
  109. type="text"
  110. @click="showOrderInfo(scope.row)">订单详情</el-button>
  111. <el-button
  112. type="text"
  113. @click="$refs.ticketInfo.show(scope.row.tickets)">门票详情</el-button>
  114. <el-button
  115. type="text"
  116. @click="showGuestInfo(scope.row)">游客信息</el-button>
  117. <el-button
  118. type="text"
  119. v-if="checkRefundVisible(scope.row)&&canCancel"
  120. @click="showOrderInfo(scope.row,'cancel')">退订单</el-button>
  121. </template>
  122. </el-table-column> -->
  123. </el-table>
  124. <el-pagination
  125. background
  126. :current-page.sync="form.pageNum"
  127. @current-change="getCancelOrderList"
  128. layout="total, prev, pager, next"
  129. :total="total">
  130. </el-pagination>
  131. </div>
  132. <ElDialog
  133. :title="type==='cancel'?'退单':'订单详情'"
  134. width="760px"
  135. v-model="orderDialogVisible"
  136. >
  137. <OrderDialog
  138. :current-item="currentItem"
  139. :can-cancel="canCancel"
  140. @updateList="getCancelOrderList"
  141. :type="type"></OrderDialog>
  142. </ElDialog>
  143. <ElDialog
  144. title="游客信息"
  145. width="760px"
  146. v-model="guestDialogVisible">
  147. <GuestDialog
  148. :current-item="currentItem"></GuestDialog>
  149. </ElDialog>
  150. <TicketInfo ref="ticketInfo"></TicketInfo>
  151. </div>
  152. </template>
  153. <script>
  154. import { getOrderCancelStatistics, getOtaSourceList } from '@/api/order'
  155. import { getTicketTypeList } from '@/api/ticketType'
  156. import ElDialog from '@/components/Dialog'
  157. import OrderDialog from './orderList/OrderDialog'
  158. import GuestDialog from './orderList/GuestDialog'
  159. import TicketInfo from './orderList/TicketInfo'
  160. import { orderStatus } from '@/const'
  161. import moment from 'moment'
  162. export default {
  163. name: 'salesReport',
  164. components: {
  165. ElDialog,
  166. OrderDialog,
  167. GuestDialog,
  168. TicketInfo
  169. },
  170. data () {
  171. return {
  172. ticketTypeList: [],
  173. otaSourceList: [],
  174. projectName: localStorage.getItem('otaProject'),
  175. totalObj: {},
  176. type: '', // 操作状态 cancel退订单
  177. form: {
  178. timeBegin: moment().startOf('day'),
  179. timeEnd: moment().endOf('day'),
  180. ticketTypeIdList: [], // 票种名称
  181. otaSourceNameList: [], // 订单渠道
  182. export: false,
  183. pageNum: 1,
  184. pageSize: 10
  185. },
  186. orderStatusDic: orderStatus,
  187. loading: false,
  188. tableData: [],
  189. total: 0,
  190. currentItem: {},
  191. orderDialogVisible: false,
  192. guestDialogVisible: false
  193. }
  194. },
  195. created () {
  196. this.getTicketTypeList()
  197. this.getOtaSourceList()
  198. this.getCancelOrderList()
  199. },
  200. computed: {
  201. canCancel () {
  202. return this.$store.state.user.permissionList.includes('orders:cancel')
  203. },
  204. queryClear () {
  205. return this.$store.state.user.permissionList.includes('stats:clearwx_query')
  206. },
  207. otaList () {
  208. const list = JSON.parse(localStorage.getItem('otaList'))
  209. return this.projectName === 'YINXIANGMAZU' && !this.queryClear ? list.filter(item => item.otaSourceCode !== 'CLEARWX') : list
  210. }
  211. },
  212. methods: {
  213. checkRefundVisible (item) {
  214. if (item.status !== 'CANCELED') return true
  215. if (item.status === 'CANCELED') {
  216. if (item.tickets.some(i => i.status !== 'CANCELED')) {
  217. return true
  218. } else {
  219. return false
  220. }
  221. }
  222. return false
  223. },
  224. reset () {
  225. this.$refs.form.resetFields()
  226. },
  227. getTicketTypeList () {
  228. getTicketTypeList({
  229. pageNum: 1,
  230. pageSize: -1
  231. }).then(res => {
  232. this.ticketTypeList = res.data.records || []
  233. })
  234. },
  235. getOtaSourceList () {
  236. getOtaSourceList({
  237. pageNum: 1,
  238. pageSize: -1
  239. }).then(res => {
  240. this.otaSourceList = res.data || []
  241. })
  242. },
  243. getCancelOrderList (e, goFirst) {
  244. if (goFirst) { this.form.pageNum = 1 }
  245. if (!this.form.timeBegin || !this.form.timeEnd) {
  246. this.$message.error('请选择起始时间和截止时间')
  247. return
  248. }
  249. this.form.timeBegin = moment(this.form.timeBegin).format('YYYY-MM-DD HH:mm:ss')
  250. this.form.timeEnd = moment(this.form.timeEnd).format('YYYY-MM-DD HH:mm:ss')
  251. if (!this.form.ticketTypeIdList) {
  252. this.form.ticketTypeIdList = []
  253. }
  254. if (!this.form.otaSourceNameList) {
  255. this.form.otaSourceNameList = []
  256. }
  257. this.loading = true
  258. getOrderCancelStatistics(this.form).then(res => {
  259. this.tableData = res.data
  260. this.loading = false
  261. })
  262. },
  263. showOrderInfo (item, type) {
  264. if ((item.otaSourceCode === 'CLEARWX' || item.otaSourceCode === 'CLEARWXDEV') && type === 'cancel') return this.$message.info('自营平台订单请到自营后台办理退票')
  265. this.currentItem = item
  266. this.type = type
  267. this.orderDialogVisible = true
  268. },
  269. showGuestInfo (item) {
  270. this.currentItem = item
  271. this.guestDialogVisible = true
  272. },
  273. handleExport () {
  274. this.form.export = true
  275. getOrderCancelStatistics(this.form).then(res => {
  276. this.$notify({
  277. title: '提示',
  278. message: '导出成功',
  279. type: 'success'
  280. })
  281. }, () => {
  282. this.$notify.error({
  283. title: '提示',
  284. message: '导出失败'
  285. })
  286. })
  287. }
  288. }
  289. }
  290. </script>
  291. <style scoped>
  292. </style>