seatInventory.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
  4. <el-form-item label="票务管理:">
  5. <el-select
  6. v-model="queryParams.goodsId"
  7. placeholder="票务管理"
  8. clearable
  9. @change="goodsChangeEven"
  10. style="width: 100%;"
  11. >
  12. <el-option
  13. v-for="dict in ticketList"
  14. :key="dict.id"
  15. :label="dict.goodsName"
  16. :value="dict.goodsId"
  17. />
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="座位类型:">
  21. <el-select
  22. v-model="queryParams.seatTypeId"
  23. placeholder="座位类型"
  24. clearable
  25. style="width: 100%;"
  26. >
  27. <el-option
  28. v-for="dict in seatList"
  29. :key="dict.seatTypeId"
  30. :label="dict.seatTypeName"
  31. :value="dict.seatTypeId"
  32. />
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="场次日期">
  36. <el-date-picker
  37. v-model="queryParams.time"
  38. type="daterange"
  39. value-format="yyyy-MM-dd"
  40. range-separator="至"
  41. start-placeholder="开始日期"
  42. end-placeholder="结束日期">
  43. </el-date-picker>
  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="tableData.length === 0"
  56. v-hasPermi="['statisticalReport:seatInventory: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" prop="performName" />
  68. <el-table-column label="票务名称" align="center" prop="goodsName" />
  69. <el-table-column label="座位类型" align="center" prop="seatTypeName" />
  70. <el-table-column label="场次日期" align="center">
  71. <template slot-scope="scope">
  72. <span>{{ scope.row.performDate }}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="场次" align="center">
  76. <template slot-scope="scope">
  77. <span>{{ scope.row.performTimeStart }} -- {{ scope.row.performTimeEnd }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="总库存" align="center">
  81. <template slot-scope="scope">
  82. <span>{{ scope.row.total }}张</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="已售数量" align="center">
  86. <template slot-scope="scope">
  87. <span>{{ scope.row.saleTotal }}张</span>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="已核销数量" align="center">
  91. <template slot-scope="scope">
  92. <span>{{ scope.row.usedTotal }}张</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="库存数量" align="center">
  96. <template slot-scope="scope">
  97. <span>{{ (scope.row.total - scope.row.saleTotal) >= 0 ? (scope.row.total - scope.row.saleTotal) : '' }}张</span>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <pagination
  102. v-show="total>0"
  103. :total="total"
  104. :page.sync="queryParams.pageNum"
  105. :limit.sync="queryParams.pageSize"
  106. @pagination="getList"
  107. />
  108. </div>
  109. </template>
  110. <script>
  111. import { performTimeCount, downTimeCountListXls } from '@/api/statistics'
  112. import { exportExcel } from '@/utils/exportexcel'
  113. import { seatPricePageList } from '@/api/distribution/ticketMr'
  114. export default {
  115. name: "agreement",
  116. dicts: ['agreement_type'],
  117. data() {
  118. return {
  119. // 遮罩层
  120. loading: true,
  121. // 选中数组
  122. ids: [],
  123. // 非单个禁用
  124. single: true,
  125. // 非多个禁用
  126. multiple: true,
  127. // 显示搜索条件
  128. showSearch: true,
  129. // 总条数
  130. total: 0,
  131. // 用户表格数据
  132. dataList: null,
  133. // 弹出层标题
  134. title: "",
  135. // 是否显示弹出层
  136. open: false,
  137. // 日期范围
  138. dateRange: [],
  139. // 查询参数
  140. queryParams: {
  141. pageNum: 1,
  142. pageSize: 10,
  143. },
  144. visibleStatus: false,
  145. newObj: {},
  146. visibleType: '',
  147. handleExportLoading: false,
  148. tableData: {},
  149. ticketList: [],
  150. seatList: [],
  151. };
  152. },
  153. created() {
  154. this.getList();
  155. this.ticketListApi();
  156. },
  157. methods: {
  158. /** 查询列表 */
  159. getList() {
  160. this.loading = true;
  161. if(this.queryParams.time){
  162. this.queryParams.performStartDate = this.queryParams.time[0];
  163. this.queryParams.performEndDate = this.queryParams.time[1];
  164. }
  165. performTimeCount(this.addDateRange(this.queryParams, this.dateRange))
  166. .then(response => {
  167. this.dataList = response.data.rows;
  168. this.total = response.data.total;
  169. this.loading = false;
  170. }
  171. );
  172. },
  173. /** 票务列表查询 */
  174. ticketListApi() {
  175. this.ticketList = []
  176. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100}))
  177. .then(response => {
  178. let ticketItemList = []
  179. response.data.rows.forEach(item => {
  180. if(ticketItemList.indexOf(item.goodsId) == -1){
  181. this.ticketList.push(item);
  182. ticketItemList.push(item.goodsId);
  183. }
  184. })
  185. });
  186. },
  187. /** 座位类型列表 */
  188. getSeatTypeList(obj) {
  189. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100, goodsId: obj.goodsId}))
  190. .then(response => {
  191. let ticketList = []
  192. response.data.rows.forEach(item => {
  193. if(ticketList.indexOf(item.seatTypeId) == -1){
  194. this.seatList.push(item);
  195. ticketList.push(item.seatTypeId);
  196. }
  197. })
  198. });
  199. },
  200. // 取消按钮
  201. cancel() {
  202. this.open = false;
  203. },
  204. // 票务改变事件
  205. goodsChangeEven() {
  206. this.seatList = [];
  207. this.$set(this.queryParams, 'seatTypeId', '');
  208. let selectMap = {goodsId: this.queryParams.goodsId}
  209. this.getSeatTypeList(selectMap);
  210. },
  211. /** 搜索按钮操作 */
  212. handleQuery() {
  213. this.queryParams.pageNum = 1;
  214. this.getList();
  215. },
  216. /** 重置按钮操作 */
  217. resetQuery() {
  218. this.dateRange = [];
  219. this.seatList = [];
  220. this.$set(this.queryParams, 'time', '');
  221. this.$set(this.queryParams, 'performStartDate', '');
  222. this.$set(this.queryParams, 'performEndDate', '');
  223. this.$set(this.queryParams, 'goodsId', '');
  224. this.$set(this.queryParams, 'seatTypeId', '');
  225. this.queryParams.pageNum = 1;
  226. this.handleQuery();
  227. },
  228. /**
  229. * 导出报表
  230. * @date 2022-10-24
  231. * @returns {any}
  232. */
  233. handleExport() {
  234. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  235. confirmButtonText: '确定 ',
  236. cancelButtonText: '取消 ',
  237. type: 'warning'
  238. })
  239. .then(() => {
  240. this.handleExportLoading = true;
  241. // const { pageNum, pageSize} = this.params;
  242. let postMap = {}
  243. for (let key in this.queryParams) {
  244. if(key != 'pageNum' && key != 'pageSize'){
  245. postMap[key] = this.queryParams[key]
  246. }
  247. }
  248. downTimeCountListXls(postMap)
  249. .then((res) => {
  250. exportExcel(res, '场次统计', '.xlsx');
  251. this.handleExportLoading = false;
  252. })
  253. .catch(() => {
  254. this.handleExportLoading = false;
  255. });
  256. })
  257. .catch(() => {
  258. this.$message.info('您已取消导出!');
  259. });
  260. },
  261. }
  262. };
  263. </script>