index.vue 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="subPage">
  3. <div class="system-table-search">
  4. <div class="flex-h">
  5. <div class="flex-item"></div>
  6. <ul>
  7. <li>
  8. <el-select v-model="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. <!-- <span>VIP卡号:</span> -->
  19. <el-input
  20. placeholder="请输入VIP卡号"
  21. v-model="postData.cardNo"
  22. clearable>
  23. </el-input>
  24. </li>
  25. <li>
  26. <!-- <span>销售:</span> -->
  27. <el-input
  28. placeholder="请输入销售姓名"
  29. v-model="postData.sellerName"
  30. clearable>
  31. </el-input>
  32. </li>
  33. <li>
  34. <!-- <span>用户:</span> -->
  35. <el-input
  36. placeholder="请输入用户姓名"
  37. v-model="postData.userName"
  38. clearable>
  39. </el-input>
  40. </li>
  41. </ul>
  42. <el-button
  43. size="mini"
  44. type="primary" @click="search">搜索</el-button>
  45. </div>
  46. <div class="moreFilter"></div>
  47. <div class="flex-h">
  48. <div class="flex-item flex-h" style="margin-top: 20px;">
  49. <el-button size="mini" type="success" @click='addVIP'>新增VIP</el-button>
  50. <el-button size="mini" type="success" @click='activateVip'>激活VIP</el-button>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="system-table-box">
  55. <el-table
  56. :data="vips.list"
  57. stripe
  58. style="width: 100%">
  59. <el-table-column
  60. prop="VipCardChildCode"
  61. label="卡号">
  62. </el-table-column>
  63. <el-table-column
  64. prop="Amount"
  65. label="价格">
  66. </el-table-column>
  67. <el-table-column
  68. prop="Status"
  69. label="状态">
  70. <template slot-scope="scope">
  71. <span>{{scope.row.Status===1?'已激活':'未激活'}}</span>
  72. </template>
  73. </el-table-column>
  74. <el-table-column
  75. prop="SalesName"
  76. label="销售">
  77. </el-table-column>
  78. <el-table-column
  79. prop="CaseName"
  80. label="案场">
  81. </el-table-column>
  82. <el-table-column
  83. prop="CustomerName"
  84. label="用户">
  85. </el-table-column>
  86. <el-table-column
  87. prop="ActiveDate"
  88. label="激活时间">
  89. <template slot-scope="scope">
  90. <span>{{toolClass.dateFormat(scope.row.ActiveDate, 'yyyy-MM-dd')==='1-01-01'?'':toolClass.dateFormat(scope.row.ActiveDate, 'yyyy-MM-dd hh:mm')}}</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column
  94. prop="CreateDate"
  95. label="创建时间">
  96. <template slot-scope="scope">
  97. <span>{{toolClass.dateFormat(scope.row.CreateDate, 'yyyy-MM-dd hh:mm')}}</span>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. </div>
  102. <el-pagination
  103. @current-change="handleCurrentChange"
  104. :current-page.sync="postData.page"
  105. :page-size="postData.pagesize"
  106. layout="prev, pager, next, jumper"
  107. :total="vips.pagenum">
  108. </el-pagination>
  109. </div>
  110. </template>
  111. <script>
  112. import { createNamespacedHelpers, mapState } from 'vuex'
  113. const { mapState: mapVipState, mapActions: mapVipActions } = createNamespacedHelpers('vip')
  114. export default {
  115. name: '',
  116. data () {
  117. return {
  118. total: 0,
  119. postData: { // 表格搜索条件
  120. caseid: '', // 案场id
  121. page: 1, // 当前页码
  122. pagesize: 10, // 请求数据量
  123. cardNo: '', // vip卡号
  124. sellerName: '', // 销售姓名
  125. userName: '', // 用户名
  126. },
  127. }
  128. },
  129. mounted () {
  130. this.$nextTick(function () {
  131. this.getList()
  132. })
  133. },
  134. computed: {
  135. ...mapVipState({
  136. vips: x => x.vipList,
  137. }),
  138. ...mapState({
  139. cases: x => x.app.cases.list,
  140. defaultCaseId: x => x.app.cases.default
  141. }),
  142. CaseId: {
  143. get () {
  144. return this.postData.caseid || this.defaultCaseId
  145. },
  146. set (val) {
  147. this.postData.caseid = val
  148. }
  149. }
  150. },
  151. methods: {
  152. ...mapVipActions([
  153. 'GetVipList',
  154. ]),
  155. search () { // 搜索
  156. this.postData.page = 1
  157. this.currentList = []
  158. this.getList()
  159. },
  160. getList () { // 获取列表
  161. this.GetVipList({...this.postData, caseid: this.CaseId})
  162. },
  163. handleCurrentChange (val) { // 跳转到分页
  164. this.postData.page = val
  165. this.getList()
  166. },
  167. addVIP () {
  168. this.$router.push({ name: 'editVip' })
  169. },
  170. activateVip () {
  171. this.$router.push({ name: 'activateVip' })
  172. },
  173. }
  174. }
  175. </script>
  176. <!-- Add "scoped" attribute to limit CSS to this component only -->
  177. <style lang="scss" scoped>
  178. @import "page.scss";
  179. </style>