record.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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: 60px;
  10. }
  11. .rightlist-head{padding:15px 0;line-height:50px;}
  12. .rightlist-head-con{padding-right:20px;font-size:16px;color:#888;display:inline-block;}
  13. #re_content .time{margin-bottom:20px;}
  14. </style>
  15. <!-- tab -->
  16. <div id='re_content' v-loading="all_loading">
  17. <div class="rightlist-head">
  18. <div class="rightlist-head-con">活动数据</div>
  19. <a href="{{ yzWebFullUrl('plugin.lucky-draw.admin.controllers.activity.index') }}">
  20. <el-button>返回列表</el-button>
  21. </a>
  22. </div>
  23. <div class="time">活动时间:[[start_time]]至[[end_time]]</div>
  24. <template>
  25. <el-form :inline="true" :model="search_form" ref="search_form">
  26. <el-row>
  27. <el-col :span="24">
  28. <el-form-item label="会员昵称">
  29. <el-input v-model="search_form.name" placeholder="会员昵称"></el-input>
  30. </el-form-item>
  31. <el-form-item label="会员ID">
  32. <el-input v-model="search_form.uid" placeholder="会员ID"></el-input>
  33. </el-form-item>
  34. <el-form-item label="时间范围" >
  35. <el-date-picker v-model="search_form.times" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  36. </el-form-item>
  37. <el-form-item style="text-align:left;margin-right: 10px">
  38. <a href="#">
  39. <el-button type="primary" @click="derive" v-if="list.length>0">导出</el-button>
  40. </a>
  41. <a href="#">
  42. <!-- <el-button type="default" @click="outExcel()">导出EXCEL</el-button> -->
  43. </a>
  44. </el-form-item>
  45. <el-form-item style="text-align:left;">
  46. <a href="#">
  47. <el-button type="success" icon="el-icon-search" @click="search()">搜索</el-button>
  48. </a>
  49. <a href="#">
  50. <!-- <el-button type="default" @click="outExcel()">导出EXCEL</el-button> -->
  51. </a>
  52. </el-form-item>
  53. </el-col>
  54. </el-row>
  55. </el-form>
  56. <!-- 表格start -->
  57. <el-table :data="list" style="width: 100%" >
  58. <el-table-column prop="member.uid" label="会员ID" align="center"></el-table-column>
  59. <el-table-column prop="member.nickname" label="会员" align="center">
  60. <template slot-scope="scope">
  61. <div v-if="scope.row.member">
  62. <img :src="scope.row.member.avatar_image" style="width:30px;height:30px;padding:1px;border:1px solid #ccc;">
  63. <div>[[scope.row.member.nickname]]</div>
  64. </div>
  65. <div v-else>
  66. <div>未更新</div>
  67. </div>
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="member.mobile" label="手机号" align="center"></el-table-column>
  71. <el-table-column prop="created_at" label="抽奖时间" align="center">
  72. </el-table-column>
  73. <el-table-column prop="prize_name" label="中奖信息" align="center">
  74. </el-table-column>
  75. <el-table-column prop="" label="奖励信息" align="center">
  76. <template slot-scope="scope">
  77. <div v-if="scope.row.coupon_id">
  78. <span>[[scope.row.prize_name]]</span>
  79. <span>优惠券:ID[[scope.row.coupon_id]]</span>
  80. </div>
  81. <div v-if="scope.row.point && scope.row.point != false">
  82. <span>[[scope.row.point]]</span>
  83. <span>积分</span>
  84. </div>
  85. <div v-if="scope.row.love && scope.row.love != false">
  86. <span>[[scope.row.love]]</span>
  87. <span>[[love_name]]</span>
  88. </div>
  89. <div v-if="scope.row.amount && scope.row.amount != false">
  90. <span>[[scope.row.amount]]</span>
  91. <span>余额</span>
  92. </div>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. <el-row>
  97. <el-col :span="24" align="right" migra style="padding:15px 5% 15px 0" v-loading="loading">
  98. <el-pagination background layout="prev, pager, next" @current-change="currentChange" :total="page_total"
  99. :page-size="page_size" :current-page="current_page"></el-pagination>
  100. </el-col>
  101. </el-row>
  102. <!-- 表格end -->
  103. </template>
  104. </template>
  105. </div>
  106. <script>
  107. var vm = new Vue({
  108. el: "#re_content",
  109. delimiters: ['[[', ']]'],
  110. data() {
  111. let logs={!! $logs?:'{}' !!}
  112. let love_name={!! $love_name ?: '爱心值' !!}
  113. let activityModel={!! $activityModel?:'{}' !!}
  114. let activity_id=activityModel.id
  115. let start_time=this.timestampToTime(activityModel.countdown_time[0])
  116. let end_time=this.timestampToTime(activityModel.countdown_time[1])
  117. return {
  118. love_name : love_name,
  119. list:[
  120. ...logs.data
  121. ],
  122. loading:false,
  123. activity_id:activity_id,
  124. page_total:logs.total,
  125. page_size:logs.per_page,
  126. current_page:logs.current_page,
  127. search_form:{},
  128. real_search_form:{},
  129. search_loading:false,
  130. all_loading:false,
  131. start_time:start_time,
  132. end_time:end_time,
  133. formData:{
  134. name:null,
  135. uid:null,
  136. times:null,
  137. start_time:null,
  138. end_time:null
  139. },
  140. }
  141. },
  142. mounted () {
  143. },
  144. methods: {
  145. timestampToTime(timestamp) {
  146. var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  147. var Y = date.getFullYear() + '-';
  148. var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
  149. var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
  150. var h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
  151. var m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
  152. var s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
  153. return Y+M+D+h+m+s;
  154. },
  155. currentChange(val) {
  156. this.loading = true;
  157. this.$http.post('{!! yzWebFullUrl('plugin.lucky-draw.admin.controllers.activity.searchRecord') !!}',{page:val,id:this.activity_id,search:this.real_search_form}).then(function (response){
  158. let datas = response.data.data.logs;
  159. this.page_total = datas.total;
  160. this.list = datas.data;
  161. this.page_size = datas.per_page;
  162. this.current_page = datas.current_page;
  163. this.loading = false;
  164. },function (response) {
  165. this.loading = false;
  166. }
  167. );
  168. },
  169. search() {
  170. this.search_loading = true;
  171. if(this.search_form.is_time != 0 && this.search_form.times){
  172. this.search_form.start_time = Math.round(this.search_form.times[0]/1000).valueOf();
  173. this.search_form.end_time = Math.round(this.search_form.times[1]/1000).valueOf();
  174. }
  175. else{
  176. this.search_form.start_time = '';
  177. this.search_form.end_time = '';
  178. }
  179. this.formData = JSON.parse(JSON.stringify(this.search_form));
  180. let json={
  181. search:this.search_form,
  182. id:this.activity_id
  183. }
  184. this.$http.post('{!! yzWebFullUrl('plugin.lucky-draw.admin.controllers.activity.searchRecord') !!}',json
  185. ).then(function (response) {
  186. if (response.data.result){
  187. let data = response.data.data.logs;
  188. this.page_total = data.total;
  189. this.list = data.data;
  190. this.page_size = data.per_page;
  191. this.current_page = data.current_page;
  192. this.loading = false;
  193. this.real_search_form=Object.assign({},this.search_form);
  194. }
  195. else {
  196. this.$message({message: response.data.msg,type: 'error'});
  197. }
  198. this.search_loading = false;
  199. },function (response) {
  200. this.search_loading = false;
  201. this.$message({message: response.data.msg,type: 'error'});
  202. }
  203. );
  204. },
  205. derive(){
  206. if(!this.formData.name){
  207. this.formData.name=null;
  208. }
  209. if(!this.formData.times){
  210. this.formData.times=null;
  211. this.formData.start_time=null;
  212. this.formData.end_time=null;
  213. }
  214. let host= '{!! yzWebFullUrl('plugin.lucky-draw.admin.controllers.activity.export') !!}'+'&search[name]='+this.formData.name+'&search[times]='+this.formData.times+'&search[start_time]='+this.formData.start_time+'&search[end_time]='+this.formData.end_time+'&search[id]='+this.activity_id;
  215. window.location.href=host;
  216. }
  217. },
  218. });
  219. </script>
  220. @endsection