Commit 82221a1cf5ba8e88e7e3e0667b68709f4adadf9c
1 parent
512f1fe2
等级卡续费
Showing
2 changed files
with
109 additions
and
57 deletions
pages/user/cardinfo/cardinfo.js
| ... | ... | @@ -47,6 +47,7 @@ Page({ |
| 47 | 47 | cardid: "",//会员卡的id |
| 48 | 48 | user_card: null,//会员买的卡 |
| 49 | 49 | free:null,//分佣的数据 |
| 50 | + expiryDate:"",//卡到期时间 | |
| 50 | 51 | |
| 51 | 52 | |
| 52 | 53 | }, |
| ... | ... | @@ -176,9 +177,13 @@ Page({ |
| 176 | 177 | }, |
| 177 | 178 | }).then(res => { |
| 178 | 179 | |
| 179 | - var GradeCardID = res.data.data[0].GradeCardID | |
| 180 | + var GradeCardID = res.data.data[0].GradeCardID; | |
| 181 | + var expiryDate = res.data.data[0].ExpiryDate | |
| 180 | 182 | console.log(GradeCardID, "卡的id", res.data.data[0]); |
| 181 | - ee.setData({cardid: GradeCardID}); | |
| 183 | + ee.setData({cardid: GradeCardID, | |
| 184 | + expiryDate: expiryDate | |
| 185 | + }); | |
| 186 | + | |
| 182 | 187 | |
| 183 | 188 | }) |
| 184 | 189 | //-----------会员分佣------------------- |
| ... | ... | @@ -400,6 +405,10 @@ Page({ |
| 400 | 405 | wx.showLoading({ |
| 401 | 406 | title: '生成中...', |
| 402 | 407 | }) |
| 408 | + | |
| 409 | + this.setData({ | |
| 410 | + canvasHidden: false | |
| 411 | + }) | |
| 403 | 412 | |
| 404 | 413 | var th = this; |
| 405 | 414 | //设置画板显示,才能开始绘图 |
| ... | ... | @@ -412,32 +421,28 @@ Page({ |
| 412 | 421 | var img_Identification = th.data.img_Identification;//会员标识 |
| 413 | 422 | var privilege_o = th.data.privilege_o;//勋章图片 |
| 414 | 423 | var img_square=th.data.img_square; |
| 415 | - console.log("user的会员资料", user); | |
| 416 | - console.log("最大的卡", big_card); | |
| 417 | - console.log("会员头像", card_ming); | |
| 418 | - console.log("缓存vip的价格", img_money); | |
| 419 | - console.log(" 会员标识", img_Ancrown); | |
| 420 | - console.log("/勋章图片", privilege_o); | |
| 424 | + | |
| 421 | 425 | var app = getApp(); |
| 422 | 426 | var unit = th.data.screenWidth / 750 * 1.35; |
| 423 | 427 | var scene = getApp().globalData.user_id; |
| 424 | - console.log("二维码主键",scene); | |
| 428 | + console.log("用户头像", th.data.head_pic); | |
| 425 | 429 | ///二微码 |
| 426 | - var vpath=""; | |
| 430 | + | |
| 427 | 431 | var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + |
| 428 | - os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/plus/plus"; | |
| 432 | + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/user/index/index"; | |
| 429 | 433 | wx.getImageInfo({ |
| 430 | 434 | src: path3, |
| 431 | 435 | success: function (res) { |
| 432 | 436 | //回调写法 |
| 433 | 437 | th.get_head_temp(th.get_goods_temp, function () { |
| 434 | - vpath = res.path; | |
| 435 | - }) | |
| 436 | - } | |
| 437 | - }) | |
| 438 | + var vpath=res.path; | |
| 439 | + | |
| 438 | 440 | console.log("生成二维码", path3); |
| 439 | 441 | //开启画布 |
| 440 | 442 | const ctx = wx.createCanvasContext('myCanvas'); |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 441 | 446 | //先画背景 |
| 442 | 447 | ctx.drawImage("../../../images/plus/share/mackground.png", 0, 0, 554 * unit, 930 * unit); |
| 443 | 448 | ctx.setFontSize(26 * unit); |
| ... | ... | @@ -571,7 +576,7 @@ Page({ |
| 571 | 576 | ctx.setFillStyle('rgb(218,194,169)') |
| 572 | 577 | ctx.fill(); |
| 573 | 578 | |
| 574 | - ctx.drawImage(vpath, 100 * unit, 780 * unit, 110 * unit, 110 * unit); | |
| 579 | + ctx.drawImage(vpath, 100 * unit, 780 * unit, 110 * unit, 110 * unit); | |
| 575 | 580 | |
| 576 | 581 | ctx.setFontSize(20 * unit); |
| 577 | 582 | ctx.setFillStyle("#000"); |
| ... | ... | @@ -593,7 +598,7 @@ Page({ |
| 593 | 598 | ctx.closePath(); |
| 594 | 599 | ctx.fill(); |
| 595 | 600 | ctx.clip(); |
| 596 | - ctx.drawImage(user_head, h_x, h_y, h_r * 2, h_r * 2); | |
| 601 | + ctx.drawImage(th.data.head_pic, h_x, h_y, h_r * 2, h_r * 2); | |
| 597 | 602 | ctx.restore(); |
| 598 | 603 | |
| 599 | 604 | var x = 345 * unit, |
| ... | ... | @@ -641,66 +646,111 @@ Page({ |
| 641 | 646 | ctx.setFillStyle("#000"); |
| 642 | 647 | ctx.fillText("立即开通", 362 * unit, 212 * unit); |
| 643 | 648 | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 644 | 652 | //绘制图片 |
| 645 | 653 | ctx.draw(false, |
| 646 | - wx.canvasToTempFilePath({ | |
| 647 | - x: 0, | |
| 648 | - y: 0, | |
| 649 | - width: 750, | |
| 650 | - height: 930, | |
| 651 | - destWidth: 1.2 * 750 * 750 / th.data.screenWidth, | |
| 652 | - destHeight: 1.2 * 1217 * 750 / th.data.screenWidth, | |
| 653 | - canvasId: 'myCanvas', | |
| 654 | - success: function (res) { | |
| 655 | - wx.hideLoading();//关闭生成中的方法 | |
| 656 | - th.data.is_loading=0; | |
| 657 | - | |
| 658 | - console.log("sssssssssssssssssssssssss" + res.tempFilePath); | |
| 659 | - var tempFilePath = res.tempFilePath; | |
| 660 | - th.setData({ | |
| 661 | - imagePath: tempFilePath, | |
| 662 | - maskHidden: false, | |
| 663 | - canvasHidden: true | |
| 664 | - }); | |
| 665 | - wx.previewImage({ | |
| 666 | - urls: [res.tempFilePath], | |
| 667 | - }) | |
| 668 | - if (!res.tempFilePath) { | |
| 669 | - wx.showModal({ | |
| 670 | - title: '提示', | |
| 671 | - content: '图片绘制中,请稍后重试', | |
| 672 | - showCancel: false | |
| 673 | - }) | |
| 674 | - } | |
| 675 | - | |
| 676 | - } | |
| 677 | 654 | |
| 678 | - })) | |
| 655 | + function(){ | |
| 656 | + | |
| 657 | + setTimeout(function(){ | |
| 658 | + wx.canvasToTempFilePath({ | |
| 659 | + x: 0, | |
| 660 | + y: 0, | |
| 661 | + width: 750, | |
| 662 | + height: 930, | |
| 663 | + destWidth: 1.2 * 750 * 750 / th.data.screenWidth, | |
| 664 | + destHeight: 1.2 * 1217 * 750 / th.data.screenWidth, | |
| 665 | + canvasId: 'myCanvas', | |
| 666 | + success: function (res) { | |
| 667 | + wx.hideLoading();//关闭生成中的方法 | |
| 668 | + th.data.is_loading = 0; | |
| 669 | + console.log("生成的海报"); | |
| 670 | + console.log(res.tempFilePath); | |
| 671 | + var tempFilePath = res.tempFilePath; | |
| 672 | + th.setData({ | |
| 673 | + imagePath: tempFilePath, | |
| 674 | + maskHidden: false, | |
| 675 | + canvasHidden: true | |
| 676 | + }); | |
| 677 | + wx.previewImage({ | |
| 678 | + urls: [res.tempFilePath], | |
| 679 | + }) | |
| 680 | + if (!res.tempFilePath) { | |
| 681 | + wx.showModal({ | |
| 682 | + title: '提示', | |
| 683 | + content: '图片绘制中,请稍后重试', | |
| 684 | + showCancel: false | |
| 685 | + }) | |
| 686 | + } | |
| 687 | + | |
| 688 | + } | |
| 689 | + | |
| 690 | + }) | |
| 691 | + },500) | |
| 692 | + | |
| 693 | + | |
| 694 | + } | |
| 695 | + ) | |
| 679 | 696 | |
| 680 | - | |
| 697 | + | |
| 698 | + }) | |
| 699 | + } | |
| 700 | + }) | |
| 701 | + | |
| 702 | + }, | |
| 703 | + | |
| 704 | + //--获取头像的本地缓存,回调写法-- | |
| 705 | + get_head_temp: function (tt, func) { | |
| 706 | + var ee = this; | |
| 707 | + console.log("获取头像", ee.data.head_pic); | |
| 708 | + if (ee.data.head_pic) { | |
| 709 | + tt(func); | |
| 710 | + return false; | |
| 711 | + } | |
| 712 | + //---获取分享图片的本地地址,头像和商品图片---- | |
| 713 | + var path2 = getApp().globalData.userInfo.head_pic; | |
| 714 | + if (path2 == "") { | |
| 715 | + ee.data.head_pic = "../../../images/share/hui_hear_pic.png"; | |
| 716 | + tt(func); | |
| 717 | + } else { | |
| 718 | + path2 = path2.replace("http://thirdwx.qlogo.cn", "https://wx.qlogo.cn"); | |
| 719 | + wx.getImageInfo({ | |
| 720 | + src: path2, | |
| 721 | + success: function (res) { | |
| 722 | + //res.path是网络图片的本地地址 | |
| 723 | + ee.data.head_pic= res.path; | |
| 724 | + tt(func);; | |
| 725 | + }, | |
| 726 | + fail: function (res) { | |
| 727 | + ee.data.head_pic= "../../../images/share/hui_hear_pic.png"; //分享的图片不能用网络的 | |
| 728 | + tt(func); | |
| 729 | + } | |
| 730 | + }); | |
| 731 | + } | |
| 681 | 732 | }, |
| 682 | 733 | //--获取商品图片的本地缓存,回调写法-- |
| 683 | 734 | get_goods_temp: function (tt) { |
| 684 | 735 | var ee = this; |
| 685 | - if (ee.data.share_goods_img) { | |
| 736 | + if (ee.data.head_pic) { | |
| 686 | 737 | tt(); |
| 687 | 738 | return false; |
| 688 | 739 | } |
| 689 | 740 | //获取商品是分享图信息 |
| 690 | 741 | wx.getImageInfo({ |
| 691 | - src: ee.data.data.original_img, | |
| 742 | + src: ee.data.head_pic, | |
| 692 | 743 | success: function (res) { |
| 693 | 744 | //res.path是网络图片的本地地址 |
| 694 | - ee.data.share_goods_img = res.path; | |
| 745 | + ee.data.head_pic = res.path; | |
| 695 | 746 | tt(); |
| 696 | 747 | }, |
| 697 | 748 | fail: function (res) { |
| 698 | - ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
| 749 | + ee.data.head_pic = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | |
| 699 | 750 | tt(); |
| 700 | 751 | } |
| 701 | 752 | }); |
| 702 | 753 | }, |
| 703 | - | |
| 704 | 754 | /** |
| 705 | 755 | * 生命周期函数--监听页面显示 |
| 706 | 756 | */ | ... | ... |
pages/user/cardinfo/cardinfo.wxml
| 1 | 1 | <import src="../../../utils/wxParse/wxParse.wxml"></import> |
| 2 | +<import src="../../../utils/filter.wxs"></import> | |
| 3 | +<wxs module="filters" src="../../../utils/filter.wxs"></wxs> | |
| 2 | 4 | |
| 3 | 5 | <view> |
| 4 | 6 | <image class="Member_bk" src="{{url}}/miniapp/images/plus/page_bk.png"></image> |
| ... | ... | @@ -10,7 +12,7 @@ |
| 10 | 12 | <view class="flex-space-between"> |
| 11 | 13 | <view style="color:{{user_card.CardColor}}"> |
| 12 | 14 | <view class="fs36" style="font-weight:bold">{{user_card.CardName}}</view> |
| 13 | - <view class="fs22">会员将在{{user_card.ExpiryDate}}到期</view> | |
| 15 | + <view class="fs22">会员将在{{filters.replace_time2(expiryDate)}}到期</view> | |
| 14 | 16 | </view> |
| 15 | 17 | <view class="renew fs28" style="background:{{user_card.CardColor}}">立即续费 |
| 16 | 18 | </view> |
| ... | ... | @@ -20,7 +22,7 @@ |
| 20 | 22 | <view class="flex-vertical-between xs fs24"> |
| 21 | 23 | |
| 22 | 24 | <view class="flex" style=" overflow:hidden"> |
| 23 | - <view class="Member"style="background-image:url('{{url}}/miniapp/images/plus/privilege_o.png');filter: drop-shadow( 40rpx 0rpx 0rpx {{user_card.CardColor}});"></view> | |
| 25 | + <view class="Member"style="background-image:url('{{url}}/miniapp/images/plus/privilege_o.png');filter:box-shadow( 40rpx 0rpx 0rpx {{user_card.CardColor}});"></view> | |
| 24 | 26 | <view style="color:{{user_card.CardColor}}">正在享受{{user_card.CardName}}会员特权 |
| 25 | 27 | </view> |
| 26 | 28 | </view> | ... | ... |