index.blade.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. @extends('layouts.base')
  2. @section('title', '消息通知')
  3. <style>
  4. .content{padding:0 !important;}
  5. .vue-content{display:flex;margin: 0;width: 100%;font-weight: 500;}
  6. .vue-nav{position:fixed;width:170px;flex: 0 0 170px;overflow-y: auto;overflow-x: hidden;z-index:2;box-shadow: 0 10px 10px -12px rgba(0, 0, 0, 0.42), 0 4px 10px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.2);height: calc(100vh - 50px);}
  7. .nav-li{padding-left:15px;line-height: 35px;margin:5px 0;cursor: pointer;color:#333;color:#000;margin:5px 0;font-weight:300;font-family: arial, 'Hiragino Sans GB', 'Microsoft Yahei', '微软雅黑', '宋体', \5b8b\4f53, Tahoma, Arial, Helvetica, STHeiti;}
  8. .nav-li i{margin:0 5px;font-weight:600}
  9. .nav-li-tips{display:inline-block;background:#ff485d;color:#fff;border-radius: 8px 8px 8px 1px;position: relative;top:-10px;height: 15px;line-height: 15px;padding:0 5px;font-size: 12px;font-weight: 500;}
  10. .nav-li-selected{font-weight: 600;background: #f5f5f5;}
  11. .message{flex:1;background: #f5f5f5;margin-left: 170px;}
  12. .message-top{margin:15px;background:#fff;border-radius: 8px;padding:15px;}
  13. .message-top-title{line-height: 18px;border-left: 5px solid #29ba9c;padding-left:20px;flex:1;font-size:14px;font-weight: 600;}
  14. .message-top-read{text-align: right;flex:0 0 150px;cursor: pointer;font-size:14px;font-weight: 600;margin-right:20px}
  15. .message-top-read:hover{color:#29ba9c}
  16. .search{margin-top:30px;}
  17. .message-content{display: flex;justify-content: start;flex-wrap: wrap;margin-bottom: 55px;}
  18. .message-li{width: 50%;margin:15px 0;}
  19. .message-li-col{display:flex;flex-direction: column;margin:0 15px;padding:15px;border-radius: 8px;height: 150px;overflow: hidden;background: #fff;}
  20. .message-li-one{display:flex;align-items: center;font-size: 15px;overflow: hidden;}
  21. .message-li-one-icon{width:60px;height:60px;line-height:60px;border-radius: 50px;position: relative;}
  22. .green{background: #29ba9c;}
  23. .yellow{background: #ffba00;}
  24. .red{background: #ff0084;}
  25. .blue{background: #00a2ff;}
  26. .purple{background: #632dff;}
  27. .orange{background: #ff6a28;}
  28. .message-li-one-icon i{font-size: 26px;color:#fff;padding-left: 17px;}
  29. .red-rod{background:#f00;width: 8px;height: 8px;border-radius: 50px;position: absolute;top:0;right: 0;}
  30. .message-li-one-con{display:flex;flex-direction: column;align-items: flex-start;flex:1;margin-left:20px;overflow: hidden;text-overflow:ellipsis;margin-right: 20px; }
  31. .message-li-one-title{font-weight: 600;color:#000;}
  32. .message-li-one-hh{text-overflow:ellipsis;height:23.33px; overflow: hidden;text-overflow: ellipsis;-webkit-text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp:1;-webkit-box-orient: vertical;}
  33. .message-li-one-order{display:flex;flex-wrap:wrap;width:100%;font-size:12px;color:#999;overflow: hidden;line-height: 23.33px;}
  34. .message-li-one-order1{width:48%;overflow: hidden;word-break: keep-all;text-overflow: ellipsis;}
  35. .message-li-one-order2{width:39%;overflow: hidden;text-overflow: ellipsis;white-space:nowrap}
  36. .message-li-two{flex:1;align-items: flex-end;display:flex;}
  37. .message-li-two-time{flex:1;color:#999;font-size:12px;}
  38. .message-li-two-more{margin-right: 20px;color:#ffae01;cursor: pointer;}
  39. .message-li-two-more a{color:#ffae01}
  40. [v-cloak] {display: none;}
  41. </style>
  42. @section('content')
  43. <div class="all">
  44. <div id="app" v-cloak v-loading="loading">
  45. <link rel="stylesheet" href="//at.alicdn.com/t/font_432132_fpp3d6mr6kk.css">
  46. <div class="vue-content">
  47. <div class="vue-nav">
  48. <div class="nav-li" :class="{'nav-li-selected':nav_index==1}" @click="chooseMenu(1)">
  49. <div style="display:inline-block">
  50. <i class="iconfont icon-ht_list_line_allmessage" style="padding-right:5px"></i>全部消息
  51. </div>
  52. <div class="nav-li-tips" v-if="msgType[0] && msgType[0].has_many_log_count>0">[[msgType[0].has_many_log_count]]</div>
  53. </div>
  54. <div class="nav-li" :class="{'nav-li-selected':nav_index==2}" @click="chooseMenu(2)">
  55. <div style="display:inline-block">
  56. <i class="iconfont icon-ht_list_line_system" style="padding-right:5px"></i>系统通知
  57. </div>
  58. <div class="nav-li-tips" v-if="msgType[1] &&msgType[1].has_many_log_count>0">[[msgType[1].has_many_log_count]]</div>
  59. </div>
  60. <div class="nav-li" :class="{'nav-li-selected':nav_index==3}" @click="chooseMenu(3)">
  61. <div style="display:inline-block">
  62. <i class="iconfont icon-ht_list_line_apply" style="padding-right:5px"></i>申请通知
  63. </div>
  64. <div class="nav-li-tips" v-if="msgType[4] && msgType[4].has_many_log_count>0">[[msgType[4].has_many_log_count]]</div>
  65. </div>
  66. <div class="nav-li" :class="{'nav-li-selected':nav_index==4}" @click="chooseMenu(4)">
  67. <div style="display:inline-block">
  68. <i class="iconfont icon-ht_list_line_goods" style="padding-right:5px"></i>商品通知
  69. </div>
  70. <div class="nav-li-tips" v-if="msgType[5] && msgType[5].has_many_log_count>0">[[msgType[5].has_many_log_count]]</div>
  71. </div>
  72. <div class="nav-li" :class="{'nav-li-selected':nav_index==5}" @click="chooseMenu(5)">
  73. <div style="display:inline-block">
  74. <i class="iconfont icon-ht_list_line_coupons" style="padding-right:5px"></i>优惠券
  75. </div>
  76. <div class="nav-li-tips" v-if="msgType[6] && msgType[6].has_many_log_count>0">[[msgType[6].has_many_log_count]]</div>
  77. </div>
  78. <div class="nav-li" :class="{'nav-li-selected':nav_index==6}" @click="chooseMenu(6)">
  79. <div style="display:inline-block">
  80. <i class="iconfont icon-ht_list_line_order" style="padding-right:5px"></i>订单通知
  81. </div>
  82. <div class="nav-li-tips" v-if="msgType[2] && msgType[2].has_many_log_count>0">[[msgType[2].has_many_log_count]]</div>
  83. </div>
  84. <div class="nav-li" :class="{'nav-li-selected':nav_index==7}" @click="chooseMenu(7)">
  85. <div style="display:inline-block">
  86. <i class="iconfont icon-ht_list_line_tixian" style="padding-right:5px"></i>提现通知
  87. </div>
  88. <div class="nav-li-tips" v-if="msgType[3] && msgType[3].has_many_log_count>0">[[msgType[3].has_many_log_count]]</div>
  89. </div>
  90. <div class="nav-li" :class="{'nav-li-selected':nav_index==8}" @click="chooseMenu(8)">
  91. <div style="display:inline-block">
  92. <i class="iconfont icon-ht_list_line_tixian" style="padding-right:5px"></i>退款通知
  93. </div>
  94. <div class="nav-li-tips" v-if="msgType[7] && msgType[7].has_many_log_count>0">[[msgType[7].has_many_log_count]]</div>
  95. </div>
  96. </div>
  97. <div class="message" v-if="view">
  98. <div class="message-top">
  99. <div class="" style="display:flex;align-items: center;">
  100. <div class="message-top-title">系统消息通知</div>
  101. <div class="message-top-read" @click="readAll">全部标记为已读</div>
  102. </div>
  103. <div class="search">
  104. <el-form :inline="true" :model="search_form" ref="search_form" style="margin-left:10px;">
  105. <el-row>
  106. <el-form-item label="" prop="">
  107. <el-date-picker v-model="search_form.times" type="datetimerange" value-format="timestamp" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
  108. </el-date-picker>
  109. </el-form-item>
  110. <el-form-item label="" prop="">
  111. <el-select v-model="search_form.is_read" placeholder="请选择消息状态" clearable>
  112. <el-option v-for="item in status_list" :key="item.id" :label="item.word" :value="item.id"></el-option>
  113. </el-select>
  114. </el-form-item>
  115. <a href="#">
  116. <el-button type="primary" icon="el-icon-search" @click="search(1)">搜索
  117. </el-button>
  118. </a>
  119. </el-col>
  120. </el-row>
  121. </el-form>
  122. </div>
  123. </div>
  124. <div class="message-content">
  125. <div class="message-li" v-for="(item,index) in list">
  126. <div class="message-li-col">
  127. <div class="message-li-one">
  128. <div class="message-li-one-icon" :class="item.bgcolor">
  129. <i class="iconfont" :class="item.belongs_to_type.icon_src"></i>
  130. <div class="red-rod" v-if="item.is_read==0"></div>
  131. </div>
  132. <div class="message-li-one-con">
  133. <div class="message-li-one-title message-li-one-hh">[[item.title]]</div>
  134. <div class="message-li-one-order" v-if="item.type_id!=1">
  135. <div class="message-li-one-order1" v-for="(item1,index1) in item.message" :key="index1">[[item1]]</div>
  136. </div>
  137. </div>
  138. </div>
  139. <div class="message-li-two">
  140. <div class="message-li-two-time">[[item.created_at]]</div>
  141. <div class="message-li-two-more" @click="read(item)">查看详情>></div>
  142. </div>
  143. </div>
  144. </div>
  145. <div v-if="list.length<=0" style="text-align:center;width:100%;font-size:32px;font-weight:600;margin:30px 0">~~暂无更多~~</div>
  146. <div style="position:fixed;padding:15px;background:#fff;width:calc(100vw - 266px);text-align:center;bottom:0;box-shadow: 0 2px 9px rgba(51, 51, 51, 0.1);">
  147. <el-pagination layout="prev, pager, next,jumper"
  148. @current-change="search" :total="total"
  149. :page-size="per_page"
  150. :current-page="current_page"
  151. background
  152. ></el-pagination>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. <script>
  160. let all_url = '{!! yzWebFullUrl('sysMsg.system-msg.all-message') !!}';
  161. let system_url = '{!! yzWebFullUrl('sysMsg.system-msg.sys-message') !!}';
  162. let order_url = '{!! yzWebFullUrl('sysMsg.system-msg.order-message') !!}';
  163. let withdraw_url = '{!! yzWebFullUrl('sysMsg.system-msg.withdrawal-message') !!}';
  164. let apply_url = '{!! yzWebFullUrl('sysMsg.system-msg.apply-message') !!}';
  165. let stock_url = '{!! yzWebFullUrl('sysMsg.system-msg.stock-message') !!}';
  166. let coupon_url = '{!! yzWebFullUrl('sysMsg.system-msg.coupon-message') !!}';
  167. let refund_url = '{!! yzWebFullUrl('sysMsg.system-msg.refund-message') !!}';
  168. console.log(all_url)
  169. var app = new Vue({
  170. el:"#app",
  171. delimiters: ['[[', ']]'],
  172. name: 'test',
  173. data() {
  174. return{
  175. nav_index:1,
  176. search_form:{},
  177. status_list:[{id:'',word:'全部'},{id:0,word:'未读'},{id:1,word:'已读'}],
  178. list:[],
  179. data_url : '',
  180. all_total:0,
  181. msgType:[{},{},{},{},{},{},{}],
  182. // more
  183. total:0,
  184. current_page:1,
  185. per_page:1,
  186. loading:false,
  187. view:false,
  188. }
  189. },
  190. created() {
  191. this.data_url = all_url;
  192. this.getData(this.data_url);
  193. },
  194. mounted() {
  195. },
  196. methods: {
  197. search(page) {
  198. console.log(this.search_form)
  199. let start = '';
  200. let end = '';
  201. if(this.search_form.times) {
  202. start = this.search_form.times[0]/1000;
  203. end = this.search_form.times[1]/1000;
  204. }
  205. let json = {
  206. search:{
  207. time:{start:start,end:end},
  208. is_read:this.search_form.is_read
  209. },
  210. page:page
  211. }
  212. if(!json.search.time.start) {
  213. json.search.time = {}
  214. }
  215. console.log(json)
  216. this.getData(this.data_url,json);
  217. },
  218. chooseMenu(index) {
  219. if(this.nav_index == index) {
  220. return;
  221. }
  222. this.nav_index = index;
  223. this.search_form = {};
  224. switch(index){
  225. case 1:
  226. this.data_url = all_url;
  227. break;
  228. case 2:
  229. this.data_url = system_url;
  230. break;
  231. case 3:
  232. this.data_url = apply_url;
  233. break;
  234. case 4:
  235. this.data_url = stock_url;
  236. break;
  237. case 5:
  238. this.data_url = coupon_url;
  239. break;
  240. case 6:
  241. this.data_url = order_url;
  242. break;
  243. case 7:
  244. this.data_url = withdraw_url;
  245. break;
  246. case 8:
  247. this.data_url = refund_url;
  248. break;
  249. default:
  250. break;
  251. }
  252. this.getData(this.data_url);
  253. },
  254. getData(url,json) {
  255. this.loading = true;
  256. this.$http.post(url,json).then(function (response) {
  257. if (response.data.result){
  258. this.loading = false;
  259. this.view = true;
  260. this.list = response.data.data.list.data;
  261. this.list.forEach((item,index) => {
  262. this.list[index].message = [];
  263. this.list[index].message = item.content.split("||");
  264. if(item.type_id==1){
  265. this.list[index].bgcolor = 'green'
  266. }
  267. if(item.type_id==2){
  268. this.list[index].bgcolor = 'yellow'
  269. }
  270. if(item.type_id==3){
  271. this.list[index].bgcolor = 'red'
  272. }
  273. if(item.type_id==4){
  274. this.list[index].bgcolor = 'blue'
  275. }
  276. if(item.type_id==5){
  277. this.list[index].bgcolor = 'purple'
  278. }
  279. if(item.type_id==6){
  280. this.list[index].bgcolor = 'orange'
  281. }
  282. if(item.type_id==7){
  283. this.list[index].bgcolor = 'orange'
  284. }
  285. });
  286. this.total = response.data.data.list.total;
  287. this.per_page = response.data.data.list.per_page;
  288. this.current_page = response.data.data.list.current_page;
  289. if(!this.msgType[0].has_many_log_count || this.msgType[0].has_many_log_count==0) {
  290. this.msgType = response.data.data.msgType || [{},{},{},{},{},{},{}];
  291. }
  292. }
  293. else {
  294. this.$message({message: response.data.msg,type: 'error'});
  295. this.loading = false;
  296. }
  297. },function (response) {
  298. this.$message({message: response.data.msg,type: 'error'});
  299. this.loading = false;
  300. }
  301. );
  302. },
  303. read(item) {
  304. console.log('{!! yzWebFullUrl('sysMsg.system-msg.read-system-message') !!}'+'&id='+item.id)
  305. // return;
  306. this.loading = true;
  307. let json = {
  308. id:item.id,
  309. type:0,
  310. }
  311. this.$http.post('{!! yzWebFullUrl('sysMsg.system-msg.read-log') !!}',json).then(function (response) {
  312. if (response.data.result){
  313. this.loading = false;
  314. if(item.redirect_url) {
  315. window.location.href=item.redirect_url;
  316. }
  317. else {
  318. window.location.href='{!! yzWebFullUrl('sysMsg.system-msg.read-system-message') !!}'+'&id='+item.id;
  319. }
  320. }
  321. else {
  322. this.$message({message: response.data.msg,type: 'error'});
  323. this.loading = false;
  324. }
  325. },function (response) {
  326. this.$message({message: response.data.msg,type: 'error'});
  327. this.loading = false;
  328. })
  329. },
  330. readAll() {
  331. this.loading = true;
  332. let json = {
  333. type:1,
  334. }
  335. this.$http.post('{!! yzWebFullUrl('sysMsg.system-msg.read-log') !!}',json).then(function (response) {
  336. if (response.data.result){
  337. this.loading = false;
  338. window.location.reload();
  339. }
  340. else {
  341. this.$message({message: response.data.msg,type: 'error'});
  342. this.loading = false;
  343. }
  344. },function (response) {
  345. this.$message({message: response.data.msg,type: 'error'});
  346. this.loading = false;
  347. })
  348. }
  349. },
  350. })
  351. </script>
  352. @endsection