123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- <template>
- <div class="crm-action">
- <!-- 收录 -->
- <div class="action-content" v-for="(item, i) in getList" :key="i">
- <div @click="setActionEvent(item)" class="action-list" :class="'action-' + item.class">
- <i class="iconfont" :class="[ 'icon-' + item['icon-' + item.active] , {'checked': !!item.active }]">
- <div class="msg" v-if="item.msg">{{ item.msg }}</div>
- </i>
- <span> {{ item.active ? '已' : '' }}{{ item.title }}</span>
- </div>
- </div>
- <iframe-dialog :iframe-src="iframeSrc" @getEmployInfo="getEmployEvent" @setDialogStatus="setDialogStatus" :showDialog="setShowDialog"></iframe-dialog>
- </div>
- </template>
- <script>
- import '@/assets/style/iconfont.css'
- import iframeDialog from '@/components/crm-info/IframeDialog.vue'
- import { ajaxIgnoreOperate, ajaxEmployOperate, ajaxEmployInfo } from '@/api/modules/'
- export default {
- name: 'crm-action',
- props: {
- params: {
- type: Object,
- default () {
- return {
- employType: 3,
- idArr: ''
- }
- }
- },
- ename: {
- type: Object,
- default () {
- return ''
- }
- }
- },
- components: {
- iframeDialog
- },
- data () {
- return {
- list: [
- { title: '收录', 'icon-0': 'a-Property1shoulu', 'icon-1': 'a-Property1yishoulu', class: 'employ', active: 0 },
- { title: '忽略', 'icon-0': 'a-Property1hulve', 'icon-1': 'a-Property1yihulve', class: 'ignore', active: 0 },
- { title: '创建客户', 'icon-0': 'chuangjiankehu', 'icon-1': 'chuangjiankehu', class: 'custom', active: 0, msg: 0 }
- ],
- employInfo: {},
- setShowDialog: false,
- iframeSrc: ''
- }
- },
- computed: {
- getList () {
- if (this.list[0].active === 0) {
- return this.list.slice(0, 1)
- } else {
- return this.list
- }
- }
- },
- created () {
- this.getEmployEvent()
- },
- methods: {
- setDialogStatus (data) {
- this.setShowDialog = data
- },
- // 收录情况
- async getEmployEvent () {
- const { data, error_code: code } = await ajaxEmployInfo(this.params)
- if (code === 0 && Array.from(data) && data.length > 0) {
- this.employInfo = data
- // 收录情况
- this.list[0].active = data[0].isEmploy ? 1 : 0
- // 忽略情况
- this.list[1].active = data[0].isIgnore ? 1 : 0
- }
- },
- setActionEvent (data) {
- switch (data.class) {
- case 'employ':
- this.setEmployEvent(data)
- break
- case 'ignore':
- this.setIgnoreEvent(data)
- break
- case 'custom':
- this.setShowDialog = true
- this.iframeSrc = location.origin + '/succbi/crm_system/app/crm.app/%E9%80%9A%E7%94%A8%E5%88%9B%E5%BB%BA/create_customer.spg?E_customer_name=' + this.ename
- break
- default:
- break
- }
- },
- // 收录操作
- async setEmployEvent (item) {
- const info = this.employInfo[0]
- const params = {
- idArr: this.params.idArr,
- isEmploy: !info.isEmploy,
- employType: this.params.employType
- }
- const { data, error_code: code } = await ajaxEmployOperate(params)
- if (code === 0) {
- if (data.status) {
- item.active = item.active === 0 ? 1 : 0
- }
- }
- },
- // 忽略操作
- async setIgnoreEvent (item) {
- const info = this.employInfo[0]
- const params = {
- idArr: this.params.idArr,
- isIgnore: !info.isIgnore,
- employType: this.params.employType
- }
- const { data, error_code: code } = await ajaxIgnoreOperate(params)
- if (code === 0) {
- if (data.status) {
- item.active = item.active === 0 ? 1 : 0
- }
- }
- }
- }
- }
- </script>
- <style lang="scss">
- .crm-action{
- display: flex;
- align-items: center;
- .action-list{
- margin-left: 16px;
- cursor: pointer;
- }
- .iconfont{
- position: relative;
- margin-right: 4px;
- font-size: 20px;
- color: #AAA;
- &.checked{
- color: #2ABED1;
- }
- &.icon-chuangjiankehu{
- color: #2ABED1;
- }
- &.icon-a-Property1yihulve {
- color: #FF9F40;
- }
- .msg {
- position: absolute;
- top: -8px;
- right: -6px;
- display: flex;
- align-items: center;
- justify-content: center;
- width: 16px;
- height: 16px;
- background: #FF3A20;
- border-radius: 50%;
- color: #fff;
- font-size: 12px;
- }
- }
- }
- </style>
|