distridbution.vue 8.5 KB

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