| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- @extends('layouts.base')
- @section('content')
- @section('title', '模板库管理')
- <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}" />
- <div id="app">
- <div class="all">
- <div class="vue-head">
- <div class="vue-main-title">
- <div class="vue-main-title-left"></div>
- <div class="vue-main-title-content">模板库管理</div>
- <div class="vue-main-title-right"><el-button style="margin-top:10px;color: #FFFFFF;background-color: #29ba9c;" @click="addTemp"> <i class="el-icon-plus"></i> 添加新模板</el-button></div>
- </div>
- <el-table :data="tableData" style="width: 100%">
- <el-table-column prop="title" label="模板名称" align="center">
- </el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <i class="el-icon-edit-outline" @click="edit(scope.row.id)" style="font-size:18px;cursor:pointer"></i>
- <i v-if="urls.del_url" class="el-icon-delete-solid" @click="deleteTemp(scope.row.id)" style="font-size:18px;cursor:pointer"></i>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="vue-page" >
- <el-row>
- <el-col align="right">
- <el-pagination layout="prev, pager, next,jumper" @current-change="search1" :total="total" :page-size="per_page" :current-page="current_page" background></el-pagination>
- </el-col>
- </el-row>
- </div>
- </div>
- </div>
- <script language='javascript'>
- //vue
- var app = new Vue({
- el: "#app",
- delimiters: ['[[', ']]'],
- data() {
- return {
- page: 1,
- tableData: [],
- current_page:1,
- total:1,
- per_page:15,
- urls:{},
- }
- },
- computed: {
- },
- mounted() {
- this.getTempList()
- },
- methods: {
- //获取模板列表数据
- getTempList() {
- let url=window.location.href
- this.$http.post(url, {
- page: this.current_page
- }).then(res => {
- if (res.data.result) {
- this.tableData = res.data.data.list.data
- this.current_page = res.data.data.list.current_page
- this.total=res.data.data.list.total
- this.per_page =res.data.data.list.per_page
- this.urls=res.data.data.urls
- } else {
- this.$message.error(res.data.msg);
- }
- })
- },
- //编辑模板
- edit(id) {
- let url=this.urls.edit_url+"&id="+id
- window.location.href = url
- },
- addTemp() {
- let url=this.urls.add_url
- window.location.href = url
- },
- deleteTemp(id) {
- this.$confirm('此操作将永久删除该模板, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let url=this.urls.del_url
- this.$http.post(url+"&id=" + id, {
- id
- }).then(res => {
- if (res.data.result) {
- this.$message.success(res.data.msg);
- this.getTempList()
- } else {
- this.$message.error(res.data.msg);
- }
- })
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- });
- });
- },
- // 搜索
- search1(page){
- this.getTempList(page)
- },
- },
- })
- </script>
- @endsection
|