li.shaoyi 1 рік тому
батько
коміт
b00ba0f6b7

+ 1 - 1
src/packages/sbyj/router/index.ts

@@ -172,7 +172,7 @@ const routes: Array<RouteRecordRaw> = [
       {
         path: 'wallet',
         name: 'bank-wallet',
-        component: () => import('@mobile/views/bank/wallet/Index.vue'),
+        component: () => import('../views/bank/wallet/index.vue'),
       },
       {
         path: 'sign',

+ 65 - 0
src/packages/sbyj/views/bank/wallet/components/deposit/index.less

@@ -0,0 +1,65 @@
+.bank-wallet-deposit {
+    .g-form__bank {
+        padding: 16px;
+
+        table {
+            width: 100%;
+            font-size: 12px;
+            border: 1px dashed #ddd;
+            border-radius: 5px;
+
+            td {
+                &:not(:first-child) {
+                    text-align: right;
+                }
+
+                span {
+                    &:first-child {
+                        color: #999;
+                    }
+                }
+
+                button {
+                    background-color: #e1e1e1;
+                    border-radius: 5px;
+                    padding: 1px 10px;
+                }
+            }
+        }
+    }
+
+    .msg_tips {
+        color: #0099FF;
+        padding-left: 14px;
+        height: 35px;
+    }
+
+    .tips {
+        color: #993333; 
+        font-size: 12px;
+    }
+
+    .tips_time {
+        background-color: white; 
+        border-radius: 5px; 
+        margin: 10px 15px; 
+        padding: 10px 15px;
+    }
+
+    .tips_bank {
+        display: flex;
+        flex-direction: column;
+        background-color: white; 
+        margin: 0px 15px 10px 15px; 
+        padding: 10px 15px;
+        border-radius: 5px; 
+
+        .tips_bank_row {
+            height: 30px;
+            &__label {
+                font-size: 14px; 
+                color: #333;
+            }
+        }
+    }
+}

+ 180 - 0
src/packages/sbyj/views/bank/wallet/components/deposit/index.vue

@@ -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>

+ 29 - 0
src/packages/sbyj/views/bank/wallet/components/withdraw/index.less

@@ -0,0 +1,29 @@
+.bank-wallet-withdraw {
+    .form-field {
+        .van-field__control {
+            display: flex;
+            flex-direction: column;
+            align-items: flex-start;
+        }
+
+        &__tips {
+            font-size: 12px;
+        }
+    }
+
+    .g-form__bank {
+        padding: 16px;
+    }
+
+    .msg_tips {
+        color: #993333; 
+        font-size: 12px;
+    }
+
+    .tips_time {
+        background-color: white; 
+        border-radius: 10px; 
+        margin: 10px 15px; 
+        padding: 10px 15px;
+    }
+}

+ 163 - 0
src/packages/sbyj/views/bank/wallet/components/withdraw/index.vue

@@ -0,0 +1,163 @@
+<template>
+    <app-view class="g-form bank-wallet-withdraw">
+        <Form ref="formRef" class="g-form__container" @submit="doWithDrawWarning">
+            <CellGroup inset v-if="cusBank?.canoutamount === 1">
+                <Field class="form-field" type="number" label="收款金额" v-model="formData.Amount"
+                    :rules="formRules.Amount">
+                    <template #input>
+                        <input v-model="formData.Amount" placeholder="请输入" />
+                        <span class="form-field__tips">可收款额:{{ fund.AvailableOutMoney }}</span>
+                    </template>
+                </Field>
+                <Field label="开户银行">
+                    <template #input>
+                        {{ sign.bankname }}
+                    </template>
+                </Field>
+                <Field label="银行卡号">
+                    <template #input>
+                        {{ sign.bankaccountno }}
+                    </template>
+                </Field>
+                <Field label="姓名">
+                    <template #input>
+                        {{ sign.bankaccountname }}
+                    </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="msg_tips">收款时间:交易日 {{ startTime }} - {{ endTime }}</span>
+                <span class="msg_tips"><br>节假日以通知、公告为准,非交易日请勿操作!</span>
+            </div>
+            <CellGroup inset v-if="msg_317">
+                <Cell title="提示">
+                    <template #label>
+                        <p v-html="msg_317" />
+                    </template>
+                </Cell>
+            </CellGroup>
+            <CellGroup inset v-if="cusBank?.canoutamount === 0">
+                <Cell>
+                    <template #label>
+                        <p v-html="msg"></p>
+                    </template>
+                </Cell>
+            </CellGroup>
+        </Form>
+        <template #footer v-if="cusBank?.canoutamount === 1">
+            <div class="g-form__footer inset">
+                <Button round block type="danger" @click="formRef?.submit()">确定</Button>
+            </div>
+        </template>
+    </app-view>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef } from 'vue'
+import { Form, Field, Cell, CellGroup, FormInstance, Button, FieldRule } from 'vant'
+import { fullloading, dialog, } from '@/utils/vant'
+import { useDoWithdraw, useAccountFundInfo, useDoCusBankExtendConfigs } from '@/business/bank'
+import { getServerTime } from '@/services/api/common'
+import { useNavigation } from '@mobile/router/navigation'
+import { useUserStore } from '@/stores'
+import moment from 'moment'
+
+const { formData, onSubmit, sign } = useDoWithdraw()
+const { configs, cusBank, startTime, endTime } = useDoCusBankExtendConfigs(3)
+/// 资金账户信息
+const { fund } = useAccountFundInfo()
+const { router } = useNavigation()
+const formRef = shallowRef<FormInstance>()
+const { getSystemParamValue } = useUserStore()
+const msg = getSystemParamValue('302')
+const msg_317 = getSystemParamValue('317')
+const userStore = useUserStore()
+
+// 表单验证规则
+const formRules: { [key: string]: FieldRule[] } = {
+    Amount: [{
+        required: true,
+        message: '请输入收款金额',
+        validator: (val) => {
+            if (val <= (fund.value.AvailableOutMoney ?? 0.0) && val > 0.0) {
+                return true
+            } else if (fund.value.AvailableOutMoney === 0.0) {
+                return '可收款额为0'
+            } else {
+                return '超过可收款额'
+            }
+        }
+    }]
+}
+
+/// 提示信息
+const doWithDrawWarning = () => {
+    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)) {
+                /// 提交
+                formSubmit()
+            } else {
+                dialog({
+                    title: '提示',
+                    message: '收款不在时间范围内',
+                    confirmButtonText: '我知道了'
+                })
+            }
+        }).catch(() => {
+            hideLoading('获取服务器时间失败', 'fail')
+        }).finally(() => {
+            hideLoading()
+        })
+    })
+}
+
+const formSubmit = () => {
+    const obj: { [key: string]: unknown } = Object.create({})
+    configs.value.forEach((e) => {
+        if (e.value) {
+            obj[e.fieldcode] = e.value
+        }
+    })
+    formData.extendInfo = JSON.stringify(obj)
+    fullloading((hideLoading) => {
+        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>

+ 42 - 0
src/packages/sbyj/views/bank/wallet/index.vue

@@ -0,0 +1,42 @@
+<template>
+    <app-view>
+        <template #header>
+            <app-navbar title="收付款" >
+                <template #right>
+                    <div class="button-more" @click="openComponent('inoutapply')">
+                        <span>申请记录</span>
+                    </div>
+                </template>
+            </app-navbar>
+        </template>
+        <Tabs v-model:active="active">
+            <Tab title="付款">
+                <app-deposit />
+            </Tab>
+            <Tab title="收款">
+                <app-withdraw />
+            </Tab>
+        </Tabs>
+        <component ref="componentRef" :is="componentMap.get(componentId)" @closed="closeComponent"
+            v-if="componentId" />
+    </app-view>
+</template>
+
+<script lang="ts" setup>
+import { shallowRef, defineAsyncComponent } from 'vue'
+import { Tab, Tabs } from 'vant'
+import { useNavigation } from '@mobile/router/navigation'
+import AppDeposit from './components/deposit/index.vue'
+import AppWithdraw from './components/withdraw/index.vue'
+import { useComponent } from '@/hooks/component'
+
+const componentMap = new Map<string, unknown>([
+    ['inoutapply', defineAsyncComponent(() => import('@mobile/views/bank/wallet/components/inoutapply/Index.vue'))], // 申请流水
+])
+
+const { componentRef, componentId, openComponent, closeComponent } = useComponent()
+
+const { getQueryStringToNumber } = useNavigation()
+
+const active = shallowRef(getQueryStringToNumber('tab'))
+</script>

+ 2 - 2
src/packages/sbyj/views/mine/index.vue

@@ -58,8 +58,8 @@
                     </ul>
                 </div>
                 <div class="button">
-                    <Button type="danger" size="small" round @click="doInOutMoney('0')">入金</Button>
-                    <Button size="small" round @click="doInOutMoney('1')">出金</Button>
+                    <Button type="danger" size="small" round @click="doInOutMoney('0')">付款</Button>
+                    <Button size="small" round @click="doInOutMoney('1')">收款</Button>
                 </div>
             </div>
         </div>