list.js 5.7 KB

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