service-detail.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. (function ($) {
  2. function Page(option) {
  3. this.init();
  4. }
  5. Page.prototype = {
  6. //初始化
  7. init: function () {
  8. this.initServiceInfo();
  9. },
  10. initServiceInfo: function(){
  11. var itemCode = this.GetQueryString('itemCode');
  12. var loading = dialog({contentType:'load', skin:'bk-popup'});
  13. loading.show();
  14. sendPost("/patient/sign/service/getItemByItemCode", {itemCode: itemCode}, "json", "get", function(){
  15. }, function(res){
  16. loading.close();
  17. if(res.status == 200){
  18. var data = res.data;
  19. $('.view').html('');
  20. var aHtml = '';
  21. if(itemCode == '1'){
  22. aHtml = '<a href="./medical-examination.html">立即检查</a>';
  23. }
  24. if(itemCode == '2'){
  25. aHtml = '<a href="tel:'+data.mobile.replace('-','')+'">立即拨打</a>'
  26. }
  27. var html = '<div class="page-content btn-toolbar">'
  28. +'<div class="service-detail-header">'
  29. +'<a href="#">'
  30. +'<img src="'+ getImgUrl(data.image)+'" alt="">'
  31. +'</a>'
  32. +'</div>'
  33. +'<div class="service-detail-content">'
  34. +'<div class="title">'
  35. + data.name
  36. +'</div>'
  37. +'<div class="content">'
  38. +'<div class="subtitle">'
  39. + data.subName
  40. +'</div>'
  41. + data.introduce
  42. +'</div>'
  43. +'</div>'
  44. +'</div>'
  45. +'<div class="btn-bar">'
  46. + aHtml
  47. +'</div>';
  48. $('.view').append(html);
  49. }else{
  50. dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:'数据获取失败!'+res.msg}).show();
  51. }
  52. });
  53. },
  54. GetQueryString: function(name){
  55. var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
  56. var r = window.location.search.substr(1).match(reg);
  57. if(r!=null)return unescape(r[2]); return null;
  58. }
  59. };
  60. $(document).ready(function () {
  61. var page = new Page();
  62. });
  63. })(jQuery);