distributor.vue 12 KB

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