"use strict"; var common_vendor = require("../common/vendor.js"); var api_user = require("../api/user.js"); var api_common = require("../api/common.js"); var api_inquiryOrder = require("../api/inquiryOrder.js"); require("../common/request.js"); const _sfc_main = { data() { return { order: null, orderId: null, orderTypeOptions: [], inquiryTypeOptions: [], couponText: "\u8BF7\u9009\u62E9\u4F18\u60E0\u5238", userCouponId: 0, coupons: [], couponShow: false, payMoney: 0, discountMoney: 0 }; }, onLoad(options) { this.orderId = options.orderId; }, onShow() { this.getDictByKey("sys_inquiry_order_type"); this.getDictByKey("sys_inquiry_type"); this.getInquiryOrderById(); this.getMyEnableCouponList(); }, methods: { couponSelect(item) { this.couponShow = false; this.userCouponId = item.id; console.log(item); this.couponText = item.price + "\u5143\u4F18\u60E0\u5238"; this.compute(); }, open() { }, close() { this.couponShow = false; }, openCoupon() { this.couponShow = true; }, delCoupon() { this.userCouponId = 0; this.couponText = "\u8BF7\u9009\u62E9\u4F18\u60E0\u5238"; this.compute(); }, compute() { var data = { orderId: this.orderId, userCouponId: this.userCouponId }; console.log(data); api_inquiryOrder.compute(data).then((res) => { if (res.code == 200) { this.payMoney = res.data.payMoney; this.discountMoney = res.data.discountMoney; } else { this.userCouponId = 0; this.couponText = "\u8BF7\u9009\u62E9\u4F18\u60E0\u5238"; common_vendor.index.showToast({ icon: "none", title: res.msg }); } }, (err) => { }); }, getMyEnableCouponList() { var data = { couponType: 3 }; api_user.getMyEnableCouponList(data).then((res) => { if (res.code == 200) { this.coupons = res.data; } }, (err) => { }); }, getDictByKey(key) { var data = { key }; api_common.getDictByKey(data).then((res) => { if (res.code == 200) { if (key == "sys_inquiry_order_type") { this.orderTypeOptions = res.data; } if (key == "sys_inquiry_type") { this.inquiryTypeOptions = res.data; } } }, (err) => { }); }, getInquiryOrderById() { var data = { orderId: this.orderId }; var that = this; common_vendor.index.showLoading(); api_inquiryOrder.getInquiryOrderById(data).then((res) => { if (res.code == 200) { common_vendor.index.hideLoading(); that.order = res.data; this.compute(); } else { common_vendor.index.showToast({ icon: "none", title: res.msg }); } }, (rej) => { }); }, payOrder() { var data = { orderId: this.order.orderId, userCouponId: this.userCouponId }; common_vendor.index.showLoading(); api_inquiryOrder.pay(data).then((res) => { if (res.code == 200) { common_vendor.index.redirectTo({ url: "./inquiryPayment?orderId=" + this.orderId }); } else { common_vendor.index.showToast({ icon: "none", title: res.msg }); } }, (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: $data.order != null }, $data.order != null ? { b: common_vendor.t($data.order.orderSn) } : {}, { c: common_vendor.t(_ctx.$getDictLabelName($data.inquiryTypeOptions, $data.order.inquiryType)), d: common_vendor.t(_ctx.$getDictLabelName($data.orderTypeOptions, $data.order.orderType)), e: common_vendor.t($data.order.money.toFixed(2)), f: $data.order != null && ($data.order.userCouponId == null || $data.order.userCouponId == 0) }, $data.order != null && ($data.order.userCouponId == null || $data.order.userCouponId == 0) ? common_vendor.e({ g: common_vendor.t($data.couponText), h: $data.userCouponId != 0 }, $data.userCouponId != 0 ? { i: common_vendor.o(($event) => $options.delCoupon()) } : {}, { j: common_vendor.o(($event) => $options.openCoupon()) }) : {}, { k: $data.order.userCouponId == null || $data.order.userCouponId == 0 }, $data.order.userCouponId == null || $data.order.userCouponId == 0 ? { l: common_vendor.t($data.discountMoney.toFixed(2)) } : {}, { m: common_vendor.t($data.payMoney.toFixed(2)), n: $data.coupons.length > 0 }, $data.coupons.length > 0 ? { o: common_vendor.f($data.coupons, (item, k0, i0) => { return common_vendor.e({ a: item.status == 0 }, item.status == 0 ? {} : {}, { b: item.status != 0 }, item.status != 0 ? {} : {}, { c: common_vendor.t(item.price.toFixed(2)), d: common_vendor.t(item.minPrice.toFixed(2)), e: common_vendor.t(item.title), f: item.status == 0 || item.status == 2 }, item.status == 0 || item.status == 2 ? { g: common_vendor.t(item.limitTime) } : {}, { h: item.status == 1 }, item.status == 1 ? { i: common_vendor.t(item.useTime) } : {}, { j: item.status == 1 }, item.status == 1 ? {} : {}, { k: item.status == 2 }, item.status == 2 ? {} : {}, { l: item.status == 0 }, item.status == 0 ? {} : {}, { m: common_vendor.o(($event) => $options.couponSelect(item)) }); }) } : {}, { p: $data.coupons.length == 0 }, $data.coupons.length == 0 ? {} : {}, { q: common_vendor.o($options.close), r: common_vendor.o($options.open), s: common_vendor.p({ closeable: true, show: $data.couponShow, round: 10, mode: "bottom" }), t: common_vendor.t($data.payMoney.toFixed(2)), v: common_vendor.o(($event) => $options.payOrder()) }); } var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-464ba66b"], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_order/inquiryPay.vue"]]); _sfc_main.__runtimeHooks = 2; wx.createPage(MiniProgramPage);