<template> <div class="subPage"> <div class="system-table-search"> <div class="flex-h"> <div class="flex-item"></div> <ul> <li> <el-select v-model="CaseId" placeholder="请选择"> <el-option v-for="item in cases" :key="item.CaseId" :label="item.CaseName" :value="item.CaseId"> </el-option> </el-select> </li> <li> <!-- <span>VIP卡号:</span> --> <el-input placeholder="请输入VIP卡号" v-model="postData.cardNo" clearable> </el-input> </li> <li> <!-- <span>销售:</span> --> <el-input placeholder="请输入销售姓名" v-model="postData.sellerName" clearable> </el-input> </li> <li> <!-- <span>用户:</span> --> <el-input placeholder="请输入用户姓名" v-model="postData.userName" clearable> </el-input> </li> </ul> <el-button size="mini" type="primary" @click="search">搜索</el-button> </div> <div class="moreFilter"></div> <div class="flex-h"> <div class="flex-item flex-h" style="margin-top: 20px;"> <el-button size="mini" type="success" @click='addVIP'>新增VIP</el-button> <el-button size="mini" type="success" @click='activateVip'>激活VIP</el-button> </div> </div> </div> <div class="system-table-box"> <el-table :data="vips.list" stripe style="width: 100%"> <el-table-column prop="VipCardChildCode" label="卡号"> </el-table-column> <el-table-column prop="Amount" label="价格"> </el-table-column> <el-table-column prop="Status" label="状态"> <template slot-scope="scope"> <span>{{scope.row.Status===1?'已激活':'未激活'}}</span> </template> </el-table-column> <el-table-column prop="SalesName" label="销售"> </el-table-column> <el-table-column prop="CaseName" label="案场"> </el-table-column> <el-table-column prop="CustomerName" label="用户"> </el-table-column> <el-table-column prop="ActiveDate" label="激活时间"> <template slot-scope="scope"> <span>{{toolClass.dateFormat(scope.row.ActiveDate, 'yyyy-MM-dd')==='1-01-01'?'':toolClass.dateFormat(scope.row.ActiveDate, 'yyyy-MM-dd hh:mm')}}</span> </template> </el-table-column> <el-table-column prop="CreateDate" label="创建时间"> <template slot-scope="scope"> <span>{{toolClass.dateFormat(scope.row.CreateDate, 'yyyy-MM-dd hh:mm')}}</span> </template> </el-table-column> </el-table> </div> <el-pagination @current-change="handleCurrentChange" :current-page.sync="postData.page" :page-size="postData.pagesize" layout="prev, pager, next, jumper" :total="vips.pagenum"> </el-pagination> </div> </template> <script> import { createNamespacedHelpers, mapState } from 'vuex' const { mapState: mapVipState, mapActions: mapVipActions } = createNamespacedHelpers('vip') export default { name: '', data () { return { total: 0, postData: { // 表格搜索条件 caseid: '', // 案场id page: 1, // 当前页码 pagesize: 10, // 请求数据量 cardNo: '', // vip卡号 sellerName: '', // 销售姓名 userName: '', // 用户名 }, } }, mounted () { this.$nextTick(function () { this.getList() }) }, computed: { ...mapVipState({ vips: x => x.vipList, }), ...mapState({ cases: x => x.app.cases.list, defaultCaseId: x => x.app.cases.default }), CaseId: { get () { return this.postData.caseid || this.defaultCaseId }, set (val) { this.postData.caseid = val } } }, methods: { ...mapVipActions([ 'GetVipList', ]), search () { // 搜索 this.postData.page = 1 this.currentList = [] this.getList() }, getList () { // 获取列表 this.GetVipList({...this.postData, caseid: this.CaseId}) }, handleCurrentChange (val) { // 跳转到分页 this.postData.page = val this.getList() }, addVIP () { this.$router.push({ name: 'editVip' }) }, activateVip () { this.$router.push({ name: 'activateVip' }) }, } } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> @import "page.scss"; </style>