123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="subPage">
  3. <div class="system-table-search">
  4. <div class="flex-h">
  5. <div class="flex-item flex-h"></div>
  6. <ul>
  7. <li>
  8. <el-select v-model="postData.caseid" placeholder="请选择案场">
  9. <el-option
  10. v-for="item in cases"
  11. :key="item.CaseId"
  12. :label="item.CaseName"
  13. :value="item.CaseId">
  14. </el-option>
  15. </el-select>
  16. </li>
  17. <li>
  18. <el-select v-model="postData.ctype" placeholder="请选择卡券类型">
  19. <el-option
  20. v-for="item in typeList"
  21. :key="item.id"
  22. :label="item.value"
  23. :value="item.id">
  24. </el-option>
  25. </el-select>
  26. </li>
  27. <li>
  28. <el-input
  29. placeholder="请输入卡券名称"
  30. v-model="postData.name"
  31. clearable>
  32. </el-input>
  33. </li>
  34. </ul>
  35. <el-button
  36. size="mini"
  37. type="primary" @click="search">搜索</el-button>
  38. <el-button
  39. size="mini"
  40. type="success" @click="exportExcel">导出Excel</el-button>
  41. </div>
  42. <div class="moreFilter"></div>
  43. </div>
  44. <div class="system-table-box">
  45. <el-table
  46. :data="cardCouponList"
  47. stripe
  48. style="width: 100%">
  49. <el-table-column
  50. prop="CaseName"
  51. label="所属案场">
  52. </el-table-column>
  53. <el-table-column
  54. prop="CName"
  55. label="卡券名称">
  56. </el-table-column>
  57. <el-table-column
  58. prop="TypeName"
  59. label="卡券类型">
  60. </el-table-column>
  61. <el-table-column
  62. prop="SendType"
  63. label="发送类型">
  64. <template slot-scope="scope">
  65. {{scope.row.SendType === 'case' ? '案场' : scope.row.SendType === 'system' ? '系统' : '渠道'}}
  66. </template>
  67. </el-table-column>
  68. <el-table-column
  69. prop="Price"
  70. label="价格">
  71. </el-table-column>
  72. <el-table-column
  73. prop="SentCount"
  74. label="领取数">
  75. </el-table-column>
  76. <el-table-column
  77. prop="UsedCount"
  78. label="实际使用数">
  79. </el-table-column>
  80. <el-table-column
  81. prop="UsedCount"
  82. label="总费用">
  83. <template slot-scope="scope">
  84. {{(scope.row.Price - 0) * (scope.row.UsedCount - 0)}}
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. </div>
  89. <el-pagination
  90. @current-change="handleCurrentChange"
  91. :current-page.sync="postData.page"
  92. :page-size="postData.pagesize"
  93. layout="prev, pager, next, jumper"
  94. :total="total">
  95. </el-pagination>
  96. </div>
  97. </template>
  98. <script>
  99. import { mapState, createNamespacedHelpers } from 'vuex'
  100. import tableSearch from '@/components/tableSearch/index'
  101. const { mapState: mapStaState, mapActions: mapStaActions } = createNamespacedHelpers('sta')
  102. export default {
  103. name: '',
  104. data () {
  105. return {
  106. total: 0,
  107. postData: { // 表格搜索条件
  108. caseid: '', // 案场id
  109. ctype: '', // 卡券类型
  110. name: '', // 卡券名称
  111. page: 1, // 当前页码
  112. pagesize: 10, // 请求数据量
  113. },
  114. typeList: [{
  115. value: '课程体验卡',
  116. id: 'card'
  117. }, {
  118. value: '商品优惠券',
  119. id: 'goodscoupon'
  120. }, {
  121. value: '课程优惠券',
  122. id: 'coursecoupon'
  123. }],
  124. }
  125. },
  126. computed: {
  127. ...mapState({
  128. cases: x => x.app.cases.list,
  129. defaultCaseId: x => x.app.cases.default
  130. }),
  131. ...mapStaState({
  132. cardCouponList: x => x.cardCoupon.list || [],
  133. }),
  134. CaseId: {
  135. get () {
  136. return this.postData.caseid || this.defaultCaseId
  137. },
  138. set (val) {
  139. this.postData.caseid = val
  140. }
  141. }
  142. },
  143. components: {
  144. tableSearch,
  145. },
  146. mounted () {
  147. this.$nextTick(function () {
  148. this.getList()
  149. })
  150. },
  151. methods: {
  152. ...mapStaActions([
  153. 'getCardCouponList',
  154. 'getCardCouponListExcel',
  155. ]),
  156. search () { // 搜索
  157. this.page = 1
  158. this.getList()
  159. },
  160. handleCurrentChange (val) { // 跳转到分页
  161. this.page = val
  162. this.getList()
  163. },
  164. getList () {
  165. this.getCardCouponList(this.postData).then((res) => {
  166. // console.log(JSON.stringify(res))
  167. this.postData.page = res.page
  168. this.total = res.total
  169. })
  170. },
  171. exportExcel () {
  172. window.location.href = `${this.toolClass.ReplaceOrg(this.$api.statistics.cardCouponListExcel.url)}?token=${localStorage.getItem('JWT')}`
  173. },
  174. }
  175. }
  176. </script>
  177. <!-- Add "scoped" attribute to limit CSS to this component only -->
  178. <style lang="scss" scoped>
  179. @import "page.scss";
  180. </style>