index.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_subsection2 = common_vendor.resolveComponent("u-subsection");
  5. _easycom_u_subsection2();
  6. }
  7. const _easycom_u_subsection = () => "../../node-modules/uview-plus/components/u-subsection/u-subsection.js";
  8. if (!Math) {
  9. _easycom_u_subsection();
  10. }
  11. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  12. __name: "index",
  13. setup(__props) {
  14. var _a, _b;
  15. (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  16. (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  17. common_vendor.ref(["-2px", "355px"]);
  18. const tabList = common_vendor.ref(["销量榜", "保值榜", "店铺规模榜"]);
  19. const curNow = common_vendor.ref(0);
  20. const config = common_vendor.ref({ logoUrl: [] });
  21. const list = common_vendor.ref([
  22. {
  23. id: "1",
  24. file: [{ url: "https://cdn.uviewui.com/uview/album/1.jpg" }],
  25. name: "夏朗 2013款 1.8TSI 标配型 欧IV",
  26. year: "2014年 ",
  27. city: "丹东",
  28. kilometer: "8万公里",
  29. money: "7.80"
  30. },
  31. {
  32. id: "1",
  33. file: [{ url: "https://cdn.uviewui.com/uview/album/2.jpg" }],
  34. name: "捷豹XEL 2020款 2.0T 200PS S进取优雅版",
  35. year: "2014年 ",
  36. city: "丹东",
  37. kilometer: "8万公里",
  38. money: "7.80"
  39. },
  40. {
  41. id: "1",
  42. file: [{ url: "https://cdn.uviewui.com/uview/album/3.jpg" }],
  43. name: "夏朗 2013款 1.8TSI 标配型 欧IV",
  44. year: "2014年 ",
  45. city: "丹东",
  46. kilometer: "8万公里",
  47. money: "7.80"
  48. },
  49. {
  50. id: "1",
  51. file: [{ url: "https://cdn.uviewui.com/uview/album/4.jpg" }],
  52. name: "夏朗 2013款 1.8TSI 标配型 欧IV",
  53. year: "2014年 ",
  54. city: "丹东",
  55. kilometer: "8万公里",
  56. money: "7.80"
  57. },
  58. {
  59. id: "1",
  60. file: [{ url: "https://cdn.uviewui.com/uview/album/5.jpg" }],
  61. name: "夏朗 2013款 1.8TSI 标配型 欧IV",
  62. year: "2014年 ",
  63. city: "丹东",
  64. kilometer: "8万公里",
  65. money: "7.80"
  66. },
  67. {
  68. id: "1",
  69. file: [{ url: "https://cdn.uviewui.com/uview/album/6.jpg" }],
  70. name: "夏朗 2013款 1.8TSI 标配型 欧IV",
  71. year: "2014年 ",
  72. city: "丹东",
  73. kilometer: "8万公里",
  74. money: "7.80"
  75. },
  76. {
  77. id: "1",
  78. file: [{ url: "https://cdn.uviewui.com/uview/album/7.jpg" }],
  79. name: "夏朗 2013款 1.8TSI 标配型 欧IV",
  80. year: "2014年 ",
  81. city: "丹东",
  82. kilometer: "8万公里",
  83. money: "7.80"
  84. },
  85. {
  86. id: "1",
  87. file: [{ url: "https://cdn.uviewui.com/uview/album/8.jpg" }],
  88. name: "夏朗 2013款 1.8TSI 标配型 欧IV",
  89. year: "2014年 ",
  90. city: "丹东",
  91. kilometer: "8万公里",
  92. money: "7.80"
  93. },
  94. {
  95. id: "1",
  96. file: [{ url: "https://cdn.uviewui.com/uview/album/9.jpg" }],
  97. name: "夏朗 2013款 1.8TSI 标配型 欧IV",
  98. year: "2014年 ",
  99. city: "丹东",
  100. kilometer: "8万公里",
  101. money: "7.80"
  102. },
  103. {
  104. id: "1",
  105. file: [{ url: "https://cdn.uviewui.com/uview/album/10.jpg" }],
  106. name: "夏朗 2013款 1.8TSI 标配型 欧IV",
  107. year: "2014年 ",
  108. city: "丹东",
  109. kilometer: "8万公里",
  110. money: "7.80"
  111. }
  112. ]);
  113. const total = common_vendor.ref(0);
  114. const skip = common_vendor.ref(0);
  115. const limit = common_vendor.ref(6);
  116. const page = common_vendor.ref(0);
  117. const is_bottom = common_vendor.ref(false);
  118. common_vendor.ref(0);
  119. common_vendor.onLoad(async () => {
  120. await searchConfig();
  121. await search();
  122. });
  123. const searchConfig = async () => {
  124. config.value = common_vendor.index.getStorageSync("config");
  125. };
  126. const search = async () => {
  127. };
  128. const sectionChange = (index) => {
  129. curNow.value = index;
  130. };
  131. const toView = (item) => {
  132. common_vendor.index.navigateTo({
  133. url: `/pagesHome/car/index?id=${item.id || item._id}`
  134. });
  135. };
  136. const toChat = (item) => {
  137. common_vendor.index.makePhoneCall({
  138. phoneNumber: item.shop || "110",
  139. success: function() {
  140. console.log("拨打电话成功");
  141. },
  142. fail: function() {
  143. common_vendor.index.showToast({
  144. title: "拨打电话失败",
  145. icon: "error"
  146. });
  147. }
  148. });
  149. };
  150. const toPage = () => {
  151. if (total.value > list.value.length) {
  152. common_vendor.index.showLoading({
  153. title: "加载中",
  154. mask: true
  155. });
  156. page.value = page.value + 1;
  157. skip.value = page.value * limit.value;
  158. search();
  159. common_vendor.index.hideLoading();
  160. } else
  161. is_bottom.value = true;
  162. };
  163. return (_ctx, _cache) => {
  164. return common_vendor.e({
  165. a: common_vendor.o(sectionChange),
  166. b: common_vendor.p({
  167. mode: "subsection",
  168. activeColor: "#ffbc00",
  169. list: tabList.value,
  170. current: curNow.value
  171. }),
  172. c: common_vendor.f(list.value, (item, index, i0) => {
  173. return common_vendor.e({
  174. a: item.file && item.file.length > 0 ? item.file[0].url : "",
  175. b: common_vendor.t(item.name || "暂无"),
  176. c: item.year
  177. }, item.year ? {
  178. d: common_vendor.t(item.year || "暂无")
  179. } : {}, {
  180. e: item.kilometer
  181. }, item.kilometer ? {
  182. f: common_vendor.t(item.kilometer || "暂无")
  183. } : {}, {
  184. g: item.city
  185. }, item.city ? {
  186. h: common_vendor.t(item.city || "暂无")
  187. } : {}, {
  188. i: common_vendor.t(item.money || "0"),
  189. j: common_vendor.o(($event) => toChat(item), index),
  190. k: index,
  191. l: common_vendor.o(($event) => toView(item), index)
  192. });
  193. }),
  194. d: is_bottom.value
  195. }, is_bottom.value ? {
  196. e: common_vendor.t(config.value.bottom_title || "没有更多了!")
  197. } : {}, {
  198. f: common_vendor.o(toPage)
  199. });
  200. };
  201. }
  202. });
  203. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-581af8d0"], ["__file", "D:/project/二手车/car_applet/pagesHome/rank/index.vue"]]);
  204. wx.createPage(MiniProgramPage);