Commit 48762101 authored by 郭志伟's avatar 郭志伟 Committed by 郝聪敏

feat: 顾问接口对接

parent de8499dc
......@@ -22,7 +22,7 @@ export const getCulsuggestion = param => {
// 查询顾问订单信息
export const getCulOrder = param => {
return req.post("consultant/order/query", param);
return req.get("consultant/order/query", param);
};
// 查询顾问订单支付状态
export const getPayState = param => {
......
......@@ -82,10 +82,10 @@ export default {
this.formData.loginChannel = isWeixinBrower ? 1 : 2;
this.formData.openId = localStorage.getItem("openId") || null;
const res = await loginByPhone(this.formData);
if (res.code === "0") {
if (res) {
this.$notify("登录成功");
this.setIsShowLogin(false);
localStorage.setItem("mongoToken", res.data.token);
localStorage.setItem("mongoToken", res.token);
}
},
async getCode() {
......@@ -97,7 +97,7 @@ export default {
return;
}
const res = await getCaptchaSms({ phoneNo });
if (res.code === "0" && !this.timer) {
if (res && !this.timer) {
this.count = TIME_COUNT;
this.showCount = true;
this.timer = setInterval(() => {
......
......@@ -18,7 +18,8 @@
<div class="cul-hd-stock">
<h4 class="cul-hd-stock-title">
还剩
<strong>126</strong>
<strong>{{ remain }}</strong>
</h4>
<div class="cul-hd-progress">
<cr-progress
......@@ -31,14 +32,12 @@
</div>
</div>
<div class="cul-hd-card-foot">
<cr-button type="warning" block @click="$router.push('/consultant/success')">
0.99元聘请
</cr-button>
<cr-tag class="cul-hd-discount" shape="round">
<cr-button type="warning" block @click="checkLogin">{{ price[0] }}元聘请</cr-button>
<cr-tag class="cul-hd-discount" shape="round" v-if="price[0] !== price[1]">
<strong>限时优惠</strong>
<del>
<span>原价</span>
<em>199</em>
<em>{{ price[1] }}</em>
<span></span>
</del>
</cr-tag>
......@@ -81,6 +80,9 @@
</template>
<script>
import localStorage from "@/service/localStorage";
import { mapActions, mapState } from "vuex";
import { create, goPay } from "@/api/consultant";
import Card from "@/components/Card";
import Collapse from "@/components/Collapse";
import CpsQa from "../../Goods/Detail/modules/CpsQA";
......@@ -94,6 +96,10 @@ export default {
},
data() {
return {
isLogin: localStorage.get("mongoToken"),
remain: 126,
price: [0.99, 199],
consultantOrderNo: "",
serviceList: [
{ icon: "team", title: "资深", sub: "保险精算团队" },
{ icon: "card", title: "专属", sub: "保险顾问" },
......@@ -185,7 +191,45 @@ export default {
]
};
},
mounted() {}
computed: {
...mapState(["isShowLogin"])
},
watch: {
isShowLogin(val) {
console.log(111);
if (!val) {
this.isLogin = localStorage.get("mongoToken");
}
}
},
mounted() {},
methods: {
...mapActions(["setIsShowLogin"]),
checkLogin() {
if (!this.isLogin) {
this.setIsShowLogin(true);
return;
}
this.generateOrder();
},
async generateOrder() {
const res = await create();
if (res) {
this.consultantOrderNo = res.consultantOrderNo;
this.goPay();
}
},
async goPay() {
const res = await goPay({ consultantOrderNo: this.consultantOrderNo });
if (res) {
this.$notify("支付成功");
setTimeout(() => {
// this.$router.push("/consultant/success");
this.$parent.getOrderInfo();
}, 2000);
}
}
}
};
</script>
<style lang="less" src="./index.less" scoped></style>
......@@ -17,7 +17,15 @@
</div>
<div class="cul-det">
<card title="" class="cul-card">
<div class="cul-contact">
<router-link tag="div" class="cul-entry" to="/consultant/plan" v-if="hasSuggestion">
<div class="cul-entry-title">
<h3>您的专属保险方案</h3>
<small>CAPTIVE INSURANC</small>
<cr-tag>自己</cr-tag>
</div>
<svg-icon icon-class="arrow-right" />
</router-link>
<div class="cul-contact" v-else>
<div class="cul-contact-qrcode">
<cr-image
src="@/assets/images/consultant/qrcode-demo.png"
......@@ -37,14 +45,6 @@
</div>
</div>
</div>
<router-link tag="div" class="cul-entry" to="/consultant/plan">
<div class="cul-entry-title">
<h3>您的专属保险方案</h3>
<small>CAPTIVE INSURANC</small>
<cr-tag>自己</cr-tag>
</div>
<svg-icon icon-class="arrow-right" />
</router-link>
<div class="cul-tel">
<a class="cul-tel-num" href="tel:13888888888">
<svg-icon icon-class="call" />138 8888 8888
......@@ -90,6 +90,12 @@ export default {
Card,
copyright
},
props: {
hasSuggestion: {
type: Boolean,
default: false
}
},
data() {
return {
Info: {},
......
......@@ -10,21 +10,21 @@
<card title="1">
<h5 class="cul-hd-card-title" slot="header">
总保费:
<strong>{{ baseInfo.amount }}</strong>
<strong>{{ goodInfo.totalAmount }}</strong>
{{ baseInfo.unit }}
</h5>
<p class="cul-hd-card-content">
推荐理由:
{{ baseInfo.reason }}
{{ goodInfo.remarks }}
</p>
</card>
</div>
<div class="cul-det">
<card title="保障分布">
<div class="cul-dist">
<div class="cul-dist-item" v-for="(item, index) in distList" :key="index">
<h3>{{ item.price }}</h3>
<p>{{ item.title }}</p>
<div class="cul-dist-item" v-for="(item, index) in goodInfo.ensure" :key="index">
<h3>{{ item.insuredAmount }}</h3>
<p>{{ item.productType }}</p>
</div>
</div>
</card>
......@@ -40,39 +40,41 @@
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in overviewList" :key="index">
<th>{{ item.title }}</th>
<th>{{ item.amount }}</th>
<th>{{ item.range }}</th>
<th>{{ item.way }}</th>
<tr v-for="(item, index) in goodInfo.ensure" :key="index">
<th>{{ item.productType }}</th>
<th>{{ item.insuredAmount }}</th>
<th>{{ item.term }}</th>
<th>{{ item.paymentPeriod }}</th>
<th>{{ item.price }}</th>
</tr>
</tbody>
</table>
</card>
<card title="保障产品">
<div class="good-item" v-for="(item, index) in overviewList" :key="index">
<div class="good-item" v-for="(item, index) in goodInfo.ensure" :key="index">
<div class="good-title">
{{ item.goods }}
<cr-tag :type="tagFilter(item.type)">{{ item.title }}</cr-tag>
{{ item.goods || "" }}
<cr-tag :type="tagFilter(item.productType)">{{ item.productType }}</cr-tag>
</div>
<div class="good-date">
<span class="good-date-item">
保额 | <strong>{{ item.amount }}</strong>
保额 | <strong>{{ item.insuredAmount }}</strong>
</span>
<span class="good-date-item">
缴费期 | <strong>{{ item.way }}</strong>
缴费期 | <strong>{{ item.paymentPeriod }}</strong>
</span>
<span class="good-date-item">
保障期限 | <strong>{{ item.range }}</strong>
保障期限 | <strong>{{ item.term }}</strong>
</span>
</div>
<div class="good-price">
<div class="good-price-item">
<strong>{{ item.goodsPirce }}</strong>
{{ item.goodsUnit }}
<strong>{{ item.price }}</strong>
{{ item.goodsUnit || "-" }}
</div>
<cr-button type="warning" @click="goDetail(item.id, item.type)">去投保</cr-button>
<cr-button type="warning" @click="goDetail(item.productNo, item.productType)">
去投保
</cr-button>
</div>
<div class="good-reason">
<div class="good-reason-avator">
......@@ -91,6 +93,7 @@
<script>
import Card from "@/components/Card";
import { getCulsuggestion } from "@/api/consultant";
import avator from "@/assets/images/consultant/avator.png";
export default {
name: "ConsultantSuccess",
......@@ -100,6 +103,9 @@ export default {
data() {
return {
avator,
goodInfo: {
ensure: []
},
baseInfo: {
userName: "王斌",
sex: 1,
......@@ -194,6 +200,12 @@ export default {
},
goDetail(id, type) {
this.$router.push({ url: "/goods/detail", query: { id, type } });
},
async getSuggestion() {
const res = await getCulsuggestion();
if (res) {
this.goodInfo = res;
}
}
}
};
......
......@@ -25,9 +25,9 @@
</h5>
<div class="cul-tip">{{ stepTips[currentStep].sub }}</div>
</template>
<cr-form class="cul-hd-card-body" @submit="onSubmit" @failed="onFailed">
<cr-form class="cul-hd-card-body">
<cr-radio-btn
v-model="formData.who"
v-model="formData.relation"
class="qus-radio"
:radio-data="insuredOptions"
v-show="currentStep === 0"
......@@ -43,7 +43,7 @@
:show-toolbar="false"
/>
<cr-radio-btn
v-model="formData.social"
v-model="formData.socialSecurity"
:radio-data="hasSocialOptions"
class="qus-radio cul-inline"
v-show="currentStep === 2"
......@@ -53,7 +53,7 @@
:columns="incomeOptions"
@change="
(picker, value) => {
onPickerChange(picker, value, 'income');
onPickerChange(picker, value, 'annualIncome');
}
"
v-show="currentStep === 3"
......@@ -75,21 +75,21 @@
:list="areaList"
@change="
(picker, value) => {
onPickerChange(picker, value, 'area');
onPickerChange(picker, value, 'addressCode');
}
"
:columns-num="2"
v-show="currentStep === 5"
/>
<cr-radio-btn
v-model="formData.solve"
v-model="formData.questionType"
:radio-data="solveOptions"
class="qus-radio cul-inline"
v-show="currentStep === 6"
/>
<div class="qus-form" v-show="currentStep === 7">
<cr-field
v-model="formData.username"
v-model="formData.userName"
name="姓名"
label="姓名"
placeholder="请输入投保人姓名"
......@@ -101,9 +101,10 @@
label="您的性别"
:rules="[{ required: true, message: '请选择性别' }]"
>
<cr-radio-btn slot="input" v-model="formData.sex" :radio-data="sexOptions" />
<cr-radio-btn slot="input" v-model="formData.gender" :radio-data="sexOptions" />
</cr-field>
<cr-field
<!-- <cr-field
v-if="!isLogin"
v-model="formData.phone"
type="password"
name="预留手机"
......@@ -112,6 +113,7 @@
:rules="[{ required: true, message: '请输入手机号' }]"
/>
<cr-field
v-if="!isLogin"
v-model="formData.code"
name="验证码"
label="验证码"
......@@ -119,7 +121,7 @@
:rules="[{ required: true, message: '输入短信验证码' }]"
>
<a href="javascript:;" slot="button">发送验证码</a>
</cr-field>
</cr-field> -->
</div>
</cr-form>
<div slot="footer" class="cul-hd-card-footer">
......@@ -145,7 +147,9 @@
<script>
import CrRadioBtn from "@/components/CrRadioBtn";
import Card from "@/components/Card";
import localStorage from "@/service/localStorage";
import areaList from "@qg/cherry-ui/src/area/demo/china";
import { subCulQus } from "@/api/consultant";
export default {
name: "ConsultantQuestion",
components: {
......@@ -154,65 +158,94 @@ export default {
},
data() {
return {
isLogin: localStorage.get("mongoToken"),
areaList,
formData: {},
formData: {
birthday: "",
socialSecurity: "",
annualIncome: "",
loan: "",
addressCode: "111,111,11",
questionType: "",
userName: "",
gender: "",
relation: ""
},
currentStep: 0,
showSubState: false,
stepTips: [
{
title: "您准备为谁买保险?",
tag: "relation",
rule: "请选择关系",
sub:
"想为多人买保险的情况,请在和保险顾问沟通时说明信息,保险顾问会为每一位家人量身定制方案哦~~"
},
{
title: "请选择TA的出生日期?",
tag: "birthday",
rule: "请选择出生日期",
sub: "出生日期会影响保费计算,准确的填写可让保险顾问帮您更精准的测算保费~"
},
{ title: "请选择TA有无社保", sub: "新农合也算社保哦~~" },
{
title: "请选择TA有无社保",
tag: "socialSecurity",
rule: "请选择有无社保",
sub: "新农合也算社保哦~~"
},
{
title: "请选择您的年收入?",
tag: "annualIncome",
rule: "请选择您的年收入",
sub: "保险顾问会根据您的年收入,帮您选择合适的额度和保费预算"
},
{
title: "请问您每月要还多少贷款呢?",
tag: "loan",
rule: "请选择贷款",
sub: "贷款包含房贷、车贷、信用卡等,了解您的贷款情况,能让顾问更好的帮您定制寿险额度"
},
{
title: "请选择您的居住城市?",
tag: "addressCode",
rule: "请选择居住城市",
sub: "保险产品的销售会受到地区的限制,了解您的居住城市能让顾问帮您挑选到合适的保险"
},
{
title: "您主要想解决哪方面问题?",
tag: "questionType",
rule: "请选择问题类型",
sub: "告诉保险顾问您的咨询意向,可以为您提供更专业的服务哦"
},
{
title: "请填写您的个人信息",
rule: "请完善个人信息",
sub: "请预留您的信息,保险师会在您方便时联系您"
}
],
insuredOptions: [
{ label: "本人", value: "1" },
{ label: "配偶", value: "2" },
{ label: "儿子", value: "3" },
{ label: "女儿", value: "4" },
{ label: "父亲", value: "5" },
{ label: "母亲", value: "6" }
{ label: "本人", value: "本人" },
{ label: "配偶", value: "配偶" },
{ label: "儿子", value: "儿子" },
{ label: "女儿", value: "女儿" },
{ label: "父亲", value: "父亲" },
{ label: "母亲", value: "母亲" }
],
hasSocialOptions: [
{ label: "", value: "1" },
{ label: "", value: "2" }
{ label: "", value: "0" }
],
sexOptions: [
{ label: "", value: "1" },
{ label: "", value: "2" }
{ label: "", value: "0" },
{ label: "", value: "1" }
],
incomeOptions: ["10万", "20万", "25万", "30万"],
loanOptions: ["无房贷", "1000元", "2000元", "3000元", "4000元"],
solveOptions: [
{ label: "之前从没买过保险,打算配置保险", value: "1" },
{ label: "已配置部分保险,打算再补充一些", value: "2" },
{ label: "不配置保险,就想咨询些保险疑惑", value: "3" },
{ label: "", value: "4" }
{ label: "之前从没买过保险,打算配置保险", value: "之前从没买过保险,打算配置保险" },
{ label: "已配置部分保险,打算再补充一些", value: "已配置部分保险,打算再补充一些" },
{ label: "不配置保险,就想咨询些保险疑惑", value: "不配置保险,就想咨询些保险疑惑" },
{ label: "", value: "" }
],
processList: [
{ icon: "package-active", sub: "聘请成功", active: true },
......@@ -241,12 +274,15 @@ export default {
mounted() {},
methods: {
nextQuestion() {
if (this.currentStep === 7) {
const { currentStep, stepTips, formData } = this;
const userName = formData.userName && formData.gender;
if (currentStep === 7 && userName) {
this.showSubState = true;
setTimeout(() => {
this.showSubState = false;
this.$router.push("/consultant/exclusive");
}, 3000);
this.onSubmit();
return;
}
if (!formData[stepTips[currentStep].tag] || currentStep === 7) {
this.$notify(stepTips[currentStep].rule);
return;
}
this.currentStep++;
......@@ -261,10 +297,14 @@ export default {
this.formData[type] = value;
},
async onSubmit() {
// console.log('sucess', values);
},
onFailed() {
// console.log('fail', errorInfo);
const { formData } = this;
const res = await subCulQus(formData);
if (res) {
setTimeout(() => {
this.showSubState = false;
this.$parent.getOrderInfo();
}, 2000);
}
}
}
};
......
......@@ -22,13 +22,7 @@
为了给您提供更精准的保险定制服务,请花1分钟填写问卷,让顾问更了解您。
</div>
</div>
<cr-button
type="warning"
size="large"
block
slot="footer"
@click="$router.push('/consultant/question')"
>
<cr-button type="warning" size="large" block slot="footer" @click="startQuestion">
开始填写问卷
</cr-button>
</card>
......@@ -52,7 +46,12 @@ export default {
]
};
},
mounted() {}
mounted() {},
methods: {
startQuestion() {
this.$parent.changeQuestion();
}
}
};
</script>
<style lang="less" src="./index.less" scoped></style>
<template>
<div class="container">
<div>
<buy v-if="orderState === 1" />
<success v-if="orderState === 2 && isLogin && !showQuestion" />
<exclusive
v-if="(orderState === 3 || orderState === 4) && isLogin"
:has-suggestion="orderState === 4"
/>
<question v-if="showQuestion && isLogin" />
<tabbar />
</div>
</template>
<script>
import Tabbar from "@/components/Tabbar";
import Buy from "./Buy";
import Success from "./Success";
import Question from "./Question";
import Exclusive from "./Exclusive";
import { mapState } from "vuex";
import localStorage from "@/service/localStorage";
import { getCulOrder } from "@/api/consultant";
export default {
name: "Consultant",
components: {
Tabbar
Tabbar,
Buy,
Success,
Exclusive,
Question
},
data() {
return {};
return {
isLogin: localStorage.get("mongoToken"),
showQuestion: false,
orderInfo: [
{
consultantOrderNo: "",
state: 1
}
]
};
},
computed: {
orderState() {
return this.orderInfo[0].state;
},
...mapState(["isShowLogin"])
},
watch: {
isShowLogin(val) {
if (!val) {
this.isLogin = localStorage.get("mongoToken");
}
}
},
mounted() {
this.getOrderInfo();
},
methods: {
async getOrderInfo() {}
async getOrderInfo() {
if (!this.isLogin) return;
const res = await getCulOrder();
if (res) {
this.orderInfo = res;
}
},
changeQuestion() {
this.showQuestion = true;
}
}
};
</script>
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