CollapseItem.vue 19.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664
<!--
 * @Author: yangming yangming@didihu.com.cn
 * @Date: 2023-12-22 20:36:05
 * @LastEditors: yangming yangming@didihu.com.cn
 * @LastEditTime: 2024-01-16 13:44:37
 * @FilePath: \scrm-micro-peregrination\src\views\journeyModel\components\CollapseItem.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!--
 * @Author: yangming yangming@didihu.com.cn
 * @Date: 2023-09-05 17:24:08
 * @LastEditors: yangming yangming@didihu.com.cn
 * @LastEditTime: 2024-01-03 10:53:58
 * @FilePath: \scrm-micro-journey\src\views\journeyConfig\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div :class="{ 'collapse-item': true, 'is-active': stepItem.isExpaned }">
    <div class="collapse-item-tab flex-column-center plr20" @click="handleExpand(item)">
      <i class="el-icon-caret-bottom" v-show="stepItem.isExpaned"></i>
      <i class="el-icon-caret-right" v-show="!stepItem.isExpaned"></i>
      <div class="tab-label">{{ stepItem.label }}</div>
      <div class="tab-operate">
        <slot></slot>
      </div>
    </div>
    <div class="collapse-item-panel" :style="{ display: stepItem.isExpaned ? 'block' : 'none' }">
      <div class="task-item">
        <template>
          <div class="task-item-head flex-column-center">
            <div class="task-item-icon">
              <img src="@/assets/config/log.png" />
            </div>
            <div class="task-item-name">进入条件</div>
            <div class="task-item-desc">(描述用户触发何种条件后,将自动变更为该旅程阶段)</div>
            <div class="task-item-mark">该旅程阶段{{ stepItem.editable ? '' : '不' }}支持手动标记</div>
          </div>
          <div class="progress-item-content bg-fff" v-if="stepItem.conditionsList.length">
            <div class="progress-item" v-for="(v, k) in stepItem.conditionsList" :key="k">
              <div class="progress-item-num">
                <span>条件{{ k + 1 }}</span>
                <span>{{ spiltString(v) }}</span>
              </div>
              <div class="progress-edit">
                <el-button type="text" @click.stop="showEditCondition(v, k)">编辑</el-button>
                <el-button type="text" @click.stop="handleDeleteCondition(k)">删除</el-button>
              </div>
            </div>
          </div>
          <div class="empty-panel" v-else>
            <div class="empty-img">
              <img src="@/assets/empty.png" />
            </div>
            <div class="empty-txt">
              暂无进入条件
            </div>
          </div>
        </template>
        <template>
          <div class="task-item-sop flex">
            <div class="task-sop-l">
              <div class="task-item-head flex-column-center">
                <div class="task-item-icon">
                  <img src="@/assets/config/sop.png" />
                </div>
                <div class="task-item-name">SOP任务</div>
                <div class="task-item-desc">(系统面向当前旅程阶段客户的营销计划)</div>
                <div class="task-item-add">
                  <el-button class="el-icon-plus" :size="size" type="primary" plain @click.stop="addSop">增加新内容</el-button>
                </div>
              </div>
              <div class="task-item-content bg-fff" v-if="stepItem.sopList.length">
                <div class="step-item" v-for="(v, k) in stepItem.sopList" :key="k">
                  <div class="step-item-day" v-if="v.length">
                    <img src="@/assets/config/step-border.png" />
                    <span>第{{ v[0].day }}天</span>
                  </div>
                  <div class="step-item-content" v-if="v.length">
                    <div v-for="(value, key) in v" :key="key" class="step-time-item flex-column-center">
                      <div>
                        <div class="step-item-desc flex-column-center">
                          <div class="step-item_node">
                            <span>[{{ value.time }}]发送 | {{ stageInfo([value.taskType]).nodeName }} |{{ stageInfo([value.taskType]).desc }}</span>
                          </div>
                          <div class="step-item_btn">
                            <el-button type="text" @click.stop="handleEdit(value, v, key)">编辑</el-button>
                            <el-button type="text" @click.stop="handleDelete(v, key)">删除</el-button>
                          </div>
                        </div>
                      </div>
                      <!-- <div class="step-detail-btn" @click="getEmpDetail">详情</div> -->
                    </div>
                  </div>
                </div>
              </div>
              <div class="empty-panel" v-else>
                <div class="empty-img">
                  <img src="@/assets/empty.png" />
                </div>
                <div class="empty-txt">
                  暂无SOP任务
                </div>
              </div>
            </div>
            <div class="task-sop-calendar">
              <div class="task-item-head flex-column-center">
                <div class="task-item-icon">
                  <img src="@/assets/config/calendar.png" />
                </div>
                <div class="task-item-name">SOP日历</div>
              </div>
              <div class="task-item-content bg-fff">
                <div class="calendar-panel">
                  <div class="calendar-item" v-for="(v, k) in stepItem.sopList" :key="k">
                    <div class="calendar-day" v-if="v.length">第{{ v[0].day }}天</div>
                    <div class="calendar-time flex-column-center" v-for="(value, key) in v" :key="key">
                      <el-popover popper-class="popover-dialog" placement="top-start" width="100" trigger="click">
                        <div class="popover-panel" v-for="(t, pkey) in v" :key="pkey">
                          <div class="flex-column-center">
                            <span>{{ t.time }}</span>
                          </div>
                          <div class="stage-desc">{{ stageInfo([t.taskType]).nodeName }}</div>
                        </div>

                        <div slot="reference" class="flex-column-center" v-if="v.length <= 2">
                          <span>{{ value.time }}</span>
                        </div>
                        <div slot="reference" class="flex-column-center" v-if="v.length > 2 && key == 0">
                          <span>3条内容</span>
                        </div>
                      </el-popover>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </template>
      </div>
    </div>
    <stat-dialog v-if="statVisible" :statVisible="statVisible"></stat-dialog>
    <sop-item :drawerVisible="drawerVisible" @closeDrawer="closeDrawer" ref="sopForm"></sop-item>
    <concatActivity :activityVisible="activityVisible" :activityConfig="activityConfig" v-if="activityVisible" @closeActivity="closeActivity" ref="activityForm"></concatActivity>
  </div>
</template>
<script>
const STAGE = Object.freeze({
  4: '门店助手1v1',
  3: '门店助手朋友圈',
  1: '发送短信',
  2: 'AI外呼',
  5: '跟进提醒',
  6: '客户信息查询'
})
const ICON = Object.freeze({
  4: 1,
  3: 2,
  1: 3,
  2: 4,
  5: 5,
  6: 6
})
const STAGE_INFO = Object.freeze({
  4: '本功能将给跟进员工推送1v1任务,由员工向每个客户微信转发对应的营销内容。',
  3: '本功能将给跟进员工推送朋友圈任务,由员工一键将营销内容发布微信朋友圈',
  1: '本功能将给跟进员工推送短信营销任务,由员工一键确认后系统自动推送营销短信给客户',
  2: '本功能将给跟进员工推送AI外呼任务,由员工一键确认后AI外呼平台自动对客户进行外呼',
  5: '本功能将给跟进员工推送跟进提醒,提醒员工给客户打一个电话或其他跟进行为。',
  6: '本功能配合第三方平台,定时获取到保信息并更新。'
})
const STAGE_TIME = Object.freeze({
  4: '09:00',
  3: '09:00',
  1: '09:00',
  2: '16:00',
  5: '09:00',
  6: '09:00'
})
const STAGE_PREFIX = Object.freeze({
  4: {
    key: 'activityName'
  },
  3: {
    key: 'activityName'
  },
  1: {
    key: 'textMessage',
    label: '短信模版:'
  },
  2: {
    key: 'aiSpeech',
    label: 'AI话术模版:'
  },
  5: {
    意向客户: '提醒内容:您有[客户人数] 位客户已进入[旅程阶段],请及时跟进。',
    保费报价: ['提醒内容:您有客户保费已出,请尽快联系并提供车险报价。', '提醒内容:3天前您有客户保费已出,请尽快跟进并通过门店助手反馈跟进情况(成功 或者 战败)']
  },
  6: '查询内容:到保日期'
})

// import editCondition from './editCondition'

