Dinner.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <script src="/static/mobile/weui/iscroll.js"></script>
  2. <!-- <script src="/public/mobile/Weui/updown.js"></script> -->
  3. <script src="/static/mobile/weui/lazyimg.js"></script>
  4. <script src="/static/mobile/weui/swipe.js"></script>
  5. <script type="text/javascript" src="/static/jquery-2.2.4.min.js"></script>
  6. <style type="text/css">
  7. .list{
  8. position: relative;
  9. height: 100%;
  10. overflow-x: hidden;
  11. overflow-y: scroll;
  12. }
  13. .alert{
  14. padding:15px;
  15. border:1px solid transparent;
  16. border-radius:4px;
  17. color:#31708f;
  18. background-color:#d9edf7;
  19. border-color:#bce8f1;
  20. }
  21. </style>
  22. <script>
  23. $(function() {
  24. TagNav('#tagnav', {
  25. type: 'scrollToFirst',
  26. });
  27. });
  28. </script>
  29. <div>
  30. <div>
  31. {if $is_spot==0}
  32. <div class="weui_cells_tips alert">
  33. {if $content2}
  34. {$content2}
  35. {else}
  36. 1、此界面为预约订餐,餐品次日送达 <br>
  37. 2、退餐请在手机操作 <br>
  38. 3、订单仅当日可退,逾期不可退订
  39. {/if}
  40. </div>
  41. {else}
  42. <div class="weui_cells_tips alert">
  43. {if $content1}
  44. {$content1}
  45. {else}
  46. 1、此界面可定当日餐 <br>
  47. 2、退餐请在手机操作或找订餐员退餐 <br>
  48. 3、订单仅当日可退,逾期不可退订
  49. {/if}
  50. </div>
  51. {/if}
  52. </div>
  53. <div class="weui_cells weui_cells_access" id="rank-list" style="margin-bottom: 140px;">
  54. </div>
  55. <div class="weui_cells_title hide tcenter" id="more">
  56. <div class="weui-loadmore">
  57. <i class="weui-loading"></i>
  58. <span class="weui-loadmore-tips">正在加载</span>
  59. </div>
  60. </div>
  61. </div>
  62. <script type="text/javascript">
  63. var page = 0;
  64. var stop = false;
  65. var size = 1000;
  66. var loading = false;
  67. var today = '{$is_today}';
  68. var type = '{$dinner_type_id}';
  69. function ajaxpage(){
  70. var url = 'get_type_json?size=' + size + '&page=' + page + '&today=' + today+ '&type='+type;
  71. $.showLoading();
  72. loading = true;
  73. $.ajax({
  74. type : "GET",
  75. url : url,
  76. dataType : "json",
  77. beforeSend:function(){
  78. $("#more").show();
  79. },
  80. error:function(){
  81. loading = false;
  82. },
  83. success : function(data) {
  84. var arrLen = data.length;
  85. if(arrLen>0){
  86. var result = '';
  87. for(var i=0; i<arrLen; i++){
  88. result+=' <a href="javascript:;" class="weui_media_box weui_media_appmsg">'
  89. +'<div class="weui_media_hd weui-updown">';
  90. if(data[i].img){
  91. result += '<img class="weui_media_appmsg_thumb lazyload111" alt="" src="'+data[i].img+'">';
  92. }else{
  93. result += '<img class="weui_media_appmsg_thumb lazyload111" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAYAAADNkKWqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNi8wNS8xNrqrthwAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAEMElEQVR4nO3UQQEAEADAQPRvqIESxPDYXYK9Nvc+dwAErd8BAL8YIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBA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QZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBA1gPYJgYfB4WzDQAAAABJRU5ErkJggg==" alt="" data-img="'+data[i].ThumbPic+'">';
  94. }
  95. // result += '<img class="weui_media_appmsg_thumb lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAYAAADNkKWqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNi8wNS8xNrqrthwAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAEMElEQVR4nO3UQQEAEADAQPRvqIESxPDYXYK9Nvc+dwAErd8BAL8YIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBA1gPYJgYfB4WzDQAAAABJRU5ErkJggg==" alt="" data-img="'+data[i].ThumbPic+'">'
  96. result += '</div>'
  97. +'<div class="weui_media_bd">'
  98. +'<h4 class="weui_media_title">'+data[i].name+'</h4>'
  99. +'<p class="weui_media_desc">'+data[i].content+'</p>'
  100. +'<p class="weui_media_info" style="color:#ff0000;">¥'+data[i].money
  101. +'<div class="weui_cell_ft"><span class="weui_btn weui_btn_mini bg-orange-b" onclick="godetail('+data[i].id+')">加入购物车</span></div>'
  102. +'</p>'
  103. +'</div>'
  104. +'</a>';
  105. }
  106. $("#rank-list").append(result);
  107. if(arrLen < size){
  108. stop = false;
  109. // $(document.body).destroyInfinite();
  110. $('.weui-loadmore').hide().html("没有更多商品了");
  111. }
  112. }else{
  113. stop = true;
  114. //$(document.body).destroyInfinite();
  115. $('.weui-loadmore').hide().html("没有更多商品了");
  116. }
  117. loading = false;
  118. $.hideLoading();
  119. }
  120. });
  121. }
  122. $(function(){
  123. ajaxpage(0);
  124. })
  125. function godetail(id) {
  126. window.location.href = "{:url('detail',[],false)}?id="+id;
  127. }
  128. </script>
  129. <script type="text/javascript">
  130. // (function ($) {
  131. // var getOffset = function (container) {
  132. // var tagName = container[0].tagName.toUpperCase()
  133. // var scrollTop
  134. // if (tagName === 'BODY' || tagName === 'HTML') {
  135. // scrollTop = container.scrollTop() || $(window).scrollTop()
  136. // } else {
  137. // scrollTop = container.scrollTop()
  138. // }
  139. // var offset = container.scrollHeight() - ($(window).height() + scrollTop)
  140. // console.log(offset)
  141. // return offset
  142. // }
  143. //
  144. // var Infinite = function(el, distance) {
  145. // this.container = $(el);
  146. // this.container.data("infinite", this);
  147. // this.distance = distance || 50;
  148. // this.attachEvents();
  149. // }
  150. //
  151. // Infinite.prototype.scroll = function() {
  152. // var container = this.container;
  153. // this._check();
  154. // }
  155. //
  156. // Infinite.prototype.attachEvents = function(off) {
  157. // var el = this.container;
  158. // var scrollContainer = (el[0].tagName.toUpperCase() === "BODY" ? $(document) : el);
  159. // scrollContainer[off ? "off" : "on"]("scroll", $.proxy(this.scroll, this));
  160. // };
  161. // Infinite.prototype.detachEvents = function(off) {
  162. // this.attachEvents(true);
  163. // }
  164. // Infinite.prototype._check = function() {
  165. // var offset = getOffset(this.container);
  166. // if(Math.abs(offset) <= this.distance) {
  167. // this.container.trigger("infinite");
  168. // }
  169. // }
  170. //
  171. // var infinite = function(el) {
  172. // attachEvents(el);
  173. // }
  174. //
  175. // $.fn.infinite = function(distance) {
  176. // return this.each(function() {
  177. // new Infinite(this, distance);
  178. // });
  179. // }
  180. // $.fn.destroyInfinite = function() {
  181. // return this.each(function() {
  182. // var infinite = $(this).data("infinite");
  183. // if(infinite && infinite.detachEvents) infinite.detachEvents();
  184. // });
  185. // }
  186. // })(Zepto);
  187. </script>
  188. <script type="text/javascript">
  189. function addCart(DinnerId){
  190. cancelBubble();
  191. var url = "addCart?id="+DinnerId;
  192. get_data(url,function (result) {
  193. // alert(JSON.stringify(result.info));
  194. if(result.code==0){
  195. $('#badgecart').html(result.data.count);
  196. $('#badgecart').show();
  197. }else{
  198. $.alert(result.message);
  199. }
  200. });
  201. }
  202. function cancelBubble(e) {
  203. var evt = e ? e : window.event;
  204. if (evt.stopPropagation) { //W3C
  205. evt.stopPropagation();
  206. }else { //IE
  207. evt.cancelBubble = true;
  208. }
  209. }
  210. $(function(){
  211. var lazyloadImg = new LazyloadImg({
  212. el: '.weui-updown [data-img]', //匹配元素
  213. top: 0, //元素在顶部伸出长度触发加载机制
  214. right: 0, //元素在右边伸出长度触发加载机制
  215. bottom: 0, //元素在底部伸出长度触发加载机制
  216. left: 0, //元素在左边伸出长度触发加载机制
  217. qriginal: true, // true,自动将图片剪切成默认图片的宽高;false显示图片真实宽高
  218. load: function (el) {
  219. el.style.cssText += '-webkit-animation: fadeIn 01s ease 0.2s 1 both;animation: fadeIn 1s ease 0.2s 1 both;';
  220. },
  221. error: function (el) {
  222. }
  223. });
  224. });
  225. // $(function(){
  226. // $('.weui_tab_bd').infinite(150).on("infinite", function() {
  227. // if(stop){
  228. // $("#more").html("没有更多数据了");
  229. // return;
  230. // }
  231. // if(loading){
  232. // return;
  233. // }
  234. // ajaxpage(page++);
  235. // });
  236. // });
  237. var flag = true;
  238. $(document).on('touchstart touchmove touchend', '.show-dialog-get', function (event) {
  239. switch (event.type) {
  240. case 'touchstart':
  241. flag = true;
  242. break;
  243. case 'touchmove':
  244. flag = false;
  245. break;
  246. case 'touchend':
  247. if(flag){
  248. flag = false;
  249. event.preventDefault();
  250. var $this = $(this), url = $this.attr('href') || $this.attr('data-url');
  251. window.location.href = url;
  252. }else{
  253. }
  254. break;
  255. default:
  256. break;
  257. }
  258. });
  259. $(document).on('click', '.show-dialog-get', function (event) {
  260. return false;
  261. });
  262. </script>