|
|
@@ -21,7 +21,9 @@
|
|
|
<Field v-model="formData.refernum" name="refernum" label="推荐码" placeholder="必填" autocomplete="off"
|
|
|
:rules="formRules.refernum">
|
|
|
<!-- <template #button>
|
|
|
- <Button size="small" type="primary">扫码</Button>
|
|
|
+ <app-qrcode-scan @success="onScanSuccess">
|
|
|
+ <Button size="small" type="primary">扫码</Button>
|
|
|
+ </app-qrcode-scan>
|
|
|
</template> -->
|
|
|
</Field>
|
|
|
</CellGroup>
|
|
|
@@ -41,24 +43,37 @@
|
|
|
<div class="g-form__footer">
|
|
|
<Button type="primary" @click="formRef?.submit" round block>免费注册</Button>
|
|
|
</div>
|
|
|
+ <Overlay class="register__reward" :show="showReward">
|
|
|
+ <div class="wrapper">
|
|
|
+ <div class="title">注册成功!</div>
|
|
|
+ <div class="title">恭喜获得红包</div>
|
|
|
+ <div class="details">{{ redEnvelope }}</div>
|
|
|
+ <div class="buttons">
|
|
|
+ <Button @click="router.back()" round>好的</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </Overlay>
|
|
|
</template>
|
|
|
</app-view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { reactive, ref, computed } from 'vue'
|
|
|
-import { CellGroup, Cell, Button, Field, Form, FormInstance, Checkbox, Toast, FieldRule } from 'vant'
|
|
|
+import { CellGroup, Cell, Button, Field, Form, FormInstance, Checkbox, Toast, FieldRule, Overlay } from 'vant'
|
|
|
import { useCountDown } from '@vant/use'
|
|
|
import { fullloading, dialog } from '@/utils/vant'
|
|
|
import { validateRules } from '@/constants/regex'
|
|
|
import { useNavigation } from '@/hooks/navigation'
|
|
|
-import { userRegister, sendRegisterVerifyCode } from '@/services/api/common'
|
|
|
+import { userRegister, sendRegisterVerifyCode, queryMyRegisterMoney } from '@/services/api/common'
|
|
|
+// import AppQrcodeScan from '@mobile/components/base/qrcode-scan/index.vue'
|
|
|
import cryptojs from 'crypto-js'
|
|
|
|
|
|
const { router, routerTo } = useNavigation()
|
|
|
const formRef = ref<FormInstance>()
|
|
|
const checked = ref(false) // 是否同意注册条款
|
|
|
const isCountdown = ref(false) // 是否正在倒计时
|
|
|
+const showReward = ref(false) // 显示红包
|
|
|
+const redEnvelope = ref(0) // 红包金额
|
|
|
|
|
|
// 倒计时函数
|
|
|
const countdown = useCountDown({
|
|
|
@@ -117,6 +132,11 @@ const formRules: { [key in keyof Model.RegisterReq]?: FieldRule[] } = {
|
|
|
}],
|
|
|
}
|
|
|
|
|
|
+// 扫码成功
|
|
|
+// const onScanSuccess = (text: string) => {
|
|
|
+// formData.refernum = text
|
|
|
+// }
|
|
|
+
|
|
|
// 发送手机验证码
|
|
|
const sendVerifyCode = () => {
|
|
|
formRef.value?.validate('mobilephone').then(() => {
|
|
|
@@ -133,6 +153,33 @@ const sendVerifyCode = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+// 获取注册红包
|
|
|
+const getRegisterMoney = (accountid: number) => {
|
|
|
+ const toggleDialog = () => {
|
|
|
+ dialog('您的账号已成功注册。').then(() => {
|
|
|
+ router.back()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return queryMyRegisterMoney({
|
|
|
+ data: {
|
|
|
+ accountid
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ // 查询成功显示获得红包
|
|
|
+ if (res.data.length) {
|
|
|
+ redEnvelope.value = res.data[0].amount
|
|
|
+ showReward.value = true
|
|
|
+ } else {
|
|
|
+ toggleDialog()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ // 查询失败提示注册成功后返回登录页面
|
|
|
+ toggleDialog()
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
// 表单提交
|
|
|
const formSubmit = () => {
|
|
|
if (checked.value) {
|
|
|
@@ -149,10 +196,12 @@ const formSubmit = () => {
|
|
|
},
|
|
|
success: (res) => {
|
|
|
if (res.code === 0) {
|
|
|
- hideLoading()
|
|
|
- dialog('您的账号已成功注册。').then(() => {
|
|
|
- router.back()
|
|
|
- })
|
|
|
+ // 等待3秒后查询注册红包
|
|
|
+ setTimeout(() => {
|
|
|
+ getRegisterMoney(res.taaccount[0].accountid).finally(() => {
|
|
|
+ hideLoading()
|
|
|
+ })
|
|
|
+ }, 3000)
|
|
|
} else {
|
|
|
Toast.fail(res.message)
|
|
|
}
|
|
|
@@ -161,7 +210,7 @@ const formSubmit = () => {
|
|
|
Toast.fail(err)
|
|
|
}
|
|
|
})
|
|
|
- })
|
|
|
+ }, '正在注册...')
|
|
|
} else {
|
|
|
Toast('请先同意注册条款')
|
|
|
}
|