push-message-vue.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. @extends('layouts.base')
  2. @section('title', "推送消息")
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods.css')}}"/>
  5. <div id="qrcode" ref="qrcode" style="display:none;"></div>
  6. <div class="rightlist">
  7. <div id="app" v-cloak v-loading="all_loading">
  8. <template>
  9. <div class="second-list">
  10. <div class="third-list">
  11. <div class="form-list">
  12. <el-form :inline="true" :model="search_form" ref="search_form" style="margin-left:10px;">
  13. <el-row>
  14. <el-form-item>
  15. <el-select v-model="search_form.type" placeholder="请选择状态" clearable >
  16. <el-option v-for="item,index in category.msg" :key="index" :label="item" :value="index"></el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item label="">
  20. <el-date-picker
  21. v-model="times"
  22. type="datetimerange"
  23. value-format="yyyy-MM-dd HH:mm:ss"
  24. range-separator="至"
  25. start-placeholder="开始日期"
  26. end-placeholder="结束日期"
  27. style="margin-left:5px;"
  28. align="right">
  29. </el-date-picker>
  30. </el-form-item>
  31. <el-button type="primary" icon="el-icon-search" @click="getMessageList(1)">搜索</el-button>
  32. <el-button type="danger" icon="el-icon-warning" @click="clean()">清空数据</el-button>
  33. </el-col>
  34. </el-row>
  35. </el-form>
  36. </div>
  37. <div class="table-list">
  38. <div>
  39. @section('search')
  40. <template>
  41. <!-- 表格start -->
  42. <el-table :data="message_list" style="width: 100%" :class="table_loading==true?'loading-height':''" v-loading="table_loading">
  43. <el-table-column prop="id" label="ID" width="70" align="center"></el-table-column>
  44. </el-table-column>
  45. <el-table-column prop="type_name" label="消息类型" max-width="150" align="center">
  46. <template slot-scope="scope">
  47. [[scope.row.type_array.type_name]]
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="content_name" label="内容" width="800" align="center">
  51. <template slot-scope="scope">
  52. <a :href="'{{yzWebUrl('plugin.yz-supply.admin.shop-goods.edit', ['id' => ''])}}'+[[scope.row.goods_id]]" v-if="scope.row.type_array.type_order_or_goods == 1">
  53. 商品id:[[scope.row.goods_id]]
  54. </a>
  55. <a :href="'{!! yzWebUrl('plugin.yz-supply.admin.order-list.detail',['id'=>''])!!}'+[[scope.row.order_id]]" v-if="scope.row.type_array.type_order_or_goods != 1">
  56. 订单id:[[scope.row.order_id]]
  57. </a>
  58. </template>
  59. </el-table-column>
  60. <el-table-column prop="created_at" label="时间" width="200" align="center">
  61. <template slot-scope="scope">
  62. [[scope.row.created_at]]
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <!-- 表格end -->
  67. </template>
  68. @show
  69. </div>
  70. </div>
  71. </div>
  72. <!-- 分页 -->
  73. <div class="vue-page" v-show="total>1">
  74. <el-row>
  75. <el-col align="right">
  76. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total" :page-size="per_size" :current-page="current_page" background v-loading="loading"></el-pagination>
  77. </el-col>
  78. </el-row>
  79. </div>
  80. </div>
  81. </template>
  82. </div>
  83. </div>
  84. <script src="{{resource_get('static/js/qrcode.min.js')}}"></script>
  85. <script>
  86. var app = new Vue({
  87. el:"#app",
  88. delimiters: ['[[', ']]'],
  89. data() {
  90. let category = JSON.parse('{!! $category !!}');
  91. return{
  92. category:category,
  93. times:[],
  94. message_list:[],//商品列表
  95. table_loading:false,
  96. all_loading:false,
  97. loading:false,
  98. search_form:{},
  99. //分页
  100. total:0,
  101. per_size:0,
  102. current_page:0,
  103. }
  104. },
  105. created() {
  106. console.log('category');
  107. console.log(this.category)
  108. this.getMessageList();
  109. },
  110. methods: {
  111. /*
  112. 清空数据
  113. */
  114. clean(){
  115. let that = this;
  116. that.$confirm('确定情况所有消息吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  117. that.table_loading = true;
  118. that.$http.post("{!! yzWebFullUrl('plugin.yz-supply.admin.push-message.clean') !!}",{}).then(response => {
  119. if(response.data.result==1){
  120. that.$message.success("清除成功!");
  121. that.getMessageList(1);
  122. }
  123. else{
  124. that.$message.error(response.data.msg);
  125. }
  126. that.table_loading = false;
  127. }),function(res){
  128. console.log(res);
  129. that.table_loading = false;
  130. };
  131. }).catch(() => {
  132. this.$message({type: 'info',message: '已取消'});
  133. });
  134. },
  135. getMessageList(page){
  136. var that = this;
  137. console.log(this.times);
  138. this.search_form.start_time = "";
  139. this.search_form.end_time = "";
  140. if(this.times && this.times.length>0) {
  141. this.search_form.start_time = this.times[0];
  142. this.search_form.end_time = this.times[1];
  143. }
  144. that.table_loading = true;
  145. that.$http.post("{!! yzWebFullUrl('plugin.yz-supply.admin.push-message.index') !!}",{page:page,search:that.search_form}).then(response => {
  146. console.log(response);
  147. if(response.data.result==1){
  148. that.message_list = response.data.data.page_data.data;
  149. that.total = response.data.data.page_data.total;
  150. that.current_page = response.data.data.page_data.current_page;
  151. that.per_size = response.data.data.page_data.per_page;
  152. }
  153. else{
  154. that.$message.error(response.data.msg);
  155. }
  156. that.table_loading = false;
  157. }),function(res){
  158. console.log(res);
  159. that.table_loading = false;
  160. };
  161. },
  162. // 搜索、分页
  163. search(page) {
  164. this.getMessageList(page);
  165. },
  166. // 上一页
  167. prev() {
  168. let page = parseInt(this.current_page) - 1;
  169. if (page < 1) {
  170. return false;
  171. }
  172. this.getMessageList(page);
  173. },
  174. //下一页
  175. next() {
  176. let page = parseInt(this.current_page) + 1;
  177. if (this.per_size < this.page_number) {
  178. return false;
  179. }
  180. this.getMessageList(page);
  181. },
  182. //跳页
  183. jumpPage() {
  184. if (this.current_page <= 1) {
  185. this.current_page = 1;
  186. }
  187. // if(this.current_page>100){
  188. // this.current_page = 100
  189. // }
  190. this.getMessageList(this.current_page);
  191. },
  192. },
  193. })
  194. </script>
  195. @endsection