|
- const config = require('../../config/config.js')
- const Http = require('../../utils/http.js')
- const HttpBasics = require('../../utils/HttpBasics.js')
- const util = require('../../utils/util.js')
- const qrCodeJS = require('../../utils/qrcode.js')
- var app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- isPhonePermission: false
- },
- qrcode() {
- let that = this;
- let merchantIdScan = JSON.stringify({ END: "B", TYPE: "merchant", ID: app.globalData.merchant.merchant_id_scan });
- console.log(merchantIdScan)
- // qrCodeJS.qrApi.draw(merchantIdScan, "logoQRCode", wx.getSystemInfoSync().windowWidth * (260 / 375), wx.getSystemInfoSync().windowWidth * (260 / 375), null, '',function (res) {
- // debugger;
- // that.setData({
- // tempFilePath: res
- // })
- // });
- qrCodeJS.qrApi.draw(merchantIdScan, 'logoQRCode', wx.getSystemInfoSync().windowWidth * (260 / 375), wx.getSystemInfoSync().windowWidth * (260 / 375), function (res) {
- that.setData({
- tempFilePath: res
- })
- })
- },
-
- gotoReund() {
- wx.navigateTo({
- url: '/pages/refund/refund',
- })
- },
-
- gotoReceive() {
- wx.navigateTo({
- url: '/pages/receiveRecord/index',
- })
- },
-
- gotoScan() {
- wx.scanCode({
- success: (res) => {
- console.log(res.result, 'res');
- const codeInfo = encodeURIComponent(res.result);
- wx.navigateTo({
- url: `/pages/cardPay/cardPay?codeInfo=${codeInfo}&isTransform=${true}`,
- })
- },
- fail: (res) => {
- wx.showToast({
- title: "未识别到二维码",
- icon: "none",
- mask: false
- })
- }
- })
- },
-
- gotoInput() {
- wx.navigateTo({
- url: `/pages/cardInput/cardInput`,
- })
- },
-
- getMallInfo() {
- HttpBasics.get({
- url: config.api.useCardBySearchPhone,
- })
- .then(res => {
- console.log(res, 'res');
- this.setData({
- isPhonePermission: res.data
- ? true
- : false
- })
- }).catch(err => {
-
- })
- },
-
- onReady: function () {
- console.log(app.globalData.merchant.merchant_id_scan)
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onLoad: function () {
- this.qrcode();
- this.getMallInfo()
- },
- })
|