06e347c5 by joe

客户服务信息更新

1 parent 08eea576
Showing 40 changed files with 212 additions and 53 deletions
......@@ -8,8 +8,11 @@
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" href="./css/pure-min.css">
<link rel="stylesheet" href="./css/grids-responsive-min.css">
<!--[if gt IE 6]>
<![endif]-->
<title>平安人寿保险官网</title>
<link href="static/js/0.1575514351062.js" rel="prefetch"><link href="static/js/1.1575514351062.js" rel="prefetch"><link href="static/js/10.1575514351062.js" rel="prefetch"><link href="static/js/11.1575514351062.js" rel="prefetch"><link href="static/js/12.1575514351062.js" rel="prefetch"><link href="static/js/13.1575514351062.js" rel="prefetch"><link href="static/js/14.1575514351062.js" rel="prefetch"><link href="static/js/15.1575514351062.js" rel="prefetch"><link href="static/js/16.1575514351062.js" rel="prefetch"><link href="static/js/17.1575514351062.js" rel="prefetch"><link href="static/js/18.1575514351062.js" rel="prefetch"><link href="static/js/2.1575514351062.js" rel="prefetch"><link href="static/js/3.1575514351062.js" rel="prefetch"><link href="static/js/4.1575514351062.js" rel="prefetch"><link href="static/js/5.1575514351062.js" rel="prefetch"><link href="static/js/6.1575514351062.js" rel="prefetch"><link href="static/js/7.1575514351062.js" rel="prefetch"><link href="static/js/8.1575514351062.js" rel="prefetch"><link href="static/js/9.1575514351062.js" rel="prefetch"><link href="static/js/app.1575514351062.js" rel="preload" as="script"></head>
<link href="static/js/0.1575886985498.js" rel="prefetch"><link href="static/js/1.1575886985498.js" rel="prefetch"><link href="static/js/10.1575886985498.js" rel="prefetch"><link href="static/js/11.1575886985498.js" rel="prefetch"><link href="static/js/12.1575886985498.js" rel="prefetch"><link href="static/js/13.1575886985498.js" rel="prefetch"><link href="static/js/14.1575886985498.js" rel="prefetch"><link href="static/js/15.1575886985498.js" rel="prefetch"><link href="static/js/16.1575886985498.js" rel="prefetch"><link href="static/js/17.1575886985498.js" rel="prefetch"><link href="static/js/18.1575886985498.js" rel="prefetch"><link href="static/js/19.1575886985498.js" rel="prefetch"><link href="static/js/2.1575886985498.js" rel="prefetch"><link href="static/js/20.1575886985498.js" rel="prefetch"><link href="static/js/21.1575886985498.js" rel="prefetch"><link href="static/js/3.1575886985498.js" rel="prefetch"><link href="static/js/4.1575886985498.js" rel="prefetch"><link href="static/js/5.1575886985498.js" rel="prefetch"><link href="static/js/6.1575886985498.js" rel="prefetch"><link href="static/js/7.1575886985498.js" rel="prefetch"><link href="static/js/8.1575886985498.js" rel="prefetch"><link href="static/js/9.1575886985498.js" rel="prefetch"><link href="static/js/app.1575886985498.js" rel="preload" as="script"></head>
<body>
<noscript>
......@@ -19,6 +22,6 @@
<div id="app"></div>
<!-- built files will be auto injected -->
<script src="./js/unionrsa.js"></script>
<script type="text/javascript" src="static/js/app.1575514351062.js"></script></body>
<script type="text/javascript" src="static/js/app.1575886985498.js"></script></body>
</html>
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
......@@ -52,4 +52,6 @@ module.exports = {
updatePolicyContanct : "/pingan_hklife_webapi/policy/updateContacts",
// 保单客戶資料變更
updatePolicyInfo : "/pingan_hklife_webapi/policy/updateInfo",
// 证件上传
idPicUpload : "/pingan_hklife_webapi/policy/idPicUpload",
}
\ No newline at end of file
......
......@@ -181,7 +181,21 @@ export const httpPost = params => {
export const formdata = params => {
let {
url,
data
data,
sid,
} = params;
return axios.post(`${base}${url}`, data, formDataHeaders).then(res => res.data);
let headers = {
headers : {
"Content-Type": "multipart/form-data"
}
}
let formData = new FormData(); //使用formData对象
for (let key in data) {
formData.append(key, data[key]);
}
if (sid) {
let sessionId = state.userInfo && state.userInfo.sid ? state.userInfo.sid : "";
headers.headers.sid = sessionId;
}
return axios.post(`${base}${url}`, formData, headers).then(res => res.data);
}
......
......@@ -3,6 +3,7 @@ import {
httpGet,
httpPost
} from '@/api/fetch-api.js'
import { read } from 'fs';
export default {
......@@ -76,37 +77,72 @@ export default {
},
data() {
return {
key: 'value'
key: 'value',
frontPicSrc: null,
backPicSrc: null,
frontPicFile: null,
backPicFile: null
}
},
components: {},
computed: {
submitBtnDisabled() {
let b1 = this.frontPicFile ? false : true;
let b2 = this.backPicFile ? false : true;
return b1 || b2;
}
},
methods: {
// 点击确认
onConfirmHandler() {
if (this.confirm) {
this.confirm();
if (this.submitBtnDisabled) {
return;
}
this.$emit("onSubmit", { front: this.frontPicFile, back: this.backPicFile });
},
handlePicSelect(type) {
let _this = this;
let input = document.createElement("input");
input.setAttribute("type", "file");
input.setAttribute("accept", "image/*");
input.onchange = function (val) {
var reader = new FileReader();
reader.onload = function (e) {
if (type == 'front') {
_this.$set(_this, 'frontPicSrc', reader.result);
} else {
_this.$set(_this, 'backPicSrc', reader.result);
}
}
let file = input.files[0];
if (type == 'front') {
_this.$set(_this, 'frontPicFile', file);
} else {
_this.$set(_this, 'backPicFile', file);
}
reader.readAsDataURL(file);
};
input.click();
},
// 点击取消
onCancelHandler() {
if (this.cancel) {
this.cancel();
}
this.$emit("close");
},
// 点击关闭
onCloseHandler() {
if (this.close) {
this.close();
}
this.$emit("close");
},
// 点击蒙层
onOverLayHandler() {
if (this.overlay) {
this.overlay();
}
this.$emit("close");
},
initData() {}
init() {
this.frontPicFile = null;
this.backPicFile = null;
this.frontPicSrc = null;
this.backPicSrc = null;
}
},
mounted() {},
created() {}
mounted() { },
created() { }
}
......
......@@ -70,6 +70,11 @@
&-item {
padding: 0 $marginSmallHalf;
max-width: 15.583333rem ;
img {
width: 100%;
}
}
}
}
......
......@@ -11,17 +11,17 @@
<div class="gird-g upload">
<div class="pure-u-1 pure-u-md-1-2 upload-item">
<div class="tit"> {{$t('form.modalUploadCard.front')}}</div>
<img class="poster pointer" :src="require('@assets/images/common/card-front.png')" alt="">
<img class="poster pointer" :src="frontPicSrc || require('@assets/images/common/card-front.png')" alt="" @click="handlePicSelect('front')">
</div>
<div class="pure-u-1 pure-u-md-1-2 upload-item">
<div class="tit"> {{$t('form.modalUploadCard.back')}}</div>
<img class="poster pointer" :src="require('@assets/images/common/card-back.png')" alt="">
<img class="poster pointer" :src="backPicSrc || require('@assets/images/common/card-back.png')" alt="" @click="handlePicSelect('back')">
</div>
</div>
</div>
<div class="modal-btn-wrap">
<div @click="onCancelHandler()" v-if="showCancel" class="btn">{{cancelText}}</div>
<div @click="onConfirmHandler()" v-if="showConfirm" class="btn">{{confirmText}}</div>
<div @click="onConfirmHandler()" v-if="showConfirm" class="btn" :class="{disabled: submitBtnDisabled}">{{confirmText}}</div>
</div>
</div>
</div>
......
import api from '@/api/api'
import {
httpGet,
formdata,
httpPost
} from '@/api/fetch-api.js'
......@@ -23,6 +23,9 @@ export default {
data: null,
// 保单信息
policy: null,
// ID证件照引用
idFront: null,
idBack: null,
// 模态窗
modalSimpleVisiable: false,
......@@ -79,49 +82,77 @@ export default {
url: api.policyDetail,
data: param,
sid: true
}).then(response => {
}).then(res => {
this.loading = false;
if (response) {
this.policy = response;
if (res) {
this.policy = res;
let clientName = res.clientNameCn ? res.clientNameCn : res.clientNameEn;
let insuredName = res.insuredNameCn ? res.insuredNameCn : res.insuredNameEn;
this.policy.clientName = clientName;
this.policy.insuredName = insuredName;
// 证件类型、证件号要备份,用于比较
this.policy.clientIdTypeBak = this.policy.clientIdType;
this.policy.clientIdNumberBak = this.policy.clientIdNumber;
this.policy.insuredIdTypeBak = this.policy.insuredIdType;
this.policy.insuredIdNumberBak = this.policy.insuredIdNumber;
this.initData();
}
}).catch(res => {
}).catch(err => {
this.loading = false;
if (res.code == "404") {
this.$refs.auth.noAuth();
}
this.handleErrResponse(err);
});
},
initData() {
this.idFront = null;
this.idBack = null;
let res = this.policy;
let name = "";
if (res) {
let isOwner = this.isOwner;
if (isOwner) {
name = res.clientNameCn ? res.clientNameCn : res.clientNameEn;
} else {
name = res.insuredNameCn ? res.insuredNameCn : res.insuredNameEn;
}
let data = {
name: name,
name: isOwner ? res.clientName : res.insuredName,
idType: isOwner ? res.clientIdType : res.insuredIdType,
idNumber: isOwner ? res.clientIdNumber : res.insuredIdNumber,
idExpireAt: isOwner ? res.clientExpireAt : res.insurantExpireAt,
nature: isOwner ? res.clientNationality : res.insurantNationality,
company: isOwner ? res.clientCompany : res.insurantCompany,
marriage: isOwner ? res.clientMarriage : res.insurantMarriage,
idExpireAt: isOwner ? res.clientExpireAt : res.insuredExpireAt,
nature: isOwner ? res.clientNationality : res.insuredNationality,
company: isOwner ? res.clientCompany : res.insuredCompany,
marriage: isOwner ? res.clientMarriage : res.insuredMarriage,
sex: isOwner ? res.clientSex : res.insuredSex,
birthday: isOwner ? res.clientBirthday : res.insuredBirthday
};
data.sex = data.sex ? data.sex : "M";
console.log("data ===", data);
this.$set(this, 'data', data);
}
},
handlePolicySelect(data) {
this.selectedPolicies = data;
this.loadData();
},
handleUpdatePolicy() {
let showUploadPicDialog = false;
if (this.isOwner) {
showUploadPicDialog = (this.policy.clientIdType != this.data.idType || this.policy.clientIdNumber != this.data.idNumber);
} else {
showUploadPicDialog = (this.policy.insuredIdType != this.data.idType || this.policy.insuredIdNumber != this.data.idNumber);
}
if (showUploadPicDialog) {
this.modalUploadCardVisiable = true;
} else {
this.updatePolicyInfo();
}
},
handleUpdatePolicyWithFile(data) {
console.log("handleUpdatePolicyWithFile");
this.idFront = data.front;
this.idBack = data.back;
console.log(data)
console.log(this.idFront)
console.log(this.idBack)
this.updatePolicyIdPic().then(() => {
this.updatePolicyInfo();
});
},
updatePolicyInfo() {
console.log(1, this.loading);
if (this.loading) {
return;
}
......@@ -133,18 +164,81 @@ export default {
param.policyId = this.selectedPolicies[0].id;
param.policyCode = this.selectedPolicies[0].code;
console.log("2,", param);
httpPost({ url: api.updatePolicyInfo, data: param, sid: true }).then(res => {
console.log("3,", res);
this.loading = false;
this.showModal(this.i18n.policyChangeInformation.success);
}).catch(err => {
this.loading = false;
this.handleErrResponse(err);
});
},
updatePolicyIdPic() {
return new Promise((resolve, reject) => {
if (this.loading) {
return;
}
this.loading = true;
let param = {
policyId: this.selectedPolicies[0].id,
policyCode: this.selectedPolicies[0].code,
modifyObj: this.isOwner ? 1 : 2,
front: this.idFront,
back: this.idBack
};
this.modalUploadCardVisiable = false;
formdata({ url: api.idPicUpload, data: param, sid: true }).then(res => {
this.loading = false;
resolve();
}).catch(err => {
this.loading = false;
this.handleErrResponse(err);
});
});
},
switchPolicyRole(role) {
if (this.isOwner && role == 1) {
return;
}
if (!this.isOwner && role == 2) {
return;
}
if (this.policy) {
if (role == 1) {
// 需要缓存结果,注意取反,此处存在受保人信息
this.policy.insuredName = this.data.name;
this.policy.insuredIdType = this.data.idType;
this.policy.insuredIdNumber = this.data.idNumber;
this.policy.insuredExpireAt = this.data.idExpireAt;
this.policy.insuredNationality = this.data.nature;
this.policy.insuredCompany = this.data.company;
this.policy.insuredMarriage = this.data.marriage;
this.policy.insuredSex = this.data.sex;
this.policy.insuredBirthday = this.data.birthday;
} else {
// 需要缓存结果,注意取反,此处存在投保人信息
this.policy.clientName = this.data.name;
this.policy.clientIdType = this.data.idType;
this.policy.clientIdNumber = this.data.idNumber;
this.policy.clientExpireAt = this.data.idExpireAt;
this.policy.clientNationality = this.data.nature;
this.policy.clientCompany = this.data.company;
this.policy.clientMarriage = this.data.marriage;
this.policy.clientSex = this.data.sex;
this.policy.clientBirthday = this.data.birthday;
}
}
this.isOwner = role == 1 ? true : false;
this.initData();
},
handleErrResponse(err) {
if (err) {
if (err.code == 404) {
this.$refs.auth.noAuth();
}
});
if (err.errMsg) {
this.showModal(errMsg, 'info');
}
}
},
userLogout() {
this.showForm = false;
......@@ -154,7 +248,7 @@ export default {
}
},
mounted() {
this.isOwner = this.$route.query.u == 1 ? true : false;
this.isOwner = this.$route.query.u == 2 ? false : true;
},
created() { }
}
......
......@@ -2,6 +2,8 @@
<template>
<div>
<auth @onLogin="userLogin" @onLogout="userLogout" :checkProfile="true" ref="auth"></auth>
<modal-upload-card-comp :visible="modalUploadCardVisiable" :show-confirm="true" @close="modalUploadCardVisiable=false" @onSubmit="handleUpdatePolicyWithFile" ></modal-upload-card-comp>
<modal-comp :visible="modalVisiable" :show-confirm="false" :icon="modalIcon" :content="modalContent" :confirm="modalCallback" :overlay="modalCallback"></modal-comp>
<template v-if="showForm">
<div class="pure-u-1 form-item form-item2">
......@@ -9,13 +11,12 @@
{{$t('policyChangeInformation.obj')}}
</div>
<div class="cont">
<div class="boo-btn pointer" :class="{active:isOwner}" @click="isOwner=true">{{$t('policyChangeInformation.owner')}}</div>
<div class="boo-btn pointer" :class="{active:!isOwner}" @click="isOwner=false">{{$t('policyChangeInformation.insured')}}</div>
<div class="boo-btn pointer" :class="{active:isOwner}" @click="switchPolicyRole(1)">{{$t('policyChangeInformation.owner')}}</div>
<div class="boo-btn pointer" :class="{active:!isOwner}" @click="switchPolicyRole(2)">{{$t('policyChangeInformation.insured')}}</div>
</div>
</div>
<policy-head-list :multiSelectable="false" @onSelect="handlePolicySelect" :model="'checkbox'"></policy-head-list>
<modal-upload-card-comp :visible="modalUploadCardVisiable" :show-confirm="true" ></modal-upload-card-comp>
<div class="container border" v-if="selectedPolicies.length > 0 && data">
<div class="table">
<div class="table-header orange">
......@@ -144,7 +145,7 @@
</div>
<div class="submit-btn" @click="updatePolicyInfo">
<div class="submit-btn" @click="handleUpdatePolicy">
{{$t("policyChangeInformation.submit")}}
</div>
</div>
......
......@@ -216,7 +216,9 @@ export default {
}).then(response => {
this.loading = false;
this._handlerLoginResponse(response);
})
}).catch(err=>{
this.loading = false;
});
});
},
// 处理登录结果
......@@ -291,6 +293,8 @@ export default {
}).then(response => {
this.loading = false;
this._handlerLoginResponse(response);
}).catch(err=>{
this.loading = false;
});
});
},
......