| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- @extends('layouts.base')
- @section('title', "轮播图管理")
- @section('content')
- <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
- <style>
- .vue-main-title-button{flex:1;}
- </style>
- <div class="all">
- <div id="app" v-cloak>
- <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="sequence"></el-table-column>
- <el-table-column label="轮播图名称" align="center" prop="name"></el-table-column>
- <el-table-column label="轮播图片" align="center" prop="name">
- <template slot-scope="scope">
- <div>
- <img :src="scope.row.img" alt="" style="width:50px;height:50px">
- </div>
- </template>
- </el-table-column>
- <el-table-column label="是否显示" align="center" prop="id" >
- <template slot-scope="scope">
- <div>
- <el-switch v-model="scope.row.is_show" :active-value="1" :inactive-value="0" @change="changeStatus(scope.row.id)"></el-switch>
- </div>
- </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:'4',
- 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.circle.admin.banner.get-list') !!}',{page:page}).then(function(response) {
- if (response.data.result) {
- 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.circle.admin.banner.edit') !!}`+`&id=`+item.id;
- window.location.href = link;
- },
-
- search(val) {
- this.getData(val);
- },
-
- addModal() {
- let link = `{!! yzWebFullUrl('plugin.circle.admin.banner.edit') !!}`;
- window.location.href = link;
- },
- del(id,index) {
- console.log(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.circle.admin.banner.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: '已取消删除'});
- });
- },
-
- // 快速修改
- changeStatus(id) {
- let that = this;
- let json = {id: id};
- let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
- that.$http.post("{!! yzWebFullUrl('plugin.circle.admin.banner.isShow') !!}", json).then(response => {
- if (response.data.result == 1) {
- that.$message.success('操作成功!');
- } else {
- that.$message.error(response.data.msg);
- }
- that.search(this.current_page);
- loading.close();
- }), function (res) {
- console.log(res);
- loading.close();
- };
- },
-
- },
- })
- </script>
- @endsection
|