| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <style>
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .input-item {
- width: 250px;
- margin: 0 0 20px;
- }
- .input-item .el-input__inner {
- border-right: 0;
- }
- .input-item .el-input__inner:hover{
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input__inner:focus{
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
-
- .input-item .el-input-group__append {
- background-color: #fff;
- border-left: 0;
- width: 10%;
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- margin: 0;
- }
- .table-body .el-button {
- padding: 0!important;
- border: 0;
- margin: 0 5px;
- }
- </style>
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <span>抽奖记录</span>
- </div>
- <div class="table-body">
- <el-form size="small" :inline="true" :model="search">
- <el-form-item>
- <el-select style="width: 100px" @change="scratchSearch()" v-model="search.type">
- <el-option label="全部" value="0"></el-option>
- <el-option :key="index" :label="item" :value="index"
- v-for="(item, index) in types"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <div class="input-item">
- <el-input @keyup.enter.native="scratchSearch()"
- size="small" placeholder="请输入用户名"
- v-model="search.user_id" clearable @clear='scratchSearch()'>
- <el-button slot="append" icon="el-icon-search" @click="scratchSearch()"></el-button>
- </el-input>
- </div>
- </el-form-item>
- <el-form-item>
- <div class="input-item">
- <el-input @keyup.enter.native="scratchSearch()"
- size="small" placeholder="请输入用户手机号/昵称"
- v-model="search.keyword" clearable @clear='scratchSearch()'>
- <el-button slot="append" icon="el-icon-search" @click="scratchSearch()"></el-button>
- </el-input>
- </div>
- </el-form-item>
- </el-form>
- <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
- <el-table-column prop="id" label="ID" width="100"></el-table-column>
- <el-table-column prop="nickname" label="用户">
- <template slot-scope="scope">
- <span v-if="scope.row.user">
- <span v-if="scope.row.user.nickname != ''">{{scope.row.user.nickname}}</span>
- <span v-else>{{scope.row.user.mobile}}</span>
- </span>
- <span v-else>-</span>
- </template>
- </el-table-column>
- <el-table-column prop="type" label="奖品分类" width="100">
- <template slot-scope="scope">
- <span v-if="scope.row.type == 1">
- 红包
- </span>
- <span v-else-if="scope.row.type == 2">
- 余额
- </span>
- <span v-else-if="scope.row.type == 3">
- 优惠券
- </span>
- <span v-else-if="scope.row.type == 4">
- 积分
- </span>
- <span v-else-if="scope.row.type == 5">
- 实物
- </span>
- <span v-else-if="scope.row.type == 6">
- 谢谢参与
- </span>
- </template>
- </el-table-column>
- <el-table-column prop="scratch.name" label="奖品明细" width="350">
- <template slot-scope="scope">
- <samp v-if="scope.row.scratch">
- <span v-if="scope.row.scratch.type == 1">{{ scope.row.scratch.price }}元</span>
- <span v-if="scope.row.scratch.type == 2">{{ scope.row.scratch.balance }}元</span>
- <span v-if="scope.row.scratch.type == 3">{{ scope.row.coupon_data.name}}</span>
- <span v-if="scope.row.scratch.type == 4">{{ scope.row.scratch.num}}积分</span>
- <span v-if="scope.row.scratch.type == 5">{{ scope.row.goods.goods_name }}</span>
- </samp>
- <span v-else>-</span>
- </template>
- </el-table-column>
- <el-table-column prop="status" label="领取状态" width="150">
- <template slot-scope="scope">
- <span v-if="scope.row.status == 0">预领取</span>
- <span v-if="scope.row.status == 1">未领取</span>
- <span v-if="scope.row.status == 2">已领取</span>
- </template>
- </el-table-column>
- <el-table-column prop="created_at" label="抽奖时间" width="250">
- <template slot-scope="scope">
- {{scope.row.created_at | dateTimeFormat("Y-m-d H:i:s")}}
- </template>
- </el-table-column>
- <el-table-column prop="raffled_at" label="领取时间" width="250">
- <template slot-scope="scope">
- <span v-if="scope.row.raffled_at > scope.row.created_at">
- {{scope.row.raffled_at | dateTimeFormat("Y-m-d H:i:s")}}
- </span>
- <span v-else>
- {{scope.row.created_at | dateTimeFormat("Y-m-d H:i:s")}}
- </span>
- </template>
- </el-table-column>
- </el-table>
- <div flex="box:last cross:center">
- <div></div>
- <div>
- <el-pagination
- v-if="list.length > 0"
- style="display: inline-block;float: right;"
- background :page-size="pageSize"
- @current-change="pageChange"
- layout="prev, pager, next" :current-page="current_page"
- :total="pagination.totalCount">
- </el-pagination>
- </div>
- </div>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- pageSize: 10,
- current_page: 1,
- pagination: null,
- types: [],
- search: {
- keyword: '',
- type: '0',
- page: 1,
- user_id:'',
- },
- loading: false,
- list: [],
- };
- },
- methods: {
- //分页
- pageChange(page) {
- this.search.page = page;
- this.getList();
- },
- // 搜索
- scratchSearch() {
- this.getList();
- },
- getList() {
- this.loading = true;
- request({
- params: {
- r: 'scratch/scratch/get-log-list',
- page: this.search.page,
- keyword: this.search.keyword,
- type: this.search.type,
- user_id:this.search.user_id,
- },
- }).then(e => {
- if (e.data.code == 0) {
- this.loading = false;
- this.list = e.data.data.list;
- this.types = e.data.data.types;
- this.pagination = e.data.data.pagination;
- this.pageSize = e.data.data.page_size;
- this.current_page = e.data.data.page;
- }
- }).catch(e => {
- });
- },
- },
- created() {
- this.getList();
- }
- })
- </script>
|