<template>
|
<div class="appointment-client-detail-close-page">
|
|
<el-row
|
type="flex"
|
class="pam-paragraph">
|
<UiField label="歸檔方式" :labelSize="20">
|
<SingleSelectBtn class="mt-10"
|
:singleSelected.sync="appointmentCloseInfo.selectCloseOption"
|
:options="closeOptions" />
|
</UiField>
|
</el-row>
|
|
<template v-if="appointmentCloseInfo.selectCloseOption === 'done'">
|
<el-row
|
type="flex"
|
class="pam-paragraph" style="flex-direction: column">
|
<UiField label="保戶身分證字號" :labelSize="20" class="required">
|
<input
|
class="appointment-client-detail-close__input"
|
:class="{'is-invalid':!identityIdValid}"
|
v-model="appointmentCloseInfo.policyholderIdentityId"
|
placeholder="請輸入"
|
type="text">
|
</UiField>
|
<div class="error mt-5 mb-5" v-show="!identityIdValid">
|
<span>身分證字號格式有誤</span>
|
</div>
|
</el-row>
|
|
<el-row
|
type="flex"
|
class="pam-paragraph">
|
<UiField label="商品代碼Plan Code" :labelSize="20" class="required">
|
<input
|
class="appointment-client-detail-close__input"
|
v-model="appointmentCloseInfo.planCode"
|
placeholder="請輸入"
|
type="text">
|
</UiField>
|
</el-row>
|
|
<el-row
|
type="flex"
|
class="pam-paragraph">
|
<UiField label="進件時間" :labelSize="20" class="required">
|
<DateTimePicker @changeDateTime="appointmentCloseDate = $event"></DateTimePicker>
|
</UiField>
|
</el-row>
|
</template>
|
|
<template v-if="appointmentCloseInfo.selectCloseOption === 'close'">
|
<el-row
|
class="pam-paragraph">
|
<UiField label="未成交原因" :labelSize="20" class="required">
|
</UiField>
|
<div class="appointment-client-detail-close__selectbox">
|
<select
|
class="appointment-client-detail-close__select"
|
name="closedReason" id="closedReason" v-model="appointmentCloseInfo.closedReason">
|
<option :value="failReason.value" v-for="(failReason, index) in appointmentFailReason" :key="index">
|
{{ failReason.key }}
|
</option>
|
</select>
|
<i class="icon-down down-icon"></i>
|
</div>
|
<div style="display: flex" class="mt-10">
|
|
<input
|
v-if="appointmentCloseInfo.closedReason === 'other'
|
|| appointmentCloseInfo.closedReason === 'no_suitable_commodity'"
|
class="appointment-client-detail-close__input"
|
v-model="appointmentCloseInfo.closedOtherReason"
|
placeholder="請輸入原因,限50字。"
|
type="text">
|
</div>
|
</el-row>
|
</template>
|
|
<el-row
|
type="flex"
|
class="pam-paragraph">
|
<UiField label="備註" :labelSize="20">
|
<el-input
|
type="textarea"
|
:rows="3"
|
placeholder="請輸入"
|
v-model="appointmentCloseInfo.remark"
|
resize="none">
|
</el-input>
|
|
<!-- <textarea
|
v-model="appointmentCloseInfo.archivedDate"
|
class="appointment-close__remark"
|
placeholder="請輸入"
|
name="remark"
|
id="remark"
|
wrap="off"
|
rows="3">
|
</textarea> -->
|
</UiField>
|
</el-row>
|
|
<el-row
|
type="flex"
|
justify="center"
|
class="pam-paragraph">
|
<el-button @click="$router.go(-1)">取消</el-button>
|
<el-button @click="closeAppointment" :disabled="isSubmitBtnDisabled">確認</el-button>
|
</el-row>
|
|
<PopUpFrame :isOpen.sync="isShowSuccessAlert">
|
<div class="text--middle invite-review">
|
<div class="mb-30 mt-10">結案成功</div>
|
<el-button type="primary" @click="closeAlert">確定</el-button>
|
</div>
|
</PopUpFrame>
|
</div>
|
</template>
|
|
<script lang="ts">
|
|
import { namespace } from 'nuxt-property-decorator';
|
import { Vue, Component } from 'vue-property-decorator';
|
import { Appointment, ToCloseAppointment, ToDoneAppointment } from '~/shared/models/appointment.model';
|
import { ContactStatus } from '~/shared/models/enum/contact-status';
|
|
import appointmentService from '~/shared/services/appointment.service';
|
|
const appointmentStore = namespace('appointment.store');
|
|
@Component
|
export default class AppointmentDetailCloseComponent extends Vue {
|
|
@appointmentStore.Action
|
updateAppointmentDetail!: () => Appointment;
|
|
contactStatus = ContactStatus;
|
|
appointmentCloseDate = '';
|
isShowSuccessAlert = false;
|
|
appointmentCloseInfo = {
|
closedOtherReason : '',
|
closedReason : 'other',
|
planCode : '',
|
policyEntryDate : this.appointmentCloseDate,
|
policyholderIdentityId: '',
|
remark : '',
|
selectCloseOption : 'done',
|
};
|
|
closeOptions = [
|
{
|
title:'成交',
|
label: 'done',
|
},
|
{
|
title:'未成交',
|
label: 'close',
|
}
|
];
|
|
appointmentFailReason = [
|
{
|
key: '無法聯繫客戶',
|
value: 'cannot_to_contact_customer'
|
},
|
{
|
key: '單純諮詢',
|
value: 'only_consultation'
|
},
|
{
|
key: '無合適商品',
|
value: 'no_suitable_commodity'
|
},
|
{
|
key: '核保問題- 體況、財務、職業',
|
value: 'prohibited_factors'
|
},
|
{
|
key: '經濟因素',
|
value: 'economy'
|
},
|
{
|
key: '其他',
|
value: 'other'
|
},
|
];
|
|
closeAppointment(): void {
|
const appointmentId = +this.$route.params.appointmentId;
|
if (this.appointmentCloseInfo.selectCloseOption === 'done') {
|
const toDoneAppointment: ToDoneAppointment = {
|
appointmentId : appointmentId,
|
contactStatus : this.contactStatus.DONE,
|
planCode : this.appointmentCloseInfo.planCode,
|
policyEntryDate : this.appointmentCloseInfo.policyEntryDate,
|
policyholderIdentityId: this.appointmentCloseInfo.policyholderIdentityId,
|
}
|
appointmentService.closeAppointment(toDoneAppointment).then((res) => res);
|
this.isShowSuccessAlert = true;
|
} else {
|
const toCloseAppointment: ToCloseAppointment = {
|
appointmentId : appointmentId,
|
closedOtherReason: this.appointmentCloseInfo.closedOtherReason,
|
closedReason : this.appointmentCloseInfo.closedReason,
|
contactStatus : this.contactStatus.CLOSE,
|
remark : this.appointmentCloseInfo.remark,
|
}
|
appointmentService.closeAppointment(toCloseAppointment).then((res) => res);
|
this.isShowSuccessAlert = true;
|
}
|
}
|
|
closeAlert(){
|
this.isShowSuccessAlert = false ;
|
this.$router.push(`/myAppointmentList/contactedList`);
|
}
|
|
get isSubmitBtnDisabled() {
|
const {
|
selectCloseOption,
|
policyholderIdentityId,
|
planCode,
|
closedReason,
|
closedOtherReason
|
} = this.appointmentCloseInfo;
|
// this.appointmentCloseInfo.policyEntryDate 並沒有辦法取值到 this.appointmentCloseDate
|
if (selectCloseOption === 'done') {
|
return !policyholderIdentityId || !this.identityIdValid || !planCode || !this.appointmentCloseDate
|
} else if (closedReason === 'other' || closedReason === 'no_suitable_commodity') {
|
return !closedOtherReason
|
}
|
return false
|
}
|
|
get identityIdValid() {
|
const rule = /^[A-Z]\d{9}$/;
|
const identityId = this.appointmentCloseInfo.policyholderIdentityId;
|
return identityId ? rule.test(identityId) : true;
|
}
|
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.appointment-close__remark,
|
.appointment-client-detail-close__input,
|
.appointment-client-detail-close__select {
|
border-radius: 5px;
|
border : 1px solid #707070;
|
font-size: 20px;
|
padding : 10px 20px;
|
width : 100%;
|
box-sizing: border-box;
|
&::placeholder {
|
color: $MID_GREY;
|
}
|
&.is-invalid {
|
border-color: $PRIMARY_RED !important;
|
}
|
}
|
.appointment-client-detail-close__selectbox {
|
position: relative;
|
|
& .appointment-client-detail-close__select{
|
appearance: none;
|
}
|
& .down-icon {
|
position: absolute;
|
right: 7px;
|
bottom: 10px;
|
}
|
}
|
.invite-review{
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
}
|
.error {
|
@extend .smTxt_bold;
|
@extend .text--primary;
|
height: 16px;
|
}
|
.required {
|
position: relative;
|
|
&::before {
|
content: '*';
|
font-size: 20px;
|
font-weight: bold;
|
position: absolute;
|
color: #FF0000;
|
transform: translateX(-5px);
|
z-index: 5;
|
}
|
}
|
</style>
|