channelSales.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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" max-height="500px" 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: "ChannelSales",
  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.dataList = []
  187. this.total = 0
  188. this.loading = false;
  189. });
  190. },
  191. /** 票务列表查询 */
  192. ticketListApi() {
  193. this.ticketList = []
  194. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100}))
  195. .then(response => {
  196. let ticketItemList = []
  197. response.data.rows.forEach(item => {
  198. if(ticketItemList.indexOf(item.goodsId) == -1){
  199. this.ticketList.push(item);
  200. ticketItemList.push(item.goodsId);
  201. }
  202. })
  203. });
  204. },
  205. /** 座位类型列表 */
  206. getSeatTypeList(obj) {
  207. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100, goodsId: obj.goodsId}))
  208. .then(response => {
  209. let ticketList = []
  210. response.data.rows.forEach(item => {
  211. if(ticketList.indexOf(item.seatTypeId) == -1){
  212. this.seatList.push(item);
  213. ticketList.push(item.seatTypeId);
  214. }
  215. })
  216. });
  217. },
  218. // 取消按钮
  219. cancel() {
  220. this.open = false;
  221. },
  222. // 票务改变事件
  223. goodsChangeEven() {
  224. this.seatList = [];
  225. this.$set(this.queryParams, 'seatTypeId', '');
  226. let selectMap = {goodsId: this.queryParams.goodsId}
  227. this.getSeatTypeList(selectMap);
  228. },
  229. /** 搜索按钮操作 */
  230. handleQuery() {
  231. // this.queryParams.pageNum = 1;
  232. this.getList();
  233. },
  234. /** 重置按钮操作 */
  235. resetQuery() {
  236. this.dateRange = [];
  237. this.seatList = [];
  238. this.$set(this.queryParams, 'time', '');
  239. this.$set(this, 'selectTime', '');
  240. this.$set(this.queryParams, 'auditoriumId', '');
  241. this.$set(this.queryParams, 'beginDate', '');
  242. this.$set(this.queryParams, 'endDate', '');
  243. this.$set(this.queryParams, 'goodsId', '');
  244. this.$set(this.queryParams, 'seatTypeId', '');
  245. this.$set(this.queryParams, 'timeId', '');
  246. // this.queryParams.pageNum = 1;
  247. this.multiPerformDate = false;
  248. //必须要有默认值
  249. this.$set(this,'selectTime',[moment().format("yyyy-MM-DD"),moment().format("yyyy-MM-DD")]);
  250. this.pagePerformTimeListFun(this.selectTime)
  251. // this.handleQuery();
  252. },
  253. /**
  254. * 导出报表
  255. * @date 2022-10-24
  256. * @returns {any}
  257. */
  258. handleExport() {
  259. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  260. confirmButtonText: '确定 ',
  261. cancelButtonText: '取消 ',
  262. type: 'warning'
  263. })
  264. .then(() => {
  265. this.handleExportLoading = true;
  266. // const { pageNum, pageSize} = this.params;
  267. let postMap = {}
  268. for (let key in this.queryParams) {
  269. if(key != 'pageNum' && key != 'pageSize'){
  270. postMap[key] = this.queryParams[key]
  271. }
  272. }
  273. downChannelOrderListXls(postMap)
  274. .then((res) => {
  275. exportExcel(res, '渠道订单销售统计', '.xlsx');
  276. this.handleExportLoading = false;
  277. })
  278. .catch(() => {
  279. this.handleExportLoading = false;
  280. });
  281. })
  282. .catch(() => {
  283. this.$message.info('您已取消导出!');
  284. });
  285. },
  286. async pagePerformTimeListFun(value) {
  287. // console.log('value',value);
  288. try {
  289. this.pagePerformTimeList = []
  290. this.$set(this.queryParams,'timeId',null)
  291. if(!value){
  292. return
  293. }
  294. if(value.length==2&&value[0]==value[1]){
  295. this.multiPerformDate = false
  296. }else{
  297. this.multiPerformDate = true
  298. return
  299. }
  300. let { data,code } = await pagePerformTimeList({
  301. performDate: value[0],
  302. pageNum: 1,
  303. pageSize: 999
  304. })
  305. this.pagePerformTimeList = [].concat(data.rows);
  306. if(data.rows[0]){
  307. this.queryParams.timeId = data.rows[0].id;
  308. this.getList();
  309. }else {
  310. this.loading = false;
  311. }
  312. } catch (error) {
  313. }
  314. },
  315. /** 获取演出厅 */
  316. async merchantTheatreAuditoriumListFun(){
  317. try {
  318. let res = await merchantTheatreAuditoriumList({
  319. pageNum: 1,
  320. pageSize: 999
  321. })
  322. if(res.code == 200){
  323. this.merchantTheatreAuditoriumListS = res.data.rows
  324. if(this.merchantTheatreAuditoriumListS.length>0){
  325. this.$set(this.queryParams,'auditoriumId',this.merchantTheatreAuditoriumListS[0].id)
  326. this.pagePerformTimeListFun(this.selectTime)
  327. }
  328. }
  329. } catch (error) {
  330. }
  331. },
  332. }
  333. };
  334. </script>