packageDetails.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. "use strict";
  2. var common_vendor = require("../common/vendor.js");
  3. var api_packageOrder = require("../api/packageOrder.js");
  4. var api_companyUser = require("../api/companyUser.js");
  5. var api_package = require("../api/package.js");
  6. require("../common/request.js");
  7. const _sfc_main = {
  8. data() {
  9. return {
  10. orderCount: 0,
  11. storeName: "",
  12. displayText: "\u67E5\u770B\u66F4\u591A",
  13. displayMore: 0,
  14. imgs: [],
  15. activeImg: 1,
  16. doctorShow: false,
  17. doctors: [],
  18. products: [],
  19. packageId: null,
  20. item: {},
  21. describe: null,
  22. doctorId: null,
  23. doctorPageNum: 1,
  24. doctorLastPage: false,
  25. doctorTotal: 0,
  26. companyUserId: null,
  27. companyId: null
  28. };
  29. },
  30. onLoad(option) {
  31. this.packageId = option.packageId;
  32. if (!this.$isEmpty(option.companyId)) {
  33. this.companyId = option.companyId;
  34. }
  35. if (!this.$isEmpty(option.companyUserId)) {
  36. this.companyUserId = option.companyUserId;
  37. }
  38. },
  39. onShow() {
  40. var that = this;
  41. this.$isLogin().then((res) => {
  42. if (res) {
  43. var data = { companyUserId: this.companyUserId };
  44. api_companyUser.bindCompanyUser(data).then((res2) => {
  45. if (res2.code == 200)
  46. ;
  47. }, (rej) => {
  48. });
  49. data = {};
  50. api_packageOrder.getOrderCount(data).then((res2) => {
  51. if (res2.code == 200) {
  52. that.orderCount = res2.count;
  53. }
  54. }, (rej) => {
  55. });
  56. } else {
  57. common_vendor.index.navigateTo({
  58. url: "/pages/auth/login"
  59. });
  60. }
  61. });
  62. this.getPackageById();
  63. this.getPackageDoctorList();
  64. },
  65. onShareAppMessage(res) {
  66. return {
  67. title: this.item.packageName,
  68. path: "/pages_index/packageDetails?packageId=" + this.packageId + "&companyId=" + this.companyId + "&companyUserId=" + this.companyUserId,
  69. imageUrl: this.item.imgUrl
  70. };
  71. },
  72. methods: {
  73. closeOrder() {
  74. this.messageShow = false;
  75. },
  76. showOrder() {
  77. common_vendor.index.navigateTo({
  78. url: "/pages_order/packageOrderList?status=1"
  79. });
  80. },
  81. showMore() {
  82. this.displayMore = this.displayMore == 1 ? 0 : 1;
  83. this.displayText = this.displayMore == 1 ? "\u6536\u8D77" : "\u67E5\u770B\u66F4\u591A";
  84. console.log(this.displayText);
  85. },
  86. swiperChange(event) {
  87. this.activeImg = event.detail.current + 1;
  88. },
  89. handleDoctorClick(item) {
  90. this.doctorShow = false;
  91. this.doctorId = item.doctorId;
  92. this.doSubmit();
  93. },
  94. lower(event) {
  95. if (this.doctorTotal > this.doctors.length) {
  96. this.doctorPageNum++;
  97. this.getPackageDoctorList();
  98. }
  99. },
  100. doSubmit() {
  101. var that = this;
  102. this.$isLogin().then((res) => {
  103. if (res) {
  104. that.submit();
  105. } else {
  106. common_vendor.index.navigateTo({
  107. url: "/pages/auth/login"
  108. });
  109. }
  110. });
  111. },
  112. submit() {
  113. if (this.doctors.length > 0 && this.doctorId == null) {
  114. this.doctorShow = true;
  115. } else {
  116. common_vendor.index.navigateTo({
  117. url: "/pages_index/packageForm?packageId=" + this.packageId + "&doctorId=" + this.doctorId + "&companyId=" + this.companyId + "&companyUserId=" + this.companyUserId
  118. });
  119. }
  120. },
  121. createOrder() {
  122. common_vendor.index.showLoading({
  123. title: "\u5904\u7406\u4E2D..."
  124. });
  125. var data = {
  126. companyId: this.companyId,
  127. companyUserId: this.companyUserId,
  128. packageId: this.packageId,
  129. doctorId: this.doctorId
  130. };
  131. api_packageOrder.create(data).then((res) => {
  132. common_vendor.index.hideLoading();
  133. if (res.code == 200) {
  134. common_vendor.index.navigateTo({
  135. url: "/pages_order/packageOrderPay?orderId=" + res.order.orderId
  136. });
  137. } else {
  138. common_vendor.index.showToast({
  139. icon: "none",
  140. title: res.msg
  141. });
  142. }
  143. });
  144. },
  145. doctorOpen() {
  146. this.doctorShow = true;
  147. },
  148. doctorClose() {
  149. this.doctorShow = false;
  150. },
  151. showImg() {
  152. common_vendor.index.previewImage({
  153. urls: this.imgs,
  154. current: this.imgs[0]
  155. });
  156. },
  157. getPackageDoctorList() {
  158. if (this.doctorLastPage) {
  159. return;
  160. }
  161. var data = {
  162. packageId: this.packageId,
  163. pageNum: this.doctorPageNum,
  164. pageSize: 10
  165. };
  166. var that = this;
  167. api_package.getPackageDoctorList(data).then((res) => {
  168. if (res.code == 200) {
  169. if (this.doctorPageNum == 0) {
  170. that.doctors = res.data.list;
  171. } else {
  172. that.doctors = that.doctors.concat(res.data.list);
  173. }
  174. this.doctorLastPage = res.data.isLastPage;
  175. this.doctorTotal = res.data.total;
  176. console.log(that.doctors);
  177. } else {
  178. common_vendor.index.showToast({
  179. icon: "none",
  180. title: "\u8BF7\u6C42\u5931\u8D25"
  181. });
  182. }
  183. }, (rej) => {
  184. });
  185. },
  186. getPackageById() {
  187. let data = { packageId: this.packageId };
  188. api_package.getPackageById(data).then((res) => {
  189. if (res.code == 200) {
  190. this.item = res.data;
  191. this.storeName = res.storeName;
  192. if (res.data.images != null) {
  193. this.imgs = res.data.images.split(",");
  194. } else {
  195. this.activeImg = 0;
  196. }
  197. this.describe = JSON.parse(this.item.describeJson);
  198. if (this.item.productJson != null) {
  199. this.products = JSON.parse(this.item.productJson);
  200. }
  201. console.log(this.imgs);
  202. } else {
  203. common_vendor.index.showToast({
  204. icon: "none",
  205. title: "\u8BF7\u6C42\u5931\u8D25"
  206. });
  207. }
  208. }, (rej) => {
  209. });
  210. }
  211. }
  212. };
  213. if (!Array) {
  214. const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup");
  215. _easycom_u_popup2();
  216. }
  217. const _easycom_u_popup = () => "../uni_modules/uview-plus/components/u-popup/u-popup.js";
  218. if (!Math) {
  219. _easycom_u_popup();
  220. }
  221. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  222. return common_vendor.e({
  223. a: common_vendor.f($data.imgs, (item, index, i0) => {
  224. return {
  225. a: item,
  226. b: index
  227. };
  228. }),
  229. b: common_vendor.o((...args) => $options.swiperChange && $options.swiperChange(...args)),
  230. c: common_vendor.t($data.activeImg),
  231. d: common_vendor.t($data.imgs.length),
  232. e: common_vendor.o(($event) => $options.showImg()),
  233. f: common_vendor.t($data.item.packageName),
  234. g: $data.item.cycle > 0
  235. }, $data.item.cycle > 0 ? {
  236. h: common_vendor.t($data.item.cycle)
  237. } : {}, {
  238. i: $data.item.duration > 0
  239. }, $data.item.duration > 0 ? {
  240. j: common_vendor.t($data.item.duration)
  241. } : {}, {
  242. k: $data.item != null
  243. }, $data.item != null ? {
  244. l: common_vendor.t($data.item.price.toFixed(2))
  245. } : {}, {
  246. m: $data.item != null && $data.item.packageSubType == 1
  247. }, $data.item != null && $data.item.packageSubType == 1 ? {} : {}, {
  248. n: $data.item != null && $data.item.packageSubType == 2
  249. }, $data.item != null && $data.item.packageSubType == 2 ? {} : {}, {
  250. o: $data.item != null && $data.item.packageSubType == 3
  251. }, $data.item != null && $data.item.packageSubType == 3 ? {} : {}, {
  252. p: common_vendor.t($data.item.sales),
  253. q: $data.describe.use != null
  254. }, $data.describe.use != null ? common_vendor.e({
  255. r: $data.describe != null
  256. }, $data.describe != null ? {
  257. s: $data.describe.use
  258. } : {}) : {}, {
  259. t: $data.item.indication != null
  260. }, $data.item.indication != null ? common_vendor.e({
  261. v: $data.item != null
  262. }, $data.item != null ? {
  263. w: $data.item.indication
  264. } : {}) : {}, {
  265. x: $data.describe.usageMethod != null
  266. }, $data.describe.usageMethod != null ? {
  267. y: $data.describe.usageMethod
  268. } : {}, {
  269. z: $data.describe.forPeople != null
  270. }, $data.describe.forPeople != null ? {
  271. A: $data.describe.forPeople
  272. } : {}, {
  273. B: $data.describe.tabooPeople != null
  274. }, $data.describe.tabooPeople != null ? {
  275. C: $data.describe.tabooPeople
  276. } : {}, {
  277. D: $data.item.explain != null
  278. }, $data.item.explain != null ? {
  279. E: $data.item.explain
  280. } : {}, {
  281. F: $data.item.desc,
  282. G: $data.item != null
  283. }, $data.item != null ? {
  284. H: common_vendor.t($data.item.totalPrice.toFixed(2))
  285. } : {}, {
  286. I: common_vendor.o(($event) => $options.doSubmit()),
  287. J: common_vendor.f($data.doctors, (item, index, i0) => {
  288. return {
  289. a: item.avatar,
  290. b: common_vendor.t(item.doctorName),
  291. c: common_vendor.t(item.position),
  292. d: common_vendor.t(item.hospitalName),
  293. e: common_vendor.t(item.deptName),
  294. f: common_vendor.o(($event) => $options.handleDoctorClick(item)),
  295. g: common_vendor.o(($event) => _ctx.navTo("/pages_doctor/doctorDetails?doctorId=" + item.doctorId))
  296. };
  297. }),
  298. K: common_vendor.o((...args) => $options.lower && $options.lower(...args)),
  299. L: common_vendor.o(($event) => $options.doctorOpen()),
  300. M: common_vendor.o(($event) => $options.doctorClose()),
  301. N: common_vendor.p({
  302. bgColor: "#f6f6f6",
  303. round: 10,
  304. mode: "bottom",
  305. show: $data.doctorShow
  306. }),
  307. O: $data.orderCount > 0
  308. }, $data.orderCount > 0 ? {
  309. P: common_vendor.o(($event) => $options.closeOrder()),
  310. Q: common_vendor.t(_ctx.count),
  311. R: common_vendor.o(($event) => $options.showOrder())
  312. } : {});
  313. }
  314. var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_index/packageDetails.vue"]]);
  315. _sfc_main.__runtimeHooks = 2;
  316. wx.createPage(MiniProgramPage);