index.js 6.4 KB

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