| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <?php
- /*
- * @Descripttion:
- * @copyright: Copyright (c) 2021 广东七件事集团
- * @Author: lun
- * @Date: 2021-12-28 23:01:04
- */
- ?>
- <style>
- .link_url {
- text-align: left;
- font-size: 14px;
- }
- .showqr .el-dialog__body {
- text-align: center;
- padding-bottom: 10px;
- }
- .el-dialog {
- min-width: 400px;
- }
- </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 style="float: right;margin-top: -5px">
- <el-button type="primary"
- @click="$navigate({r: 'rebate/ad/edit'})"
- size="small">添加广告
- </el-button>
- </div>
- </div>
- <div class="table-body">
- <el-tabs>
- <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
- <el-table-column prop="id" min-width="30" label="序号" align="center"></el-table-column>
- <el-table-column prop="title" label="标题" min-width="100" align="center"></el-table-column>
- <el-table-column label="轮播图" align="center">
- <template slot-scope="scope">
- <el-image style="height: 50px;border-radius: 5px;" fit="contain" :src="scope.row.cover"></el-image>
- </template>
- </el-table-column>
- <el-table-column prop="sort" label="排序" min-width="30" align="center"></el-table-column>
- <el-table-column prop="created_at" label="创建时间" min-width="50" align="center">
- <template slot-scope="scope">
- {{ scope.row.created_at | dateTimeFormat('Y-m-d H:i') }}
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <el-button type="text" @click="handle('edit',scope.row)">编辑</el-button>
- <el-button type="text" @click="handle('destroy',scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-tabs>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data: {
- loading: false,
- list: [],
- },
- mounted() {
- this.getList();
- },
- methods: {
- handle(type, data = null) {
- let id = data ? parseInt(data.id) : '';
- switch (type) {
- case 'edit':
- let params = {
- r: 'rebate/ad/edit'
- };
- if (id) params = Object.assign(params, {
- id: id
- });
- navigateTo(params);
- break;
- case 'destroy':
- param = {id: data.id,status: -1};
- this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send('rebate/ad/handle',param)})
- break;
- }
- },
- send(url, params, callback = null) {
- let self = this;
- request({
- params: {
- r: url,
- },
- method: 'post',
- data: params
- }).then(e => {
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.getList();
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- if(callback) return e.data;
- },
- getList(search = {}) {
- let self = this;
- self.loading = true;
- let basic_params = {
- page: self.page,
- };
- params = Object.assign(basic_params, search);
- request({
- params: {
- r: 'rebate/ad/index'
- },
- method: 'post',
- data: params
- }).then(e => {
- this.loading = false;
- if (e.data.code == 0) {
- self.list = e.data.data;
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.loading = false;
- });
- },
- }
- });
- </script>
- <style>
- .el-tabs__header {
- font-size: 16px;
- }
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .table-body .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .input-item {
- width: 250px;
- margin: 0 0 20px;
- display: inline-block;
- }
- .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;
- }
- .batch {
- margin: 0 0 20px;
- display: inline-block;
- }
- .batch .el-button {
- padding: 9px 15px !important;
- }
-
- .el-table th>.cell{
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper, .el-table__header-wrapper{
- border-bottom: 1.4px solid #D6D6D6;
- }
- </style>
|