businessInfo.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <div class="flex flex-col h-full">
  3. <div class="bg-white info flex-1 overflow-y-auto cellnormall">
  4. <van-cell title="商机名称" :value="info.name" />
  5. <van-cell title="客户名称" :value="info.customerName" />
  6. <van-cell title="联系人姓名" :value="info.contactsName" />
  7. <van-cell title="商机金额">
  8. <template #default>
  9. <span class="text-[#FF8B32]" v-if="info.amountOfMoney">¥ {{ info.amountOfMoney }}</span>
  10. </template>
  11. </van-cell>
  12. <van-cell title="预计成交" :value="info.expectedTransactionDate" />
  13. <van-cell title="商机阶段" :value="info.stageValue" />
  14. <van-cell title="负责人">
  15. <template #default>
  16. <TranslationComponent :openId="info.inchargerName" />
  17. </template>
  18. </van-cell>
  19. <van-cell title="备注" :value="info.remark" />
  20. </div>
  21. <div class="bottomButton">
  22. <van-button type="primary" class="w-full block">关联联系人</van-button>
  23. <van-button type="warning" class="w-full block" v-if="info.inchargerName"
  24. @click="showDialogCli()">转移商机</van-button>
  25. <van-button type="primary" class="w-full block" v-if="!info.inchargerName"
  26. @click="claimAndClaim()">认领商机</van-button>
  27. </div>
  28. <!-- 转移弹窗 -->
  29. <van-dialog v-model:show="showDialog" :title="`转移商机`" show-cancel-button @confirm="confirmTransfer"
  30. :before-close="dialogCloseBefo">
  31. <van-cell title="转移至" is-link @click="showSelect = true">
  32. <template #value>
  33. {{ dialogSelection.label }}
  34. </template>
  35. </van-cell>
  36. <div class="themeTextColor text-size-small pl-4 pt-2 pb-2">转移后,将看不到此商机了</div>
  37. </van-dialog>
  38. <!-- select 选择器 -->
  39. <van-popup v-model:show="showSelect" destroy-on-close position="bottom" :style="{ height: '80%' }">
  40. <PullDownSelector @change="selectChange" />
  41. </van-popup>
  42. </div>
  43. </template>
  44. <script setup>
  45. import { ref } from 'vue';
  46. import { useLifecycle } from '@hooks/useCommon.js';
  47. import { BUSINESS_OPPORTUNITY_TRANSFER } from '@hooks/useApi'
  48. import requests from "@common/requests";
  49. import useShowToast from '@hooks/useToast'
  50. import useInfoStore from '@store/useInfoStore'
  51. const userInfo = useInfoStore()
  52. const { toastSuccess, toastFail, toastText } = useShowToast()
  53. const props = defineProps({
  54. info: {
  55. type: Object,
  56. required: true,
  57. default: () => ({})
  58. }
  59. })
  60. const showDialog = ref(false);
  61. const showSelect = ref(false);
  62. const dialogSelection = ref({});
  63. function confirmTransfer() {
  64. if (!dialogSelection.value.label) {
  65. return toastText('请选择要转移的人员')
  66. }
  67. requests.post(BUSINESS_OPPORTUNITY_TRANSFER, { ids: props.info.id, inchargerId: dialogSelection.value.value }).then((res) => {
  68. toastSuccess('转移成功')
  69. showDialog.value = false
  70. setTimeout(() => {
  71. history.back()
  72. }, 2000)
  73. })
  74. }
  75. function claimAndClaim() {
  76. showConfirmDialog({
  77. title: '认领商机',
  78. message: `确定认领【${props.info.name}】商机吗?`,
  79. }).then(() => {
  80. requests.post(BUSINESS_OPPORTUNITY_TRANSFER, { ids: props.info.id, inchargerId: userInfo.userInfo.id }).then((res) => {
  81. toastSuccess('认领成功')
  82. props.info.inchargerName = userInfo.userInfo.name
  83. showDialog.value = false
  84. })
  85. })
  86. }
  87. function selectChange(value, label) {
  88. dialogSelection.value = {
  89. value, label
  90. }
  91. showSelect.value = false
  92. }
  93. function showDialogCli() {
  94. showDialog.value = true
  95. }
  96. function dialogCloseBefo(val) {
  97. if (val == 'confirm' && showDialog.value) {
  98. return false
  99. }
  100. return true
  101. }
  102. useLifecycle({
  103. load: () => {
  104. // 添加加载逻辑
  105. }
  106. });
  107. </script>
  108. <style lang='scss' scoped>
  109. .bottomButton {
  110. margin: 0 14px;
  111. padding-bottom: 30px;
  112. :deep(.van-button) {
  113. margin-bottom: 20px;
  114. }
  115. }
  116. .info {
  117. margin: 8px 14px 30px 14px;
  118. padding: 14px;
  119. }
  120. </style>