From ab4e8129d5c94ff96e6c85d0d2b66a04a052b4e5 Mon Sep 17 00:00:00 2001
From: HelenHuang <LinHuang@pollex.com.tw>
Date: 星期四, 09 六月 2022 15:26:15 +0800
Subject: [PATCH] TODO#139888 嚴選配對 - 文案修改

---
 PAMapp/pages/questionnaire/_agentNo.vue |  106 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 82 insertions(+), 24 deletions(-)

diff --git a/PAMapp/pages/questionnaire/_agentNo.vue b/PAMapp/pages/questionnaire/_agentNo.vue
index cc1ccc5..4e55158 100644
--- a/PAMapp/pages/questionnaire/_agentNo.vue
+++ b/PAMapp/pages/questionnaire/_agentNo.vue
@@ -23,9 +23,13 @@
               <div class="mdTxt">�隞��蝜急撘�</div>
               <div class="ques-header__input-block">
                   <span>Email嚗�</span>
-                  <input class="ques-header__input"
+                  <input class="ques-header__input  break"
+                    :class="{ 'is-invalid': !emailValid}"
                     placeholder="隢撓�"
                     v-model="myRequest.email">
+              </div>
+              <div class="error mt-5 mb-5" style="margin-left:65px">
+                  <span v-show="!emailValid">Email�撘�炊</span>
               </div>
           </div>
         </div>
@@ -34,14 +38,14 @@
               <div class="mdTxt">�����蝜急撘�</div>
               <div class="mt-10 ques-header__input-block">
                   <span>Email嚗�</span>
-                  <span>{{myRequest.email}}</span>
+                  <span class=" break">{{myRequest.email}}</span>
               </div>
           </div>
           <div class="mt-30">
               <div class="mdTxt">�隞��蝜急撘�</div>
               <div class="ques-header__input-block">
-                  <span>�����</span>
-                  <input class="ques-header__input"
+                  <span>���� : </span>
+                  <input class="ques-header__input ml-4"
                     :class="{'is-invalid': !phoneValid}"
                     placeholder="隢撓�"
                     maxlength="10"
@@ -63,7 +67,7 @@
     <div class="ques-container">
       <div class="pam-paragraph">
         <div class="mdTxt">
-            �閬岷������
+            �鈭圾�����
             <span class="hint text--bold">
                 (�銴)
             </span>
@@ -99,7 +103,7 @@
 
     <PopUpFrame :isOpen.sync="showDrawer">
       <div class="qaTextTitle mdTxt">
-        <strong>�閬岷������</strong>
+        <strong>�鈭圾�����</strong>
       </div>
       <div class="qa-dialog">
           <div v-for="(qaText,index) in quesAboutList" :key="index" >
@@ -128,7 +132,7 @@
         <div class="text--center mdTxt">
           <el-button @click="closeReservePopUp">����</el-button>
           <el-button type="primary"
-            @click="closeReservePopUp">
+            @click="reviewPlatform">
             �
           </el-button>
         </div>
@@ -152,14 +156,19 @@
 import { getRequestsFromStorage, removeRequestQuestionFromStorage, setRequestsToStorage } from '~/shared/storageRequests';
 import _ from 'lodash';
 
+import accountSettingService from '~/shared/services/account-setting.service';
 import appointmentService from '~/shared/services/appointment.service';
 import authService from '~/shared/services/auth.service';
 import queryConsultantService from '~/shared/services/query-consultant.service';
+import reviewsService from '~/shared/services/reviews.service';
 import { Consultant } from '~/shared/models/consultant.model';
 import { ContactType } from '~/shared/models/enum/ContactType';
 import { Gender } from '~/shared/models/enum/Gender';
 import { RegisterInfo } from '~/shared/models/registerInfo';
 import { AppointmentParams, AppointmentRequests } from '~/shared/models/appointment.model';
+import { UserSetting } from '~/shared/models/account.model';
+import { SatisfactionType } from '~/shared/models/enum/satisfaction-type';
+import { UserReviewParams } from '~/shared/models/reviews.model';
 
   const roleStorage = namespace('localStorage');
   @Component
@@ -176,7 +185,10 @@
     @roleStorage.State
     recommendConsultantItem!:string;
 
-    score ="" ;
+    @roleStorage.Mutation
+    storageUserInfo!: (params: RegisterInfo) => void;
+
+    score = 0;
 
     genderOptions=[
       {
@@ -275,8 +287,9 @@
     ];
 
     myRequest: AppointmentRequests = {
-      phone          : this.userInfo?.phone ? this.userInfo.phone                               : '',
-      email          : this.userInfo?.email ? this.userInfo.email                               : '',
+      name           : '',
+      phone          : '',
+      email          : '',
       contactType    : _.isEqual(this.userInfo?.contactType,ContactType.SMS) ? ContactType.PHONE: ContactType.EMAIL,
       gender         : '',
       age            : '',
@@ -343,6 +356,17 @@
         }
         removeRequestQuestionFromStorage();
       }
