|
|
@@ -17,59 +17,50 @@
|
|
|
</template>
|
|
|
</CellGroup>
|
|
|
</div>
|
|
|
+ <template #footer>
|
|
|
+ <div class="g-form__footer inset">
|
|
|
+ <Button type="danger" @click="onClose()" round block>完成合同签署</Button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</app-view>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import { shallowRef } from 'vue'
|
|
|
-import { CellGroup, Cell, showFailToast, showToast } from 'vant'
|
|
|
+import { CellGroup, Cell, showFailToast, showToast, Button } from 'vant'
|
|
|
import { fullloading } from '@/utils/vant';
|
|
|
import { useNavigation } from '@mobile/router/navigation'
|
|
|
import { useRequest } from '@/hooks/request'
|
|
|
-import { queryTencentUsereSignRecords, requestInitTencentESS } from '@/services/api/account';
|
|
|
-import { useRequestCreateFlowByTemplateDirectly } from '@/business/user/account';
|
|
|
+import { queryUsereSignRecords } from '@/services/api/account';
|
|
|
+import { useRequestCreateContract } from '@/business/user/account';
|
|
|
import plus from '@/utils/h5plus'
|
|
|
import { getUserId } from '@/services/methods/user'
|
|
|
import { useUserStore } from '@/stores'
|
|
|
import { decryptAES } from '@/services/websocket/package/crypto'
|
|
|
+import eventBus from '@/services/bus'
|
|
|
|
|
|
-const { getQueryStringToNumber } = useNavigation()
|
|
|
+const { getQueryStringToNumber, router } = useNavigation()
|
|
|
/// 所属机构
|
|
|
const memberUserId = getQueryStringToNumber('memberUserId')
|
|
|
/// userStore
|
|
|
const userStore = useUserStore()
|
|
|
/// 创建电子签合同
|
|
|
-const { createTemplate, templateFormData } = useRequestCreateFlowByTemplateDirectly()
|
|
|
+const { createTemplate, createFormData } = useRequestCreateContract()
|
|
|
/// 电子签合同信息
|
|
|
const dataList = shallowRef<Model.TencentUsereSignRecordsRsq[]>([])
|
|
|
/// 用户信息
|
|
|
const { customername, cardnum, mobile2 } = userStore.userInfo
|
|
|
/// 查询
|
|
|
-const { run } = useRequest(queryTencentUsereSignRecords, {
|
|
|
+const { run } = useRequest(queryUsereSignRecords, {
|
|
|
params: {
|
|
|
userId: getUserId(),
|
|
|
- memberUserId: memberUserId
|
|
|
+ memberUserId: memberUserId,
|
|
|
+ templatetype: 2
|
|
|
},
|
|
|
onSuccess: (res) => {
|
|
|
if (res.data != null && res.data.length != 0) {
|
|
|
dataList.value = res.data
|
|
|
- } else {
|
|
|
- /// 创建电子签合同
|
|
|
- initTencentESS()
|
|
|
- }
|
|
|
- }
|
|
|
-})
|
|
|
-
|
|
|
-/// 创建电子签合同
|
|
|
-const { run: initTencentESS } = useRequest(requestInitTencentESS, {
|
|
|
- manual: true,
|
|
|
- params: {
|
|
|
- userId: getUserId(),
|
|
|
- memberUserId: memberUserId
|
|
|
- },
|
|
|
- onSuccess: () => {
|
|
|
- /// 重新请求
|
|
|
- run()
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
|
|
|
@@ -98,29 +89,13 @@ const openWebview = (url: string) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const signer = (item: Model.TencentUsereSignRecordsRsq) => {
|
|
|
+const signer = (item: Model.UsereSignRecordsRsq) => {
|
|
|
/// 如果是已签署
|
|
|
- if (item.recordstatus === 2) {
|
|
|
+ if ([2, 3].includes(item.recordstatus)) {
|
|
|
item.signurl ? openWebview(item.signurl) : showFailToast('合同地址错误')
|
|
|
- } else if (item.recordstatus === 3) {
|
|
|
- showFailToast('合同已签署,请前往腾讯电子签小程序查看!')
|
|
|
} else {
|
|
|
fullloading((hideLoading) => {
|
|
|
- const userinfotype = useUserStore().userInfo.userinfotype
|
|
|
- templateFormData.userESignRecordID = item.recordid
|
|
|
- templateFormData.userType = userinfotype
|
|
|
- /// 个人信息
|
|
|
- if (userinfotype === 1) {
|
|
|
- templateFormData.personInfo = {
|
|
|
- idCardNumber: decryptAES(cardnum),
|
|
|
- mobile: mobile2,
|
|
|
- name: customername
|
|
|
- }
|
|
|
- } else {
|
|
|
- templateFormData.organizationInfo = {
|
|
|
- name: customername
|
|
|
- }
|
|
|
- }
|
|
|
+ createFormData.recordId = item.recordid
|
|
|
/// 创建合同
|
|
|
createTemplate().then((res) => {
|
|
|
hideLoading()
|
|
|
@@ -132,4 +107,16 @@ const signer = (item: Model.TencentUsereSignRecordsRsq) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 接收窗口页面状态通知
|
|
|
+const documentVisibilityStateNotify = eventBus.$on('DocumentVisibilityStateNotify', (state) => {
|
|
|
+ if (state === 'visible') {
|
|
|
+ run()
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+const onClose = () => {
|
|
|
+ router.back()
|
|
|
+ documentVisibilityStateNotify.cancel()
|
|
|
+}
|
|
|
+
|
|
|
</script>
|