From 8b3eac27e27d437014ebbd308f0e7de24cf1fffa Mon Sep 17 00:00:00 2001
From: Tomas <tomasysh@gmail.com>
Date: 星期二, 25 一月 2022 12:26:09 +0800
Subject: [PATCH] Merge branch 'Phase3' of https://dev.pollex.com.tw:8443/r/pcalife/PAM into Phase3

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

diff --git a/PAMapp/pages/appointment/_appointmentId/close/index.vue b/PAMapp/pages/appointment/_appointmentId/close/index.vue
index 956280e..bc59019 100644
--- a/PAMapp/pages/appointment/_appointmentId/close/index.vue
+++ b/PAMapp/pages/appointment/_appointmentId/close/index.vue
@@ -43,10 +43,10 @@
         <el-row
           type="flex"
           class="pam-paragraph">
-          <UiField label="�脖辣����" :labelSize="20">
+          <UiField label="�脖辣����" :labelSize="20" class="required">
             <DateTimePicker
               :defaultValue="appointmentCloseInfo.policyEntryDate"
-              @changeDateTime="appointmentCloseInfo.policyEntryDate = $event"></DateTimePicker>
+              @changeDateTime="appointmentCloseDate = $event"></DateTimePicker>
           </UiField>
         </el-row>
       </template>
@@ -55,26 +55,16 @@
         <el-row
           class="pam-paragraph">
           <UiField label="���漱����" :labelSize="20" class="required">
+            <UiSelect :closeReason.sync="appointmentCloseInfo.closedReason"
+              :options="appointmentFailReason"/>
           </UiField>
-            <div class="appointment-client-detail-close__select-box">
-              <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 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 mt-10"
+            v-model="appointmentCloseInfo.closedOtherReason"
+            placeholder="隢撓�������50摮��"
+            type="text">
         </el-row>
       </template>
 
@@ -139,7 +129,7 @@
     closedOtherReason     : '',
     closedReason          : 'other',
     planCode              : '',
-    policyEntryDate       : this.appointmentCloseDate,
+    policyEntryDate       : '',
     policyholderIdentityId: '',
     remark                : '',
     selectCloseOption     : this.contactStatus.DONE,
@@ -179,6 +169,7 @@
                                 ? this.contactStatus.DONE
                                 : this.contactStatus.CLOSE
       };
+      this.appointmentCloseDate = closedInfo?.policyEntryDate;
     }
   }
 
@@ -191,7 +182,7 @@
         appointmentId         : appointmentId,
         contactStatus         : this.contactStatus.DONE,
         planCode              : this.appointmentCloseInfo.planCode,
-        policyEntryDate       : this.appointmentCloseInfo.policyEntryDate,
+        policyEntryDate       : this.appointmentCloseDate,
         policyholderIdentityId: this.appointmentCloseInfo.policyholderIdentityId,
         remark                : this.appointmentCloseInfo.remark,
       }
@@ -205,8 +196,11 @@
         contactStatus    : this.contactStatus.CLOSE,
         remark           : this.appointmentCloseInfo.remark,
       }
-      appointmentService.closeAppointment(toCloseAppointment).then((_) => this.updateAppointmentDetail(appointmentId));
-      this.isShowSuccessAlert = true;
+      appointmentService.closeAppointment(toCloseAppointment).then((_) => {
+        this.updateAppointmentDetail(appointmentId);
+        this.isShowSuccessAlert = true;
+      });
+
     }
   }
 
@@ -214,6 +208,27 @@
     this.isShowSuccessAlert = false ;
     this.$router.push(`/myAppointmentList/contactedList`);
   }
+
+  checkIdentityId (id) {
+  const tab = "ABCDEFGHJKLMNPQRSTUVXYWZIO";
+  const A1 = [ 1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3 ];
+  const A2 = [ 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5 ];
+  const Mx = [ 9,8,7,6,5,4,3,2,1,1 ];
+
+  if ( id.length != 10 ) return false;
+  let i = tab.indexOf( id.charAt(0) );
+  if ( i == -1 ) return false;
+  let sum = A1[i] + A2[i]*9;
+
+  for ( i=1; i<10; i++ ) {
+    const v = parseInt( id.charAt(i) );
+    if ( isNaN(v) ) return false;
+    sum = sum + v * Mx[i];
+  }
+
+  if ( sum % 10 != 0 ) return false;
+  return true;
+}
 
   get isSubmitBtnDisabled() {
     const {
@@ -224,9 +239,8 @@
       closedOtherReason,
       remark
     } = this.appointmentCloseInfo;
-    // this.appointmentCloseInfo.policyEntryDate 銝行��齒瘜��澆 this.appointmentCloseDate
     if (selectCloseOption === this.contactStatus.DONE) {
-      return !policyholderIdentityId || !this.identityIdValid || !planCode || !this.appointmentCloseInfo.policyEntryDate || !remark
+      return !policyholderIdentityId || !this.identityIdValid || !planCode || !this.appointmentCloseDate
     } else if (closedReason === 'other' || closedReason === 'no_suitable_commodity') {
       return !closedOtherReason
     }
@@ -234,9 +248,8 @@
   }
 
   get identityIdValid() {
-    const rule = /^[A-Z]\d{9}$/;
     const identityId = this.appointmentCloseInfo.policyholderIdentityId;
-    return identityId ? rule.test(identityId) : true;
+    return identityId ? this.checkIdentityId(identityId) : true;
   }
 
 }
@@ -244,8 +257,7 @@
 
 <style lang="scss" scoped>
 .appointment-close__remark,
-.appointment-client-detail-close__input,
-.appointment-client-detail-close__select {
+.appointment-client-detail-close__input {
   border-radius: 5px;
   border   : 1px solid #707070;
   font-size: 20px;
@@ -257,18 +269,6 @@
   }
   &.is-invalid {
     border-color: $PRIMARY_RED !important;
-  }
-}
-.appointment-client-detail-close__select-box {
-  position: relative;
-
-  & .appointment-client-detail-close__select{
-    appearance: none;
-  }
-  & .down-icon {
-    position: absolute;
-    right: 7px;
-    bottom: 10px;
   }
 }
 .invite-review{
@@ -286,11 +286,11 @@
 
     &::before {
       content: '*';
-      font-size: 20px;
+      font-size: 15px;
       font-weight: bold;
       position: absolute;
       color: #FF0000;
-      transform: translateX(-5px);
+      transform: translateX(-2px);
       z-index: 5;
     }
   }

--
Gitblit v1.8.0