Commit 5c5695a1 authored by 郝聪敏's avatar 郝聪敏

Merge branch 'fix/picker_fix' into 'master'

Fix/picker fix

See merge request !39
parents f919352d 60737965
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no"> <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,viewport-fit=cover">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
<script> <script>
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
}); });
} }
})(); })();
// ! 上线需要删掉
var baseUrl = "";
</script> </script>
</head> </head>
<body> <body>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Description:众安50万意外险 * @Description:众安50万意外险
* @Date: 2020-07-27 15:46:37 * @Date: 2020-07-27 15:46:37
* @LastEditors: gzw * @LastEditors: gzw
* @LastEditTime: 2020-08-13 10:37:30 * @LastEditTime: 2020-08-18 16:24:31
*/ */
import goodsBg from "@/assets/images/goods/detail/yiwaixian/bg.png"; import goodsBg from "@/assets/images/goods/detail/yiwaixian/bg.png";
...@@ -141,6 +141,7 @@ export default { ...@@ -141,6 +141,7 @@ export default {
url: "http://mangguo-contract.qthbx.com/fu-wu-xie-yi-v1/" url: "http://mangguo-contract.qthbx.com/fu-wu-xie-yi-v1/"
}, },
{ title: "保险计划" }, { title: "保险计划" },
{ title: "保险计划" },
{ title: "理赔信息" }, { title: "理赔信息" },
{ title: "完整费率" }, { title: "完整费率" },
{ {
......
This diff is collapsed.
...@@ -158,6 +158,7 @@ export default { ...@@ -158,6 +158,7 @@ export default {
&-icon { &-icon {
font-style: normal; font-style: normal;
font-weight: @font-weight-bold; font-weight: @font-weight-bold;
width: 15px;
} }
&-txt { &-txt {
margin-left: 8px; margin-left: 8px;
......
...@@ -68,6 +68,7 @@ export default { ...@@ -68,6 +68,7 @@ export default {
<style lang="less" scoped> <style lang="less" scoped>
@import "../style/var.less"; @import "../style/var.less";
@import "../style/mixins.less";
.good-action { .good-action {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
...@@ -80,6 +81,7 @@ export default { ...@@ -80,6 +81,7 @@ export default {
justify-content: space-between; justify-content: space-between;
background-color: @white; background-color: @white;
border-top: 1px solid rgba(0, 0, 0, 0.1); border-top: 1px solid rgba(0, 0, 0, 0.1);
.iphonex-fix-padding();
&-left { &-left {
display: flex; display: flex;
align-items: center; align-items: center;
......
...@@ -109,6 +109,7 @@ export default { ...@@ -109,6 +109,7 @@ export default {
if (res && !this.timer) { if (res && !this.timer) {
this.count = TIME_COUNT; this.count = TIME_COUNT;
this.showCount = true; this.showCount = true;
this.$notify({ type: "success", message: "短信验证码已发送,请注意查收" });
this.timer = setInterval(() => { this.timer = setInterval(() => {
if (this.count > 0 && this.count <= TIME_COUNT) { if (this.count > 0 && this.count <= TIME_COUNT) {
this.count--; this.count--;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<svg-icon icon-class="triangle-right" slot="button" /> <svg-icon icon-class="triangle-right" slot="button" />
</div> </div>
<cr-popup v-model="show" position="bottom" get-container="body"> <cr-popup v-model="show" position="bottom" get-container="body">
<cr-area ref="area" :list="areaList" @cancel="onCancel" @confirm="onConfirm" /> <cr-area ref="area" :value="value" :list="areaList" @cancel="onCancel" @confirm="onConfirm" />
</cr-popup> </cr-popup>
</div> </div>
</template> </template>
...@@ -23,19 +23,49 @@ export default { ...@@ -23,19 +23,49 @@ export default {
data() { data() {
return { return {
refName: "area", refName: "area",
areaList areaList,
pickerDefaultVal: ""
}; };
}, },
watch: {
value(val) {
if (val) {
this.setDefaultVal(false);
}
}
},
methods: { methods: {
handleResult(res) { handleResult(res) {
let valShow = []; let valShow = [];
let val = []; let val = [];
res.forEach(item => { res.forEach(item => {
valShow.push(item.name); valShow.push(item.name || item.text);
val.push(item.code); val.push(item.code);
}); });
this.pickerValShow = valShow.join(","); this.pickerValShow = valShow.join(",");
this.pickerVal = val; this.pickerVal = val[2];
},
setDefaultVal(setCol = true) {
setTimeout(() => {
const $area = this.$refs.area;
const $picker = $area.$refs.picker;
const val = this.value;
let columns = "";
$area.selectedCodes = [`${val.substring(0, 2)}0000`, `${val.substring(0, 4)}00`, val];
$area.renderProvince();
// 防止refresh把数据刷没
columns = JSON.parse(JSON.stringify($area.columns));
if (setCol) {
$picker.setColumnIndex(0, columns[0].selectedIndex);
$picker.setColumnIndex(1, columns[1].selectedIndex);
$picker.setColumnIndex(2, columns[2].selectedIndex);
} else {
const province = columns[0].values[columns[0].selectedIndex];
const city = columns[1].values[columns[1].selectedIndex];
const country = columns[2].values[columns[2].selectedIndex];
this.handleResult([province, city, country]);
}
});
} }
} }
}; };
......
<template> <template>
<div class="jobs-wrap"> <div class="jobs-wrap">
<div class="jobs-wrap-txt" :class="{ placeholder: !selectedTexts.length }" @click="show = true"> <div class="jobs-wrap-txt" :class="{ placeholder: !selectedTexts[2] }" @click="show = true">
<span>{{ selectedTexts[1] || placeholder }}</span> <span>{{ selectedTexts[2] || placeholder }}</span>
<svg-icon icon-class="triangle-right" slot="button" /> <svg-icon icon-class="triangle-right" slot="button" />
</div> </div>
<cr-popup v-model="show" get-container="body" round closeable position="bottom" class="jobs"> <cr-popup v-model="show" get-container="body" round closeable position="bottom" class="jobs">
<div class="jobs-head"> <div class="jobs-head">
<div class="jobs-title">请选择</div> <div class="jobs-title">请选择职业</div>
<cr-divider :hairline="false" :style="{ color: '#F4F4F4', margin: 0 }" /> <cr-divider :hairline="false" :style="{ color: '#F4F4F4', margin: 0 }" />
</div> </div>
<!-- content --> <!-- content -->
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
v-for="(item, index) in industry" v-for="(item, index) in industry"
:key="index" :key="index"
:class="{ active: columns[0].values.length > 0 && index === columns[0].selectedIndex }" :class="{ active: columns[0].values.length > 0 && index === columns[0].selectedIndex }"
@click="changeIndustry(item, index)" @click.stop="changeIndustry(item, index)"
> >
<div class="jobs-item-txt"> <div class="jobs-item-txt">
<span>{{ item.text }}</span> <span>{{ item.text }}</span>
...@@ -30,10 +30,30 @@ ...@@ -30,10 +30,30 @@
<div <div
class="jobs-item" class="jobs-item"
v-for="(it, idx) in columns[1].values" v-for="(it, idx) in columns[1].values"
:class="{
active: columns[1].values.length > 0 && idx === columns[1].selectedIndex
}"
:key="idx" :key="idx"
@click="changeProfession(it, idx)" @click.stop="changeCategory(it, idx)"
> >
<div class="jobs-item-txt">{{ it.text }}</div> <div class="jobs-item-txt">
<span>{{ it.text }}</span>
<cr-icon type="arrow" />
</div>
<div
class="jobs-children jobs-leaf"
v-if="columns[2].values.length > 0 && idx === columns[1].selectedIndex"
>
<div
class="jobs-item"
v-for="(itc, idxc) in columns[2].values"
:key="idxc"
@click.stop="changeProfession(itc, idxc)"
>
<div class="jobs-item-txt">{{ itc.text }}</div>
</div>
</div>
<cr-divider />
</div> </div>
</div> </div>
<cr-divider /> <cr-divider />
...@@ -45,6 +65,7 @@ ...@@ -45,6 +65,7 @@
</template> </template>
<script> <script>
// TODO 组件目前只针对职业码表处理,有待优化
/** /**
* @description: 职业码表 * @description: 职业码表
* @param {type} * @param {type}
...@@ -54,17 +75,26 @@ import popupPickerMixin from "../mixins/popupPicker.mixin.js"; ...@@ -54,17 +75,26 @@ import popupPickerMixin from "../mixins/popupPicker.mixin.js";
import jobs from "@/api/jobs"; import jobs from "@/api/jobs";
const CHANGE_EVENT = "input"; const CHANGE_EVENT = "input";
const INDUSTRY_INDEX = 0; const INDUSTRY_INDEX = 0;
const PROFESSION_INDEX = 1; const CATEGORY_INDEX = 1;
const PROFESSION_INDEX = 2;
export default { export default {
name: "PopupCascade", name: "PopupCascade",
mixins: [popupPickerMixin], mixins: [popupPickerMixin],
props: { props: {
value: null value: null,
isLite: {
type: Boolean,
default: false
}
}, },
watch: { watch: {
// value(val) { value(val) {
// this.popupShow = val; if (val) {
// }, const value = "" + val;
this.selectedCodes = [value.substring(0, 1), value.substring(0, 3), value];
this.renderIndustry();
}
},
popupShow(val) { popupShow(val) {
this.$emit(CHANGE_EVENT, val); this.$emit(CHANGE_EVENT, val);
} }
...@@ -79,8 +109,18 @@ export default { ...@@ -79,8 +109,18 @@ export default {
}; };
}); });
}, },
category() {
const list = this.jobs[this.categoryKey];
return Object.keys(list).map(key => {
return {
code: key,
text: list[key]
};
});
},
profession() { profession() {
const list = this.jobs[this.professionKey]; const key = this.isLite ? this.professionLiteKey : this.professionKey;
const list = this.jobs[key];
return Object.keys(list).map(key => { return Object.keys(list).map(key => {
return { return {
code: key, code: key,
...@@ -94,7 +134,9 @@ export default { ...@@ -94,7 +134,9 @@ export default {
show: false, show: false,
jobs, jobs,
industryKey: "industry", industryKey: "industry",
categoryKey: "category",
professionKey: "profession", professionKey: "profession",
professionLiteKey: "professionLite",
columns: [], columns: [],
selectedCodes: [], selectedCodes: [],
selectedTexts: [] selectedTexts: []
...@@ -103,10 +145,10 @@ export default { ...@@ -103,10 +145,10 @@ export default {
created() { created() {
if (this.value) { if (this.value) {
const value = "" + this.value; const value = "" + this.value;
this.selectedCodes = [value.substring(0, 4), value]; this.selectedCodes = [value.substring(0, 1), value.substring(0, 3), value];
} }
for (let i = 0; i < 2; i++) { for (let i = 0; i < 3; i++) {
this.columns[i] = { this.columns[i] = {
values: [], values: [],
selectedIndex: "" selectedIndex: ""
...@@ -118,16 +160,33 @@ export default { ...@@ -118,16 +160,33 @@ export default {
}, },
methods: { methods: {
changeIndustry(item, index) { changeIndustry(item, index) {
if (index === this.columns[INDUSTRY_INDEX].selectedIndex) {
this.columns[INDUSTRY_INDEX].selectedIndex = "";
this.$forceUpdate();
} else {
this.columns[INDUSTRY_INDEX].selectedIndex = index; this.columns[INDUSTRY_INDEX].selectedIndex = index;
this.selectedCodes[INDUSTRY_INDEX] = item.code; this.setValueOfSelected(item, INDUSTRY_INDEX);
this.selectedTexts[INDUSTRY_INDEX] = item.text; this.renderCategory(item.code);
}
this.columns[CATEGORY_INDEX].selectedIndex = "";
this.columns[PROFESSION_INDEX].selectedIndex = "";
},
changeCategory(item, index) {
if (index === this.columns[CATEGORY_INDEX].selectedIndex) {
this.columns[CATEGORY_INDEX].selectedIndex = "";
this.$forceUpdate();
return;
} else {
this.columns[CATEGORY_INDEX].selectedIndex = index;
this.setValueOfSelected(item, CATEGORY_INDEX);
this.renderProfession(item.code); this.renderProfession(item.code);
}
this.columns[PROFESSION_INDEX].selectedIndex = "";
}, },
changeProfession(item, index) { changeProfession(item, index) {
this.columns[PROFESSION_INDEX].selectedIndex = index; this.columns[PROFESSION_INDEX].selectedIndex = index;
this.selectedCodes[PROFESSION_INDEX] = item.code; this.setValueOfSelected(item, PROFESSION_INDEX);
this.selectedTexts[PROFESSION_INDEX] = item.text; this.$emit(CHANGE_EVENT, item.code);
this.$emit("input", this.selectedCodes);
this.show = false; this.show = false;
}, },
renderIndustry() { renderIndustry() {
...@@ -135,14 +194,29 @@ export default { ...@@ -135,14 +194,29 @@ export default {
this.setDefaultIndexOfColumn(this.industry, INDUSTRY_INDEX); this.setDefaultIndexOfColumn(this.industry, INDUSTRY_INDEX);
const industry = this.industry[this.columns[INDUSTRY_INDEX].selectedIndex]; const industry = this.industry[this.columns[INDUSTRY_INDEX].selectedIndex];
if (industry) { if (industry) {
this.selectedTexts[PROFESSION_INDEX] = industry.text; this.setValueOfSelected(industry, INDUSTRY_INDEX);
this.renderProfession(industry?.code); this.renderCategory(industry?.code);
} }
}, },
renderProfession(industryCode) { renderCategory(industryCode) {
const professionOfIndustry = this.quickFilter(this.profession, 5, industryCode); const categoryOfIndustry = this.quickFilter(this.category, 1, industryCode);
this.columns[PROFESSION_INDEX].values = professionOfIndustry; this.columns[CATEGORY_INDEX].values = categoryOfIndustry;
this.setDefaultIndexOfColumn(professionOfIndustry, PROFESSION_INDEX); this.setDefaultIndexOfColumn(categoryOfIndustry, CATEGORY_INDEX);
const category = categoryOfIndustry[this.columns[CATEGORY_INDEX].selectedIndex];
if (category) {
this.setValueOfSelected(category, CATEGORY_INDEX);
this.renderProfession(category?.code);
}
this.$forceUpdate();
},
renderProfession(categoryCode) {
const professionOfCategory = this.quickFilter(this.profession, 3, categoryCode);
this.columns[PROFESSION_INDEX].values = professionOfCategory;
this.setDefaultIndexOfColumn(professionOfCategory, PROFESSION_INDEX);
const profession = professionOfCategory[this.columns[PROFESSION_INDEX].selectedIndex];
if (profession) {
this.setValueOfSelected(profession, PROFESSION_INDEX);
}
this.$forceUpdate(); this.$forceUpdate();
}, },
quickFilter(list, slice, code) { quickFilter(list, slice, code) {
...@@ -161,6 +235,10 @@ export default { ...@@ -161,6 +235,10 @@ export default {
} }
return filtered; return filtered;
}, },
setValueOfSelected(item, index) {
this.selectedCodes[index] = item.code;
this.selectedTexts[index] = item.text;
},
setDefaultIndexOfColumn(list, index) { setDefaultIndexOfColumn(list, index) {
if (this.selectedCodes[index]) { if (this.selectedCodes[index]) {
list.some((item, i) => { list.some((item, i) => {
...@@ -183,12 +261,12 @@ export default { ...@@ -183,12 +261,12 @@ export default {
.body-wrap-mixin { .body-wrap-mixin {
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
height: 80vh; height: calc(70vh - 90px);
padding: @padding-lg; padding: @padding-lg;
} }
.jobs { .jobs {
z-index: 200; z-index: 200;
height: 80vh; height: 70vh;
overflow: hidden; overflow: hidden;
@{deep} .cr-icon { @{deep} .cr-icon {
position: absolute; position: absolute;
...@@ -248,20 +326,25 @@ export default { ...@@ -248,20 +326,25 @@ export default {
} }
} }
&.active { &.active {
.jobs-children { & > .jobs-item-txt > .cr-icon {
display: block;
}
.cr-icon {
transform: rotate(90deg); transform: rotate(90deg);
} }
} }
&:last-child {
.cr-divider {
display: none;
}
}
} }
&-children { &-children {
display: none; padding: 2px 0 2px 10px;
margin: 0 0 10px; &.jobs-leaf {
padding: 2px 10px;
border-radius: 8px; border-radius: 8px;
background-color: @gray-1; background-color: @gray-1;
.jobs-item-txt {
margin: 10px 0;
}
}
.jobs-item-txt { .jobs-item-txt {
color: @gray-5; color: @gray-5;
padding: 0; padding: 0;
......
...@@ -32,10 +32,30 @@ export default { ...@@ -32,10 +32,30 @@ export default {
initVal: parseTime("", "{y}-{m}-{d}") initVal: parseTime("", "{y}-{m}-{d}")
}; };
}, },
watch: {
value(val) {
if (val) {
this.initVal = val;
this.handleResult(val);
}
}
},
methods: { methods: {
handleResult(res) { handleResult(res) {
this.pickerValShow = res; this.pickerValShow = res;
this.pickerVal = res; this.pickerVal = res;
},
setDefaultVal() {
setTimeout(() => {
const $datepicker = this.$refs.datepicker;
const $picker = $datepicker.$refs.picker;
const columns = $datepicker.columns;
$datepicker.setInitValue();
$picker.setColumnIndex(0, columns[0].selectedIndex);
$picker.setColumnIndex(1, columns[1].selectedIndex);
$picker.setColumnIndex(2, columns[2].selectedIndex);
});
} }
} }
}; };
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
</template> </template>
<script> <script>
// TODO 目前没有用到的业务场景,默认值还未做处理
import popupPickerMixin from "../mixins/popupPicker.mixin.js"; import popupPickerMixin from "../mixins/popupPicker.mixin.js";
export default { export default {
name: "PopupPicker", name: "PopupPicker",
...@@ -29,6 +30,12 @@ export default { ...@@ -29,6 +30,12 @@ export default {
handleResult(res) { handleResult(res) {
this.pickerValShow = res[0]; this.pickerValShow = res[0];
this.pickerVal = res[1]; this.pickerVal = res[1];
},
setDefaultVal() {
setTimeout(() => {
const $picker = this.$refs.picker;
$picker.setColumnIndex(0, this.pickerData.indexOf(this.value));
});
} }
} }
}; };
......
...@@ -80,13 +80,15 @@ export default { ...@@ -80,13 +80,15 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import "../style/var.less"; @import "../style/var.less";
@import "../style/mixins.less";
.mongo-tabbar { .mongo-tabbar {
position: fixed; position: fixed;
bottom: 0; bottom: 0;
z-index: 100; z-index: 100;
box-sizing: border-box; box-sizing: border-box;
height: 49px; min-height: 49px;
padding: 5px 0 2px 0; padding: 5px 0 2px 0;
.iphonex-fix-padding();
&-item { &-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: PopupPicker mixin * @Description: PopupPicker mixin
* @Date: 2020-07-28 19:46:31 * @Date: 2020-07-28 19:46:31
* @LastEditors: gzw * @LastEditors: gzw
* @LastEditTime: 2020-08-16 21:21:05 * @LastEditTime: 2020-08-17 16:52:26
*/ */
// TODO 默认值需要处理 // TODO 默认值需要处理
...@@ -36,6 +36,7 @@ export default { ...@@ -36,6 +36,7 @@ export default {
if (val && !this.refreshed && this.$refs[this.refName]) { if (val && !this.refreshed && this.$refs[this.refName]) {
this.refreshed = true; this.refreshed = true;
this.$refs[this.refName].refreshColumns(); this.$refs[this.refName].refreshColumns();
this.setDefaultVal();
} }
} }
// value: { // value: {
......
...@@ -25,7 +25,6 @@ const { Notify } = cherry; ...@@ -25,7 +25,6 @@ const { Notify } = cherry;
const CancelToken = axios.CancelToken; const CancelToken = axios.CancelToken;
let pending = {}; let pending = {};
let reqNum = 0; let reqNum = 0;
axios.defaults.baseURL = config.basicHost; axios.defaults.baseURL = config.basicHost;
axios.defaults.timeout = 30000; axios.defaults.timeout = 30000;
...@@ -55,7 +54,9 @@ axios.interceptors.request.use( ...@@ -55,7 +54,9 @@ axios.interceptors.request.use(
pending[config.url]("取消重复请求"); pending[config.url]("取消重复请求");
} }
config.cancelToken = new CancelToken(c => (pending[config.url] = c)); config.cancelToken = new CancelToken(c => (pending[config.url] = c));
// ! 上线需要删掉
// eslint-disable-next-line
config.baseURL = baseUrl || config.baseURL;
// 添加token // 添加token
const token = localStorage.get("mongoToken"); const token = localStorage.get("mongoToken");
if (token) { if (token) {
......
...@@ -21,6 +21,9 @@ a { ...@@ -21,6 +21,9 @@ a {
input::-webkit-input-placeholder { input::-webkit-input-placeholder {
color: #AAAAAA; color: #AAAAAA;
} }
input:focus {
outline: 0;
}
strong { strong {
font-weight: @font-weight-bold; font-weight: @font-weight-bold;
} }
......
...@@ -38,3 +38,12 @@ ...@@ -38,3 +38,12 @@
color: @black; color: @black;
} }
} }
.iphonex-fix-padding {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.iphonex-fix-margin {
margin-bottom: constant(safe-area-inset-bottom);
margin-bottom: env(safe-area-inset-bottom);
}
\ No newline at end of file
...@@ -230,34 +230,31 @@ export default { ...@@ -230,34 +230,31 @@ export default {
this.generateOrder(); this.generateOrder();
} }
}, },
updateRemain(isBuy = false) { updateRemain() {
let historyRemain = sessionStorage.getItem("historyRemain"); let historyRemain = localStorage.get("historyRemain");
if (historyRemain && +historyRemain > 100) { if (historyRemain && +historyRemain > 100) {
isBuy && historyRemain--; historyRemain--;
} else { } else {
historyRemain = Math.floor(Math.random() * (200 - 100) + 100); historyRemain = Math.floor(Math.random() * (200 - 100) + 100);
} }
this.remain = historyRemain; this.remain = historyRemain;
sessionStorage.setItem("historyRemain", historyRemain); localStorage.set("historyRemain", historyRemain);
}, },
async generateOrder() { async generateOrder() {
const res = await create(); const res = await create();
if (res) { if (res) {
this.consultantOrderNo = res.consultantOrderNo; this.consultantOrderNo = res.consultantOrderNo;
this.updateRemain(true); this.updateRemain();
this.goPay(); this.goPay();
} }
}, },
async goPay() { async goPay() {
const res = await goPay({ tradeType: this.tradeType }); const res = await goPay({ tradeType: this.tradeType });
if (res) { if (res) {
payByWay(this.tradeType, res.payInfo).then(res => { payByWay(this.tradeType, res.payInfo).then(() => {
if (res === "ok") {
setTimeout(() => { setTimeout(() => {
// this.$router.push("/consultant/success");
this.$parent.getOrderInfo(); this.$parent.getOrderInfo();
}, 2000); }, 1000);
}
}); });
} }
} }
......
...@@ -138,7 +138,7 @@ export default { ...@@ -138,7 +138,7 @@ export default {
formData: { formData: {
name: "", name: "",
idNo: "", idNo: "",
relation: "1", relation: "",
payType: "1", payType: "1",
amountInsured: "1000000", amountInsured: "1000000",
autoRenewPolicy: false, autoRenewPolicy: false,
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
:url="pupopData.url" :url="pupopData.url"
> >
<cps-process-detail v-if="currentPupopIndex === 5" :process-data="processDetail" /> <cps-process-detail v-if="currentPupopIndex === 5" :process-data="processDetail" />
<cps-rate v-if="currentPupopIndex === 6" /> <cps-rate :rate-data="rateInfo" v-if="currentPupopIndex === 6" />
</popup-with-iframe> </popup-with-iframe>
<go-insure-dialog <go-insure-dialog
v-model="goInsureState" v-model="goInsureState"
...@@ -135,8 +135,8 @@ export default { ...@@ -135,8 +135,8 @@ export default {
formData: { formData: {
name: "", name: "",
idNo: "", idNo: "",
relation: "1", relation: "",
payType: "1", payType: "",
amountInsured: "300000", amountInsured: "300000",
autoRenewPolicy: false, autoRenewPolicy: false,
read: true read: true
...@@ -166,15 +166,16 @@ export default { ...@@ -166,15 +166,16 @@ export default {
if (this.calTimer) { if (this.calTimer) {
clearTimeout(this.calTimer); clearTimeout(this.calTimer);
} }
const { idNo, payType } = val; const { idNo } = val;
const { idNo: oldNo, payType: oldType } = oldVal; const { idNo: oldNo } = oldVal;
if (this.goInsureState) { if (this.goInsureState) {
sessionStorage.setItem( sessionStorage.setItem(
"policyFormData", "policyFormData",
JSON.stringify(Object.assign(this.formData, { productNo: this.goodId })) JSON.stringify(Object.assign(this.formData, { productNo: this.goodId }))
); );
} }
if (idNo === oldNo && payType === oldType) return; console.log(idNo, oldNo);
if (idNo === oldNo) return;
this.calTimer = setTimeout(() => { this.calTimer = setTimeout(() => {
this.calFee(); this.calFee();
}, 600); }, 600);
...@@ -257,17 +258,17 @@ export default { ...@@ -257,17 +258,17 @@ export default {
async calFee() { async calFee() {
let { price, subPrice } = this.headerInfo; let { price, subPrice } = this.headerInfo;
const { idNo, socialSecurity, payType, amountInsured, userInfoSecId } = this.formData; const { idNo, socialSecurity, payType, amountInsured, userInfoSecId } = this.formData;
if (!idNo || !socialSecurity || !payType) return; if (!idNo) return;
const _param = { const _param = {
productNo: this.goodId, productNo: this.goodId,
productUserInfo: { productUserInfo: {
userInfo: { userInfo: {
idNo, idNo,
socialSecurity: !!Number(socialSecurity), socialSecurity: socialSecurity ? !!Number(socialSecurity) : true,
userInfoSecId: userInfoSecId ? userInfoSecId : undefined userInfoSecId: userInfoSecId ? userInfoSecId : undefined
}, },
productItem: { productItem: {
payType, payType: payType || "2",
amountInsured amountInsured
} }
} }
......
...@@ -136,9 +136,9 @@ export default { ...@@ -136,9 +136,9 @@ export default {
formData: { formData: {
name: "", name: "",
idNo: "", idNo: "",
socialSecurity: "1", socialSecurity: "",
relation: "1", relation: "",
payType: "1", payType: "",
planValue: "3", planValue: "3",
autoRenewPolicy: false, autoRenewPolicy: false,
read: true read: true
...@@ -163,15 +163,12 @@ export default { ...@@ -163,15 +163,12 @@ export default {
]; ];
} }
}, },
formDataCpu: { formData: {
deep: true, deep: true,
handler(val, oldVal) { handler() {
if (this.calTimer) { if (this.calTimer) {
clearTimeout(this.calTimer); clearTimeout(this.calTimer);
} }
const { idNo, socialSecurity, payType } = val;
const { idNo: oldNo, socialSecurity: oldSocialSecurity, payType: oldType } = oldVal;
if (idNo === oldNo && socialSecurity === oldSocialSecurity && payType === oldType) return;
this.calTimer = setTimeout(() => { this.calTimer = setTimeout(() => {
this.calFee(); this.calFee();
}, 600); }, 600);
...@@ -190,9 +187,6 @@ export default { ...@@ -190,9 +187,6 @@ export default {
paywayOptions, paywayOptions,
medicalOptions medicalOptions
}; };
},
formDataCpu() {
return JSON.parse(JSON.stringify(this.formData));
} }
}, },
mounted() { mounted() {
...@@ -289,17 +283,18 @@ export default { ...@@ -289,17 +283,18 @@ export default {
async calFee() { async calFee() {
let { price, subPrice } = this.headerInfo; let { price, subPrice } = this.headerInfo;
const { idNo, socialSecurity, payType, userInfoSecId } = this.formData; const { idNo, socialSecurity, payType, userInfoSecId } = this.formData;
if (!idNo || !socialSecurity || !payType) return; if (!idNo) return;
const _param = { const _param = {
productNo: this.goodId, productNo: this.goodId,
productUserInfo: { productUserInfo: {
userInfo: { userInfo: {
idNo, idNo,
socialSecurity: !!Number(socialSecurity), socialSecurity: socialSecurity ? !!Number(socialSecurity) : true,
userInfoSecId: userInfoSecId ? userInfoSecId : undefined userInfoSecId: userInfoSecId ? userInfoSecId : undefined
}, },
productItem: { productItem: {
payType payType: payType || "2",
socialSecurity: socialSecurity ? !!Number(socialSecurity) : true
} }
} }
}; };
......
...@@ -36,7 +36,8 @@ export default { ...@@ -36,7 +36,8 @@ export default {
}; };
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
if (this.noOrder && !this.userClickState && to.name === "Goods") { const blackList = ["Goods", "Home", "Detail", "ConsultantPlan"];
if (this.noOrder && !this.userClickState && blackList.includes(to.name)) {
this.showRec = true; this.showRec = true;
next(false); next(false);
} else { } else {
......
...@@ -228,7 +228,7 @@ export default { ...@@ -228,7 +228,7 @@ export default {
userInfoSecId: selfSecId, userInfoSecId: selfSecId,
socialSecurity socialSecurity
} = item; } = item;
if (relation === 1) { if (+relation === 1) {
this.formData = { this.formData = {
...this.formData, ...this.formData,
...{ ...{
...@@ -242,17 +242,26 @@ export default { ...@@ -242,17 +242,26 @@ export default {
} }
}); });
const userArray = this.familyList.filter(item => item.relation === +relation); const userArray = this.familyList.filter(item => item.relation === +relation);
let [name, idNo, userInfoSecId, socialSecurity] = ["", "", "", "0"]; let [name, idNo, userInfoSecId, socialSecurity] = ["", "", "", ""];
if (userArray.length) { if (userArray.length) {
let { nameMask, idNoMask, userInfoSecId: id, socialSecurity: ss } = userArray[0]; let { nameMask, idNoMask, userInfoSecId: id, socialSecurity: ss } = userArray[0];
[name, idNo, userInfoSecId, socialSecurity] = [nameMask, idNoMask, id, ss]; [name, idNo, userInfoSecId, socialSecurity] = [nameMask, idNoMask, id, ss];
this.infoReadonly = true; this.infoReadonly = true;
} else { } else {
if (relation === "1") {
const { selfName: sName, selfIdNo: sNo } = this.formData;
[name, idNo] = [sName, sNo];
}
this.infoReadonly = false; this.infoReadonly = false;
} }
this.formData = { this.formData = {
...this.formData, ...this.formData,
...{ name, idNo, userInfoSecId, socialSecurity: socialSecurity ? "1" : "0" } ...{
name,
idNo,
userInfoSecId,
socialSecurity
}
}; };
}, },
async getFamilyList() { async getFamilyList() {
......
...@@ -82,7 +82,10 @@ ...@@ -82,7 +82,10 @@
:rules="[{ required: true, message: '请选择投保人职业' }]" :rules="[{ required: true, message: '请选择投保人职业' }]"
> >
<template #input> <template #input>
<popup-cascade /> <popup-cascade
v-model="formData.holderUserInfo.occupation"
placeholder="请选择投保人职业"
/>
</template> </template>
</cr-field> </cr-field>
<cr-field <cr-field
...@@ -216,13 +219,13 @@ ...@@ -216,13 +219,13 @@
v-model="formData.insuredUserInfo.occupation" v-model="formData.insuredUserInfo.occupation"
name="insuredUserInfo_occupation" name="insuredUserInfo_occupation"
label="职业" label="职业"
:rules="[{ required: true, message: '请选择保人职业' }]" :rules="[{ required: true, message: '请选择保人职业' }]"
> >
<template #input> <template #input>
<popup-picker <popup-cascade
:picker-data="['老师', '工人']"
v-model="formData.insuredUserInfo.occupation" v-model="formData.insuredUserInfo.occupation"
placeholder="请选择投保人职业" placeholder="请选择被保人职业"
:is-lite="true"
/> />
</template> </template>
</cr-field> </cr-field>
...@@ -340,7 +343,6 @@ ...@@ -340,7 +343,6 @@
<script> <script>
import GoodAction from "@/components/GoodAction"; import GoodAction from "@/components/GoodAction";
import CrRadioBtn from "@/components/CrRadioBtn"; import CrRadioBtn from "@/components/CrRadioBtn";
import PopupPicker from "@/components/PopupPicker";
import PopupAreaPicker from "@/components/PopupAreaPicker"; import PopupAreaPicker from "@/components/PopupAreaPicker";
import PopupDatePicker from "@/components/PopupDatePicker"; import PopupDatePicker from "@/components/PopupDatePicker";
import PopupWithIframe from "@/components/PopupWithIframe"; import PopupWithIframe from "@/components/PopupWithIframe";
...@@ -377,7 +379,6 @@ export default { ...@@ -377,7 +379,6 @@ export default {
GoodAction, GoodAction,
CrRadioBtn, CrRadioBtn,
GoInsureDialog, GoInsureDialog,
PopupPicker,
PopupAreaPicker, PopupAreaPicker,
PopupDatePicker, PopupDatePicker,
PopupWithIframe, PopupWithIframe,
...@@ -398,7 +399,7 @@ export default { ...@@ -398,7 +399,7 @@ export default {
policyFormData: JSON.parse(sessionStorage.getItem("policyFormData") || "{}"), policyFormData: JSON.parse(sessionStorage.getItem("policyFormData") || "{}"),
formData: { formData: {
insuredUserInfo: { insuredUserInfo: {
relation: "1" relation: ""
}, },
holderUserInfo: {}, holderUserInfo: {},
productItem: { productItem: {
...@@ -441,7 +442,7 @@ export default { ...@@ -441,7 +442,7 @@ export default {
this.goodBuyModalInfo = [{ title: `${price[2]}保费`, value: `${price[0]}${price[1]}` }]; this.goodBuyModalInfo = [{ title: `${price[2]}保费`, value: `${price[0]}${price[1]}` }];
} }
}, },
formDataCpu: { formData: {
deep: true, deep: true,
handler() { handler() {
this.autoSaveHandler(AUTO_SAVE_TARGET, AUTO_SAVE_KEY); this.autoSaveHandler(AUTO_SAVE_TARGET, AUTO_SAVE_KEY);
...@@ -474,9 +475,6 @@ export default { ...@@ -474,9 +475,6 @@ export default {
const { popupArray, currentPupopIndex } = this; const { popupArray, currentPupopIndex } = this;
return popupArray[currentPupopIndex] || {}; return popupArray[currentPupopIndex] || {};
}, },
formDataCpu() {
return JSON.parse(JSON.stringify(this.formData));
},
socialSecurityReadonly() { socialSecurityReadonly() {
const { relation } = this.formData.insuredUserInfo; const { relation } = this.formData.insuredUserInfo;
const { selfInfoReadonly, infoReadonly } = this; const { selfInfoReadonly, infoReadonly } = this;
...@@ -533,7 +531,7 @@ export default { ...@@ -533,7 +531,7 @@ export default {
} }
this.formData.insuredUserInfo = { this.formData.insuredUserInfo = {
...this.formData.insuredUserInfo, ...this.formData.insuredUserInfo,
...{ name, idNo, userInfoSecId, socialSecurity: socialSecurity } ...{ name, idNo, userInfoSecId, socialSecurity: socialSecurity ? "1" : "0" }
}; };
this.$forceUpdate(); this.$forceUpdate();
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment