| 1 |
- function infinite_scroll(t,n,o,e,a){return loading||e.page>total_page?void $(".content-inner").css({paddingBottom:"0"}):(loading=!0,void handleAjax.handle(n,{page:e.page},"html").done(function(n){var i=$('<div id="tmpHTML"></div>').html(n),d=i.find(o),s=$(d).html();$(s).find(".total_page").remove(),e.page++,loading=!1,$(t).find(o).append(s),$.refreshScroller(),null!=a&&a()}).fail(function(t){$.toast(t)}))}function pull_refresh(t,n,o,e,a){var i=!1;i||(i=!0,handleAjax.handle(n,"","html").done(function(n){refreshing=!1;var d=$('<div id="tmpHTML"></div>').html(n),s=d.find(o),c=$(t).find(o),r=$(s).html();value=r.replace(/\s+/g,"");var n=$(n).find(".content").html(),p=s.find("input[name='total_page']").val();i=!1,e.page=2,e.total_page=p,setTimeout(function(){c.addClass("animated fadeInUp").html(value.length>0?r:'<div style="text-align:center;color:#999;font-size:0.75rem;">暂无数据</div>'),setTimeout(function(){c.removeClass("fadeInUp")},1e3),$.pullToRefreshDone(".pull-to-refresh-content"),$(".pull-to-refcontainerresh-layer").css({visibility:"visible"}),page=2,"function"==typeof a&&a.call(this)},300)}).fail(function(t){$.toast(t)}))}var vm_login=new Vue({el:"#vscope-login",data:{mobile:"",verify_coder:"",is_disabled:!1,code_lefttime:0,code_timeer:null},methods:{login:function(t){var n=this;if(!n.check())return!1;var o=new Object;o.mobile=n.mobile,o.verify_coder=n.verify_coder,$.ajax({url:t,data:o,type:"POST",dataType:"json",success:function(t){1==t.status?t.error?($.toast(t.error,1e3),t.is_url&&setTimeout(function(){location.href=t.url},1e3)):t.is_url&&(location.href=t.url):t.error?($.toast(t.error,1e3),t.is_url&&setTimeout(function(){location.href=t.url},1e3)):$.toast("操作失败")}})},check:function(t,n){var o=this;return 0==$.trim(o.mobile).length?($.toast("手机号码不能为空"),!1):$.checkMobilePhone(o.mobile)?!!$.maxLength(o.mobile,11,!0)||($.toast("长度不能超过11位"),!1):($.toast("手机号码格式错误"),!1)},send_code:function(t){var n=this;if(n.is_disabled)return $.toast("发送速度太快了"),!1;var o=($("#j-send-code"),new Object);o.mobile=n.mobile,$.ajax({url:APP_ROOT+"/mapi/index.php?ctl=login&act=send_mobile_verify",data:o,type:"POST",dataType:"json",success:function(t){return 1==t.status?(countdown=60,vm_login.code_lefttime=60,n.code_lefttime_fuc("#j-send-code",n.code_lefttime),!1):($.toast(t.error),!1)}})},code_lefttime_fuc:function(t,n){var o=this;clearTimeout(o.code_timeer),$(t).html("重新发送 "+n),n--,n>0?($(t).attr("disabled","disabled"),o.is_disabled=!0,vm_login.code_timeer=setTimeout(function(){o.code_lefttime_fuc(t,n)},1e3)):(n=60,o.is_disabled=!1,$(t).removeAttr("disabled"),$(t).html("发送验证码"))}}});$(document).on("pageInit","#page-shop-distribution_goods_list",function(t,n,o){function e(){new_paramet=paramet.options?"&options="+paramet.options:"",ajax_url=APP_ROOT+"/wap/index.php?ctl=shop&act=distribution_goods_list"+new_paramet}e();var a=new Vue({el:"#vscope-paging",data:{total_page:total_page,page:page}});$(document).on("click",".J-distribution",function(){var t=$(this);if(!t.hasClass("is_distribution")){var n=t.attr("data-id");handleAjax.handle(TMPL+"index.php?ctl=shop&act=add_distribution_goods",{goods_id:n}).done(function(n){t.addClass("is_distribution"),$.toast(n,1e3),setTimeout(function(){t.html("已添加分销")},1e3)}).fail(function(t){$.toast(t,1e3)})}}),$(o).on("infinite",function(t){infinite_scroll(o,ajax_url,".shop-list",a)}),$(o).find(".pull-to-refresh-content").on("refresh",function(t){pull_refresh(o,ajax_url,".shop-list",a),$("#search").val("");var n=document.getElementById("goods_cate").options;for(i=0;i<n.length;i++)0==n[i].id&&(n[i].selected=!0)}),$(function(){var t=TMPL+"index.php?ctl=shop&act=distribution_goods_list&options=1&cate_id="+paramet.cate_id,n=TMPL+"index.php?ctl=shop&act=distribution_goods_list&options=2&cate_id="+paramet.cate_id,o=TMPL+"index.php?ctl=shop&act=distribution_goods_list&options=3&cate_id="+paramet.cate_id;$(".option1").attr("href",t),$(".option2").attr("href",n),$(".option3").attr("href",o)}),$(".select").change(function(){var t=$("option").not(function(){return!this.selected}),n=t.attr("data-id");location.href=TMPL+"index.php?ctl=shop&act=distribution_goods_list&cate_id="+n+"&options="+paramet.options+"&page="+data.page}),paramet.cate_id&&$("#search option").attr("data-id")==paramet.cate_id&&$(this).attr("selected",!0),$(document).on("click",".J-search",function(){var t=$("#search").val();console.log(data),location.href=TMPL+"index.php?ctl=shop&act=distribution_goods_list&content="+t+"&options="+paramet.options+"&page="+data.page})}),$(document).on("pageInit","#page-shop-goods_details",function(t,n,o){$(document).on("click",".J-anchor",function(){handleAjax.handle(TMPL+"index.php?ctl=shop&act=add_distribution_goods",{goods_id:goods_id}).done(function(t){$.toast(t,1e3),setTimeout(function(){self.html("已添加分销")},1e3)}).fail(function(t){$.toast(t,1e3)})})}),$(document).on("pageInit","#page-shop-new_address",function(t,n,o){function e(t,n){if("string"!=typeof t)return!1;var t=document.getElementById(t),n=n||300,o=function(e){e.target!=t&&setTimeout(function(){t.blur(),document.removeEventListener("touchend",o,!1)},n)};t&&t.addEventListener("focus",function(){document.addEventListener("touchend",o,!1)},!1)}$("#city-picker").cityPicker({}),$("#city-picker").click(function(){$("input:not(this)").blur()});var a=navigator.userAgent.toUpperCase().indexOf("IPHONE")!=-1;if(a){var i=e("input");i=null}$(".item-input").find("input[name=consignee]").blur(function(){var t=$(this).val();data.consignee=t}),$(".item-input").find("input[name=consignee_mobile]").blur(function(){var t=$(this).val();data.consignee_mobile=t}),$(".item-input").find("input[name=consignee_address]").blur(function(){var t=$(this).val();data.consignee_address=t}),$(".J-save").click(function(){return data.consignee_district=$("#city-picker").val(),console.log(data.consignee_district),$.checkEmpty(data.consignee)?($.toast("收货人不能为空"),!1):0==$.trim(data.consignee_mobile).length?($.toast("手机号码不能为空"),!1):$.checkMobilePhone(data.consignee_mobile)?$.maxLength(data.consignee_mobile,11,!0)?$.checkEmpty(data.consignee_address)?($.toast("请输入收货地址"),!1):$.checkEmpty(data.consignee_district)?($.toast("请输入收货地址"),!1):void $.ajax({url:APP_ROOT+"/wap/index.php?ctl=shop&act=editaddress&post_type=json&itype=shop",type:"post",data:data,dataType:"json",beforeSend:function(){$.showIndicator(),onload=function(){var t=document.querySelector("a");t.onclick=function(){return!this.disabled&&(this.style.color="grey",void(this.disabed=!0))}}},success:function(t){1==t.status?($.toast("操作成功"),history.back()):$.toast(t.error)},error:function(){$.toast(err)},complete:function(){$.hideIndicator()}}):($.toast("手机号码长度不能超过11位"),!1):($.toast("手机号码格式错误"),!1)})}),$(document).on("pageInit","#page-shop-order_settlement",function(t,n,o){for(var e=0;e<shop_info.length;e++){var a=shop_info[e],i={};for(var d in a)"goods_id"==d&&(i.goods_id=shop_info[e][d]),"number"==d&&(i.number=shop_info[e][d]),"podcast_id"==d&&(i.podcast_id=shop_info[e][d]),"order_sn"==d&&(i.order_sn=shop_info[e][d]);goods_arr.push(i)}var s=JSON.stringify(goods_arr);$(document).on("click",".J-submit-order",function(){handleAjax.handle(APP_ROOT+"/wap/index.php?ctl=shop&act=goods_inventory",{shop_info:s},"",1).done(function(t){return 1!=t.status?($.toast(t.error),!1):void(location.href=TMPL+"index.php?ctl=pay&act=h5_pay&purchase_type="+data.purchase_type+"&shop_info="+s)}).fail(function(t){$.toast(t)})})}),$(document).on("pageInit","#page-shop-order_settlement_user",function(t,n,o){$(document).on("click",".J-address",function(){location.href=TMPL+"index.php?ctl=shop&act=new_address&address_id="+data.address_id});for(var e=0;e<shop_info.length;e++){var a=shop_info[e],i={};for(var d in a)"goods_id"==d&&(i.goods_id=shop_info[e][d]),"number"==d&&(i.number=shop_info[e][d]),"podcast_id"==d&&(i.podcast_id=shop_info[e][d]),"order_sn"==d&&(i.order_sn=shop_info[e][d]);goods_arr.push(i)}$(document).on("click",".confirm-ok",function(){var t=$(this).attr("data-id"),n=$(this).val();console.log(n),$.alert('<textarea class="footer-input" type="text" name="remarks" data-id="'+t+'" value="'+n+'" placeholder="选填:对本次交易的说明(建议填写已和卖家协商一致的内容)">'+n+"</textarea>",function(){var n=$(".modal").find("textarea");n.attr("data-id");$(".liuyan-"+t).val(n.val())})}),$(document).on("click",".J-submit-order",function(){$(".goods-item").each(function(t,n){var o=$(this),e=t,a=o.find("input[name='remarks']");goods_arr[e].memo=a.val()}),console.log(goods_arr);var t=JSON.stringify(goods_arr);""==data.address_id?$.toast("地址不能为空",1e3):handleAjax.handle(APP_ROOT+"/wap/index.php?ctl=shop&act=goods_inventory",{shop_info:t},"",1).done(function(n){return 1!=n.status?($.toast(n.error),!1):void(location.href=TMPL+"index.php?ctl=pay&act=h5_pay&address_id="+data.address_id+"&purchase_type="+data.purchase_type+"&shop_info="+t)}).fail(function(t){$.toast(t)})})}),$(document).on("pageInit","#page-shop-podcasr_goods_management",function(t,n,o){function e(){new_paramet=paramet.state?"&state="+paramet.state:"",ajax_url=APP_ROOT+"/wap/index.php?ctl=shop&act=podcasr_goods_management"+new_paramet}e();var a=new Vue({el:"#vscope-paging",data:{total_page:total_page,page:page}});$(document).on("click",".J-podcasr_shelves_goods",function(){var t=$(this),n=t.attr("data-id");handleAjax.handle(TMPL+"index.php?ctl=shop&act=podcasr_shelves_goods",{goods_id:n}).done(function(t){$.toast(t,1e3),setTimeout(function(){$("#goods-item-"+n).remove()},1e3)}).fail(function(t){$.toast(t,1e3)})}),$(document).on("click",".J-podcasr_delete_goods",function(){var t=$(this),n=t.attr("data-id");handleAjax.handle(TMPL+"index.php?ctl=shop&act=podcasr_delete_goods",{goods_id:n}).done(function(t){$.toast(t,1e3),setTimeout(function(){$("#goods-item-"+n).remove()},1e3)}).fail(function(t){$.toast(t,1e3)})}),$(document).on("click","#J-podcasr_empty_goods",function(){handleAjax.handle(TMPL+"index.php?ctl=shop&act=podcasr_empty_goods").done(function(t){$.toast(t,1e3),setTimeout(function(){var t='<div class="tc" style="color:#999;margin-top:50%;"> <i class="icon iconfont" style="font-size:3rem;line-height:1;"></i> <div>暂无分销商品,点击马上添加哦~</div></div>';$(o).find(".goods-list").html(t)},1e3)}).fail(function(t){$.toast(t,1e3)})}),$(o).on("infinite",function(t){infinite_scroll(o,ajax_url,".goods-list",a)}),$(o).find(".pull-to-refresh-content").on("refresh",function(t){pull_refresh(o,ajax_url,".goods-list",a),$("#search").val("")}),$(document).on("click",".J-search",function(){var t=$("#search").val();location.href=encodeURI(TMPL+"index.php?ctl=shop&act=podcasr_goods_management&content="+t+"&state="+data.state+"&page="+data.page)})}),$(document).on("pageInit","#page-shop-shop_goods_details",function(t,n,o){var e=[];e.push({podcast_id:data.podcast_id,goods_id:data.goods_id,number:data.number});var a=JSON.stringify(e);$(document).on("click",".J-anchor",function(){location.href=TMPL+"index.php?ctl=shop&act=order_settlement&shop_info="+a}),$(document).on("click",".J-oneself",function(){location.href=TMPL+"index.php?ctl=shop&act=order_settlement_user&shop_info="+a})}),$(document).on("pageInit","#page-shop-shop_goods_list",function(t,n,o){function e(){new_paramet=paramet.podcast_id?"&podcast_id="+paramet.podcast_id:"",ajax_url=APP_ROOT+"/wap/index.php?ctl=shop&act=shop_goods_list"+new_paramet}e();var a=new Vue({el:"#vscope-paging",data:{total_page:total_page,page:page}});$(o).on("infinite",function(t){infinite_scroll(o,ajax_url,".goods-list",a)}),$(o).find(".pull-to-refresh-content").on("refresh",function(t){pull_refresh(o,ajax_url,".goods-list",a),$("#search").val("")}),$(".input-goods-num").val(0),$(document).on("click",".add",function(){var t=$(this),n=t.attr("data-id"),o=parseInt($(this).siblings(".input-goods-num").val())||0;o<99&&(o+=1),$(this).siblings(".input-goods-num").val(o),data.goods_id=n,data.number=Number(o)}),$(document).on("click",".lost",function(){var t=$(this),n=t.attr("data-id"),o=parseInt($(this).siblings(".input-goods-num").val())||0;o>0&&(o-=1),$(this).siblings(".input-goods-num").val(o),data.goods_id=n,data.number=Number(o)}),$(".input-goods-num").blur(function(){var t=$(this),n=t.attr("data-id");data.goods_id=n,data.number=Number($(this).val())}),$(".input-goods-num").bind("input propertychange",function(){var t=$(this),n=t.val();n>99&&$(this).val(99)}),$(document).on("click",".J-anchor",function(){var t=[];$(".goods-item").each(function(){var n=$(this),o=n.find("input[name='amount']");o.val()>0&&t.push({podcast_id:data.podcast_id,goods_id:o.attr("data-id"),number:o.val()})});var n=JSON.stringify(t);return t.length?void(location.href=TMPL+"index.php?ctl=shop&act=order_settlement&shop_info="+n):($.toast("请先选择商品"),!1)}),$(document).on("click",".J-oneself",function(){var t=[];$(".goods-item").each(function(){var n=$(this),o=n.find("input[name='amount']");o.val()>0&&t.push({podcast_id:data.podcast_id,goods_id:o.attr("data-id"),number:o.val()})});var n=JSON.stringify(t);return t.length?void(location.href=TMPL+"index.php?ctl=shop&act=order_settlement_user&shop_info="+n):($.toast("请先选择商品"),!1)}),$(document).on("click",".J-details",function(){var t=$(this),n=t.attr("data-id");location.href=TMPL+"index.php?ctl=shop&act=shop_goods_details&podcast_id="+data.podcast_id+"&goods_id="+n}),$(document).on("click",".J-search",function(){var t=$("#search").val();location.href=TMPL+"index.php?ctl=shop&act=shop_goods_list&content="+t+"&podcast_id="+data.podcast_id+"&page="+data.page}),$(document).on("click",".J-add_shopping_cart",function(){var t=$(this),n=t.attr("data-id"),o=t.parents(".card").find("input[name=amount]").val();return o>0?void handleAjax.handle(TMPL+"index.php?ctl=shop&act=join_shopping",{goods_id:n,podcast_id:data.podcast_id,number:o}).done(function(t){setTimeout(function(){$.toast("已添加购物车")},1e3)}).fail(function(t){$.toast(t,1e3)}):($.toast("请先选择商品"),!1)})}),$(document).on("pageInit","#page-shop-shop_order",function(t,n,o){function e(){new_paramet=paramet.state?"&state="+paramet.state:"",ajax_url=APP_ROOT+"/wap/index.php?ctl=shop&act=shop_order"+new_paramet,console.log(ajax_url)}e();var a=new Vue({el:"#vscope-paging",data:{total_page:total_page,page:page}});$(o).on("infinite",function(t){infinite_scroll(o,ajax_url,".goods-list",a)}),$(o).find(".pull-to-refresh-content").on("refresh",function(t){pull_refresh(o,ajax_url,".goods-list",a,function(){$(".left_time").each(function(){var t=Math.abs(parseInt($(this).attr("data-leftTime")));left_time(t,$(this))})})}),$(document).on("click",".J-pay",function(){var t=$(this),n=t.attr("data-order_id"),o=t.attr("data-order_sn");window.location.href=TMPL+"index.php?ctl=pay&act=h5_pay&order_sn="+o+"&order_id="+n}),$(document).on("click",".J-confirm",function(){var t=$(this),n=t.attr("data-to_podcast_id"),o=t.attr("data-order_sn");$.confirm("是否确认收货?",function(t){handleAjax.handle(TMPL+"index.php?ctl=pai_podcast&act=buyer_confirm_date",{to_podcast_id:n,order_sn:o}).done(function(t){$.toast("确认收货成功",1e3),setTimeout(function(){window.location.reload()},1e3)}).fail(function(t){$.toast(t,1e3)})})}),$(document).on("click",".J-remind",function(){$.toast("已经提醒商家",1e3)}),$(document).on("click",".J-detail",function(){var t=$(this),n=t.attr("data-order_id"),o=t.attr("data-order_sn");location.href=TMPL+"index.php?ctl=shop&act=virtual_shop_order_details&order_id="+n+"&order_sn="+o})}),$(document).on("pageInit","#page-shop-shop_shopping_cart",function(t,n,o){function e(){new_paramet=paramet.page?"&page="+paramet.page:"",ajax_url=APP_ROOT+"/wap/index.php?ctl=shop&act=shop_shopping_cart&page=1"}function a(){var t=$("input[name=shopping-cart-top]"),n=$("input[name=shopping-cart]"),o=$("input[name=shopping-cart-all]");t.click(function(){var t=$(this);t.is(":checked")?t.parents(".card").find("input[name=shopping-cart]").prop("checked",!0):t.parents(".card").find("input[name=shopping-cart]").prop("checked",!1);var n=0;$("input[name=shopping-cart]:checked").each(function(){n+=parseFloat($(this).parent().find(".input-money").val()*$(this).parent().find(".goods-numb").attr("data-id"))}),n=n.toFixed(2),$(".J-money").html(n);var e=$(".card").length,a=$("input[name=shopping-cart-top]:checked").length;a==e?o.prop("checked",!0):o.prop("checked",!1)}),n.click(function(){n.is(":checked")||($(this).parents(".card").find("input[name=shopping-cart-top]").prop("checked",!1),$(o).prop("checked",!1));var t=$(this).parents(".card").find(".card-content").length,e=$(this).parents(".card").find("input[name=shopping-cart]:checked").length;e==t?$(this).parents(".card").find("input[name=shopping-cart-top]").prop("checked",!0):$(this).parents(".card").find("input[name=shopping-cart-top]").prop("checked",!1);var a=$(".card").length,i=$("input[name=shopping-cart-top]:checked").length;i==a?o.prop("checked",!0):o.prop("checked",!1);var d=0;$("input[name=shopping-cart]:checked").each(function(){d+=parseFloat($(this).parent().find(".input-money").val()*$(this).parent().find(".goods-numb").attr("data-id"))}),d=d.toFixed(2),$(".J-money").html(d)}),$(".J-edit").click(function(){var t=$(this),n=t.html(),o=t.attr("data-id"),e=t.attr("data-podcast_id"),a=t.parents(".card").find("input[name=amount]").val();"编辑"==n?t.html("完成"):"完成"==n&&(t.html("编辑"),handleAjax.handle(TMPL+"index.php?ctl=shop&act=update_shopping_goods",{goods_id:o,podcast_id:e,number:a}).done(function(t){$.toast(t,1e3),setTimeout(function(){window.location.reload()})}).fail(function(t){$.toast(t,1e3)})),t.parents(".card").find(".goods-text").toggleClass("active"),t.parents(".card").find(".goods-edit").toggleClass("active")}),$(".J-delete").click(function(){var t=$(this),n=t.parents(".card"),o=t.attr("data-id"),e=t.attr("data-podcast_id"),a=t.parents(".card").find("input[name=amount]").val();$.confirm("是否确定删除商品?",function(){handleAjax.handle(TMPL+"index.php?ctl=shop&act=delete_shopping_goods",{goods_id:o,podcast_id:e,number:a}).done(function(t){setTimeout(function(){n.remove();var t=0;$("input[name=shopping-cart]:checked").each(function(){t+=parseFloat($(this).parent().find(".input-money").val()*$(this).parent().find(".goods-numb").attr("data-id"))}),t=t.toFixed(2),$(".J-money").html(t)})}).fail(function(t){$.toast(t,1e3)})})}),o.click(function(){o.is(":checked")?$(".input-check").prop("checked",!0):$(".input-check").prop("checked",!1);var t=0;$("input[name=shopping-cart]:checked").each(function(){t+=parseFloat($(this).parent().find(".input-money").val()*$(this).parent().find(".goods-numb").attr("data-id"))}),t=t.toFixed(2),$(".J-money").html(t)}),$(".add").click(function(){var t=$(this),n=(t.attr("data-id"),parseInt($(this).siblings(".input-goods-num").val())||0);n<99&&(n+=1),$(this).siblings(".input-goods-num").val(n)}),$(".lost").click(function(){var t=$(this),n=(t.attr("data-id"),parseInt($(this).siblings(".input-goods-num").val())||0);n>1&&(n-=1),$(this).siblings(".input-goods-num").val(n)}),$(".input-goods-num").blur(function(){var t=$(this);t.attr("data-id")}),$(".input-goods-num").bind("input propertychange",function(){var t=$(this),n=t.val();n>99&&$(this).val(99)}),$(document).on("click",".J-settlement",function(){var t=[];$("input[name=shopping-cart]:checked").each(function(){var n=$(this),o=n.parents(".card").find("input[name='input-number']"),e=n.parents(".card").find("input[name='input-money']");o.val()>0&&t.push({podcast_id:e.attr("data-podcast_id"),goods_id:e.attr("data-id"),number:o.val()})});var n=JSON.stringify(t);return t.length?void(location.href=TMPL+"index.php?ctl=shop&act=order_settlement_user&shop_info="+n):($.toast("请先选择商品"),!1)})}a(),e();var i=new Vue({el:"#vscope-paging",data:{total_page:total_page,page:page}});$(o).on("infinite",function(t){infinite_scroll(o,ajax_url,".goods-list",i)}),$(o).find(".pull-to-refresh-content").on("refresh",function(t){pull_refresh(o,ajax_url,".goods-list",i,function(){a()}),$(".J-money").html(0),$("input[name=shopping-cart-all]").prop("checked",!1)})}),$(document).on("pageInit","#page-shop-virtual_shop_order_details",function(t,n,o){$(document).on("click",".J-pay",function(){window.location.href=TMPL+"index.php?ctl=pay&act=h5_pay&order_sn="+data.order_sn+"&order_id="+data.order_id}),$(document).on("click",".J-remind",function(){$.toast("已经提醒商家",1e3)}),$(document).on("click","#J-return_virtual_pai",function(){handleAjax.handle(TMPL+"index.php?ctl=pai_podcast&act=buyer_confirm_date",data).done(function(t){$.toast("确认收货成功",1e3),setTimeout(function(){window.location.reload()},1e3)}).fail(function(t){$.toast(t,1e3)})}),$(document).on("click",".J-buyer_to_complaint",function(){handleAjax.handle(TMPL+"index.php?ctl=pai_podcast&act=buyer_to_complaint",data).done(function(t){$.toast("已提交申请",1e3),setTimeout(function(){window.location.reload()},1e3)}).fail(function(t){$.toast(t,1e3)})})});
|