confirm-info.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. var request = GetRequest(),
  2. id = request.id;
  3. new Vue({
  4. el: "#main",
  5. data: {
  6. dateInfo: {},
  7. numberInfo: {},
  8. baseInfo: {},
  9. patientInfo: {},
  10. Warntxt: "",
  11. },
  12. mounted: function() {
  13. EventBus.$emit("jump-step", {
  14. step: 4
  15. }); //step:跳转的步数
  16. //从缓存获取前一个页面缓存的信息
  17. var dateInfo = window.localStorage.getItem("dateInfo"),
  18. numberInfo = window.localStorage.getItem("numberInfo"),
  19. baseInfo = window.localStorage.getItem("baseInfo"),
  20. patientInfo = window.sessionStorage.getItem("oauthInfo");
  21. if(patientInfo) {
  22. patientInfo = JSON.parse(patientInfo);
  23. this.patientInfo = patientInfo;
  24. }
  25. if(dateInfo) {
  26. dateInfo = JSON.parse(dateInfo);
  27. this.dateInfo = dateInfo;
  28. }
  29. if(numberInfo) {
  30. numberInfo = JSON.parse(numberInfo);
  31. this.numberInfo = numberInfo;
  32. }
  33. if(baseInfo) {
  34. baseInfo = JSON.parse(baseInfo);
  35. this.baseInfo = baseInfo;
  36. }
  37. jiuzhenAPI.getRegisterWarn({
  38. token: "e8b01d2e-6dc8-4ba2-8422-462ae7535651"
  39. }).then(function(res) {
  40. this.Warntxt = res.value.replace("预约须知:", "")
  41. })
  42. },
  43. methods: {
  44. confirm: function() {
  45. var userInfo = this.patientInfo,
  46. baseInfo = this.baseInfo,
  47. dateInfo = this.dateInfo,
  48. numberInfo = this.numberInfo;
  49. var params = {
  50. thirdPartyUserId: userInfo.id,
  51. patientName: userInfo.realName,
  52. tel: userInfo.telephone,
  53. IP: returnCitySN.cip, //通过搜狐接口获得ip地址
  54. cardNo: userInfo.idCardNo,
  55. modeId: dateInfo.modeId,
  56. hospitalId: baseInfo.hospitalId,
  57. hospitalName: baseInfo.hosName,
  58. hosDeptId: baseInfo.hosDeptId,
  59. hosDeptName: baseInfo.deptName,
  60. doctorSn: baseInfo.doctorSn,
  61. doctorName: baseInfo.doctorName,
  62. numberSn: numberInfo.numberSN,
  63. numberPrice: dateInfo.specialPrice,
  64. thirdPartyOrderId: id,
  65. registerDate: dateInfo.registerDate,
  66. timeId: dateInfo.timeId,
  67. commendTime: numberInfo.commendTime,
  68. serialNo: numberInfo.serialNo
  69. }
  70. appointmentAPI.createRegOrderForOpen(params).then(function(res) {
  71. if(res.successFlg) {
  72. if(res.obj.Code == "10000") {
  73. var orderId = res.obj.orderId;
  74. //更新我们自己系统的挂号单信息
  75. var params2 = {
  76. id: res.obj.thirdPartyOrderId,
  77. userId: userInfo.id
  78. };
  79. appointmentAPI.updateRegistrationOrder(params2).then(function(res) {
  80. console.log(res);
  81. if(res.successFlg) {
  82. window.localStorage.removeItem("dateInfo");
  83. window.localStorage.removeItem("numberInfo");
  84. window.localStorage.removeItem("baseInfo");
  85. window.location.href = "success-info.html?orderId=" + orderId + "&hospitalId=" + baseInfo.hospitalId + "&deptId=" + baseInfo.hosDeptId;
  86. } else {
  87. console.log(res.errorMsg);
  88. }
  89. })
  90. } else {
  91. showErrorMessage(res.obj.Message);
  92. }
  93. } else {
  94. showErrorMessage(res.errorMsg);
  95. }
  96. });
  97. },
  98. cancel: function() {
  99. var params = {
  100. id: id,
  101. state: 99 //订单状态: 1-待付款,2-待就诊,11-预约中,22-退款中,99-已退号,-1-系统取消,3-已就诊
  102. };
  103. appointmentAPI.updateOrderState(params).then(function(res) {
  104. if(res.successFlg) {
  105. window.localStorage.removeItem("dateInfo");
  106. window.localStorage.removeItem("numberInfo");
  107. window.localStorage.removeItem("baseInfo");
  108. document.history.back();
  109. } else {
  110. showErrorMessage(res.errorMsg);
  111. }
  112. })
  113. }
  114. }
  115. })
  116. function showErrorMessage(content) {
  117. layer.msg(content, {
  118. icon: 2,
  119. time: 3000
  120. });
  121. }