mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-10 03:26:45 +08:00
430 lines
15 KiB
Vue
430 lines
15 KiB
Vue
.
|
||
<template>
|
||
<div class="proposal-list-container">
|
||
<van-sticky>
|
||
<van-tabs :line-width="45" title-inactive-color="#999999" v-model="active" @change="tabChange" title-active-color="#E9332E">
|
||
<van-tab title="制作中" name="1"></van-tab>
|
||
<van-tab title="已制作" name="2"></van-tab>
|
||
<van-tab title="转投保" name="3"></van-tab>
|
||
</van-tabs>
|
||
</van-sticky>
|
||
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
||
<van-list
|
||
v-model="loading"
|
||
:immediate-check="false"
|
||
:finished="finished"
|
||
:finished-text="finishedText"
|
||
error-text="请求失败,点击重新加载"
|
||
:error.sync="error"
|
||
@load="loadMore"
|
||
class="pb45"
|
||
>
|
||
<div v-if="isSuccess">
|
||
<div v-if="proposalList.length > 0">
|
||
<div v-for="(item, index) in proposalList" :key="index">
|
||
<div class="fs12 mt20 mb5 text-center c-gray-dark">{{ item.orderInfoDTO.appntDateLabel }}</div>
|
||
|
||
<div class="bg-white radius5 mh15 pv15 pr15 pl10">
|
||
<div class="flex justify-content-s align-items-c">
|
||
<div>
|
||
<div class="w45 inline-b">
|
||
<van-tag plain color="#5CA7DE">投保</van-tag>
|
||
</div>
|
||
<span class="fs15 c-gray-dark">{{ item.appntDTO.name }}</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div v-for="(insure, insureIndex) in item.insuredDTOs" :key="insureIndex">
|
||
<div class="mv15">
|
||
<div class="w45 inline-b">
|
||
<van-tag plain color="#DD9C56">被保</van-tag>
|
||
</div>
|
||
<span class="fs15 c-gray-dark">{{ insure.name }}</span>
|
||
</div>
|
||
<div v-for="(mainRisk, riskIndex) in insure.mainRisk" :key="riskIndex">
|
||
<div class="mv10">
|
||
<span class="w45 inline-b">
|
||
<van-tag plain type="danger">主险</van-tag>
|
||
</span>
|
||
<span class="fs15 c-gray-dark">{{ mainRisk.riskName }}</span>
|
||
</div>
|
||
<div class="mv10 pl45 flex" v-for="(addtion, addtionIndex) in mainRisk.addtion" :key="addtionIndex">
|
||
<span class="mr10" style="flex-shrink: 0">
|
||
<van-tag mark color="#DDF2EF" text-color="#E9332E">附加</van-tag>
|
||
</span>
|
||
<span class="fs13">{{ addtion.riskName }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="flex fs15 c-gray-dark justify-content-s mt5 mb5">
|
||
<span class="c-gray-darker fwb">首期总保费(元)</span>
|
||
<span class="yellow fwb">{{ item.firstPrem | moneyFormat }}</span>
|
||
</div>
|
||
<div class="text-right pv5">
|
||
<van-button v-if="active == 2" round size="small" @click="toInsurance(item)" class="mr5" type="danger">转投保</van-button>
|
||
<van-button v-if="active == 2" round @click="copy(item)" size="small" class="mr5" type="danger">复制计划书</van-button>
|
||
<van-button v-if="active == 1" round @click="edit(item)" size="small" class="mr5" type="danger">编辑</van-button>
|
||
<van-button v-if="active == 2" plain round @click="preview(item)" size="small" class="mr5" type="danger">预览</van-button>
|
||
<van-button size="small" round :plain="active == 3 ? false : true" @click="deleteProposal(item, active, index)" type="danger">删除</van-button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div v-else class="text-center">
|
||
<img class="mt40 w250" src="@/assets/images/pic_page-non.png" />
|
||
<div class="fs17 c-gray-dark mt40">暂无建议书</div>
|
||
</div>
|
||
</van-list>
|
||
</van-pull-refresh>
|
||
<van-button type="danger" @click="addProposal" class="bottom-btn fs16">点我新增</van-button>
|
||
|
||
<check-agent @checModelSuccessMethod="initThisPage" />
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { Tabs, Tab, Tag, Dialog, List, Sticky, Toast,PullRefresh } from 'vant'
|
||
import { getList, toInsurance, deleteProposal,proposalCopy } from '@/api/ebiz/proposal/proposal.js'
|
||
import { funcPermCheck } from '@/api/ebiz/common/common'
|
||
import { formatRiskList } from '@/assets/js/utils/formatRiskList.js'
|
||
import riskRules from '../common/risk-rules.js'
|
||
import CheckAgent from '@/components/common/CheckAgent'
|
||
|
||
export default {
|
||
name: 'proposalList',
|
||
components: {
|
||
[CheckAgent.name]: CheckAgent,
|
||
[Tabs.name]: Tabs,
|
||
[Tab.name]: Tab,
|
||
[Tag.name]: Tag,
|
||
[List.name]: List,
|
||
[Sticky.name]: Sticky,
|
||
[PullRefresh.name]: PullRefresh
|
||
},
|
||
|
||
data() {
|
||
return {
|
||
isCheck: 0, //查看是否有权限
|
||
active: 1,
|
||
proposalList: [],
|
||
finishedText: '没有更多了',
|
||
finished: false,
|
||
error: false,
|
||
loading: false,
|
||
pageSize: 5, //每页数据条数
|
||
morePage: 1, // 当前页数
|
||
isSuccess: false,
|
||
refreshing:false //下拉刷新
|
||
}
|
||
},
|
||
created() {
|
||
this.$CacheUtils.removeLocItem('proposalNo')
|
||
this.$CacheUtils.removeLocItem('canMoveOn')
|
||
this.$CacheUtils.removeLocItem('orderNo')
|
||
funcPermCheck({}).then(res => {
|
||
this.isCheck = res.result
|
||
})
|
||
},
|
||
mounted() {
|
||
this.$jump({
|
||
flag: 'navigation',
|
||
extra: {
|
||
title: '建议书列表',
|
||
hiddenRight: '1'
|
||
}
|
||
})
|
||
},
|
||
methods: {
|
||
initThisPage(showFlag) {
|
||
if (showFlag) {
|
||
return
|
||
}
|
||
setTimeout(() => {
|
||
// eslint-disable-next-line no-undef
|
||
EWebBridge.webCallAppInJs('webview_left_button', {
|
||
intercept: '1' //是否拦截原生返回事件 1是 其他否
|
||
})
|
||
}, 100)
|
||
window.appCallBack = this.appCallBack
|
||
this.loadMore()
|
||
},
|
||
appCallBack(data) {
|
||
if (data.trigger == 'left_button_click') {
|
||
this.$jump({
|
||
flag: 'home',
|
||
extra: {}
|
||
})
|
||
}
|
||
},
|
||
//获取建议书列表
|
||
getProposalList(tabType, pageInfo) {
|
||
let status = '0' + tabType
|
||
let request = {
|
||
proposalInfoDTO: {
|
||
status
|
||
},
|
||
pageInfo
|
||
}
|
||
getList(request).then(res => {
|
||
if (res.result == '0') {
|
||
this.isSuccess = true
|
||
let content = res.content
|
||
this.morePage++
|
||
let list = content.list
|
||
if (list.length == 0) {
|
||
this.finishedText = ''
|
||
} else {
|
||
this.finishedText = '已经全部加载'
|
||
}
|
||
list = formatRiskList(list, 'insuredDTOs', 'riskDTOLst') //格式化数据为本地显示结果
|
||
|
||
this.proposalList = this.proposalList.concat(list)
|
||
this.proposalList.forEach(item => {
|
||
// 建议书投保人/被保人姓名不必填, 填写姓名时展示姓名(落库),不填写姓名时展示性别+年龄,如:男30岁(不落库)
|
||
if(!item.appntDTO.name){
|
||
let sexAppnt = item.appntDTO.sex == '0'?'男':'女'
|
||
item.appntDTO.name = sexAppnt + item.appntDTO.age+'岁'
|
||
}
|
||
if(item.insuredDTOs.length){
|
||
item.insuredDTOs.forEach(item01 => {
|
||
if(!item01.name){
|
||
let sex = item01.sex == '0'?'男':'女'
|
||
item01.name = sex + item01.insuredAge+'岁'
|
||
}
|
||
})
|
||
}
|
||
})
|
||
if (this.proposalList.length == 0) {
|
||
this.isSuccess = false
|
||
}
|
||
this.loading = false
|
||
if (content.nextPage == 0) {
|
||
//当下一页为0时 表示全部数据加载完毕
|
||
this.finished = true
|
||
}
|
||
this.refreshing = false
|
||
} else {
|
||
this.refreshing = true
|
||
this.finished = true
|
||
this.loading = false
|
||
this.finishedText = res.resultMessage
|
||
}
|
||
})
|
||
},
|
||
|
||
loadMore() {
|
||
let pageInfo = {
|
||
pageNum: this.morePage,
|
||
pageSize: this.pageSize
|
||
}
|
||
let active = this.active
|
||
this.getProposalList(active, pageInfo)
|
||
},
|
||
//下拉刷新
|
||
onRefresh() {
|
||
console.log(111111111111111)
|
||
this.finished = false // 不写这句会导致你上拉到底过后在下拉刷新将不能触发下拉加载事件
|
||
let pageInfo = {
|
||
pageNum: 1,
|
||
pageSize: this.pageSize
|
||
}
|
||
let active = this.active
|
||
this.proposalList = []
|
||
this.getProposalList(active, pageInfo) // 加载数据
|
||
},
|
||
tabChange(index) {
|
||
this.morePage = 1
|
||
this.active = index
|
||
this.proposalList = []
|
||
;[this.loading, this.finished] = [true, false]
|
||
|
||
this.finishedText = '正在加载...'
|
||
this.loadMore()
|
||
},
|
||
//删除建议书
|
||
deleteProposal(item) {
|
||
let params = {
|
||
orderDTO: {
|
||
orderInfoDTO: {
|
||
orderNo: item.orderInfoDTO.orderNo
|
||
}
|
||
},
|
||
type: '1'
|
||
}
|
||
Dialog.confirm({
|
||
className: 'dialog-delete',
|
||
title: '提示',
|
||
message: '确认删除建议书?',
|
||
cancelButtonColor: '#E9332E',
|
||
confirmButtonColor: '#FFFFFF'
|
||
})
|
||
.then(() => {
|
||
deleteProposal(params).then(res => {
|
||
if (res.result == '0') {
|
||
this.proposalList = []
|
||
this.morePage = 1
|
||
;[this.loading, this.finished] = [true, false]
|
||
this.loadMore()
|
||
}
|
||
})
|
||
})
|
||
.catch(() => {})
|
||
},
|
||
//点我新增
|
||
addProposal() {
|
||
let thisToken = this.$CacheUtils.getLocItem('token')
|
||
let thisbranchType = ''
|
||
if(this.$CacheUtils.getLocItem('branchType') == '13') {
|
||
thisbranchType = this.$CacheUtils.getLocItem('branchType')
|
||
}
|
||
window.localStorage.clear()
|
||
this.$CacheUtils.setLocItem('token', thisToken)
|
||
if(thisbranchType) {
|
||
this.$CacheUtils.setLocItem('branchType', thisbranchType)
|
||
}
|
||
this.$jump({
|
||
flag: 'h5',
|
||
extra: {
|
||
url: location.origin + '/#/proposal/appnt'
|
||
},
|
||
routerInfo: {
|
||
path: '/proposal/appnt'
|
||
}
|
||
})
|
||
},
|
||
//编辑
|
||
edit(item) {
|
||
let thisToken = this.$CacheUtils.getLocItem('token')
|
||
let thisbranchType = ''
|
||
if(this.$CacheUtils.getLocItem('branchType') == '13') {
|
||
thisbranchType = this.$CacheUtils.getLocItem('branchType')
|
||
}
|
||
window.localStorage.clear()
|
||
this.$CacheUtils.setLocItem('token', thisToken)
|
||
if(thisbranchType) {
|
||
this.$CacheUtils.setLocItem('branchType', thisbranchType)
|
||
}
|
||
//建议书列表 编辑=》制作中的建议书跳转到选择被保险人页面;
|
||
this.$CacheUtils.setLocItem('proposalNo', item.orderInfoDTO.orderNo)
|
||
this.$CacheUtils.setLocItem('canMoveOn', 1)
|
||
let url = `/proposal/chooseInsuredPerson?proposalOrderNo=${item.orderInfoDTO.orderNo}`
|
||
this.$jump({
|
||
flag: 'h5',
|
||
extra: {
|
||
url: location.origin + `/#${url}`,
|
||
needRefresh: '1'
|
||
},
|
||
routerInfo: {
|
||
path: url
|
||
}
|
||
})
|
||
},
|
||
//拷贝
|
||
copy(item) {
|
||
//建议书列表 编辑=》制作中的建议书跳转到选择被保险人页面;
|
||
this.$CacheUtils.setLocItem('canMoveOn', 1)
|
||
let params = {
|
||
orderNo:item.orderInfoDTO.orderNo
|
||
}
|
||
proposalCopy(params).then(res => {
|
||
if (res.result == '0') {
|
||
this.$CacheUtils.setLocItem('proposalNo', res.content)
|
||
let url = `/proposal/appnt?proposalOrderNo=${res.content}`
|
||
this.$router.push({ path: url })
|
||
}
|
||
})
|
||
// this.$jump({
|
||
// flag: 'h5',
|
||
// extra: {
|
||
// url: location.origin + `/#${url}`,
|
||
// needRefresh: '1'
|
||
// },
|
||
// routerInfo: {
|
||
// path: url
|
||
// }
|
||
// })
|
||
},
|
||
//预览 跳转至利益演示
|
||
preview(item) {
|
||
let thisToken = this.$CacheUtils.getLocItem('token')
|
||
window.localStorage.clear()
|
||
this.$CacheUtils.setLocItem('token', thisToken)
|
||
this.$CacheUtils.setLocItem('proposalNo', item.orderInfoDTO.orderNo)
|
||
//新增 解决直接点击预览报错问题
|
||
localStorage.mainRiskCode = item.insuredDTOs[0].mainRisk[0].mainRiskCode
|
||
let url = `/proposal/proposalInfo?proposalOrderNo=${item.orderInfoDTO.orderNo}`
|
||
this.$jump({
|
||
flag: 'h5',
|
||
extra: {
|
||
url: location.origin + `/#${url}`,
|
||
},
|
||
routerInfo: {
|
||
path: url
|
||
}
|
||
})
|
||
},
|
||
//转投保
|
||
async toInsurance(item) {
|
||
let thisToken = this.$CacheUtils.getLocItem('token')
|
||
window.localStorage.clear()
|
||
this.$CacheUtils.setLocItem('token', thisToken)
|
||
if (this.isCheck == '1') {
|
||
//校验该代理人是否有该产品的售卖权限
|
||
return this.$toast('您暂无使用权限!如有问题咨询,请联系个险业务部。')
|
||
}
|
||
if (item.insuredDTOs[0].mainRisk.length === 2) {
|
||
let prodCodes = item.insuredDTOs[0].riskDTOLst
|
||
let prd26 = prodCodes.some(item => {
|
||
return item.riskCode === 'GFRS_M0026'
|
||
})
|
||
let prd17 = prodCodes.some(item => {
|
||
return item.riskCode === 'GFRS_M0017'
|
||
})
|
||
// 如果选择的产品不是GFRS_M0026&GFRS_M0017弹出提示
|
||
if (!(prd26 && prd17)) {
|
||
return Toast.fail('暂不支持组合产品转投保')
|
||
}
|
||
}
|
||
let permissionRiskCode
|
||
let flag = item.insuredDTOs[0].riskDTOLst.some(v => {
|
||
permissionRiskCode = v.riskCode
|
||
return v.riskCode == 'GFRS_M0024' || v.riskCode == 'GFRS_M0040' || v.riskCode == 'GFRS_M0044'|| v.riskCode == 'GFRS_M0051'
|
||
})
|
||
let flagPermission = await riskRules.getProductSellPermissionList(permissionRiskCode, this)
|
||
if (flag && flagPermission.flag) {
|
||
return this.$toast(flagPermission.resultMessage)
|
||
}
|
||
// let flag = item.insuredDTOs[0].riskDTOLst.some(v => {
|
||
// return v.riskCode == 'GFRS_M0024' //桂企单独调用check
|
||
// })
|
||
|
||
let params = {
|
||
proposalInfoDTO: {
|
||
proposalNo: item.orderInfoDTO.orderNo
|
||
}
|
||
}
|
||
toInsurance(params).then(res => {
|
||
if (res.result == '0') {
|
||
localStorage.chooseProductCodes = ''
|
||
this.$CacheUtils.setLocItem('orderNo', res.content.orderNo)
|
||
this.$jump({
|
||
flag: 'h5',
|
||
extra: {
|
||
url: location.origin + '/#/sale/insuredInfo?edit=1&orderNo=' + res.content.orderNo,
|
||
backToFirst: '1'
|
||
},
|
||
routerInfo: {
|
||
path: '/sale/insuredInfo?edit=1&orderNo=' + res.content.orderNo
|
||
}
|
||
})
|
||
} else {
|
||
Toast.fail(res.resultMessage)
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|