list.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title></title>
  8. <link rel="stylesheet" type="text/css" href="../../css/api.css" />
  9. <link rel="stylesheet" type="text/css" href="../../css/iconfont.css" />
  10. <link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
  11. <link rel="stylesheet" type="text/css" href="../../css/example.css" />
  12. <link rel="stylesheet" type="text/css" href="../../css/style.css?v=1.2" />
  13. <style>
  14. body {
  15. background: #f2f2f2;
  16. }
  17. .msg-list{
  18. height: 100%
  19. }
  20. .bgf2{
  21. background: #f2f2f2;
  22. height: auto;
  23. padding-bottom: 1rem;
  24. }
  25. .msg-cent-list{
  26. /*width: 100%;*/
  27. /*height: 2.4rem;*/
  28. background: #ffffff;
  29. border-radius: 0.1rem;
  30. padding: 0.3rem;
  31. box-sizing: border-box;
  32. position: relative;
  33. /*box-shadow: darkgrey 0.1rem 0.1rem 0.3rem 0.05rem;*/
  34. }
  35. .msg-cent-right-title {
  36. font-size: 0.3rem;
  37. color: #333;
  38. }
  39. .msg-cent-list ul {
  40. width: 100%;
  41. display: inline-block;
  42. }
  43. .msg-cent-list li{
  44. float: left;
  45. width: 100%;
  46. }
  47. .msg-cent-right-dtl{
  48. font-size: 0.26rem;
  49. color: #999;
  50. }
  51. .msg-time{
  52. color: #bbb;
  53. width: 100%;
  54. text-align:center;
  55. padding: 0.3rem 0;
  56. /*font-size: 0.22rem;*/
  57. }
  58. .member-avatar{
  59. width: 0.3rem;
  60. height: 0.3rem;
  61. border-radius:50%;
  62. vertical-align:middle;
  63. margin-bottom: 0.05rem;
  64. }
  65. button.el-button {
  66. background: #f2f2f2;
  67. margin-left: 0.2rem;
  68. }
  69. button.el-button, .feed-btn,.tel-btn{
  70. float:right;
  71. font-size: 0.24rem;
  72. }
  73. .el-button.is-round {
  74. border-radius: 0.5rem;
  75. margin-top: -0.1rem;
  76. }
  77. .is_read div {
  78. color: #999;
  79. }
  80. .weui-loadmore_line .weui-loadmore__tips {
  81. background-color: rgba(0, 0, 0, 0)
  82. }
  83. .weui-media-box__info__meta img {
  84. border-radius: 0.25rem;width: 0.35rem;vertical-align: middle;margin-right: 0.2rem;
  85. }
  86. .weui-media-box_appmsg .weui-media-box__thumb {
  87. border-radius: 0.2em;
  88. }
  89. .page__hd {
  90. padding: 0.2rem;
  91. }
  92. .page__bd .msg-cent-list {
  93. margin: 0 0.32rem;
  94. }
  95. .page__desc, .page__title {
  96. text-align: center;
  97. }
  98. a.weui-media-box:active {
  99. background-color: #ffffff;
  100. }
  101. .weui-media-box__info a.weui-btn_mini {
  102. position: absolute;
  103. float: right;
  104. right: 0.2rem;
  105. margin-top: -0.7rem;
  106. }
  107. .page__bd .weui-media-box__desc {
  108. -webkit-line-clamp: 3;
  109. color: #666;
  110. }
  111. .weui-media-box__info__meta {
  112. color: #999;
  113. }
  114. .hotel_credit {
  115. font-size: 0.47rem;
  116. position: absolute;
  117. margin-top: -0.2rem;
  118. color: #000000;
  119. font-family: Medium;
  120. font-weight: 500;
  121. }
  122. .home-hotel-title {
  123. font-size: 0.27rem;
  124. overflow: hidden;
  125. white-space: nowrap;
  126. text-overflow: ellipsis;
  127. color: #000;
  128. font-weight: 700;
  129. }
  130. .hotel_list {
  131. padding: 0.32rem;
  132. background-color: #fff;
  133. }
  134. </style>
  135. <script>
  136. (function(w, d, m) {
  137. function r() {
  138. var t = 100,
  139. o = 750,
  140. e = d.documentElement.clientWidth || w.innerWidth,
  141. n = m.max(m.min(e, 480), 320),
  142. h = 50;
  143. 320 >= n && (h = m.floor(n / o * t * .99)),
  144. n > 320 && 362 >= n && (h = m.floor(n / o * t * 1)),
  145. n > 362 && 375 >= n && (h = m.floor(n / o * t * 1)),
  146. n > 375 && (h = m.floor(n / o * t * .97)),
  147. d.querySelector("html").style.fontSize = h + "px"
  148. };
  149. r();
  150. w.onresize = function() {
  151. r()
  152. }
  153. })(window, document, Math);
  154. </script>
  155. </head>
  156. <body>
  157. <div class="topbar"></div>
  158. <section style="background:#ffffff;">
  159. <header class="back-header">
  160. <ul>
  161. <li class="padding-20 back-btn"><img class="back-header-ico" src="../../image/nav_button_back_default.png" /></li>
  162. <li class="back-header-title" id="header-title">首 页</li>
  163. <li class="more-btn"></li>
  164. </ul>
  165. </header>
  166. </section>
  167. <section class="msg-list padding-top page panel js_show">
  168. <div class="page__hd mask-hidden" style="text-align: center;">
  169. <p class="page__desc">我管辖的酒店</p>
  170. <h1 class="page__title">500家</h1>
  171. </div>
  172. <div class="weui-search-bar mask-hidden" id="searchBar">
  173. <form class="weui-search-bar__form" onsubmit="return false;">
  174. <div class="weui-search-bar__box">
  175. <i class="weui-icon-search"></i>
  176. <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="搜索" />
  177. <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
  178. </div>
  179. <label class="weui-search-bar__label" id="searchText" style="transform-origin: 0px 0px; opacity: 1; transform: scale(1, 1);">
  180. <i class="weui-icon-search"></i>
  181. <span>搜索</span>
  182. </label>
  183. </form>
  184. <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
  185. </div>
  186. <div class="page__bd" id="list_all"></div>
  187. <div class="page__ft">
  188. <a href="#" class="mask-hidden">@QZaiwang.com</a>
  189. </div>
  190. </section>
  191. </body>
  192. <script type="text/javascript" src="../../script/api.js"></script>
  193. <script type="text/javascript" src="../../script/jquery.min.js"></script>
  194. <script type="text/javascript" src="../../script/jquery.tap.js"></script>
  195. <script type="text/javascript">
  196. var _tag = 'replenishment';
  197. var _page = '1';
  198. var _keyword = '0';
  199. apiready = function() {
  200. _tag = api.pageParam.type;
  201. setFixStatusBar();
  202. getRouteData();
  203. api.addEventListener({
  204. name: 'scrolltobottom'
  205. }, function(ret, err) {
  206. _page = '1';
  207. getRouteData();
  208. });
  209. api.addEventListener({
  210. name: 'resume'
  211. }, function(ret, err) {
  212. getRouteData();
  213. });
  214. };
  215. function getRouteData(_keywordx, _pagex) {
  216. if (_pagex == 1) {
  217. _page = '1';
  218. }
  219. if ( !_page ) {
  220. return false;
  221. }
  222. var _data = { page: _page };
  223. if ( _keywordx != 0 ) {
  224. _data = {keyword: _keywordx, page: _page};
  225. }
  226. if ( _tag == 'hotel' ) {
  227. _tag = 'store';
  228. }
  229. $.ajax({
  230. url: siteurl + 'v1/agent/'+ _tag +'List',
  231. data: _data,
  232. headers: { "X-TOKEN": $api.getStorage("accesstoken") },
  233. dataType: 'json',
  234. type: 'post',
  235. success: function(datas) {
  236. if (datas.result) {
  237. if (datas.data.list.length > 0) {
  238. var _html = '';
  239. $.each(datas.data.list, function (index, item) {
  240. switch (_tag) {
  241. case 'post':
  242. $("#header-title").html('平台公告');
  243. _html += '<div class="weui-panel"><div class="weui-panel__bd"><a href="javascript:post_Info('+item.article_id+');" class="weui-media-box weui-media-box_text"><h4 class="weui-media-box__title">'+item.article_title+'</h4><p class="weui-media-box__desc">'+item.article_desc+'</p><ul class="weui-media-box__info"><li class="weui-media-box__info__meta">'+item.article_time+'</li></ul></a></div></div>';
  244. break;
  245. case 'urge':
  246. $("#header-title").html('催单消息');
  247. // _html += '<div class="weui-panel"><div class="weui-panel__bd"><div class="weui-media-box weui-media-box_text"><h4 class="weui-media-box__title">'+item.am_title+'</h4><p class="weui-media-box__desc">'+item.am_extra.content+'</p><p class="weui-media-box__desc">订单号 '+item.am_extra.order_sn+'</p><ul class="weui-media-box__info"><li class="weui-media-box__info__meta"><img src="'+item.am_extra.member_avatar+'">'+item.am_extra.name+'</li><li class="weui-media-box__info__meta">时间</li><li class="weui-media-box__info__meta weui-media-box__info__meta_extra">'+item.am_create_time+'</li><li><a href="javascript:urge_tel('+item.am_extra.store_phone+');" class="weui-btn weui-btn_mini weui-btn_primary">联系酒店</a></li></ul></div></div></div>';
  248. _html += '<div class="msg-time" keyid="' + item.am_target_id + '">' + item.am_create_time + '</div>';
  249. if (item.am_is_read == 0) {
  250. _html += '<div class="msg-cent-list" keyid="' + item.am_target_id + '" tag="' + item.types + '"><ul>';
  251. }else{
  252. _html += '<div class="msg-cent-list is_read" keyid="' + item.am_target_id + '" tag="' + item.types + '"><ul>';
  253. }
  254. _html += '<li class="msg-cent-right"><div class="msg-cent-right-title">' + item.am_title + '</div>';
  255. _html += '<div class="h50"></div>';
  256. _html += '<div class="msg-cent-right-dtl">订单号:' + item.am_extra.order_sn + ' </div>';
  257. _html += '<div class="msg-cent-right-dtl" style="padding-top: 0.1rem;">' + item.am_extra.content + '</div>';
  258. _html += '<div class="h50"></div>';
  259. _html += '<div style="font-size: 0.24rem;"><img src="'+siteurl+'uploads/home/store/'+item.am_extra.store_id+'/'+ item.am_extra.store_avatar + '" class="member-avatar" /> ' + item.am_extra.store_name + '<button type="button" class="el-button el-button--default is-round"><span class="tel-btn" tel="' + item.am_extra.store_phone + '">致电</span></button></div>';
  260. _html += ' </li></ul></div>';
  261. break;
  262. case 'replenishment':
  263. $("#header-title").html('补货申请');
  264. // _html += '<div class="weui-panel"><div class="weui-panel__bd"><div class="weui-media-box weui-media-box_text"><h4 class="weui-media-box__title">'+item.am_title+'</h4><p class="weui-media-box__desc">'+item.am_extra.content+'</p><ul class="weui-media-box__info"><li class="weui-media-box__info__meta">'+item.am_extra.store_name+'</li><li class="weui-media-box__info__meta">时间</li><li class="weui-media-box__info__meta weui-media-box__info__meta_extra">'+item.am_create_time+'</li><li><a href="javascript:urge_tel('+item.am_extra.store_phone+');" class="weui-btn weui-btn_mini weui-btn_primary">联系酒店</a></li></ul></div></div></div>';
  265. _html += '<div class="msg-time" keyid="' + item.am_target_id + '">' + item.am_create_time + '</div>';
  266. if (item.am_is_read == 0) {
  267. _html += '<div class="msg-cent-list" keyid="' + item.am_target_id + '" tag="' + item.types + '"><ul>';
  268. }else{
  269. _html += '<div class="msg-cent-list is_read" keyid="' + item.am_target_id + '" tag="' + item.types + '"><ul>';
  270. }
  271. _html += '<li class="msg-cent-right"><div class="msg-cent-right-title">' + item.am_extra.store_name + '酒店发来一条补货申请</div>';
  272. _html += '<div class="h50"></div>';
  273. // _html += '<div class="msg-cent-right-dtl">订单号:' + item.am_extra.order_sn + ' </div>';
  274. _html += '<div class="msg-cent-right-dtl" style="padding-top: 0.1rem;">' + item.am_extra.content + '</div>';
  275. _html += '<div class="h50"></div>';
  276. _html += '<div style="font-size: 0.24rem;"><img src="'+siteurl+'uploads/home/store/'+item.am_extra.store_id+'/' + item.am_extra.store_avatar + '" class="member-avatar" /> ' + item.am_extra.store_name + '<button type="button" class="el-button el-button--default is-round"><span class="tel-btn" tel="' + item.am_extra.store_phone + '">致电</span></button></div>';
  277. _html += ' </li></ul></div>';
  278. break;
  279. case 'store':
  280. if ( _keywordx ) {
  281. // get_bill();
  282. }else{
  283. $("#header-title").html('我的酒店');
  284. $(".page__title").html( datas.data.list.length +' 家');
  285. }
  286. $(".page__hd").removeClass("mask-hidden");
  287. $("#searchBar").removeClass("mask-hidden");
  288. $("#list_all").addClass("hotel_list");
  289. // _html += '<div class="weui-panel weui-panel_access"><div class="weui-panel__bd"><a href="javascript:store_info('+item.store_id+');" class="weui-media-box weui-media-box_appmsg"><div class="weui-media-box__hd"><img class="weui-media-box__thumb" src="'+siteurl+'uploads/home/store/'+item.store_id+'/'+item.store_avatar+'" alt=""></div><div class="weui-media-box__bd"><h4 class="weui-media-box__title">'+item.store_name+'</h4><p class="weui-media-box__desc">'+item.store_address+'</p></div></a></div></div>';
  290. _html += '<div class="home-hotel-list" keyid="' + item.store_id + '"><div class="home-hotel-left"><img src="'+siteurl+'uploads/home/store/'+item.store_id+'/'+item.store_avatar+'"/></div>';
  291. _html += '<div class="home-hotel-right"><div class="home-hotel-title">' + item.store_name + '</div>';
  292. _html += '<div class="home-hotel-dtl"><ul><li style="width:40%"><div class="hotel_credit my-rating">'+intToFloat(item.store_servicecredit)+'</div></li>';
  293. _html += '<li style="text-align:center;"> 月访客' + item.store_visitor + '</li><li style="float:right;"></li>';
  294. _html += '</ul></div>';
  295. _html += '<div class="home-hotel-dsc"></div></div></div>';
  296. break;
  297. }
  298. });
  299. if ( _page == 1 || _keywordx ) {
  300. $(".page__bd").html(_html);
  301. } else {
  302. $(".page__bd").append(_html);
  303. }
  304. _page++;
  305. } else {
  306. if ( _page == 1 ) {
  307. $(".page__bd").html('<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无数据</span></div>');
  308. } else {
  309. $(".page__bd").append('<div class="weui-loadmore weui-loadmore_line"><span class="weui-loadmore__tips">暂无数据</span></div>');
  310. }
  311. _page = false;
  312. }
  313. } else {
  314. errcode(datas, datas.code);
  315. }
  316. }
  317. });
  318. }
  319. function urge_tel(key) {
  320. if (!key) {
  321. api.toast({ msg: '号码不能为空' });
  322. return false;
  323. }
  324. api.call({
  325. type: 'tel_prompt',
  326. number: key
  327. });
  328. return false;
  329. }
  330. function intToFloat(val) {
  331. // body...
  332. return new Number(val).toFixed(1);
  333. }
  334. $(".page__bd").on("tap", ".tel-btn", function() {
  335. var _tel = $(this).attr("tel");
  336. console.log(_tel)
  337. if (!_tel) {
  338. api.toast({ msg: '号码不能为空' });
  339. return false;
  340. }
  341. api.call({
  342. type: 'tel_prompt',
  343. number: _tel
  344. });
  345. return false;
  346. })
  347. function post_Info(key) {
  348. api.openWin({
  349. name: 'showhotel',
  350. url: '../find/finddetails.html',
  351. bounces: false,
  352. pageParam: {
  353. keyid: key
  354. }
  355. });
  356. return false;
  357. }
  358. $("#list_all").on("tap", ".home-hotel-list", function() {
  359. var _key = $(this).attr("keyid");
  360. api.openWin({
  361. name: 'showhotel',
  362. url: '../home/showhotel.html',
  363. bounces: false,
  364. pageParam: {
  365. keyid: _key
  366. }
  367. });
  368. return false;
  369. });
  370. function store_info(key) {
  371. api.openWin({
  372. name: 'showhotel',
  373. url: '../home/showhotel.html',
  374. bounces: false,
  375. pageParam: {
  376. keyid: key
  377. }
  378. });
  379. return false;
  380. }
  381. function get_bill() {
  382. $.ajax({
  383. url: siteurl + 'v1/agent/bill',
  384. data: {},
  385. headers: { "X-TOKEN": $api.getStorage("accesstoken") },
  386. dataType: 'json',
  387. type: 'post',
  388. success: function(datas) {
  389. if (datas.result) {
  390. // $(".page__title").html(datas.data.store_count+' 家');
  391. } else {
  392. errcode(datas, datas.code);
  393. }
  394. }
  395. })
  396. }
  397. $(".msg-list").on("tap", ".js_category", function() {
  398. var tag = $(this).attr("id");
  399. api.openWin({
  400. name: 'list',
  401. url: 'x.html',
  402. bounces: false,
  403. pageParam: {
  404. agentid: _agentid,
  405. type: tag
  406. }
  407. })
  408. return false;
  409. });
  410. $(function(){
  411. var $searchBar = $('#searchBar'),
  412. $searchResult = $('#searchResult'),
  413. $searchText = $('#searchText'),
  414. $searchInput = $('#searchInput'),
  415. $searchClear = $('#searchClear'),
  416. $searchCancel = $('#searchCancel');
  417. function hideSearchResult(){
  418. $searchResult.hide();
  419. $searchInput.val('');
  420. getRouteData('0', '1');
  421. }
  422. function cancelSearch(){
  423. hideSearchResult();
  424. $searchBar.removeClass('weui-search-bar_focusing');
  425. $searchText.show();
  426. }
  427. $searchText.on('click', function(){
  428. $searchBar.addClass('weui-search-bar_focusing');
  429. $searchInput.focus();
  430. });
  431. $searchInput
  432. .on('blur', function () {
  433. if(!this.value.length) cancelSearch();
  434. })
  435. .on('input', function(){
  436. if(this.value.length) {
  437. $searchResult.show();
  438. getRouteData(this.value, '1');
  439. } else {
  440. $searchResult.hide();
  441. }
  442. });
  443. $searchClear.on('click', function(){
  444. hideSearchResult();
  445. $searchInput.focus();
  446. });
  447. $searchCancel.on('click', function(){
  448. cancelSearch();
  449. $searchInput.blur();
  450. });
  451. });
  452. </script>
  453. </html>