Handy_Cao 2 năm trước cách đây
mục cha
commit
3d7134fa12

+ 30 - 1
src/business/user/account.ts

@@ -1,6 +1,6 @@
 import { shallowRef, reactive } from 'vue'
 import { useLoginStore, useAccountStore } from '@/stores'
-import { investorDel, modifyPassword, requestAddAuth, requestAddUser, requestCreateContractAndAddSigner, requestSignCompleted, requestWillFace } from '@/services/api/account'
+import { investorDel, modifyPassword, requestAddAuth, requestAddUser, requestCreateContractAndAddSigner, requestCreateFlowByTemplateDirectly, requestSignCompleted, requestWillFace } from '@/services/api/account'
 import cryptojs from 'crypto-js'
 
 const loginStore = useLoginStore()
@@ -197,4 +197,33 @@ export function useRequestWillFace() {
         willFaceFormData,
         willFace
     }
+}
+
+/**
+ * 通过合同名和模板 id 直接发起签署流程
+ */
+export function useRequestCreateFlowByTemplateDirectly() {
+    const loading = shallowRef(false)
+
+    /// 合同编号
+    const templateFormData = reactive<Model.CreateFlowByTemplateDirectlyReq>({})
+
+    const createTemplate = async () => {
+        try {
+            loading.value = true
+            return await requestCreateFlowByTemplateDirectly({
+                data: {
+                    ...templateFormData,
+                }
+            })
+        } finally {
+            loading.value = false
+        }
+    }
+
+    return {
+        loading,
+        createTemplate,
+        templateFormData
+    }
 }

+ 0 - 1
src/packages/mobile/views/order/list/components/swaporder/history/Index.vue

