paymentList.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. id:"",
  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. }else{
  81. vm.data=res.data.filter(function(item){
  82. return item.isDefault==1
  83. })[0]
  84. }
  85. if(!vm.data){
  86. vm.data=res.data[0]
  87. }
  88. vm.queryList.healthNo=vm.data.cardNo
  89. vm.getList(1)
  90. }else{
  91. dialog({
  92. content: "请先绑定就诊卡,再查看就诊缴费信息!",
  93. okValue: '确定',
  94. ok: function(){
  95. window.location.href='../../payment/html/patientIDCards.html';
  96. },
  97. // cancelValue: '我再看看',
  98. // cancel: function(){}
  99. }).showModal()
  100. }
  101. }else{
  102. loading.close();
  103. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  104. }
  105. })
  106. },
  107. //获取列表数据
  108. getList:function(pageNo){
  109. var vm=this
  110. if(pageNo){
  111. vm.queryList.pageNo=pageNo
  112. vm.dataList=[]
  113. }
  114. sendPost("third/hy/pay/gerPayOrderList", vm.queryList, "json", "get",function(){
  115. loading.close();
  116. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'请求失败'}).show();
  117. }, function(res){
  118. loading.close();
  119. if(vm.queryList.pageNo==1){
  120. vm.length=0
  121. }
  122. if(res.status == 200){
  123. vm.isUPsuccess=true
  124. vm.dataList.push.apply(vm.dataList,res.data)
  125. vm.length+=vm.dataList.length
  126. if(iscrollState=="down"){
  127. mui('#wrapper').pullRefresh().endPulldownToRefresh(false);
  128. mui('#wrapper').pullRefresh().enablePullupToRefresh();//重置
  129. }else{
  130. if(res.data.length<vm.queryList.pageSize){
  131. mui('#wrapper').pullRefresh().enablePullupToRefresh(true);
  132. }else{
  133. mui('#wrapper').pullRefresh().enablePullupToRefresh(false);
  134. }
  135. }
  136. }else{
  137. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败'}).show();
  138. mui('#wrapper').pullRefresh().endPulldownToRefresh(false);
  139. mui('#wrapper').pullRefresh().enablePullupToRefresh();//重置
  140. }
  141. })
  142. },
  143. //跳转到订单结果页
  144. gotoResult:function(index){
  145. var vm=this
  146. // console.log($($(index)[0].currentTarget).attr("data-id"))
  147. var item=vm.dataList[index]
  148. 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;
  149. },
  150. //跳转切换就诊卡
  151. changeCards:function(){
  152. window.location.href='../../payment/html/changeCards.html?pre=paymentList';
  153. },
  154. //绑定事件-时间
  155. eventClick:function(){
  156. var vm=this
  157. $('.date-icon').mobiscroll({
  158. preset: 'date',
  159. dateOrder: 'yymm',
  160. dateFormat: 'yy-mm',
  161. theme: 'ios',
  162. lang:'zh',
  163. minDate: new Date(2015,1),
  164. maxDate: new Date(),
  165. onSelect: function(valueText, inst){
  166. if(vm.queryList.month!=valueText){
  167. vm.queryList.month=valueText
  168. vm.getList(1)
  169. }
  170. },
  171. });
  172. },
  173. //跳转我的就诊卡页面
  174. gotoCards:function(){
  175. window.location.href='../../payment/html/patientIDCards.html';
  176. },
  177. //判断是否验证登录通过
  178. checkType:function(){
  179. var vm=this
  180. var timer = setInterval(function(){
  181. if(checktype){
  182. clearInterval(timer);
  183. vm.getData()
  184. }
  185. },10);
  186. },
  187. isdown:function(){
  188. alert(12)
  189. this.getList(1)
  190. },
  191. isup:function(){
  192. alert(13)
  193. if(this.isUPsuccess){
  194. this.queryList.pageNo++
  195. this.isUPsuccess=false
  196. }
  197. this.getList()
  198. },
  199. },
  200. })
  201. })()
  202. function queryInit(){
  203. checktype=true
  204. }