"use strict";
const common_vendor = require("../../common/vendor.js");
const api_index = require("../../api/index.js");
if (!Array) {
  const _easycom_wd_navbar2 = common_vendor.resolveComponent("wd-navbar");
  const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
  (_easycom_wd_navbar2 + _easycom_z_paging2)();
}
const _easycom_wd_navbar = () => "../../uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js";
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
if (!Math) {
  (_easycom_wd_navbar + _easycom_z_paging)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "list",
  setup(__props) {
    const paging = common_vendor.ref(null);
    const type = common_vendor.ref(null);
    const dataList = common_vendor.ref([]);
    common_vendor.onLoad((options) => {
      type.value = options.type;
    });
    common_vendor.onShow(() => {
      paging.value.reload();
    });
    const queryList = (pageNo, pageSize) => {
      api_index.api.addressPage({ pageNo, pageSize }).then((res) => {
        paging.value.complete(res.list);
      }).catch((res) => {
        paging.value.complete(false);
      });
    };
    const back = () => {
      common_vendor.index.navigateBack();
    };
    const tn = (e) => {
      common_vendor.index.navigateTo({
        url: e
      });
    };
    const back_A = (e) => {
      if (type.value == 1) {
        common_vendor.index.$emit("address", e);
        common_vendor.index.navigateBack();
      } else {
        return;
      }
    };
    const deleAddress = (data) => {
      common_vendor.index.showModal({
        title: "提示",
        content: "是否确认删除？",
        success: (res) => {
          if (res.confirm) {
            api_index.api.addressDel({ id: data.id }).then((res2) => {
              paging.value.reload();
            });
          }
        }
      });
    };
    const copyAddress = (data) => {
      let aaa = `收货人：${data.receiverName}
手机号码：${data.receiverPhone}
所在地区：${data.receiverArea}
详细地址：${data.receiverAddress}`;
      common_vendor.index.setClipboardData({
        data: aaa,
        success: function() {
          common_vendor.index.__f__("log", "at pages/address/list.vue:100", "success");
        }
      });
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.o(back),
        b: common_vendor.p({
          title: "地址管理",
          safeAreaInsetTop: true,
          ["left-arrow"]: true
        }),
        c: common_vendor.f(dataList.value, (item, index, i0) => {
          return {
            a: common_vendor.t(item.receiverName),
            b: common_vendor.t(item.receiverPhone),
            c: common_vendor.t(item.receiverArea),
            d: common_vendor.t(item.receiverAddress),
            e: common_vendor.o(($event) => deleAddress(item), index),
            f: common_vendor.o(($event) => tn(`./add?id=${item.id}`), index),
            g: common_vendor.o(($event) => copyAddress(item), index),
            h: common_vendor.o(($event) => back_A(item), index),
            i: index
          };
        }),
        d: common_vendor.sr(paging, "90a3874e-1", {
          "k": "paging"
        }),
        e: common_vendor.o(queryList),
        f: common_vendor.o(($event) => dataList.value = $event),
        g: common_vendor.p({
          ["use-page-scroll"]: true,
          modelValue: dataList.value
        }),
        h: common_vendor.o(($event) => tn("./add"))
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-90a3874e"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/address/list.js.map
