123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- "use strict";
- var common_vendor = require("../common/vendor.js");
- var api_userAddress = require("../api/userAddress.js");
- require("../common/request.js");
- const _sfc_main = {
- data() {
- return {
- address: []
- };
- },
- onLoad() {
- var that = this;
- common_vendor.index.$on("refreshAddress", () => {
- that.getAddressList();
- });
- },
- onShow() {
- this.getAddressList();
- },
- methods: {
- selectAddress(item) {
- common_vendor.index.$emit("updateAddress", item);
- common_vendor.index.navigateBack({
- delta: 1
- });
- },
- editAddress(item) {
- common_vendor.index.navigateTo({
- url: "./addEditAddress?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_userAddress.delAddress(data).then((res2) => {
- if (res2.code == 200) {
- common_vendor.index.showToast({
- icon: "success",
- title: "\u64CD\u4F5C\u6210\u529F"
- });
- this.getAddressList();
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u8BF7\u6C42\u5931\u8D25"
- });
- }
- }, (rej) => {
- });
- }
- }
- });
- },
- getAddressList() {
- api_userAddress.getAddressList().then((res) => {
- if (res.code == 200) {
- this.address = res.data;
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u8BF7\u6C42\u5931\u8D25"
- });
- }
- }, (rej) => {
- });
- },
- addAddress() {
- common_vendor.index.navigateTo({
- url: "./addEditAddress?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.delAddress(item)),
- i: common_vendor.o(($event) => $options.editAddress(item)),
- j: index,
- k: common_vendor.o(($event) => $options.selectAddress(item), index)
- });
- }),
- b: $data.address.length == 0
- }, $data.address.length == 0 ? {
- c: common_vendor.o(($event) => $options.getAddressList())
- } : {}, {
- d: common_vendor.o(($event) => $options.addAddress())
- });
- }
- 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/address.vue"]]);
- wx.createPage(MiniProgramPage);
|