From 77c2bdd45ca70e57667b346585edc5034cbd821e Mon Sep 17 00:00:00 2001 From: Liuyi <candymxq888@outlook.com> Date: 星期六, 28 九月 2024 17:48:30 +0800 Subject: [PATCH] 调通地址管理及新增接口,调整树形区域组件 --- unpackage/dist/dev/mp-weixin/pages/address/index.js | 63 ++++++++++++++++++++++++++----- 1 files changed, 53 insertions(+), 10 deletions(-) diff --git a/unpackage/dist/dev/mp-weixin/pages/address/index.js b/unpackage/dist/dev/mp-weixin/pages/address/index.js index e2f6158..97a4669 100644 --- a/unpackage/dist/dev/mp-weixin/pages/address/index.js +++ b/unpackage/dist/dev/mp-weixin/pages/address/index.js @@ -1,6 +1,7 @@ "use strict"; const common_vendor = require("../../common/vendor.js"); -const _sfc_main = {}; +const common_assets = require("../../common/assets.js"); +const api_index = require("../../api/index.js"); if (!Array) { const _easycom_navbar2 = common_vendor.resolveComponent("navbar"); _easycom_navbar2(); @@ -9,12 +10,54 @@ if (!Math) { _easycom_navbar(); } -function _sfc_render(_ctx, _cache) { - return { - a: common_vendor.p({ - title: "地址管理" - }) - }; -} -const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]); -wx.createPage(MiniProgramPage); +const _sfc_main = { + __name: "index", + setup(__props) { + const addressList = common_vendor.ref([]); + async function getAddressList() { + await api_index.searchAddress({ limit: 100, page: 1 }).then((res) => { + if (res.code == 200) { + res.data.list.forEach((item) => { + res.data.list.forEach((item2) => { + if (item2.isDefault == 1) { + item2.isDefault = true; + } else { + item2.isDefault = false; + } + item2.addressWhole = item2.regionName.replace(/[,#]/g, " ") + item2.address; + }); + }); + addressList.value = res.data.list; + } + }); + } + function navTo() { + common_vendor.index.navigateTo({ + url: "/pages/addressAdd/index" + }); + } + common_vendor.onMounted(() => { + getAddressList(); + }); + return (_ctx, _cache) => { + return { + a: common_vendor.p({ + title: "地址管理" + }), + b: common_vendor.f(addressList.value, (item, index, i0) => { + return { + a: common_vendor.t(item.userName), + b: common_vendor.t(item.userPhone), + c: common_vendor.t(item.addressWhole), + d: item.id, + e: item.isDefault + }; + }), + c: common_assets._imports_0$3, + d: common_assets._imports_1$1, + e: common_vendor.o(($event) => navTo()) + }; + }; + } +}; +wx.createPage(_sfc_main); -- Gitblit v1.9.3