|
@@ -19,7 +19,8 @@
|
|
|
<van-cell title="备注" :value="info.remark" />
|
|
|
</div>
|
|
|
<div class="bottomButton">
|
|
|
- <van-button type="primary" class="w-full block">关联联系人</van-button>
|
|
|
+ <van-button type="primary" class="w-full block" v-if="!info.contactsName"
|
|
|
+ @click="shoContactDialag()">关联联系人</van-button>
|
|
|
<van-button type="warning" class="w-full block" v-if="info.inchargerName"
|
|
|
@click="showDialogCli()">转移商机</van-button>
|
|
|
<van-button type="primary" class="w-full block" v-if="!info.inchargerName"
|
|
@@ -37,17 +38,30 @@
|
|
|
<div class="themeTextColor text-size-small pl-4 pt-2 pb-2">转移后,将看不到此商机了</div>
|
|
|
</van-dialog>
|
|
|
|
|
|
+ <van-dialog v-model:show="showContactDialog" :title="`关联联系人`" show-cancel-button @confirm="relatedContacts"
|
|
|
+ :before-close="dialogCloseBefo">
|
|
|
+ <van-cell title="联系人" is-link @click="showContactSelect = true">
|
|
|
+ <template #value>
|
|
|
+ {{ dialogSelection.label }}
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
+ </van-dialog>
|
|
|
+
|
|
|
<!-- select 选择器 -->
|
|
|
<van-popup v-model:show="showSelect" destroy-on-close position="bottom" :style="{ height: '80%' }">
|
|
|
<PullDownSelector @change="selectChange" />
|
|
|
</van-popup>
|
|
|
+
|
|
|
+ <van-popup v-model:show="showContactSelect" destroy-on-close position="bottom" :style="{ height: '80%' }">
|
|
|
+ <PullDownSelector :options="allContactsList" :doYouNeedTranslation="false" @change="selectChange" />
|
|
|
+ </van-popup>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { ref } from 'vue';
|
|
|
import { useLifecycle } from '@hooks/useCommon.js';
|
|
|
-import { BUSINESS_OPPORTUNITY_TRANSFER } from '@hooks/useApi'
|
|
|
+import { BUSINESS_OPPORTUNITY_TRANSFER, GET_CONTACTS_WITH_MORE_I_DS, CONTACT_PERSON_ASSOCIATED_WITH_BUSINESS_OPPORTUNITY } from '@hooks/useApi'
|
|
|
import requests from "@common/requests";
|
|
|
import useShowToast from '@hooks/useToast'
|
|
|
import useInfoStore from '@store/useInfoStore'
|
|
@@ -64,7 +78,30 @@ const props = defineProps({
|
|
|
|
|
|
const showDialog = ref(false);
|
|
|
const showSelect = ref(false);
|
|
|
+const showContactSelect = ref(false);
|
|
|
+const showContactDialog = ref(false)
|
|
|
const dialogSelection = ref({});
|
|
|
+const allContactsList = ref([]);
|
|
|
+
|
|
|
+function shoContactDialag() {
|
|
|
+ dialogSelection.value = {}
|
|
|
+ showContactDialog.value = true
|
|
|
+}
|
|
|
+
|
|
|
+function relatedContacts() {
|
|
|
+ if (!dialogSelection.value.label) {
|
|
|
+ return toastText('请选择要关联的联系人')
|
|
|
+ }
|
|
|
+
|
|
|
+ requests.post(CONTACT_PERSON_ASSOCIATED_WITH_BUSINESS_OPPORTUNITY, {
|
|
|
+ id: props.info.id,
|
|
|
+ contactsId: dialogSelection.value.value
|
|
|
+ }).then((res) => {
|
|
|
+ props.info.contactsName = dialogSelection.value.label
|
|
|
+ showContactDialog.value = false
|
|
|
+ toastSuccess('关联成功')
|
|
|
+ })
|
|
|
+}
|
|
|
|
|
|
function confirmTransfer() {
|
|
|
if (!dialogSelection.value.label) {
|
|
@@ -98,9 +135,11 @@ function selectChange(value, label) {
|
|
|
value, label
|
|
|
}
|
|
|
showSelect.value = false
|
|
|
+ showContactSelect.value = false
|
|
|
}
|
|
|
|
|
|
function showDialogCli() {
|
|
|
+ dialogSelection.value = {}
|
|
|
showDialog.value = true
|
|
|
}
|
|
|
|
|
@@ -112,9 +151,27 @@ function dialogCloseBefo(val) {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
+function getAllContactsList() {
|
|
|
+ requests.get(`${GET_CONTACTS_WITH_MORE_I_DS}?customerId=${props.info.customerId}`).then(({ data = [] }) => {
|
|
|
+ let list = data.map(item => {
|
|
|
+ return {
|
|
|
+ label: item.name,
|
|
|
+ value: item.id,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (!list.length) {
|
|
|
+ list = [{}]
|
|
|
+ }
|
|
|
+ allContactsList.value = list
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
useLifecycle({
|
|
|
load: () => {
|
|
|
- // 添加加载逻辑
|
|
|
+ getAllContactsList()
|
|
|
+ },
|
|
|
+ init: () => {
|
|
|
+ getAllContactsList()
|
|
|
}
|
|
|
});
|
|
|
</script>
|