category-list.blade.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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. <link rel="stylesheet" href="{{resource_get('plugins/pc-terminal/views/admin/index.css')}}">
  6. <style>
  7. /* 导航 */
  8. .el-radio-button .el-radio-button__inner,.el-radio-button:first-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;border-left: 0px;}
  9. .el-radio-button__inner{border:0;}
  10. .el-radio-button:last-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;}
  11. </style>
  12. <div class="all">
  13. <div id="app" v-cloak>
  14. <div class="vue-head">
  15. <el-radio-group v-model="order_type">
  16. <el-radio-button label="1" @click.native="gotoOther(1)">幻灯片</el-radio-button>
  17. <el-radio-button label="2" @click.native="gotoOther(2)">banner图</el-radio-button>
  18. <el-radio-button label="3" @click.native="gotoOther(3)">三栏广告</el-radio-button>
  19. <el-radio-button label="4" @click.native="gotoOther(4)">双栏广告</el-radio-button>
  20. <el-radio-button label="5" @click.native="gotoOther(5)">分类广告</el-radio-button>
  21. </el-radio-group>
  22. </div>
  23. <div class="vue-head">
  24. <div class="vue-main-title" style="margin-bottom:20px">
  25. <div class="vue-main-title-left"></div>
  26. <div class="vue-main-title-content">商品分类</div>
  27. {{--<div class="vue-main-title-button">--}}
  28. {{--<el-button type="primary" plain icon="el-icon-plus" size="small" @click="addFirst">添加一级分类</el-button>--}}
  29. {{--</div>--}}
  30. </div>
  31. <div class="vue-search">
  32. <el-input v-model="keyword" style="width:40%"></el-input>
  33. <el-button type="primary" @click="search(1)">搜索</el-button>
  34. <el-link class="el-link-assist" :underline="false" @click="openAll">
  35. 全部展开
  36. </el-link>
  37. <el-link class="el-link-assist" :underline="false" @click="closeAll" style="margin-left:20px;">
  38. 全部折叠
  39. </el-link>
  40. </div>
  41. </div>
  42. <div class="vue-main">
  43. <div class="vue-main-form">
  44. <el-table
  45. v-if="show_table"
  46. :data="list"
  47. row-key="id"
  48. ref="table"
  49. default-expand-all
  50. :tree-props="{children: 'children'}"
  51. style="width: 100%"
  52. >
  53. <el-table-column prop="name" label="分类名称"></el-table-column>
  54. <el-table-column prop="refund_time" label="操作" align="left" width="400">
  55. <template slot-scope="scope">
  56. <div style="text-align:left">
  57. <el-link title="编辑分类" :underline="false" v-if="scope.row.level<3" @click="editChild(scope.row)" style="text-align: left;display: inline-block;font-size:26px;width:50px;">
  58. <i class="iconfont icon-ht_operation_edit"></i>
  59. </el-link>
  60. </div>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. </div>
  65. </div>
  66. <!-- 分页 -->
  67. <div class="vue-page">
  68. <el-row v-if="total>0">
  69. <el-col align="right">
  70. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  71. :page-size="per_page" :current-page="current_page" background
  72. ></el-pagination>
  73. </el-col>
  74. </el-row>
  75. </div>
  76. </div>
  77. </div>
  78. <script>
  79. var app = new Vue({
  80. el: "#app",
  81. delimiters: ['[[', ']]'],
  82. name: 'test',
  83. data() {
  84. return {
  85. order_type:'5',
  86. list:[],
  87. keyword:'',
  88. rules: {},
  89. thirdShow:true,
  90. show_table:true,
  91. current_page:1,
  92. total:1,
  93. per_page:1,
  94. }
  95. },
  96. created() {
  97. },
  98. mounted() {
  99. this.getData(1);
  100. },
  101. methods: {
  102. getData(page) {
  103. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  104. this.show_table = false;
  105. this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.category.category-list') !!}',{page:page,keyword:this.keyword}).then(function(response) {
  106. if (response.data.result) {
  107. this.list = response.data.data.data.data;
  108. this.current_page=response.data.data.data.current_page;
  109. this.total=response.data.data.data.total;
  110. this.per_page=response.data.data.data.per_page;
  111. this.thirdShow=response.data.data.thirdShow;
  112. loading.close();
  113. this.show_table = true;
  114. } else {
  115. this.$message({
  116. message: response.data.msg,
  117. type: 'error'
  118. });
  119. this.show_table = true;
  120. }
  121. loading.close();
  122. }, function(response) {
  123. this.$message({
  124. message: response.data.msg,
  125. type: 'error'
  126. });
  127. loading.close();
  128. this.show_table = true;
  129. });
  130. },
  131. search(val) {
  132. if(this.keyword == "") {
  133. this.getData(val);
  134. return;
  135. }
  136. this.show_table = false;
  137. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  138. this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.category.category-list') !!}',{page:val,keyword:this.keyword}).then(function(response) {
  139. if (response.data.result) {
  140. this.list = response.data.data.data;
  141. this.list = response.data.data.data;
  142. this.current_page=response.data.data.current_page;
  143. this.total=response.data.data.total;
  144. this.per_page=response.data.data.per_page;
  145. this.show_table = true;
  146. this.$forceUpdate()
  147. // this.thirdShow=response.data.thirdShow;
  148. loading.close();
  149. } else {
  150. this.$message({
  151. message: response.data.msg,
  152. type: 'error'
  153. });
  154. this.show_table = false;
  155. }
  156. loading.close();
  157. }, function(response) {
  158. this.$message({
  159. message: response.data.msg,
  160. type: 'error'
  161. });
  162. loading.close();
  163. this.show_table = false;
  164. });
  165. },
  166. openAll() {
  167. this.list.forEach((item,index) => {
  168. // this.$refs.table.toggleRowExpansion(item, true)
  169. if(this.list[index].children && this.list[index].children.length>0) {
  170. this.$refs.table.toggleRowExpansion(item, true)
  171. }
  172. })
  173. },
  174. closeAll() {
  175. this.list.forEach((item,index) => {
  176. if(this.list[index].children && this.list[index].children.length>0) {
  177. this.$refs.table.toggleRowExpansion(item, false)
  178. }
  179. })
  180. },
  181. // 编辑子分类
  182. editChild(item) {
  183. let link = `{!! yzWebFullUrl('plugin.pc-terminal.admin.category.category-info') !!}`+`&id=`+item.id;
  184. window.location.href = link;
  185. },
  186. gotoOther(type) {
  187. let url = ""
  188. if(type==1) {
  189. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.slide.slide-list') !!}'
  190. }
  191. else if(type==2) {
  192. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.banner') !!}'
  193. }
  194. else if(type==3) {
  195. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.three-advert-list') !!}'
  196. }
  197. else if(type==4) {
  198. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.two-advert-list') !!}'
  199. }
  200. else if(type==5) {
  201. // url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.category.category-list') !!}'
  202. }
  203. if(url) {
  204. window.location.href=url
  205. }
  206. },
  207. },
  208. })
  209. </script>
  210. @endsection