button.blade.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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="img">
  24. <template slot-scope="scope">
  25. <div>
  26. <img :src="scope.row.img" alt="" style="width:50px;height:50px">
  27. </div>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="是否显示" align="center" prop="id" >
  31. <template slot-scope="scope">
  32. <div>
  33. <el-switch v-model="scope.row.is_show" :active-value="1" :inactive-value="0" @change="changeStatus(scope.row.id)"></el-switch>
  34. </div>
  35. </template>
  36. </el-table-column>
  37. <el-table-column prop="refund_time" label="操作" align="center" width="320">
  38. <template slot-scope="scope">
  39. <el-link title="编辑按钮" :underline="false" @click="gotoDetail(scope.row)" style="width:50px;">
  40. <i class="iconfont icon-ht_operation_edit"></i>
  41. </el-link>
  42. <el-link title="删除按钮" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
  43. <i class="iconfont icon-ht_operation_delete"></i>
  44. </el-link>
  45. </template>
  46. </el-table-column>
  47. </el-table>
  48. </div>
  49. </div>
  50. <!-- 分页 -->
  51. <div class="vue-page" v-if="total>0">
  52. <el-row>
  53. <el-col align="right">
  54. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  55. :page-size="per_page" :current-page="current_page" background
  56. ></el-pagination>
  57. </el-col>
  58. </el-row>
  59. </div>
  60. </div>
  61. </div>
  62. <script>
  63. var app = new Vue({
  64. el: "#app",
  65. delimiters: ['[[', ']]'],
  66. name: 'test',
  67. data() {
  68. return {
  69. list:[],
  70. rules: {},
  71. current_page:1,
  72. total:1,
  73. per_page:1,
  74. }
  75. },
  76. created() {
  77. },
  78. mounted() {
  79. this.getData(1);
  80. },
  81. methods: {
  82. getData(page) {
  83. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  84. this.$http.post('{!! yzWebFullUrl('plugin.circle.admin.button.get-list') !!}',{page:page}).then(function(response) {
  85. if (response.data.result) {
  86. this.list = response.data.data.data;
  87. this.current_page=response.data.data.current_page;
  88. this.total=response.data.data.total;
  89. this.per_page=response.data.data.per_page;
  90. loading.close();
  91. } else {
  92. this.$message({
  93. message: response.data.msg,
  94. type: 'error'
  95. });
  96. }
  97. loading.close();
  98. }, function(response) {
  99. this.$message({
  100. message: response.data.msg,
  101. type: 'error'
  102. });
  103. loading.close();
  104. });
  105. },
  106. gotoDetail(item) {
  107. let link = `{!! yzWebFullUrl('plugin.circle.admin.button.edit') !!}`+`&id=`+item.id;
  108. window.location.href = link;
  109. },
  110. search(val) {
  111. this.getData(val);
  112. },
  113. addModal() {
  114. let link = `{!! yzWebFullUrl('plugin.circle.admin.button.edit') !!}`;
  115. console.log(link);
  116. window.location.href = link;
  117. },
  118. del(id,index) {
  119. console.log(id,index)
  120. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  121. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  122. this.$http.post('{!! yzWebFullUrl('plugin.circle.admin.button.del') !!}',{id:id}).then(function (response) {
  123. if (response.data.result) {
  124. this.$message({type: 'success',message: '删除成功!'});
  125. }
  126. else{
  127. this.$message({type: 'error',message: response.data.msg});
  128. }
  129. loading.close();
  130. this.search(this.current_page)
  131. },function (response) {
  132. this.$message({type: 'error',message: response.data.msg});
  133. loading.close();
  134. }
  135. );
  136. }).catch(() => {
  137. this.$message({type: 'info',message: '已取消删除'});
  138. });
  139. },
  140. // 快速修改
  141. changeStatus(id) {
  142. let that = this;
  143. let json = {id: id};
  144. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  145. that.$http.post("{!! yzWebFullUrl('plugin.circle.admin.button.is-show') !!}", json).then(response => {
  146. if (response.data.result == 1) {
  147. that.$message.success('操作成功!');
  148. } else {
  149. that.$message.error(response.data.msg);
  150. }
  151. that.search(this.current_page);
  152. loading.close();
  153. }), function (res) {
  154. console.log(res);
  155. loading.close();
  156. };
  157. },
  158. },
  159. })
  160. </script>
  161. @endsection