li.shaoyi před 3 měsíci
rodič
revize
745ba27ad2

+ 5 - 0
src/packages/snhl/router/index.ts

@@ -146,6 +146,11 @@ const routes: Array<RouteRecordRaw> = [
         path: 'authresult',
         name: 'account-authresult',
         component: () => import('@mobile/views/account/authresult/Index.vue'),
+      },
+      {
+        path: 'protocol',
+        name: 'account-protocol',
+        component: () => import('../../sbyj/views/account/protocol/Index.vue'),
       }
     ],
   },

+ 23 - 77
src/packages/snhl/views/mine/index.vue

@@ -93,17 +93,23 @@
                 </Cell>
                 <Cell is-link :to="{ name: 'account-authresult' }" v-if="authStatus === AuthStatus.Submitted">
                     <template #title>
-                        <Iconfont icon="g-icon-certification">{{ $t('mine.authentication') }}</Iconfont>
+                        <Iconfont icon="g-icon-certification">实名认证</Iconfont>
                     </template>
                 </Cell>
                 <Cell is-link :to="{ name: 'account-certification' }" v-else-if="authStatus !== AuthStatus.Certified">
                     <template #title>
-                        <Iconfont icon="g-icon-certification">{{ $t('mine.authentication') }}</Iconfont>
+                        <Iconfont icon="g-icon-certification">实名认证</Iconfont>
                     </template>
                 </Cell>
-                <Cell is-link :to="{ name: 'bank-sign' }" v-if="authStatus === AuthStatus.Certified">
+                <Cell is-link :to="{ name: 'bank-sign' }" v-if="authStatus === AuthStatus.Certified && canBankSign">
                     <template #title>
-                        <Iconfont icon="g-icon-sign">{{ $t('mine.banksign') }}</Iconfont>
+                        <Iconfont icon="g-icon-sign">签约账户</Iconfont>
+                    </template>
+                </Cell>
+                <Cell is-link :to="{ name: 'account-protocol' }"
+                    v-if="signRecords.length && userStore.userType != 2 && authStatus === AuthStatus.Certified">
+                    <template #title>
+                        <Iconfont icon="g-icon-order--line">合同签署</Iconfont>
                     </template>
                 </Cell>
                 <Cell is-link :to="{ name: 'mine-profile' }">
@@ -145,84 +151,24 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, onActivated, computed } from 'vue'
 import { Cell, CellGroup, Button, Icon } from 'vant'
-import { fullloading, dialog } from '@/utils/vant'
 import { parsePercent } from '@/filters'
-import { useNavigation } from '@mobile/router/navigation'
 import { AuthStatus } from '@/constants/account'
-import { queryBankAccountSign } from '@/services/api/bank'
-import { useLoginStore, useAccountStore, useUserStore,  } from '@/stores'
-import eventBus from '@/services/bus'
 import Iconfont from '@/components/base/iconfont/index.vue'
-import { i18n } from '@/stores'
-
-const { global: { t } } = i18n
-const { router, routerTo } = useNavigation()
-const loginStore = useLoginStore()
-const userStore = useUserStore()
-const accountStore = useAccountStore()
-const { currentAccount } = accountStore.$toRefs()
-
-const headerRef = shallowRef<HTMLDivElement>()
-const authStatus = computed(() => userStore.userAccount.hasauth) // 实名认证状态
-
-const onReady = (el: HTMLDivElement) => {
-    // 设置背景图位置
-    headerRef.value?.style.setProperty('background-position', `0 -${el.clientHeight}px`)
-}
-
-/// 进行出入金操作判断
-const doInOutMoney = (tab: string) => {
-    if (authStatus.value === AuthStatus.Certified) {
-        fullloading((hideLoading) => {
-            queryBankAccountSign().then((res) => {
-                hideLoading()
-                const { signstatus } = res.data[0] ?? {}
-                /// 只有已签约的情况下才可以进行出入金
-                if (signstatus && signstatus === 4) {
-                    router.push({ name: 'bank-wallet', query: { tab } })
-                } else {
-                    dialog({
-                        message: t('banksign.tips1'),
-                        showCancelButton: true,
-                        confirmButtonText: t('banksign.tips2')
-                    }).then(() => {
-                        router.push({ name: 'bank-sign' })
-                    })
-                }
-            }).catch(() => {
-                hideLoading(t('common.loadingfailed'), 'fail')
-            })
-        }, t('common.loading'))
-    } else {
-        dialog({
-            message: t('banksign.tips3'),
-            showCancelButton: true,
-            confirmButtonText: t('banksign.tips4')
-        }).then(() => {
-            router.push({ name: 'account-certification' })
-        })
-    }
-}
-
-const userLogout = () => {
-    dialog({
-        message: t('banksign.tips5'),
-        showCancelButton: true,
-        confirmButtonText: t('operation.confirm'),
-    }).then(() => {
-        loginStore.clearAutoLoginData()
-        eventBus.$emit('LogoutNotify')
-    })
-}
+import { useSetup } from '../../../sbyj/views/mine/composables'
 
-onActivated(() => {
-    if (authStatus.value !== AuthStatus.Certified) {
-        userStore.getUserData()
-    }
-    accountStore.getAccountList()
-})
+const {
+    loginStore,
+    userStore,
+    authStatus,
+    currentAccount,
+    signRecords,
+    canBankSign,
+    userLogout,
+    onReady,
+    routerTo,
+    doInOutMoney
+} = useSetup()
 </script>
 
 <style lang="less">