message.blade.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. @extends('layouts.base')
  2. @section('title', '消息列表')
  3. @section('content')
  4. <link href="{{ static_url('yunshop/element-ui/2.10.1/css/index.css') }}" rel="stylesheet">
  5. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}" />
  6. <style>
  7. .el-button+.el-button {margin-left:0px;}
  8. .el-dialog__body{border-top:1px solid #dde2ee;border-bottom:1px solid #dde2ee;}
  9. </style>
  10. <div class="all">
  11. <div id="app" v-cloak>
  12. <div class="vue-head">
  13. <div class="vue-main-title" style="margin-bottom:20px">
  14. <div class="vue-main-title-left"></div>
  15. <div class="vue-main-title-content">消息列表</div>
  16. <div class="vue-main-title-button">
  17. <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">新建消息</el-button>
  18. </div>
  19. </div>
  20. <div class="vue-search">
  21. <el-form :inline="true" :model="search_form" class="demo-form-inline">
  22. <el-form-item label="">
  23. <el-input v-model="search_form.title" placeholder="标题"></el-input>
  24. </el-form-item>
  25. <el-form-item label="">
  26. <el-date-picker
  27. v-model="search_form.activity_time"
  28. type="datetimerange"
  29. value-format="timestamp"
  30. range-separator="至"
  31. start-placeholder="开始日期"
  32. end-placeholder="结束日期"
  33. style="margin-left:5px;"
  34. align="right">
  35. </el-date-picker>
  36. </el-form-item>
  37. <el-form-item label="">
  38. <el-button type="primary" @click="search(1)">搜索</el-button>
  39. </el-form-item>
  40. </el-form>
  41. </div>
  42. </div>
  43. <div class="vue-main">
  44. <div class="vue-main-form">
  45. <el-table :data="list" style="width: 100%">
  46. <el-table-column label="创建时间" align="center" prop="created_at"></el-table-column>
  47. <el-table-column label="标题" align="center" prop="title"></el-table-column>
  48. <el-table-column label="类型" align="center" prop="msg_type.name"></el-table-column>
  49. <el-table-column prop="refund_time" label="操作" align="center" width="260">
  50. <template slot-scope="scope">
  51. <a :href="'{{ yzWebFullUrl('plugin.instation-message.admin.message-log.index', array('id' => '')) }}'+[[scope.row.id]]"><el-button size="mini" >记录</el-button></a>
  52. <a :href="'{{ yzWebFullUrl('plugin.instation-message.admin.message.edit', array('id' => '')) }}'+[[scope.row.id]]+'&type=1'"><el-button size="mini" >编辑</el-button></a>
  53. <el-button size="mini" @click="Del(scope, list)">删除</el-button>
  54. <a :href="'{{ yzWebFullUrl('plugin.instation-message.admin.message.edit', array('id' => '')) }}'+[[scope.row.id]]+'&type=2'"><el-button size="mini">发送</el-button></a>
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. </div>
  59. </div>
  60. <!-- 分页 -->
  61. <div class="vue-page" v-if="total>0">
  62. <el-row>
  63. <el-col align="center" v-loading="loading">
  64. <el-pagination
  65. background
  66. @current-change="currentChange"
  67. :current-page="current_page"
  68. :page-size="page_size"
  69. layout=" prev, pager, next"
  70. :total="page_total">
  71. </el-pagination>
  72. </el-col>
  73. </el-row>
  74. </div>
  75. </div>
  76. </div>
  77. <script>
  78. var app = new Vue({
  79. el: "#app",
  80. delimiters: ['[[', ']]'],
  81. name: 'test',
  82. data() {
  83. return {
  84. loading:false,
  85. current_page:1,
  86. page_total:1,
  87. page:1,
  88. page_size:1,
  89. list:[],
  90. times:[],
  91. search_form:{
  92. title:'',
  93. start:'',
  94. end:'',
  95. },
  96. real_search_form:{},
  97. rules: {},
  98. current_page:1,
  99. total:1,
  100. per_page:1,
  101. }
  102. },
  103. created() {
  104. },
  105. mounted() {
  106. this.currentChange(1);
  107. },
  108. methods: {
  109. addModal(){
  110. window.location.href = '{!! yzWebFullUrl('plugin.instation-message.admin.message.create1') !!}';
  111. },
  112. Del(scope, rows){
  113. rows.splice(scope.$index, 1);
  114. let json={
  115. id:scope.row.id
  116. }
  117. this.$http.post('{!! yzWebFullUrl('plugin.instation-message.admin.message.del') !!}',json).then(function (response){
  118. if (response.data.result) {
  119. this.$message({message:"删除成功!",type:"success"});
  120. } else {
  121. this.$message({message:"删除成功!",type:"error"});
  122. }
  123. },function (response) {
  124. console.log(response);
  125. }
  126. );
  127. },
  128. search() {
  129. if(this.search_form.is_time != 0 && this.search_form.activity_time){
  130. this.search_form.start = Math.round(this.search_form.activity_time[0]/1000).valueOf();
  131. this.search_form.end = Math.round(this.search_form.activity_time[1]/1000).valueOf();
  132. }
  133. this.$http.post('{!! yzWebFullUrl('plugin.instation-message.admin.message.get-message-list') !!}',{search:this.search_form}
  134. ).then(function (response) {
  135. if (response.data.result){
  136. let data = response.data.data.list;
  137. this.page_total = data.total;
  138. this.list = data.data;
  139. this.page_size = data.per_page;
  140. this.current_page = data.current_page;
  141. this.loading = false;
  142. this.real_search_form=Object.assign({},this.search_form);
  143. }
  144. else {
  145. this.$message({message: response.data.msg,type: 'error'});
  146. }
  147. this.search_loading = false;
  148. },function (response) {
  149. this.search_loading = false;
  150. this.$message({message: response.data.msg,type: 'error'});
  151. }
  152. );
  153. },
  154. currentChange(val) {
  155. this.loading = true;
  156. this.$http.post('{!! yzWebFullUrl('plugin.instation-message.admin.message.get-message-list') !!}',{page:val,search:this.real_search_form}).then(function (response){
  157. let data = response.data.data.list;
  158. this.page_total = data.total;
  159. this.list = data.data;
  160. this.page_size = data.per_page;
  161. this.current_page = data.current_page;
  162. this.loading = false;
  163. },function (response) {
  164. console.log(response);
  165. this.loading = false;
  166. }
  167. );
  168. },
  169. },
  170. })
  171. </script>
  172. @endsection