Merge branch 'feature/GFRS-2065【1125】惠桂保数据导入' into dev

# Conflicts:
#	src/assets/js/utils/request.js
#	src/router/ebiz/index.js
This commit is contained in:
mengxiaolong
2020-11-26 10:22:54 +08:00
6 changed files with 474 additions and 80 deletions

19
src/api/ebiz/hgb/index.js Normal file
View File

@@ -0,0 +1,19 @@
import request from '@/assets/js/utils/request'
import getUrl from '@/assets/js/utils/get-url'
// 惠桂保数据查询
export function selectHgb(data) {
return request({
url: getUrl('/sale/order/selectHgb', 1),
method: 'post',
data
})
}
export function selectHgbDetail(data) {
return request({
url: getUrl('/sale/order/getHgbDetail', 1),
method: 'post',
data
})
}

View File

@@ -6,7 +6,6 @@ import MD5 from 'js-md5'
import CacheUtils from '@/assets/js/utils/cacheUtils' import CacheUtils from '@/assets/js/utils/cacheUtils'
import BusinessCommon from '@/assets/js/business-common' import BusinessCommon from '@/assets/js/business-common'
let proposal = [ let proposal = [
'/proposal/proposal/list', '/proposal/proposal/list',
'/proposal/proposal/toInsurance', '/proposal/proposal/toInsurance',
@@ -97,6 +96,9 @@ let preserve = [
// 个险业绩排行优化 // 个险业绩排行优化
let performanceRanking = ['/data/performance/getComList', '/data/performance/getComPerformance'] let performanceRanking = ['/data/performance/getComList', '/data/performance/getComPerformance']
// 惠桂保
let hgb = ['/sale/order/selectHgb', '/sale/order/getHgbDetail']
let whiteList = [ let whiteList = [
'/customer/agent/getCustomersList', '/customer/agent/getCustomersList',
...proposal, ...proposal,
@@ -108,7 +110,8 @@ let whiteList = [
...preserve, ...preserve,
...productStore, ...productStore,
...renewalManage, ...renewalManage,
...performanceRanking ...performanceRanking,
...hgb
] ]
// 创建axios实例 // 创建axios实例
@@ -118,90 +121,96 @@ const service = axios.create({
// request拦截器 // request拦截器
service.interceptors.request.use( service.interceptors.request.use(
async config => { async config => {
let relativePath = config.url && config.url.split(configApp.API_VERSION)[1] let relativePath = config.url && config.url.split(configApp.API_VERSION)[1]
if (whiteList.includes(relativePath)) { if (whiteList.includes(relativePath)) {
Toast.loading({ Toast.loading({
duration: 0, // 持续展示 toast duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击 forbidClick: true, // 禁用背景点击
loadingType: 'spinner', loadingType: 'spinner',
message: '加载中……' message: '加载中……'
}) })
}
/**
* 请求拦截处理(待添加 判断走统一网关处理)
*/
if(config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0]) && configApp.API_VERSION == 'v2'){
if(!config.data || config.data == null){
config.data = {}
}
if(!!config.data && config.data != null){
let encrypt = AESTools.AESEncrypt(JSON.stringify(config.data),configApp.REQ_PWD)
config.data = {"data": encrypt }
}
}
// token 不存在初始化处理
let token = CacheUtils.getLocItem('token');
if (!token){
// 设备类型
const target = BusinessCommon.device()
// 安卓or苹果
if (target.isAndroid || target.isIphone) {
// eslint-disable-next-line no-undef
const res = await EWebBridge.webCallAppInJs('getToken')
CacheUtils.setLocItem('token', JSON.parse(res).token)
}
}
config.headers['token'] = CacheUtils.getLocItem('token')
// 添加请时间戳
let timeStr = new Date().getTime() + '';
config.headers['timeStr'] = timeStr;
config.headers['signature'] = MD5(timeStr + CacheUtils.getLocItem('token'));
return config
},
error => {
// Do something with request error
Promise.reject(error)
} }
/**
* 请求拦截处理(待添加 判断走统一网关处理)
*/
if (config.url && /api\/$/.test(config.url.split(configApp.API_VERSION)[0]) && configApp.API_VERSION == 'v2') {
if (!config.data || config.data == null) {
config.data = {}
}
if (!!config.data && config.data != null) {
let encrypt = AESTools.AESEncrypt(JSON.stringify(config.data), configApp.REQ_PWD)
config.data = { data: encrypt }
}
}
// token 不存在初始化处理
let token = CacheUtils.getLocItem('token')
if (!token) {
// 设备类型
const target = BusinessCommon.device()
// 安卓or苹果
if (target.isAndroid || target.isIphone) {
// eslint-disable-next-line no-undef
const res = await EWebBridge.webCallAppInJs('getToken')
CacheUtils.setLocItem('token', JSON.parse(res).token)
}
}
config.headers['token'] = CacheUtils.getLocItem('token')
// 添加请时间戳
let timeStr = new Date().getTime() + ''
config.headers['timeStr'] = timeStr
config.headers['signature'] = MD5(timeStr + CacheUtils.getLocItem('token'))
return config
},
error => {
// Do something with request error
Promise.reject(error)
}
) )
// respone拦截器 // respone拦截器
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
let res = response.data let res = response.data
if( configApp.API_VERSION == 'v2' && response.config.url && response.headers['content-type'].match(/application\/json/) && /api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])){ if (
if(res.response){// 正常情況返回必有response 节点 configApp.API_VERSION == 'v2' &&
res = JSON.parse(AESTools.AESDecrypt(res.response,configApp.REQ_PWD)) response.config.url &&
} response.headers['content-type'].match(/application\/json/) &&
/api\/$/.test(response.config.url.split(configApp.API_VERSION)[0])
) {
if (res.response) {
// 正常情況返回必有response 节点
res = JSON.parse(AESTools.AESDecrypt(res.response, configApp.REQ_PWD))
} }
Toast.clear()
if (res.code != 0) {
if (res.code == 10001 || res.code == 10002) {
Dialog.confirm({
confirmButtonText: '重新登录',
message: '你已被登出,可以取消继续留在该页面,或者重新登录'
}).then(() => {
//eslint-disable-next-line
EWebBridge.webCallAppInJs('bridge', {
flag: 'login'
})
})
} else {
//Toast.fail(res.msg)
}
return Promise.reject(res)
} else {
return res.content
}
},
error => {
Toast.clear()
console.log('err' + error) // for debug
//Toast.fail(error.message)
return Promise.reject(error)
} }
Toast.clear()
if (res.code != 0) {
if (res.code == 10001 || res.code == 10002) {
Dialog.confirm({
confirmButtonText: '重新登录',
message: '你已被登出,可以取消继续留在该页面,或者重新登录'
}).then(() => {
//eslint-disable-next-line
EWebBridge.webCallAppInJs('bridge', {
flag: 'login'
})
})
} else {
//Toast.fail(res.msg)
}
return Promise.reject(res)
} else {
return res.content
}
},
error => {
Toast.clear()
console.log('err' + error) // for debug
//Toast.fail(error.message)
return Promise.reject(error)
}
) )
export default service export default service

