list.js 7.0 KB

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