| @@ -116,3 +116,15 @@ page { | |||||
| .fr{ | .fr{ | ||||
| float: right; | float: right; | ||||
| } | } | ||||
| .canWrap{ | |||||
| position: fixed; | |||||
| bottom: -2000rpx; | |||||
| left: 0rpx; | |||||
| width: 100%; | |||||
| height: 100%; | |||||
| overflow: visible; | |||||
| } | |||||
| .canWrap canvas{ | |||||
| width: 690rpx; | |||||
| height: 450rpx; | |||||
| } | |||||
| @@ -1,3 +1,4 @@ | |||||
| @import "../../../app.wxss"; | |||||
| .container { | .container { | ||||
| background: #fff; | background: #fff; | ||||
| width: 92%; | width: 92%; | ||||
| @@ -3,6 +3,7 @@ const config = require("../../../config/config.js"); | |||||
| const Http = require("../../../utils/HttpBasics"); | const Http = require("../../../utils/HttpBasics"); | ||||
| let app = getApp(); | let app = getApp(); | ||||
| const imgurl = require("../../../utils/imgurl"); | const imgurl = require("../../../utils/imgurl"); | ||||
| const QR = require("../../../utils/memberqrcode.js"); | |||||
| //券详情页面 | //券详情页面 | ||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| @@ -165,7 +166,8 @@ Page({ | |||||
| TYPE:"couponorder", | TYPE:"couponorder", | ||||
| ID: options.quancode | ID: options.quancode | ||||
| }) | }) | ||||
| util.qrcode("qrcode", url, 350, 350); | |||||
| // util.qrcode("qrcode", url, 350, 350); | |||||
| that.createQrCode(url, "qrcode", 350, 350); | |||||
| }) | }) | ||||
| .catch(err => { | .catch(err => { | ||||
| wx.showToast({ | wx.showToast({ | ||||
| @@ -176,6 +178,15 @@ Page({ | |||||
| }); | }); | ||||
| }) | }) | ||||
| }, | }, | ||||
| createQrCode: function (url, canvasId, cavW, cavH) { | |||||
| //调用插件中的draw方法,绘制二维码图片 | |||||
| let that = this; | |||||
| QR.api.draw(url, canvasId, cavW, cavH, function (res) { | |||||
| that.setData({ | |||||
| tempFilePath: res | |||||
| }) | |||||
| }); | |||||
| }, | |||||
| phone: function (e) { | phone: function (e) { | ||||
| let that = this; | let that = this; | ||||
| if (e.currentTarget.dataset.merchantlinkphone) { | if (e.currentTarget.dataset.merchantlinkphone) { | ||||
| @@ -36,9 +36,13 @@ | |||||
| <image wx:if="{{data.couponOrderStatus==3}}" src="{{wm03Url}}" mode='widthFix'></image> | <image wx:if="{{data.couponOrderStatus==3}}" src="{{wm03Url}}" mode='widthFix'></image> | ||||
| <image wx:if="{{data.couponOrderStatus==0&&data.validStatus==0}}" src="{{wm04Url}}" mode='widthFix'></image> | <image wx:if="{{data.couponOrderStatus==0&&data.validStatus==0}}" src="{{wm04Url}}" mode='widthFix'></image> | ||||
| <view class="panel" wx:if="{{data.couponOrderStatus==0&&data.validStatus!=0}}"> | <view class="panel" wx:if="{{data.couponOrderStatus==0&&data.validStatus!=0}}"> | ||||
| <view class="qrcode"> | |||||
| <!-- <view class="qrcode"> | |||||
| <canvas canvas-id="qrcode" /> | <canvas canvas-id="qrcode" /> | ||||
| </view> --> | |||||
| <view class="canWrap"> | |||||
| <canvas canvas-id="qrcode" style="width: 1200rpx; height: 800rpx;" /> | |||||
| </view> | </view> | ||||
| <image src="{{tempFilePath}}" mode="aspectFit" /> | |||||
| <view class="barnum buy"> | <view class="barnum buy"> | ||||
| <text>优惠券码:</text>{{code}}</view> | <text>优惠券码:</text>{{code}}</view> | ||||
| </view> | </view> | ||||
| @@ -2,7 +2,6 @@ const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {} | |||||
| const Http = require("../../utils/HttpBasics"); | const Http = require("../../utils/HttpBasics"); | ||||
| const imgurl = require("../../utils/imgurl"); | const imgurl = require("../../utils/imgurl"); | ||||
| const config = require("../../config/config"); | const config = require("../../config/config"); | ||||
| const QR = require("../../utils/memberqrcode.js"); | |||||
| let app = getApp(); | let app = getApp(); | ||||
| Page({ | Page({ | ||||
| /** | /** | ||||
| @@ -1,8 +1,9 @@ | |||||
| let util = require("../../utils/util"); | |||||
| // let util = require("../../utils/util"); | |||||
| let Http = require("../../utils/HttpBasics"); | let Http = require("../../utils/HttpBasics"); | ||||
| let config = require("../../config/config.js"); | let config = require("../../config/config.js"); | ||||
| let app = getApp(); | let app = getApp(); | ||||
| const imgurl = require("../../utils/imgurl"); | const imgurl = require("../../utils/imgurl"); | ||||
| const QR = require("../../utils/memberqrcode.js"); | |||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| lineUrl: imgurl.line.url, | lineUrl: imgurl.line.url, | ||||
| @@ -51,9 +52,8 @@ Page({ | |||||
| }, | }, | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||
| let that = this; | let that = this; | ||||
| console.log(options) | |||||
| let value = JSON.stringify({ END: "C", TYPE: "couponorder", ID: options.quancode}) | let value = JSON.stringify({ END: "C", TYPE: "couponorder", ID: options.quancode}) | ||||
| util.qrcode("qrcode", value, 350, 350); | |||||
| that.createQrCode(value, "qrcode", 350, 350); | |||||
| that.setData({ | that.setData({ | ||||
| code: options.quancode, | code: options.quancode, | ||||
| title: options.title, | title: options.title, | ||||
| @@ -131,14 +131,15 @@ Page({ | |||||
| * 1 已经核销成功 | * 1 已经核销成功 | ||||
| */ | */ | ||||
| }, | }, | ||||
| // onShow(options) { | |||||
| // console.log("屏幕的亮度") | |||||
| // setTimeout(function () { | |||||
| // wx.setScreenBrightness({ | |||||
| // value: 1, | |||||
| // }) | |||||
| // }, 200) | |||||
| // }, | |||||
| createQrCode: function (url, canvasId, cavW, cavH) { | |||||
| //调用插件中的draw方法,绘制二维码图片 | |||||
| let that = this; | |||||
| QR.api.draw(url, canvasId, cavW, cavH, function (res) { | |||||
| that.setData({ | |||||
| tempFilePath: res | |||||
| }) | |||||
| }); | |||||
| }, | |||||
| onUnload: function () { | onUnload: function () { | ||||
| let that = this; | let that = this; | ||||
| clearInterval(that.data.setInter); | clearInterval(that.data.setInter); | ||||
| @@ -2,6 +2,7 @@ | |||||
| <view class="title">{{title}}</view> | <view class="title">{{title}}</view> | ||||
| <view class="subtitle">{{subtitle}}</view> | <view class="subtitle">{{subtitle}}</view> | ||||
| <image class='line' src='{{lineUrl}}' mode="widthFix"></image> | <image class='line' src='{{lineUrl}}' mode="widthFix"></image> | ||||
| <!-- | <!-- | ||||
| couponorderstatus | couponorderstatus | ||||
| 0 未使用 | 0 未使用 | ||||
| @@ -16,9 +17,10 @@ | |||||
| <image wx:if="{{couponorderstatus==3}}" src="{{wm03Url}}" mode='widthFix'></image> | <image wx:if="{{couponorderstatus==3}}" src="{{wm03Url}}" mode='widthFix'></image> | ||||
| <image wx:if="{{couponorderstatus==0&&validStatus==0}}" src="{{wm04Url}}" mode='widthFix'></image> | <image wx:if="{{couponorderstatus==0&&validStatus==0}}" src="{{wm04Url}}" mode='widthFix'></image> | ||||
| <view class="panel" wx:if="{{couponorderstatus==0&&validStatus!=0}}"> | <view class="panel" wx:if="{{couponorderstatus==0&&validStatus!=0}}"> | ||||
| <view class="qrcode"> | |||||
| <canvas canvas-id="qrcode" /> | |||||
| <view class="canWrap"> | |||||
| <canvas canvas-id="qrcode" style="width: 1200rpx; height: 800rpx;" /> | |||||
| </view> | </view> | ||||
| <image src="{{tempFilePath}}" mode="aspectFit" /> | |||||
| <view class="barnum buy"><text>兑换码:</text>{{code}}</view> | <view class="barnum buy"><text>兑换码:</text>{{code}}</view> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -1,3 +1,4 @@ | |||||
| @import "../../app.wxss"; | |||||
| page { | page { | ||||
| background: #02c0ff; | background: #02c0ff; | ||||
| } | } | ||||
| @@ -37,13 +38,12 @@ page { | |||||
| } | } | ||||
| .panel, .zhuangtai image { | .panel, .zhuangtai image { | ||||
| width:600rpx; | |||||
| display:block; | |||||
| border-radius:10rpx; | |||||
| margin:0 auto; | |||||
| padding:0; | |||||
| z-index:10000000000; | |||||
| width:500rpx; | |||||
| display:block; | |||||
| border-radius:10rpx; | |||||
| margin:0 auto; | |||||
| padding:0; | |||||
| z-index:10000000000; | |||||
| } | } | ||||
| .pane2 { | .pane2 { | ||||
| @@ -2,9 +2,7 @@ var config = require("../../config/config.js"); | |||||
| var app = getApp(); | var app = getApp(); | ||||
| const Http = require("../../utils/HttpBasics"); | const Http = require("../../utils/HttpBasics"); | ||||
| const QR = require("../../utils/memberqrcode.js"); | const QR = require("../../utils/memberqrcode.js"); | ||||
| const BR = require("../../utils/barcode.js"); | |||||
| const imgurl = require("../../utils/imgurl"); | const imgurl = require("../../utils/imgurl"); | ||||
| const util = require("../../utils/util"); | |||||
| Page({ | Page({ | ||||
| /** | /** | ||||
| * 页面的初始数据 | * 页面的初始数据 | ||||
| @@ -27,6 +25,7 @@ Page({ | |||||
| */ | */ | ||||
| onShow: function () { | onShow: function () { | ||||
| let that = this; | let that = this; | ||||
| console.log("渲染开始") | |||||
| Http.get({ | Http.get({ | ||||
| url: config.api.getDiscountInfo, | url: config.api.getDiscountInfo, | ||||
| data: {} | data: {} | ||||
| @@ -36,6 +35,7 @@ Page({ | |||||
| level: res.data.level ? res.data.level : '' | level: res.data.level ? res.data.level : '' | ||||
| }) | }) | ||||
| that.qrcode(res.data.id); | that.qrcode(res.data.id); | ||||
| that.setData({ | that.setData({ | ||||
| memberId: res.data.id | memberId: res.data.id | ||||
| }) | }) | ||||
| @@ -51,6 +51,7 @@ Page({ | |||||
| }) | }) | ||||
| }) | }) | ||||
| }, | }, | ||||
| goback: function () { | goback: function () { | ||||
| wx.switchTab({ | wx.switchTab({ | ||||
| url: '/pages/main/index', | url: '/pages/main/index', | ||||
| @@ -68,18 +69,22 @@ Page({ | |||||
| ID: memberId, | ID: memberId, | ||||
| }); | }); | ||||
| that.createQrCode(url, "mycanvas2", size.w, size.h); | that.createQrCode(url, "mycanvas2", size.w, size.h); | ||||
| // util.barcode('barcode',memberId, 600, 150); | |||||
| }, | }, | ||||
| createQrCode: function (url, canvasId, cavW, cavH) { | createQrCode: function (url, canvasId, cavW, cavH) { | ||||
| //调用插件中的draw方法,绘制二维码图片 | //调用插件中的draw方法,绘制二维码图片 | ||||
| QR.api.draw(url, canvasId, cavW, cavH); | |||||
| let that = this; | |||||
| QR.api.draw(url, canvasId, cavW, cavH,function(res){ | |||||
| that.setData({ | |||||
| tempFilePath: res | |||||
| }) | |||||
| }); | |||||
| }, | }, | ||||
| //适配不同屏幕大小的canvas | //适配不同屏幕大小的canvas | ||||
| setCanvasSize: function () { | setCanvasSize: function () { | ||||
| var size = {}; | var size = {}; | ||||
| try { | try { | ||||
| var res = wx.getSystemInfoSync(); | var res = wx.getSystemInfoSync(); | ||||
| var scale = 750 / 300; | |||||
| var scale = 750 / 400; | |||||
| //不同屏幕下canvas的适配比例;设计稿是750宽 | //不同屏幕下canvas的适配比例;设计稿是750宽 | ||||
| var width = res.windowWidth / scale; | var width = res.windowWidth / scale; | ||||
| var height = width; | var height = width; | ||||
| @@ -1,8 +1,9 @@ | |||||
| <button class='goback' bindtap='goback'><image src='{{wmhome}}' mode="widthFix"></image></button> | <button class='goback' bindtap='goback'><image src='{{wmhome}}' mode="widthFix"></image></button> | ||||
| <view class='code'> | <view class='code'> | ||||
| <!-- <text style='margin-bottom:20rpx;'>会员码</text> --> | |||||
| <!-- <canvas canvas-id="barcode" id='barcode' /> --> | |||||
| <canvas canvas-id="mycanvas2" id='mycanvas2' /> | |||||
| <view class="canWrap"> | |||||
| <canvas canvas-id="mycanvas2" style="width: 1200rpx; height: 800rpx;" /> | |||||
| </view> | |||||
| <image src="{{tempFilePath}}" mode="aspectFit" /> | |||||
| <text>会员码:{{memberId}}</text> | <text>会员码:{{memberId}}</text> | ||||
| </view> | </view> | ||||
| <view class='con'> | <view class='con'> | ||||
| @@ -1,3 +1,4 @@ | |||||
| @import "../../app.wxss"; | |||||
| Page{ | Page{ | ||||
| background: #fc5b24; | background: #fc5b24; | ||||
| } | } | ||||
| @@ -132,7 +133,7 @@ Page{ | |||||
| background: #fff; | background: #fff; | ||||
| margin: 0 auto; | margin: 0 auto; | ||||
| border-radius:10rpx; | border-radius:10rpx; | ||||
| padding: 10rpx 0 40rpx; | |||||
| padding: 20rpx 0 40rpx; | |||||
| } | } | ||||
| .code text{ | .code text{ | ||||
| color: #666; | color: #666; | ||||
| @@ -144,4 +145,9 @@ Page{ | |||||
| width: 600rpx; | width: 600rpx; | ||||
| height: 150rpx; | height: 150rpx; | ||||
| margin: 0 auto 10rpx; | margin: 0 auto 10rpx; | ||||
| } | |||||
| .code image{ | |||||
| display: block; | |||||
| width: 500rpx; | |||||
| margin: 0 auto; | |||||
| } | } | ||||
| @@ -16,6 +16,7 @@ Page({ | |||||
| activeUrl: imgurl.active.url, | activeUrl: imgurl.active.url, | ||||
| dingUrl: imgurl.ding.url, | dingUrl: imgurl.ding.url, | ||||
| quansUrl: imgurl.quans.url, | quansUrl: imgurl.quans.url, | ||||
| wmintegral: imgurl.wmintegral.url, | |||||
| cardiconUrl: imgurl.cardicon.url, | cardiconUrl: imgurl.cardicon.url, | ||||
| cheUrl: imgurl.che.url, | cheUrl: imgurl.che.url, | ||||
| giftUrl: imgurl.gift.url, | giftUrl: imgurl.gift.url, | ||||
| @@ -73,7 +73,7 @@ | |||||
| <navigator url="/pages/integralmall/index"> | <navigator url="/pages/integralmall/index"> | ||||
| <view class="user-btn app-border-bottom"> | <view class="user-btn app-border-bottom"> | ||||
| <view> | <view> | ||||
| <image class='icons' src="{{cardiconUrl}}" mode='widthFix'></image>积分商城</view> | |||||
| <image class='icons' src="{{wmintegral}}" mode='widthFix'></image>积分商城</view> | |||||
| <view> | <view> | ||||
| <text class="couponnum" wx:if="{{couponNum2=='couponNum2'}}"></text> | <text class="couponnum" wx:if="{{couponNum2=='couponNum2'}}"></text> | ||||
| <text class="iconfont icon-right"></text> | <text class="iconfont icon-right"></text> | ||||
| @@ -49,11 +49,11 @@ module.exports = { | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'cardicon': { | 'cardicon': { | ||||
| 'url': baseUrl + 'cardicon.png', | |||||
| 'url': baseUrl + 'cardicon1.png', | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'che': { | 'che': { | ||||
| 'url': baseUrl + 'che.png', | |||||
| 'url': baseUrl + 'che1.png', | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'choice': { | 'choice': { | ||||
| @@ -77,7 +77,7 @@ module.exports = { | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'ding': { | 'ding': { | ||||
| 'url': baseUrl + 'ding.png', | |||||
| 'url': baseUrl + 'ding1.png', | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'dingdan': { | 'dingdan': { | ||||
| @@ -237,11 +237,11 @@ module.exports = { | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'quan': { | 'quan': { | ||||
| 'url': baseUrl + 'quan.png', | |||||
| 'url': baseUrl + 'quan1.png', | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'quans': { | 'quans': { | ||||
| 'url': baseUrl + 'quans.png', | |||||
| 'url': baseUrl + 'quans1.png', | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'ques_bg': { | 'ques_bg': { | ||||
| @@ -265,7 +265,7 @@ module.exports = { | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'rule': { | 'rule': { | ||||
| 'url': baseUrl + 'rule.png', | |||||
| 'url': baseUrl + 'rule1.png', | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'shanchuGray': { | 'shanchuGray': { | ||||
| @@ -329,7 +329,7 @@ module.exports = { | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'wenti': { | 'wenti': { | ||||
| 'url': baseUrl + 'wenti.png', | |||||
| 'url': baseUrl + 'wenti1.png', | |||||
| 'name': '' | 'name': '' | ||||
| }, | }, | ||||
| 'wm01': { | 'wm01': { | ||||
| @@ -498,11 +498,11 @@ module.exports = { | |||||
| }, | }, | ||||
| 'wmbarginicon': { | 'wmbarginicon': { | ||||
| 'url': baseUrl + 'wmbarginicon.png', | |||||
| 'url': baseUrl + 'wmbarginicon1.png', | |||||
| 'name': '我的砍价' | 'name': '我的砍价' | ||||
| }, | }, | ||||
| 'wmspellgroup': { | 'wmspellgroup': { | ||||
| 'url': baseUrl + 'wmspellgroup.png', | |||||
| 'url': baseUrl + 'wmspellgroup1.png', | |||||
| 'name': '我的拼团' | 'name': '我的拼团' | ||||
| }, | }, | ||||
| 'leftarrows': { | 'leftarrows': { | ||||
| @@ -564,5 +564,9 @@ module.exports = { | |||||
| 'wangmeimeicredit':{ | 'wangmeimeicredit':{ | ||||
| 'url': baseUrl + "wangmeimeicredit.png", | 'url': baseUrl + "wangmeimeicredit.png", | ||||
| 'name': '积分背景' | 'name': '积分背景' | ||||
| }, | |||||
| 'wmintegral': { | |||||
| 'url': baseUrl + "wmintegral.png", | |||||
| 'name': '积分商城' | |||||
| } | } | ||||
| } | } | ||||
| @@ -750,7 +750,7 @@ | |||||
| /** | /** | ||||
| * 新增$this参数,传入组件的this,兼容在组件中生成 | * 新增$this参数,传入组件的this,兼容在组件中生成 | ||||
| */ | */ | ||||
| draw: function (str, canvas, cavW, cavH, $this, ecc) { | |||||
| draw: function (str, canvas, cavW, cavH,cb,$this, ecc) { | |||||
| var that = this; | var that = this; | ||||
| ecclevel = ecc || ecclevel; | ecclevel = ecc || ecclevel; | ||||
| canvas = canvas || _canvas; | canvas = canvas || _canvas; | ||||
| @@ -763,9 +763,9 @@ | |||||
| str = that.utf16to8(str);//增加中文显示 | str = that.utf16to8(str);//增加中文显示 | ||||
| var frame = that.getFrame(str), | var frame = that.getFrame(str), | ||||
| // 组件中生成qrcode需要绑定this | |||||
| ctx = wx.createCanvasContext(canvas,$this), | |||||
| px = Math.round(size / (width + 8)); | |||||
| // 组件中生成qrcode需要绑定this | |||||
| ctx = wx.createCanvasContext(canvas,$this), | |||||
| px = Math.round(size / (width + 8)); | |||||
| var roundedSize = px * (width + 8), | var roundedSize = px * (width + 8), | ||||
| offset = Math.floor((size - roundedSize) / 2); | offset = Math.floor((size - roundedSize) / 2); | ||||
| size = roundedSize; | size = roundedSize; | ||||
| @@ -780,10 +780,28 @@ | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ctx.draw(); | |||||
| ctx.draw(false, setTimeout(function () { | |||||
| wx.canvasToTempFilePath({ | |||||
| x: 0, | |||||
| y: 0, | |||||
| width: cavW, | |||||
| height: cavH, | |||||
| destWidth: cavW, | |||||
| destHeight: cavH, | |||||
| canvasId: canvas, | |||||
| fail: function (res) { | |||||
| console.log(res) | |||||
| }, | |||||
| success: function (res) { | |||||
| console.log(res.tempFilePath) | |||||
| if (cb) { | |||||
| cb(res.tempFilePath); | |||||
| }; | |||||
| } | |||||
| }) | |||||
| },200)); | |||||
| } | } | ||||
| } | } | ||||
| module.exports = { api } | module.exports = { api } | ||||
| // exports.draw = api; | // exports.draw = api; | ||||
| })(); | })(); | ||||