@@ -91,7 +91,6 @@ const componentMap = new Map<string, unknown>([
 const { loading, pageIndex, pageCount, run } = useRequest(queryHisTradeOrderDetail, {
     manual: true,
     params: {
-        pagesize: 20,
         tradeMode: '46',
     },
     onSuccess: (res) => {

+ 1 - 1
src/packages/pc/views/market/trade/swap/detail/index.vue

@@ -65,7 +65,7 @@ const props = defineProps({
 const emit = defineEmits(['closed'])
 const futuresStore = useFuturesStore()
 const quote = futuresStore.getGoodsQuote(props.goodsId)
-const active = shallowRef(true)
+const active = shallowRef(false)
 const goodsCode = computed(() => quote.value?.goodscode ?? '')
 const goodsId = computed(() => props.selectedRow?.goodsid ?? 0)
 const userStore = useUserStore()

+ 19 - 12
src/packages/tjmd/views/account/certification/Index.vue

@@ -7,7 +7,7 @@
             <CellGroup inset>
                 <Field v-model="formData.username" name="username" label="姓名" placeholder="请输入用户姓名" :rules="formRules.username"
                     :readonly="isReadonly" />
-                <!-- <Field v-model="formData.mobile" name="mobile" readonly label="手机号码" /> -->
+                <Field v-model="formData.mobile" name="mobile" readonly label="手机号码" />
                 <Field name="idCardType" label="证件类型" :rules="formRules.cardtype" is-link>
                     <template #input>
                         <app-select v-model="formData.cardtype" placeholder="请选择证件类型"
@@ -50,7 +50,7 @@ import { fullloading, dialog } from '@/utils/vant';
 import { getFileUrl } from '@/filters';
 import { getAQCertificateTypeList } from "@/constants/account";
 import { useRequest } from '@/hooks/request'
-import { queryUserESignRecord, requestCheckCardNum } from '@/services/api/account';
+import { queryTencentUsereSignRecords, requestCheckCardNum } from '@/services/api/account';
 import { addAuthReq } from '@/business/user/account';
 import { validateRules } from '@/constants/regex';
 import { useComponent } from '@/hooks/component'
@@ -58,6 +58,7 @@ import { useUserStore } from '@/stores'
 import AppSelect from '@mobile/components/base/select/index.vue'
 import AppUploader from '@mobile/components/base/uploader/index.vue'
 import { useNavigation } from '@mobile/router/navigation'
+import { getUserId, getMemberUserId } from '@/services/methods/user'
 
 const componentMap = new Map<string, unknown>([
     ['certification-next', defineAsyncComponent(() => import('./components/certification-next/Index.vue'))], // 爱签-实名认证第二步
@@ -75,17 +76,22 @@ const { componentRef, componentId, openComponent, closeComponent } = useComponen
 const isReadonly = computed(() => userESignRecords.value.some((e) => e.templatetype === 1 && e.recordstatus === 3))
 
 /// 查询记录
-const { loading: buttonLoading, dataList: userESignRecords, run: getUserESignRecord } = useRequest(queryUserESignRecord, {
+const { loading: buttonLoading, dataList: userESignRecords, run: getTencentQianNotice } = useRequest(queryTencentUsereSignRecords, {
+    manual: true,
+    params: {
+        userId: getUserId(),
+        memberUserId: getMemberUserId()
+    },
     onSuccess: (res) => {
         const record = res.data.find((e) => e.templatetype === 1 && e.recordstatus === 3)
         if (record) {
-            const { name, idCard, idCardPhoto, idCardPhotoBackURL, mobile, idCardType } = JSON.parse(record.authinfo || '{}')
-            formData.username = name
-            formData.cardnum = idCard
-            formData.cardbackphotourl = idCardPhoto
-            formData.cardbackphotourl = idCardPhotoBackURL
-            formData.cardtype = idCardType
-            // formData.mobile = mobile
+            const { customername, cardnum, cardfrontphotourl, cardbackphotourl, mobile2, cardtypeid } =  userStore.userInfo
+            formData.username = customername
+            formData.cardnum = cardnum
+            formData.cardbackphotourl = cardfrontphotourl
+            formData.cardbackphotourl = cardbackphotourl
+            formData.cardtype = cardtypeid
+            formData.mobile = mobile2
         }
     },
     onError: (err) => {
@@ -141,12 +147,13 @@ const onCheckCardNum = () => {
     fullloading((hideLoading) => {
         requestCheckCardNum({
             data: {
-                cardnum: formData.idCard
+                cardnum: formData.cardnum
             }
         }).then(() => {
             formSubmit().then(() => {
                 hideLoading()
-                getUserESignRecord()
+                /// 查询电子签合同
+                getTencentQianNotice()
                 dialog('提交请求成功').then(() => {
                     /// 进行下一步
                     openComponent('certification-next')

+ 51 - 83
src/packages/tjmd/views/account/certification/components/certification-next/Index.vue

@@ -6,37 +6,31 @@
             </template>
             <div class="g-form__container">
                 <CellGroup inset>
-                    <Cell title="姓名" :value="formData.name" />
+                    <Cell title="姓名" :value="formData.username" />
                     <Cell title="手机号码" :value="formData.mobile" />
-                    <Cell title="证件类型" :value="getAQCertificateTypeListName(formData.idCardType ?? 1)" />
-                    <Cell title="证件号码" :value="formData.idCard" />
+                    <Cell title="证件类型" :value="getAQCertificateTypeListName(formData.cardtype ?? 1)" />
+                    <Cell title="证件号码" :value="formData.cardnum" />
                     <Cell title="证件正面照片">
                         <template #value>
-                            <Image fit="contain" :src="idCardPhoto" width="100" height="100" />
+                            <Image fit="contain" :src="cardfrontphotourl" width="100" height="100" />
                         </template>
                     </Cell>
                     <Cell title="证件反面照片">
                         <template #value>
-                            <Image fit="contain" :src="idCardPhotoBackURL" width="100" height="100" />
+                            <Image fit="contain" :src="cardbackphotourl" width="100" height="100" />
                         </template>
                     </Cell>
                 </CellGroup>
                 <CellGroup inset>
-                    <template v-for="(item, index) in secondStepList" :key="index">
+                    <template v-for="(item, index) in dataList" :key="index">
                         <Cell :title="item.templatename" :icon="iconName(item.recordstatus)" @click="signer(item)"
                             is-link />
                     </template>
-                    <template v-if="secondStepList.every(e => e.recordstatus === 3)">
-                        <template v-for="(item, index) in thirdStepList" :key="index">
-                            <Cell title="视频认证" :icon="iconName(item.recordstatus)" @click="faceAuth(item.recordstatus)"
-                                :is-link="item.recordstatus !== 3" />
-                        </template>
-                    </template>
                 </CellGroup>
             </div>
             <template #footer>
                 <div class="g-form__footer inset">
-                    <Button type="danger" :disabled="dataList.some((e) => e.recordstatus !== 3)" @click="onSubmit()" round
+                    <Button type="danger" :disabled="dataList.some((e) => e.recordstatus !== 3)" @click="closed(true)" round
                         block>提交认证</Button>
                 </div>
             </template>
@@ -47,31 +41,37 @@
 <script lang="ts" setup>
 import { shallowRef, computed, PropType } from 'vue'
 import { CellGroup, Button, Cell, showFailToast, Image, showToast } from 'vant'
-import { fullloading, dialog } from '@/utils/vant';
+import { fullloading } from '@/utils/vant';
 import { getAQCertificateTypeListName } from "@/constants/account";
 import { useRequest } from '@/hooks/request'
-import { queryUserESignRecord } from '@/services/api/account';
-import { useRequestCreateContractAndAddSigner, useRequestSignCompleted, useRequestWillFace } from '@/business/user/account';
+import { queryTencentUsereSignRecords } from '@/services/api/account';
+import { useRequestCreateFlowByTemplateDirectly } from '@/business/user/account';
 import plus from '@/utils/h5plus'
 import eventBus from '@/services/bus'
 import { getFileUrl } from '@/filters';
 import AppModal from '@/components/base/modal/index.vue'
+import { getUserId, getMemberUserId } from '@/services/methods/user'
+import { useUserStore } from '@/stores'
 
 const showModal = shallowRef(true)
 // 是否刷新父组件数据
 const refresh = shallowRef(false)
-const { createSigner, templateNoFormData } = useRequestCreateContractAndAddSigner()
-/// 意愿视频认证
-const { willFace, willFaceFormData } = useRequestWillFace()
-const { signCompleted } = useRequestSignCompleted()
-
+/// 创建电子签合同
+const { createTemplate, templateFormData } = useRequestCreateFlowByTemplateDirectly()
+/// 电子签合同信息
+const dataList = shallowRef<Model.TencentUsereSignRecordsRsq[]>([])
 /// 查询
-const { run, dataList } = useRequest(queryUserESignRecord)
-
-// 步骤2列表
-const secondStepList = computed(() => dataList.value.filter(obj => obj.templatetype === 2))
-// 步骤3列表
-const thirdStepList = computed(() => dataList.value.filter(obj => obj.templatetype === 3))
+const { run } = useRequest(queryTencentUsereSignRecords, {
+    params: {
+        userId: getUserId(),
+        memberUserId: getMemberUserId()
+    },
+    onSuccess: (res) => {
+        if (res.data.length != 0) {
+            dataList.value = res.data
+        }
+    }
+})
 
 const iconName = (type: number) => {
     switch (type) {
@@ -83,16 +83,16 @@ const iconName = (type: number) => {
 }
 
 // 正面照
-const idCardPhoto = computed(() => {
-    const idCardPhoto = props.formData.idCardPhoto ?? ''
-    const image = idCardPhoto.split(',')[0]
+const cardfrontphotourl = computed(() => {
+    const cardfrontphotourl = props.formData.cardfrontphotourl ?? ''
+    const image = cardfrontphotourl.split(',')[0]
     return getFileUrl(image)
 })
 
 // 背面照
-const idCardPhotoBackURL = computed(() => {
-    const idCardPhotoBackURL = props.formData.idCardPhotoBackURL ?? ''
-    const image = idCardPhotoBackURL.split(',')[0]
+const cardbackphotourl = computed(() => {
+    const cardbackphotourl = props.formData.cardbackphotourl ?? ''
+    const image = cardbackphotourl.split(',')[0]
     return getFileUrl(image)
 })
 
@@ -114,12 +114,12 @@ const openWebview = (url: string) => {
 
 const props = defineProps({
     formData: {
-        type: Object as PropType<Model.AddUserReq>,
+        type: Object as PropType<Model.AddAuthReq>,
         required: true,
     }
 })
 
-const signer = (item: Model.UserESignRecordRsq) => {
+const signer = (item: Model.TencentUsereSignRecordsRsq) => {
     ///  如果是已签署
     if (item.recordstatus === 2) {
         item.signurl ? openWebview(item.signurl) : showFailToast('合同地址错误')
@@ -128,9 +128,23 @@ const signer = (item: Model.UserESignRecordRsq) => {
         item.contractfileaddr ? plus.openURL(fileUrl) : showFailToast('合同地址错误')
     } else {
         fullloading((hideLoading) => {
-            templateNoFormData.templateNo = item.templateno
+            const userinfotype = useUserStore().userInfo.userinfotype
+            templateFormData.userESignRecordID = item.recordid
+            templateFormData.userType = userinfotype
+            /// 个人信息
+            if (userinfotype === 1) {
+                templateFormData.personInfo = {
+                    idCardNumber: props.formData.cardnum,
+                    mobile: props.formData.mobile,
+                    name: props.formData.username
+                }
+            } else {
+                templateFormData.organizationInfo = {
+                    name: props.formData.username
+                }
+            }
             /// 创建合同
-            createSigner().then((res) => {
+            createTemplate().then((res) => {
                 hideLoading()
                 openWebview(res.data.signUrl)
             }).catch((err) => {
@@ -140,52 +154,6 @@ const signer = (item: Model.UserESignRecordRsq) => {
     }
 }
 
-// 视频认证
-const faceAuth = (status: number) => {
-    if (status !== 3) {
-        plus.requestPermissionCamera({
-            onSuccess: () => {
-                plus.requestPermissionRecordAudio({
-                    onSuccess: () => {
-                        /// 进行视频认证
-                        willFaceFormData.idCardNo = props.formData.idCard
-                        willFaceFormData.realName = props.formData.name
-                        /// loading
-                        fullloading((hideLoading) => {
-                            willFace().then((res) => {
-                                hideLoading()
-                                openWebview(res.data.faceUrl)
-                            }).catch((err) => {
-                                hideLoading(err, 'fail')
-                            })
-                        })
-                    },
-                    onError: (err) => {
-                        showFailToast(err)
-                    }
-                })
-            },
-            onError: (err) => {
-                showFailToast(err)
-            }
-        })
-    }
-}
-
-/// 最终提交
-const onSubmit = () => {
-    fullloading((hideLoading) => {
-        signCompleted().then(() => {
-            hideLoading()
-            dialog('实名认证提交请求成功').then(() => {
-                closed(true)
-            })
-        }).catch((err) => {
-            hideLoading(err, 'fail')
-        })
-    })
-}
-
 // 接收窗口页面状态通知
 const documentVisibilityStateNotify = eventBus.$on('DocumentVisibilityStateNotify', (state) => {
     if (state === 'visible') {

+ 15 - 4
src/services/api/account/index.ts

@@ -235,10 +235,21 @@ export function requestCheckCardNum(config: RequestConfig<Model.CheckCardNumReq>
 /**
  * 查询用户电子签记录表
  */
-export function QueryTencentQianNotice(config: RequestConfig<Model.QianNoticeReq> = {}) {
-    return http.goRequest<Model.QianNoticeRsp[]>({
+export function queryTencentUsereSignRecords(config: RequestConfig<Model.TencentUsereSignRecordsReq> = {}) {
+    return http.commonRequest<Model.TencentUsereSignRecordsRsq[]>({
         method: 'get',
-        url: '/Tencent/QianNotice',
+        url: '/Tencent/QueryUsereSignRecords',
         params: config.data,
-    })
+    }, 'QueryUsereSignRecords')
+}
+
+/**
+ * 通过合同名和模板 id 直接发起签署流程
+ */
+export function requestCreateFlowByTemplateDirectly(config: RequestConfig<Model.CreateFlowByTemplateDirectlyReq> = {}) {
+    return http.commonRequest<Model.CreateFlowByTemplateDirectlyRsq>({
+        method: 'post',
+        url: '/Tencent/CreateFlowByTemplateDirectly',
+        data: config.data,
+    }, 'CreateFlowByTemplateDirectly')
 }

+ 1 - 1
src/services/http/index.ts

@@ -132,7 +132,7 @@ export default new (class {
      * @returns 
      */
     async commonRequest<T>(config: AxiosRequestConfig, errMsg?: string) {
-        const baseUrl = service.getConfig('goCommonSearchUrl')
+        const baseUrl = 'http://192.168.30.172:8082/api'//service.getConfig('goCommonSearchUrl')
         config.url = baseUrl + config.url
         const res = await this.request<CommonResult<T>>(config, errMsg)
         switch (res.code) {

+ 9 - 0
src/services/methods/user.ts

@@ -34,4 +34,13 @@ export function getAccountId() {
 export function getMemberUserId() {
     const store = useUserStore()
     return store.memberUserId
+}
+
+/**
+ * 获取账户类型
+ * @returns 
+ */
+export function getUserInfoType() {
+    const store = useUserStore()
+    return store.userInfo.userinfotype
 }

+ 35 - 1
src/types/model/bank.d.ts

@@ -217,7 +217,8 @@ declare namespace Model {
         userid?: number;
         // 半身照
         halfbodyphotourl?: string; 
-        // 手持证件照
+        /// 手机号码
+        mobile?: string
         // 用户类型
         userinfotype?: number; 
     }
@@ -419,4 +420,37 @@ declare namespace Model {
         /// 可用类型 - 1:通用 2:机构专用 3:投资者专用
         usabletype: number
     }
+
+    /// 通过合同名和模板 id 直接发起签署流程 -请求
+    interface CreateFlowByTemplateDirectlyReq {
+        /// 用户类型 1-个人 2-企业
+        userType?: number
+        /// 用户电子签记录表ID
+        userESignRecordID?: number
+        /// 企业信息
+        organizationInfo?: OrganizationInfo
+        /// 个人信息
+        personInfo?: PersonInfo
+    }
+    interface PersonInfo {
+        /// 身份证号码,目前只支持身份证
+        idCardNumber?: string
+        /// 手机号码
+        mobile?: string 
+        /// 姓名
+        name?: string
+    }
+
+    interface OrganizationInfo {
+        /// 企业签署方工商营业执照上的企业名称
+        name?: string
+    }
+
+    /// 通过合同名和模板 id 直接发起签署流程 - 回应
+    interface CreateFlowByTemplateDirectlyRsq {
+        /// 流程编号
+        flowId: string
+        /// 合同签署小程序URL
+        signUrl: string
+    }
 }

+ 2 - 2
src/types/model/user.d.ts

@@ -69,7 +69,7 @@ declare namespace Model {
     }
 
     /** 查询腾讯用户电子签记录 请求 */
-    interface QianNoticeReq {
+    interface TencentUsereSignRecordsReq {
         userId?: number; // 用户ID
         memberUserId?: number; // 所属会员ID
         recordId?: number   // 记录ID
@@ -78,7 +78,7 @@ declare namespace Model {
     }
 
     /** 查询腾讯用户电子签记录 响应 */
-    interface QianNoticeRsp {
+    interface TencentUsereSignRecordsRsq {
         // 认证信息
         authinfo: string
         // 合同签署文件地址