"use strict"; var common_vendor = require("../common/vendor.js"); var api_integral = require("../api/integral.js"); require("../common/request.js"); const _sfc_main = { data() { return { addressId: null, address: null, orderId: null, order: null, item: null }; }, onLoad(option) { this.goodsId = option.goodsId; var that = this; common_vendor.index.$on("updateAddress", (e) => { that.addressId = e.addressId; that.address = e; that.address.address = e.province + e.city + e.district + e.detail; }); this.getIntegralGoodsById(); }, methods: { getIntegralGoodsById() { var data = { goodsId: this.goodsId }; console.log(data); api_integral.getIntegralGoodsById(data).then((res) => { if (res.code == 200) { this.item = res.data; } }, (rej) => { }); }, openAddress() { common_vendor.index.navigateTo({ url: "/pages_user/address" }); }, payOrder() { if (this.addressId == null) { common_vendor.index.showToast({ icon: "none", title: "\u8BF7\u9009\u62E9\u6536\u8D27\u5730\u5740" }); return; } var data = { goodsId: this.goodsId, addressId: this.addressId }; common_vendor.index.showLoading(); api_integral.createOrder(data).then((res) => { if (res.code == 200) { common_vendor.index.redirectTo({ url: "./integralOrderPaySuccess?orderId=" + res.order.orderId }); } else { common_vendor.index.showToast({ icon: "none", title: res.msg }); } }, (rej) => { }); } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: $data.address == null }, $data.address == null ? { b: common_vendor.o(($event) => $options.openAddress()) } : {}, { c: $data.address != null }, $data.address != null ? common_vendor.e({ d: common_vendor.t($data.address.realName), e: $data.address.phone != null }, $data.address.phone != null ? { f: common_vendor.t($data.address.phone) } : {}, { g: common_vendor.t($data.address.address), h: common_vendor.o(($event) => $options.openAddress()) }) : {}, { i: $data.item.imgUrl == "" ? "/static/images/drug.svg" : $data.item.imgUrl, j: common_vendor.t($data.item.goodsName), k: common_vendor.t($data.item.integral), l: common_vendor.t($data.item.integral), m: $data.item != null }, $data.item != null ? { n: common_vendor.o(($event) => $options.payOrder()) } : {}); } var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_user/integralOrderPay.vue"]]); wx.createPage(MiniProgramPage);