paymentList.js 6.7 KB

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