packageDetails.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. "use strict";
  2. var common_vendor = require("../common/vendor.js");
  3. var api_package = require("../api/package.js");
  4. require("../common/request.js");
  5. const _sfc_main = {
  6. data() {
  7. return {
  8. displayText: "\u67E5\u770B\u66F4\u591A",
  9. displayMore: 0,
  10. imgs: [],
  11. activeImg: 1,
  12. doctorShow: false,
  13. doctors: [],
  14. products: [],
  15. packageId: null,
  16. item: {},
  17. describe: null,
  18. doctorId: null,
  19. doctorPageNum: 1,
  20. doctorLastPage: false,
  21. doctorTotal: 0
  22. };
  23. },
  24. onLoad(option) {
  25. this.packageId = option.packageId;
  26. this.companyId = common_vendor.index.getStorageSync("companyId");
  27. this.companyUserId = common_vendor.index.getStorageSync("companyUserId");
  28. },
  29. onShow() {
  30. this.getPackageById();
  31. this.getPackageDoctorList();
  32. },
  33. onShareAppMessage(res) {
  34. return {
  35. title: this.item.packageName,
  36. path: "/pages_index/packageDetails?packageId=" + this.packageId + "&companyId=" + this.companyId + "&companyUserId=" + this.companyUserId,
  37. imageUrl: this.item.imgUrl
  38. };
  39. },
  40. methods: {
  41. showMore() {
  42. this.displayMore = this.displayMore == 1 ? 0 : 1;
  43. this.displayText = this.displayMore == 1 ? "\u6536\u8D77" : "\u67E5\u770B\u66F4\u591A";
  44. console.log(this.displayText);
  45. },
  46. swiperChange(event) {
  47. this.activeImg = event.detail.current + 1;
  48. },
  49. handleDoctorClick(item) {
  50. this.doctorShow = false;
  51. this.doctorId = item.doctorId;
  52. common_vendor.index.navigateTo({
  53. url: "/pages_index/packageForm?packageId=" + this.packageId + "&doctorId=" + this.doctorId
  54. });
  55. },
  56. lower(event) {
  57. if (this.doctorTotal > this.doctors.length) {
  58. this.doctorPageNum++;
  59. this.getPackageDoctorList();
  60. }
  61. },
  62. doctorOpen() {
  63. this.doctorShow = true;
  64. },
  65. doctorClose() {
  66. this.doctorShow = false;
  67. },
  68. showImg() {
  69. common_vendor.index.previewImage({
  70. urls: this.imgs,
  71. current: this.imgs[0]
  72. });
  73. },
  74. getPackageDoctorList() {
  75. if (this.doctorLastPage) {
  76. return;
  77. }
  78. var data = {
  79. packageId: this.packageId,
  80. pageNum: this.doctorPageNum,
  81. pageSize: 10
  82. };
  83. var that = this;
  84. api_package.getPackageDoctorList(data).then((res) => {
  85. if (res.code == 200) {
  86. if (this.doctorPageNum == 0) {
  87. that.doctors = res.data.list;
  88. } else {
  89. that.doctors = that.doctors.concat(res.data.list);
  90. }
  91. this.doctorLastPage = res.data.isLastPage;
  92. this.doctorTotal = res.data.total;
  93. console.log(that.doctors);
  94. } else {
  95. common_vendor.index.showToast({
  96. icon: "none",
  97. title: "\u8BF7\u6C42\u5931\u8D25"
  98. });
  99. }
  100. }, (rej) => {
  101. });
  102. },
  103. getPackageById() {
  104. let data = { packageId: this.packageId };
  105. api_package.getPackageById(data).then((res) => {
  106. if (res.code == 200) {
  107. this.item = res.data;
  108. if (res.data.images != null) {
  109. this.imgs = res.data.images.split(",");
  110. } else {
  111. this.activeImg = 0;
  112. }
  113. this.describe = JSON.parse(this.item.describeJson);
  114. if (this.item.productJson != null) {
  115. this.products = JSON.parse(this.item.productJson);
  116. }
  117. console.log(this.imgs);
  118. } else {
  119. common_vendor.index.showToast({
  120. icon: "none",
  121. title: "\u8BF7\u6C42\u5931\u8D25"
  122. });
  123. }
  124. }, (rej) => {
  125. });
  126. }
  127. }
  128. };
  129. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  130. return common_vendor.e({
  131. a: common_vendor.f($data.imgs, (item, index, i0) => {
  132. return {
  133. a: item,
  134. b: index
  135. };
  136. }),
  137. b: common_vendor.o((...args) => $options.swiperChange && $options.swiperChange(...args)),
  138. c: common_vendor.t($data.activeImg),
  139. d: common_vendor.t($data.imgs.length),
  140. e: common_vendor.o(($event) => $options.showImg()),
  141. f: common_vendor.t($data.item.packageName),
  142. g: $data.item.cycle > 0
  143. }, $data.item.cycle > 0 ? {
  144. h: common_vendor.t($data.item.cycle)
  145. } : {}, {
  146. i: $data.item.duration > 0
  147. }, $data.item.duration > 0 ? {
  148. j: common_vendor.t($data.item.duration)
  149. } : {}, {
  150. k: $data.item != null
  151. }, $data.item != null ? {
  152. l: common_vendor.t($data.item.price.toFixed(2))
  153. } : {}, {
  154. m: $data.item != null && $data.item.packageSubType == 1
  155. }, $data.item != null && $data.item.packageSubType == 1 ? {} : {}, {
  156. n: $data.item != null && $data.item.packageSubType == 2
  157. }, $data.item != null && $data.item.packageSubType == 2 ? {} : {}, {
  158. o: $data.item != null && $data.item.packageSubType == 3
  159. }, $data.item != null && $data.item.packageSubType == 3 ? {} : {}, {
  160. p: common_vendor.t($data.item.sales),
  161. q: $data.products.length > 0
  162. }, $data.products.length > 0 ? common_vendor.e({
  163. r: common_vendor.f($data.products, (product, index, i0) => {
  164. return common_vendor.e({
  165. a: $data.displayMore == 0 ? index < 2 : true
  166. }, ($data.displayMore == 0 ? index < 2 : true) ? {
  167. b: product.image,
  168. c: common_vendor.t(product.productName),
  169. d: common_vendor.t(product.sku),
  170. e: common_vendor.t(product.usageMethod)
  171. } : {});
  172. }),
  173. s: $data.products.length > 2
  174. }, $data.products.length > 2 ? {
  175. t: common_vendor.t($data.displayText),
  176. v: common_vendor.o(($event) => $options.showMore())
  177. } : {}) : {}, {
  178. w: $data.describe.use != null
  179. }, $data.describe.use != null ? common_vendor.e({
  180. x: $data.describe != null
  181. }, $data.describe != null ? {
  182. y: $data.describe.use
  183. } : {}) : {}, {
  184. z: $data.item.indication != null
  185. }, $data.item.indication != null ? common_vendor.e({
  186. A: $data.item != null
  187. }, $data.item != null ? {
  188. B: $data.item.indication
  189. } : {}) : {}, {
  190. C: $data.describe.usageMethod != null
  191. }, $data.describe.usageMethod != null ? {
  192. D: $data.describe.usageMethod
  193. } : {}, {
  194. E: $data.describe.forPeople != null
  195. }, $data.describe.forPeople != null ? {
  196. F: $data.describe.forPeople
  197. } : {}, {
  198. G: $data.describe.tabooPeople != null
  199. }, $data.describe.tabooPeople != null ? {
  200. H: $data.describe.tabooPeople
  201. } : {}, {
  202. I: $data.item.explain != null
  203. }, $data.item.explain != null ? {
  204. J: $data.item.explain
  205. } : {}, {
  206. K: $data.item.desc,
  207. L: $data.item != null
  208. }, $data.item != null ? {
  209. M: common_vendor.t($data.item.totalPrice.toFixed(2))
  210. } : {});
  211. }
  212. var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_company/packageDetails.vue"]]);
  213. _sfc_main.__runtimeHooks = 2;
  214. wx.createPage(MiniProgramPage);