|
|
@@ -1,25 +1,71 @@
|
|
|
<template>
|
|
|
<app-view>
|
|
|
- <Form ref="formRef">
|
|
|
+ <Form ref="formRef" class="g-form__container" @submit="formSubmit">
|
|
|
<CellGroup inset>
|
|
|
- <Field label="充值金额" placeholder="请填写充值金额" />
|
|
|
+ <Field v-model="formData.Amount" label="充值金额" placeholder="请填写充值金额" :rules="formRules.Amount"/>
|
|
|
<Field label="凭证">
|
|
|
<template #input>
|
|
|
- <span>请上传银行充值流水截图</span>
|
|
|
- <Uploader />
|
|
|
+ <Uploader v-model="fileList" name="fileList" :max-size="50 * 1024 * 1024" @oversize="onOversize" max-count="1" :after-read="afterRead" :rules="formRules.fileList"/>
|
|
|
</template>
|
|
|
</Field>
|
|
|
</CellGroup>
|
|
|
</Form>
|
|
|
<template #footer>
|
|
|
- <Button round block type="primary">确定</Button>
|
|
|
+ <Button round block type="primary" @click="formRef?.submit()">确定</Button>
|
|
|
</template>
|
|
|
</app-view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { ref } from 'vue'
|
|
|
-import { Form, Field, CellGroup, Button, Uploader, FormInstance } from 'vant'
|
|
|
+import { Form, Field, CellGroup, Button, Uploader, FieldRule, FormInstance, Toast } from 'vant'
|
|
|
+import { doDeposit } from '@/business/bank'
|
|
|
+import { fullloading, dialog } from '@/utils/vant';
|
|
|
+import { useNavigation } from '@/hooks/navigation'
|
|
|
|
|
|
const formRef = ref<FormInstance>()
|
|
|
+const { formData, onSubmit } = doDeposit('xxx')
|
|
|
+const {router}=useNavigation()
|
|
|
+
|
|
|
+/// 证件正面地址
|
|
|
+const fileList = ref([]);
|
|
|
+
|
|
|
+const afterRead = (file: any) => {
|
|
|
+ file.status = 'uploading';
|
|
|
+ file.message = '上传中...';
|
|
|
+
|
|
|
+ let params = new FormData()
|
|
|
+ params.append('file', file.file)
|
|
|
+ params.append('size', file.file.size)
|
|
|
+};
|
|
|
+
|
|
|
+const onOversize = () => {
|
|
|
+ Toast('图片大小不能超过 50Mb')
|
|
|
+};
|
|
|
+
|
|
|
+// 表单验证规则
|
|
|
+const formRules: { [key in keyof Proto.t2bBankDepositReq | 'fileList']?: FieldRule[] } = {
|
|
|
+ Amount: [{
|
|
|
+ required: true,
|
|
|
+ message: '请填写充值金额',
|
|
|
+ }],
|
|
|
+ fileList: [{
|
|
|
+ required: true,
|
|
|
+ message: '请上传转账凭证',
|
|
|
+ }]
|
|
|
+}
|
|
|
+
|
|
|
+const formSubmit = () => {
|
|
|
+ fullloading((hideLoading) => {
|
|
|
+ onSubmit().then(() => {
|
|
|
+ hideLoading()
|
|
|
+ dialog('充值申请提交成功,请等待审核。').then(() => {
|
|
|
+ router.back()
|
|
|
+ })
|
|
|
+ }).catch((err) => {
|
|
|
+ Toast.fail(err)
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
</script>
|