paymentList.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. var Request = GetRequest();
  2. var checktype=false;
  3. var loading = dialog({
  4. contentType: 'load',
  5. skin: 'bk-popup',
  6. });
  7. var iscrollState='';//判断滑动方向
  8. (function() {
  9. mui.init({
  10. pullRefresh : {
  11. container:'#wrapper',
  12. down : {
  13. height:50,
  14. auto: false,
  15. contentdown : "下拉可以刷新",
  16. contentover : "释放立即刷新",
  17. contentrefresh : "正在刷新...",
  18. callback: function(){
  19. iscrollState='down'
  20. myVue.isdown()
  21. }
  22. },
  23. up : {
  24. height:50,
  25. contentinit: '',
  26. contentdown: '',
  27. contentrefresh : "正在加载...",
  28. contentnomore:'没有更多数据了',
  29. callback: function() {
  30. iscrollState='up'
  31. myVue.isup()
  32. }
  33. }
  34. }
  35. })
  36. var myVue=new Vue({
  37. el: "#app",
  38. data: {
  39. data:{},
  40. dataList:[],
  41. length:1,
  42. cardlenght:0,
  43. cardId:"",
  44. queryList:{
  45. month:"",
  46. healthNo:"",
  47. chargeType:"1", //1:门诊,2:住院,
  48. pageNo:1,
  49. pageSize:10,
  50. },
  51. code:"",
  52. payTypeList:[{},{type:"weixin",Img:"../images/weixinzhifu_icon.png",text:"微信支付"},{type:"xianjin",Img:"../images/xianjichongzhi_icon.png",text:"现金支付"},{type:"yinlian",Img:"../images/yinlianzhifu_icon.png",text:"银联支付"},{type:"zhifubao",Img:"../images/zhifubaozhifu_icon.png",text:"支付宝支付"}],
  53. healthType:["","门诊充值","住院充值"],
  54. isUPsuccess:true, //上拉锁,搜索成功则释放
  55. },
  56. mounted: function() {
  57. var vm = this
  58. checkUserAgent();
  59. vm.checkType()
  60. vm.code=JSON.parse(localStorage.getItem("wlyyAgent")).uid
  61. vm.queryList.month=new Date().getFullYear()+"-"+(new Date().getMonth()+1)
  62. vm.eventClick()
  63. },
  64. methods: {
  65. //获取就诊卡
  66. getData:function(){
  67. var vm=this
  68. loading.showModal();
  69. sendPost("patient/card/getCardList", {patient:vm.code}, "json", "get",function(){
  70. loading.close();
  71. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  72. }, function(res){
  73. if(res.status == 200){
  74. if(res.data.length>0){
  75. vm.cardlenght=res.data.length
  76. if(Request.id){
  77. vm.data=res.data.filter(function(item){
  78. return item.id==Request.id
  79. })[0]
  80. if(!vm.data){
  81. vm.data=res.data.filter(function(item){
  82. return item.isDefault==1
  83. })[0]
  84. }
  85. }else{
  86. vm.data=res.data.filter(function(item){
  87. return item.isDefault==1
  88. })[0]
  89. }
  90. if(!vm.data){
  91. vm.data=res.data[0]
  92. }
  93. vm.cardId=vm.data.id
  94. vm.queryList.healthNo=vm.data.cardNo
  95. vm.getList(1)
  96. }else{
  97. dialog({
  98. content: "请先绑定就诊卡,再查看就诊充值信息!",
  99. okValue: '确定',
  100. ok: function(){
  101. window.location.href='../../payment/html/patientIDCards.html';
  102. },
  103. // cancelValue: '我再看看',
  104. // cancel: function(){}
  105. }).showModal()
  106. }
  107. }else{
  108. loading.close();
  109. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  110. }
  111. })
  112. },
  113. //获取列表数据
  114. getList:function(pageNo){
  115. var vm=this
  116. if(pageNo){
  117. vm.queryList.pageNo=pageNo
  118. vm.dataList=[]
  119. vm.isUPsuccess=true
  120. }
  121. sendPost("third/hy/pay/gerPayOrderList", vm.queryList, "json", "get",function(){
  122. loading.close();
  123. mui('#wrapper').pullRefresh().endPulldownToRefresh(false);
  124. mui('#wrapper').pullRefresh().enablePullupToRefresh();//重置
  125. mui('#wrapper').pullRefresh().endPullupToRefresh(false);
  126. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  127. }, function(res){
  128. loading.close();
  129. if(vm.queryList.pageNo==1){
  130. vm.length=0
  131. }
  132. if(res.status == 200){
  133. vm.isUPsuccess=true
  134. vm.dataList.push.apply(vm.dataList,res.data)
  135. vm.length+=vm.dataList.length
  136. if(iscrollState=="down"){
  137. mui('#wrapper').pullRefresh().endPulldownToRefresh(false);
  138. mui('#wrapper').pullRefresh().enablePullupToRefresh();//重置
  139. }else{
  140. if(res.data.length<vm.queryList.pageSize){
  141. mui('#wrapper').pullRefresh().endPullupToRefresh(true);
  142. }else{
  143. mui('#wrapper').pullRefresh().endPullupToRefresh(false);
  144. }
  145. }
  146. }else{
  147. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  148. mui('#wrapper').pullRefresh().endPulldownToRefresh(false);
  149. mui('#wrapper').pullRefresh().enablePullupToRefresh();//重置
  150. mui('#wrapper').pullRefresh().endPullupToRefresh(false);
  151. }
  152. })
  153. },
  154. //跳转到订单结果页
  155. gotoResult:function(item){
  156. var vm=this
  157. window.location.href='../../payment/html/paymentResult.html?healthType='+item.healthType+"&patientName="+item.patientName+"&healthNo="+item.healthNo+"&payAmount="+item.payAmount+"&seqNo="+item.seqNo+"&createDate="+item.createDate+"&payStatus="+item.payStatus+"&payType="+item.payType+"&cardId="+this.cardId;
  158. },
  159. //跳转切换就诊卡
  160. changeCards:function(){
  161. window.location.href='../../payment/html/changeCards.html?pre=paymentList';
  162. },
  163. //绑定事件-时间
  164. eventClick:function(){
  165. var vm=this
  166. $('.date-icon').mobiscroll({
  167. preset: 'date',
  168. dateOrder: 'yymm',
  169. dateFormat: 'yy-mm',
  170. theme: 'ios',
  171. lang:'zh',
  172. minDate: new Date(2015,1),
  173. maxDate: new Date(),
  174. onSelect: function(valueText, inst){
  175. if(vm.queryList.month!=valueText){
  176. vm.queryList.month=valueText
  177. vm.getList(1)
  178. }
  179. },
  180. });
  181. },
  182. //跳转我的就诊卡页面
  183. gotoCards:function(){
  184. window.location.href='../../payment/html/patientIDCards.html';
  185. },
  186. //判断是否验证登录通过
  187. checkType:function(){
  188. var vm=this
  189. var timer = setInterval(function(){
  190. if(checktype){
  191. clearInterval(timer);
  192. vm.getData()
  193. }
  194. },10);
  195. },
  196. isdown:function(){
  197. // alert(12)
  198. this.getList(1)
  199. },
  200. isup:function(){
  201. // alert(13)
  202. if(this.isUPsuccess){
  203. this.queryList.pageNo++
  204. this.isUPsuccess=false
  205. }
  206. this.getList()
  207. },
  208. },
  209. })
  210. })()
  211. function queryInit(){
  212. checktype=true
  213. }