爱简收旧衣按件回收前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.5 KiB

  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js");
  4. const _sfc_main = {
  5. mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin],
  6. data() {
  7. return {
  8. formData: {
  9. name: "",
  10. phone: "",
  11. address: ""
  12. }
  13. };
  14. },
  15. methods: {
  16. goBack() {
  17. common_vendor.index.navigateBack();
  18. },
  19. async onRefresh() {
  20. await new Promise((resolve) => setTimeout(resolve, 1e3));
  21. this.stopPullRefresh();
  22. },
  23. confirmAdd() {
  24. if (!this.formData.name.trim()) {
  25. return common_vendor.index.showToast({
  26. title: "请输入姓名",
  27. icon: "none"
  28. });
  29. }
  30. if (!/^1\d{10}$/.test(this.formData.phone)) {
  31. return common_vendor.index.showToast({
  32. title: "请输入正确的手机号",
  33. icon: "none"
  34. });
  35. }
  36. if (!this.formData.address.trim()) {
  37. return common_vendor.index.showToast({
  38. title: "请输入地址",
  39. icon: "none"
  40. });
  41. }
  42. const pages = getCurrentPages();
  43. const prevPage = pages[pages.length - 2];
  44. if (prevPage) {
  45. prevPage.$vm.addressList.push({
  46. name: this.formData.name,
  47. phone: this.formData.phone,
  48. address: this.formData.address
  49. });
  50. }
  51. common_vendor.index.navigateBack();
  52. }
  53. }
  54. };
  55. if (!Array) {
  56. const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  57. _easycom_uni_icons2();
  58. }
  59. const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
  60. if (!Math) {
  61. _easycom_uni_icons();
  62. }
  63. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  64. return {
  65. a: common_vendor.p({
  66. type: "left",
  67. size: "20"
  68. }),
  69. b: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
  70. c: $data.formData.name,
  71. d: common_vendor.o(($event) => $data.formData.name = $event.detail.value),
  72. e: $data.formData.phone,
  73. f: common_vendor.o(($event) => $data.formData.phone = $event.detail.value),
  74. g: $data.formData.address,
  75. h: common_vendor.o(($event) => $data.formData.address = $event.detail.value),
  76. i: common_vendor.o((...args) => $options.confirmAdd && $options.confirmAdd(...args))
  77. };
  78. }
  79. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3b5138af"]]);
  80. wx.createPage(MiniProgramPage);
  81. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/subcomponent/add.js.map