Files
frontend-app/unpackage/dist/dev/mp-weixin/pages/mine_address/mine_address.js
T

132 lines
4.1 KiB
JavaScript
Raw Normal View History

2025-03-20 08:46:07 +08:00
"use strict";
const common_vendor = require("../../common/vendor.js");
const api_address = require("../../api/address.js");
2025-05-07 09:54:33 +08:00
const Header = () => "../../components/header.js";
2025-03-20 08:46:07 +08:00
const _sfc_main = {
data() {
return {
2025-05-07 09:54:33 +08:00
addressList: [],
options: [
{ text: "删除" }
]
2025-03-20 08:46:07 +08:00
};
},
2025-05-07 09:54:33 +08:00
components: { Header },
2025-03-20 08:46:07 +08:00
mounted() {
this.getAddressList();
},
methods: {
// 添加地址
jumpAddAddress() {
common_vendor.index.navigateTo({
url: "/pages/mine_address_add/mine_address_add"
});
},
// 查询地址
async getAddressList() {
const res = await api_address.getAddress();
if (res && res.bizcode === 100) {
this.addressList = res.data;
}
},
// 设为默认地址
async isDefaultChange(item) {
const params = {
id: item.id
};
const res = await api_address.setAddressDefault(params);
if (res && res.bizcode === 100) {
this.getAddressList();
}
},
// 删除地址
deleteAddressFun(item) {
const then = this;
common_vendor.index.showModal({
title: "提示",
content: "是否要删除该地址?",
success: function(res) {
if (res.confirm) {
then.deleteAddress(item);
}
}
});
},
// 删除的方法
async deleteAddress(item) {
const params = {
id: item.id
};
const respon = await api_address.deleteAddress(params);
if (respon && respon.bizcode === 100) {
this.getAddressList();
}
},
// 修改地址
updateAddress(item) {
common_vendor.index.navigateTo({
url: "/pages/mine_address_add/mine_address_add?id=" + item.id
});
}
}
};
if (!Array) {
2025-05-07 09:54:33 +08:00
const _component_Header = common_vendor.resolveComponent("Header");
2025-03-20 08:46:07 +08:00
const _easycom_up_checkbox2 = common_vendor.resolveComponent("up-checkbox");
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
2025-05-07 09:54:33 +08:00
(_component_Header + _easycom_up_checkbox2 + _easycom_up_image2)();
2025-03-20 08:46:07 +08:00
}
const _easycom_up_checkbox = () => "../../uni_modules/uview-plus/components/u-checkbox/u-checkbox.js";
const _easycom_up_image = () => "../../uni_modules/uview-plus/components/u-image/u-image.js";
if (!Math) {
(_easycom_up_checkbox + _easycom_up_image)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
2025-05-07 09:54:33 +08:00
a: common_vendor.p({
leftTitle: _ctx.$t("address.title"),
["left-path-type"]: "switchTab",
["left-path"]: "/pages/mine/mine"
}),
b: $data.addressList && $data.addressList.length !== 0
2025-03-20 08:46:07 +08:00
}, $data.addressList && $data.addressList.length !== 0 ? {
2025-05-07 09:54:33 +08:00
c: common_vendor.f($data.addressList, (item, k0, i0) => {
2025-03-20 08:46:07 +08:00
return {
a: common_vendor.t(item.name),
b: common_vendor.t(item.phone),
c: common_vendor.t(item.countryName),
d: common_vendor.t(item.provinceName),
e: common_vendor.t(item.cityName),
f: common_vendor.t(item.areaName),
g: common_vendor.t(item.address),
h: common_vendor.o(($event) => $options.isDefaultChange(item), item.id),
2025-05-07 09:54:33 +08:00
i: "1172d71f-1-" + i0,
2025-03-20 08:46:07 +08:00
j: common_vendor.p({
customStyle: {},
label: "已默认",
name: "agree",
usedAlone: true,
checked: item.isDefault,
shape: "circle",
activeColor: "#FF7C41"
}),
k: common_vendor.o(($event) => $options.deleteAddressFun(item), item.id),
l: common_vendor.o(($event) => $options.updateAddress(item), item.id),
m: item.id
};
})
} : {
2025-05-07 09:54:33 +08:00
d: common_vendor.p({
2025-03-20 08:46:07 +08:00
src: "/static/common/not_search.png",
width: "100",
height: "100",
bgColor: "#f1f6ff00"
})
}, {
2025-05-07 09:54:33 +08:00
e: common_vendor.o((...args) => $options.jumpAddAddress && $options.jumpAddAddress(...args))
2025-03-20 08:46:07 +08:00
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-1172d71f"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mine_address/mine_address.js.map