| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- @extends('layouts.base')
- @section('title', "三栏广告")
- @section('content')
- <link rel="stylesheet" href="{{resource_get('plugins/pc-terminal/views/admin/index.css')}}">
- <style>
- /* 导航 */
- .el-radio-button .el-radio-button__inner,.el-radio-button:first-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;border-left: 0px;}
- .el-radio-button__inner{border:0;}
- .el-radio-button:last-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;}
- </style>
- <div class="all">
- <div id="app" v-cloak>
- <div class="vue-head">
- <el-radio-group v-model="order_type">
- <el-radio-button label="1" @click.native="gotoOther(1)">幻灯片</el-radio-button>
- <el-radio-button label="2" @click.native="gotoOther(2)">banner图</el-radio-button>
- <el-radio-button label="3" @click.native="gotoOther(3)">三栏广告</el-radio-button>
- <el-radio-button label="4" @click.native="gotoOther(4)">双栏广告</el-radio-button>
- <el-radio-button label="5" @click.native="gotoOther(5)">分类广告</el-radio-button>
- </el-radio-group>
- </div>
- <div class="vue-main">
- <div>
- <div class="vue-main-title" style="margin-bottom:20px">
- <div class="vue-main-title-left"></div>
- <div class="vue-main-title-content" style="flex:0 0 120px">广告列表</div>
- <div class="vue-main-title-button">
- <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">添加广告</el-button>
- </div>
- </div>
- <el-table :data="list" style="width: 100%">
- <el-table-column label="ID" align="center" prop="id" width="100"></el-table-column>
- <el-table-column label="广告名称" align="center" prop="title"></el-table-column>
- <el-table-column label="广告图片" align="center" prop="img_src">
- <template slot-scope="scope">
- <div>
- <div><img :src="scope.row.img_src" alt="" style="width:80px;height: 50px;"></div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="是否显示" align="center" prop="is_show" >
- <template slot-scope="scope">
- <el-switch v-model="scope.row.is_show" :active-value="1" :inactive-value="0" @change="editStatus(scope.row.id,scope.$index)"></el-switch>
- </template>
- </el-table-column>
- <el-table-column prop="refund_time" label="操作" align="center" width="320">
- <template slot-scope="scope">
- <el-link title="编辑广告" :underline="false" @click="gotoDetail(scope.row)" style="width:50px;">
- <i class="iconfont icon-ht_operation_edit"></i>
- </el-link>
- <el-link title="删除广告" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
- <i class="iconfont icon-ht_operation_delete"></i>
- </el-link>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <!-- 分页 -->
- <div class="vue-page" v-if="total>0">
- <el-row>
- <el-col align="right">
- <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
- :page-size="per_page" :current-page="current_page" background
- ></el-pagination>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- <script>
- var app = new Vue({
- el: "#app",
- delimiters: ['[[', ']]'],
- name: 'test',
- data() {
- return {
- order_type:'3',
- list:[],
-
- rules: {},
- current_page:1,
- total:1,
- per_page:1,
- }
- },
- created() {
- },
- mounted() {
- this.getData(1);
- },
- methods: {
- getData(page) {
- let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
- this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.three-advert-list') !!}',{page:page}).then(function(response) {
- if (response.data.result) {
- console.log(response.data.data);
- this.list = response.data.data.data;
- this.current_page=response.data.data.current_page;
- this.total=response.data.data.total;
- this.per_page=response.data.data.per_page;
- loading.close();
- } else {
- this.$message({
- message: response.data.msg,
- type: 'error'
- });
- }
- loading.close();
- }, function(response) {
- this.$message({
- message: response.data.msg,
- type: 'error'
- });
- loading.close();
- });
- },
- gotoDetail(item) {
- let link = `{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.advert-edit') !!}`+`&id=`+item.id;
- window.location.href = link;
- },
-
- search(val) {
- this.getData(val);
- },
-
- addModal() {
- let link = `{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.advert-add',['advert_type'=>2]) !!}`;
- window.location.href = link;
- },
- del(id,index) {
- this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
- let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
- this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.advert-del') !!}',{id:id}).then(function (response) {
- if (response.data.result) {
- this.list.splice(index,1);
- this.$message({type: 'success',message: '删除成功!'});
- }
- else{
- this.$message({type: 'error',message: response.data.msg});
- }
- loading.close();
- this.search(this.current_page)
- },function (response) {
- this.$message({type: 'error',message: response.data.msg});
- loading.close();
- }
- );
- }).catch(() => {
- this.$message({type: 'info',message: '已取消删除'});
- });
- },
-
- gotoOther(type) {
- let url = ""
- if(type==1) {
- url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.slide.slide-list') !!}'
- }
- else if(type==2) {
- url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.banner') !!}'
- }
- else if(type==3) {
- //url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.three-advert-list') !!}'
- }
- else if(type==4) {
- url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.two-advert-list') !!}'
- }
- else if(type==5) {
- url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.category.category-list') !!}'
- }
- if(url) {
- window.location.href=url
- }
- },
- // 字符转义
- escapeHTML(a) {
- a = "" + a;
- return a.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"").replace(/'/g, "'");;
- },
- editStatus(id,index){
- let json = {
- id:id,
- }
- json.status = this.list[index].is_show;
- let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
- this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.edit-advert-status') !!}',json).then(function (response) {
- if (response.data.result){
- this.$message.success("操作成功");
- this.search(this.current_page);
- }
- else {
- this.$message.error( response.data.msg );
- }
- loading.close();
- },function (response) {
- this.$message.error(response.data.msg);
- loading.close();
- }
- );
- },
- },
- })
- </script>
- @endsection
|