爱简收旧衣按件回收前端代码仓库
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

"use strict";
const common_vendor = require("../../common/vendor.js");
const pages_mixins_pullRefreshMixin = require("../mixins/pullRefreshMixin.js");
const _sfc_main = {
mixins: [pages_mixins_pullRefreshMixin.pullRefreshMixin],
data() {
return {
formData: {
name: "",
phone: "",
address: ""
}
};
},
methods: {
goBack() {
common_vendor.index.navigateBack();
},
async onRefresh() {
await new Promise((resolve) => setTimeout(resolve, 1e3));
this.stopPullRefresh();
},
confirmAdd() {
if (!this.formData.name.trim()) {
return common_vendor.index.showToast({
title: "请输入姓名",
icon: "none"
});
}
if (!/^1\d{10}$/.test(this.formData.phone)) {
return common_vendor.index.showToast({
title: "请输入正确的手机号",
icon: "none"
});
}
if (!this.formData.address.trim()) {
return common_vendor.index.showToast({
title: "请输入地址",
icon: "none"
});
}
const pages = getCurrentPages();
const prevPage = pages[pages.length - 2];
if (prevPage) {
prevPage.$vm.addressList.push({
name: this.formData.name,
phone: this.formData.phone,
address: this.formData.address
});
}
common_vendor.index.navigateBack();
}
}
};
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.p({
type: "left",
size: "20"
}),
b: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
c: $data.formData.name,
d: common_vendor.o(($event) => $data.formData.name = $event.detail.value),
e: $data.formData.phone,
f: common_vendor.o(($event) => $data.formData.phone = $event.detail.value),
g: $data.formData.address,
h: common_vendor.o(($event) => $data.formData.address = $event.detail.value),
i: common_vendor.o((...args) => $options.confirmAdd && $options.confirmAdd(...args))
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3b5138af"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/subcomponent/add.js.map