123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- mui.init();
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var pagetype=53;
- (function(mui) {
- checkUserAgent();
- var unUserPage=userPage=1;//初始化页数
- var loadMoreNumber=15;//一次加载几条
- var useAgent=JSON.parse(window.localStorage.getItem(agentName));
- var accountId=window.localStorage.getItem("accountId");
- findAccount();
- function initPage(){
- var deceleration = mui.os.ios?0.003:0.0009;
- mui('.mui-scroll-wrapper').scroll({
- bounce: false,
- indicators: false, //是否显示滚动条
- deceleration:deceleration
- });
-
- }
- function getIntegralList(index, isLoadMore){
- var self= this;
- var tradeDirection,__page;
- var useAgent=JSON.parse(window.localStorage.getItem(agentName));
- if(index===0){
- tradeDirection=1;
- unUserPage=__page=isLoadMore?unUserPage:1;
- }else{
- tradeDirection=-1;
- userPage=__page=isLoadMore?userPage:1;
- }
- var params={
- creditsLogDo : JSON.stringify({"accountId":accountId,"tradeDirection":tradeDirection}),
- // tradeDirection : tradeDirection,
- page : __page,
- size : loadMoreNumber
- };
- sendPost('healthBank/selectDetails', params, 'json', 'post',function(){
- if(isLoadMore){
- self.endPullupToRefresh();
- }else{
- self.endPulldownToRefresh();
- }
- airDialog('服务器繁忙,请稍后再试!')
- },function(res){
- html = template('li_tmpl',{list: res.data&&res.data.detailModelList});
- var ul=self.element.querySelector('.integral-list');
- var length=res.data && res.data.detailModelList && res.data.detailModelList.length || 0;
- if(isLoadMore){//是否是上拉加载
- ul.innerHTML+=html;
- //加载完新数据后,必须执行如下代码,true表示没有更多数据了:
- if((length==0&&unUserPage==1)||(length==0&&userPage==1)){
- $('.mui-pull-caption-refresh').hide();
- $(ul).hide();
- $(ul).parents(".mui-slider-item").find('.div-no-info').removeClass("c-hide");
- }else{
- if(index===0) unUserPage++;
- else userPage++;
- }
- //
- self.endPullupToRefresh(length<loadMoreNumber);
- }else{
- ul.innerHTML=html;
- self.endPulldownToRefresh();
- }
- })
- }
- function findAccount(){
- var params={
- creditsDetail:JSON.stringify({patientId:useAgent.uid,tradeDirection:-1}),
- };
- sendPost('patient/healthBank/selectAccount', params , 'json', 'post',function(){
- airDialog("系统繁忙,请稍后再试!");
- $('.div-no-info').removeClass('c-hide');
- },function(res){
- if(res.status==200){
- var accountId=res.data&&res.data.obj&&res.data.obj.id || "";
- if(accountId){
- window.localStorage.setItem("accountId",accountId);
- initPage();
- }else{
- $('.div-no-info').removeClass('c-hide');
- airDialog("获取用户账户信息失败")
- }
- var total=res.data && res.data.obj && res.data.obj.total || 0;
- var useTotal=res.data && res.data.obj && res.data.obj.usedTotal || 0;
- $(".totalable").text(total);
- $("#useTotal").text(useTotal);
- }else{
- airDialog(res.msg)
- }
- })
- }
- })(mui);
- function airDialog(content){
- dialog({contentType:'tipsbox',top:true, skin:'bk-popup' , content:content}).show();
- }
- function goUrl(url){
- if(url) location.href=url;
- else airDialog('功能开发中,敬请期待!')
- }
|