index.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_swiper2 = common_vendor.resolveComponent("u-swiper");
  5. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  6. const _easycom_u_button2 = common_vendor.resolveComponent("u-button");
  7. (_easycom_u_swiper2 + _easycom_u_icon2 + _easycom_u_button2)();
  8. }
  9. const _easycom_u_swiper = () => "../../node-modules/uview-plus/components/u-swiper/u-swiper.js";
  10. const _easycom_u_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
  11. const _easycom_u_button = () => "../../node-modules/uview-plus/components/u-button/u-button.js";
  12. if (!Math) {
  13. (_easycom_u_swiper + _easycom_u_icon + _easycom_u_button)();
  14. }
  15. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  16. __name: "index",
  17. setup(__props) {
  18. var _a;
  19. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  20. common_vendor.computed(() => {
  21. return common_vendor.index.getStorageSync("openid");
  22. });
  23. const config = common_vendor.ref({});
  24. const id = common_vendor.ref("");
  25. const currentNum = common_vendor.ref(1);
  26. const info = common_vendor.ref({});
  27. const shop = common_vendor.ref({});
  28. const list = common_vendor.ref([]);
  29. const emissionList = common_vendor.ref([]);
  30. const boxTypeList = common_vendor.ref([]);
  31. common_vendor.onLoad(async (options) => {
  32. id.value = options && options.id;
  33. await searchConfig();
  34. await search();
  35. });
  36. const searchConfig = async () => {
  37. config.value = common_vendor.index.getStorageSync("config");
  38. };
  39. const search = async () => {
  40. var _a2;
  41. if (id.value) {
  42. const res = await $api(`car/${id.value}`, "GET", {});
  43. if (res.errcode === 0) {
  44. info.value = res.data;
  45. await searchShop((_a2 = res.data) == null ? void 0 : _a2.shop);
  46. await searchOther();
  47. } else {
  48. common_vendor.index.showToast({
  49. title: res.errmsg || "",
  50. icon: "error"
  51. });
  52. }
  53. }
  54. };
  55. const searchShop = async (e) => {
  56. if (!e)
  57. return;
  58. const res = await $api(`shop/${e}`, "GET", {});
  59. if (res.errcode === 0) {
  60. shop.value = res.data;
  61. } else {
  62. common_vendor.index.showToast({
  63. title: res.errmsg || "",
  64. icon: "error"
  65. });
  66. }
  67. };
  68. const searchOther = async () => {
  69. const info2 = {
  70. skip: 0,
  71. limit: 20,
  72. status: "0",
  73. shop: shop.value._id
  74. };
  75. const arr = await $api("car", "GET", info2);
  76. if (arr.errcode === 0) {
  77. list.value = arr.data;
  78. shop.value.num = arr.total;
  79. } else {
  80. common_vendor.index.showToast({
  81. title: arr.errmsg || "",
  82. icon: "error"
  83. });
  84. }
  85. let res;
  86. res = await $api(`dictData`, "GET", { code: "boxType", is_use: "0" });
  87. if (res.errcode === 0)
  88. boxTypeList.value = res.data;
  89. res = await $api(`dictData`, "GET", { code: "emission", is_use: "0" });
  90. if (res.errcode === 0)
  91. emissionList.value = res.data;
  92. };
  93. const getDict = (data, model) => {
  94. let list2;
  95. switch (model) {
  96. case "type":
  97. list2 = boxTypeList.value;
  98. break;
  99. case "emission":
  100. list2 = emissionList.value;
  101. break;
  102. }
  103. if (!list2)
  104. return;
  105. const res = list2.find((f) => f.value == data);
  106. return (res == null ? void 0 : res.label) || "暂无";
  107. };
  108. const PhoneNumber = (e) => {
  109. console.log(e);
  110. };
  111. const toRecord = () => {
  112. common_vendor.index.navigateTo({
  113. url: `/pagesHome/record/index?id=${info.value.id || info.value._id}`
  114. });
  115. };
  116. const toView = (item) => {
  117. common_vendor.index.navigateTo({
  118. url: `/pagesHome/car/index?id=${item.id || item._id}`
  119. });
  120. };
  121. const toChat = (item) => {
  122. var _a2;
  123. common_vendor.index.makePhoneCall({
  124. phoneNumber: (_a2 = shop.value) == null ? void 0 : _a2.tel,
  125. success: function() {
  126. console.log("拨打电话成功");
  127. },
  128. fail: function() {
  129. common_vendor.index.showToast({
  130. title: "拨打电话失败",
  131. icon: "error"
  132. });
  133. }
  134. });
  135. };
  136. const toShop = () => {
  137. common_vendor.index.navigateTo({
  138. url: `/pagesHome/shop/index?id=${shop.value.id || shop.value._id}&name=${shop.value.name}`
  139. });
  140. };
  141. const toPicture = (index, e) => {
  142. const urls = e.map((item, index2) => {
  143. return item.url;
  144. });
  145. common_vendor.index.previewImage({
  146. current: index,
  147. urls
  148. });
  149. };
  150. const toMore = () => {
  151. common_vendor.index.navigateTo({
  152. url: `/pagesHome/picture/index?id=${info.value.id || info.value._id}&shop=${shop.value._id}`
  153. });
  154. };
  155. return (_ctx, _cache) => {
  156. var _a2, _b, _c, _d, _e, _f, _g;
  157. return {
  158. a: common_vendor.t(currentNum.value + 1),
  159. b: common_vendor.t((_a2 = info.value.file) == null ? void 0 : _a2.length),
  160. c: common_vendor.o((e) => currentNum.value = e.current),
  161. d: common_vendor.p({
  162. list: info.value.file,
  163. height: "300px",
  164. keyName: "url",
  165. autoplay: false,
  166. indicatorStyle: "right: 20px",
  167. radius: "0"
  168. }),
  169. e: common_vendor.t(info.value.real_pay || "0"),
  170. f: common_vendor.t(info.value.price || "0"),
  171. g: common_vendor.o(PhoneNumber),
  172. h: common_vendor.t(info.value.series || "暂无"),
  173. i: common_vendor.t(info.value.year || "暂无"),
  174. j: common_vendor.t(info.value.style || "暂无"),
  175. k: common_vendor.t(info.value.series),
  176. l: common_vendor.p({
  177. name: "arrow-right",
  178. size: "12"
  179. }),
  180. m: common_vendor.t(info.value.first_pay),
  181. n: common_vendor.p({
  182. name: "arrow-right",
  183. size: "16"
  184. }),
  185. o: common_vendor.o(toChat),
  186. p: common_vendor.t(common_vendor.unref(common_vendor.hooks)(info.value.f_time).format("YYYY-MM") || "暂无日期"),
  187. q: common_vendor.t(info.value.mileage || "暂无"),
  188. r: common_vendor.t(getDict(info.value.emission, "emission")),
  189. s: common_vendor.t(info.value.place || "暂无"),
  190. t: common_vendor.o(toRecord),
  191. v: common_vendor.p({
  192. name: "arrow-right",
  193. size: "16"
  194. }),
  195. w: common_vendor.t(info.value.hundred_time || "0"),
  196. x: common_vendor.t(info.value.displacement || "暂无"),
  197. y: common_vendor.t(info.value.wheelbase || "暂无"),
  198. z: common_vendor.t(getDict(info.value.type, "type")),
  199. A: common_vendor.t(info.value.oil || "0"),
  200. B: common_vendor.t(info.value.premium || "0"),
  201. C: common_vendor.t(info.value.maintenance || "0"),
  202. D: shop.value.logo && ((_b = shop.value.logo) == null ? void 0 : _b.length) > 0 ? shop.value.logo[0].url : "https://cdn.uviewui.com/uview/album/1.jpg",
  203. E: common_vendor.t(shop.value.name || "暂无"),
  204. F: common_vendor.p({
  205. bold: true,
  206. color: "#000",
  207. name: "arrow-right",
  208. size: "16"
  209. }),
  210. G: common_vendor.o(toShop),
  211. H: common_vendor.t(shop.value.num || 0),
  212. I: common_vendor.o(toChat),
  213. J: common_vendor.p({
  214. icon: "phone",
  215. text: "咨询卖家车况",
  216. size: "normal",
  217. type: "info"
  218. }),
  219. K: common_vendor.o(($event) => toPicture(0, info.value.file)),
  220. L: info.value.file && ((_c = info.value.file) == null ? void 0 : _c.length) > 0 ? info.value.file[0].url : "https://cdn.uviewui.com/uview/album/1.jpg",
  221. M: common_vendor.o(($event) => toPicture(1, info.value.file)),
  222. N: info.value.file && ((_d = info.value.file) == null ? void 0 : _d.length) > 1 ? info.value.file[1].url : "https://cdn.uviewui.com/uview/album/5.jpg",
  223. O: common_vendor.o(($event) => toPicture(2, info.value.file)),
  224. P: info.value.file && ((_e = info.value.file) == null ? void 0 : _e.length) > 2 ? info.value.file[2].url : "https://cdn.uviewui.com/uview/album/2.jpg",
  225. Q: common_vendor.o(($event) => toPicture(3, info.value.file)),
  226. R: info.value.file && ((_f = info.value.file) == null ? void 0 : _f.length) > 3 ? info.value.file[3].url : "https://cdn.uviewui.com/uview/album/3.jpg",
  227. S: common_vendor.o(($event) => toPicture(4, info.value.file)),
  228. T: info.value.file && ((_g = info.value.file) == null ? void 0 : _g.length) > 4 ? info.value.file[4].url : "https://cdn.uviewui.com/uview/album/4.jpg",
  229. U: common_vendor.o(toMore),
  230. V: common_vendor.p({
  231. text: "查看更多图片",
  232. size: "normal",
  233. type: "info"
  234. }),
  235. W: common_vendor.f(list.value, (item, index, i0) => {
  236. return common_vendor.e({
  237. a: item.file && item.file.length > 0 ? item.file[0].url : "",
  238. b: common_vendor.t(item.series || "暂无"),
  239. c: common_vendor.t(item.year || "暂无"),
  240. d: common_vendor.t(item.style || "暂无"),
  241. e: item.year
  242. }, item.year ? {
  243. f: common_vendor.t(item.year || "暂无")
  244. } : {}, {
  245. g: item.mileage
  246. }, item.mileage ? {
  247. h: common_vendor.t(item.mileage || "暂无")
  248. } : {}, {
  249. i: item.place
  250. }, item.place ? {
  251. j: common_vendor.t(item.place || "暂无")
  252. } : {}, {
  253. k: common_vendor.t(item.total_money || "0"),
  254. l: index,
  255. m: common_vendor.o(($event) => toView(item), index)
  256. });
  257. }),
  258. X: common_vendor.p({
  259. color: "#000",
  260. name: "red-packet",
  261. size: "20"
  262. }),
  263. Y: common_vendor.o(toChat),
  264. Z: common_vendor.o(toChat),
  265. aa: common_vendor.o(toChat)
  266. };
  267. };
  268. }
  269. });
  270. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6b665083"], ["__file", "D:/project/赋强公证/notarization_applet/pagesHome/car/index.vue"]]);
  271. wx.createPage(MiniProgramPage);