|
@@ -15,6 +15,18 @@
|
|
|
<el-form-item label="预留手机号" prop="mobile">
|
|
<el-form-item label="预留手机号" prop="mobile">
|
|
|
<el-input v-model="form.mobile" :maxlength="11" />
|
|
<el-input v-model="form.mobile" :maxlength="11" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item label="手机验证码" prop="code">
|
|
|
|
|
+ <div style="display: flex;">
|
|
|
|
|
+ <el-input v-model="form.code" placeholder="请输入验证码" style="flex: 1;" />
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ :disabled="countdown > 0"
|
|
|
|
|
+ style="margin-left: 10px; width: 120px;"
|
|
|
|
|
+ @click="sendVerificationCode">
|
|
|
|
|
+ {{ countdown > 0 ? `${countdown}秒后重发` : '发送验证码' }}
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
<el-button style="min-width: 100px" type="primary" @click="submitForm(formRef)"
|
|
<el-button style="min-width: 100px" type="primary" @click="submitForm(formRef)"
|
|
|
v-permission="'recycleLogistics:abnormalSetting:update'">
|
|
v-permission="'recycleLogistics:abnormalSetting:update'">
|
|
@@ -28,20 +40,26 @@
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { ElMessage } from 'element-plus';
|
|
import { ElMessage } from 'element-plus';
|
|
|
-import { getCurrentInstance } from 'vue'
|
|
|
|
|
|
|
+import { getCurrentInstance, ref, reactive, onMounted } from 'vue'
|
|
|
const { proxy } = getCurrentInstance();
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
|
|
|
|
const formRef = ref(null);
|
|
const formRef = ref(null);
|
|
|
|
|
+const countdown = ref(0);
|
|
|
const form = reactive({
|
|
const form = reactive({
|
|
|
maxSignPerNum: '',
|
|
maxSignPerNum: '',
|
|
|
maxSignDayNum: '',
|
|
maxSignDayNum: '',
|
|
|
- mobile: ''
|
|
|
|
|
|
|
+ mobile: '',
|
|
|
|
|
+ code: ''
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 表单验证规则
|
|
// 表单验证规则
|
|
|
const rules = {
|
|
const rules = {
|
|
|
mobile: [
|
|
mobile: [
|
|
|
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号格式', trigger: 'blur' }
|
|
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号格式', trigger: 'blur' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ code: [
|
|
|
|
|
+ { required: true, message: '请输入验证码', trigger: 'blur' },
|
|
|
|
|
+ { pattern: /^\d{6}$/, message: '验证码格式不正确', trigger: 'blur' }
|
|
|
]
|
|
]
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -58,6 +76,42 @@ const getSettings = async () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// 发送验证码
|
|
|
|
|
+const sendVerificationCode = async () => {
|
|
|
|
|
+ if (!form.mobile) {
|
|
|
|
|
+ ElMessage.warning('请先输入手机号');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!/^1[3-9]\d{9}$/.test(form.mobile)) {
|
|
|
|
|
+ ElMessage.warning('请输入正确的手机号格式');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await proxy.$http.post('/order/ordersign/routeExceptionSign/getCode', {
|
|
|
|
|
+ mobile: form.mobile
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (res.data?.code === 200) {
|
|
|
|
|
+ ElMessage.success('验证码发送成功');
|
|
|
|
|
+ // 开始倒计时
|
|
|
|
|
+ countdown.value = 60;
|
|
|
|
|
+ const timer = setInterval(() => {
|
|
|
|
|
+ countdown.value--;
|
|
|
|
|
+ if (countdown.value <= 0) {
|
|
|
|
|
+ clearInterval(timer);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 1000);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessage.error(res.data?.msg || '验证码发送失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('发送验证码失败:', error);
|
|
|
|
|
+ ElMessage.error('验证码发送失败,请稍后重试');
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
// 提交表单
|
|
// 提交表单
|
|
|
const submitForm = async (formEl) => {
|
|
const submitForm = async (formEl) => {
|
|
|
if (!formEl) return;
|
|
if (!formEl) return;
|
|
@@ -66,12 +120,13 @@ const submitForm = async (formEl) => {
|
|
|
const res = await proxy.$http.post('/order/ordersign/routeExceptionSign', {
|
|
const res = await proxy.$http.post('/order/ordersign/routeExceptionSign', {
|
|
|
maxSignPerNum: form.maxSignPerNum,
|
|
maxSignPerNum: form.maxSignPerNum,
|
|
|
maxSignDayNum: form.maxSignDayNum,
|
|
maxSignDayNum: form.maxSignDayNum,
|
|
|
- mobile: form.mobile
|
|
|
|
|
|
|
+ mobile: form.mobile,
|
|
|
|
|
+ code: form.code
|
|
|
});
|
|
});
|
|
|
if (res.data?.code === 200) {
|
|
if (res.data?.code === 200) {
|
|
|
ElMessage.success('设置保存成功');
|
|
ElMessage.success('设置保存成功');
|
|
|
} else {
|
|
} else {
|
|
|
- ElMessage.error(res.data.msg)
|
|
|
|
|
|
|
+ ElMessage.error(res.data?.msg || '保存失败')
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
console.log('error submit!', fields);
|
|
console.log('error submit!', fields);
|