index.vue 5.3KB

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