distridbution.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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. style="width: 230px;"
  7. v-model="selectTime"
  8. type="daterange"
  9. @change="dataChange"
  10. value-format="yyyy-MM-dd"
  11. placeholder="日期">
  12. </el-date-picker>
  13. </el-form-item>
  14. <el-form-item label="分销商类型" label-width="120px">
  15. <el-select
  16. v-model="queryParams.personType"
  17. placeholder="分销商类型"
  18. @change="getList"
  19. clearable
  20. style="width: 140px"
  21. >
  22. <el-option
  23. v-for="dict in dict.type.distribution_type"
  24. :key="dict.value"
  25. :label="dict.label"
  26. :value="dict.value"
  27. />
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  32. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  33. </el-form-item>
  34. </el-form>
  35. <el-row :gutter="10" class="mb8" style="margin-left: 0; margin-top: 10px">
  36. <el-button
  37. type="primary"
  38. size="mini"
  39. icon="el-icon-download"
  40. :disabled="dataList.length === 0"
  41. v-hasPermi="['session:session:downloadExcel']"
  42. @click="handleExport"
  43. v-loading.fullscreen.lock="handleExportLoading"
  44. element-loading-text="正在拼命生成数据中..."
  45. element-loading-spinner="el-icon-loading"
  46. element-loading-background="rgba(0, 0, 0, 0.5)"
  47. >导出excel</el-button>
  48. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  49. </el-row>
  50. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  51. <el-table-column label="序号" align="center" type="index" width="60"></el-table-column>
  52. <!-- <el-table-column label="剧目名称" align="center" prop="performName" />
  53. <el-table-column label="票务名称" align="center" prop="goodsName" /> -->
  54. <el-table-column label="分销商类型" align="center">
  55. <template slot-scope="scope">
  56. <span>{{ scope.row.personType }}</span>
  57. </template>
  58. </el-table-column>
  59. <el-table-column label="分销商名称" align="center">
  60. <template slot-scope="scope">
  61. <span>{{ scope.row.personName }}</span>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="票种(元)" align="center">
  65. </el-table-column>
  66. <el-table-column label="结算价(元)" align="center">
  67. <template slot-scope="scope">
  68. <span>{{ scope.row.settlementAmount }}</span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="人次" align="center">
  72. <template slot-scope="scope">
  73. <span>{{ scope.row.personNext }}</span>
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="收入" align="center">
  77. <template slot-scope="scope">
  78. <span>{{ scope.row.salePriceAmount }}</span>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="收入占比" align="center">
  82. <template slot-scope="scope">
  83. <span>{{ scope.row.incomeRatio?scope.row.incomeRatio+'%' : '-' }}</span>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="备注" align="center">
  87. <template slot-scope="scope">
  88. <span>{{ scope.row.remark }}</span>
  89. </template>
  90. </el-table-column>
  91. </el-table>
  92. <ul class="total-remark" v-if="responseData.saleTotalRemarkOnColor">
  93. <li><span class="til">合计:</span><div class="html-wap" v-html="responseData.saleTotalRemarkOnColor||'-'"></div> </li>
  94. </ul>
  95. <!-- <pagination
  96. v-show="total>0"
  97. :total="total"
  98. :page.sync="queryParams.pageNum"
  99. :limit.sync="queryParams.pageSize"
  100. @pagination="getList"
  101. /> -->
  102. </div>
  103. </template>
  104. <script>
  105. import { marketPersonSaleCount, downMarketPersonSaleCount } from '@/api/statisticalReport/statistics'
  106. import { exportExcel } from '@/utils/exportexcel'
  107. import { seatPricePageList } from '@/api/distribution/ticketMr'
  108. import moment from "moment"
  109. export default {
  110. name: "",
  111. dicts: ['distribution_type'],
  112. data() {
  113. return {
  114. // 遮罩层
  115. loading: true,
  116. // 选中数组
  117. ids: [],
  118. // 非单个禁用
  119. single: true,
  120. // 非多个禁用
  121. multiple: true,
  122. // 显示搜索条件
  123. showSearch: true,
  124. // 总条数
  125. total: 0,
  126. // 用户表格数据
  127. dataList: [],
  128. // 弹出层标题
  129. title: "",
  130. // 是否显示弹出层
  131. open: false,
  132. // 日期范围
  133. dateRange: [],
  134. // 查询参数
  135. queryParams: {
  136. // pageNum: 1,
  137. // pageSize: 10,
  138. },
  139. visibleStatus: false,
  140. newObj: {},
  141. visibleType: '',
  142. handleExportLoading: false,
  143. tableData: {},
  144. ticketList: [],
  145. seatList: [],
  146. selectTime:'',
  147. responseData:{},
  148. };
  149. },
  150. created() {
  151. this.$set(this,'selectTime',[moment().format("yyyy-MM-DD"),moment().format("yyyy-MM-DD")]);
  152. this.getList();
  153. this.ticketListApi();
  154. },
  155. methods: {
  156. /** 查询列表 */
  157. getList() {
  158. this.loading = true;
  159. if(this.selectTime){
  160. this.queryParams.beginDate = this.selectTime[0];
  161. this.queryParams.endDate = this.selectTime[1];
  162. }
  163. marketPersonSaleCount(this.addDateRange(this.queryParams, this.dateRange))
  164. .then(response => {
  165. this.responseData = response.data;
  166. this.dataList = response.data.dataList||[];
  167. this.total = response.data.total;
  168. this.loading = false;
  169. }
  170. );
  171. },
  172. dataChange(data) {
  173. this.getList()
  174. },
  175. /** 票务列表查询 */
  176. ticketListApi() {
  177. this.ticketList = []
  178. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100}))
  179. .then(response => {
  180. let ticketItemList = []
  181. response.data.rows.forEach(item => {
  182. if(ticketItemList.indexOf(item.goodsId) == -1){
  183. this.ticketList.push(item);
  184. ticketItemList.push(item.goodsId);
  185. }
  186. })
  187. });
  188. },
  189. /** 座位类型列表 */
  190. getSeatTypeList(obj) {
  191. seatPricePageList(this.addDateRange({pageNum: 1, pageSize: 100, goodsId: obj.goodsId}))
  192. .then(response => {
  193. let ticketList = []
  194. response.data.rows.forEach(item => {
  195. if(ticketList.indexOf(item.seatTypeId) == -1){
  196. this.seatList.push(item);
  197. ticketList.push(item.seatTypeId);
  198. }
  199. })
  200. });
  201. },
  202. // 取消按钮
  203. cancel() {
  204. this.open = false;
  205. },
  206. // 票务改变事件
  207. goodsChangeEven() {
  208. this.seatList = [];
  209. this.$set(this.queryParams, 'seatTypeId', '');
  210. let selectMap = {goodsId: this.queryParams.goodsId}
  211. this.getSeatTypeList(selectMap);
  212. },
  213. /** 搜索按钮操作 */
  214. handleQuery() {
  215. // this.queryParams.pageNum = 1;
  216. this.getList();
  217. },
  218. /** 重置按钮操作 */
  219. resetQuery() {
  220. this.dateRange = [];
  221. this.seatList = [];
  222. this.$set(this.queryParams, 'time', '');
  223. this.$set(this.queryParams, 'performStartDate', '');
  224. this.$set(this.queryParams, 'performEndDate', '');
  225. this.$set(this.queryParams, 'goodsId', '');
  226. this.$set(this.queryParams, 'seatTypeId', '');
  227. this.$set(this.queryParams, 'personType', '');
  228. // this.queryParams.pageNum = 1;
  229. this.$set(this,'selectTime',[moment().format("yyyy-MM-DD"),moment().format("yyyy-MM-DD")]);
  230. this.handleQuery();
  231. },
  232. /**
  233. * 导出报表
  234. * @date 2022-10-24
  235. * @returns {any}
  236. */
  237. handleExport() {
  238. this.$confirm('您确定要导出当前查询的数据吗?', '提示', {
  239. confirmButtonText: '确定 ',
  240. cancelButtonText: '取消 ',
  241. type: 'warning'
  242. })
  243. .then(() => {
  244. this.handleExportLoading = true;
  245. // const { pageNum, pageSize} = this.params;
  246. let postMap = {}
  247. for (let key in this.queryParams) {
  248. if(key != 'pageNum' && key != 'pageSize'){
  249. postMap[key] = this.queryParams[key]
  250. }
  251. }
  252. downMarketPersonSaleCount(postMap)
  253. .then((res) => {
  254. exportExcel(res, '分销明细', '.xlsx');
  255. this.handleExportLoading = false;
  256. })
  257. .catch(() => {
  258. this.handleExportLoading = false;
  259. });
  260. })
  261. .catch(() => {
  262. this.$message.info('您已取消导出!');
  263. });
  264. },
  265. }
  266. };
  267. </script>
  268. <style lang="scss" scoped>
  269. .total-remark{
  270. margin-top: 24px;
  271. margin-bottom: 24px;
  272. padding-left: 0;
  273. li{
  274. list-style: none;
  275. display: flex;
  276. ::v-deep .html-wap{
  277. span{
  278. color: blue;
  279. margin: 0 5px;
  280. display: inline-block;
  281. }
  282. }
  283. }
  284. .til{
  285. font-weight: bold;
  286. color: #333;
  287. }
  288. }
  289. </style>