list.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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-share-activity">
  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.name" placeholder="请输入活动名称"></el-input>
  29. </el-form-item>
  30. <el-form-item label="创建时间">
  31. <template>
  32. <div class="block">
  33. <span class="demonstration"></span>
  34. <el-date-picker
  35. v-model="searchParams.localcreate_time"
  36. type="datetimerange"
  37. range-separator="至"
  38. start-placeholder="开始日期"
  39. end-placeholder="结束日期"
  40. align="right">
  41. </el-date-picker>
  42. </div>
  43. </template>
  44. </el-form-item>
  45. <el-button type="primary" icon="el-icon-search" @click="searchData()">搜索</el-button>
  46. </el-form>
  47. </div>
  48. </div>
  49. </el-header>
  50. {{--表格start--}}
  51. <el-main>
  52. <template>
  53. <el-table :data="list">
  54. <el-table-column align="center" align="center" prop="id" label="ID" width="auto"></el-table-column>
  55. <el-table-column align="center" prop="start_time" label="创建时间" width="auto"></el-table-column>
  56. <el-table-column
  57. align="center"
  58. prop="end_time"
  59. label="结束时间">
  60. </el-table-column>
  61. <el-table-column align="center" prop="name" label="活动名称" width="auto"></el-table-column>
  62. <el-table-column label="状态">
  63. <template slot-scope="scope">
  64. <el-tooltip :content="scope.row.status?'启用':'禁用'" placement="top">
  65. <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" @change="statusChange(scope.$index,scope.row,scope.row.id)"></el-switch>
  66. </el-tooltip>
  67. </template>
  68. </el-table-column>
  69. <el-table-column
  70. align="center"
  71. prop="reviewstatus" :formatter="reviewstatusFormatter"
  72. label="审核状态">
  73. </el-table-column>
  74. <el-table-column
  75. align="center"
  76. prop="browse_count"
  77. label="浏览人数">
  78. </el-table-column>
  79. <el-table-column align="center" label="操作">
  80. <template slot-scope="scope">
  81. <a v-bind:href="'{{ yzWebUrl('plugin.share-store-activity.admin.activity.add', array('id' => '')) }}'+[[scope.row.id]]" title="编辑">
  82. <i class="el-icon-edit" style="font-size:28px;color:#606266"></i>
  83. </a>
  84. <a href="#" title="删除">
  85. <i class="el-icon-delete" style="font-size:28px;color:#606266" @click="del(scope.row.id)"></i>
  86. </a>
  87. <a href="#" v-if="scope.row.reviewstatus == 1">
  88. <el-tooltip placement="top">
  89. <div slot="content">
  90. <img :src="scope.row.qr_code" alt="" style="max-width:100px;">
  91. </div>
  92. <i class="iconfont icon-erweima1" style="font-size:28px;color:#606266"></i>
  93. </el-tooltip>
  94. </a>
  95. <a href="#" v-if="scope.row.reviewstatus == 1">
  96. <i class="el-icon-share" style="font-size:28px;color:#606266" title="点击复制链接" @click="copy(scope.row,scope.$index)"></i>
  97. <el-input v-model="scope.row.activity_url" :ref="'copy'+scope.$index" style="height: 1px;position: absolute;opacity:0;z-index:-2"></el-input>
  98. </a>
  99. <a href="#" v-if="scope.row.reviewstatus == 1">
  100. <i class="el-icon-help" style="font-size:28px;color:#606266" title="点击复制小程序链接" @click="copyMini(scope.row,scope.$index)"></i>
  101. <el-input v-model="scope.row.mini_url" :ref="'copyMini'+scope.$index" style="height: 1px;;position: absolute;opacity:0;z-index:-2"></el-input>
  102. </a>
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. </template>
  107. </el-main>
  108. {{--表格end--}}
  109. <el-footer>
  110. <el-pagination
  111. layout="prev, pager, next"
  112. @current-change="currentChange"
  113. :current-page.sync="current_page"
  114. :total="page_total"
  115. :page-size="page_size"
  116. background v-loading="loading">
  117. </el-pagination>
  118. </el-footer>
  119. </el-container>
  120. </template>
  121. </div>
  122. <script>
  123. var app = new Vue({
  124. el: '#app-share-activity',
  125. delimiters: ['[[', ']]'],
  126. data() {
  127. let pageList = {!! $pageList ?: '{}'!!};
  128. console.log("数据:"+ JSON.stringify(pageList.data) );
  129. return {
  130. form : {},
  131. loading : false,
  132. searchParams: {
  133. 'id' : '',
  134. 'name' : '',
  135. 'create_time' : [],
  136. 'localcreate_time':'',
  137. 'aa':''
  138. },
  139. real_search_form: {
  140. 'id' : '',
  141. 'name' : '',
  142. 'create_time' : '',
  143. },
  144. list : pageList.data,
  145. current_page : pageList.current_page,
  146. page_total : pageList.total,
  147. page_size : pageList.per_page,
  148. }
  149. },
  150. methods: {
  151. reviewstatusFormatter(row, column){
  152. if(row.reviewstatus==1){
  153. return "已审核";
  154. }else{
  155. return "未审核";
  156. }
  157. },
  158. statusChange(index,row,id) {
  159. this.loading = true;
  160. this.$http.post('{!! yzWebFullUrl('plugin.share-store-activity.admin.activity.change-status') !!}',{id:id,status:row.status}).then(function (response) {
  161. if (response.data.result){
  162. if(row.status){
  163. this.$message({message: '开启成功',type: 'success'});
  164. }
  165. else {
  166. this.$message({message: '关闭成功',type: 'success'});
  167. }
  168. } else {
  169. this.$message({message: response.data.msg,type: 'error'});
  170. if (this.list[index].status==1){
  171. this.list[index].status = 0;
  172. }
  173. else{
  174. this.list[index].status = 1;
  175. }
  176. }
  177. this.loading = false;
  178. },function (response) {
  179. this.$message({message: response.data.msg,type: 'error'});
  180. if (this.list[index].status==1){
  181. this.list[index].status = 0;
  182. } else{
  183. this.list[index].status = 1;
  184. }
  185. this.loading = false;
  186. });
  187. },
  188. del(id) {
  189. this.$confirm('是否删除', '提示', {
  190. confirmButtonText: '确定',
  191. cancelButtonText: '取消',
  192. type: 'warning'
  193. }).then(() => {
  194. this.$http.post('{!! yzWebFullUrl('plugin.share-store-activity.admin.activity.del') !!}',{id:id}).then(function (response) {
  195. if (response.data.result) {
  196. this.$message({
  197. type: 'success',
  198. message: '删除成功!'
  199. });
  200. window.open("{!! yzWebUrl('plugin.share-store-activity.admin.activity.index') !!}", '_self');
  201. }
  202. });
  203. }).catch(() => {
  204. this.$message({
  205. type: 'info',
  206. message: '已取消删除'
  207. });
  208. });
  209. },
  210. searchData() {
  211. let thattime=this.searchParams;
  212. let stime=Math.floor(new Date(this.searchParams.localcreate_time[0]).getTime() /1000).toString();
  213. let etime=Math.floor(new Date(this.searchParams.localcreate_time[1]).getTime() /1000).toString();
  214. this.loading = true;
  215. if(this.searchParams.localcreate_time){
  216. this.searchParams.create_time[0]=stime
  217. this.searchParams.create_time[1]=etime
  218. }
  219. console.log("转换1:"+this.searchParams.create_time[0])
  220. console.log("转换2:"+this.searchParams.create_time[1])
  221. this.$http.post('{!! yzWebFullUrl('plugin.share-store-activity.admin.activity.search') !!}',{search:this.searchParams}
  222. ).then(function (response) {
  223. if (response.data.result){
  224. let datas = response.data.data;
  225. this.page_total = datas.total;
  226. this.list = datas.data;
  227. this.page_size = datas.per_page;
  228. this.current_page = datas.current_page;
  229. this.real_search_form = this.searchParams;
  230. }
  231. else {
  232. this.$message({message: response.data.msg,type: 'error'});
  233. }
  234. this.loading = false;
  235. },function (response) {
  236. this.loading = false;
  237. this.$message({message: response.data.msg,type: 'error'});
  238. }
  239. );
  240. },
  241. addActivity(){
  242. window.open("{!! yzWebUrl('plugin.share-store-activity.admin.activity.add') !!}", '_self');
  243. },
  244. copy(row,index) {
  245. that = this;
  246. let Url = that.$refs['copy'+index];
  247. Url.select(); // 选择对象
  248. document.execCommand("Copy",false);
  249. that.$message({message:"复制成功!",type:"success"});
  250. },
  251. copyMini(row,index) {
  252. let that = this;
  253. let Url = that.$refs['copyMini'+index];
  254. Url.select(); // 选择对象
  255. document.execCommand("Copy",false);
  256. that.$message({message:"复制成功!",type:"success"});
  257. },
  258. currentChange(val) {
  259. this.loading = true;
  260. this.$http.post('{!! yzWebFullUrl('plugin.share-store-activity.admin.activity.search') !!}',{page:val,search:this.real_search_form}).then(function (response) {
  261. if (response.data.result){
  262. let datas = response.data.data;
  263. this.page_total = datas.total;
  264. this.list = datas.data;
  265. this.page_size = datas.per_page;
  266. this.current_page = datas.current_page;
  267. }
  268. else {
  269. this.$message({message: response.data.msg,type: 'error'});
  270. }
  271. this.loading = false;
  272. },function (response) {
  273. this.loading = false;
  274. this.$message({message: response.data.msg,type: 'error'});
  275. }
  276. );
  277. }
  278. },
  279. });
  280. </script>
  281. @endsection