|
|
@@ -0,0 +1,180 @@
|
|
|
+<template>
|
|
|
+ <app-view class="g-form bank-wallet-deposit">
|
|
|
+ <Form ref="formRef" class="g-form__container" @submit="doDepositWarning">
|
|
|
+ <CellGroup inset v-if="cusBank?.caninamount === 1">
|
|
|
+ <Field type="number" v-model="formData.Amount" label="付款金额" placeholder="请输入"
|
|
|
+ :rules="formRules.Amount" />
|
|
|
+ <Field label="凭证" :rules="formRules.filePath">
|
|
|
+ <template #input>
|
|
|
+ <app-uploader @success="onUploadSuccess" />
|
|
|
+ </template>
|
|
|
+ </Field>
|
|
|
+ <template v-for="(item, index) in configs" :key="index">
|
|
|
+ <Field v-if="item.usabletype === 1 || item.usabletype === userStore.userInfo?.userinfotype"
|
|
|
+ :name="item.fieldcode" :label="item.fieldname" v-model="item.value" placeholder="请输入" />
|
|
|
+ </template>
|
|
|
+ </CellGroup>
|
|
|
+ <div class="tips_time">
|
|
|
+ <span class="tips">付款时间:交易日 {{ startTime }} - {{ endTime }}</span>
|
|
|
+ <span class="tips"><br>节假日以通知、公告为准,非交易日请勿操作!</span>
|
|
|
+ </div>
|
|
|
+ <div class="tips_bank">
|
|
|
+ <div class="tips_bank_row" v-if="msg_320">
|
|
|
+ <span class="tips_bank_row__label">平台付款银行</span>
|
|
|
+ <span class="msg_tips" :data-clipboard-text="msg_320" v-copy="onCopy">{{ msg_320 }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="tips_bank_row" v-if="msg_321">
|
|
|
+ <span class="tips_bank_row__label">平台付款账号</span>
|
|
|
+ <span class="msg_tips" :data-clipboard-text="msg_321" v-copy="onCopy">{{ msg_321 }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="tips_bank_row" v-if="msg_322">
|
|
|
+ <span class="tips_bank_row__label">平台付款账户</span>
|
|
|
+ <span class="msg_tips" :data-clipboard-text="msg_322" v-copy="onCopy">{{ msg_322 }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="tips_bank_row" v-if="msg_323">
|
|
|
+ <span class="tips_bank_row__label">平台付款支行</span>
|
|
|
+ <span class="msg_tips" :data-clipboard-text="msg_323" v-copy="onCopy">{{ msg_323 }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <CellGroup inset v-if="msg_324">
|
|
|
+ <Cell :title="$t('common.tips')">
|
|
|
+ <template #label>
|
|
|
+ <p v-html="msg_324" />
|
|
|
+ </template>
|
|
|
+ </Cell>
|
|
|
+ </CellGroup>
|
|
|
+ </Form>
|
|
|
+ <template #footer v-if="cusBank?.caninamount === 1">
|
|
|
+ <div class="g-form__footer inset">
|
|
|
+ <Button round block type="danger" @click="formRef?.submit()">{{ $t('operation.confirm') }}</Button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </app-view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import { shallowRef, ref } from 'vue'
|
|
|
+import { Form, Field, Cell, CellGroup, Button, FieldRule, FormInstance, showToast, showFailToast } from 'vant'
|
|
|
+import { fullloading, dialog } from '@/utils/vant'
|
|
|
+import { useNavigation } from '@mobile/router/navigation'
|
|
|
+import { useDoDeposit, useDoCusBankExtendConfigs } from '@/business/bank'
|
|
|
+import { getServerTime } from '@/services/api/common'
|
|
|
+import { useUserStore } from '@/stores'
|
|
|
+import AppUploader from '@mobile/components/base/uploader/index.vue'
|
|
|
+import moment from 'moment'
|
|
|
+
|
|
|
+const formRef = shallowRef<FormInstance>()
|
|
|
+const { formData, onSubmit } = useDoDeposit()
|
|
|
+const { router } = useNavigation()
|
|
|
+const { getSystemParamValue } = useUserStore()
|
|
|
+const { configs, cusBank, startTime, endTime } = useDoCusBankExtendConfigs(2)
|
|
|
+const certificate_photo_url = ref('')
|
|
|
+const userStore = useUserStore()
|
|
|
+
|
|
|
+const msg_320 = getSystemParamValue('320')
|
|
|
+const msg_321 = getSystemParamValue('321')
|
|
|
+const msg_322 = getSystemParamValue('322')
|
|
|
+const msg_323 = getSystemParamValue('323')
|
|
|
+const msg_324 = getSystemParamValue('324')
|
|
|
+
|
|
|
+// 表单验证规则
|
|
|
+const formRules: { [key: string]: FieldRule[] } = {
|
|
|
+ Amount: [{
|
|
|
+ required: true,
|
|
|
+ message: '请输入付款金额',
|
|
|
+ }],
|
|
|
+ filePath: [{
|
|
|
+ message: '请上传转账凭证',
|
|
|
+ validator: () => {
|
|
|
+ /// 是否非必填
|
|
|
+ const ismandatory = Number(getSystemParamValue('316'))
|
|
|
+ return ismandatory === 0 ? true : !!certificate_photo_url.value
|
|
|
+ }
|
|
|
+ }]
|
|
|
+}
|
|
|
+
|
|
|
+const onUploadSuccess = (filePath: string) => {
|
|
|
+ certificate_photo_url.value = filePath
|
|
|
+}
|
|
|
+
|
|
|
+/// 提示信息
|
|
|
+const doDepositWarning = () => {
|
|
|
+ fullloading((hideLoading) => {
|
|
|
+ getServerTime().then((res) => {
|
|
|
+ const n = moment(res.data)
|
|
|
+ const s = moment(startTime.value, 'HH:mm')
|
|
|
+ const e = moment(endTime.value, 'HH:mm')
|
|
|
+ if (n.isSameOrAfter(s) && n.isBefore(e)) {
|
|
|
+ dialog({ message: '是否已在银行端进行付款转账?', showCancelButton: true, confirmButtonText: '确认', cancelButtonText: '取消', }).then(() => {
|
|
|
+ /// 提交
|
|
|
+ formSubmit()
|
|
|
+ }).catch(() => {
|
|
|
+ /// 返回上一层
|
|
|
+ router.back()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ dialog({
|
|
|
+ title: '提示',
|
|
|
+ message: '付款不在时间范围内',
|
|
|
+ confirmButtonText: '我知道了'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ hideLoading('获取服务器时间失败', 'fail')
|
|
|
+ }).finally(() => {
|
|
|
+ hideLoading()
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const onCopy = (status: boolean) => {
|
|
|
+ if (status) {
|
|
|
+ showToast({ message: '已复制,快去粘贴吧~' })
|
|
|
+ } else {
|
|
|
+ showFailToast('复制失败')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const formSubmit = () => {
|
|
|
+ fullloading((hideLoading) => {
|
|
|
+ const obj: { [key: string]: unknown } = Object.create({})
|
|
|
+ configs.value.forEach((e) => {
|
|
|
+ if (e.value) {
|
|
|
+ obj[e.fieldcode] = e.value
|
|
|
+ }
|
|
|
+ })
|
|
|
+ obj['certificate_photo_url'] = certificate_photo_url.value
|
|
|
+ formData.extendInfo = JSON.stringify(obj)
|
|
|
+
|
|
|
+ let isComplete = false // 请求是否结束
|
|
|
+ const complete = () => {
|
|
|
+ isComplete = true
|
|
|
+ dialog('提交成功,请稍后确认结果').then(() => {
|
|
|
+ router.back()
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 请求等待可能会超过30秒导致请求超时,所以2秒内没回应直接提示成功
|
|
|
+ const t = setTimeout(() => complete(), 2000)
|
|
|
+
|
|
|
+ onSubmit().then(() => {
|
|
|
+ if (!isComplete) {
|
|
|
+ complete()
|
|
|
+ }
|
|
|
+ }).catch((err) => {
|
|
|
+ if (!isComplete) {
|
|
|
+ dialog('提交失败:' + err).then(() => {
|
|
|
+ formData.Amount = undefined
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ window.clearTimeout(t)
|
|
|
+ hideLoading()
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+@import './index.less';
|
|
|
+</style>
|