|
@@ -1,50 +1,81 @@
|
|
|
<template>
|
|
|
<div class="flex flex-col h-full">
|
|
|
<div class="bg-white info flex-1 overflow-y-auto cellnormall">
|
|
|
- <van-cell title="合同编号" :value="info.number" />
|
|
|
- <van-cell title="合同名称" :value="info.name" />
|
|
|
- <van-cell title="合同金额" :value="info.amounts">
|
|
|
+ <van-cell title="合同编号" :value="infoData.number" />
|
|
|
+ <van-cell title="合同名称" :value="infoData.name" />
|
|
|
+ <van-cell title="合同金额" :value="infoData.amounts">
|
|
|
<template #default>
|
|
|
- <span class="text-[#FF8B32]" v-if="info.amounts">¥ {{ info.amounts }}</span>
|
|
|
+ <span class="text-[#FF8B32]" v-if="infoData.amounts">¥ {{ infoData.amounts }}</span>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
- <van-cell title="已回款金额" :value="info.payment">
|
|
|
+ <van-cell title="已回款金额" :value="infoData.payment">
|
|
|
<template #default>
|
|
|
- <span class="text-[#FF8B32]" v-if="info.payment">¥ {{ info.payment }}</span>
|
|
|
+ <span class="text-[#FF8B32]" v-if="infoData.payment">¥ {{ infoData.payment }}</span>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
- <van-cell title="已回款进度" :value="info.payment">
|
|
|
+ <van-cell title="已回款进度" :value="infoData.payment">
|
|
|
<template #default>
|
|
|
- {{ info.payment ? (100 * info.payment / info.amounts).toFixed(1) + '%' : '0%' }}
|
|
|
+ {{ infoData.payment ? (100 * infoData.payment / infoData.amounts).toFixed(1) + '%' : '0%' }}
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
- <van-cell title="下笔回款日期" :value="info.nextPaymentDate">
|
|
|
+ <van-cell title="下笔回款日期" :value="infoData.nextPaymentDate">
|
|
|
<template #default>
|
|
|
- {{ info.nextPaymentDate ? info.nextPaymentDate : '-' }}
|
|
|
+ {{ infoData.nextPaymentDate ? infoData.nextPaymentDate : '-' }}
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
- <van-cell title="下笔回款金额" :value="info.payment">
|
|
|
+ <van-cell title="下笔回款金额" :value="infoData.payment">
|
|
|
<template #default>
|
|
|
- <span class="text-[#FF8B32]" v-if="info.payment">¥ {{ info.payment.toFixed(2) }}</span>
|
|
|
+ <span class="text-[#FF8B32]" v-if="infoData.payment">¥ {{ infoData.payment.toFixed(2) }}</span>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
- <van-cell title="合同类型" :value="info.typeName" />
|
|
|
- <van-cell title="状态" :value="info.status">
|
|
|
+ <van-cell title="合同类型" :value="infoData.typeName" />
|
|
|
+ <van-cell title="状态" :value="infoData.status">
|
|
|
<template #default>
|
|
|
- <span :style="fixedFieldStatusArray[info.status].color">
|
|
|
- {{ fixedFieldStatusArray[info.status].label }}
|
|
|
+ <span :style="fixedFieldStatusArray[infoData.status].color">
|
|
|
+ {{ fixedFieldStatusArray[infoData.status].label }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
</div>
|
|
|
+ <div class="bottomButton">
|
|
|
+ <template v-if="infoData.status == 1">
|
|
|
+ <van-button type="success" class="w-full block" @click="adoptOperation">通过合同</van-button>
|
|
|
+ <van-button type="danger" class="w-full block" @click="rejectOperation">驳回合同</van-button>
|
|
|
+ </template>
|
|
|
+ <van-button type="default" class="w-full block" v-permission="[routingInformation.jurisdiction.edit]"
|
|
|
+ @click="jumpEdit()">编辑合同</van-button>
|
|
|
+ <van-button type="danger" class="w-full block" v-permission="[routingInformation.jurisdiction.delete]"
|
|
|
+ @click="deleteRow()">删除合同</van-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 驳回弹窗 -->
|
|
|
+ <van-dialog v-model:show="showDialog" :title="`转移线索`" show-cancel-button @confirm="confirmTransfer"
|
|
|
+ :before-close="dialogCloseBefo">
|
|
|
+ <template #default>
|
|
|
+ <van-field v-model.trim="dialogSelection" type="textarea" rows="3" label="驳回原因" placeholder="请输入驳回原因" />
|
|
|
+ </template>
|
|
|
+ </van-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref } from 'vue';
|
|
|
+import { ref, watch } from 'vue';
|
|
|
+import requests from "@common/requests";
|
|
|
+import { showConfirmDialog } from 'vant';
|
|
|
import { useLifecycle } from '@hooks/useCommon.js';
|
|
|
import { fixedFieldStatusArray } from '@/utility/defaultData.js';
|
|
|
+import { CONTRACT_APPROVED } from '@hooks/useApi'
|
|
|
+import useShowToast from '@hooks/useToast'
|
|
|
+import useInfoStore from '@store/useInfoStore'
|
|
|
+import useRouterStore from "@store/useRouterStore.js";
|
|
|
+import { routingInfos } from "@utility/generalVariables"
|
|
|
+import { resetListData, getListFieldKey } from '@components/common/formForm/formCorrespondenceProcessing'
|
|
|
+import useFixedData from "@store/useFixedData.js"
|
|
|
|
|
|
+const fixedData = useFixedData()
|
|
|
+const router = useRouterStore()
|
|
|
+const userInfo = useInfoStore()
|
|
|
+const { toastSuccess, toastFail, toastText } = useShowToast()
|
|
|
const props = defineProps({
|
|
|
info: {
|
|
|
type: Object,
|
|
@@ -53,9 +84,123 @@ const props = defineProps({
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+const routingInformation = routingInfos['contract']
|
|
|
+const showDialog = ref(false);
|
|
|
+const showSelect = ref(false);
|
|
|
+const dialogSelection = ref({});
|
|
|
+
|
|
|
+watch(() => props.info, (newValue) => {
|
|
|
+ processingData(newValue.id)
|
|
|
+})
|
|
|
+
|
|
|
+const infoData = ref(props.info);
|
|
|
+const timeout = ref(null);
|
|
|
+
|
|
|
+function adoptOperation() {
|
|
|
+ const { name = '', id } = infoData.value
|
|
|
+ showConfirmDialog({
|
|
|
+ title: `合同通过`,
|
|
|
+ message: `确认审核通过吗?,通过后合同基本信息无法修改`,
|
|
|
+ }).then(() => {
|
|
|
+ requests.post(CONTRACT_APPROVED, { id, status: 0 }).then((res) => {
|
|
|
+ toastSuccess('操作成功')
|
|
|
+ processingData(id)
|
|
|
+ }).catch((err) => {
|
|
|
+ toastFail(err.msg ? err.msg : '操作失败')
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function rejectOperation() {
|
|
|
+ dialogSelection.value = ''
|
|
|
+ showDialog.value = true
|
|
|
+}
|
|
|
+
|
|
|
+function confirmTransfer() {
|
|
|
+ const { name = '', id } = infoData.value
|
|
|
+ if (!dialogSelection.value) {
|
|
|
+ return toastText('请输入驳回原因')
|
|
|
+ }
|
|
|
+
|
|
|
+ showConfirmDialog({
|
|
|
+ title: `合同驳回`,
|
|
|
+ message: `确认驳回吗?,驳回后合同基本信息无法修改`,
|
|
|
+ }).then(() => {
|
|
|
+ requests.post(CONTRACT_APPROVED, { id, status: 0, msg: dialogSelection.value }).then((res) => {
|
|
|
+ toastSuccess('操作成功')
|
|
|
+ showDialog.value = false
|
|
|
+ processingData(id)
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function dialogCloseBefo(val) {
|
|
|
+ if (val == 'confirm' && showDialog.value) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ return true
|
|
|
+}
|
|
|
+
|
|
|
+function deleteRow() {
|
|
|
+ const { name = '', searchFiled = {}, deteleFiled = '' } = routingInformation
|
|
|
+ const row = props.info
|
|
|
+ const foemVal = { [routingInformation.key == 'tasks' ? 'taskIds' : 'ids']: row.id }
|
|
|
+ showConfirmDialog({
|
|
|
+ title: `删除${name}`,
|
|
|
+ message: `确定删除【${row[searchFiled?.search]}】${name}吗?`,
|
|
|
+ }).then(() => {
|
|
|
+ requests.post(deteleFiled, { ...foemVal }).then((res) => {
|
|
|
+ toastSuccess('删除成功')
|
|
|
+ router.navigateBack({
|
|
|
+ success: () => {
|
|
|
+ router.emit('moduleListDetailParameter', {
|
|
|
+ row: JSON.stringify(routingInformation)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch((err) => {
|
|
|
+ toastFail(err.msg ? err.msg : '删除失败')
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function jumpEdit() {
|
|
|
+ const formJson = fixedData.formJson[routingInformation.key] || []
|
|
|
+ const formList = resetListData(formJson?.list)
|
|
|
+ const filedObj = getListFieldKey(formList, props.info)
|
|
|
+ const formVal = { ...filedObj, id: props.info.id }
|
|
|
+
|
|
|
+ router.navigateTo({
|
|
|
+ pathName: 'addEditor',
|
|
|
+ success: () => {
|
|
|
+ router.emit('addEditorParameter', {
|
|
|
+ routerInfo: JSON.stringify(routingInformation),
|
|
|
+ filedValue: JSON.stringify(formVal)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function getDetails(id) {
|
|
|
+ // 获取合同详情
|
|
|
+}
|
|
|
+function processingData(id) {
|
|
|
+ clearTimeout(timeout.value);
|
|
|
+ timeout.value = setTimeout(() => {
|
|
|
+ getDetails(id)
|
|
|
+ }, 100);
|
|
|
+}
|
|
|
+
|
|
|
useLifecycle({
|
|
|
+ init: () => {
|
|
|
+ processingData(props.info.id)
|
|
|
+ },
|
|
|
load: () => {
|
|
|
- // 添加加载逻辑
|
|
|
+ processingData(props.info.id)
|
|
|
+ },
|
|
|
+ unload: () => {
|
|
|
+ clearTimeout(timeout.value)
|
|
|
}
|
|
|
});
|
|
|
</script>
|