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.

91 lines
2.9 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. import * as echarts from '../../ec-canvas/echarts';
  6. var app = getApp()
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. showVerify: ''
  13. },
  14. gotoSaoyiSao: function () {//扫码核销、识别会员码
  15. wx.setStorageSync("verifyRemark", 12)
  16. wx.scanCode({
  17. success: function (val) {
  18. console.log(val.result);
  19. if (util.isJSON(val.result)) {
  20. let value = JSON.parse(val.result);
  21. if (value.END == 'C' && value.TYPE == 'couponorder' && value.ID.length >= 18) {
  22. Http.getRequest(config.api.couponOrderDetail, app.globalData.token, '加载中', {
  23. couponOrderId: value.ID
  24. }, (res) => {
  25. wx.setStorageSync("verifyRemark", 12)
  26. wx.setStorageSync("couponOrderId", value.ID)
  27. if (res.code == 200) {
  28. wx.navigateTo({
  29. url: `/pages/main/writeoffPage/writeoffPage`
  30. })
  31. } else {
  32. console.log(res.message, "res")
  33. wx.reLaunch({
  34. url: `/pages/main/writeoffPage/errorPage/errorPage?errTitle=${res.message}`,
  35. })
  36. }
  37. })
  38. } else if (value.END == 'C' && value.TYPE == 'memberCode' && value.ID.length >= 18) {
  39. Http.postRequest(config.api.memScan, app.globalData.token, '加载中', {
  40. memCode: value.ID
  41. }, (res) => {
  42. if (res.code == 200) {
  43. if (res.data.discountRate != 100) {
  44. var discountRate = res.data.discountRate / 10;
  45. } else {
  46. var discountRate = "暂无折扣";
  47. }
  48. wx.navigateTo({
  49. url: `/pages/member/member?levelName=${res.data.levelName}&discountRate=${discountRate}`
  50. })
  51. } else {
  52. wx.showModal({
  53. title: "抱歉",
  54. content: res.message,
  55. showCancel: false
  56. })
  57. }
  58. })
  59. } else {
  60. wx.showToast({
  61. title: '请扫描正确的二维码',
  62. icon: 'none',
  63. duration: 1300
  64. })
  65. }
  66. } else {
  67. wx.showToast({
  68. title: '请扫描正确的二维码',
  69. icon: 'none',
  70. duration: 1300
  71. })
  72. }
  73. },
  74. fail: function () {
  75. wx.showToast({
  76. title: '请扫描正确的二维码',
  77. icon: 'none',
  78. duration: 1300
  79. })
  80. }
  81. })
  82. },
  83. // 跳转到手动核销
  84. aoto: function () {
  85. wx.setStorageSync("verifyRemark", 11)
  86. wx.setStorageSync
  87. wx.navigateTo({
  88. url: '/pages/main/write0ff/write0ff',
  89. })
  90. },
  91. })