[盘债计算器]

This commit is contained in:
2023-06-21 17:04:42 +08:00
commit f2e1454a83
37 changed files with 4165 additions and 0 deletions

708
pages/result/history.vue Normal file
View File

@@ -0,0 +1,708 @@
<template>
<view class="content">
<block v-if="listsArr.length > 0">
<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="resultDel" v-if="isSalesman" @click="resultClick(index, item.log_id)">删除记录</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>
</block>
<view class="pack-center pages-hint" v-else>
<image src="https://cdn.shuiganying.com/images/2023/04/04/40b2f4bfe2dfb828688fcd3766d6b541.png"></image>
<view class="reportTips">
<view class="reportTips-title">暂无数据</view>
<view class="reportTips-text">抱歉暂没有历史记录</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 class="pack-center pages-hint grey" v-if="paySuccess">
<image src="/static/loadingGif.gif"></image>
<view>加载中...</view>
</view>
</view>
</template>
<script>
import { Init, Lists, logDel } from '@/apis/interfaces/index'
import { VueCanvasPoster } from 'vue-canvas-poster'
export default {
components: {
VueCanvasPoster
},
data() {
return {
listsArr : [], // 结果列表
timeArr : [], // 还款计划表列表
timeAll : '', // 还款计划表总计
otherArr : '', // 其他携带数据
isSalesman : '', // 客户管理
generalShow: false,
paySuccess : true,
// 海报
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: "", //生成的海报图片路径
}
},
onShow() {
Init().then(res => {
this.isSalesman = res.is_salesman
}).catch(err => {
uni.showToast({
title: err.message,
icon: "none"
})
})
// 获取历史结果
this.listsInfo()
},
methods: {
// 历史结果
listsInfo() {
Lists().then(res => {
this.paySuccess = false
this.listsArr = res
}).catch(err => {
uni.showToast({
title: err.message,
icon: "none"
})
})
},
// 删除结果
resultClick(index, id) {
uni.showModal({
title: '删除确认',
content: '是否删除此计算记录',
success: res=> {
if (res.confirm) {
logDel(id).then(res => {
this.listsArr.splice(index, 1)
}).catch(err => {
uni.showToast({
title: err.message,
icon: "none"
})
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
// 查看还款计划表
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;
position: relative;
}
.resultDel {
position: absolute;
right: 30rpx;
top: 30rpx;
background-color: #ff7171;
color: #ffffff;
border-radius: 80rpx;
line-height: 52rpx;
padding: 0 24rpx;
display: inline-block;
font-size: 26rpx;
}
.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;
}
/* 暂无数据 */
.reportTips-title {
color: #000;
font-size: 34rpx;
line-height: 80rpx;
}
.reportTips-text {
font-size: 26rpx;
}
.reportTips-btn {
background-color: #3b7cff;
display: inline-block;
color: #fff;
line-height: 78rpx;
padding: 0 60rpx;
border-radius: 10rpx;
margin-top: 50rpx;
}
.pack-center {
z-index: 99999;
}
.grey {
background-color: #f9f9f9;
z-index: 9999999;
}
</style>