Files
gxtyzx-uniapp/dist/dev/mp-weixin/package/user/pay-password.js
T

249 lines
7.6 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
require("../../utils/request.js");
const api_passport_login_index = require("../../api/passport/login/index.js");
const utils_common = require("../../utils/common.js");
const store_modules_user = require("../../store/modules/user.js");
const store_modules_car = require("../../store/modules/car.js");
const userStore = store_modules_user.useUserStore();
store_modules_car.useCarStore();
const _sfc_main = {
data() {
return {
list: [],
isLogin: false,
form: {
name: "",
phone: "",
code: "",
password: ""
},
tips: "点击获取",
logo: "",
userInfo: {},
rules: {
mobile: {
rules: [{
required: true,
format: "number",
errorMessage: "请输入手机号码"
}]
},
password: {
rules: [{
required: true,
errorMessage: "请输入支付密码"
}]
},
code: {
rules: [{
required: true,
errorMessage: "请输入短信验证码"
}]
}
}
};
},
onLoad() {
this.reload();
},
onLoad() {
if (!this.isLogin) {
this.reload();
}
},
methods: {
async reload(e) {
const app = this;
const userInfo = await userStore.fetchUserInfo();
if (Object.keys(userInfo).length > 0) {
app.isLogin = true;
app.userInfo = userInfo;
app.form.phone = userInfo.phone;
} else {
app.isLogin = false;
app.openLogin();
}
},
navTo(item) {
if (!this.isLogin) {
this.$refs.login.open("bottom");
return false;
}
utils_common.openUrl(item);
},
// 弹出登录提示框
openLogin() {
if (!this.isLogin) {
this.$refs.login.open("bottom");
return false;
}
},
codeChange(text) {
this.tips = text;
},
getSmsCode() {
const {
phone
} = this.form;
if (!phone || phone.length != 11) {
common_vendor.index.showToast({
title: "请填写正确的手机号码",
icon: "none"
});
return false;
}
if (this.$refs.uCode.canGetCode) {
api_passport_login_index.sendSmsCaptcha({
phone
}).then((res) => {
console.log("res: ", res);
});
common_vendor.index.showLoading({
title: "正在获取验证码"
});
setTimeout(() => {
common_vendor.index.hideLoading();
common_vendor.index.showToast({
title: "验证码已发送"
});
this.$refs.uCode.start();
}, 1e3);
} else {
common_vendor.index.showToast({
title: "倒计时结束后再发送",
icon: "none"
});
}
},
// 触发提交表单
submit() {
const { form } = this;
this.$refs.form.validate().then((res) => {
api_passport_login_index.updatePayPassword(form).then((message) => {
common_vendor.index.showToast({
title: "设置成功",
icon: "success"
});
setTimeout(() => {
common_vendor.index.navigateBack();
}, 1500);
}).catch((err) => {
common_vendor.index.showToast({
title: err.message,
icon: "none"
});
});
}).catch((err) => {
});
}
}
};
if (!Array) {
const _easycom_uv_code_input2 = common_vendor.resolveComponent("uv-code-input");
const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item");
const _easycom_uv_code2 = common_vendor.resolveComponent("uv-code");
const _easycom_uv_button2 = common_vendor.resolveComponent("uv-button");
const _easycom_uv_input2 = common_vendor.resolveComponent("uv-input");
const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms");
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
const _easycom_ws_login2 = common_vendor.resolveComponent("ws-login");
(_easycom_uv_code_input2 + _easycom_uni_forms_item2 + _easycom_uv_code2 + _easycom_uv_button2 + _easycom_uv_input2 + _easycom_uni_forms2 + _easycom_uni_card2 + _easycom_ws_login2)();
}
const _easycom_uv_code_input = () => "../../uni_modules/uv-code-input/components/uv-code-input/uv-code-input.js";
const _easycom_uni_forms_item = () => "../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.js";
const _easycom_uv_code = () => "../../uni_modules/uv-code/components/uv-code/uv-code.js";
const _easycom_uv_button = () => "../../uni_modules/uv-button/components/uv-button/uv-button.js";
const _easycom_uv_input = () => "../../uni_modules/uv-input/components/uv-input/uv-input.js";
const _easycom_uni_forms = () => "../../uni_modules/uni-forms/components/uni-forms/uni-forms.js";
const _easycom_uni_card = () => "../../uni_modules/uni-card/components/uni-card/uni-card.js";
const _easycom_ws_login = () => "../../uni_modules/ws-login/components/ws-login/ws-login.js";
if (!Math) {
(_easycom_uv_code_input + _easycom_uni_forms_item + _easycom_uv_code + _easycom_uv_button + _easycom_uv_input + _easycom_uni_forms + _easycom_uni_card + _easycom_ws_login)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_vendor.o(_ctx.change),
b: common_vendor.o(_ctx.finish),
c: common_vendor.o(($event) => $data.form.password = $event),
d: common_vendor.p({
mode: "box",
space: 0,
maxlength: 6,
hairline: true,
dot: true,
modelValue: $data.form.password
}),
e: common_vendor.p({
label: "支付密码",
name: "password",
required: true
}),
f: common_vendor.sr("uCode", "1e4336c6-6,1e4336c6-5"),
g: common_vendor.o($options.codeChange),
h: common_vendor.p({
seconds: _ctx.seconds,
changeText: "X秒重新获取"
}),
i: common_vendor.o($options.getSmsCode),
j: common_vendor.p({
text: $data.tips,
shape: "circle"
}),
k: common_vendor.o(($event) => $data.userInfo.mobile = $event),
l: common_vendor.p({
placeholder: "手机号码",
disabled: true,
maxlength: "11",
border: "bottom",
modelValue: $data.userInfo.mobile
}),
m: common_vendor.p({
label: "手机号码",
name: "phone",
required: true
}),
n: common_vendor.o(($event) => $data.form.code = $event),
o: common_vendor.p({
mode: "box",
space: 0,
maxlength: 6,
hairline: true,
modelValue: $data.form.code
}),
p: common_vendor.p({
label: "短信验证码",
name: "code",
required: true
}),
q: common_vendor.o($options.submit),
r: common_vendor.p({
customStyle: {
background: "linear-gradient(to right, #70b915, #008e04)",
borderRadius: "30px",
color: "#ffffff"
},
text: "确定修改"
}),
s: common_vendor.sr("form", "1e4336c6-1,1e4336c6-0"),
t: common_vendor.p({
modelValue: $data.form,
rules: $data.rules,
["label-width"]: 90
}),
v: common_vendor.p({
title: "设置支付密码",
border: false,
["is-shadow"]: false,
padding: "10px 6px"
}),
w: common_vendor.sr("login", "1e4336c6-11"),
x: common_vendor.o($options.reload),
y: common_vendor.p({
logo: $data.logo
})
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/package/user/pay-password.vue"]]);
wx.createPage(MiniProgramPage);