list.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../../sheep/index.js");
  4. const sheep_api_system_area = require("../../../sheep/api/system/area.js");
  5. const sheep_api_member_address = require("../../../sheep/api/member/address.js");
  6. require("../../../sheep/url/index.js");
  7. require("../../../sheep/store/index.js");
  8. require("../../../sheep/store/app.js");
  9. require("../../../sheep/api/promotion/diy.js");
  10. require("../../../sheep/request/index.js");
  11. require("../../../sheep/config/index.js");
  12. require("../../../sheep/platform/index.js");
  13. require("../../../sheep/platform/provider/wechat/index.js");
  14. require("../../../sheep/platform/provider/wechat/miniProgram.js");
  15. require("../../../sheep/api/member/auth.js");
  16. require("../../../sheep/api/member/social.js");
  17. require("../../../sheep/api/member/user.js");
  18. require("../../../sheep/platform/provider/apple/index.js");
  19. require("../../../sheep/platform/share.js");
  20. require("../../../sheep/router/index.js");
  21. require("../../../sheep/hooks/useModal.js");
  22. require("../../../sheep/helper/index.js");
  23. require("../../../sheep/helper/test.js");
  24. require("../../../sheep/helper/digit.js");
  25. require("../../../sheep/helper/throttle.js");
  26. require("../../../sheep/platform/pay.js");
  27. require("../../../sheep/api/pay/order.js");
  28. require("../../../sheep/store/user.js");
  29. require("../../../sheep/store/cart.js");
  30. require("../../../sheep/api/trade/cart.js");
  31. require("../../../sheep/api/pay/wallet.js");
  32. require("../../../sheep/api/trade/order.js");
  33. require("../../../sheep/api/promotion/coupon.js");
  34. require("../../../sheep/store/sys.js");
  35. require("../../../sheep/store/modal.js");
  36. require("../../../sheep/config/zIndex.js");
  37. if (!Array) {
  38. const _easycom_s_address_item2 = common_vendor.resolveComponent("s-address-item");
  39. const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed");
  40. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  41. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  42. (_easycom_s_address_item2 + _easycom_su_fixed2 + _easycom_s_empty2 + _easycom_s_layout2)();
  43. }
  44. const _easycom_s_address_item = () => "../../../sheep/components/s-address-item/s-address-item.js";
  45. const _easycom_su_fixed = () => "../../../sheep/ui/su-fixed/su-fixed.js";
  46. const _easycom_s_empty = () => "../../../sheep/components/s-empty/s-empty.js";
  47. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  48. if (!Math) {
  49. (_easycom_s_address_item + _easycom_su_fixed + _easycom_s_empty + _easycom_s_layout)();
  50. }
  51. const _sfc_main = {
  52. __name: "list",
  53. setup(__props) {
  54. const state = common_vendor.reactive({
  55. list: [],
  56. // 地址列表
  57. loading: true
  58. });
  59. const onSelect = (addressInfo) => {
  60. common_vendor.index.$emit("SELECT_ADDRESS", {
  61. addressInfo
  62. });
  63. sheep_index.sheep.$router.back();
  64. };
  65. function importWechatAddress() {
  66. let wechatAddress = {};
  67. common_vendor.index.chooseAddress({
  68. success: (res) => {
  69. wechatAddress = {
  70. consignee: res.userName,
  71. mobile: res.telNumber,
  72. province_name: res.provinceName,
  73. city_name: res.cityName,
  74. district_name: res.countyName,
  75. address: res.detailInfo,
  76. region: "",
  77. is_default: false
  78. };
  79. if (!common_vendor.lodashExports.isEmpty(wechatAddress)) {
  80. sheep_index.sheep.$router.go("/pages/user/address/edit", {
  81. data: JSON.stringify(wechatAddress)
  82. });
  83. }
  84. },
  85. fail: (err) => {
  86. console.log("uni.chooseAddress调用失败,问题是:", err);
  87. }
  88. });
  89. }
  90. common_vendor.onShow(async () => {
  91. state.list = (await sheep_api_member_address.AddressApi.getAddressList()).data;
  92. state.loading = false;
  93. });
  94. common_vendor.onBeforeMount(() => {
  95. if (!!common_vendor.index.getStorageSync("areaData")) {
  96. return;
  97. }
  98. sheep_api_system_area.AreaApi.getAreaTree().then((res) => {
  99. if (res.code === 0) {
  100. common_vendor.index.setStorageSync("areaData", res.data);
  101. }
  102. });
  103. });
  104. return (_ctx, _cache) => {
  105. return common_vendor.e({
  106. a: state.list.length
  107. }, state.list.length ? {
  108. b: common_vendor.f(state.list, (item, k0, i0) => {
  109. return {
  110. a: item.id,
  111. b: common_vendor.o(($event) => onSelect(item), item.id),
  112. c: "5a5957ad-1-" + i0 + ",5a5957ad-0",
  113. d: common_vendor.p({
  114. hasBorderBottom: true,
  115. item
  116. })
  117. };
  118. })
  119. } : {}, {
  120. c: ["WechatMiniProgram", "WechatOfficialAccount"].includes(common_vendor.unref(sheep_index.sheep).$platform.name)
  121. }, ["WechatMiniProgram", "WechatOfficialAccount"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) ? {
  122. d: common_vendor.o(importWechatAddress)
  123. } : {}, {
  124. e: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/user/address/edit")),
  125. f: common_vendor.p({
  126. bottom: true,
  127. placeholder: true
  128. }),
  129. g: state.list.length === 0 && !state.loading
  130. }, state.list.length === 0 && !state.loading ? {
  131. h: common_vendor.p({
  132. text: "暂无收货地址",
  133. icon: "/static/data-empty.png"
  134. })
  135. } : {}, {
  136. i: common_vendor.p({
  137. title: "收货地址",
  138. bgStyle: {
  139. color: "#FFF"
  140. }
  141. })
  142. });
  143. };
  144. }
  145. };
  146. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-5a5957ad"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/user/address/list.vue"]]);
  147. wx.createPage(MiniProgramPage);