log.blade.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. @extends('layouts.base')
  2. @section('title', '优惠券领取发放记录')
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}" />
  5. <style>
  6. .edit-i{display:none;}
  7. .el-table_1_column_2:hover .edit-i{font-weight:900;padding:0;margin:0;display:inline-block;}
  8. .el-tabs__item,.is-top{font-size:16px}
  9. .el-tabs__active-bar { height: 3px;}
  10. </style>
  11. <div class="all">
  12. <div id="app" v-cloak>
  13. <div class="vue-nav" style="margin-bottom:15px">
  14. <el-tabs v-model="activeName" @tab-click="handleClick">
  15. <el-tab-pane label="优惠券设置" name="1"></el-tab-pane>
  16. <el-tab-pane label="优惠券列表" name="2"></el-tab-pane>
  17. <el-tab-pane label="领取发放记录" name="3"></el-tab-pane>
  18. <el-tab-pane label="分享领取记录" name="4"></el-tab-pane>
  19. <el-tab-pane label="使用记录" name="5"></el-tab-pane>
  20. <el-tab-pane label="领券中心幻灯片" name="6"></el-tab-pane>
  21. <el-tab-pane label="会员优惠券" name="7"></el-tab-pane>
  22. </el-tabs>
  23. </div>
  24. <div class="vue-head">
  25. <div class="vue-main-title" style="margin-bottom:20px">
  26. <div class="vue-main-title-left"></div>
  27. <div class="vue-main-title-content">优惠券领取发放记录</div>
  28. <div class="vue-main-title-button">
  29. </div>
  30. </div>
  31. <div class="vue-search">
  32. <el-form :inline="true" :model="search_form" class="demo-form-inline">
  33. <el-form-item label="">
  34. <el-input v-model="search_form.couponname" placeholder="优惠券名称"></el-input>
  35. </el-form-item>
  36. <el-form-item label="">
  37. <el-input v-model="search_form.member_keyword" placeholder="会员ID/昵称/姓名/手机号"></el-input>
  38. </el-form-item>
  39. <el-form-item label="">
  40. <div v-show="show_get_from">
  41. <el-select v-model="search_form.getfrom" clearable placeholder="领取还是发放" >
  42. <el-option label="用户领取" value="1"></el-option>
  43. <el-option label="商城发放" value="0"></el-option>
  44. </el-select>
  45. </div>
  46. </el-form-item>
  47. <el-form-item label="">
  48. <el-select v-model="search_form.timesearchswtich" clearable placeholder="是否搜索时间">
  49. <el-option label="不搜索时间" value="0"></el-option>
  50. <el-option label="搜索时间" value="1"></el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item label="">
  54. <el-date-picker
  55. v-model="times"
  56. type="datetimerange"
  57. value-format="timestamp"
  58. range-separator="至"
  59. start-placeholder="开始日期"
  60. end-placeholder="结束日期"
  61. style="margin-left:5px;"
  62. align="right">
  63. </el-date-picker>
  64. </el-form-item>
  65. <el-form-item label="">
  66. <el-button type="primary" @click="search(1)">搜索</el-button>
  67. <el-button type="primary" @click="dataExport()">导出</el-button>
  68. </el-form-item>
  69. </el-form>
  70. </div>
  71. </div>
  72. <div class="vue-main">
  73. <div class="vue-main-form">
  74. <el-table :data="list" style="width: 100%">
  75. <el-table-column label="ID" align="center" prop="id" width="80"></el-table-column>
  76. <el-table-column label="优惠券名称" align="center" prop="coupon.name"></el-table-column>
  77. <el-table-column label="用户名称" align="center" prop="member.nickname"></el-table-column>
  78. <el-table-column label="获取途径" align="center" width="120">
  79. <template slot-scope="scope">
  80. <span >[[ scope.row.getfrom_name ]]</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="创建时间" align="center" prop="createtime"></el-table-column>
  84. <el-table-column label="日志详情" align="center" prop="logno"></el-table-column>
  85. </el-table>
  86. </div>
  87. </div>
  88. <!-- 分页 -->
  89. <div class="vue-page" v-if="total>0">
  90. <el-row>
  91. <el-col align="right">
  92. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  93. :page-size="per_page" :current-page="current_page" background
  94. ></el-pagination>
  95. </el-col>
  96. </el-row>
  97. </div>
  98. </div>
  99. </div>
  100. <script>
  101. let id = {!! $id?:'0' !!};
  102. let member_id = {!! $member_id?:'0' !!};
  103. let getfrom = {!! $getfrom?:'0' !!};
  104. var app = new Vue({
  105. el: "#app",
  106. delimiters: ['[[', ']]'],
  107. name: 'test',
  108. data() {
  109. return {
  110. activeName:'3',
  111. id:id,
  112. member_id:member_id,
  113. getfrom:getfrom,
  114. list:[],
  115. times:[],
  116. show_get_from: true,
  117. search_form:{
  118. },
  119. rules: {},
  120. current_page:1,
  121. total:1,
  122. per_page:1,
  123. }
  124. },
  125. created() {
  126. },
  127. mounted() {
  128. if (this.member_id) {
  129. this.show_get_from = false;
  130. }
  131. this.getData(1);
  132. },
  133. methods: {
  134. getData(page) {
  135. let that = this;
  136. let json = {
  137. page:page,
  138. couponname:this.search_form.couponname,
  139. member_keyword:this.search_form.member_keyword,
  140. getfrom:this.search_form.getfrom || '',
  141. timesearchswtich:this.search_form.timesearchswtich,
  142. };
  143. if(this.search_form.couponname != ''){
  144. json.id = this.id
  145. }
  146. if (this.member_id) {
  147. json.member_id = this.member_id
  148. }
  149. if (this.getfrom) {
  150. json.getfrom = this.getfrom
  151. }
  152. if(this.times && this.times.length>0) {
  153. json.time = [];
  154. json.time = {start:this.times[0]/1000,end:this.times[1]/1000}
  155. }
  156. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  157. this.$http.post('{!! yzWebFullUrl('coupon.coupon.log') !!}',json).then(function(response) {
  158. if (response.data.result) {
  159. this.list = response.data.data.list.data;
  160. if(that.list){
  161. that.list.forEach(item => {
  162. if(item.createtime!=0){
  163. item.createtime = that.timeStyle(item.createtime);//时间格式转换
  164. }
  165. });
  166. }
  167. this.current_page=response.data.data.list.current_page;
  168. this.total=response.data.data.list.total;
  169. this.per_page=response.data.data.list.per_page;
  170. loading.close();
  171. } else {
  172. this.$message({
  173. message: response.data.msg,
  174. type: 'error'
  175. });
  176. }
  177. loading.close();
  178. }, function(response) {
  179. this.$message({
  180. message: response.data.msg,
  181. type: 'error'
  182. });
  183. loading.close();
  184. });
  185. },
  186. search(val) {
  187. this.getData(val);
  188. },
  189. dataExport(){
  190. var that = this;
  191. var url = "{!! yzWebFullUrl('coupon.coupon.export') !!}";
  192. var couponDataUrl = "{!! yzWebFullUrl('coupon.coupon.log') !!}";
  193. that.search_form.id = that.id
  194. const search_form = that.search_form;
  195. if (search_form.couponname) {
  196. url += "&couponname="+that.search_form.couponname;
  197. couponDataUrl += "&couponname="+that.search_form.couponname;
  198. }
  199. if (search_form.getfrom) {
  200. url += "&getfrom="+that.search_form.getfrom;
  201. couponDataUrl += "&getfrom="+that.search_form.getfrom;
  202. }
  203. if (search_form.nickname) {
  204. url += "&nickname="+that.search_form.nickname;
  205. couponDataUrl += "&nickname="+that.search_form.nickname;
  206. }
  207. if (search_form.timesearchswtich) {
  208. url += "&timesearchswtich="+that.search_form.timesearchswtich;
  209. couponDataUrl += "&timesearchswtich="+that.search_form.timesearchswtich;
  210. }
  211. if (search_form.id) {
  212. url += "&id="+search_form.id;
  213. couponDataUrl += "&id="+search_form.id;
  214. }
  215. if(this.times && this.times.length>0) {
  216. url += "&start=" + this.times[0]/1000;
  217. url += "&end=" + this.times[1]/1000
  218. couponDataUrl += "&time[start]=" + this.times[0]/1000;
  219. couponDataUrl += "&time[end]=" + this.times[1]/1000
  220. }
  221. // console.log(that.search_form)
  222. this.$confirm('确认导出? (提示: 导出数据为当前搜索条件后的数据)', '提示', {
  223. confirmButtonText: '确定',
  224. cancelButtonText: '取消',
  225. type: 'warning'
  226. }).then(async () => {
  227. let res = await this.$http.get(couponDataUrl)
  228. let couponDataCount = res.body.data.list.data.length ? res.body.data.list.data.length : 0
  229. if (couponDataCount > 0){
  230. this.$message({
  231. type: 'success',
  232. message: '导出中~, 请稍后!'
  233. });
  234. window.location.href = url;
  235. } else {
  236. this.$message({
  237. type: 'warning',
  238. message: '数据为空, 无法执行导出, 请确认搜索条件是否有数据.'
  239. });
  240. }
  241. }).catch(() => {
  242. this.$message({
  243. type: 'info',
  244. message: '已取消导出'
  245. });
  246. });
  247. },
  248. handleClick(val) {
  249. console.log(val.name)
  250. if(val.name == 1) {
  251. window.location.href = `{!! yzWebFullUrl('coupon.base-set.see') !!}`;
  252. }
  253. else if(val.name == 2) {
  254. window.location.href = `{!! yzWebFullUrl('coupon.coupon.index') !!}`;
  255. }
  256. else if(val.name == 3) {
  257. window.location.href = `{!! yzWebFullUrl('coupon.coupon.log-view') !!}`;
  258. }
  259. else if(val.name == 4) {
  260. window.location.href = `{!! yzWebFullUrl('coupon.share-coupon.log') !!}`;
  261. }
  262. else if(val.name == 5) {
  263. window.location.href = `{!! yzWebFullUrl('coupon.coupon-use.index') !!}`;
  264. }
  265. else if(val.name == 6) {
  266. window.location.href = `{!! yzWebFullUrl('coupon.slide-show') !!}`;
  267. }
  268. else if(val.name == 7) {
  269. window.location.href = `{!! yzWebFullUrl('coupon.member-coupon.index') !!}`;
  270. }
  271. },
  272. // 字符转义
  273. escapeHTML(a) {
  274. a = "" + a;
  275. return a.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'");;
  276. },
  277. add0(m) {
  278. return m<10?'0'+m:m
  279. },
  280. timeStyle(time) {
  281. let time1 = new Date(time*1000);
  282. let y = time1.getFullYear();
  283. let m = time1.getMonth()+1;
  284. let d = time1.getDate();
  285. let h = time1.getHours();
  286. let mm = time1.getMinutes();
  287. let s = time1.getSeconds();
  288. return y+'-'+this.add0(m)+'-'+this.add0(d)+' '+this.add0(h)+':'+this.add0(mm)+':'+this.add0(s);
  289. },
  290. },
  291. })
  292. </script>
  293. @endsection