保誠-保戶業務員媒合平台
Jack
2021-12-29 f8c7e51fc52be25eb12fffd81eb6d1b4ce8075a1
PAMapp/pages/agentInfo/edit/_agentNo.vue
@@ -8,7 +8,6 @@
          :agentNo="agentInfo.agentNo">
        </UiAvatar>
      </el-row>
      <el-row
        type="flex"
        class="pt-10"
@@ -101,7 +100,6 @@
            v-for="(communicateStyle, index) in communicationStyleList">
          </el-checkbox>
        </UiField>
      </el-row>
      <el-row
        type="flex"
@@ -154,7 +152,16 @@
            </div>
        </div>
    </PopUpFrame>
    <PopUpFrame :isOpen.sync="isInfoUpdate">
      <div class="text--center mdTxt fs-18">
        <p class="mt-20 text--center ">帳號資訊更新成功</p>
        <el-button
                type="primary"
                @click="backToInfo"
                class="mt-20"
              >我知道了</el-button>
      </div>
    </PopUpFrame>
    <div class="pam-paragraph account-confirm">
      <el-button :disabled="isSubmitBtnDisabled"
        @click.native="editAgentInfoSetting">
@@ -194,22 +201,24 @@
  fieldInfoTitle  : string = '';
  hideReviews     : boolean = hideReviews ;
  isAlertFieldInfo: boolean = false;
  isInfoUpdate    : boolean = false;
  editInfoValue = {
    agentNo           : '',
    name              : '',
    expertise            : [] as string[],
    expertise         : [] as string[],
    title             : '',
    serveArea         : '',
    companyAddress    : '',
    seniorityYear     : 1,
    seniorityMonth    : 0,
    concept           : '',
    experiences        : '',
    experiences       : '',
    awards            : '',
    communicationStyle: [] as string[],
    photoBase64       : '',
  };
  communicationStyleList: string[] = agentCommunicationStyleList;
  expertList: string[] = agentExpertList;
  role           = Role;
@@ -226,10 +235,10 @@
  mounted(){
    this.setAgentInfo(this.agentInfo);
  }
  /////////////////////////////////////////////////////////////////////////////
  private setAgentInfo(agentInfo: AgentInfo): void {
    const [agentYear, _yearUnit , agentMonth, _monthUnit] =  agentInfo.seniority.split(" ");
    this._agentInfoSetting = {
      agentNo           : agentInfo.agentNo||'',
      name              : agentInfo.name || '',
@@ -240,25 +249,39 @@
      gender            : agentInfo.gender||'',
      phoneNumber       : agentInfo.phoneNumber||'',
      companyAddress    : agentInfo.companyAddress || '',
      seniorityYear     : agentYear? +agentYear     : 0,
      seniorityMonth    : agentMonth ? +agentMonth  : 0,
      seniorityYear     : agentYear? +agentYear : 0,
      seniorityMonth    : agentMonth ? +agentMonth : 0,
      concept           : agentInfo.concept || '',
      experiences       : agentInfo.experiences  || '',
      awards            : agentInfo.awards || '',
      communicationStyle: agentInfo.communicationStyle || '',
      photoBase64       : '',
      photoBase64       : ''
    };
    this.editInfoValue = {
      ...this._agentInfoSetting,
      expertise          : _.cloneDeep(this._agentInfoSetting.expertise),
      // TODO: 確認後端此欄位後端應改為以" , "隔開 [Tomas, 2021/12/28]
      communicationStyle : this._agentInfoSetting.communicationStyle.split('、')
      communicationStyle : this._agentInfoSetting.communicationStyle.split('、'),
    }
  }
  //////////////////////////////////////////////////////////////////////
  editAgentInfoSetting(): void {
    const editSettingInfo: any = {
      ...this.editInfoValue,
      communicationStyle: this.editInfoValue.communicationStyle.join('、'),
    }
    accountSettingService.editAgentInfoSetting(editSettingInfo).then((res: AgentInfoSetting) => {
      console.log(editSettingInfo)
    });
    this.isInfoUpdate = true;
  }
  backToInfo() {
    this.isInfoUpdate = false
    this.$router.push(`/agentInfo/${this.agentInfo.agentNo}`);
    }
  alertFieldInfo(field: string): void {
    this.isAlertFieldInfo = true;
    switch(field) {
@@ -272,9 +295,7 @@
        break;
    }
  }
  ////////////////////////////////////////////////////////////
  get isSubmitBtnDisabled(): boolean {
      const isFormValid =  this.editInfoValue.name
                        && this.editInfoValue.title
@@ -289,21 +310,6 @@
                        && this.editInfoValue.communicationStyle;
      return !isFormValid
  }
  editAgentInfoSetting(): void {
    const editSettingInfo: any = {
      ...this.editInfoValue,
      communicationStyle: this.editInfoValue.communicationStyle.join('、'),
      photoBase64       : '',
    }
    accountSettingService.editAgentInfoSetting(editSettingInfo).then((res: AgentInfoSetting) => {
      console.log(editSettingInfo)
    });
  }
}
</script>
@@ -366,5 +372,4 @@
  width       : 50px;
  margin-right: 5px;
}
</style>