保誠-保戶業務員媒合平台
Mila
2021-12-22 6a4966b8898509299cd4d43cc31e2ae2985d0cfe
PAMapp/components/QuickFilter/QuickFilterSelector.vue
@@ -2,7 +2,7 @@
    <div>
        <div class="mb-10" v-if="questionOption.title !== '顧問性別'">
            <span class="mdTxt"
            >{{questionOption.title === '顧問滿意度' ? '保險顧問滿意度' : questionOption.title}}
            >{{questionOption.title}}
            </span>
            <span
                class="smTxt_bold text--primary"
@@ -14,7 +14,10 @@
            >選取星星</span>
        </div>
        <div class="quickBtnBlock" v-if="questionOption.name === 'communicationStyles'">
        <!-------------------- 溝通風格 -------------------->
        <div class="quickBtnBlock"
            v-if="questionOption.name === 'communicationStyles'"
        >
            <el-checkbox-group
                class="pam-quickFilter-checkbox"
                v-model="pickedItem.communicationStyles"
@@ -29,8 +32,37 @@
                ></el-checkbox>
            </el-checkbox-group>
        </div>
        <div class="quickBtnBlock" v-else-if="questionOption.name === 'gender'">
        <!-------------------- 年資 -------------------->
        <div class="quickBtnBlock pam-radio-group"
            v-else-if="questionOption.name === 'seniority'"
        >
            <div
                v-for="(i, index) in questionOption.detail"
                :key="index"
                class="pam-radio"
            >
                <input
                    :id="i.value"
                    type="radio"
                    name="seniority"
                    :value="i.value"
                    class="el-radio-input"
                    v-model="pickedItem.seniority"
                >
                <label
                    :for="i.value"
                    class="el-radio-label"
                    :class="i.className"
                >
                    <p>{{i.name}}</p>
                    <p class="subtitle">{{i.subTitle}}</p>
                </label>
            </div>
        </div>
        <!-------------------- 性別 -------------------->
        <div class="quickBtnBlock"
            v-else-if="questionOption.name === 'gender'"
        >
            <el-radio-group
                class="pam-quickFilter-radio"
                v-model="pickedItem.gender"
@@ -43,7 +75,7 @@
                >{{i.name}}</el-radio>
            </el-radio-group>
        </div>
        <!-------------------- 滿意度 -------------------->
        <div v-else> 
            <el-rate
            v-if="!hideReviews"
@@ -74,7 +106,8 @@
        communicationStyles: [],
        status: '',
        gender: '',
        avgScore: 0
        avgScore: 0,
        seniority: ''
    }
    hideReviews = hideReviews ;
@@ -82,36 +115,34 @@
    @Prop() isOpenQuestionPopUp!: boolean;
    @Prop() confirmItem!: Selected[];
    @Watch('isOpenQuestionPopUp', {immediate: true}) onPopUpChange() {
    @Watch('isOpenQuestionPopUp', {immediate: true})
    onPopUpChange() {
        this.pickedItem = {
            communicationStyles: this.communicationStyles,
            communicationStyles: this.getCommunicationStyles(),
            status: '',
            gender: this.gender,
            avgScore: this.avgScore
            gender: this.getGender(),
            avgScore: this.getAvgScore(),
            seniority: this.getSeniority()
        }
    }
    get gender() {
        const filter = this.confirmItem.filter(item => item.option === 'gender');
        return filter.length > 0 ? filter[0].value : '';
    @Emit('confirm')
    confirm() {
        const name = this.questionOption.name;
        return {
            option: name,
            value: this.pickedItem[name]
        }
    }
    get avgScore() {
        const filter = this.confirmItem.filter(item => item.option === 'avgScore');
        return filter.length > 0 ? filter[0].value : 0;
    }
    get communicationStyles() {
        return this.confirmItem
            .filter(item => item.option === 'communicationStyles')
            .map(item => item.value);
    }
    //////////////////////////////////////////////////////////////////
    get isDisabled() {
        const name = this.questionOption.name;
        return name === 'gender' && !this.pickedItem[name]
            || name === 'avgScore' && !this.pickedItem[name]
            || name === 'communicationStyles' && !this.pickedItem[name].length
            || name === 'seniority' && !this.pickedItem[name]
    }
    selectedCommunicationStyles() {
@@ -120,13 +151,31 @@
        }
    }
    @Emit('confirm')
    confirm() {
        const name = this.questionOption.name;
        return {
            option: this.questionOption.name,
            value: this.pickedItem[name]
    //////////////////////////////////////////////////////////////////
    private getGender(): string {
        return this.filterSingleSelected('gender');
        }
    private getAvgScore(): number {
        return this.filterSingleSelected('avgScore');
    }
    private getCommunicationStyles(): string[] {
        return this.confirmItem
            .filter(item => item.option === 'communicationStyles')
            .map(item => item.value);
    }
    private getSeniority(): string {
        return this.filterSingleSelected('seniority');
    }
    private filterSingleSelected(name: string) {
        const filter = this.confirmItem.filter(item => item.option === name);
        return filter.length > 0
            ? filter[0].value
            : (name === 'avgScore' ? 0 : '');
    }
}
</script>
@@ -136,8 +185,46 @@
    .quickBtnBlock {
        display: flex;
        justify-content: space-between;
        align-content: space-between;
        flex-wrap: wrap;
    }
    .pam-radio-group {
        height: 240px;
        .pam-radio {
            width: 48%;
            height: 110px;
            .el-radio-input {
                display: none;
            }
            .el-radio-label {
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
                width: 100%;
                height: 100%;
                box-shadow: 0 0 6px #22222229;
                border-radius: 10px;
                -webkit-tap-highlight-color: transparent;
                font-size: 20px;
                font-weight: bold;
                color: $PRIMARY_BLACK;
                cursor: pointer;
                .subtitle {
                    font-size: 16px;
                    font-weight: lighter;
                }
            }
            .el-radio-input:checked ~ .el-radio-label {
                background-color: $PEACH;
                color: $PRIMARY_WHITE;
            }
        }
    }
</style>