123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- <script src="/static/mobile/weui/iscroll.js"></script>
- <!-- <script src="/public/mobile/Weui/updown.js"></script> -->
- <script src="/static/mobile/weui/lazyimg.js"></script>
- <script src="/static/mobile/weui/swipe.js"></script>
- <script type="text/javascript" src="/static/jquery-2.2.4.min.js"></script>
- <style type="text/css">
- .list{
- position: relative;
- height: 100%;
- overflow-x: hidden;
- overflow-y: scroll;
- }
- .alert{
- padding:15px;
- border:1px solid transparent;
- border-radius:4px;
- color:#31708f;
- background-color:#d9edf7;
- border-color:#bce8f1;
- }
- </style>
- <script>
- $(function() {
- TagNav('#tagnav', {
- type: 'scrollToFirst',
- });
- });
- </script>
- <div>
- <div>
- {if $is_spot==0}
- <div class="weui_cells_tips alert">
- {if $content2}
- {$content2}
- {else}
- 1、此界面为预约订餐,餐品次日送达 <br>
- 2、退餐请在手机操作 <br>
- 3、订单仅当日可退,逾期不可退订
- {/if}
- </div>
- {else}
- <div class="weui_cells_tips alert">
- {if $content1}
- {$content1}
- {else}
- 1、此界面可定当日餐 <br>
- 2、退餐请在手机操作或找订餐员退餐 <br>
- 3、订单仅当日可退,逾期不可退订
- {/if}
- </div>
- {/if}
- </div>
- <div class="weui_cells weui_cells_access" id="rank-list" style="margin-bottom: 140px;">
- </div>
- <div class="weui_cells_title hide tcenter" id="more">
- <div class="weui-loadmore">
- <i class="weui-loading"></i>
- <span class="weui-loadmore-tips">正在加载</span>
- </div>
- </div>
- </div>
- <script type="text/javascript">
- var page = 0;
- var stop = false;
- var size = 1000;
- var loading = false;
- var today = '{$is_today}';
- var type = '{$dinner_type_id}';
- function ajaxpage(){
- var url = 'get_type_json?size=' + size + '&page=' + page + '&today=' + today+ '&type='+type;
- $.showLoading();
- loading = true;
- $.ajax({
- type : "GET",
- url : url,
- dataType : "json",
- beforeSend:function(){
- $("#more").show();
- },
- error:function(){
- loading = false;
- },
- success : function(data) {
- var arrLen = data.length;
- if(arrLen>0){
- var result = '';
- for(var i=0; i<arrLen; i++){
- result+=' <a href="javascript:;" class="weui_media_box weui_media_appmsg">'
- +'<div class="weui_media_hd weui-updown">';
- if(data[i].img){
- result += '<img class="weui_media_appmsg_thumb lazyload111" alt="" src="'+data[i].img+'">';
- }else{
- result += '<img class="weui_media_appmsg_thumb lazyload111" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAYAAADNkKWqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwNi8wNS8xNrqrthwAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAEMElEQVR4nO3UQQEAEADAQPRvqIESxPDYXYK9Nvc+dwAErd8BAL8YIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBA1gPYJgYfB4WzDQAAAABJRU5ErkJggg==" alt="" data-img="'+data[i].ThumbPic+'">';
- }
- // result += '<img class="weui_media_appmsg_thumb lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAYAAADNkKWqAAAABHN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lgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBAlgECWQYIZBkgkGWAQJYBAlkGCGQZIJBlgECWAQJZBghkGSCQZYBA1gPYJgYfB4WzDQAAAABJRU5ErkJggg==" alt="" data-img="'+data[i].ThumbPic+'">'
- result += '</div>'
- +'<div class="weui_media_bd">'
- +'<h4 class="weui_media_title">'+data[i].name+'</h4>'
- +'<p class="weui_media_desc">'+data[i].content+'</p>'
- +'<p class="weui_media_info" style="color:#ff0000;">¥'+data[i].money
- +'<div class="weui_cell_ft"><span class="weui_btn weui_btn_mini bg-orange-b" onclick="godetail('+data[i].id+')">加入购物车</span></div>'
- +'</p>'
- +'</div>'
- +'</a>';
- }
- $("#rank-list").append(result);
- if(arrLen < size){
- stop = false;
- // $(document.body).destroyInfinite();
- $('.weui-loadmore').hide().html("没有更多商品了");
- }
- }else{
- stop = true;
- //$(document.body).destroyInfinite();
- $('.weui-loadmore').hide().html("没有更多商品了");
- }
- loading = false;
- $.hideLoading();
- }
- });
- }
- $(function(){
- ajaxpage(0);
- })
- function godetail(id) {
- window.location.href = "{:url('detail',[],false)}?id="+id;
- }
- </script>
- <script type="text/javascript">
- // (function ($) {
- // var getOffset = function (container) {
- // var tagName = container[0].tagName.toUpperCase()
- // var scrollTop
- // if (tagName === 'BODY' || tagName === 'HTML') {
- // scrollTop = container.scrollTop() || $(window).scrollTop()
- // } else {
- // scrollTop = container.scrollTop()
- // }
- // var offset = container.scrollHeight() - ($(window).height() + scrollTop)
- // console.log(offset)
- // return offset
- // }
- //
- // var Infinite = function(el, distance) {
- // this.container = $(el);
- // this.container.data("infinite", this);
- // this.distance = distance || 50;
- // this.attachEvents();
- // }
- //
- // Infinite.prototype.scroll = function() {
- // var container = this.container;
- // this._check();
- // }
- //
- // Infinite.prototype.attachEvents = function(off) {
- // var el = this.container;
- // var scrollContainer = (el[0].tagName.toUpperCase() === "BODY" ? $(document) : el);
- // scrollContainer[off ? "off" : "on"]("scroll", $.proxy(this.scroll, this));
- // };
- // Infinite.prototype.detachEvents = function(off) {
- // this.attachEvents(true);
- // }
- // Infinite.prototype._check = function() {
- // var offset = getOffset(this.container);
- // if(Math.abs(offset) <= this.distance) {
- // this.container.trigger("infinite");
- // }
- // }
- //
- // var infinite = function(el) {
- // attachEvents(el);
- // }
- //
- // $.fn.infinite = function(distance) {
- // return this.each(function() {
- // new Infinite(this, distance);
- // });
- // }
- // $.fn.destroyInfinite = function() {
- // return this.each(function() {
- // var infinite = $(this).data("infinite");
- // if(infinite && infinite.detachEvents) infinite.detachEvents();
- // });
- // }
- // })(Zepto);
- </script>
- <script type="text/javascript">
- function addCart(DinnerId){
- cancelBubble();
- var url = "addCart?id="+DinnerId;
- get_data(url,function (result) {
- // alert(JSON.stringify(result.info));
- if(result.code==0){
- $('#badgecart').html(result.data.count);
- $('#badgecart').show();
- }else{
- $.alert(result.message);
- }
- });
- }
- function cancelBubble(e) {
- var evt = e ? e : window.event;
- if (evt.stopPropagation) { //W3C
- evt.stopPropagation();
- }else { //IE
- evt.cancelBubble = true;
- }
- }
- $(function(){
- var lazyloadImg = new LazyloadImg({
- el: '.weui-updown [data-img]', //匹配元素
- top: 0, //元素在顶部伸出长度触发加载机制
- right: 0, //元素在右边伸出长度触发加载机制
- bottom: 0, //元素在底部伸出长度触发加载机制
- left: 0, //元素在左边伸出长度触发加载机制
- qriginal: true, // true,自动将图片剪切成默认图片的宽高;false显示图片真实宽高
- load: function (el) {
- el.style.cssText += '-webkit-animation: fadeIn 01s ease 0.2s 1 both;animation: fadeIn 1s ease 0.2s 1 both;';
- },
- error: function (el) {
- }
- });
- });
- // $(function(){
- // $('.weui_tab_bd').infinite(150).on("infinite", function() {
- // if(stop){
- // $("#more").html("没有更多数据了");
- // return;
- // }
- // if(loading){
- // return;
- // }
- // ajaxpage(page++);
- // });
- // });
- var flag = true;
- $(document).on('touchstart touchmove touchend', '.show-dialog-get', function (event) {
- switch (event.type) {
- case 'touchstart':
- flag = true;
- break;
- case 'touchmove':
- flag = false;
- break;
- case 'touchend':
- if(flag){
- flag = false;
- event.preventDefault();
- var $this = $(this), url = $this.attr('href') || $this.attr('data-url');
- window.location.href = url;
- }else{
- }
- break;
- default:
- break;
- }
- });
- $(document).on('click', '.show-dialog-get', function (event) {
- return false;
- });
- </script>
|