"use strict"; var common_vendor = require("../common/vendor.js"); var api_packageOrder = require("../api/packageOrder.js"); var api_companyUser = require("../api/companyUser.js"); var api_package = require("../api/package.js"); require("../common/request.js"); const _sfc_main = { data() { return { orderCount: 0, storeName: "", displayText: "\u67E5\u770B\u66F4\u591A", displayMore: 0, imgs: [], activeImg: 1, doctorShow: false, doctors: [], products: [], packageId: null, item: {}, describe: null, doctorId: null, doctorPageNum: 1, doctorLastPage: false, doctorTotal: 0, companyUserId: null, companyId: null }; }, onLoad(option) { this.packageId = option.packageId; if (!this.$isEmpty(option.companyId)) { this.companyId = option.companyId; } if (!this.$isEmpty(option.companyUserId)) { this.companyUserId = option.companyUserId; } }, onShow() { var that = this; this.$isLogin().then((res) => { if (res) { var data = { companyUserId: this.companyUserId }; api_companyUser.bindCompanyUser(data).then((res2) => { if (res2.code == 200) ; }, (rej) => { }); data = {}; api_packageOrder.getOrderCount(data).then((res2) => { if (res2.code == 200) { that.orderCount = res2.count; } }, (rej) => { }); } else { common_vendor.index.navigateTo({ url: "/pages/auth/login" }); } }); this.getPackageById(); this.getPackageDoctorList(); }, onShareAppMessage(res) { return { title: this.item.packageName, path: "/pages_index/packageDetails?packageId=" + this.packageId + "&companyId=" + this.companyId + "&companyUserId=" + this.companyUserId, imageUrl: this.item.imgUrl }; }, methods: { closeOrder() { this.messageShow = false; }, showOrder() { common_vendor.index.navigateTo({ url: "/pages_order/packageOrderList?status=1" }); }, showMore() { this.displayMore = this.displayMore == 1 ? 0 : 1; this.displayText = this.displayMore == 1 ? "\u6536\u8D77" : "\u67E5\u770B\u66F4\u591A"; console.log(this.displayText); }, swiperChange(event) { this.activeImg = event.detail.current + 1; }, handleDoctorClick(item) { this.doctorShow = false; this.doctorId = item.doctorId; this.doSubmit(); }, lower(event) { if (this.doctorTotal > this.doctors.length) { this.doctorPageNum++; this.getPackageDoctorList(); } }, doSubmit() { var that = this; this.$isLogin().then((res) => { if (res) { that.submit(); } else { common_vendor.index.navigateTo({ url: "/pages/auth/login" }); } }); }, submit() { if (this.doctors.length > 0 && this.doctorId == null) { this.doctorShow = true; } else { common_vendor.index.navigateTo({ url: "/pages_index/packageForm?packageId=" + this.packageId + "&doctorId=" + this.doctorId + "&companyId=" + this.companyId + "&companyUserId=" + this.companyUserId }); } }, createOrder() { common_vendor.index.showLoading({ title: "\u5904\u7406\u4E2D..." }); var data = { companyId: this.companyId, companyUserId: this.companyUserId, packageId: this.packageId, doctorId: this.doctorId }; api_packageOrder.create(data).then((res) => { common_vendor.index.hideLoading(); if (res.code == 200) { common_vendor.index.navigateTo({ url: "/pages_order/packageOrderPay?orderId=" + res.order.orderId }); } else { common_vendor.index.showToast({ icon: "none", title: res.msg }); } }); }, doctorOpen() { this.doctorShow = true; }, doctorClose() { this.doctorShow = false; }, showImg() { common_vendor.index.previewImage({ urls: this.imgs, current: this.imgs[0] }); }, getPackageDoctorList() { if (this.doctorLastPage) { return; } var data = { packageId: this.packageId, pageNum: this.doctorPageNum, pageSize: 10 }; var that = this; api_package.getPackageDoctorList(data).then((res) => { if (res.code == 200) { if (this.doctorPageNum == 0) { that.doctors = res.data.list; } else { that.doctors = that.doctors.concat(res.data.list); } this.doctorLastPage = res.data.isLastPage; this.doctorTotal = res.data.total; console.log(that.doctors); } else { common_vendor.index.showToast({ icon: "none", title: "\u8BF7\u6C42\u5931\u8D25" }); } }, (rej) => { }); }, getPackageById() { let data = { packageId: this.packageId }; api_package.getPackageById(data).then((res) => { if (res.code == 200) { this.item = res.data; this.storeName = res.storeName; if (res.data.images != null) { this.imgs = res.data.images.split(","); } else { this.activeImg = 0; } this.describe = JSON.parse(this.item.describeJson); if (this.item.productJson != null) { this.products = JSON.parse(this.item.productJson); } console.log(this.imgs); } else { common_vendor.index.showToast({ icon: "none", title: "\u8BF7\u6C42\u5931\u8D25" }); } }, (rej) => { }); } } }; if (!Array) { const _easycom_u_popup2 = common_vendor.resolveComponent("u-popup"); _easycom_u_popup2(); } const _easycom_u_popup = () => "../uni_modules/uview-plus/components/u-popup/u-popup.js"; if (!Math) { _easycom_u_popup(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: common_vendor.f($data.imgs, (item, index, i0) => { return { a: item, b: index }; }), b: common_vendor.o((...args) => $options.swiperChange && $options.swiperChange(...args)), c: common_vendor.t($data.activeImg), d: common_vendor.t($data.imgs.length), e: common_vendor.o(($event) => $options.showImg()), f: common_vendor.t($data.item.packageName), g: $data.item.cycle > 0 }, $data.item.cycle > 0 ? { h: common_vendor.t($data.item.cycle) } : {}, { i: $data.item.duration > 0 }, $data.item.duration > 0 ? { j: common_vendor.t($data.item.duration) } : {}, { k: $data.item != null }, $data.item != null ? { l: common_vendor.t($data.item.price.toFixed(2)) } : {}, { m: $data.item != null && $data.item.packageSubType == 1 }, $data.item != null && $data.item.packageSubType == 1 ? {} : {}, { n: $data.item != null && $data.item.packageSubType == 2 }, $data.item != null && $data.item.packageSubType == 2 ? {} : {}, { o: $data.item != null && $data.item.packageSubType == 3 }, $data.item != null && $data.item.packageSubType == 3 ? {} : {}, { p: common_vendor.t($data.item.sales), q: $data.describe.use != null }, $data.describe.use != null ? common_vendor.e({ r: $data.describe != null }, $data.describe != null ? { s: $data.describe.use } : {}) : {}, { t: $data.item.indication != null }, $data.item.indication != null ? common_vendor.e({ v: $data.item != null }, $data.item != null ? { w: $data.item.indication } : {}) : {}, { x: $data.describe.usageMethod != null }, $data.describe.usageMethod != null ? { y: $data.describe.usageMethod } : {}, { z: $data.describe.forPeople != null }, $data.describe.forPeople != null ? { A: $data.describe.forPeople } : {}, { B: $data.describe.tabooPeople != null }, $data.describe.tabooPeople != null ? { C: $data.describe.tabooPeople } : {}, { D: $data.item.explain != null }, $data.item.explain != null ? { E: $data.item.explain } : {}, { F: $data.item.desc, G: $data.item != null }, $data.item != null ? { H: common_vendor.t($data.item.totalPrice.toFixed(2)) } : {}, { I: common_vendor.o(($event) => $options.doSubmit()), J: common_vendor.f($data.doctors, (item, index, i0) => { return { a: item.avatar, b: common_vendor.t(item.doctorName), c: common_vendor.t(item.position), d: common_vendor.t(item.hospitalName), e: common_vendor.t(item.deptName), f: common_vendor.o(($event) => $options.handleDoctorClick(item)), g: common_vendor.o(($event) => _ctx.navTo("/pages_doctor/doctorDetails?doctorId=" + item.doctorId)) }; }), K: common_vendor.o((...args) => $options.lower && $options.lower(...args)), L: common_vendor.o(($event) => $options.doctorOpen()), M: common_vendor.o(($event) => $options.doctorClose()), N: common_vendor.p({ bgColor: "#f6f6f6", round: 10, mode: "bottom", show: $data.doctorShow }), O: $data.orderCount > 0 }, $data.orderCount > 0 ? { P: common_vendor.o(($event) => $options.closeOrder()), Q: common_vendor.t(_ctx.count), R: common_vendor.o(($event) => $options.showOrder()) } : {}); } 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"]]); _sfc_main.__runtimeHooks = 2; wx.createPage(MiniProgramPage);