index.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
  5. const _easycom_u_form_item2 = common_vendor.resolveComponent("u-form-item");
  6. const _easycom_u__form2 = common_vendor.resolveComponent("u--form");
  7. (_easycom_u_icon2 + _easycom_u_form_item2 + _easycom_u__form2)();
  8. }
  9. const _easycom_u_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
  10. const _easycom_u_form_item = () => "../../node-modules/uview-plus/components/u-form-item/u-form-item.js";
  11. const _easycom_u__form = () => "../../node-modules/uview-plus/components/u-form/u-form.js";
  12. if (!Math) {
  13. (_easycom_u_icon + _easycom_u_form_item + _easycom_u__form)();
  14. }
  15. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  16. __name: "index",
  17. setup(__props) {
  18. var _a, _b;
  19. const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  20. (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  21. const config = common_vendor.ref({});
  22. const agree = common_vendor.ref(false);
  23. common_vendor.ref({});
  24. const form = common_vendor.ref({ brand: "", bank: "", type: "", start: "", course: "", place: "", city: "", tel: "" });
  25. const rules = {
  26. "bank": {
  27. type: "string",
  28. required: true,
  29. message: "请输入车辆车系",
  30. trigger: ["blur", "change"]
  31. },
  32. "type": {
  33. type: "string",
  34. required: true,
  35. message: "请输入车辆车型",
  36. trigger: ["blur", "change"]
  37. },
  38. "start": {
  39. type: "string",
  40. required: true,
  41. message: "请选择上牌日期",
  42. trigger: ["blur", "change"]
  43. },
  44. "course": {
  45. type: "string",
  46. required: true,
  47. message: "请选择行驶里程",
  48. trigger: ["blur", "change"]
  49. },
  50. "tel": {
  51. type: "string",
  52. required: true,
  53. message: "请输入手机号",
  54. trigger: ["blur", "change"]
  55. }
  56. };
  57. const uForm = common_vendor.ref(null);
  58. const openid = common_vendor.computed(() => {
  59. return common_vendor.index.getStorageSync("openid");
  60. });
  61. const courseList = common_vendor.ref([{ value: "1", label: "1万公里" }, { value: "2", label: "2万公里" }, { value: "3", label: "3万公里" }, { value: "4", label: "4万公里" }, { value: "5", label: "5万公里" }]);
  62. common_vendor.onLoad(async () => {
  63. await searchConfig();
  64. });
  65. common_vendor.onShow(() => {
  66. common_vendor.index.$on("toRoute", function(data) {
  67. form.value.brand = data.name;
  68. });
  69. common_vendor.index.$on("toCity", function(data) {
  70. form.value[data.field] = data.name;
  71. });
  72. });
  73. const searchConfig = async () => {
  74. config.value = common_vendor.index.getStorageSync("config");
  75. };
  76. const dateChange = (e) => {
  77. form.value.start = e.target.value;
  78. };
  79. const courseChange = (e) => {
  80. const data = courseList.value[e.detail.value];
  81. if (data)
  82. form.value.course = data.label;
  83. };
  84. const toCity = () => {
  85. common_vendor.index.navigateTo({
  86. url: `/pagesHome/city/index?field=${"city"}`
  87. });
  88. };
  89. const toPlace = () => {
  90. common_vendor.index.navigateTo({
  91. url: `/pagesHome/city/index?field=${"place"}`
  92. });
  93. };
  94. const toSelect = () => {
  95. common_vendor.index.navigateTo({
  96. url: `/pagesHome/brand/index`
  97. });
  98. };
  99. const toEvaluate = async () => {
  100. if (agree.value) {
  101. if (openid.value) {
  102. uForm.value.validate().then(async (res) => {
  103. if (form.value.place || form.value.city) {
  104. form.value.openid = openid.value;
  105. const res2 = await $api(`estimate`, "POST", form.value);
  106. if (res2.errcode == 0) {
  107. common_vendor.index.showToast({
  108. title: "免费估价申请成功",
  109. icon: "none"
  110. });
  111. common_vendor.index.navigateBack({
  112. delta: 1
  113. });
  114. } else {
  115. common_vendor.index.showToast({
  116. title: res2.errmsg,
  117. icon: "none"
  118. });
  119. }
  120. } else {
  121. common_vendor.index.showToast({
  122. title: "缺少城市信息",
  123. icon: "none"
  124. });
  125. }
  126. }).catch((err) => {
  127. console.log(err, "校验失败");
  128. });
  129. } else {
  130. common_vendor.index.showToast({
  131. title: "系统更新中,请稍后再试!",
  132. icon: "none"
  133. });
  134. }
  135. } else {
  136. common_vendor.index.showToast({
  137. title: "请阅读并同意用户协议和隐私政策",
  138. icon: "none"
  139. });
  140. }
  141. };
  142. const toAgree = () => {
  143. common_vendor.index.navigateTo({
  144. url: `/pagesHome/agree/index`
  145. });
  146. };
  147. const changeAgree = () => {
  148. agree.value = !agree.value;
  149. };
  150. return (_ctx, _cache) => {
  151. var _a2, _b2, _c, _d, _e;
  152. return common_vendor.e({
  153. a: !form.value.brand && !((_a2 = form.value.brand) == null ? void 0 : _a2.title)
  154. }, !form.value.brand && !((_b2 = form.value.brand) == null ? void 0 : _b2.title) ? {
  155. b: common_vendor.p({
  156. name: "plus-circle-fill",
  157. size: "20",
  158. color: "#2979ff"
  159. }),
  160. c: common_vendor.o(toSelect)
  161. } : {
  162. d: ((_c = form.value.brand) == null ? void 0 : _c.url) && ((_d = form.value.brand) == null ? void 0 : _d.url.length) > 0 ? (_e = form.value.brand) == null ? void 0 : _e.url[0].url : "/static/logo.png",
  163. e: common_vendor.t(form.value.brand),
  164. f: common_vendor.p({
  165. name: "arrow-right"
  166. }),
  167. g: common_vendor.o(toSelect)
  168. }, {
  169. h: form.value.bank,
  170. i: common_vendor.o(($event) => form.value.bank = $event.detail.value),
  171. j: common_vendor.p({
  172. name: "arrow-right"
  173. }),
  174. k: common_vendor.p({
  175. label: "车辆车系",
  176. prop: "bank"
  177. }),
  178. l: form.value.type,
  179. m: common_vendor.o(($event) => form.value.type = $event.detail.value),
  180. n: common_vendor.p({
  181. name: "arrow-right"
  182. }),
  183. o: common_vendor.p({
  184. label: "车辆车型",
  185. prop: "type"
  186. }),
  187. p: common_vendor.t(form.value.start || "请选择"),
  188. q: common_vendor.o(dateChange),
  189. r: common_vendor.p({
  190. name: "arrow-right"
  191. }),
  192. s: common_vendor.p({
  193. label: "上牌日期",
  194. prop: "start"
  195. }),
  196. t: common_vendor.t(form.value.course || "请选择"),
  197. v: common_vendor.o(courseChange),
  198. w: _ctx.index,
  199. x: courseList.value,
  200. y: common_vendor.p({
  201. name: "arrow-right"
  202. }),
  203. z: common_vendor.p({
  204. label: "行驶里程",
  205. prop: "course"
  206. }),
  207. A: common_vendor.t(form.value.city || "请选择"),
  208. B: common_vendor.o(toCity),
  209. C: common_vendor.p({
  210. name: "arrow-right"
  211. }),
  212. D: common_vendor.p({
  213. label: "上牌城市",
  214. prop: "city"
  215. }),
  216. E: common_vendor.t(form.value.place || "请选择"),
  217. F: common_vendor.o(toPlace),
  218. G: common_vendor.p({
  219. name: "arrow-right"
  220. }),
  221. H: common_vendor.p({
  222. label: "估值地区",
  223. prop: "place"
  224. }),
  225. I: form.value.contacts,
  226. J: common_vendor.o(($event) => form.value.contacts = $event.detail.value),
  227. K: common_vendor.p({
  228. label: "联系人",
  229. prop: "contacts"
  230. }),
  231. L: form.value.tel,
  232. M: common_vendor.o(($event) => form.value.tel = $event.detail.value),
  233. N: common_vendor.p({
  234. label: "联系电话",
  235. prop: "tel"
  236. }),
  237. O: common_vendor.sr(uForm, "1d378803-2", {
  238. "k": "uForm"
  239. }),
  240. P: common_vendor.p({
  241. model: form.value,
  242. rules,
  243. labelWidth: "65",
  244. ["border-bottom"]: true
  245. }),
  246. Q: common_vendor.o(toEvaluate),
  247. R: agree.value,
  248. S: common_vendor.o(toAgree),
  249. T: common_vendor.o(changeAgree)
  250. });
  251. };
  252. }
  253. });
  254. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1d378803"], ["__file", "D:/project/赋强公证/notarization_applet/pagesHome/sell/index.vue"]]);
  255. wx.createPage(MiniProgramPage);