list.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. @extends('layouts.base')
  2. @section('title', '画册管理')
  3. @section('content')
  4. <style xmlns:v-bind="http://www.w3.org/1999/xhtml">
  5. .rightlist #app .rightlist-head{padding:15px 0;line-height:50px;}
  6. .rightlist #app{margin-left:30px;}
  7. .rightlist-head-con{float:left;padding-right:20px;font-size:16px;color:#888;}
  8. .el-form-item__label{padding-right:30px;}
  9. .mouse-active{cursor:pointer;border:1px dotted #409EFF;border-radius: 4px;}
  10. /* 滑块选择小白点 */
  11. .el-switch.is-checked .el-switch__core::after {left: 100%;margin-left: -17px;}
  12. .el-switch__core::after {content: "";position: absolute;top: 1px;left: 1px;border-radius: 100%;transition: all .3s;width: 16px;height: 16px;background-color: #fff;}
  13. </style>
  14. <link rel="stylesheet" href="//at.alicdn.com/t/font_913727_zrmdutznqpd.css">
  15. <div id="app-picture-album">
  16. <template>
  17. <el-container>
  18. <el-header height="auto">
  19. <div class="">
  20. <h4 class="card-title">智能画册管理</h4>
  21. <el-button type="primary" icon="el-icon-plus" @click="addActivity()">创建画册</el-button>
  22. <div style="padding-top: 24px">
  23. <el-form v-loading="loading" ref="form" :model="form" :inline="true">
  24. <el-form-item label="画册ID">
  25. <el-input v-model="searchParams.id" placeholder="画册ID"></el-input>
  26. </el-form-item>
  27. <el-form-item label="画册名称">
  28. <el-input v-model="searchParams.picture_name" placeholder="请输入画册名称"></el-input>
  29. </el-form-item>
  30. <el-button type="primary" icon="el-icon-search" @click="searchData(1)">搜索</el-button>
  31. </el-form>
  32. </div>
  33. </div>
  34. </el-header>
  35. {{--表格start--}}
  36. <el-main>
  37. <template>
  38. <el-table :data="list">
  39. <el-table-column prop="id" label="ID" align="center"></el-table-column>
  40. <el-table-column prop="created_at" label="创建时间" align="center"></el-table-column>
  41. <el-table-column prop="picture_name" label="画册名称" align="center"></el-table-column>
  42. <el-table-column prop="has_many_image.length" label="画册图片数量" align="center"></el-table-column>
  43. <el-table-column prop="has_many_goods.length" label="画册商品数量" align="center"></el-table-column>
  44. <el-table-column prop="picture_peo" label="浏览人数" align="center"></el-table-column>
  45. <el-table-column label="操作" align="center" width="320">
  46. <template slot-scope="scope">
  47. <el-button @click="picManage(scope.row.id)">图片管理</el-button>
  48. <a title="编辑">
  49. <i class="el-icon-edit" style="font-size:25px;color:#606266;" @click="edit(scope.row.id)" ></i>
  50. </a>
  51. <a title="删除">
  52. <i class="el-icon-delete" style="font-size:24px;color:#606266;cursor: pointer;" @click="del(scope.row.id)"></i>
  53. </a>
  54. <a href="#">
  55. <el-tooltip placement="top">
  56. <div slot="content">
  57. <img :src="scope.row.qr_code" alt="" style="max-width:100px;">
  58. </div>
  59. <i class="iconfont icon-erweima1" style="font-size:24px;color:#606266"></i>
  60. </el-tooltip>
  61. </a>
  62. <a href="#">
  63. <i class="el-icon-share" style="font-size:24px;color:#606266" title="点击复制链接" @click="copy(scope.row,scope.$index)"></i>
  64. </a>
  65. <el-input v-model="scope.row.activity_url" :ref="'copy'+scope.$index" style="position: absolute;opacity:0;"></el-input>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. </template>
  70. </el-main>
  71. {{--表格end--}}
  72. <el-footer>
  73. <el-pagination
  74. layout="prev, pager, next"
  75. @current-change="currentChange"
  76. :current-page.sync="current_page"
  77. :total="page_total"
  78. :page-size="page_size"
  79. background v-loading="loading">
  80. </el-pagination>
  81. </el-footer>
  82. </el-container>
  83. </template>
  84. </div>
  85. <script>
  86. var app = new Vue({
  87. el: '#app-picture-album',
  88. delimiters: ['[[', ']]'],
  89. data() {
  90. let pageList = {!! $pageList ?: '{}'!!};
  91. console.log(pageList)
  92. return {
  93. form : {},
  94. loading : false,
  95. searchParams: {
  96. 'id' : '',
  97. 'name' : '',
  98. 'create_time' : '',
  99. },
  100. real_search_form: {
  101. 'id' : '',
  102. 'name' : '',
  103. 'create_time' : '',
  104. },
  105. list : pageList.data,
  106. current_page : pageList.current_page,
  107. page_total : pageList.total,
  108. page_size : pageList.per_page,
  109. }
  110. },
  111. created(){
  112. let that = this;
  113. document.onkeydown = function(){
  114. if(window.event.keyCode == 13)
  115. that.searchData(1);
  116. }
  117. },
  118. methods: {
  119. statusChange(index,row,id) {
  120. this.loading = true;
  121. this.$http.post('{!! yzWebFullUrl('plugin.picture-album.admin.controllers.activity.change-status') !!}',{id:id,status:row.status}).then(function (response) {
  122. if (response.data.result){
  123. if(row.status){
  124. this.$message({message: '开启成功',type: 'success'});
  125. }
  126. else {
  127. this.$message({message: '关闭成功',type: 'success'});
  128. }
  129. } else {
  130. this.$message({message: response.data.msg,type: 'error'});
  131. if (this.list[index].status==1){
  132. this.list[index].status = 0;
  133. }
  134. else{
  135. this.list[index].status = 1;
  136. }
  137. }
  138. this.loading = false;
  139. },function (response) {
  140. this.$message({message: response.data.msg,type: 'error'});
  141. if (this.list[index].status==1){
  142. this.list[index].status = 0;
  143. } else{
  144. this.list[index].status = 1;
  145. }
  146. this.loading = false;
  147. });
  148. },
  149. del(id) {
  150. this.$confirm('是否删除', '提示', {
  151. confirmButtonText: '确定',
  152. cancelButtonText: '取消',
  153. type: 'warning'
  154. }).then(() => {
  155. this.$http.post('{!! yzWebFullUrl('plugin.picture-album.admin.controllers.activity.del') !!}',{id:id}).then(function (response) {
  156. if (response.data.result) {
  157. this.$message({
  158. type: 'success',
  159. message: '删除成功!'
  160. });
  161. window.open("{!! yzWebUrl('plugin.picture-album.admin.controllers.activity.index') !!}", '_self');
  162. }
  163. });
  164. }).catch(() => {
  165. this.$message({
  166. type: 'info',
  167. message: '已取消删除'
  168. });
  169. });
  170. },
  171. searchData(page) {
  172. this.loading = true;
  173. if(this.searchParams.create_time){
  174. this.searchParams.create_time[0] = Math.round(this.searchParams.create_time[0]/1000).valueOf();
  175. this.searchParams.create_time[1] = Math.round(this.searchParams.create_time[1]/1000).valueOf();
  176. }
  177. this.$http.post('{!! yzWebFullUrl('plugin.picture-album.admin.controllers.activity.search') !!}',{page:page,search:this.searchParams}
  178. ).then(function (response) {
  179. if (response.data.result){
  180. let datas = response.data.data;
  181. this.page_total = datas.total;
  182. this.list = datas.data;
  183. this.page_size = datas.per_page;
  184. this.current_page = datas.current_page;
  185. this.real_search_form = this.searchParams;
  186. }
  187. else {
  188. this.$message({message: response.data.msg,type: 'error'});
  189. }
  190. this.loading = false;
  191. },function (response) {
  192. this.loading = false;
  193. this.$message({message: response.data.msg,type: 'error'});
  194. }
  195. );
  196. },
  197. addActivity(){
  198. window.open("{!! yzWebUrl('plugin.picture-album.admin.controllers.activity.add-activity') !!}", '_self');
  199. },
  200. copy(row,index) {
  201. that = this;
  202. let Url = that.$refs['copy'+index];
  203. Url.select(); // 选择对象
  204. document.execCommand("Copy",false);
  205. that.$message({message:"复制成功!",type:"success"});
  206. },
  207. currentChange(val) {
  208. this.loading = true;
  209. this.$http.post('{!! yzWebFullUrl("plugin.picture-album.admin.controllers.activity.search") !!}',{page:val,search:this.real_search_form}).then(function (response) {
  210. if (response.data.result){
  211. let datas = response.data.data;
  212. this.page_total = datas.total;
  213. this.list = datas.data;
  214. this.page_size = datas.per_page;
  215. this.current_page = datas.current_page;
  216. window.scrollTo({
  217. top: 0,
  218. behavior: "smooth"
  219. });
  220. }
  221. else {
  222. this.$message({message: response.data.msg,type: 'error'});
  223. }
  224. this.loading = false;
  225. },function (response) {
  226. this.loading = false;
  227. this.$message({message: response.data.msg,type: 'error'});
  228. }
  229. );
  230. },
  231. picManage(id) {
  232. url = '{!! yzWebFullUrl('plugin.picture-album.admin.controllers.activity-wheel.index') !!}';
  233. location.href = url+'&id='+id;
  234. },
  235. edit(id) {
  236. url = '{!! yzWebFullUrl('plugin.picture-album.admin.controllers.activity.add-activity') !!}';
  237. location.href = url+'&id='+id;
  238. }
  239. },
  240. });
  241. </script>
  242. @endsection