threeAdvert-list.blade.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. @extends('layouts.base')
  2. @section('title', "三栏广告")
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/pc-terminal/views/admin/index.css')}}">
  5. <style>
  6. /* 导航 */
  7. .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;}
  8. .el-radio-button__inner{border:0;}
  9. .el-radio-button:last-child .el-radio-button__inner {border-radius: 4px 4px 4px 4px;}
  10. </style>
  11. <div class="all">
  12. <div id="app" v-cloak>
  13. <div class="vue-head">
  14. <el-radio-group v-model="order_type">
  15. <el-radio-button label="1" @click.native="gotoOther(1)">幻灯片</el-radio-button>
  16. <el-radio-button label="2" @click.native="gotoOther(2)">banner图</el-radio-button>
  17. <el-radio-button label="3" @click.native="gotoOther(3)">三栏广告</el-radio-button>
  18. <el-radio-button label="4" @click.native="gotoOther(4)">双栏广告</el-radio-button>
  19. <el-radio-button label="5" @click.native="gotoOther(5)">分类广告</el-radio-button>
  20. </el-radio-group>
  21. </div>
  22. <div class="vue-main">
  23. <div>
  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" style="flex:0 0 120px">广告列表</div>
  27. <div class="vue-main-title-button">
  28. <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">添加广告</el-button>
  29. </div>
  30. </div>
  31. <el-table :data="list" style="width: 100%">
  32. <el-table-column label="ID" align="center" prop="id" width="100"></el-table-column>
  33. <el-table-column label="广告名称" align="center" prop="title"></el-table-column>
  34. <el-table-column label="广告图片" align="center" prop="img_src">
  35. <template slot-scope="scope">
  36. <div>
  37. <div><img :src="scope.row.img_src" alt="" style="width:80px;height: 50px;"></div>
  38. </div>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="是否显示" align="center" prop="is_show" >
  42. <template slot-scope="scope">
  43. <el-switch v-model="scope.row.is_show" :active-value="1" :inactive-value="0" @change="editStatus(scope.row.id,scope.$index)"></el-switch>
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="refund_time" label="操作" align="center" width="320">
  47. <template slot-scope="scope">
  48. <el-link title="编辑广告" :underline="false" @click="gotoDetail(scope.row)" style="width:50px;">
  49. <i class="iconfont icon-ht_operation_edit"></i>
  50. </el-link>
  51. <el-link title="删除广告" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
  52. <i class="iconfont icon-ht_operation_delete"></i>
  53. </el-link>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. </div>
  58. </div>
  59. <!-- 分页 -->
  60. <div class="vue-page" v-if="total>0">
  61. <el-row>
  62. <el-col align="right">
  63. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  64. :page-size="per_page" :current-page="current_page" background
  65. ></el-pagination>
  66. </el-col>
  67. </el-row>
  68. </div>
  69. </div>
  70. </div>
  71. <script>
  72. var app = new Vue({
  73. el: "#app",
  74. delimiters: ['[[', ']]'],
  75. name: 'test',
  76. data() {
  77. return {
  78. order_type:'3',
  79. list:[],
  80. rules: {},
  81. current_page:1,
  82. total:1,
  83. per_page:1,
  84. }
  85. },
  86. created() {
  87. },
  88. mounted() {
  89. this.getData(1);
  90. },
  91. methods: {
  92. getData(page) {
  93. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  94. this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.three-advert-list') !!}',{page:page}).then(function(response) {
  95. if (response.data.result) {
  96. console.log(response.data.data);
  97. this.list = response.data.data.data;
  98. this.current_page=response.data.data.current_page;
  99. this.total=response.data.data.total;
  100. this.per_page=response.data.data.per_page;
  101. loading.close();
  102. } else {
  103. this.$message({
  104. message: response.data.msg,
  105. type: 'error'
  106. });
  107. }
  108. loading.close();
  109. }, function(response) {
  110. this.$message({
  111. message: response.data.msg,
  112. type: 'error'
  113. });
  114. loading.close();
  115. });
  116. },
  117. gotoDetail(item) {
  118. let link = `{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.advert-edit') !!}`+`&id=`+item.id;
  119. window.location.href = link;
  120. },
  121. search(val) {
  122. this.getData(val);
  123. },
  124. addModal() {
  125. let link = `{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.advert-add',['advert_type'=>2]) !!}`;
  126. window.location.href = link;
  127. },
  128. del(id,index) {
  129. this.$confirm('确定删除吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  130. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  131. this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.advert-del') !!}',{id:id}).then(function (response) {
  132. if (response.data.result) {
  133. this.list.splice(index,1);
  134. this.$message({type: 'success',message: '删除成功!'});
  135. }
  136. else{
  137. this.$message({type: 'error',message: response.data.msg});
  138. }
  139. loading.close();
  140. this.search(this.current_page)
  141. },function (response) {
  142. this.$message({type: 'error',message: response.data.msg});
  143. loading.close();
  144. }
  145. );
  146. }).catch(() => {
  147. this.$message({type: 'info',message: '已取消删除'});
  148. });
  149. },
  150. gotoOther(type) {
  151. let url = ""
  152. if(type==1) {
  153. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.slide.slide-list') !!}'
  154. }
  155. else if(type==2) {
  156. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.set.banner') !!}'
  157. }
  158. else if(type==3) {
  159. //url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.three-advert-list') !!}'
  160. }
  161. else if(type==4) {
  162. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.two-advert-list') !!}'
  163. }
  164. else if(type==5) {
  165. url = '{!! yzWebFullUrl('plugin.pc-terminal.admin.category.category-list') !!}'
  166. }
  167. if(url) {
  168. window.location.href=url
  169. }
  170. },
  171. // 字符转义
  172. escapeHTML(a) {
  173. a = "" + a;
  174. return a.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'");;
  175. },
  176. editStatus(id,index){
  177. let json = {
  178. id:id,
  179. }
  180. json.status = this.list[index].is_show;
  181. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  182. this.$http.post('{!! yzWebFullUrl('plugin.pc-terminal.admin.advert.edit-advert-status') !!}',json).then(function (response) {
  183. if (response.data.result){
  184. this.$message.success("操作成功");
  185. this.search(this.current_page);
  186. }
  187. else {
  188. this.$message.error( response.data.msg );
  189. }
  190. loading.close();
  191. },function (response) {
  192. this.$message.error(response.data.msg);
  193. loading.close();
  194. }
  195. );
  196. },
  197. },
  198. })
  199. </script>
  200. @endsection