保誠-保戶業務員媒合平台
Tomas
2022-01-17 8330d39b4274453e569fcbd673902b0c5f64df53
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<template>
  <div class="appointment-client-detail-close-page">
 
      <el-row
        type="flex"
        class="pam-paragraph">
        <UiField label="歸檔方式" :labelSize="20">
          <SingleSelectBtn class="mt-10"
            :singleSelected.sync="appointmentCloseInfo.selectCloseOption"
            :options="closeOptions" />
        </UiField>
      </el-row>
 
      <template v-if="appointmentCloseInfo.selectCloseOption === 'done'">
        <el-row
          type="flex"
          class="pam-paragraph">
          <UiField label="保戶身分證字號" :labelSize="20">
            <input
              class="appointment-client-detail-close__input"
              v-model="appointmentCloseInfo.policyholderIdentityId"
              placeholder="請輸入"
              type="text">
          </UiField>
        </el-row>
 
        <el-row
          type="flex"
          class="pam-paragraph">
          <UiField label="商品代碼Plan Code" :labelSize="20">
            <input
              class="appointment-client-detail-close__input"
              v-model="appointmentCloseInfo.planCode"
              placeholder="請輸入"
              type="text">
          </UiField>
        </el-row>
 
        <el-row
          type="flex"
          class="pam-paragraph">
          <UiField label="進件時間" :labelSize="20">
            <input
              class="appointment-client-detail-close__input"
              v-model="appointmentCloseInfo.planCode"
              placeholder="TBD: 日期元件"
              type="text">
          </UiField>
        </el-row>
      </template>
 
      <template v-if="appointmentCloseInfo.selectCloseOption === 'close'">
        <el-row
          class="pam-paragraph">
          <UiField label="未成交原因" :labelSize="20">
          </UiField>
              <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>
 
              <div style="display: flex" class="mt-10">
 
                <input
                  v-if="appointmentCloseInfo.closedReason === 'other'"
                  class="appointment-client-detail-close__input"
                  v-model="appointmentCloseInfo.closedOtherReason"
                  placeholder="請輸入原因,限50字。"
                  type="text">
              </div>
        </el-row>
      </template>
 
      <el-row
        type="flex"
        class="pam-paragraph">
        <UiField label="備註" :labelSize="20">
          <el-input
            type="textarea"
            :rows="3"
            placeholder="請輸入"
            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>
 
      <el-row
        type="flex"
        justify="center"
        class="pam-paragraph">
        <el-button @click="$router.go(-1)">取消</el-button>
        <el-button @click="closeAppointment">確認</el-button>
      </el-row>
 
  </div>
</template>
 
<script lang="ts">
 
import { Vue, Component } from 'vue-property-decorator';
import { ToCloseAppointment, ToDoneAppointment } from '~/shared/models/appointment.model';
import { ContactStatus } from '~/shared/models/enum/contact-status';
 
import appointmentService from '~/shared/services/appointment.service';
 
@Component
export default class AppointmentDetailCloseComponent extends Vue {
 
  contactStatus = ContactStatus;
 
  appointmentCloseInfo = {
    closedOtherReason     : '',
    closedReason          : 'other',
    planCode              : '',
    policyEntryDate       : '',
    policyholderIdentityId: '',
    remark                : '',
    selectCloseOption     : 'done',
  };
 
  closeOptions = [
    {
      title:'成交',
      label: 'done',
    },
    {
      title:'未成交',
      label: 'close',
    }
  ];
 
  appointmentFailReason = [
    {
      key: '其他',
      value: 'other'
    }
  ];
 
  closeAppointment(): void {
    const appointmentId = +this.$route.params.appointmentId;
    if (this.appointmentCloseInfo.selectCloseOption === 'done') {
      const toDoneAppointment: ToDoneAppointment = {
        appointmentId         : appointmentId,
        contactStatus         : this.contactStatus.DONE,
        planCode              : this.appointmentCloseInfo.planCode,
        policyEntryDate       : this.appointmentCloseInfo.policyEntryDate,
        policyholderIdentityId: this.appointmentCloseInfo.policyholderIdentityId,
      }
      appointmentService.closeAppointment(toDoneAppointment).then((res) => res);
    } else {
      const toCloseAppointment: ToCloseAppointment = {
        appointmentId    : appointmentId,
        closedOtherReason: this.appointmentCloseInfo.closedOtherReason,
        closedReason     : this.appointmentCloseInfo.closedReason,
        contactStatus    : this.contactStatus.CLOSE,
        remark           : this.appointmentCloseInfo.remark,
      }
      appointmentService.closeAppointment(toCloseAppointment).then((res) => res);
    }
  }
 
}
</script>
 
<style lang="scss" scoped>
.appointment-close__remark,
.appointment-client-detail-close__input,
.appointment-client-detail-close__select {
  border-radius: 5px;
  border   : 1px solid #707070;
  font-size: 20px;
  padding  : 10px 20px;
  width    : 100%;
  &::placeholder {
    color: $MID_GREY;
  }
}
</style>