channelSales.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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="演出厅" prop="auditoriumId" label-width="70px">
  5. <el-select
  6. v-model="queryParams.auditoriumId"
  7. placeholder="演出厅"
  8. clearable
  9. style="width: 100%"
  10. @change="pagePerformTimeListFun(selectTime)"
  11. >
  12. <el-option
  13. v-for="dict in merchantTheatreAuditoriumListS"
  14. :key="dict.id"
  15. :label="dict.name"
  16. :value="dict.id"
  17. />
  18. </el-select>
  19. </el-form-item> -->
  20. <el-form-item label="场次日期" :required="true" label-width="85px">
  21. <el-date-picker
  22. style="width: 230px;"
  23. v-model="selectTime"
  24. type="daterange"
  25. @change="pagePerformTimeListFun"
  26. value-format="yyyy-MM-dd"
  27. placeholder="日期">
  28. </el-date-picker>
  29. </el-form-item>
  30. <el-form-item label="场次" v-if="!multiPerformDate" :required="!multiPerformDate" label-width="55px">
  31. <el-select
  32. v-model="queryParams.timeId"
  33. placeholder="场次"
  34. clearable
  35. style="width: 100%"
  36. >
  37. <el-option
  38. v-for="dict in pagePerformTimeList"
  39. :key="dict.id"
  40. :label="dict.timeSnapshot+'('+dict.performTimeStart+'-'+dict.performTimeEnd+')'"
  41. :value="dict.id"
  42. />
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item>
  46. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  47. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  48. </el-form-item>
  49. </el-form>
  50. <el-row :gutter="10" class="mb8" style="margin-left: 0; margin-top: 10px">
  51. <el-button
  52. type="primary"
  53. size="mini"
  54. icon="el-icon-download"
  55. :disabled="dataList.length === 0"
  56. v-hasPermi="['session:session:downloadExcel']"
  57. @click="handleExport"
  58. v-loading.fullscreen.lock="handleExportLoading"
  59. element-loading-text="正在拼命生成数据中..."
  60. element-loading-spinner="el-icon-loading"
  61. element-loading-background="rgba(0, 0, 0, 0.5)"
  62. >导出excel</el-button>
  63. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  64. </el-row>
  65. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  66. <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
  67. <!-- <el-table-column label="场次日期" align="center">
  68. <template slot-scope="scope">
  69. <span>{{ scope.row.performDate }}</span>
  70. </template>
  71. </el-table-column> -->
  72. <el-table-column label="渠道名称" align="center" prop="channelName" />
  73. <el-table-column label="订单数(笔)" align="center">
  74. <template slot-scope="scope">
  75. <span>{{ scope.row.ordersTotal }}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="应收总额(元)" align="center">
  79. <template slot-scope="scope">
  80. <span>{{ scope.row.receivablePriceTotal }}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="实收总额(元)" align="center">
  84. <template slot-scope="scope">
  85. <span>{{ scope.row.practicalPriceTotal }}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="己售票数(张)" align="center">
  89. <template slot-scope="scope">
  90. <span>{{ scope.row.saleTotal }}</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="核销票数(张)" align="center">
  94. <template slot-scope="scope">
  95. <span>{{ scope.row.usedTotal }}</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="未核销票数(张)" align="center" prop="unUsedTotal" />
  99. <el-table-column label="退票数(张)" align="center" prop="refundTotal" />
  100. <el-table-column label="退票金额(元)" align="center" prop="refundPriceTotal" />
  101. </el-table>
  102. <!-- <pagination
  103. v-show="total>0"
  104. :total="total"
  105. :page.sync="queryParams.pageNum"
  106. :limit.sync="queryParams.pageSize"
  107. @pagination="getList"
  108. /> -->
  109. </div>
  110. </template>
  111. <script>
  112. import {merchantTheatreAuditoriumList} from '@/api/windowTicketSales/ticketingSales'
  113. import { channelOrderCount, downChannelOrderListXls } from '@/api/statisticalReport/statistics'
  114. import { exportExcel } from '@/utils/exportexcel'
  115. import { seatPricePageList } from '@/api/distribution/ticketMr'
  116. import { pagePerformTimeList } from "@/api/schedulingMr/schedulingMr"
  117. import moment from "moment"
  118. export default {
  119. name: "agreement",
  120. dicts: ['agreement_type'],
  121. data() {
  122. return {
  123. // 遮罩层
  124. loading: true,
  125. // 选中数组
  126. ids: [],
  127. // 非单个禁用
  128. single: true,
  129. // 非多个禁用
  130. multiple: true,
  131. // 显示搜索条件
  132. showSearch: true,
  133. // 总条数
  134. total: 0,
  135. // 用户表格数据
  136. dataList: [],
  137. // 弹出层标题
  138. title: "",
  139. // 是否显示弹出层
  140. open: false,
  141. // 日期范围
  142. dateRange: [],
  143. // 查询参数
  144. queryParams: {
  145. auditoriumId:'',
  146. // pageNum: 1,
  147. // pageSize: 10,
  148. },
  149. visibleStatus: false,
  150. newObj: {},
  151. visibleType: '',
  152. handleExportLoading: false,
  153. tableData: {},
  154. ticketList: [],
  155. seatList: [],
  156. multiPerformDate:false,
  157. pagePerformTimeList: [], // 场次列表
  158. selectTime:'',
  159. merchantTheatreAuditoriumListS: [],//演出厅
  160. };
  161. },
  162. created() {
  163. // this.$set(this.queryParams,'time',moment().format("yyyy-MM-DD"))
  164. // this.merchantTheatreAuditoriumListFun();//演出厅
  165. this.$set(this,'selectTime',[moment().format("yyyy-MM-DD"),moment().format("yyyy-MM-DD")]);
  166. this.pagePerformTimeListFun(this.selectTime)
  167. // this.getList();
  168. // this.ticketListApi();
  169. },
  170. methods: {
  171. /** 查询列表 */
  172. getList() {
  173. this.loading = true;
  174. if(this.selectTime){
  175. this.queryParams.beginDate = this.selectTime[0];
  176. this.queryParams.endDate = this.selectTime[1];
  177. }
  178. // channelOrderCount(this.addDateRange(this.queryParams, this.dateRange))
  179. channelOrderCount(this.queryParams)
  180. .then(response => {
  181. this.dataList = response.data;
  182. this.total = response.data.total;
  183. this.loading = false;
  184. }
  185. ).catch(response => {
  186. this.loading = false;
  187. });
  188. },
  189. /** 票务列表查询 */
  190. ticketListApi() {
  191. this.ticketList = []
  192. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100}))
  193. .then(response => {
  194. let ticketItemList = []
  195. response.data.rows.forEach(item => {
  196. if(ticketItemList.indexOf(item.goodsId) == -1){
  197. this.ticketList.push(item);
  198. ticketItemList.push(item.goodsId);
  199. }
  200. })
  201. });
  202. },
  203. /** 座位类型列表 */
  204. getSeatTypeList(obj) {
  205. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100, goodsId: obj.goodsId}))
  206. .then(response => {
  207. let ticketList = []
  208. response.data.rows.forEach(item => {
  209. if(ticketList.indexOf(item.seatTypeId) == -1){
  210. this.seatList.push(item);
  211. ticketList.push(item.seatTypeId);
  212. }
  213. })
  214. });
  215. },
  216. // 取消按钮
  217. cancel() {
  218. this.open = false;
  219. },
  220. // 票务改变事件
  221. goodsChangeEven() {
  222. this.seatList = [];
  223. this.$set(this.queryParams, 'seatTypeId', '');
  224. let selectMap = {goodsId: this.queryParams.goodsId}
  225. this.getSeatTypeList(selectMap);
  226. },
  227. /** 搜索按钮操作 */
  228. handleQuery() {
  229. // this.queryParams.pageNum = 1;
  230. this.getList();
  231. },
  232. /** 重置按钮操作 */
  233. resetQuery() {
  234. this.dateRange = [];
  235. this.seatList = [];
  236. this.$set(this.queryParams, 'time', '');
  237. this.$set(this, 'selectTime', '');
  238. this.$set(this.queryParams, 'auditoriumId', '');
  239. this.$set(this.queryParams, 'beginDate', '');
  240. this.$set(this.queryParams, 'endDate', '');
  241. this.$set(this.queryParams, 'goodsId', '');
  242. this.$set(this.queryParams, 'seatTypeId', '');
  243. this.$set(this.queryParams, 'timeId', '');
  244. // this.queryParams.pageNum = 1;
  245. this.multiPerformDate = false;
  246. //必须要有默认值
  247. this.$set(this,'selectTime',[moment().format("yyyy-MM-DD"),moment().format("yyyy-MM-DD")]);
  248. this.pagePerformTimeListFun(this.selectTime)
  249. // this.handleQuery();
  250. },
  251. /**
  252. * 导出报表
  253. * @date 2022-10-24
  254. * @returns {any}
  255. */
  256. handleExport() {
  257. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  258. confirmButtonText: '确定 ',
  259. cancelButtonText: '取消 ',
  260. type: 'warning'
  261. })
  262. .then(() => {
  263. this.handleExportLoading = true;
  264. // const { pageNum, pageSize} = this.params;
  265. let postMap = {}
  266. for (let key in this.queryParams) {
  267. if(key != 'pageNum' && key != 'pageSize'){
  268. postMap[key] = this.queryParams[key]
  269. }
  270. }
  271. downChannelOrderListXls(postMap)
  272. .then((res) => {
  273. exportExcel(res, '渠道订单销售统计', '.xlsx');
  274. this.handleExportLoading = false;
  275. })
  276. .catch(() => {
  277. this.handleExportLoading = false;
  278. });
  279. })
  280. .catch(() => {
  281. this.$message.info('您已取消导出!');
  282. });
  283. },
  284. async pagePerformTimeListFun(value) {
  285. console.log('value',value);
  286. try {
  287. this.pagePerformTimeList = []
  288. this.$set(this.queryParams,'timeId',null)
  289. if(!value){
  290. return
  291. }
  292. if(value.length==2&&value[0]==value[1]){
  293. this.multiPerformDate = false
  294. }else{
  295. this.multiPerformDate = true
  296. return
  297. }
  298. let { data,code } = await pagePerformTimeList({
  299. performDate: value[0],
  300. pageNum: 1,
  301. pageSize: 999
  302. })
  303. this.pagePerformTimeList = [].concat(data.rows);
  304. if(data.rows[0]){
  305. this.queryParams.timeId = data.rows[0].id;
  306. this.getList();
  307. }
  308. } catch (error) {
  309. }
  310. },
  311. /** 获取演出厅 */
  312. async merchantTheatreAuditoriumListFun(){
  313. try {
  314. let res = await merchantTheatreAuditoriumList({
  315. pageNum: 1,
  316. pageSize: 999
  317. })
  318. if(res.code == 200){
  319. this.merchantTheatreAuditoriumListS = res.data.rows
  320. if(this.merchantTheatreAuditoriumListS.length>0){
  321. this.$set(this.queryParams,'auditoriumId',this.merchantTheatreAuditoriumListS[0].id)
  322. this.pagePerformTimeListFun(this.selectTime)
  323. }
  324. }
  325. } catch (error) {
  326. }
  327. },
  328. }
  329. };
  330. </script>