list.blade.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. @extends('layouts.base')
  2. @section('content')
  3. @section('title', '模板库管理')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}" />
  5. <div id="app">
  6. <div class="all">
  7. <div class="vue-head">
  8. <div class="vue-main-title">
  9. <div class="vue-main-title-left"></div>
  10. <div class="vue-main-title-content">模板库管理</div>
  11. <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>
  12. </div>
  13. <el-table :data="tableData" style="width: 100%">
  14. <el-table-column prop="title" label="模板名称" align="center">
  15. </el-table-column>
  16. <el-table-column label="操作" align="center">
  17. <template slot-scope="scope">
  18. <i class="el-icon-edit-outline" @click="edit(scope.row.id)" style="font-size:18px;cursor:pointer"></i>
  19. <i v-if="urls.del_url" class="el-icon-delete-solid" @click="deleteTemp(scope.row.id)" style="font-size:18px;cursor:pointer"></i>
  20. </template>
  21. </el-table-column>
  22. </el-table>
  23. </div>
  24. <div class="vue-page" >
  25. <el-row>
  26. <el-col align="right">
  27. <el-pagination layout="prev, pager, next,jumper" @current-change="search1" :total="total" :page-size="per_page" :current-page="current_page" background></el-pagination>
  28. </el-col>
  29. </el-row>
  30. </div>
  31. </div>
  32. </div>
  33. <script language='javascript'>
  34. //vue
  35. var app = new Vue({
  36. el: "#app",
  37. delimiters: ['[[', ']]'],
  38. data() {
  39. return {
  40. page: 1,
  41. tableData: [],
  42. current_page:1,
  43. total:1,
  44. per_page:15,
  45. urls:{},
  46. }
  47. },
  48. computed: {
  49. },
  50. mounted() {
  51. this.getTempList()
  52. },
  53. methods: {
  54. //获取模板列表数据
  55. getTempList() {
  56. let url=window.location.href
  57. this.$http.post(url, {
  58. page: this.current_page
  59. }).then(res => {
  60. if (res.data.result) {
  61. this.tableData = res.data.data.list.data
  62. this.current_page = res.data.data.list.current_page
  63. this.total=res.data.data.list.total
  64. this.per_page =res.data.data.list.per_page
  65. this.urls=res.data.data.urls
  66. } else {
  67. this.$message.error(res.data.msg);
  68. }
  69. })
  70. },
  71. //编辑模板
  72. edit(id) {
  73. let url=this.urls.edit_url+"&id="+id
  74. window.location.href = url
  75. },
  76. addTemp() {
  77. let url=this.urls.add_url
  78. window.location.href = url
  79. },
  80. deleteTemp(id) {
  81. this.$confirm('此操作将永久删除该模板, 是否继续?', '提示', {
  82. confirmButtonText: '确定',
  83. cancelButtonText: '取消',
  84. type: 'warning'
  85. }).then(() => {
  86. let url=this.urls.del_url
  87. this.$http.post(url+"&id=" + id, {
  88. id
  89. }).then(res => {
  90. if (res.data.result) {
  91. this.$message.success(res.data.msg);
  92. this.getTempList()
  93. } else {
  94. this.$message.error(res.data.msg);
  95. }
  96. })
  97. }).catch(() => {
  98. this.$message({
  99. type: 'info',
  100. message: '已取消删除'
  101. });
  102. });
  103. },
  104. // 搜索
  105. search1(page){
  106. this.getTempList(page)
  107. },
  108. },
  109. })
  110. </script>
  111. @endsection