index.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. _easycom_u_search2();
  6. }
  7. const _easycom_u_search = () => "../../node-modules/uview-plus/components/u-search/u-search.js";
  8. if (!Math) {
  9. _easycom_u_search();
  10. }
  11. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  12. __name: "index",
  13. setup(__props) {
  14. var _a, _b;
  15. const $api = (_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.computed(() => {
  18. return common_vendor.index.getStorageSync("openid");
  19. });
  20. const searchInfo = common_vendor.ref({});
  21. const config = common_vendor.ref({ logoUrl: [] });
  22. const list = common_vendor.ref([]);
  23. const total = common_vendor.ref(0);
  24. const skip = common_vendor.ref(0);
  25. const limit = common_vendor.ref(6);
  26. const page = common_vendor.ref(0);
  27. const is_bottom = common_vendor.ref(false);
  28. common_vendor.ref(0);
  29. const statusList = common_vendor.ref([]);
  30. common_vendor.onLoad(async () => {
  31. await searchOther();
  32. await searchConfig();
  33. await search();
  34. });
  35. const searchOther = async () => {
  36. let res;
  37. res = await $api(`dictData`, "GET", { code: "valuation", is_use: "0" });
  38. if (res.errcode === 0)
  39. statusList.value = res.data;
  40. };
  41. const searchConfig = async () => {
  42. config.value = common_vendor.index.getStorageSync("config");
  43. };
  44. const search = async () => {
  45. const info = {
  46. skip: skip.value,
  47. limit: limit.value
  48. // openid: openid.value
  49. };
  50. const res = await $api("estimate", "GET", {
  51. ...info,
  52. ...searchInfo.value
  53. });
  54. if (res.errcode === 0) {
  55. list.value = list.value.concat(res.data);
  56. total.value = res.total;
  57. } else {
  58. common_vendor.index.showToast({
  59. title: res.errmsg || "",
  60. icon: "error"
  61. });
  62. }
  63. };
  64. const getDict = (data, model) => {
  65. let list2;
  66. switch (model) {
  67. case "status":
  68. list2 = statusList.value;
  69. break;
  70. }
  71. if (!list2)
  72. return;
  73. const res = list2.find((f) => f.value == data);
  74. return (res == null ? void 0 : res.label) || "暂无";
  75. };
  76. const toChange = () => {
  77. common_vendor.index.navigateTo({
  78. url: `/pagesHome/type/index`
  79. });
  80. };
  81. const toPage = () => {
  82. if (total.value > list.value.length) {
  83. common_vendor.index.showLoading({
  84. title: "加载中",
  85. mask: true
  86. });
  87. page.value = page.value + 1;
  88. skip.value = page.value * limit.value;
  89. search();
  90. common_vendor.index.hideLoading();
  91. } else
  92. is_bottom.value = true;
  93. };
  94. return (_ctx, _cache) => {
  95. return common_vendor.e({
  96. a: common_vendor.o(toChange),
  97. b: common_vendor.p({
  98. shape: "square",
  99. ["show-action"]: false,
  100. placeholder: "品牌/车系"
  101. }),
  102. c: common_vendor.f(list.value, (item, index, i0) => {
  103. return common_vendor.e({
  104. a: common_vendor.t(item.brand || "暂无"),
  105. b: common_vendor.t(item.bank || "暂无"),
  106. c: common_vendor.t(item.type || "暂无"),
  107. d: item.start
  108. }, item.start ? {
  109. e: common_vendor.t(item.start || "暂无")
  110. } : {}, {
  111. f: item.course
  112. }, item.course ? {
  113. g: common_vendor.t(item.course || "暂无")
  114. } : {}, {
  115. h: item.city
  116. }, item.city ? {
  117. i: common_vendor.t(item.city || "暂无")
  118. } : {}, {
  119. j: item.place
  120. }, item.place ? {
  121. k: common_vendor.t(item.place || "暂无")
  122. } : {}, {
  123. l: item.estimate
  124. }, item.estimate ? {
  125. m: common_vendor.t(item.estimate || "暂无")
  126. } : {}, {
  127. n: item.status
  128. }, item.status ? {
  129. o: common_vendor.t(getDict(item.status, "status"))
  130. } : {}, {
  131. p: index
  132. });
  133. }),
  134. d: is_bottom.value
  135. }, is_bottom.value ? {
  136. e: common_vendor.t(config.value.bottom_title || "没有更多了!")
  137. } : {}, {
  138. f: common_vendor.o(toPage)
  139. });
  140. };
  141. }
  142. });
  143. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-8e01b58b"], ["__file", "D:/project/赋强公证/notarization_applet/pagesMy/car/index.vue"]]);
  144. wx.createPage(MiniProgramPage);