record.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. .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.new-member-prize.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.nickname" 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.activity_time" value-format="timestamp" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  36. </el-form-item>
  37. <el-form-item >
  38. <a style="margin-right:10px;">
  39. <el-button type="success" icon="el-icon-search" @click="search()">搜索</el-button>
  40. </a>
  41. <a >
  42. <el-button type="primary" @click="derive">导出</el-button>
  43. </a>
  44. </el-form-item>
  45. </el-col>
  46. </el-row>
  47. </el-form>
  48. <!-- 表格start -->
  49. <el-table :data="list" style="width: 100%" v-loading="search_loading">
  50. <el-table-column prop="member.uid" label="会员ID" align="center">
  51. <template slot-scope="scope">
  52. <div v-if="scope.row.has_one_member">
  53. <div>[[scope.row.has_one_member.uid]]</div>
  54. </div>
  55. </template>
  56. </el-table-column>
  57. <el-table-column prop="member.nickname" label="会员昵称" align="center">
  58. <template slot-scope="scope">
  59. <div v-if="scope.row.has_one_member">
  60. <div>[[scope.row.has_one_member.nickname]]</div>
  61. </div>
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="member.mobile" label="手机号" align="center">
  65. <template slot-scope="scope">
  66. <div v-if="scope.row.has_one_member">
  67. <div>[[scope.row.has_one_member.mobile]]</div>
  68. </div>
  69. </template>
  70. </el-table-column>
  71. <el-table-column prop="member.mobile" label="领奖时间" align="center">
  72. <template slot-scope="scope">
  73. <div>
  74. <div>[[scope.row.created_at]]</div>
  75. </div>
  76. </template>
  77. </el-table-column>
  78. <el-table-column prop="has_one_prize" label="奖励信息" align="center">
  79. <template slot-scope="scope" >
  80. <div v-if="scope.row.has_one_coupon">
  81. <span>[[scope.row.coupon_name]]</span>
  82. <span>优惠券</span>
  83. </div>
  84. <div v-if="scope.row.point">
  85. <span>[[scope.row.point]]</span>
  86. <span>积分</span>
  87. </div>
  88. @if(app('plugins')->isEnabled('love'))
  89. <div v-if="scope.row.love">
  90. <span>[[scope.row.love]]</span>
  91. <span>[[love_name]]</span>
  92. </div>
  93. @endif
  94. <div v-if="scope.row.amount">
  95. <span>[[scope.row.amount]]</span>
  96. <span>余额</span>
  97. </div>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <el-row>
  102. <el-col :span="24" align="right" migra style="padding:15px 5% 15px 0" v-loading="loading">
  103. <el-pagination background layout="prev, pager, next" @current-change="currentChange" :total="page_total"
  104. :page-size="page_size" :current-page="current_page"></el-pagination>
  105. </el-col>
  106. </el-row>
  107. <!-- 表格end -->
  108. </template>
  109. </template>
  110. </div>
  111. <script>
  112. var vm = new Vue({
  113. el: "#re_content",
  114. delimiters: ['[[', ']]'],
  115. data() {
  116. return {
  117. love_name:'',
  118. activity:'',
  119. start_time:'',
  120. end_time:'',
  121. list:[],
  122. loading:false,
  123. activity_id:'',
  124. page_total:0,
  125. page_size:0,
  126. current_page:0,
  127. search_form:{},
  128. real_search_form:{},
  129. search_loading:false,
  130. all_loading:false,
  131. formData:{
  132. nickname:null,
  133. uid:null,
  134. activity_time:[],
  135. id:null
  136. },
  137. }
  138. },
  139. mounted () {
  140. this.GetUrlParam('id');
  141. },
  142. methods: {
  143. GetUrlParam(paraName) {
  144. var url = document.location.toString();
  145. var arrObj = url.split("?");
  146. if (arrObj.length > 1) {
  147. var arrPara = arrObj[1].split("&");
  148. var arr;
  149. for (var i = 0; i < arrPara.length; i++) {
  150. arr = arrPara[i].split("=");
  151. if (arr != null && arr[0] == paraName) {
  152. this.activity_id=arr[1]
  153. this.currentChange(1)
  154. return arr[1];
  155. }
  156. }
  157. return "";
  158. }
  159. else {
  160. return "";
  161. }
  162. },
  163. timestampToTime(timestamp) {
  164. var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  165. var Y = date.getFullYear() + '-';
  166. var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
  167. var D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
  168. var h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':';
  169. var m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
  170. var s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds());
  171. return Y+M+D+h+m+s;
  172. },
  173. currentChange(val) {
  174. this.loading = true;
  175. this.$http.post('{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.searchRecord') !!}',{page:val,id:this.activity_id,search:this.real_search_form}).then(function (response){
  176. this.activity=response.data.data.activity
  177. this.love_name=response.data.data.love_name
  178. this.start_time=this.timestampToTime(this.activity.start_time)
  179. this.end_time=this.timestampToTime(this.activity.end_time)
  180. let datas = response.data.data.logs;
  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.loading = false;
  186. },function (response) {
  187. console.log(response);
  188. this.loading = false;
  189. }
  190. );
  191. },
  192. derive(){
  193. let host= '{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.export') !!}'+'&search[nickname]='+this.formData.nickname+'&search[uid]='+this.formData.uid+'&search[activity_time]='+this.formData.activity_time+'&search[id]='+this.activity_id+'&id='+this.activity_id;
  194. window.location.href=host;
  195. },
  196. search() {
  197. this.search_loading = true;
  198. if(this.search_form.is_time != 0 && this.search_form.activity_time){
  199. this.search_form.activity_time[0] = Math.round(this.search_form.activity_time[0]/1000).valueOf();
  200. this.search_form.activity_time[1] = Math.round(this.search_form.activity_time[1]/1000).valueOf();
  201. }
  202. this.formData = JSON.parse(JSON.stringify(this.search_form));
  203. let json={
  204. search:this.search_form,
  205. id:this.activity_id
  206. }
  207. this.$http.post('{!! yzWebFullUrl('plugin.new-member-prize.admin.controllers.activity.searchRecord') !!}',json
  208. ).then(function (response) {
  209. if (response.data.result){
  210. let data = response.data.data.logs;
  211. this.page_total = data.total;
  212. this.list = data.data;
  213. this.page_size = data.per_page;
  214. this.current_page = data.current_page;
  215. this.loading = false;
  216. this.real_search_form=Object.assign({},this.search_form);
  217. }
  218. else {
  219. this.$message({message: response.data.msg,type: 'error'});
  220. }
  221. this.search_loading = false;
  222. },function (response) {
  223. this.search_loading = false;
  224. this.$message({message: response.data.msg,type: 'error'});
  225. }
  226. );
  227. },
  228. },
  229. });
  230. </script>
  231. @endsection