增加新模块
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const api_address = require("../../api/address.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
addressList: []
|
||||
};
|
||||
},
|
||||
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) {
|
||||
common_vendor.index.__f__("log", "at pages/mine_address/mine_address.vue:79", "item", 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) {
|
||||
const _easycom_up_checkbox2 = common_vendor.resolveComponent("up-checkbox");
|
||||
const _easycom_up_image2 = common_vendor.resolveComponent("up-image");
|
||||
(_easycom_up_checkbox2 + _easycom_up_image2)();
|
||||
}
|
||||
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({
|
||||
a: $data.addressList && $data.addressList.length !== 0
|
||||
}, $data.addressList && $data.addressList.length !== 0 ? {
|
||||
b: common_vendor.f($data.addressList, (item, k0, i0) => {
|
||||
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),
|
||||
i: "1172d71f-0-" + i0,
|
||||
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
|
||||
};
|
||||
})
|
||||
} : {
|
||||
c: common_vendor.p({
|
||||
src: "/static/common/not_search.png",
|
||||
width: "100",
|
||||
height: "100",
|
||||
bgColor: "#f1f6ff00"
|
||||
})
|
||||
}, {
|
||||
d: common_vendor.o((...args) => $options.jumpAddAddress && $options.jumpAddAddress(...args))
|
||||
});
|
||||
}
|
||||
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
|
||||
Reference in New Issue
Block a user