From ed4b2b7c67443b83abdc7aaf99e784a79d2e0a4f Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期四, 20 一月 2022 17:04:24 +0800
Subject: [PATCH] Merge branch 'Phase3' of https://192.168.0.10:8443/r/pcalife/PAM into Phase3

---
 PAMapp/pages/appointment/_appointmentId/close/index.vue |  111 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 90 insertions(+), 21 deletions(-)

diff --git a/PAMapp/pages/appointment/_appointmentId/close/index.vue b/PAMapp/pages/appointment/_appointmentId/close/index.vue
index 4fc41a4..973e48a 100644
--- a/PAMapp/pages/appointment/_appointmentId/close/index.vue
+++ b/PAMapp/pages/appointment/_appointmentId/close/index.vue
@@ -14,20 +14,24 @@
       <template v-if="appointmentCloseInfo.selectCloseOption === 'done'">
         <el-row
           type="flex"
-          class="pam-paragraph">
-          <UiField label="靽頨怠�����" :labelSize="20">
+          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="���誨蝣噗lan Code" :labelSize="20">
+          <UiField label="���誨蝣噗lan Code" :labelSize="20" class="required">
             <input
               class="appointment-client-detail-close__input"
               v-model="appointmentCloseInfo.planCode"
@@ -39,8 +43,8 @@
         <el-row
           type="flex"
           class="pam-paragraph">
-          <UiField label="�脖辣����" :labelSize="20">
-          <DateTimePicker  @changeDateTime="appointmentCloseDate = $event"></DateTimePicker>
+          <UiField label="�脖辣����" :labelSize="20" class="required">
+            <DateTimePicker  @changeDateTime="appointmentCloseDate = $event"></DateTimePicker>
           </UiField>
         </el-row>
       </template>
@@ -48,8 +52,9 @@
       <template v-if="appointmentCloseInfo.selectCloseOption === 'close'">
         <el-row
           class="pam-paragraph">
-          <UiField label="���漱����" :labelSize="20">
+          <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">
@@ -57,17 +62,18 @@
                   {{ failReason.key }}
                 </option>
               </select>
+              <i class="icon-down down-icon"></i>
+            </div>
+            <div style="display: flex" class="mt-10">
 
-              <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>
+              <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>
 
@@ -100,7 +106,7 @@
         justify="center"
         class="pam-paragraph">
         <el-button @click="$router.go(-1)">����</el-button>
-        <el-button @click="closeAppointment">蝣箄��</el-button>
+        <el-button @click="closeAppointment" :disabled="isSubmitBtnDisabled">蝣箄��</el-button>
       </el-row>
 
       <PopUpFrame :isOpen.sync="isShowSuccessAlert">
@@ -114,14 +120,20 @@
 
 <script lang="ts">
 
+import { namespace } from 'nuxt-property-decorator';
 import { Vue, Component } from 'vue-property-decorator';
-import { ToCloseAppointment, ToDoneAppointment } from '~/shared/models/appointment.model';
+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;
 
@@ -206,6 +218,29 @@
     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>
 
@@ -218,13 +253,47 @@
   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;
+  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>

--
Gitblit v1.8.0