paymentList.js 7.1 KB

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