| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- <template>
- <view class='page'>
- <view class="" id="panelcanvas">
- <image class="back" :src="detailbackimg" mode=""></image>
- <uni-NavBar headerTitle="订单付款" background="transparent" :isShared="false" :isSlot="false"
- @share="share"></uni-NavBar>
- <view class="header-title dis a-c j-s ">
- <view class="dis a-c left">
- <image :src="insCompanyVo.logo" mode=""></image>
- <text class="ml-1">保险公司</text>
- </view>
- <text>{{info.createTime}}</text>
- </view>
- <view class="content dis f-c">
- <view class="scroll-content">
- <view class="view dis a-c j-s ">
- <text>车主</text>
- <text> {{info.ownerName}}</text>
- </view>
- <view class="view dis a-c j-s ">
- <text>车牌号</text>
- <text>{{info.licenseNo}}</text>
- </view>
- <view class="view dis a-c j-s ">
- <text>投保人</text>
- <text>{{info.policyName}}</text>
- </view>
- <view class="view dis a-c j-s ">
- <text>被保人</text>
- <text>{{info.insuredName}} </text>
- </view>
- <view class="view dis a-c j-s " v-if="info.jqStartTime">
- <text>交强险起保时间</text>
- <text>{{info.jqStartTime}}</text>
- </view>
- <view class="view dis a-c j-s " v-if="info.syStartTime">
- <text>商业险起保时间</text>
- <text>{{info.syStartTime}}</text>
- </view>
- <view class="view dis a-c j-s " v-if="info.jqPremium">
- <text>交强险</text>
- <text>¥{{info.jqPremium}}</text>
- </view>
- <view class="view dis a-c j-s " v-if="info.taxPremium">
- <text>车船税</text>
- <text>¥{{info.taxPremium}}</text>
- </view>
- <view class="view dis a-c j-s " v-if="info.syPremium">
- <text>商业险</text>
- <text>¥{{info.syPremium}}</text>
- </view>
- <view class="view dis a-c j-s " v-if="info.jyPremium">
- <text>驾意险</text>
- <text>¥{{info.jyPremium}}</text>
- </view>
- <view class="view dis a-c j-s ">
- <text>合计</text>
- <text style="color: #FF540A;">¥{{info.sumPremium}}</text>
- </view>
- <view class="qrCode dis a-c f-c ">
- <view class="qr">
- <image :src="recommendImg" mode="widthFix" lazy-load style="width:100%;height: 100%;">
- <!-- <image :src="logoImg" mode=""
- style="width: 26px;height: 26px;position: absolute;top: 0;left: 0;right: 0;bottom: 0; margin: auto;">
- </image> -->
- </image>
- </view>
- <text class="mt-2">支付码当天之内有效</text>
- <!-- #ifdef APP-PLUS -->
- <view class="undoButton mt-3">
- 撤销二维码
- </view>
- <!-- #endif -->
- </view>
- </view>
- </view>
- </view>
- <!-- #ifdef APP-PLUS -->
- <view class="" style="padding: 0 20rpx;box-sizing: border-box;">
- <view class="btn mt-3 dis a-c j-c " @click="sendPayCode">
- 分享
- </view>
- </view>
- <!-- #endif -->
- </view>
- </template>
- <script>
- import {
- mapState
- } from "vuex"
- import {
- turnBase64Image
- } from '@/plugins/utils.js';
- import {
- pathToBase64,
- base64ToPath
- } from '@/common/pdf.js'
- import QR from "@/common/wxqrcode.js"
- export default {
- data() {
- return {
- detailbackimg: "", //背景图
- recommendImg: '', //二维码图片
- payImg: "",
- posterUrl: "",
- info: {},
- insCompanyVo: {}, //保险公司信息
- }
- },
- onShow() {
- },
- async mounted() {
- this.detailbackimg = await turnBase64Image('/static/image/detailback.png');
- },
- async onLoad(options) {
- if (options.ordersNo) {
- let res = await this.$http.get('/order/qrCode/getQrCode?orderNo=' + options.ordersNo)
- if (res.code == '200') {
- this.info = res.data;
- let res1 = await this.$http.get('/supplementOrder/getOrderDetail?ordersNo=' + options.ordersNo);
- if (res1.code == "200") {
- this.insCompanyVo = res1.data.insCompanyVo[0];
- }
- } else {
- uni.showToast({
- title: res.msg,
- icon: "none"
- })
- }
- }
- this.recommendCode();
- },
- methods: {
- //分享图片到微信
- sendPayCode() {
- if (this.payImg) {
- uni.share({
- provider: "weixin",
- scene: "WXSceneSession",
- type: 2,
- imageUrl: this.payImg
- })
- }
- },
- //页面截图转路径
- receiveRenderData(val) {
- this.posterUrl = val.replace(/[\r\n]/g, ''); // 去除base64位中的空格
- const imageStr = this.posterUrl;
- // 将base64转化为临时地址
- base64ToPath(imageStr).then(path => {
- this.payImg = path
- }).catch(error => {
- console.log(error);
- });
- },
- showLoading() {
- uni.showLoading({
- title: '正在生成图片'
- });
- },
- hideLoading() {
- uni.hideLoading();
- this.loading = false;
- },
- recommendCode() {
- this.recommendImg = QR.createQrCodeImg(this.info.qrcode, {
- size: parseInt(500) //二维码大小
- })
- },
- }
- }
- </script>
- <script module="canvasImage" lang="renderjs">
- import html2canvas from 'html2canvas'
- export default {
- data() {
- return {
- }
- },
- mounted() {
- // #ifdef APP-PLUS
- setTimeout(() => {
- this.canvasImage.generateImage()
- }, 1000);
- // #endif
- },
- methods: {
- // #ifdef APP-PLUS
- generateImage() {
- setTimeout(() => {
- this.$ownerInstance.callMethod('showLoading')
- const dom = document.getElementById('panelcanvas') // 需要生成图片内容的 dom 节点
- html2canvas(dom, {
- width: dom.clientWidth, //dom 原始宽度
- height: dom.clientHeight,
- scrollY: 0, // html2canvas默认绘制视图内的页面,需要把scrollY,scrollX设置为0
- scrollX: 0,
- useCORS: true, //支持跨域
- // allowTaint: false,
- scale: 3, // 设置生成图片的像素比例,默认是1,如果生成的图片模糊的话可以开启该配置项
- }).then((canvas) => {
- // 生成成功
- this.$ownerInstance.callMethod('hideLoading')
- this.$ownerInstance.callMethod('receiveRenderData', canvas.toDataURL('image/png'))
- }).catch(err => {
- console.log('323213213123_errAlert', `【生成图片失败,请重试】${err}`);
- // 生成失败 弹出提示弹窗
- this.$ownerInstance.callMethod('_errAlert', `【生成图片失败,请重试】${err}`)
- })
- }, 300)
- }
- // #endif
- },
- }
- </script>
- <style lang="scss" scoped>
- .page {
- background-color: #F8F8F8;
- height: 100vh;
- }
- .page {
- position: relative;
- background-color: #f8f8f8;
- }
- /* 背景图 */
- .back {
- width: 100%;
- height: 492rpx;
- position: fixed;
- top: 0;
- left: 0;
- z-index: 0;
- }
- .header-title {
- position: relative;
- padding: 0 30rpx;
- box-sizing: border-box;
- margin: 16rpx 0;
- .left {
- image {
- width: 40rpx;
- height: 40rpx;
- }
- text {
- font-size: 36rpx;
- color: #333;
- font-weight: bold;
- }
- }
- >text {
- font-size: 26rpx;
- color: rgba(51, 51, 51, 0.7);
- }
- }
- .content {
- padding: 0 20rpx;
- box-sizing: border-box;
- position: relative;
- .scroll-content {
- height: calc(100vh - 200px);
- background: #FFFFFF;
- box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(0, 0, 0, 0.05);
- border-radius: 20rpx 20rpx 10rpx 10rpx;
- padding: 30rpx;
- box-sizing: border-box;
- overflow: auto;
- .view {
- font-size: 30rpx;
- color: #666;
- margin-bottom: 30rpx;
- >text:last-child {
- color: #333;
- font-weight: bold;
- width: 65%;
- text-align: right;
- }
- }
- .qrCode {
- margin-top: 10px;
- >text {
- font-size: 30rpx;
- color: #333;
- }
- .qr {
- width: 290rpx;
- height: 290rpx;
- margin: 10rpx auto 0;
- padding: 10rpx;
- box-sizing: border-box;
- }
- .undoButton {
- padding: 13rpx 26rpx;
- box-sizing: border-box;
- background: rgba(253, 233, 53, 0.2);
- border-radius: 58rpx 58rpx 58rpx 58rpx;
- border: 1rpx solid #FDE935;
- font-size: 30rpx;
- color: #1F1F1F;
- }
- }
- }
- }
- .btn {
- width: 100%;
- height: 88rpx;
- background: #FDE935;
- margin: 30rpx auto 0;
- border-radius: 58rpx 58rpx 58rpx 58rpx;
- font-size: 36rpx;
- color: #1F1F1F;
- font-weight: bold;
- }
- </style>
|