Files
debtH5/pages/result/result.vue
2023-06-21 17:04:42 +08:00

614 lines
14 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content">
<image class="indexTop" src="/static/index_top.png" mode="scaleToFill"></image>
<view class="indexTips">
<view class="indexTips-name">计算结果...</view>
<view class="indexTips-text">根据您填写的内容生成以下结果</view>
</view>
<view class="indexCont">
<view class="indexCont-white" v-for="(item, index) in listsArr" :key="index">
<view class="resultTitle">
{{item.institution}}
</view>
<view class="resultList">
<view class="item">
<view class="item-label">
<view class="item-label-name">
欠款金额
</view>
<view class="item-label-text">
{{item.total}}
</view>
</view>
<view :class="{textShadow: item.status != '1'}">
<view class="item-label">
<view class="item-label-name">
首付金额
</view>
<view class="item-label-text">
{{item.base.first_amount}}
</view>
</view>
<view class="item-label">
<view class="item-label-name">
分期金额
</view>
<view class="item-label-text">
{{item.base.periods_amount}}
</view>
</view>
<view class="item-label">
<view class="item-label-name">
分期期数
</view>
<view class="item-label-text">
{{item.base.periods}}
</view>
</view>
<view class="item-label">
<view class="item-label-name">
手续费费率
</view>
<view class="item-label-text">
{{item.base.tax}}%
</view>
</view>
<view class="item-label">
<view class="item-label-name">
每期还款本金
</view>
<view class="item-label-text">
{{item.base.every_total}}
</view>
</view>
<view class="item-label">
<view class="item-label-name">
每期还款手续费
</view>
<view class="item-label-text">
{{item.base.every_tax}}
</view>
</view>
<view class="item-label">
<view class="item-label-name">
总还款金额
</view>
<view class="item-label-text">
{{item.base.total}}
</view>
</view>
<view class="item-label">
<view class="item-label-name">
总还款本金
</view>
<view class="item-label-text">
{{item.base.principal}}
</view>
</view>
<view class="item-label">
<view class="item-label-name">
总还款手续费
</view>
<view class="item-label-text">
{{item.base.tax_amount}}
</view>
</view>
</view>
</view>
<view class="tips">温馨提示{{item.description}}</view>
<view class="see">
<view class="see-go" @click="generalClick(item)" v-if="item.status == '1'">点击查看还款计划表</view>
<view class="see-go" @click="unlockClick(item.share)" v-else><image class="indexLock" src="/static/lock.png" mode="widthFix"></image>分享二维码解锁次数</view>
</view>
</view>
</view>
</view>
<!-- 还款计划表弹出 -->
<view class="tipsBack" v-if="generalShow" :catchtouchmove="true"></view>
<view class="tipsCont" v-if="generalShow" :catchtouchmove="true">
<view class="tipsWhite">
<view class="tipsTitle">还款计划表单位</view>
<view class="tipsList">
<view class="tipsList-tab">
<view class="tips-tab-item">期数</view>
<view class="tips-tab-item">还款金额</view>
<view class="tips-tab-item">本金</view>
<view class="tips-tab-item">手续费</view>
</view>
<view class="tipsList-data">
<view class="tipsList-label" v-for="(items, index) in timeArr" :key="index">
<view class="tips-label-item">{{index+1}}</view>
<view class="tips-label-item">{{items.total}}</view>
<view class="tips-label-item">{{items.principal}}</view>
<view class="tips-label-item">{{items.tax}}</view>
</view>
<view class="tipsList-label">
<view class="tips-label-item">合计</view>
<view class="tips-label-item">{{timeAll.total}}</view>
<view class="tips-label-item">{{timeAll.principal}}</view>
<view class="tips-label-item">{{timeAll.tax}}</view>
</view>
</view>
</view>
<view class="tipsWhite-btn">
<view @click="otherSee" class="tipsWhite-btn-go">
其他还款方式
</view>
</view>
<image class="close" @click="generalShow = false" src="/static/close.png" mode="widthFix"></image>
</view>
</view>
<!-- 邀请好友弹出 -->
<view class="postertBack" v-if="isImgLay"></view>
<view class="postertCont postertContTop" v-if="isImgLay">
<view class="poster-back">
<image class="poster-img" src="/static/share_back.png" mode="widthFix"></image>
<view class="poster-Cont">
<view class="poster-Cont-code">
<image :src="canShare.qrcode" mode="widthFix"></image>
</view>
<view class="poster-Cont-url">
<view class="nowrap poster-url-number" @click="copyUrl(canShare.url)">地址{{canShare.url}}/</view>
<view class="poster-url-copy">复制</view>
</view>
<view class="poster-Cont-btn">
<view class="poster-Cont-down" @click="shareClick">保存图片分享好友<image class="poster-Cont-down-img" src="/static/hand.png" mode="widthFix"></image></view>
</view>
</view>
<image class="sign-img-btn" src="/static/close.png" @click="isImgLay = false" mode="widthFix"></image>
</view>
</view>
<!-- 长按保存 -->
<view class="postertBack" v-if="isImgLong"></view>
<view class="postertCont" v-if="isImgLong">
<view class="poster-back">
<image v-if="isImgLong" class="poster-img" :src="posterImg" mode="widthFix"></image>
<view class="poster-Cont-btn" style="margin-top: 40rpx; text-align: center;">
<view class="poster-Cont-down">请长按图片保存本地</view>
<image class="poster-img-btn" src="/static/close.png" @click="isImgLong = false" mode="widthFix"></image>
</view>
</view>
</view>
<!-- 海报canvas -->
<vue-canvas-poster :widthPixels="1000" :painting="paintings" @success="saveSuccess" @fail="saveFail"></vue-canvas-poster>
</view>
</template>
<script>
import { Lists } from '@/apis/interfaces/index'
import { VueCanvasPoster } from 'vue-canvas-poster'
export default {
components: {
VueCanvasPoster
},
data() {
return {
listsArr : [], // 结果列表
timeArr : [], // 还款计划表列表
timeAll : '', // 还款计划表总计
otherArr : '', // 其他携带数据
generalShow: false,
// 海报
canShare : '', // 分享图片
isImgLay : false, // 是否显示图片弹出层
isImgLong : false,// 长按保存图片
paintings : {
width: "375px",
height: "375px",
borderRadius: "10px",
background: "#ffffff",
views: [
//海报背景
{
type: "image",
url: "/static/share_downback.png",
css: {
top: "0",
left: "0",
width: "375px",
height: "375px",
mode: 'aspectFill'
},
},
//二维码
{
type: "image",
url: "",
css: {
top: "60px",
left: "60px",
width: "255px",
height: "255px",
mode: 'aspectFill'
},
}
],
},
posterImg: "", //生成的海报图片路径
}
},
created() {
// 获取查看结果
this.listsInfo()
},
methods: {
// 查看结果
listsInfo() {
Lists().then(res => {
this.listsArr = res
}).catch(err => {
uni.showToast({
title: err.message,
icon: "none"
})
})
},
// 查看还款计划表
generalClick(arr){
this.otherArr = arr
this.timeArr = arr.project
this.timeAll = arr.project_total
this.generalShow = !this.generalShow
},
// 其他方式
otherSee() {
let newData = JSON.stringify(this.otherArr);
uni.navigateTo({
url: `/pages/result/other?data=${encodeURIComponent(newData)}`
})
this.generalShow = false
},
// 显示海报
unlockClick(share) {
this.paintings.views[1].url = share.qrcode
this.isImgLay = true
this.canShare = share
},
// 下载海报
shareClick (){
this.isImgLay = false
this.isImgLong = true
},
saveSuccess(src) {
this.posterImg = src;
},
saveFail(err) {},
}
}
</script>
<style>
.indexTop {
width: 100%;
height: 440rpx;
}
.indexTips {
position: absolute;
top: 0;
left: 0;
padding: 60rpx 40rpx 0;
box-sizing: border-box;
color: #fff;
}
.indexTips-name {
font-weight: 600;
font-size: 44rpx;
}
.indexTips-text {
margin-top: 20rpx;
font-size: 28rpx;
}
.indexCont {
width: 100%;
padding: 30rpx;
box-sizing: border-box;
position: absolute;
margin-top: 200rpx;
top: 0;
left: 0;
}
.indexCont-white {
height: 100%;
background: white;
border-radius: 20rpx;
padding: 30rpx;
box-sizing: border-box;
margin-bottom: 30rpx;
}
.resultTitle {
font-weight: 600;
font-size: 34rpx;
color: #0c58d2;
margin-bottom: 20rpx;
}
.item-label {
line-height: 48rpx;
padding: 15rpx 0;
display: flex;
margin-right: 20rpx;
font-weight: 400;
}
.item-label-name {
color: #999999;
}
.textShadow {
filter: blur(6px);
}
.tips {
font-weight: 400;
background-color: #f7faff;
border-radius: 10rpx;
padding: 20rpx 30rpx;
text-align: justify;
box-sizing: border-box;
font-size: 26rpx;
color: #999999;
line-height: 40rpx;
margin-top: 20rpx;
}
.see {
text-align: center;
margin-top: 30rpx;
}
.see-go {
display: inline-block;
border: 2rpx solid #0c58d2;
color: #0c58d2;
line-height: 74rpx;
padding: 0 25rpx;
border-radius: 10rpx;
}
.indexLock {
width: 34rpx;
vertical-align: -4rpx;
margin-right: 10rpx;
}
/* 计划表弹出 */
.tipsBack {
position: fixed;
width: 100vw;
height: 100vh;
left: 0;
top: 0;
z-index: 9;
background-color: rgba(0, 0, 0, .6);
}
.tipsCont {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 10;
padding: 0 10%;
box-sizing: border-box;
text-align: center;
}
.tipsWhite {
background-color: #ffffff;
border-radius: 20rpx;
padding: 30rpx;
box-sizing: border-box;
position: relative;
}
.close {
position: absolute;
left: calc(50% - 35rpx);
width: 70rpx;
bottom: -120rpx;
z-index: 999;
}
.tipsTitle {
font-weight: 600;
font-size: 34rpx;
}
.tipsList {
margin: 20rpx 0;
font-size: 28rpx;
font-weight: 400;
}
.tipsList-tab {
display: flex;
background: #e5edf8;
line-height: 90rpx;
border-radius: 20rpx 20rpx 0 0;
}
.tips-tab-item, .tips-label-item {
flex: 4;
text-align: center;
}
.tipsList-data {
background: #fafafa;
border-radius: 0 0 20rpx 20rpx;
max-height: 30vh;
overflow: hidden;
overflow-y: scroll;
}
.tipsList-label {
display: flex;
line-height: 80rpx;
border-bottom: 2rpx solid #eeeeee;
}
.tipsList-label:last-child {
border: none;
}
.tipsWhite-btn {
text-align: center;
padding: 30rpx 0 20rpx;
}
.tipsWhite-btn-go {
display: inline-block;
width: 70%;
line-height: 88rpx;
border-radius: 80rpx;
background-color: #0c58d2;
color: #fff;
}
.postertBack {
width: 100vw;
height: 100vh;
position: fixed;
background-color: rgba(0,0,0,.6);
left: 0;
top: 0;
z-index: 999;
}
.postertCont {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 1000;
padding: 0 10%;
box-sizing: border-box;
}
.postertContTop {
top: -200rpx;
}
.poster-back {
position: relative;
padding-top: 100%;
width: 100%;
}
.poster-img, .poster-Cont {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
.poster-Cont {
padding: 50rpx;
box-sizing: border-box;
color: #fff;
}
.poster-Cont-code {
background: #fff;
border-radius: 20rpx;
padding: 30rpx;
box-sizing: border-box;
}
.poster-Cont-code image {
width: 100%;
}
.poster-Cont-url {
display: flex;
padding: 30rpx 0 40rpx;
}
.poster-url-number {
flex: 1;
padding-right: 20rpx;
box-sizing: border-box;
}
.poster-url-copy {
font-weight: 600;
}
.poster-Cont-btn {
text-align: center;
}
.poster-Cont-down {
display: inline-block;
width: 80%;
background-color: #fff;
border-radius: 80rpx;
line-height: 90rpx;
color: #051437;
font-weight: 600;
}
.poster-Cont-down-img {
width: 40rpx;
margin-left: 15rpx;
vertical-align: -8rpx;
animation: bounce-down 2s linear infinite;
}
@keyframes bounce-down {
25% {
transform: translateX(-4px);
}
50%,
100% {
transform: translateX(0);
}
75% {
transform: translateX(4px);
}
}
.sign-img-btn {
position: absolute;
left: calc(50% - 35rpx);
width: 70rpx;
top: calc(100% + 240rpx);
z-index: 999;
}
.poster-img-btn {
width: 70rpx;
display: block;
margin: 30rpx auto 0;
}
</style>