"use strict"; var common_vendor = require("../common/vendor.js"); var api_order = require("../api/order.js"); require("../common/request.js"); const _sfc_main = { data() { return { address: [] }; }, onLoad() { this.getUserAddr(); common_vendor.index.$on("refreshAddress", () => { this.getUserAddr(); }); }, methods: { getUserAddr() { this.userInfo = JSON.parse(common_vendor.index.getStorageSync("userInfo")); api_order.userAddr(this.userInfo.userId).then((res) => { if (res.code == 200) { console.log("\u7528\u6237\u6536\u8D27\u5730\u5740>>>>", res.data); this.address = res.data; } else { common_vendor.index.showToast({ title: res.msg, icon: "none" }); } }, (rej) => { }); }, selectAddress(item) { common_vendor.index.$emit("updateAddress", item); common_vendor.index.navigateBack({ delta: 1 }); }, editAddress(item) { common_vendor.index.navigateTo({ url: "./addAddress?type=edit&addressId=" + item.addressId }); }, delAddress(item) { common_vendor.index.showModal({ title: "\u63D0\u793A", content: "\u786E\u8BA4\u5220\u9664\u6B64\u5730\u5740\u5417?", showCancel: true, cancelText: "\u53D6\u6D88", confirmText: "\u786E\u5B9A", success: (res) => { if (res.confirm) { var data = { addressId: item.addressId }; api_order.delAddress(data).then((res2) => { if (res2.code == 200) { common_vendor.index.showToast({ icon: "success", title: "\u64CD\u4F5C\u6210\u529F" }); this.getUserAddr(); } else { common_vendor.index.showToast({ icon: "none", title: "\u8BF7\u6C42\u5931\u8D25" }); } }, (rej) => { }); } } }); }, addAdress() { common_vendor.index.navigateTo({ url: "./addAddress?type=add" }); } } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: common_vendor.f($data.address, (item, index, i0) => { return common_vendor.e({ a: item.isDefault == 1 }, item.isDefault == 1 ? {} : {}, { b: common_vendor.t(item.province), c: common_vendor.t(item.city), d: common_vendor.t(item.district), e: common_vendor.t(item.detail), f: common_vendor.t(item.realName), g: common_vendor.t(_ctx.$parsePhone(item.phone)), h: common_vendor.o(($event) => $options.selectAddress(item)), i: common_vendor.o(($event) => $options.delAddress(item)), j: common_vendor.o(($event) => $options.editAddress(item)), k: index }); }), b: $data.address.length == 0 }, $data.address.length == 0 ? { c: common_vendor.o(($event) => _ctx.getAddressList()) } : {}, { d: common_vendor.o((...args) => $options.addAdress && $options.addAdress(...args)) }); } var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "C:/Users/Administrator/Desktop/\u9879\u76EE/\u76F4\u64AD/liveH5-v3/pages_user/address.vue"]]); wx.createPage(MiniProgramPage);