index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div class="course-red-packet-statistics">
  3. <!-- 查询条件 -->
  4. <el-card class="search-card">
  5. <el-form :model="queryForm" ref="queryForm" label-width="80px" inline>
  6. <el-row :gutter="20">
  7. <el-col :span="6">
  8. <el-form-item label="公司名" prop="companyId">
  9. <el-select filterable style="width: 220px" v-model="queryForm.companyId" @change="handleSeller" placeholder="请选择公司名" clearable size="small">
  10. <el-option
  11. v-for="item in companys"
  12. :key="item.companyId"
  13. :label="item.companyName"
  14. :value="item.companyId"
  15. />
  16. </el-select>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="6">
  20. <el-form-item label="员工" prop="nickName" v-if="queryForm.companyId">
  21. <el-select v-model="queryForm.companyUserId" remote placeholder="请选择" filterable clearable style="width: 100%;" @keyup.enter.native="handleQuery">
  22. <el-option
  23. v-for="dict in companyUserList"
  24. :key="dict.userId"
  25. :label="`${dict.nickName}`"
  26. :value="dict.userId">
  27. </el-option>
  28. </el-select>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="6">
  32. <el-form-item label="创建时间" prop="createTime">
  33. <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" @change="change"></el-date-picker>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="6">
  37. <el-form-item label="状态" prop="status">
  38. <el-select v-model="queryForm.status" placeholder="请选择状态" clearable style="width: 100%">
  39. <el-option label="全部" value=""></el-option>
  40. <el-option label="发送中" value="0"></el-option>
  41. <el-option label="已发送" value="1"></el-option>
  42. </el-select>
  43. </el-form-item>
  44. </el-col>
  45. </el-row>
  46. <el-row>
  47. <el-col :span="24" class="text-right">
  48. <el-button type="primary" @click="handleSearch">查询</el-button>
  49. <el-button @click="resetQuery">重置</el-button>
  50. </el-col>
  51. </el-row>
  52. </el-form>
  53. </el-card>
  54. <!-- 统计结果 -->
  55. <el-card class="result-card">
  56. <div slot="header">
  57. <span>红包发送统计</span>
  58. </div>
  59. <el-table :data="statisticsData" border style="width: 100%" v-loading="loading">
  60. <el-table-column prop="companyName" label="公司名称" align="center"></el-table-column>
  61. <el-table-column prop="nickName" label="员工姓名" align="center"></el-table-column>
  62. <el-table-column prop="companyUserId" label="员工编号" align="center"></el-table-column>
  63. <el-table-column prop="redPacketNum" label="红包数" align="center"></el-table-column>
  64. <el-table-column prop="redPacketTotalMoney" label="总金额(元)" align="center">
  65. <template slot-scope="scope">
  66. {{ scope.row.redPacketTotalMoney.toFixed(2) }}
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. <div class="pagination-container">
  71. <el-pagination
  72. @size-change="handleSizeChange"
  73. @current-change="handleCurrentChange"
  74. :current-page="pageInfo.currentPage"
  75. :page-sizes="[10, 20, 50, 100]"
  76. :page-size="pageInfo.pageSize"
  77. layout="total, sizes, prev, pager, next, jumper"
  78. :total="pageInfo.total">
  79. </el-pagination>
  80. </div>
  81. </el-card>
  82. </div>
  83. </template>
  84. <script>
  85. import {getCompanyList} from "@/api/company/company";
  86. import {getUserList} from "@/api/company/companyUser";
  87. import {list} from "@/api/course/courseRedPacketStatistics";
  88. export default {
  89. name: 'CourseRedPacketStatistics',
  90. data() {
  91. return {
  92. companys:[],
  93. companyUserList:[],
  94. createTime: [],
  95. queryForm: {
  96. companyId: '',
  97. companyUserId: '',
  98. startTime:null,
  99. endTime:null,
  100. status: ''
  101. },
  102. statisticsData: [],
  103. loading: false,
  104. pageInfo: {
  105. currentPage: 1,
  106. pageSize: 10,
  107. total: 0
  108. }
  109. }
  110. },
  111. mounted() {
  112. this.getList()
  113. },
  114. created() {
  115. getCompanyList().then(response => {
  116. this.companys = response.data;
  117. if(this.companys!=null&&this.companys.length>0){
  118. this.companyId=this.companys[0].companyId;
  119. }
  120. });
  121. },
  122. methods: {
  123. handleSearch() {
  124. this.pageInfo.currentPage = 1
  125. this.getList();
  126. },
  127. change() {
  128. if (this.createTime) {
  129. this.queryForm.startTime = this.createTime[0];
  130. this.queryForm.endTime = this.createTime[1];
  131. } else {
  132. this.queryForm.startTime = null;
  133. this.queryForm.endTime = null;
  134. }
  135. },
  136. handleSeller(){
  137. console.log(this.queryForm.companyId)
  138. if(this.queryForm.companyId != null) {
  139. getUserList(this.queryForm.companyId).then(res=>{
  140. if(res.code === 200) {
  141. this.companyUserList = res.data
  142. }
  143. })
  144. }
  145. },
  146. resetQuery() {
  147. this.$refs.queryForm.resetFields()
  148. this.queryForm.dateRange = []
  149. this.handleSearch()
  150. },
  151. getList() {
  152. this.loading = true
  153. // 查询统计
  154. list(this.queryForm).then(response => {
  155. this.statisticsData = response.data.list;
  156. this.pageInfo.total = response.data.total;
  157. this.loading = false;
  158. });
  159. },
  160. handleSizeChange(val) {
  161. this.pageInfo.pageSize = val
  162. this.pageInfo.currentPage = 1
  163. this.getList()
  164. },
  165. handleCurrentChange(val) {
  166. this.pageInfo.currentPage = val
  167. this.getList()
  168. }
  169. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .course-red-packet-statistics {
  174. padding: 20px;
  175. .search-card {
  176. margin-bottom: 20px;
  177. }
  178. .result-card {
  179. .pagination-container {
  180. margin-top: 20px;
  181. text-align: right;
  182. }
  183. }
  184. .text-right {
  185. text-align: right;
  186. }
  187. }
  188. </style>