22
src/router/ebiz/hgb.js Normal file
View File

@@ -0,0 +1,22 @@
// 惠桂保路由信息
const HgbIndex = () => import('@/views/ebiz/hgb')
const Detail = () => import('@/views/ebiz/hgb/Detail')
export default [
{
name: 'HgbIndex',
path: '/hgb/index',
component: HgbIndex,
meta: {
title: '惠桂保客户清单'
}
},
{
name: 'HgbDetail',
path: '/hgb/orderDetail/:prtNo',
component: Detail,
props: true,
meta: {
title: '保单详情'
}
}
]

View File

@@ -27,6 +27,7 @@ import attendance from './attendance'
// 开门红业绩 // 开门红业绩
import goodStart from './goodStart' import goodStart from './goodStart'
import hgb from './hgb'
export default [ export default [
...proposal, ...proposal,
@@ -53,5 +54,6 @@ export default [
...performance, ...performance,
...renewalManage, ...renewalManage,
...question, ...question,
...goodStart ...goodStart,
...hgb
] //根据需要进行删减 ] //根据需要进行删减

View File

@@ -0,0 +1,81 @@
<template>
<div class="hgb-detail bg-white mt10 p20">
<van-cell :title="row.rowName" :value="blankFilter(row.key)" v-for="(row, i) in rowInfos" :key="i" />
</div>
</template>
<script>
import { selectHgbDetail } from '@/api/ebiz/hgb'
export default {
props: {
prtNo: {
type: String
}
},
data() {
return {
rowInfos: [
{ rowName: '保单号', key: 'orderNumber' },
{ rowName: '投保人姓名', key: 'applicantName' },
{ rowName: '投保人电话', key: 'applicantPhone' },
{ rowName: '被保人姓名', key: 'insuredName' },
{ rowName: '被保人电话', key: 'insuredPhone' },
{ rowName: '被保人性别', key: 'insuredGender' },
{ rowName: '被保人出生日期', key: 'insuredBirthday' },
{ rowName: '生效日', key: 'effectiveDate' },
{ rowName: '到期日', key: 'expireDate' }
],
orderNumber: '',
applicantName: '',
applicantPhone: '',
insuredName: '',
insuredPhone: '',
insuredGender: '',
insuredBirthday: '',
effectiveDate: '',
expireDate: ''
}
},
created() {
this.getData()
},
methods: {
async getData() {
const res = await selectHgbDetail({ policyNo: this.prtNo })
if (res.result === '0') {
if (res.content && res.content.data) {
let appntDTO = res.content.data.appntDTO
if (appntDTO) {
this.applicantName = appntDTO.name
this.applicantPhone = appntDTO.mobile
}
let insuredDTO = res.content.data.insuredDTOs[0]
if (insuredDTO) {
this.insuredName = insuredDTO.name
this.insuredPhone = insuredDTO.mobile
this.insuredGender = insuredDTO.sex === '0' ? '男' : insuredDTO.sex === '1' ? '女' : '-'
this.insuredBirthday = insuredDTO.birthday
}
let orderInfoDTO = res.content.data.orderInfoDTO
if (orderInfoDTO) {
this.orderNumber = orderInfoDTO.prtNo
this.effectiveDate = orderInfoDTO.cvaliDate
this.expireDate = orderInfoDTO.expiryDate
}
}
} else {
this.$toast(res.resultMessage)
}
},
blankFilter(val) {
return this[val] ? this[val] : '-'
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .van-cell::after {
border: none;
}
</style>

View File

@@ -0,0 +1,261 @@
<template>
<div class="hgb bg-white pb60">
<p class="title p15">惠桂保销售量</p>
<div class="order-count">
<div class="available-count">
<p class="count-num active">{{ cvilNum }}</p>
<p class="count-text active">生效单量</p>
</div>
<div class="unavailable-count">
<p class="count-num inactive">{{ uncvilNum }}</p>
<p class="count-text inactive">失效单量</p>
</div>
</div>
<p class="title p15 search">
<span>惠桂保客户明细</span>
<van-icon name="search" @click="idSidebarShow = true" />
</p>
<div class="table-container">
<table class="table">
<thead>
<tr>
<th>序号</th>
<th>生效日</th>
<th>投保人</th>
<th>分单号</th>
<th>到期日</th>
</tr>
</thead>
<tbody>
<template v-if="tableData.length">
<tr v-for="(data, i) in tableData" :key="i" @click="toDetail(data)">
<td>{{ i + 1 }}</td>
<td v-for="(key, j) in keys" :key="j">
{{ data[key] }}
</td>
</tr>
</template>
<tr v-else>
<td colspan="5">暂无数据</td>
</tr>
</tbody>
</table>
</div>
<!-- 分页 -->
<div class="pagination bg-white" v-if="tableData.length">
<van-pagination v-model="currentPage" :total-items="totalItems" :items-per-page="10" @change="onPageChanged" />
</div>
<!-- 弹出层 -->
<van-popup
@click.native.self="isSearchDateShow = false"
v-model="idSidebarShow"
position="left"
:style="{ width: '70vw', height: '100%' }"
@close="onSideBarClosed"
>
<p class="p15 fw600">查找</p>
<van-field v-model="param.startDate" label="生效日" placeholder="请选择" readonly @click="isSearchDateShow = true" />
<van-field v-model="param.prtName" maxlength="10" label="担保人" placeholder="请输入" />
<div class="btn-group">
<van-button size="small" @click="idSidebarShow = false">取消</van-button>
<van-button size="small" type="danger" @click="queryData">确定</van-button>
</div>
<transition name="van-slide-up">
<div class="search-date" v-show="isSearchDateShow">
<van-datetime-picker v-model="currentDate" type="date" :max-date="maxDate" @confirm="onSearchDateConfirm" @cancel="isSearchDateShow = false" />
</div>
</transition>
</van-popup>
</div>
</template>
<script>
import { Popup, DatetimePicker, Field, Pagination } from 'vant'
import { selectHgb } from '@/api/ebiz/hgb'
import dateUtil from '@/assets/js/utils/date-utils'
export default {
name: 'HgbIndex',
components: {
[Popup.name]: Popup,
[DatetimePicker.name]: DatetimePicker,
[Field.name]: Field,
[Pagination.name]: Pagination
},
data() {
return {
totalItems: 0,
cvilNum: 0,
uncvilNum: 0,
maxDate: new Date(),
currentDate: new Date(),
idSidebarShow: false,
isSearchDateShow: false,
tableData: [],
keys: ['startDate', 'prtName', 'prtNo', 'endDate'],
form: {
availableDate: '',
applicant: ''
},
currentPage: 1,
param: {
prtName: '',
startDate: '',
pageInfo: {
pageNum: 1,
pageSize: 10
}
}
}
},
created() {
this.getData()
},
methods: {
onPageChanged(page) {
this.currentPage = page
this.param.pageInfo.pageNum = page
this.getData()
},
queryData() {
if (!this.param.startDate) {
return this.$toast('请选择生效日')
}
if (!this.param.prtName.trim()) {
return this.$toast('请输入担保人')
}
this.getData({ ...this.param })
this.idSidebarShow = false
},
onSearchDateConfirm(date) {
console.log(dateUtil.formatDate(date, 'yyyy-MM-dd'))
this.param.startDate = dateUtil.formatDate(date, 'yyyy-MM-dd')
this.isSearchDateShow = false
},
async getData(param) {
const res = await selectHgb(param ? param : this.param)
console.dir(res)
if (res.result === '0') {
this.cvilNum = res.content.cvilNum
this.uncvilNum = res.content.uncvilNum
this.totalItems = res.content.list.total
this.tableData = res.content.list.list
} else {
this.$toast(res.resultMessage)
}
},
toDetail(data) {
console.log(data)
this.$jump({
flag: 'h5',
extra: {
url: location.origin + `/#/hgb/orderDetail/${data.prtNo}`
},
routerInfo: { path: `/hgb/orderDetail/${data.prtNo}` }
})
},
onSideBarClosed() {
this.param.startDate = ''
this.param.prtName = ''
}
}
}
</script>
<style lang="scss" scoped>
.hgb {
min-height: 100vh;
.search {
display: flex;
justify-content: space-between;
align-items: center;
}
.search-date {
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
.btn-group {
width: 100%;
display: flex;
justify-content: space-evenly;
position: absolute;
bottom: 20px;
}
.order-count {
text-align: center;
display: flex;
justify-content: space-between;
width: 70vw;
margin: 0 auto;
border: 1px solid #e4e4e4;
border-radius: 15px;
.available-count {
border-right: 1px solid #e4e4e4;
}
.available-count,
.unavailable-count {
flex: 1;
padding: 30px;
}
.count-num {
font-size: 20px;
font-weight: bolder;
}
.count-text {
margin-top: 1em;
font-size: 14px;
font-weight: bolder;
}
.active {
color: #ff0000;
}
.inactive {
color: #949494;
}
}
.table-container {
padding: 2px;
.table {
font-size: 14px;
width: 100%;
border-collapse: collapse;
thead {
background-color: #ff0033;
color: #fff;
border: 1px solid #ff0033;
}
th {
font-weight: normal;
padding: 10px 0;
}
td {
text-align: center;
padding: 10px 0;
border: 1px solid #bcbcbc;
}
}
}
.pagination {
position: fixed;
bottom: 0;
left: 0;
right: 0;
}
}
::v-deep .van-pagination__item {
color: #ff0033;
}
::v-deep .van-pagination__item--active {
background-color: #ff0033;
color: #fff;
}
</style>