import sopItem from './sopItem'
import concatActivity from './concatActivity'
import model from '@/mixins/model'
export default {
  mixins: [model],
  components: {
    sopItem,
    concatActivity
    // editCondition
  },
  props: {
    stepItem: {
      type: Object,
      default: () => {}
    },
    activityName: String
  },
  data() {
    return {
      activityConfig: {},
      sopIndex: [],
      stage: STAGE,
      stage_icon: ICON,
      stage_info: STAGE_INFO,
      stage_time: STAGE_TIME,
      stage_prefix: STAGE_PREFIX,
      empVisible: false,
      statVisible: false,
      conditionVisible: false,
      activityVisible: false,
      drawerVisible: false
    }
  },
  methods: {
    //获取sop映射字段
    stageInfo(i) {
      if (this.modelList) {
        return this.modelList.find(item => item.id == i)
      } else {
        return {
          nodeName: '',
          desc: ''
        }
      }
    },
    //删除sop任务
    handleDelete(val, k) {
      this.$confirm('是否确定删除?', '提示', {
        confirmButtonText: '是',
        cancelButtonText: '否',
        type: 'warning'
      })
        .then(() => {
          val.splice(k, 1)
        })
        .catch(() => {})
    },
    //新增条件
    closeActivity(val) {
      if (!val) {
        this.activityVisible = false
        return
      }
      const idx = val.condition_i
      if (idx === null) {
        this.stepItem.conditionsList.push(val.conditionList)
      } else {
        this.stepItem.conditionsList[idx] = val.conditionList
      }
      this.activityVisible = false
    },
    closeDrawer(val) {
      if (val) this.addSopList(val)
      this.drawerVisible = false
    },
    handleEdit(val, k1, k2) {
      this.sopIndex = [k1, k2]
      this.drawerVisible = true
      this.$refs.sopForm.setForm(val)
    },
    //显示sop弹框
    addSop() {
      this.sopIndex = []
      this.drawerVisible = true
      // this.SET_MODEL(this.stepItem.label)
      // this.$emit('openDrawer')
    },
    //显示sop任务
    addSopList(val) {
      if (this.sopIndex.length) {
        const [i, j] = this.sopIndex
        i.splice(j, 1)
      }
      const i = this.stepItem.sopList.findIndex(i => {
          if (i && i[0]) return i[0].day == val.day
        }),
        model = {
          day: val.day,
          stage: this.stepItem.label,
          time: val.time,
          taskType: val.nodeProtoId
        }

      if (i > -1) {
        this.stepItem.sopList[i].push(model)
      } else {
        this.stepItem.sopList.push([model])
      }
      this.stepItem.sopList = this.stepItem.sopList.filter(i => i[0])
      this.stepItem.sopList.sort((a, b) => a[0].day - b[0].day)
      this.stepItem.sopList.forEach(item => {
        item.sort((x, y) => {
          return new Date('1970/01/01 ' + x.time) - new Date('1970/01/01 ' + y.time) // 按照 time 排序
        })
      })
    },
    showEditCondition(val, index) {
      this.activityConfig = {
        label: this.stepItem.label,
        name: this.activityName
      }
      this.activityVisible = true
      this.$nextTick(() => {
        this.$refs.activityForm.$refs.conditionForm.setCondition(val, index)
      })
    },
    handleDeleteCondition(k) {
      this.$confirm('是否确定提交?', '提示', {
        confirmButtonText: '是',
        cancelButtonText: '否',
        type: 'warning'
      })
        .then(() => {
          this.stepItem.conditionsList.splice(k, 1)
          this.$message({
            type: 'success',

            message: '删除成功!'
          })
        })
        .catch(() => {})
    },
    showStat() {
      this.statVisible = true
    },

    //查看详情
    getEmpDetail() {
      this.empVisible = true
    },
    //展开收起
    handleExpand() {
      this.stepItem.isExpaned = !this.stepItem.isExpaned
    }
  }
}
</script>
<style lang="scss" scoped>
.empty-panel {
  background: #fff;
  padding: 10px;
  font-size: 12px;
  color: #666666;
  text-align: center;
  margin: 10px 0px;
  .empty-img {
    width: 48px;
    height: 30px;
    margin: 10px auto 4px;
    img {
      width: 100%;
      height: 100%;
    }
  }
}
.collapse-item {
  overflow: hidden;
  height: 51px;
  cursor: pointer;
  &.is-active {
    height: auto;
  }
  .collapse-item-tab {
    height: 50px;
    border-bottom: 1px solid #e5e5e5;
    i {
      cursor: pointer;
      margin-right: 2px;
    }
    .tab-label {
      font-weight: 600;
      font-size: 14px;
      color: #1d2129;
    }
    .tab-operate {
      margin-left: auto;
    }
    .tab-sop {
      font-weight: 400;
      font-size: 14px;
      color: #5850ff;
      margin-left: auto;
    }
  }
  .collapse-item-panel {
    background: #f7f7fc;
    padding: 16px;
    transition: all 0.3s;
    .task-item {
      &-head {
        height: 28px;
        .task-item-icon {
          width: 20px;
          height: 20px;
          img {
            width: 20px;
            height: 20px;
          }
        }
        .task-item-name {
          color: #333333;
          font-size: 14px;
          margin-left: 10px;
        }
        .task-item-desc {
          color: #999999;
          font-size: 12px;
        }
        .task-item-mark {
          color: #999999;
          font-size: 12px;
          margin-left: auto;
        }
        .task-item-add {
          margin-left: auto;
        }
      }
      .task-sop-l {
        flex: 1;
      }
      .task-sop-calendar {
        width: 296px;
        margin-left: 16px;
      }
    }
    .progress-item-content {
      padding: 16px;
      margin: 10px 0px;
      position: relative;
      .progress-edit {
        position: absolute;
        top: 50%;
        right: 20px;
        font-size: 14px;
        line-height: 20px;
        color: #5850ff;
        margin-top: -10px;
      }
      .progress-item {
        position: relative;
        padding-left: 20px;
        height: 32px;
        display: flex;
        align-items: center;
        &-num {
          flex: 1;
        }
        img {
          width: 32px;
          height: 4px;
          margin: 0 10px;
        }
        span {
          display: inline-block;
          &:first-child {
            margin-right: 40px;
            width: 48px;
          }
          &:last-child {
          }
        }
        &::before {
          content: '';
          position: absolute;
          width: 6px;
          height: 6px;
          background: #5850ff;
          border-radius: 50%;
          left: 0px;
          top: 12px;
        }
      }
    }
    .task-item-content {
      padding: 16px;
      margin-top: 10px;
      height: calc(100% - 70px);
      .step-item-day {
        position: relative;
        img {
          width: 216px;
          height: 52px;
        }
        span {
          position: absolute;
          top: 18px;
          left: 52px;
        }
      }

      .step-item {
        .step-time-item {
          width: 100%;
          padding: 12px 16px;
          background: #f9fafe;
          > div {
            width: 100%;
          }
          .step-detail-btn {
            margin-left: auto;
            font-size: 14px;
            color: #5850ff;
            cursor: pointer;
          }
          &:not(:first-child) {
            margin-top: 20px;
          }
        }
        &:last-child {
          .step-item-content {
            border: none;
          }
        }
      }
      .step-item-content {
        padding: 16px 22px 20px;
        border-left: 1px dashed #b8b9ff;
        margin: -10px 0px -10px 20px;
      }
      .step-item-desc {
        font-size: 14px;
        color: #c6c6c6;
        width: 100%;
        .step-item_node {
          width: calc(100% - 100px);
        }
        .step-item_btn {
          width: 100px;
        }
      }
      .step-item-name {
        font-size: 14px;
        color: #333333;
        margin-top: 8px;
        line-height: 20px;
        e .task-type {
          max-width: calc(100% - 150px);
        }
        .task-type-edit {
          width: 80px;
          color: #5850ff;
          margin-left: 10px;
          img {
            width: 14px;
            height: 14px;
          }
          a {
            font-size: 12px;
            color: #5850ff;
          }
        }
      }
      .calendar-panel {
        display: grid;
        grid-template-columns: repeat(4, 25%);
        row-gap: 12px;
        .calendar-item {
          .calendar-day {
            font-size: 12px;
            color: #c6c6c6;
          }
          .calendar-time {
            line-height: 20px;
            /deep/ {
              .el-popover__reference-wrapper {
                display: flex;
                align-items: center;
                .el-popover__reference {
                  height: 32px;
                  line-height: 32px;
                }
                &:hover {
                  span {
                    color: #5850ff;
                  }
                  .stage-1 {
                    background: url('../../../assets/config/calendar-icon.png') -114px -62px;
                  }
                  .stage-2 {
                    background: url('../../../assets/config/calendar-icon.png') -10px -10px;
                  }
                  .stage-3 {
                    background: url('../../../assets/config/calendar-icon.png') -62px -10px;
                  }
                  .stage-4 {
                    background: url('../../../assets/config/calendar-icon.png') -62px -166px;
                  }
                  .stage-5 {
                    background: url('../../../assets/config/calendar-icon.png') -10px -114px;
                  }
                  .stage-6 {
                    background: url('../../../assets/config/calendar-icon.png') -62px -114px;
                  }
                  .stage-7 {
                    background: url('../../../assets/config/calendar-icon.png') -114px -114px;
                  }
                }
              }
            }
            span {
              font-size: 14px;
              color: #666666;
              text-decoration: underline;
              cursor: pointer;
            }
          }
        }
      }
    }
  }
}
.stage-desc {
  font-size: 12px;
  color: #333333;
}
.stage-icon {
  width: 32px;
  height: 32px;
  transform: scale(0.5);
}
.stage-2 {
  background: url('../../../assets/config/calendar-icon.png') -62px -62px;
}
.stage-3 {
  background: url('../../../assets/config/calendar-icon.png') -114px -10px;
}
.stage-1 {
  background: url('../../../assets/config/calendar-icon.png') -10px -62px;
}
.stage-4 {
  background: url('../../../assets/config/calendar-icon.png') -166px -10px;
}
.stage-5 {
  background: url('../../../assets/config/calendar-icon.png') -166px -62px;
}
.stage-6 {
  background: url('../../../assets/config/calendar-icon.png') -166px -114px;
}
.stage-7 {
  background: url('../../../assets/config/calendar-icon.png') -10px -166px;
}
</style>