threadInfo.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 { useLifecycle } from '@hooks/useCommon.js';
  41. import { TRANSFER_CLUES } from '@hooks/useApi'
  42. import requests from "@common/requests";
  43. import useShowToast from '@hooks/useToast'
  44. import useInfoStore from '@store/useInfoStore'
  45. const userInfo = useInfoStore()
  46. const { toastSuccess, toastFail, toastText } = useShowToast()
  47. const props = defineProps({
  48. info: {
  49. type: Object,
  50. required: true,
  51. default: () => ({})
  52. }
  53. })
  54. const showDialog = ref(false);
  55. const showSelect = ref(false);
  56. const dialogSelection = ref({});
  57. function confirmTransfer() {
  58. if(!dialogSelection.value.label) {
  59. return toastText('请选择要转移的人员')
  60. }
  61. requests.post(TRANSFER_CLUES, { ids: props.info.id, inchargerId: dialogSelection.value.value }).then((res) => {
  62. toastSuccess('转移成功')
  63. showDialog.value = false
  64. setTimeout(() => {
  65. history.back()
  66. }, 2000)
  67. })
  68. }
  69. function claimAndClaim() {
  70. showConfirmDialog({
  71. title: '认领线索',
  72. message: `确定认领【${props.info.name}】线索吗?`,
  73. }).then(() => {
  74. requests.post(TRANSFER_CLUES, { ids: props.info.id, inchargerId: userInfo.userInfo.id }).then((res) => {
  75. toastSuccess('认领成功')
  76. props.info.inchargerName = userInfo.userInfo.name
  77. showDialog.value = false
  78. })
  79. })
  80. }
  81. function selectChange(value, label) {
  82. dialogSelection.value = {
  83. value, label
  84. }
  85. showSelect.value = false
  86. }
  87. function showDialogCli() {
  88. showDialog.value = true
  89. }
  90. function dialogCloseBefo(val) {
  91. if(val == 'confirm' && showDialog.value) {
  92. return false
  93. }
  94. return true
  95. }
  96. useLifecycle({
  97. load: () => {
  98. // 添加加载逻辑
  99. }
  100. });
  101. </script>
  102. <style lang='scss' scoped>
  103. .bottomButton {
  104. margin: 0 14px;
  105. padding-bottom: 30px;
  106. :deep(.van-button) {
  107. margin-bottom: 20px;
  108. }
  109. }
  110. .info {
  111. margin: 8px 14px 30px 14px;
  112. padding: 14px;
  113. }
  114. </style>