hospitalDetails.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. "use strict";
  2. var common_vendor = require("../common/vendor.js");
  3. var api_hospital = require("../api/hospital.js");
  4. var api_doctor = require("../api/doctor.js");
  5. require("../common/request.js");
  6. const _sfc_main = {
  7. data() {
  8. return {
  9. hospitalId: null,
  10. hospital: null,
  11. doctors: []
  12. };
  13. },
  14. onLoad(options) {
  15. this.hospitalId = options.hospitalId;
  16. this.getHospitalById();
  17. this.getDoctorList();
  18. },
  19. methods: {
  20. goMap() {
  21. common_vendor.index.openLocation({
  22. latitude: parseFloat(this.hospital.lat),
  23. longitude: parseFloat(this.hospital.lng),
  24. scale: 18,
  25. name: this.hospital.hospitalName,
  26. address: this.hospital.address,
  27. success: () => {
  28. console.log("\u5BFC\u822Asuccess");
  29. }
  30. });
  31. },
  32. getHospitalById() {
  33. var data = {
  34. hospitalId: this.hospitalId
  35. };
  36. api_hospital.getHospitalById(data).then((res) => {
  37. if (res.code == 200) {
  38. this.hospital = res.data;
  39. } else {
  40. common_vendor.index.showToast({
  41. icon: "none",
  42. title: "\u8BF7\u6C42\u5931\u8D25"
  43. });
  44. }
  45. });
  46. },
  47. getDoctorList() {
  48. var data = {
  49. hospitalId: this.hospitalId,
  50. pageNum: 1,
  51. pageSize: 10
  52. };
  53. api_doctor.getDoctorList(data).then((res) => {
  54. if (res.code == 200) {
  55. res.data.list.forEach(function(value, index, array) {
  56. value.prices = JSON.parse(value.priceJson);
  57. });
  58. this.doctors = res.data.list;
  59. } else {
  60. common_vendor.index.showToast({
  61. icon: "none",
  62. title: "\u8BF7\u6C42\u5931\u8D25"
  63. });
  64. }
  65. });
  66. },
  67. navTo(url) {
  68. common_vendor.index.navigateTo({
  69. url
  70. });
  71. }
  72. }
  73. };
  74. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  75. return common_vendor.e({
  76. a: $data.hospital.imgUrl,
  77. b: common_vendor.t($data.hospital.hospitalName),
  78. c: common_vendor.t($data.hospital.hospitalType),
  79. d: common_vendor.t($data.hospital.address),
  80. e: common_vendor.o(($event) => $options.goMap()),
  81. f: common_vendor.t($data.hospital.descs),
  82. g: $data.doctors.length > 0
  83. }, $data.doctors.length > 0 ? {
  84. h: common_vendor.f($data.doctors, (item, index, i0) => {
  85. return {
  86. a: item.avatar,
  87. b: common_vendor.t(item.doctorName),
  88. c: common_vendor.t(item.position),
  89. d: common_vendor.t(item.hospitalName),
  90. e: common_vendor.t(item.deptName),
  91. f: common_vendor.t(item.speciality),
  92. g: common_vendor.t(item.pingStar),
  93. h: common_vendor.t(item.orderNumber),
  94. i: common_vendor.f(item.prices, (price, index2, i1) => {
  95. return common_vendor.e({
  96. a: common_vendor.t(price.price.toFixed(2)),
  97. b: index2 == 0
  98. }, index2 == 0 ? {} : {});
  99. }),
  100. j: common_vendor.o(($event) => $options.navTo("/pages/doctor/doctorDetails?doctorId=" + item.doctorId))
  101. };
  102. })
  103. } : {});
  104. }
  105. var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-467e4d12"], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_index/hospitalDetails.vue"]]);
  106. wx.createPage(MiniProgramPage);