5999ed00 by joe

产品修改

1 parent 64295c86
......@@ -87,11 +87,19 @@ function initQueryConfig() {
let rsaKey1 = localStorage.getItem("rsaKey");
let rsaKeyIndex1 = localStorage.getItem("rsaKeyIndex");
let vhis1 = localStorage.getItem("vhis");
let policies = localStorage.getItem("policies");
try {
policies = policies ? JSON.parse(policies) : null;
} catch (e) {
console.error(e);
}
window.global = {
PK: rsaKey1,
E: rsaKeyIndex1,
vhis: vhis1
vhis: vhis1,
policies: policies
};
httpGet({
......@@ -100,6 +108,7 @@ function initQueryConfig() {
let rsaKey = res.rsaKey;
let rsaKeyIndex = res.rsaKeyIndex;
let vhis = res.vhis;
let policies = res.policies;
if (rsaKey) {
window.global.PK = rsaKey;
......@@ -115,6 +124,11 @@ function initQueryConfig() {
window.global.vhis = vhis;
localStorage.setItem("vhis", vhis);
}
if (policies) {
window.global.policies = policies;
localStorage.setItem("policies", JSON.stringify(policies));
}
});
}
......
......@@ -8,7 +8,7 @@ import {
import Auth from '@components/auth/auth.vue';
import PolicyHeadList from "./policy-head-list.vue";
import { formatMoney, getInsuredPeriod, getBenefitType, getPayPeriod, getPayType, getMoneyName, getPayMode } from "@/utils/biz.js";
import { formatMoney, getInsuredPeriod, getBenefitType, getPayPeriod, getPayType, getMoneyName, getPayMode,getPolicyName } from "@/utils/biz.js";
export default {
name: "InsuranceQuery",
......@@ -120,6 +120,9 @@ export default {
return "Year " + y + " issue " + p;
}
},
formatPolicyName(c, n) {
return getPolicyName(this.$i18n.locale, c, c);
},
userLogout() {
this.showForm = false;
},
......
......@@ -16,7 +16,7 @@
<div class="data-line">
<div class="cell1">
<div class="label">{{$t('customService.insuranceQuery.t2n1')}}</div>
<div class="label">{{dataForm.productName}}</div>
<div class="label">{{formatPolicyName(dataForm.productCode, dataForm.productName)}}</div>
</div>
<div class="separator-v"></div>
<div class="cell1">
......
......@@ -7,7 +7,7 @@ import {
import {
mapState
} from 'vuex';
import { formatMoney, getInsuredPeriod } from "@/utils/biz.js";
import { formatMoney, getInsuredPeriod, getPolicyName } from "@/utils/biz.js";
export default {
props: {
......@@ -200,6 +200,9 @@ export default {
formatInsuredPeriod(t, v) {
return getInsuredPeriod(this.$i18n.locale, t, v);
},
formatPolicyName(c, n) {
return getPolicyName(this.$i18n.locale, c, c);
},
downloadPolicy(policy) {
if (policy) {
httpPost({ url: api.getDownloadPath, sid: true, data: { policyCode: policy.policyCode } }).then(res => {
......
......@@ -38,7 +38,7 @@
</div>
<div class="td w2">{{lan == 'en' ? (item.insuredNameEn ? item.insuredNameEn : item.insuredNameCn) : (item.insuredNameCn ? item.insuredNameCn : item.insuredNameEn)}}</div>
<div class="td w1">{{item.productName}}</div>
<div class="td w1">{{formatPolicyName(item.productCode, item.productName)}}</div>
<div class="td w2">{{item.moneyCode}} {{formatMoney(item.amount,0)}}</div>
<div class="td w2">{{item.expireAt?item.expireAt.split(" ")[0]:""}}</div>
<!-- <div class="td w2">{{item.guaranteeAge?item.guaranteeAge.split(" ")[0]:""}}</div> -->
......
......@@ -1069,13 +1069,13 @@ export function getInsuredPeriod(lan, t, v) {
value = lan == "zh" ? "保终身" : lan == "tc" ? "保終身" : "Cover whole life";
break;
case "2":
value = lan == "zh" ? "保" + v + "年" : lan == "tc" ? "保" + v + "年" : "Cover " + v + " year";
value = lan == "zh" ? "保" + v + "年" : lan == "tc" ? "保" + v + "年" : "Cover " + v + " " + (v > 1 ? "years" : "year");
break;
case "3":
value = lan == "zh" ? "至" + v + "岁" : lan == "tc" ? "至" + v + "歲" : "Cover up to " + v + " age";
value = lan == "zh" ? "至" + v + "岁" : lan == "tc" ? "至" + v + "歲" : "Cover up to " + v + " " + (v > 1 ? "years" : "year") + " old";
break;
case "4":
value = lan == "zh" ? "保" + v + "月" : lan == "tc" ? "保" + v + "月" : "Cover " + v + " month";
value = lan == "zh" ? "保" + v + "月" : lan == "tc" ? "保" + v + "月" : "Cover " + v + " " + (v > 1 ? "months" : "month");
break;
default:
value = lan == "zh" ? "无关" : lan == "tc" ? "無關" : "NA";
......@@ -1132,10 +1132,10 @@ export function getPayPeriod(lan, t, v) {
value = lan == "zh" ? "趸交" : lan == "tc" ? "躉繳" : "Single";
break;
case "2":
value = lan == "zh" ? "缴" + v + "年" : lan == "tc" ? "繳" + v + "年" : "" + v + " year";
value = lan == "zh" ? "缴" + v + "年" : lan == "tc" ? "繳" + v + "年" : "" + v + " " + (v > 1 ? "years" : "year");;
break;
case "3":
value = lan == "zh" ? "缴至" + v + "岁" : lan == "tc" ? "繳至" + v + "歲" : "Pay to" + v + " year old";
value = lan == "zh" ? "缴至" + v + "岁" : lan == "tc" ? "繳至" + v + "歲" : "Pay to" + v + " " + (v > 1 ? "years" : "year") + " old";
break;
default:
value = lan == "zh" ? "缴终身" : lan == "tc" ? "繳終身" : "Whole life";
......@@ -1184,3 +1184,39 @@ export function getMoneyName(lan, t) {
}
return value;
}
/**
* 通过产品的code并通过语言选择产品名称
* @param {*} lan
* @param {*} code
* @param {*} name
*/
export function getPolicyName(lan, code, name) {
let policy = null;
try {
if (window.global.policies) {
for (let i = 0; i < window.global.policies.length; i++) {
let p = window.global.policies[i];
if (p.policyCode == code) {
policy = p;
break;
}
}
}
} catch (e) {
}
if (!policy) {
return name;
}
switch (lan) {
case "zh":
return policy.nameCn ? policy.nameCn : name;
case "en":
return policy.nameEn ? policy.nameEn : name;
default:
return policy.nameTc ? policy.nameTc : name;
}
}
\ No newline at end of file
......