daily.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <!--
  2. * @Description:
  3. * @Author: shipeng
  4. * @Date: 2025-06-10 预定报表开发 替换 日报表
  5. -->
  6. <template>
  7. <div class="app-container">
  8. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="60px">
  9. <el-form-item label="日期" required>
  10. <el-date-picker
  11. v-model="queryParams.performDate"
  12. @change="dateChange"
  13. type="date"
  14. value-format="yyyy-MM-dd"
  15. placeholder="日期">
  16. </el-date-picker>
  17. </el-form-item>
  18. <el-form-item label="场次" v-if="!multiPerformDate" label-width="55px">
  19. <el-select
  20. v-model="queryParams.timeId"
  21. placeholder="场次"
  22. @change="getList"
  23. clearable
  24. style="width: 100%"
  25. >
  26. <el-option
  27. v-for="dict in pagePerformTimeList"
  28. :key="dict.id"
  29. :label="dict.timeSnapshot+'('+dict.performTimeStart+'-'+dict.performTimeEnd+')'"
  30. :value="dict.id"
  31. />
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  36. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  37. </el-form-item>
  38. </el-form>
  39. <el-row :gutter="10" class="mb8" style="margin-left: 0; margin-top: 10px">
  40. <el-button
  41. type="primary"
  42. size="mini"
  43. icon="el-icon-download"
  44. :disabled="dataList.length === 0"
  45. v-hasPermi="['daily:daily:downloadExcel']"
  46. @click="handleExport"
  47. v-loading.fullscreen.lock="handleExportLoading"
  48. element-loading-text="正在拼命生成数据中..."
  49. element-loading-spinner="el-icon-loading"
  50. element-loading-background="rgba(0, 0, 0, 0.5)"
  51. >导出excel</el-button>
  52. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  53. </el-row>
  54. <el-table ref="tables" v-loading="loading" :data="dataList" max-height="650px" border>
  55. <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
  56. <!-- <el-table-column label="剧目名称" align="center" prop="performName" />
  57. <el-table-column label="票务名称" align="center" prop="goodsName" /> -->
  58. <el-table-column label="场次日期" align="center" width="100">
  59. <template slot-scope="scope">
  60. <span>{{ scope.row.performDate }}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="场次" align="center" width="110">
  64. <template slot-scope="scope">
  65. <span>{{ scope.row.performTimeStart }} -- {{ scope.row.performTimeEnd }}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="座位类型" align="center" prop="seatTypeName" width="120" />
  69. <el-table-column label="窗口" align="center" prop="winTotal" />
  70. <el-table-column label="小程序" align="center" prop="microAppTotal" />
  71. <el-table-column label="分销" align="center" prop="retailTotal" />
  72. <el-table-column label="自助机" align="center" prop="selfTotal" />
  73. <el-table-column label="直客小计" align="center" prop="directSaleTotal" />
  74. <el-table-column label="美团" align="center" prop="meituanTotal" />
  75. <el-table-column label="抖音" align="center" prop="duoyinTotal" />
  76. <el-table-column label="携程" align="center" prop="xiechenTotal" />
  77. <el-table-column label="猫眼" align="center" prop="maoyanTotal" />
  78. <el-table-column label="OTA小计" align="center" prop="otaSaleTotal" />
  79. <el-table-column label="大客户" align="center" prop="maxCustomerSaleTotal" />
  80. <el-table-column label="旅行社&红培" align="center" prop="travelAgencySaleTotal" />
  81. <el-table-column label="研学" align="center" prop="studySaleTotal" />
  82. <el-table-column label="党校" align="center" prop="partySchoolSaleTotal" />
  83. <el-table-column label="团购小计" align="center" prop="groupBuyTotal" />
  84. <el-table-column label="合计" align="center" prop="buySaleTotal" />
  85. <el-table-column label="推广票" align="center" prop="promotionTicketSaleTotal" />
  86. <el-table-column label="总计" align="center" prop="saleTotal" />
  87. </el-table>
  88. </div>
  89. </template>
  90. <script>
  91. import { bookingReportCount, bookingReportCountExport } from '@/api/statisticalReport/statistics'
  92. import { exportExcel } from '@/utils/exportexcel'
  93. import { seatPricePageList } from '@/api/distribution/ticketMr'
  94. import { pagePerformTimeList } from "@/api/schedulingMr/schedulingMr"
  95. import moment from "moment"
  96. export default {
  97. name: "Daily",
  98. dicts: [],
  99. data() {
  100. return {
  101. // 遮罩层
  102. loading: true,
  103. // 选中数组
  104. ids: [],
  105. // 非单个禁用
  106. single: true,
  107. // 非多个禁用
  108. multiple: true,
  109. // 显示搜索条件
  110. showSearch: true,
  111. // 总条数
  112. total: 0,
  113. // 用户表格数据
  114. dataList: [],
  115. // 弹出层标题
  116. title: "",
  117. responseData: {},
  118. // 是否显示弹出层
  119. open: false,
  120. // 日期范围
  121. dateRange: [],
  122. // 查询参数
  123. queryParams: {
  124. // pageNum: 1,
  125. // pageSize: 10,
  126. },
  127. visibleStatus: false,
  128. newObj: {},
  129. visibleType: '',
  130. handleExportLoading: false,
  131. tableData: {},
  132. ticketList: [],
  133. seatList: [],
  134. multiPerformDate:false,
  135. pagePerformTimeList: [], // 场次列表
  136. };
  137. },
  138. created() {
  139. // this.$set(this.queryParams,'performDate',moment().format("yyyy-MM-DD"));
  140. this.$set(this.queryParams,'performDate',moment().add(1, 'days').format('YYYY-MM-DD'));
  141. this.pagePerformTimeListFun(this.performDate)
  142. this.getList();
  143. // this.ticketListApi();
  144. },
  145. methods: {
  146. /** 查询列表 */
  147. getList() {
  148. this.loading = true;
  149. if(this.queryParams.time){
  150. this.queryParams.performStartDate = this.queryParams.time[0];
  151. this.queryParams.performEndDate = this.queryParams.time[1];
  152. }
  153. bookingReportCount(this.addDateRange(this.queryParams, this.dateRange))
  154. .then(response => {
  155. // this.responseData = response.data;
  156. this.dataList = response.data.rows||[];
  157. this.total = response.data.total||0;
  158. this.loading = false;
  159. }
  160. ).catch(()=>{
  161. this.loading = false;
  162. });
  163. },
  164. /** 票务列表查询 */
  165. ticketListApi() {
  166. this.ticketList = []
  167. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100}))
  168. .then(response => {
  169. let ticketItemList = []
  170. response.data.rows.forEach(item => {
  171. if(ticketItemList.indexOf(item.goodsId) == -1){
  172. this.ticketList.push(item);
  173. ticketItemList.push(item.goodsId);
  174. }
  175. })
  176. });
  177. },
  178. /** 座位类型列表 */
  179. getSeatTypeList(obj) {
  180. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100, goodsId: obj.goodsId}))
  181. .then(response => {
  182. let ticketList = []
  183. response.data.rows.forEach(item => {
  184. if(ticketList.indexOf(item.seatTypeId) == -1){
  185. this.seatList.push(item);
  186. ticketList.push(item.seatTypeId);
  187. }
  188. })
  189. });
  190. },
  191. // 取消按钮
  192. cancel() {
  193. this.open = false;
  194. },
  195. // 票务改变事件
  196. goodsChangeEven() {
  197. this.seatList = [];
  198. this.$set(this.queryParams, 'seatTypeId', '');
  199. let selectMap = {goodsId: this.queryParams.goodsId}
  200. this.getSeatTypeList(selectMap);
  201. },
  202. /** 搜索按钮操作 */
  203. handleQuery() {
  204. // this.queryParams.pageNum = 1;
  205. this.getList();
  206. },
  207. /** 重置按钮操作 */
  208. resetQuery() {
  209. this.dateRange = [];
  210. this.seatList = [];
  211. this.$set(this.queryParams, 'time', '');
  212. this.$set(this.queryParams, 'performStartDate', '');
  213. this.$set(this.queryParams, 'performEndDate', '');
  214. this.$set(this.queryParams, 'goodsId', '');
  215. this.$set(this.queryParams, 'seatTypeId', '');
  216. this.$set(this.queryParams, 'timeId', '');
  217. // this.queryParams.pageNum = 1;
  218. // this.$set(this.queryParams,'performDate',moment().format("yyyy-MM-DD"));
  219. this.$set(this.queryParams,'performDate',moment().add(1, 'days').format('YYYY-MM-DD'));
  220. this.handleQuery();
  221. },
  222. dateChange(e){
  223. this.queryParams.timeId = '';
  224. this.pagePerformTimeListFun(e)
  225. },
  226. async pagePerformTimeListFun(value) {
  227. // console.log('value',value);
  228. try {
  229. let { data,code } = await pagePerformTimeList({
  230. performDate: this.queryParams.performDate,
  231. pageNum: 1,
  232. pageSize: 999
  233. })
  234. this.pagePerformTimeList = [].concat(data.rows);
  235. // if(data.rows[0]){
  236. // this.queryParams.timeId = data.rows[0].id;
  237. // }
  238. // this.getList();
  239. } catch (error) {
  240. console.log('pagePerformTimeListFun error',error);
  241. }
  242. },
  243. /**
  244. * 导出报表
  245. * @date 2022-10-24
  246. * @returns {any}
  247. */
  248. handleExport() {
  249. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  250. confirmButtonText: '确定 ',
  251. cancelButtonText: '取消 ',
  252. type: 'warning'
  253. })
  254. .then(() => {
  255. this.handleExportLoading = true;
  256. // const { pageNum, pageSize} = this.params;
  257. let postMap = {}
  258. for (let key in this.queryParams) {
  259. if(key != 'pageNum' && key != 'pageSize'){
  260. postMap[key] = this.queryParams[key]
  261. }
  262. }
  263. bookingReportCountExport(postMap)
  264. .then((res) => {
  265. exportExcel(res, '预定报表', '.xlsx');
  266. this.handleExportLoading = false;
  267. })
  268. .catch(() => {
  269. this.handleExportLoading = false;
  270. });
  271. })
  272. .catch(() => {
  273. this.$message.info('您已取消导出!');
  274. });
  275. },
  276. }
  277. };
  278. </script>
  279. <style lang="scss" scoped>
  280. </style>