session.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="40px">
  4. <el-form-item label="日期">
  5. <el-date-picker
  6. v-model="queryParams.performStartDate"
  7. type="date"
  8. value-format="yyyy-MM-dd"
  9. placeholder="日期">
  10. </el-date-picker>
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  14. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <el-row :gutter="10" class="mb8" style="margin-left: 0; margin-top: 10px">
  18. <el-button
  19. type="primary"
  20. size="mini"
  21. icon="el-icon-download"
  22. :disabled="dataList.length === 0"
  23. v-hasPermi="['session:session:downloadExcel']"
  24. @click="handleExport"
  25. v-loading.fullscreen.lock="handleExportLoading"
  26. element-loading-text="正在拼命生成数据中..."
  27. element-loading-spinner="el-icon-loading"
  28. element-loading-background="rgba(0, 0, 0, 0.5)"
  29. >导出excel</el-button>
  30. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  31. </el-row>
  32. <el-table ref="tables" v-loading="loading" :data="dataList" max-height="500px" border>
  33. <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
  34. <!-- <el-table-column label="剧目名称" align="center" prop="performName" />
  35. <el-table-column label="票务名称" align="center" prop="goodsName" /> -->
  36. <el-table-column label="场次日期" align="center">
  37. <template slot-scope="scope">
  38. <span>{{ scope.row.performDate }}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="场次" align="center">
  42. <template slot-scope="scope">
  43. <span>{{ scope.row.performTimeStart }} -- {{ scope.row.performTimeEnd }}</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="销售量" align="center">
  47. <template slot-scope="scope">
  48. <span>{{ scope.row.saleTotal?scope.row.saleTotal+'张' : '-' }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="核销量" align="center">
  52. <template slot-scope="scope">
  53. <span>{{ scope.row.usedTotal?scope.row.usedTotal+'张' : '-' }}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="核销率" align="center">
  57. <template slot-scope="scope">
  58. <span>{{ scope.row.usedRate?scope.row.usedRate+'%' : '-' }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="核销上座率" align="center">
  62. <template slot-scope="scope">
  63. <span>{{ scope.row.occupancyRate?scope.row.occupancyRate+'%' : '-' }}</span>
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. <pagination
  68. v-show="total>0"
  69. :total="total"
  70. :page.sync="queryParams.pageNum"
  71. :limit.sync="queryParams.pageSize"
  72. @pagination="getList"
  73. />
  74. </div>
  75. </template>
  76. <script>
  77. import { performTimeCount, downTimeCountListXls } from '@/api/statisticalReport/statistics'
  78. import { exportExcel } from '@/utils/exportexcel'
  79. import { seatPricePageList } from '@/api/distribution/ticketMr'
  80. import moment from "moment"
  81. export default {
  82. name: "Session",
  83. dicts: ['agreement_type'],
  84. data() {
  85. return {
  86. // 遮罩层
  87. loading: true,
  88. // 选中数组
  89. ids: [],
  90. // 非单个禁用
  91. single: true,
  92. // 非多个禁用
  93. multiple: true,
  94. // 显示搜索条件
  95. showSearch: true,
  96. // 总条数
  97. total: 0,
  98. // 用户表格数据
  99. dataList: [],
  100. // 弹出层标题
  101. title: "",
  102. // 是否显示弹出层
  103. open: false,
  104. // 日期范围
  105. dateRange: [],
  106. // 查询参数
  107. queryParams: {
  108. pageNum: 1,
  109. pageSize: 10,
  110. },
  111. visibleStatus: false,
  112. newObj: {},
  113. visibleType: '',
  114. handleExportLoading: false,
  115. tableData: {},
  116. ticketList: [],
  117. seatList: [],
  118. };
  119. },
  120. created() {
  121. this.$set(this.queryParams,'performStartDate',moment().format("yyyy-MM-DD"))
  122. this.getList();
  123. this.ticketListApi();
  124. },
  125. methods: {
  126. /** 查询列表 */
  127. getList() {
  128. this.loading = true;
  129. if(this.queryParams.time){
  130. this.queryParams.performStartDate = this.queryParams.time[0];
  131. this.queryParams.performEndDate = this.queryParams.time[1];
  132. }
  133. performTimeCount(this.addDateRange(this.queryParams, this.dateRange))
  134. .then(response => {
  135. this.dataList = response.data.rows;
  136. this.total = response.data.total;
  137. this.loading = false;
  138. }
  139. );
  140. },
  141. /** 票务列表查询 */
  142. ticketListApi() {
  143. this.ticketList = []
  144. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100}))
  145. .then(response => {
  146. let ticketItemList = []
  147. response.data.rows.forEach(item => {
  148. if(ticketItemList.indexOf(item.goodsId) == -1){
  149. this.ticketList.push(item);
  150. ticketItemList.push(item.goodsId);
  151. }
  152. })
  153. });
  154. },
  155. /** 座位类型列表 */
  156. getSeatTypeList(obj) {
  157. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100, goodsId: obj.goodsId}))
  158. .then(response => {
  159. let ticketList = []
  160. response.data.rows.forEach(item => {
  161. if(ticketList.indexOf(item.seatTypeId) == -1){
  162. this.seatList.push(item);
  163. ticketList.push(item.seatTypeId);
  164. }
  165. })
  166. });
  167. },
  168. // 取消按钮
  169. cancel() {
  170. this.open = false;
  171. },
  172. // 票务改变事件
  173. goodsChangeEven() {
  174. this.seatList = [];
  175. this.$set(this.queryParams, 'seatTypeId', '');
  176. let selectMap = {goodsId: this.queryParams.goodsId}
  177. this.getSeatTypeList(selectMap);
  178. },
  179. /** 搜索按钮操作 */
  180. handleQuery() {
  181. this.queryParams.pageNum = 1;
  182. this.getList();
  183. },
  184. /** 重置按钮操作 */
  185. resetQuery() {
  186. this.dateRange = [];
  187. this.seatList = [];
  188. this.$set(this.queryParams, 'time', '');
  189. this.$set(this.queryParams, 'performStartDate', '');
  190. this.$set(this.queryParams, 'performEndDate', '');
  191. this.$set(this.queryParams, 'goodsId', '');
  192. this.$set(this.queryParams, 'seatTypeId', '');
  193. this.queryParams.pageNum = 1;
  194. this.handleQuery();
  195. },
  196. /**
  197. * 导出报表
  198. * @date 2022-10-24
  199. * @returns {any}
  200. */
  201. handleExport() {
  202. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  203. confirmButtonText: '确定 ',
  204. cancelButtonText: '取消 ',
  205. type: 'warning'
  206. })
  207. .then(() => {
  208. this.handleExportLoading = true;
  209. // const { pageNum, pageSize} = this.params;
  210. let postMap = {}
  211. for (let key in this.queryParams) {
  212. if(key != 'pageNum' && key != 'pageSize'){
  213. postMap[key] = this.queryParams[key]
  214. }
  215. }
  216. downTimeCountListXls(postMap)
  217. .then((res) => {
  218. exportExcel(res, '场次销售分析', '.xlsx');
  219. this.handleExportLoading = false;
  220. })
  221. .catch(() => {
  222. this.handleExportLoading = false;
  223. });
  224. })
  225. .catch(() => {
  226. this.$message.info('您已取消导出!');
  227. });
  228. },
  229. }
  230. };
  231. </script>