|
|
@@ -80,11 +80,10 @@ Component({
|
|
|
else this.setData({ "privacyContract.agree": agree });
|
|
|
},
|
|
|
onAgree() {
|
|
|
- const submitBtn = this.selectComponent("#submitBtn");
|
|
|
- console.log("onAgree-->");
|
|
|
-
|
|
|
this.setData({ "privacyContract.agree": true });
|
|
|
- if (submitBtn) submitBtn.resetState();
|
|
|
+ },
|
|
|
+ onDisagree() {
|
|
|
+ this.setData({ "privacyContract.agree": false });
|
|
|
},
|
|
|
async verifyCardno(event: WechatMiniprogram.InputConfirm) {
|
|
|
const value = event.detail.value;
|
|
|
@@ -104,19 +103,18 @@ Component({
|
|
|
},
|
|
|
async onSubmit(event: WechatMiniprogram.FormSubmit) {
|
|
|
if (this.data.submitting) return;
|
|
|
- this.setData({ submitting: true });
|
|
|
+ this.resetSubmitState(true);
|
|
|
const data = { ...this.data.model, ...event.detail.value };
|
|
|
data.phone = this.data.model.phone;
|
|
|
- const submitBtn = this.selectComponent("#submitBtn");
|
|
|
if (!data.phone) {
|
|
|
- if (submitBtn) submitBtn.resetState();
|
|
|
+ this.resetSubmitState(false);
|
|
|
return getTickleContext.call(this).showWarnMessage("请获取手机号码");
|
|
|
}
|
|
|
if (!data.agemust) {
|
|
|
data.agemust = this.data.privacyContract.agree ? "Y" : "N";
|
|
|
}
|
|
|
if (data.agemust === "N") {
|
|
|
- if (submitBtn) submitBtn.resetState();
|
|
|
+ this.resetSubmitState(false);
|
|
|
this.setData({ "privacyContract.show": true });
|
|
|
return wx.showToast({
|
|
|
title: `请阅读并同意${this.data.privacyContract.name}`,
|
|
|
@@ -146,5 +144,13 @@ Component({
|
|
|
wx.hideLoading();
|
|
|
}
|
|
|
},
|
|
|
+ resetSubmitState(loading: boolean) {
|
|
|
+ if (loading) this.setData({ submitting: true });
|
|
|
+ else {
|
|
|
+ this.setData({ submitting: false });
|
|
|
+ const submitBtn = this.selectComponent("#submitBtn");
|
|
|
+ if (submitBtn) submitBtn.resetState();
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
});
|