index.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_album2 = common_vendor.resolveComponent("u-album");
  5. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  6. (_easycom_u_album2 + _easycom_u_icon2)();
  7. }
  8. const _easycom_u_album = () => "../../node-modules/uview-plus/components/u-album/u-album.js";
  9. const _easycom_u_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
  10. if (!Math) {
  11. (_easycom_u_album + _easycom_u_icon)();
  12. }
  13. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  14. __name: "index",
  15. setup(__props) {
  16. var _a;
  17. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  18. common_vendor.computed(() => {
  19. return common_vendor.index.getStorageSync("openid");
  20. });
  21. const config = common_vendor.ref({});
  22. const id = common_vendor.ref("");
  23. const current = common_vendor.ref(0);
  24. const itemId = common_vendor.ref("");
  25. const imageList = common_vendor.ref([{ name: "外观", url: [] }, { name: "内饰", url: [] }, { name: "空间", url: [] }]);
  26. const shop = common_vendor.ref({});
  27. common_vendor.onLoad(async (options) => {
  28. id.value = options && options.id;
  29. const shopId = options && options.shop;
  30. await searchConfig();
  31. await searchOther(shopId);
  32. await search();
  33. });
  34. const searchOther = async (id2) => {
  35. let res;
  36. res = await $api(`shop/${id2}`, "GET", {});
  37. if (res.errcode === 0) {
  38. shop.value = res.data;
  39. } else {
  40. common_vendor.index.showToast({
  41. title: res.errmsg || "",
  42. icon: "error"
  43. });
  44. }
  45. };
  46. const searchConfig = async () => {
  47. config.value = common_vendor.index.getStorageSync("config");
  48. };
  49. const search = async () => {
  50. var _a2, _b;
  51. if (id.value) {
  52. const res = await $api(`car/${id.value}`, "GET", {});
  53. if (res.errcode === 0) {
  54. if (((_b = (_a2 = res.data) == null ? void 0 : _a2.file) == null ? void 0 : _b.length) > 0) {
  55. res.data.file = res.data.file.map((item, index) => {
  56. return item.url;
  57. });
  58. var one = res.data.file.slice(0, 9);
  59. var two = res.data.file.slice(9, 18);
  60. var thr = res.data.file.slice(18, 21);
  61. imageList.value = imageList.value.map((item, index) => {
  62. if (index == 0)
  63. item.url = one;
  64. else if (index == 1)
  65. item.url = two;
  66. else if (index == 2)
  67. item.url = thr;
  68. return item;
  69. });
  70. }
  71. } else {
  72. common_vendor.index.showToast({
  73. title: res.errmsg || "",
  74. icon: "error"
  75. });
  76. }
  77. }
  78. };
  79. const toChat = () => {
  80. var _a2;
  81. common_vendor.index.makePhoneCall({
  82. phoneNumber: (_a2 = shop.value) == null ? void 0 : _a2.tel,
  83. success: function() {
  84. console.log("拨打电话成功");
  85. },
  86. fail: function() {
  87. common_vendor.index.showToast({
  88. title: "拨打电话失败",
  89. icon: "error"
  90. });
  91. }
  92. });
  93. };
  94. const swichMenu = (index) => {
  95. if (index == current.value)
  96. return;
  97. current.value = index;
  98. itemId.value = `item${index}`;
  99. };
  100. return (_ctx, _cache) => {
  101. return {
  102. a: common_vendor.f(imageList.value, (item, index, i0) => {
  103. var _a2;
  104. return {
  105. a: common_vendor.t(item.name),
  106. b: common_vendor.t(((_a2 = item == null ? void 0 : item.url) == null ? void 0 : _a2.length) || 0),
  107. c: common_vendor.n(current.value == index ? "border" : ""),
  108. d: index,
  109. e: common_vendor.o(($event) => swichMenu(index), index)
  110. };
  111. }),
  112. b: common_vendor.f(imageList.value, (item, index, i0) => {
  113. var _a2;
  114. return {
  115. a: common_vendor.t(item.name),
  116. b: common_vendor.t(((_a2 = item == null ? void 0 : item.url) == null ? void 0 : _a2.length) || 0),
  117. c: "item" + index,
  118. d: common_vendor.o((width) => _ctx.albumWidth = width, index),
  119. e: "0d1a9630-0-" + i0,
  120. f: common_vendor.p({
  121. urls: item.url,
  122. multipleSize: "110"
  123. }),
  124. g: index
  125. };
  126. }),
  127. c: common_vendor.o(
  128. //@ts-ignore
  129. (...args) => _ctx.toPage && _ctx.toPage(...args)
  130. ),
  131. d: itemId.value,
  132. e: common_vendor.p({
  133. color: "#ffffff",
  134. name: "red-packet",
  135. size: "20"
  136. }),
  137. f: common_vendor.o(toChat),
  138. g: common_vendor.o(toChat),
  139. h: common_vendor.o(toChat)
  140. };
  141. };
  142. }
  143. });
  144. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0d1a9630"], ["__file", "D:/project/赋强公证/notarization_applet/pagesHome/picture/index.vue"]]);
  145. wx.createPage(MiniProgramPage);