index.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const pagesHome_condition_common_classify = require("./common/classify.js");
  4. if (!Array) {
  5. const _easycom_u_button2 = common_vendor.resolveComponent("u-button");
  6. _easycom_u_button2();
  7. }
  8. const _easycom_u_button = () => "../../node-modules/uview-plus/components/u-button/u-button.js";
  9. if (!Math) {
  10. (_easycom_u_button + SliderRange)();
  11. }
  12. const SliderRange = () => "../../components/slider-range/index.js";
  13. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  14. __name: "index",
  15. setup(__props) {
  16. var _a;
  17. (_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 total = common_vendor.ref(0);
  24. const scrollTop = common_vendor.ref(0);
  25. const current = common_vendor.ref(0);
  26. const itemId = common_vendor.ref("");
  27. const tabbar = common_vendor.ref(pagesHome_condition_common_classify.classifyData);
  28. const scrollRightTop = common_vendor.ref(0);
  29. const brandInfo = common_vendor.ref({});
  30. const cityInfo = common_vendor.ref({});
  31. const searchList = common_vendor.ref([]);
  32. common_vendor.onLoad(async (options) => {
  33. id.value = options && options.id;
  34. await searchOther();
  35. await searchConfig();
  36. await search();
  37. });
  38. common_vendor.onShow(async () => {
  39. common_vendor.index.$on("toRoute", function(data) {
  40. brandInfo.value = data;
  41. tabbar.value = tabbar.value.map((item, index) => {
  42. if (item.type == "1" && item.value == "0")
  43. item.text = data.title;
  44. return item;
  45. });
  46. });
  47. common_vendor.index.$on("toCity", function(data) {
  48. cityInfo.value = data;
  49. tabbar.value = tabbar.value.map((item, index) => {
  50. if (item.type == "1" && item.value == "1")
  51. item.text = data.name;
  52. return item;
  53. });
  54. });
  55. });
  56. const searchOther = async () => {
  57. };
  58. const searchConfig = async () => {
  59. config.value = common_vendor.index.getStorageSync("config");
  60. };
  61. const search = async () => {
  62. };
  63. const swichMenu = (index) => {
  64. if (index == current.value)
  65. return;
  66. current.value = index;
  67. itemId.value = `item${index}`;
  68. };
  69. const rightScroll = async (e) => {
  70. scrollTop.value = e.scrollTop;
  71. };
  72. const toCommon = (type) => {
  73. if (type == "0") {
  74. common_vendor.index.navigateTo({
  75. url: `/pagesHome/brand/index`
  76. });
  77. } else {
  78. common_vendor.index.navigateTo({
  79. url: `/pagesHome/city/index`
  80. });
  81. }
  82. };
  83. const changeSliderValue = (e, data) => {
  84. tabbar.value = tabbar.value.map((item, index) => {
  85. if (item.name == data.name) {
  86. if (e.firstValue == 0)
  87. item.content = `${e.secondValue}${item.unit}以下`;
  88. else
  89. item.content = `${e.firstValue}-${e.secondValue}${item.unit}`;
  90. item.value = e.values;
  91. }
  92. return item;
  93. });
  94. };
  95. const toSelect = async (value, data) => {
  96. searchList.value.push(data);
  97. tabbar.value = tabbar.value.map((item, index) => {
  98. if (item.name == value.name) {
  99. item.foods = item.foods.map((item1, index1) => {
  100. if (item1.title == data.title)
  101. item1.is_open = !item1.is_open;
  102. return item1;
  103. });
  104. }
  105. return item;
  106. });
  107. };
  108. return (_ctx, _cache) => {
  109. return {
  110. a: common_vendor.f(tabbar.value, (item, index, i0) => {
  111. return {
  112. a: common_vendor.t(item.name),
  113. b: index,
  114. c: "item" + index,
  115. d: common_vendor.n(current.value == index ? "u-tab-item-active" : ""),
  116. e: common_vendor.o(($event) => swichMenu(index), index)
  117. };
  118. }),
  119. b: scrollTop.value,
  120. c: common_vendor.f(tabbar.value, (item, index, i0) => {
  121. return common_vendor.e({
  122. a: item.type != "2"
  123. }, item.type != "2" ? {
  124. b: common_vendor.t(item.name)
  125. } : {
  126. c: common_vendor.t(item.name),
  127. d: common_vendor.t(item.unit),
  128. e: common_vendor.t(item.content || "不限")
  129. }, {
  130. f: item.type == "0"
  131. }, item.type == "0" ? {
  132. g: common_vendor.f(item.foods, (item1, index1, i1) => {
  133. return {
  134. a: common_vendor.t(item1.title),
  135. b: common_vendor.n(item1.is_open == false ? "title_1" : "title_2"),
  136. c: index1,
  137. d: common_vendor.o(($event) => toSelect(item, item1), index1)
  138. };
  139. })
  140. } : item.type == "1" ? {
  141. i: common_vendor.o(($event) => toCommon(item.value), index),
  142. j: "4b99813d-0-" + i0,
  143. k: common_vendor.p({
  144. text: item.text,
  145. size: "normal",
  146. type: "info"
  147. })
  148. } : item.type == "2" ? {
  149. m: common_vendor.o((event) => changeSliderValue(event, item), index),
  150. n: "4b99813d-1-" + i0,
  151. o: common_vendor.p({
  152. value: item.value,
  153. min: item.min,
  154. max: item.max,
  155. step: item.step,
  156. scale: {
  157. show: true
  158. }
  159. })
  160. } : {}, {
  161. h: item.type == "1",
  162. l: item.type == "2",
  163. p: "item" + index,
  164. q: index
  165. });
  166. }),
  167. d: scrollRightTop.value,
  168. e: itemId.value,
  169. f: common_vendor.o(rightScroll),
  170. g: common_vendor.t(total.value)
  171. };
  172. };
  173. }
  174. });
  175. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4b99813d"], ["__file", "D:/project/二手车/car_applet/pagesHome/condition/index.vue"]]);
  176. wx.createPage(MiniProgramPage);