+
+      if (authService.isUserLogin()) {
+        accountSettingService.getUserAccountSetting().then((contactTypeDetail) => {
+              this.myRequest = {
+                ...this.myRequest,
+                ...contactTypeDetail
+              }
+        })
+      }
+
+
     }
 
     ////////////////////////////////////////////////////////////////////////////
@@ -378,19 +402,20 @@
 
     private getReservedData(appointmentInfo) {
       if (appointmentInfo) {
-        const hopeContactTime = appointmentInfo!.hopeContactTime.split("'")
-              .filter(item => item && item !== ',');
-        this.getAppointmentId(appointmentInfo);
-
-        return {
-            ...appointmentInfo,
-            hopeContactTime: hopeContactTime.map(item => {
+        const hopeContactTime = appointmentInfo!.hopeContactTime
+          ?  appointmentInfo!.hopeContactTime.split("'").filter(item => item && item !== ',').map(item => {
                 const info = item.split('��');
                 return {
                     selectWeekOptions: info[0].split(','),
                     selectTimesOptions: info[1].split(',')
                 }
-            }),
+            })
+          :[{selectWeekOptions : [],selectTimesOptions: []}];
+        this.getAppointmentId(appointmentInfo);
+
+        return {
+            ...appointmentInfo,
+            hopeContactTime: hopeContactTime,
             requirement: appointmentInfo.requirement.split(',')
           }
       } else {
@@ -411,8 +436,17 @@
       if (this.isEditBtn) {
         this.editAppointmentDemand();
       } else {
-        queryConsultantService.addFavoriteConsultant([this.$route.params.agentNo]).then(res => this.sentAppointmentDemand());
+        queryConsultantService.addFavoriteConsultant([{ agentNo: this.$route.params.agentNo, createdTime: new Date().toISOString()}]).then(res => this.sentAppointmentDemand());
       }
+       const editSettingInfo: UserSetting = {
+          name: this.myRequest.name,
+          phone: this.myRequest.phone,
+          email: this.myRequest.email,
+      }
+
+      accountSettingService.updateAccountSetting(editSettingInfo).then((_) => {
+          this.storageUserInfo(this.userInfo);
+      });
     }
 
     private editAppointmentDemand() {
@@ -441,6 +475,7 @@
         queryConsultantService.appointmentDemand(data).then(res => {
             this.sendReserve = true;
             this.myRequest.hopeContactTime = [];
+            this.appointmentId = res['id'];
             setRequestsToStorage(this.myRequest);
         });
     }
@@ -450,6 +485,17 @@
         return selectedHopeContactTime.map(i => {
             return `'${i.selectWeekOptions}��${i.selectTimesOptions}'`}
         ).toString();
+    }
+
+    reviewPlatform(): void {
+      const reviewPlatformParams: UserReviewParams = {
+        appointmentId: this.appointmentId,
+        score: this.score,
+        type: SatisfactionType.SYSTEM
+      };
+      reviewsService.reviewPlatform(reviewPlatformParams).then((_) => {
+        this.closeReservePopUp();
+      });
     }
 
     closeReservePopUp() {
@@ -466,6 +512,11 @@
             : true;
     }
 
+    get emailValid() {
+      const rule = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
+      return this.myRequest.email ? rule.test(this.myRequest.email) : true;
+    }
+
     get userInfo(): RegisterInfo {
       const initUserInfo = JSON.parse(localStorage.getItem('userInfo')!);
       return initUserInfo;
@@ -473,7 +524,7 @@
 
     get isDisabledSubmitBtn(): boolean {
            return _.includes(this.myRequest.contactType,ContactType.PHONE)
-      ? !this.isHopeContactTimeDone()
+      ? !this.isHopeContactTimeDone() || !this.emailValid
       : !this.phoneValid;
     }
 
@@ -499,7 +550,9 @@
   color: #ED1B2E;
   cursor: pointer;
 }
-
+.error {
+  color:$PRIMARY_RED
+}
 //����見撘����
 .ques-footer{
   justify-content: center;
@@ -561,7 +614,10 @@
       transform: translate(-12px, 0);
   }
 }
-
+.break{
+  word-break: break-all;
+  line-height: 1.2;
+}
 .ques-page--reset.pam-page-container {
   margin: 0px auto;
 }
@@ -594,7 +650,7 @@
     @extend .text--middle,.mt-10 ;
     .ques-header__input{
       &.is-invalid{
-        border: 2px solid $PRIMARY_RED !important;
+        border: 1px solid $PRIMARY_RED !important;
       }
       flex: 1;
       height: 50px;
@@ -607,7 +663,9 @@
       -moz-box-sizing: border-box;
     }
   }
-
+  .ml-4{
+    margin-left: 4px;
+  }
   .ques-container {
     position: relative;
     margin: 0px 20px;

--
Gitblit v1.8.0