t
This commit is contained in:
@@ -6,17 +6,22 @@
|
||||
>
|
||||
成为代理
|
||||
</div>
|
||||
<div v-if="ancestor" class="text-center text-xs my-2" style="color: var(--van-text-color-2);">
|
||||
{{ maskName(ancestor) }}邀您成为一查查代理方
|
||||
</div>
|
||||
<div class="p-4">
|
||||
<van-field
|
||||
label-width="56"
|
||||
v-model="form.referrer"
|
||||
label="邀请信息"
|
||||
name="referrer"
|
||||
placeholder="请输入邀请码/代理编码/代理手机号"
|
||||
required
|
||||
/>
|
||||
<van-field
|
||||
label-width="56"
|
||||
v-model="form.region"
|
||||
is-link
|
||||
readonly
|
||||
label="地区"
|
||||
placeholder="请选择地区"
|
||||
placeholder="请选择地区(可选)"
|
||||
@click="showCascader = true"
|
||||
/>
|
||||
<van-popup v-model:show="showCascader" round position="bottom">
|
||||
@@ -124,10 +129,6 @@ import { useCascaderAreaData } from "@vant/area-data";
|
||||
import { showToast } from "vant"; // 引入 showToast 方法
|
||||
const emit = defineEmits(); // 确保 emit 可以正确使用
|
||||
const props = defineProps({
|
||||
ancestor: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
isSelf: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
@@ -137,11 +138,12 @@ const props = defineProps({
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
const { ancestor, isSelf, userName } = toRefs(props);
|
||||
const { isSelf, userName } = toRefs(props);
|
||||
const form = ref({
|
||||
referrer: "",
|
||||
region: "",
|
||||
mobile: "",
|
||||
code: "", // 增加验证码字段
|
||||
code: "", // 验证码字段
|
||||
});
|
||||
const showCascader = ref(false);
|
||||
const cascaderValue = ref("");
|
||||
@@ -207,10 +209,11 @@ onUnmounted(() => {
|
||||
});
|
||||
const submit = () => {
|
||||
// 校验表单字段
|
||||
if (!form.value.region) {
|
||||
showToast({ message: "请选择地区" });
|
||||
if (!form.value.referrer || !form.value.referrer.trim()) {
|
||||
showToast({ message: "请输入邀请信息" });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!form.value.mobile) {
|
||||
showToast({ message: "请输入手机号" });
|
||||
return;
|
||||
@@ -231,15 +234,13 @@ const submit = () => {
|
||||
showToast({ message: "请先阅读并同意用户协议及相关条款" });
|
||||
return;
|
||||
}
|
||||
console.log("form", form.value);
|
||||
|
||||
// 触发父组件提交申请
|
||||
emit("submit", form.value);
|
||||
emit("submit", {
|
||||
...form.value,
|
||||
referrer: form.value.referrer.trim()
|
||||
});
|
||||
};
|
||||
const maskName = computed(() => {
|
||||
return (name) => {
|
||||
return name.substring(0, 3) + "****" + name.substring(7);
|
||||
};
|
||||
});
|
||||
const closePopup = () => {
|
||||
emit("close");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user