|
@@ -1,30 +1,32 @@
|
|
|
<template>
|
|
|
<div class="flex flex-col h-full">
|
|
|
<div class="bg-white info flex-1 overflow-y-auto cellnormall">
|
|
|
- <van-cell title="商机名称" :value="info.name" />
|
|
|
- <van-cell title="客户名称" :value="info.customerName" />
|
|
|
- <van-cell title="联系人姓名" :value="info.contactsName" />
|
|
|
+ <van-cell title="商机名称" :value="infoData.name" />
|
|
|
+ <van-cell title="客户名称" :value="infoData.customerName" />
|
|
|
+ <van-cell title="联系人姓名" :value="infoData.contactsName" />
|
|
|
<van-cell title="商机金额">
|
|
|
<template #default>
|
|
|
- <span class="text-[#FF8B32]" v-if="info.amountOfMoney">¥ {{ info.amountOfMoney }}</span>
|
|
|
+ <span class="text-[#FF8B32]" v-if="infoData.amountOfMoney">¥ {{ infoData.amountOfMoney }}</span>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
- <van-cell title="预计成交" :value="info.expectedTransactionDate" />
|
|
|
- <van-cell title="商机阶段" :value="info.stageValue" />
|
|
|
+ <van-cell title="预计成交" :value="infoData.expectedTransactionDate" />
|
|
|
+ <van-cell title="商机阶段" :value="infoData.stageValue" />
|
|
|
<van-cell title="负责人">
|
|
|
<template #default>
|
|
|
- <TranslationComponent :openId="info.inchargerName" />
|
|
|
+ <TranslationComponent :openId="infoData.inchargerName" />
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
- <van-cell title="备注" :value="info.remark" />
|
|
|
+ <van-cell title="备注" :value="infoData.remark" />
|
|
|
</div>
|
|
|
<div class="bottomButton">
|
|
|
- <van-button type="primary" class="w-full block" v-if="!info.contactsName"
|
|
|
+ <van-button type="primary" class="w-full block" v-if="!infoData.contactsName"
|
|
|
@click="shoContactDialag()">关联联系人</van-button>
|
|
|
- <van-button type="warning" class="w-full block" v-if="info.inchargerName"
|
|
|
+ <van-button type="warning" class="w-full block" v-if="infoData.inchargerName"
|
|
|
@click="showDialogCli()">转移商机</van-button>
|
|
|
- <van-button type="primary" class="w-full block" v-if="!info.inchargerName"
|
|
|
+ <van-button type="primary" class="w-full block" v-if="!infoData.inchargerName"
|
|
|
@click="claimAndClaim()">认领商机</van-button>
|
|
|
+ <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="deleteBusinessOpportunity()">删除商机</van-button>
|
|
|
</div>
|
|
|
|
|
|
<!-- 转移弹窗 -->
|
|
@@ -59,16 +61,20 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref } from 'vue';
|
|
|
+import { ref, watch } from 'vue';
|
|
|
import { showConfirmDialog } from 'vant';
|
|
|
import { useLifecycle } from '@hooks/useCommon.js';
|
|
|
import { BUSINESS_OPPORTUNITY_TRANSFER, GET_CONTACTS_WITH_MORE_I_DS, CONTACT_PERSON_ASSOCIATED_WITH_BUSINESS_OPPORTUNITY } from '@hooks/useApi'
|
|
|
+import { resetListData, getListFieldKey } from '@components/common/formForm/formCorrespondenceProcessing'
|
|
|
import requests from "@common/requests";
|
|
|
import useShowToast from '@hooks/useToast'
|
|
|
import useInfoStore from '@store/useInfoStore'
|
|
|
+import useFixedData from "@store/useFixedData.js"
|
|
|
import useRouterStore from "@store/useRouterStore.js";
|
|
|
-const router = useRouterStore()
|
|
|
+import { routingInfos } from "@utility/generalVariables"
|
|
|
|
|
|
+const router = useRouterStore()
|
|
|
+const fixedData = useFixedData()
|
|
|
const userInfo = useInfoStore()
|
|
|
const { toastSuccess, toastFail, toastText } = useShowToast()
|
|
|
const props = defineProps({
|
|
@@ -78,6 +84,13 @@ const props = defineProps({
|
|
|
default: () => ({})
|
|
|
}
|
|
|
})
|
|
|
+const infoData = ref(props.info)
|
|
|
+const routingInformation = routingInfos['business']
|
|
|
+
|
|
|
+watch(() => props.info, (newValue) => {
|
|
|
+ infoData.value = newValue
|
|
|
+ getAllContactsList()
|
|
|
+})
|
|
|
|
|
|
const showDialog = ref(false);
|
|
|
const showSelect = ref(false);
|
|
@@ -86,6 +99,40 @@ const showContactDialog = ref(false)
|
|
|
const dialogSelection = ref({});
|
|
|
const allContactsList = ref([]);
|
|
|
|
|
|
+function deleteBusinessOpportunity() {
|
|
|
+ const { name = '', searchFiled = {}, deteleFiled = '' } = routingInformation
|
|
|
+ const row = infoData.value
|
|
|
+ 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()
|
|
|
+ }).catch((err) => {
|
|
|
+ toastFail(err.msg ? err.msg : '删除失败')
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+function jumpEdit() {
|
|
|
+ const formJson = fixedData.formJson[routingInformation.key] || []
|
|
|
+ const formList = resetListData(formJson?.list)
|
|
|
+ const filedObj = getListFieldKey(formList, infoData.value)
|
|
|
+ const formVal = { ...filedObj, id: infoData.value.id }
|
|
|
+
|
|
|
+ router.navigateTo({
|
|
|
+ pathName: 'addEditor',
|
|
|
+ success: () => {
|
|
|
+ router.emit('addEditorParameter', {
|
|
|
+ routerInfo: JSON.stringify(routingInformation),
|
|
|
+ filedValue: JSON.stringify(formVal)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
function shoContactDialag() {
|
|
|
dialogSelection.value = {}
|
|
|
showContactDialog.value = true
|