category.blade.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. @extends('layouts.base')
  2. @section('title', "圈子分类")
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
  5. <style>
  6. .vue-main-title-button{flex:1;}
  7. </style>
  8. <div class="all">
  9. <div id="app" v-cloak>
  10. <div class="vue-main">
  11. <div>
  12. <div class="vue-main-title" style="margin-bottom:20px">
  13. <div class="vue-main-title-left"></div>
  14. <div class="vue-main-title-content" style="flex:0 0 120px">圈子分类</div>
  15. <div class="vue-main-title-button" >
  16. <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">新增分类</el-button>
  17. </div>
  18. </div>
  19. <el-table :data="list" style="width: 100%">
  20. <el-table-column label="ID" align="center" prop="id" width="100"></el-table-column>
  21. <el-table-column label="排序" align="center" prop="sequence"></el-table-column>
  22. <el-table-column label="分类名称" align="center" prop="name"></el-table-column>
  23. <el-table-column label="是否显示" align="center" prop="id" >
  24. <template slot-scope="scope">
  25. <div>
  26. <el-switch v-model="scope.row.is_show" :active-value="1" :inactive-value="0" @change="changeStatus(scope.row.id)"></el-switch>
  27. </div>
  28. </template>
  29. </el-table-column>
  30. <el-table-column prop="refund_time" label="操作" align="center" width="320">
  31. <template slot-scope="scope">
  32. <el-link title="编辑分类" :underline="false" @click="gotoDetail(scope.row)" style="width:50px;">
  33. <i class="iconfont icon-ht_operation_edit"></i>
  34. </el-link>
  35. <el-link title="删除分类" :underline="false" @click="del(scope.row.id)" style="width:50px;">
  36. <i class="iconfont icon-ht_operation_delete"></i>
  37. </el-link>
  38. </template>
  39. </el-table-column>
  40. </el-table>
  41. </div>
  42. </div>
  43. <!-- 分页 -->
  44. <div class="vue-page" v-if="total>0">
  45. <el-row>
  46. <el-col align="right">
  47. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  48. :page-size="per_page" :current-page="current_page" background
  49. ></el-pagination>
  50. </el-col>
  51. </el-row>
  52. </div>
  53. </div>
  54. </div>
  55. <script>
  56. var app = new Vue({
  57. el: "#app",
  58. delimiters: ['[[', ']]'],
  59. name: 'test',
  60. data() {
  61. return {
  62. list:[],
  63. rules: {},
  64. current_page:1,
  65. total:1,
  66. per_page:1,
  67. }
  68. },
  69. created() {
  70. },
  71. mounted() {
  72. this.getData(1);
  73. },
  74. methods: {
  75. getData(page) {
  76. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  77. this.$http.post('{!! yzWebFullUrl('plugin.circle.admin.category.get-list') !!}',{page:page}).then(function(response) {
  78. if (response.data.result) {
  79. this.list = response.data.data.data;
  80. this.current_page=response.data.data.current_page;
  81. this.total=response.data.data.total;
  82. this.per_page=response.data.data.per_page;
  83. loading.close();
  84. } else {
  85. this.$message({
  86. message: response.data.msg,
  87. type: 'error'
  88. });
  89. }
  90. loading.close();
  91. }, function(response) {
  92. this.$message({
  93. message: response.data.msg,
  94. type: 'error'
  95. });
  96. loading.close();
  97. });
  98. },
  99. gotoDetail(item) {
  100. let link = `{!! yzWebFullUrl('plugin.circle.admin.category.edit') !!}`+`&id=`+item.id;
  101. window.location.href = link;
  102. },
  103. search(val) {
  104. this.getData(val);
  105. },
  106. addModal() {
  107. let link = `{!! yzWebFullUrl('plugin.circle.admin.category.edit') !!}`;
  108. console.log(link);
  109. window.location.href = link;
  110. },
  111. del(id) {
  112. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  113. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  114. this.$http.post('{!! yzWebFullUrl('plugin.circle.admin.category.del') !!}',{id:id}).then(function (response) {
  115. if (response.data.result) {
  116. this.$message({type: 'success',message: '删除成功!'});
  117. }
  118. else{
  119. this.$message({type: 'error',message: response.data.msg});
  120. }
  121. loading.close();
  122. this.search(this.current_page)
  123. },function (response) {
  124. this.$message({type: 'error',message: response.data.msg});
  125. loading.close();
  126. }
  127. );
  128. }).catch(() => {
  129. this.$message({type: 'info',message: '已取消删除'});
  130. });
  131. },
  132. // 快速修改
  133. changeStatus(id) {
  134. let that = this;
  135. let json = {id: id};
  136. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  137. that.$http.post("{!! yzWebFullUrl('plugin.circle.admin.category.is-show') !!}", json).then(response => {
  138. if (response.data.result == 1) {
  139. that.$message.success('操作成功!');
  140. } else {
  141. that.$message.error(response.data.msg);
  142. }
  143. that.search(this.current_page);
  144. loading.close();
  145. }), function (res) {
  146. console.log(res);
  147. loading.close();
  148. };
  149. },
  150. },
  151. })
  152. </script>
  153. @endsection