保誠-保戶業務員媒合平台
Tomas
2022-01-21 a7b45caf5b3784f65ba82793d87f5ffb202fca1e
PAMapp/pages/appointment/_appointmentId/close/index.vue
@@ -11,7 +11,7 @@
        </UiField>
      </el-row>
      <template v-if="appointmentCloseInfo.selectCloseOption === 'done'">
      <template v-if="appointmentCloseInfo.selectCloseOption === contactStatus.DONE">
        <el-row
          type="flex"
          class="pam-paragraph" style="flex-direction: column">
@@ -43,18 +43,20 @@
        <el-row
          type="flex"
          class="pam-paragraph">
          <UiField label="進件時間" :labelSize="20" class="required">
            <DateTimePicker  @changeDateTime="appointmentCloseDate = $event"></DateTimePicker>
          <UiField label="進件時間" :labelSize="20">
            <DateTimePicker
              :defaultValue="appointmentCloseInfo.policyEntryDate"
              @changeDateTime="appointmentCloseInfo.policyEntryDate = $event"></DateTimePicker>
          </UiField>
        </el-row>
      </template>
      <template v-if="appointmentCloseInfo.selectCloseOption === 'close'">
      <template v-if="appointmentCloseInfo.selectCloseOption === contactStatus.CLOSE">
        <el-row
          class="pam-paragraph">
          <UiField label="未成交原因" :labelSize="20" class="required">
          </UiField>
            <div class="appointment-client-detail-close__selectbox">
            <div class="appointment-client-detail-close__select-box">
              <select
                class="appointment-client-detail-close__select"
                name="closedReason" id="closedReason" v-model="appointmentCloseInfo.closedReason">
@@ -64,8 +66,7 @@
              </select>
              <i class="icon-down down-icon"></i>
            </div>
            <div style="display: flex" class="mt-10">
            <div class="mt-10">
              <input
                v-if="appointmentCloseInfo.closedReason === 'other'
                    || appointmentCloseInfo.closedReason === 'no_suitable_commodity'"
@@ -88,16 +89,6 @@
            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>
@@ -123,9 +114,10 @@
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';
import { appointmentFailReasonList } from '~/shared/const/appointment-fail-reason-list';
import { ContactStatus } from '~/shared/models/enum/contact-status';
const appointmentStore = namespace('appointment.store');
@@ -133,7 +125,10 @@
export default class AppointmentDetailCloseComponent extends Vue {
  @appointmentStore.Action
  updateAppointmentDetail!: () => Appointment;
  updateAppointmentDetail!: (appointmentId: number) => Appointment;
  @appointmentStore.State('appointmentDetail')
  appointmentDetail!: Appointment;
  contactStatus = ContactStatus;
@@ -147,58 +142,60 @@
    policyEntryDate       : this.appointmentCloseDate,
    policyholderIdentityId: '',
    remark                : '',
    selectCloseOption     : 'done',
    selectCloseOption     : this.contactStatus.DONE,
  };
  closeOptions = [
    {
      title:'成交',
      label: 'done',
      label: this.contactStatus.DONE,
    },
    {
      title:'未成交',
      label: 'close',
      label: this.contactStatus.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'
    },
  ];
  appointmentFailReason = appointmentFailReasonList;
  //////////////////////////////////////////////////////////////////////
  mounted() {
    const appointmentId = +this.$route.params.appointmentId;
    const closedInfo = this.appointmentDetail.appointmentClosedInfo;
    if (this.appointmentDetail.id === appointmentId
        && (this.appointmentDetail.communicateStatus === this.contactStatus.DONE
        || this.appointmentDetail.communicateStatus === this.contactStatus.CLOSE
        || this.appointmentDetail.communicateStatus === this.contactStatus.CANCEL)
        ) {
        this.appointmentCloseInfo = {
        closedOtherReason     : closedInfo?.closedOtherReason,
        closedReason          : closedInfo?.closedReason,
        planCode              : closedInfo?.planCode,
        policyEntryDate       : closedInfo?.policyEntryDate,
        policyholderIdentityId: closedInfo?.policyholderIdentityId,
        remark                : closedInfo?.remark,
        selectCloseOption     : this.appointmentDetail.communicateStatus === this.contactStatus.DONE
                                ? this.contactStatus.DONE
                                : this.contactStatus.CLOSE
      };
    }
  }
  //////////////////////////////////////////////////////////////////////
  closeAppointment(): void {
    const appointmentId = +this.$route.params.appointmentId;
    if (this.appointmentCloseInfo.selectCloseOption === 'done') {
    if (this.appointmentCloseInfo.selectCloseOption === this.contactStatus.DONE) {
      const toDoneAppointment: ToDoneAppointment = {
        appointmentId         : appointmentId,
        contactStatus         : this.contactStatus.DONE,
        planCode              : this.appointmentCloseInfo.planCode,
        policyEntryDate       : this.appointmentCloseInfo.policyEntryDate,
        policyholderIdentityId: this.appointmentCloseInfo.policyholderIdentityId,
        remark                : this.appointmentCloseInfo.remark,
      }
      appointmentService.closeAppointment(toDoneAppointment).then((res) => res);
      appointmentService.closeAppointment(toDoneAppointment).then((_) => this.updateAppointmentDetail(appointmentId));
      this.isShowSuccessAlert = true;
    } else {
      const toCloseAppointment: ToCloseAppointment = {
@@ -208,7 +205,7 @@
        contactStatus    : this.contactStatus.CLOSE,
        remark           : this.appointmentCloseInfo.remark,
      }
      appointmentService.closeAppointment(toCloseAppointment).then((res) => res);
      appointmentService.closeAppointment(toCloseAppointment).then((_) => this.updateAppointmentDetail(appointmentId));
      this.isShowSuccessAlert = true;
    }
  }
@@ -224,11 +221,12 @@
      policyholderIdentityId,
      planCode,
      closedReason,
      closedOtherReason
      closedOtherReason,
      remark
    } = this.appointmentCloseInfo;
    // this.appointmentCloseInfo.policyEntryDate 並沒有辦法取值到 this.appointmentCloseDate
    if (selectCloseOption === 'done') {
      return !policyholderIdentityId || !this.identityIdValid || !planCode || !this.appointmentCloseDate
    if (selectCloseOption === this.contactStatus.DONE) {
      return !policyholderIdentityId || !this.identityIdValid || !planCode || !this.appointmentCloseInfo.policyEntryDate || !remark
    } else if (closedReason === 'other' || closedReason === 'no_suitable_commodity') {
      return !closedOtherReason
    }
@@ -261,7 +259,7 @@
    border-color: $PRIMARY_RED !important;
  }
}
.appointment-client-detail-close__selectbox {
.appointment-client-detail-close__select-box {
  position: relative;
  & .appointment-client-detail-close__select{