<template> <div class="subPage"> <div class="system-table-search"> <div class="flex-h"> <ul class="searchFilterLine" style="white-space: normal;"> <li> <el-select v-model="postData.caseid" placeholder="请选择案场"> <el-option v-for="item in cases" :key="item.CaseId" :label="item.CaseName" :value="item.CaseId"> </el-option> </el-select> </li> <li> <el-select v-model="postData.receivetype" placeholder="请选择获取方式"> <el-option v-for="item in typeList" :key="item.id" :label="item.value" :value="item.id"> </el-option> </el-select> </li> <li> <el-select v-model="postData.status" placeholder="请选择状态"> <el-option v-for="item in statusList" :key="item.id" :label="item.value" :value="item.id"> </el-option> </el-select> </li> <li> <el-input placeholder="请输入卡券名称" v-model="postData.name" clearable> </el-input> </li> <li> <el-input placeholder="请输入手机号" v-model="postData.tel" clearable> </el-input> </li> <li style="white-space: nowrap;"> <span>有效期:</span> <el-date-picker value-format="yyyy-MM-dd" v-model="postData.begindate" type="date" placeholder="选择起始日期"> </el-date-picker> <span>至</span> <el-date-picker value-format="yyyy-MM-dd" v-model="postData.enddate" type="date" placeholder="选择截止日期"> </el-date-picker> </li> </ul> </div> <div class="flex-h"> <div class="flex-item flex-h"></div> <el-button size="mini" type="primary" @click="search">搜索</el-button> <el-button size="mini" type="success" @click="exportExcel">导出Excel</el-button> </div> <div class="moreFilter"></div> </div> <div class="system-table-box"> <el-table :data="cardCouponUsedList" stripe style="width: 100%"> <el-table-column prop="CaseName" label="所属案场"> </el-table-column> <el-table-column prop="CardCouponName" label="卡券名称"> </el-table-column> <el-table-column prop="TargetName" label="使用商品"> </el-table-column> <el-table-column prop="ReceivingType" label="获取方式"> <template slot-scope="scope"> {{scope.row.ReceivingType === 'event' ? '系统' : scope.row.ReceivingType === 'sales' ? '案场' : scope.row.ReceivingType === 'channel' ? '渠道' : scope.row.ReceivingType === 'give' ? '后台赠送' : ''}} </template> </el-table-column> <el-table-column prop="CustomerName" label="微信昵称"> </el-table-column> <el-table-column prop="Phone" label="手机号"> </el-table-column> <el-table-column prop="SalesName" label="销售"> </el-table-column> <el-table-column prop="EndDate" label="有效期" width="140px"> <template slot-scope="scope"> {{scope.row.EndDate === '0001-01-01T00:00:00Z' ? '-' : toolClass.dateFormat(scope.row.EndDate)}} </template> </el-table-column> <el-table-column prop="ReceiveDate" label="获取时间" width="140px"> <template slot-scope="scope"> {{scope.row.ReceiveDate === '0001-01-01T00:00:00Z' ? '-' : toolClass.dateFormat(scope.row.ReceiveDate)}} </template> </el-table-column> <el-table-column prop="VerifyDate" label="使用时间" width="140px"> <template slot-scope="scope"> {{scope.row.UsedDate === '0001-01-01T00:00:00Z' ? '-' : toolClass.dateFormat(scope.row.UsedDate)}} </template> </el-table-column> <el-table-column prop="VerifyStatus" label="状态"> <template slot-scope="scope"> {{scope.row.VerifyStatus === 'useable' ? '未使用' : scope.row.VerifyStatus === 'used' ? '已使用' : scope.row.VerifyStatus === 'late' ? '逾期核销' : scope.row.VerifyStatus === 'expire' ? '已失效' : ''}} </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="total"> </el-pagination> </div> </template> <script> import { mapState, createNamespacedHelpers } from 'vuex' import tableSearch from '@/components/tableSearch/index' const { mapState: mapStaState, mapActions: mapStaActions } = createNamespacedHelpers('sta') export default { name: '', data () { return { total: 0, postData: { // 表格搜索条件 tel: '', // 手机号 status: '', // 状态 caseid: '', // 案场id receivetype: '', // 获取方式 begindate: '', // 起始日期 enddate: '', // 截止日期 name: '', // 卡券名称 page: 1, // 当前页码 pagesize: 10, // 请求数据量 }, currentList: [], typeList: [{ value: '', id: '' }, { value: '案场', id: 'sales' }, { value: '渠道', id: 'channel' }, { value: '系统', id: 'event' }, { value: '后台赠送', id: 'give' }], statusList: [{ value: '', id: '' }, { value: '未使用', id: 'useable' }, { value: '已使用', id: 'used' }, { value: '已失效', id: 'expire' }], } }, computed: { ...mapState({ cases: x => x.app.cases.list, defaultCaseId: x => x.app.cases.default }), ...mapStaState({ cardCouponUsedList: x => x.cardCouponUsedList.list || [], }), CaseId: { get () { return this.postData.caseid || this.defaultCaseId }, set (val) { this.postData.caseid = val } } }, components: { tableSearch, }, mounted () { this.$nextTick(function () { this.getList() }) }, methods: { ...mapStaActions([ 'getCardCouponUsedList', ]), search () { // 搜索 this.page = 1 this.getList() }, handleCurrentChange (val) { // 跳转到分页 this.page = val this.getList() }, getList () { this.getCardCouponUsedList(this.postData).then((res) => { // console.log(JSON.stringify(res)) this.postData.page = res.page this.total = res.pagenum }) }, exportExcel () { var url = '&tel=' + this.postData.tel + '&status=' + this.postData.status + '&receivetype=' + this.postData.receivetype + '&begindate=' + this.postData.begindate + '&enddate=' + this.postData.enddate + '&name=' + this.postData.name console.log(`${this.toolClass.ReplaceOrg(this.$api.statistics.cardCouponUsedListExcel.url)}?token=${localStorage.getItem('JWT')}&caseid=${this.CaseId === 'all' ? '' : this.CaseId}${url}`) window.location.href = `${this.toolClass.ReplaceOrg(this.$api.statistics.cardCouponUsedListExcel.url)}?token=${localStorage.getItem('JWT')}&caseid=${this.CaseId === 'all' ? '' : this.CaseId}${url}` }, } } </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> @import "page.scss"; .searchFilterLine { > li { margin-bottom: 20px; } } </style>