index.vue 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div class="subPage">
  3. <div class="system-table-search">
  4. <div class="flex-h">
  5. <ul class="searchFilterLine" style="white-space: normal;">
  6. <li>
  7. <el-select v-model="postData.caseid" placeholder="请选择案场">
  8. <el-option
  9. v-for="item in cases"
  10. :key="item.CaseId"
  11. :label="item.CaseName"
  12. :value="item.CaseId">
  13. </el-option>
  14. </el-select>
  15. </li>
  16. <li>
  17. <el-input
  18. placeholder="请输入课程活动名称"
  19. v-model="postData.name"
  20. clearable>
  21. </el-input>
  22. </li>
  23. <li>
  24. <el-input
  25. placeholder="请输入手机号"
  26. v-model="postData.tel"
  27. clearable>
  28. </el-input>
  29. </li>
  30. <li>
  31. <el-select v-model="postData.status" placeholder="请选择状态">
  32. <el-option
  33. v-for="item in statusList"
  34. :key="item.id"
  35. :label="item.value"
  36. :value="item.id">
  37. </el-option>
  38. </el-select>
  39. </li>
  40. </ul>
  41. </div>
  42. <div class="flex-h">
  43. <div class="flex-item flex-h"></div>
  44. <el-button
  45. size="mini"
  46. type="primary" @click="search">搜索</el-button>
  47. <el-button
  48. size="mini"
  49. type="success" @click="exportExcel">导出Excel</el-button>
  50. </div>
  51. <div class="moreFilter"></div>
  52. </div>
  53. <div class="system-table-box">
  54. <el-table
  55. :data="courseVerifyList"
  56. stripe
  57. style="width: 100%">
  58. <el-table-column
  59. prop="CaseName"
  60. label="所属案场">
  61. </el-table-column>
  62. <el-table-column
  63. prop="CourseName"
  64. label="课程名称">
  65. </el-table-column>
  66. <el-table-column
  67. prop="BeginDate"
  68. label="课程时间"
  69. width="140px">
  70. <template slot-scope="scope">
  71. {{toolClass.dateFormat(scope.row.BeginDate)}}<br>
  72. -<br>
  73. {{toolClass.dateFormat(scope.row.EndDate)}}
  74. </template>
  75. </el-table-column>
  76. <el-table-column
  77. prop="CustomerName"
  78. label="用户姓名">
  79. </el-table-column>
  80. <el-table-column
  81. prop="Name"
  82. label="微信昵称">
  83. </el-table-column>
  84. <el-table-column
  85. prop="Phone"
  86. label="手机号">
  87. </el-table-column>
  88. <el-table-column
  89. prop="CreateDate"
  90. label="下单时间"
  91. width="140px">
  92. <template slot-scope="scope">
  93. {{toolClass.dateFormat(scope.row.CreateDate)}}
  94. </template>
  95. </el-table-column>
  96. <el-table-column
  97. prop="VerifyDate"
  98. label="核销时间"
  99. width="140px">
  100. <template slot-scope="scope">
  101. {{toolClass.dateFormat(scope.row.VerifyDate)}}
  102. </template>
  103. </el-table-column>
  104. <el-table-column
  105. prop="Status"
  106. label="状态">
  107. <template slot-scope="scope">
  108. {{scope.row.Status === 'useable' ? '未使用' : scope.row.Status === 'used' ? '已使用' : scope.row.Status === 'late' ? '逾期核销' : ''}}
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. </div>
  113. <el-pagination
  114. @current-change="handleCurrentChange"
  115. :current-page.sync="postData.page"
  116. :page-size="postData.pagesize"
  117. layout="prev, pager, next, jumper"
  118. :total="total">
  119. </el-pagination>
  120. </div>
  121. </template>
  122. <script>
  123. import { mapState, createNamespacedHelpers } from 'vuex'
  124. import tableSearch from '@/components/tableSearch/index'
  125. const { mapState: mapStaState, mapActions: mapStaActions } = createNamespacedHelpers('sta')
  126. export default {
  127. name: '',
  128. data () {
  129. return {
  130. total: 0,
  131. postData: { // 表格搜索条件
  132. caseid: '', // 案场id
  133. tel: '', // 手机号
  134. status: '', // 状态
  135. name: '', // 卡券名称
  136. page: 1, // 当前页码
  137. pagesize: 10, // 请求数据量
  138. },
  139. statusList: [{
  140. value: '',
  141. id: ''
  142. }, {
  143. value: '未使用',
  144. id: 'useable'
  145. }, {
  146. value: '已使用',
  147. id: 'used'
  148. }, {
  149. value: '逾期核销',
  150. id: 'late'
  151. }],
  152. }
  153. },
  154. computed: {
  155. ...mapState({
  156. cases: x => x.app.cases.list,
  157. defaultCaseId: x => x.app.cases.default
  158. }),
  159. ...mapStaState({
  160. courseVerifyList: x => x.courseVerifyList.list || [],
  161. }),
  162. CaseId: {
  163. get () {
  164. return this.postData.caseid || this.defaultCaseId
  165. },
  166. set (val) {
  167. this.postData.caseid = val
  168. }
  169. }
  170. },
  171. components: {
  172. tableSearch,
  173. },
  174. mounted () {
  175. this.$nextTick(function () {
  176. this.getList()
  177. })
  178. },
  179. methods: {
  180. ...mapStaActions([
  181. 'getCourseVerifyList',
  182. ]),
  183. search () { // 搜索
  184. this.page = 1
  185. this.getList()
  186. },
  187. handleCurrentChange (val) { // 跳转到分页
  188. this.page = val
  189. this.getList()
  190. },
  191. getList () {
  192. this.getCourseVerifyList(this.postData).then((res) => {
  193. // console.log(JSON.stringify(res))
  194. this.postData.page = res.page
  195. this.total = res.total
  196. })
  197. },
  198. exportExcel () {
  199. window.location.href = `${this.toolClass.ReplaceOrg(this.$api.statistics.courseVerifyListExcel.url)}?token=${localStorage.getItem('JWT')}`
  200. },
  201. }
  202. }
  203. </script>
  204. <!-- Add "scoped" attribute to limit CSS to this component only -->
  205. <style lang="scss" scoped>
  206. @import "page.scss";
  207. .searchFilterLine {
  208. > li {
  209. margin-bottom: 20px;
  210. }
  211. }
  212. </style>