You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 line
2.2 KiB

  1. const config = require('../../config/config.js')
  2. const Http = require('../../utils/http.js')
  3. const HttpBasics = require('../../utils/HttpBasics.js')
  4. const util = require('../../utils/util.js')
  5. const qrCodeJS = require('../../utils/qrcode.js')
  6. var app = getApp()
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. isPhonePermission: false
  13. },
  14. qrcode() {
  15. let that = this;
  16. let merchantIdScan = JSON.stringify({ END: "B", TYPE: "merchant", ID: app.globalData.merchant.merchant_id_scan });
  17. console.log(merchantIdScan)
  18. // qrCodeJS.qrApi.draw(merchantIdScan, "logoQRCode", wx.getSystemInfoSync().windowWidth * (260 / 375), wx.getSystemInfoSync().windowWidth * (260 / 375), null, '',function (res) {
  19. // debugger;
  20. // that.setData({
  21. // tempFilePath: res
  22. // })
  23. // });
  24. qrCodeJS.qrApi.draw(merchantIdScan, 'logoQRCode', wx.getSystemInfoSync().windowWidth * (260 / 375), wx.getSystemInfoSync().windowWidth * (260 / 375), function (res) {
  25. that.setData({
  26. tempFilePath: res
  27. })
  28. })
  29. },
  30. gotoReund() {
  31. wx.navigateTo({
  32. url: '/pages/refund/refund',
  33. })
  34. },
  35. gotoReceive() {
  36. wx.navigateTo({
  37. url: '/pages/receiveRecord/index',
  38. })
  39. },
  40. gotoScan() {
  41. wx.scanCode({
  42. success: (res) => {
  43. console.log(res.result, 'res');
  44. const codeInfo = encodeURIComponent(res.result);
  45. wx.navigateTo({
  46. url: `/pages/cardPay/cardPay?codeInfo=${codeInfo}&isTransform=${true}`,
  47. })
  48. },
  49. fail: (res) => {
  50. wx.showToast({
  51. title: "未识别到二维码",
  52. icon: "none",
  53. mask: false
  54. })
  55. }
  56. })
  57. },
  58. gotoInput() {
  59. wx.navigateTo({
  60. url: `/pages/cardInput/cardInput`,
  61. })
  62. },
  63. getMallInfo() {
  64. HttpBasics.get({
  65. url: config.api.useCardBySearchPhone,
  66. })
  67. .then(res => {
  68. console.log(res, 'res');
  69. this.setData({
  70. isPhonePermission: res.data
  71. ? true
  72. : false
  73. })
  74. }).catch(err => {
  75. })
  76. },
  77. onReady: function () {
  78. console.log(app.globalData.merchant.merchant_id_scan)
  79. },
  80. /**
  81. * 生命周期函数--监听页面显示
  82. */
  83. onLoad: function () {
  84. this.qrcode();
  85. this.getMallInfo()
  86. },
  87. })