value.blade.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. .edit-i{display:none;}
  7. .el-table_1_column_2:hover .edit-i{font-weight:900;padding:0;margin:0;display:inline-block;}
  8. </style>
  9. <div class="all">
  10. <div id="app" v-cloak>
  11. <div class="vue-crumbs">
  12. <a @click="goParent">商品标签组列表</a> > 商品标签列表
  13. </div>
  14. <div class="vue-main">
  15. <div class="vue-main-title" style="margin-bottom:20px">
  16. <div class="vue-main-title-left"></div>
  17. <div class="vue-main-title-content">所属组:【<span style="color:#f00">[[parent.name]]</span>】</div>
  18. <div class="vue-main-title-button">
  19. <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">添加标签</el-button>
  20. </div>
  21. </div>
  22. <div class="vue-main-form">
  23. <el-table :data="list" style="width: 100%">
  24. <el-table-column label="ID" align="center" prop="id"></el-table-column>
  25. <el-table-column label="标签名称" align="center" prop="name"></el-table-column>
  26. <el-table-column label="前端是否显示" align="center">
  27. <template slot-scope="scope">
  28. <el-switch
  29. v-model="scope.row.is_front_show"
  30. active-color="#13ce66"
  31. :active-value="1"
  32. :inactive-value="0"
  33. @change="setOpen(scope.row.id,scope.row.is_front_show)"
  34. >
  35. </el-switch>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="refund_time" label="操作" align="center" width="320">
  39. <template slot-scope="scope">
  40. <!-- <el-link type="warning" :underline="false" @click="gotoEdit(scope.row.id)" class="el-link-edit el-link-edit-middle">
  41. 编辑
  42. </el-link>
  43. <el-link type="warning" :underline="false" @click="del(scope.row.id,scope.$index)" class="el-link-edit el-link-edit-end">
  44. 删除
  45. </el-link> -->
  46. <el-link title="编辑标签" :underline="false" @click="gotoEdit(scope.row.id)" style="width:50px;">
  47. <i class="iconfont icon-ht_operation_edit"></i>
  48. </el-link>
  49. <el-link title="删除" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
  50. <i class="iconfont icon-ht_operation_delete"></i>
  51. </el-link>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. </div>
  56. </div>
  57. <!-- 分页 -->
  58. <div class="vue-page" v-if="total>0">
  59. <el-row>
  60. <el-col align="right">
  61. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  62. :page-size="per_page" :current-page="current_page" background
  63. ></el-pagination>
  64. </el-col>
  65. </el-row>
  66. </div>
  67. </div>
  68. </div>
  69. <script>
  70. let parent_id = {!! $parent_id?:'0' !!};
  71. console.log(parent_id)
  72. var app = new Vue({
  73. el: "#app",
  74. delimiters: ['[[', ']]'],
  75. name: 'test',
  76. data() {
  77. return {
  78. list:[],
  79. parent_id:parent_id,
  80. parent:{},
  81. rules: {},
  82. current_page:1,
  83. total:1,
  84. per_page:1,
  85. }
  86. },
  87. created() {
  88. },
  89. mounted() {
  90. this.getData(1);
  91. },
  92. methods: {
  93. getData(page) {
  94. let that = this;
  95. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  96. this.$http.post('{!! yzWebFullUrl('filtering.filtering.filter-list') !!}',{parent_id:this.parent_id,page:page}).then(function(response) {
  97. if (response.data.result) {
  98. this.list = response.data.data.list.data;
  99. this.current_page=response.data.data.list.current_page;
  100. this.total=response.data.data.list.total;
  101. this.per_page=response.data.data.list.per_page;
  102. if(this.parent_id!=0) {
  103. this.parent = response.data.data.parent;
  104. }
  105. loading.close();
  106. } else {
  107. this.$message({
  108. message: response.data.msg,
  109. type: 'error'
  110. });
  111. }
  112. loading.close();
  113. }, function(response) {
  114. this.$message({
  115. message: response.data.msg,
  116. type: 'error'
  117. });
  118. loading.close();
  119. });
  120. },
  121. search(val) {
  122. this.getData(val);
  123. },
  124. // 添加新品牌
  125. addModal() {
  126. let link = `{!! yzWebFullUrl('filtering.filtering.edit-view') !!}`+`&parent_id=`+this.parent_id;
  127. console.log(link);
  128. window.location.href = link;
  129. },
  130. gotoEdit(id) {
  131. let link = `{!! yzWebFullUrl('filtering.filtering.edit-view') !!}`+`&parent_id=`+this.parent_id+`&id=`+id;
  132. window.location.href = link;
  133. },
  134. setOpen(id,show){
  135. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  136. this.$http.post('{!! yzWebFullUrl('filtering.filtering.setOpen') !!}',{tag_id:id,show:show}).then(function (response) {
  137. if (response.data.result) {
  138. this.$message({type: 'success',message: response.data.msg});
  139. }
  140. else{
  141. this.$message({type: 'error',message: response.data.msg});
  142. }
  143. loading.close();
  144. this.search(this.current_page)
  145. },function (response) {
  146. this.$message({type: 'error',message: response.data.msg});
  147. loading.close();
  148. }
  149. );
  150. },
  151. del(id,index) {
  152. console.log(id,index)
  153. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  154. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  155. this.$http.post('{!! yzWebFullUrl('filtering.filtering.del') !!}',{id:id}).then(function (response) {
  156. if (response.data.result) {
  157. this.list.splice(index,1);
  158. this.$message({type: 'success',message: '删除成功!'});
  159. }
  160. else{
  161. this.$message({type: 'error',message: response.data.msg});
  162. }
  163. loading.close();
  164. this.search(this.current_page)
  165. },function (response) {
  166. this.$message({type: 'error',message: response.data.msg});
  167. loading.close();
  168. }
  169. );
  170. }).catch(() => {
  171. this.$message({type: 'info',message: '已取消删除'});
  172. });
  173. },
  174. goParent() {
  175. window.location.href = `{!! yzWebFullUrl('filtering.filtering.index') !!}`;
  176. },
  177. },
  178. })
  179. </script>
  180. @endsection