index.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. @extends('layouts.base')
  2. @section('title', '新人奖')
  3. @section('content')
  4. <style>
  5. #re_content{
  6. margin-top:20px;
  7. }
  8. .el-form .el-form-item{
  9. margin-right: 30px;
  10. }
  11. .list_total_num{
  12. margin-top:20px;
  13. }
  14. .el-table__header-wrapper{
  15. margin-top:20px;
  16. }
  17. .el-tag{font-weight:700;font-size:15px;}
  18. .rightlist-head{padding:15px 0;line-height:50px;}
  19. .rightlist-head-con{float:left;padding-right:20px;font-size:16px;color:#888;}
  20. .el-button+.el-button {
  21. margin-left: 0px;
  22. }
  23. .qr_code{
  24. text-align:center;
  25. }
  26. </style>
  27. <!-- tab -->
  28. <div id='re_content' v-loading="all_loading">
  29. <div class="rightlist-head">
  30. <div class="rightlist-head-con">新人礼</div>
  31. <a href="{{ yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.addActivity') }}">
  32. <el-button>创建活动</el-button>
  33. </a>
  34. </div>
  35. <template>
  36. <el-form :inline="true" :model="search_form" ref="search_form">
  37. <el-row>
  38. <el-col :span="24">
  39. <el-form-item label="活动ID">
  40. <el-input v-model="search_form.id" placeholder="请输入活动ID"></el-input>
  41. </el-form-item>
  42. <el-form-item label="活动名称">
  43. <el-input v-model="search_form.name" placeholder="请输入活动名称"></el-input>
  44. </el-form-item>
  45. <el-form-item label="时间范围">
  46. <el-date-picker v-model="search_form.activity_time" value-format="timestamp" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  47. </el-form-item>
  48. <el-form-item >
  49. <a href="#" style="margin-right:10px;">
  50. <el-button type="success" icon="el-icon-search" @click="search()">搜索</el-button>
  51. </a>
  52. </el-form-item>
  53. </el-col>
  54. </el-row>
  55. </el-form>
  56. <template>
  57. <!-- 表格start -->
  58. <el-table :data="list" style="width: 100%" v-loading="search_loading">
  59. <el-table-column prop="id" label="ID" width="70px" align="center"></el-table-column>
  60. <el-table-column prop="name" label="活动名称" min-width="110" align="center"></el-table-column>
  61. <el-table-column prop="countdown_time" label="活动时间" min-width="100" align="center">
  62. <template slot-scope="scope">
  63. <div>[[scope.row.start_time]]</div>
  64. <div>至</div>
  65. <div>[[scope.row.end_time]]</div>
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="countdown_time" label="领取条件" min-width="100" align="center">
  69. <template slot-scope="scope">
  70. <div v-if="scope.row.receive_type==0">
  71. 新注册会员
  72. </div>
  73. <div v-if="scope.row.receive_type==1">
  74. 无消费记录会员
  75. </div>
  76. <div v-if="scope.row.receive_type==2">
  77. 直推客户数量满X人
  78. </div>
  79. <div v-if="scope.row.receive_type==3">
  80. 购买指定商品会员
  81. </div>
  82. <div v-if="scope.row.receive_type==4">
  83. 选择会员标签
  84. </div>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="活动奖品" prop="prize_list" align="center">
  88. <template slot-scope="scope">
  89. <el-popover
  90. placement="right-start"
  91. trigger="hover"
  92. width="50"
  93. >
  94. <div slot="reference"><div v-for="(item,index,key) in scope.row.prize_list.slice(0,3)" style="margin-left:5px;">[[item.name]]</div></div>
  95. <div v-for="(item,index,key) in scope.row.prize_list" >[[item.name]]</div>
  96. </el-popover>
  97. </template>
  98. </el-table-column>
  99. <el-table-column prop="receive_num" label="领取人数" min-width="110" align="center"></el-table-column>
  100. <el-table-column label="操作" align="center" width="330px">
  101. <template slot-scope="scope">
  102. <a :href="'{{ yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.record', array('id' => '')) }}'+[[scope.row.id]]">
  103. <el-button size="mini">数据</el-button>
  104. </a>
  105. <a :href="'{{ yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.editActivity', array('id' => '')) }}'+[[scope.row.id]]"><el-button size="mini">编辑</el-button></a>
  106. <el-button size="mini" @click="del(scope, list)">删除</el-button>
  107. <el-input style="opacity:0;position: absolute;:1px;" v-model="scope.row.activity_url" :ref="'link'+scope.$index">
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. <el-row>
  112. <el-col :span="24" align="right" migra style="padding:15px 5% 15px 0" v-loading="loading">
  113. <el-pagination background layout="prev, pager, next" @current-change="currentChange" :total="page_total"
  114. :page-size="page_size" :current-page="current_page"></el-pagination>
  115. </el-col>
  116. </el-row>
  117. <!-- 表格end -->
  118. </template>
  119. </template>
  120. </div>
  121. <script>
  122. var vm = new Vue({
  123. el: "#re_content",
  124. delimiters: ['[[', ']]'],
  125. data() {
  126. let data = {!! $page_list?:'{}' !!}
  127. let category_list = {!! $category_list?:'{}' !!}
  128. let activate_list = {!! $type_list?:'{}' !!};
  129. let lang = {!! $lang?:'{}' !!};
  130. return {
  131. list:[],
  132. page_total:1,
  133. data:'',
  134. loading:false,
  135. page:1,
  136. page_size:1,
  137. activeName: 'activate',
  138. lang:lang,
  139. all_loading:false,
  140. loading:false,
  141. search_loading:false,
  142. search_form:{},
  143. real_search_form:{},
  144. activate_list:activate_list,
  145. category_list: category_list,
  146. page_total:data.total,
  147. data:data,
  148. page_size:data.per_page,
  149. current_page:data.current_page,
  150. }
  151. },
  152. created () {
  153. this.currentChange(1);
  154. },
  155. methods: {
  156. timestampToTime(timestamp) {
  157. var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  158. var Y = date.getFullYear() + '-';
  159. var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
  160. var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
  161. var h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
  162. var m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
  163. var s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
  164. return Y+M+D+h+m+s;
  165. },
  166. del(scope, rows){
  167. rows.splice(scope.$index, 1);
  168. let json={
  169. id:scope.row.id
  170. }
  171. this.$http.post('{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.delActivity') !!}',json).then(function (response){
  172. this.$message({message:"删除成功!",type:"success"});
  173. this.loading = false;
  174. },function (response) {
  175. console.log(response);
  176. this.loading = false;
  177. }
  178. );
  179. },
  180. search() {
  181. this.search_loading = true;
  182. if(this.search_form.is_time != 0 && this.search_form.activity_time){
  183. this.search_form.activity_time[0] = Math.round(this.search_form.activity_time[0]/1000).valueOf();
  184. this.search_form.activity_time[1] = Math.round(this.search_form.activity_time[1]/1000).valueOf();
  185. }
  186. this.$http.post('{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.search') !!}',{search:this.search_form}
  187. ).then(function (response) {
  188. if (response.data.result){
  189. let data = response.data.data.list;
  190. this.page_total = data.total;
  191. this.list = data.data;
  192. this.list.map((item,index,key)=>{
  193. item.start_time=this.timestampToTime(item.start_time);
  194. item.end_time=this.timestampToTime(item.end_time);
  195. });
  196. this.page_size = data.per_page;
  197. this.current_page = data.current_page;
  198. this.loading = false;
  199. this.real_search_form=Object.assign({},this.search_form);
  200. }
  201. else {
  202. this.$message({message: response.data.msg,type: 'error'});
  203. }
  204. this.search_loading = false;
  205. },function (response) {
  206. this.search_loading = false;
  207. this.$message({message: response.data.msg,type: 'error'});
  208. }
  209. );
  210. },
  211. currentChange(val) {
  212. this.loading = true;
  213. this.$http.post('{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.search') !!}',{page:val,search:this.real_search_form}).then(function (response){
  214. let data = response.data.data.list;
  215. this.page_total = data.total;
  216. this.list = data.data;
  217. this.list.map((item,index,key)=>{
  218. item.start_time=this.timestampToTime(item.start_time);
  219. item.end_time=this.timestampToTime(item.end_time);
  220. })
  221. this.page_size = data.per_page;
  222. this.current_page = data.current_page;
  223. this.loading = false;
  224. },function (response) {
  225. console.log(response);
  226. this.loading = false;
  227. }
  228. );
  229. },
  230. },
  231. });
  232. </script>
  233. @endsection