436 lines
10 KiB
Vue
436 lines
10 KiB
Vue
<template>
|
||
<view class="content">
|
||
<view id="poster">
|
||
<view class="top">
|
||
<view class="top-cont">
|
||
<image class="top-cont-img" src="https://cdn.douhuofalv.com/images/2023/04/20/00d2121139a3ff56077a82ae6677e052.png" mode="widthFix"></image>
|
||
<view class="top-cont-name">法律咨询服务包</view>
|
||
</view>
|
||
<image class="top-img" src="https://cdn.douhuofalv.com/images/2023/04/20/2ea5fc20ffc90e7feec7ba2650b81c99.png" mode="widthFix"></image>
|
||
</view>
|
||
<!-- <image class="backImg" src="https://cdn.douhuofalv.com/images/2023/04/20/7d3fc55a3e41ea916f770bb1be3864af.png" mode="widthFix"></image> -->
|
||
<view class="confirm">
|
||
<view class="confirm-white">
|
||
<view class="confirm-top">订单号 {{seekData.order_no}}</view>
|
||
<view class="confirm-list">
|
||
<view class="confirm-item" v-for="(item, index) in seekData.params">
|
||
<view class="confirm-item-label">{{item.title}}</view>
|
||
<view class="confirm-item-text"><text v-if="item.key == 'price'">¥</text> {{item.value_text}}</view>
|
||
</view>
|
||
</view>
|
||
<view class="confirm-user">
|
||
<view class="confirm-user-text"><image src="https://cdn.douhuofalv.com/images/2023/04/20/c359f2fa277e6658157c7108f37d0d44.png" mode="widthFix"></image> 业务联系人</view>
|
||
<view class="confirm-user-name">{{parent.nickname}}</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="idcardBtn">
|
||
<!-- <view class="idcardBtn-go active">立即咨询</view> -->
|
||
<!-- <view class="idcardBtn-go" @click="shareClick">保存图片</view> -->
|
||
<view class="idcardBtn-go" @click="toImg">保存图片</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 打卡海报 -->
|
||
<view class="postertBack" v-if="isImgLay"></view>
|
||
<view class="postert" v-if="isImgLay">
|
||
<view class="poster-Cont">
|
||
<image class="poster-Cont-img" :src="base64" mode="widthFix"></image>
|
||
</view>
|
||
<view class="sign-btn">
|
||
<view class="remove-btn">长按图片保存</view>
|
||
<view class="sign-img-block">
|
||
<button class="sign-img-btn" size="mini" @click="isImgLay = false">取消</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 海报canvas -->
|
||
<vue-canvas-poster :widthPixels="1000" :painting="paintings" @success="saveSuccess" @fail="saveFail"></vue-canvas-poster>
|
||
|
||
<!-- <image :src="base64" mode=""></image> -->
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import { VueCanvasPoster } from 'vue-canvas-poster'
|
||
import { seekOrderSee } from '@/apis/interfaces/synthesis'
|
||
import html2canvas from 'html2canvas';
|
||
export default {
|
||
components: {
|
||
VueCanvasPoster
|
||
},
|
||
data() {
|
||
return {
|
||
seekData : '', // 咨询详情数据
|
||
parent : '', // 联系人
|
||
base64 : '',
|
||
isImgLay : false,
|
||
paintings : {
|
||
width: "375px",
|
||
height: "553px",
|
||
borderRadius: "10px",
|
||
background: "#111e4b",
|
||
views: [
|
||
//海报背景
|
||
{
|
||
type: "image",
|
||
url: "",
|
||
css: {
|
||
top: "0",
|
||
left: "0",
|
||
width: "375px",
|
||
height: "553px",
|
||
mode: 'aspectFill'
|
||
},
|
||
},
|
||
|
||
//订单号
|
||
{
|
||
type: "text",
|
||
text: '',
|
||
css: {
|
||
top: "172px",
|
||
left: "40px",
|
||
width: "375px",
|
||
fontWeight: "600",
|
||
fontSize: "16px",
|
||
color: "#000000"
|
||
},
|
||
},
|
||
|
||
// 文本一
|
||
{
|
||
type: "text",
|
||
text: '',
|
||
css: {
|
||
top: "220px",
|
||
left: "40px",
|
||
width: "375px",
|
||
fontSize: "16px",
|
||
color: "#000000"
|
||
},
|
||
},
|
||
|
||
// 文本二
|
||
{
|
||
type: "text",
|
||
text: '',
|
||
css: {
|
||
top: "255px",
|
||
left: "40px",
|
||
width: "375px",
|
||
fontSize: "16px",
|
||
color: "#000000"
|
||
},
|
||
},
|
||
|
||
// 文本二
|
||
{
|
||
type: "text",
|
||
text: '',
|
||
css: {
|
||
top: "290px",
|
||
left: "40px",
|
||
width: "375px",
|
||
fontSize: "16px",
|
||
color: "#000000"
|
||
},
|
||
},
|
||
|
||
// 文本二
|
||
{
|
||
type: "text",
|
||
text: '',
|
||
css: {
|
||
top: "325px",
|
||
left: "40px",
|
||
width: "375px",
|
||
fontSize: "16px",
|
||
color: "#000000"
|
||
},
|
||
},
|
||
],
|
||
},
|
||
posterImg: "", //生成的海报图片路径
|
||
}
|
||
},
|
||
|
||
created() {
|
||
|
||
// 获取综法咨询-咨询详情
|
||
this.getBusiness();
|
||
},
|
||
|
||
methods: {
|
||
// 综法咨询-咨询详情
|
||
getBusiness(){
|
||
// this.$Route.query.synthesisId
|
||
seekOrderSee(1).then(res => {
|
||
// console.log(res)
|
||
this.seekData = res
|
||
this.parent = res.user.parent
|
||
}).catch(err => {
|
||
uni.showToast({
|
||
title: err.message,
|
||
icon : 'none'
|
||
})
|
||
})
|
||
},
|
||
|
||
toImg() {
|
||
html2canvas(document.querySelector("#poster"), {
|
||
allowTaint: true,
|
||
backgroundColor: "white",
|
||
useCORS: true, //支持图片跨域
|
||
scale: 1,
|
||
}).then((canvas) => {
|
||
this.isImgLay = true
|
||
this.base64 = canvas.toDataURL('image/png')
|
||
});
|
||
},
|
||
|
||
// 保存图片
|
||
shareClick() {
|
||
this.paintings.views[0].url = "/static/imgs/shareBack.jpg"
|
||
this.paintings.views[1].text = "订单号:" + this.seekData.order_no
|
||
this.paintings.views[2].text = this.seekData.params[0].title + ':' + this.seekData.params[0].value_text
|
||
this.paintings.views[3].text = this.seekData.params[1].title + ':' + this.seekData.params[1].value_text
|
||
this.paintings.views[4].text = this.seekData.params[2].title + ':' + this.seekData.params[2].value_text
|
||
this.paintings.views[5].text = this.seekData.params[3].title + ':' + this.seekData.params[3].value_text
|
||
this.isImgLay = true
|
||
},
|
||
saveSuccess(src) {
|
||
// console.log(src)
|
||
this.posterImg = src;
|
||
},
|
||
saveFail(err) {
|
||
console.log('-----------')
|
||
console.log(err)
|
||
console.log('-----------')
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.content {
|
||
background-image: linear-gradient(to bottom,#041f79, #111e4b);
|
||
width: 100vw;
|
||
height: 100%;
|
||
overflow-y: scroll;
|
||
position: fixed;
|
||
}
|
||
|
||
.top {
|
||
position: relative;
|
||
height: 320rpx;
|
||
z-index: 4;
|
||
.top-img {
|
||
position: absolute;
|
||
right: 0;
|
||
top: 0;
|
||
width: 35%;
|
||
}
|
||
.top-cont {
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
width: 100%;
|
||
padding: 80rpx 30rpx 0;
|
||
box-sizing: border-box;
|
||
text-align: center;
|
||
.top-cont-name {
|
||
font-weight: 600;
|
||
font-size: 74rpx;
|
||
background-image: linear-gradient(to right,#f1c694, #fffbf6 70%);
|
||
-webkit-background-clip:text;
|
||
-webkit-text-fill-color:transparent;
|
||
margin-bottom: 10rpx;
|
||
}
|
||
.top-cont-img {
|
||
width: 30%;
|
||
margin-bottom: 15rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.backImg {
|
||
width: 100%;
|
||
position: absolute;
|
||
left: 0;
|
||
top: 0;
|
||
}
|
||
|
||
.confirm {
|
||
padding: 0 30rpx 30rpx;
|
||
box-sizing: border-box;
|
||
position: relative;
|
||
top: 0;
|
||
left: 0;
|
||
z-index: 9;
|
||
width: 100%;
|
||
.confirm-white {
|
||
border-radius: 15rpx;
|
||
background-color: #ffffff;
|
||
position: relative;
|
||
&::after {
|
||
content: '';
|
||
position: absolute;
|
||
width: calc(100% - 80rpx);
|
||
height: 60rpx;
|
||
background-color: rgba(255, 255, 255, .3);
|
||
bottom: -30rpx;
|
||
left: 40rpx;
|
||
border-radius: 0 0 15rpx 15rpx;
|
||
}
|
||
&::before {
|
||
content: '';
|
||
position: absolute;
|
||
width: calc(100% - 160rpx);
|
||
height: 120rpx;
|
||
background-color: rgba(255, 255, 255, .1);
|
||
bottom: -60rpx;
|
||
left: 80rpx;
|
||
border-radius: 0 0 15rpx 15rpx;
|
||
}
|
||
.confirm-top {
|
||
background-color: #f7faff;
|
||
border-radius: 15rpx 15rpx 0 0;
|
||
line-height: 110rpx;
|
||
padding: 0 30rpx;
|
||
box-sizing: border-box;
|
||
font-weight: 600;
|
||
font-size: 34rpx;
|
||
}
|
||
.confirm-list {
|
||
padding: 10rpx 30rpx;
|
||
box-sizing: border-box;
|
||
.confirm-item {
|
||
display: flex;
|
||
line-height: 40rpx;
|
||
padding: 20rpx 0;
|
||
.confirm-item-label {
|
||
flex: 1;
|
||
width: 200rpx;
|
||
}
|
||
.confirm-item-text {
|
||
text-align: right;
|
||
width: calc(100% - 200rpx);
|
||
}
|
||
}
|
||
}
|
||
.confirm-user {
|
||
border-top: 2rpx solid #eeeeee;
|
||
line-height: 110rpx;
|
||
display: flex;
|
||
padding: 0 30rpx;
|
||
box-sizing: border-box;
|
||
font-weight: 600;
|
||
font-size: 34rpx;
|
||
color: #041f79;
|
||
.confirm-user-text {
|
||
flex: 1;
|
||
display: flex;
|
||
image {
|
||
width: 32rpx;
|
||
margin: 40rpx 15rpx 0 0;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// 按钮
|
||
.idcardBtn {
|
||
width: 100%;
|
||
display: flex;
|
||
margin-top: 120rpx;
|
||
padding-bottom: 100rpx;
|
||
.idcardBtn-go {
|
||
flex: 2;
|
||
margin: 0 15rpx;
|
||
background-image: linear-gradient(to bottom, #fff2d2, #f9cd9e);
|
||
color: #582700;
|
||
font-weight: 600;
|
||
font-size: 36rpx;
|
||
border-radius: $radius * 3;
|
||
height: 94rpx;
|
||
line-height: 94rpx;
|
||
box-shadow: 0 6rpx 10rpx rgba(0, 0, 0, .5);
|
||
text-align: center;
|
||
}
|
||
}
|
||
}
|
||
|
||
.postertBack {
|
||
width: 100vw;
|
||
height: 100vh;
|
||
position: fixed;
|
||
background-color: rgba(0,0,0,.6);
|
||
left: 0;
|
||
top: 0;
|
||
z-index: 9990;
|
||
}
|
||
.postert {
|
||
width: 100vw;
|
||
height: 100vh;
|
||
position: fixed;
|
||
left: 0;
|
||
top: 0;
|
||
z-index: 9999;
|
||
.poster-Cont {
|
||
background-color: #111e4b;
|
||
width: 80vw;
|
||
height: 55vh;
|
||
top: 20vh;
|
||
left: 10vw;
|
||
position: absolute;
|
||
box-sizing: border-box;
|
||
border-radius: $radius-m;
|
||
overflow: hidden;
|
||
.poster-Cont-img {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
.poster-Cont-code {
|
||
position: absolute;
|
||
bottom: 250px;
|
||
left: 46px;
|
||
width: 140rpx;
|
||
height: 140rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.sign-btn {
|
||
position: absolute;
|
||
top: 78vh;
|
||
width: 80%;
|
||
left: 10%;
|
||
z-index: 9999;
|
||
.remove-btn {
|
||
width: 100%;
|
||
line-height: 90rpx;
|
||
background-color: #bf9960;
|
||
color: #FFFFFF;
|
||
border-radius: $radius-m;
|
||
margin-top: $margin - 10;
|
||
text-align: center;
|
||
font-size: $title-size + 2;
|
||
}
|
||
.sign-img-block {
|
||
display: flex;
|
||
margin: 30rpx -10rpx 0;
|
||
.sign-img-btn {
|
||
flex: 2;
|
||
line-height: 90rpx;
|
||
background-color: #ffeeda;
|
||
border-radius: $radius-m;
|
||
text-align: center;
|
||
font-size: $title-size;
|
||
margin: 0 10rpx;
|
||
}
|
||
}
|
||
}
|
||
</style> |