抖音B端厂库
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

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