threadInfo.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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.clueName" />
  5. <van-cell title="线索来源" :value="info.clueSourceValue" />
  6. <van-cell title="电话号码" :value="info.phone" />
  7. <van-cell title="邮箱" :value="info.email" />
  8. <van-cell title="客户行业" :value="info.customerIndustryValue" />
  9. <van-cell title="客户级别" :value="info.customerLevelValue" />
  10. <van-cell title="客户地址" :value="info.address" />
  11. <van-cell title="负责人">
  12. <template #default>
  13. <TranslationComponent :openId="info.inchargerName" />
  14. </template>
  15. </van-cell>
  16. <van-cell title="备注" :value="info.remark" />
  17. </div>
  18. <div class="bottomButton">
  19. <van-button type="warning" class="w-full block" v-if="info.inchargerName" @click="showDialogCli()">转移线索</van-button>
  20. <van-button type="primary" class="w-full block" v-if="!info.inchargerName" @click="claimAndClaim()">认领线索</van-button>
  21. </div>
  22. <!-- 转移弹窗 -->
  23. <van-dialog v-model:show="showDialog" :title="`转移线索`" show-cancel-button
  24. @confirm="confirmTransfer" :before-close="dialogCloseBefo">
  25. <van-cell title="转移至" is-link @click="showSelect = true">
  26. <template #value>
  27. {{ dialogSelection.label }}
  28. </template>
  29. </van-cell>
  30. <div class="themeTextColor text-size-small pl-4 pt-2 pb-2">转移后,将看不到此线索了</div>
  31. </van-dialog>
  32. <!-- select 选择器 -->
  33. <van-popup v-model:show="showSelect" destroy-on-close position="bottom" :style="{ height: '80%' }">
  34. <PullDownSelector @change="selectChange" />
  35. </van-popup>
  36. </div>
  37. </template>
  38. <script setup>
  39. import { ref } from 'vue';
  40. import { showConfirmDialog } from 'vant';
  41. import { useLifecycle } from '@hooks/useCommon.js';
  42. import { TRANSFER_CLUES } from '@hooks/useApi'
  43. import requests from "@common/requests";
  44. import useShowToast from '@hooks/useToast'
  45. import useInfoStore from '@store/useInfoStore'
  46. import useRouterStore from "@store/useRouterStore.js";
  47. const router = useRouterStore()
  48. const userInfo = useInfoStore()
  49. const { toastSuccess, toastFail, toastText } = useShowToast()
  50. const props = defineProps({
  51. info: {
  52. type: Object,
  53. required: true,
  54. default: () => ({})
  55. }
  56. })
  57. const showDialog = ref(false);
  58. const showSelect = ref(false);
  59. const dialogSelection = ref({});
  60. function listReloadData() {
  61. router.navigateBack({
  62. success: () => {
  63. router.eventEmit('moduleListRefreshData', {})
  64. }
  65. })
  66. }
  67. function confirmTransfer() {
  68. if(!dialogSelection.value.label) {
  69. return toastText('请选择要转移的人员')
  70. }
  71. requests.post(TRANSFER_CLUES, { ids: props.info.id, inchargerId: dialogSelection.value.value }).then((res) => {
  72. toastSuccess('转移成功')
  73. showDialog.value = false
  74. setTimeout(() => {
  75. listReloadData()
  76. }, 2000)
  77. })
  78. }
  79. function claimAndClaim() {
  80. showConfirmDialog({
  81. title: '认领线索',
  82. message: `确定认领【${props.info.clueName}】线索吗?`,
  83. }).then(() => {
  84. requests.post(TRANSFER_CLUES, { ids: props.info.id, inchargerId: userInfo.userInfo.id }).then((res) => {
  85. toastSuccess('认领成功')
  86. listReloadData()
  87. props.info.inchargerName = userInfo.userInfo.clueName
  88. showDialog.value = false
  89. })
  90. })
  91. }
  92. function selectChange(value, label) {
  93. dialogSelection.value = {
  94. value, label
  95. }
  96. showSelect.value = false
  97. }
  98. function showDialogCli() {
  99. showDialog.value = true
  100. }
  101. function dialogCloseBefo(val) {
  102. if(val == 'confirm' && showDialog.value) {
  103. return false
  104. }
  105. return true
  106. }
  107. useLifecycle({
  108. load: () => {
  109. // 添加加载逻辑
  110. }
  111. });
  112. </script>
  113. <style lang='scss' scoped>
  114. .bottomButton {
  115. margin: 0 14px;
  116. padding-bottom: 30px;
  117. :deep(.van-button) {
  118. margin-bottom: 20px;
  119. }
  120. }
  121. .info {
  122. margin: 8px 14px 30px 14px;
  123. padding: 14px;
  124. }
  125. </style>