const config = require('../../config/config.js') const Http = require('../../utils/http.js') const HttpBasics = require('../../utils/HttpBasics.js') const util = require('../../utils/util.js') import * as echarts from '../../ec-canvas/echarts'; var app = getApp() Page({ /** * 页面的初始数据 */ data: { showVerify: '' }, gotoSaoyiSao: function () {//扫码核销、识别会员码 wx.setStorageSync("verifyRemark", 12) wx.scanCode({ success: function (val) { console.log(val.result); if (util.isJSON(val.result)) { let value = JSON.parse(val.result); if (value.END == 'C' && value.TYPE == 'couponorder' && value.ID.length >= 18) { Http.getRequest(config.api.couponOrderDetail, app.globalData.token, '加载中', { couponOrderId: value.ID }, (res) => { wx.setStorageSync("verifyRemark", 12) wx.setStorageSync("couponOrderId", value.ID) if (res.code == 200) { wx.navigateTo({ url: `/pages/main/writeoffPage/writeoffPage` }) } else { console.log(res.message, "res") wx.reLaunch({ url: `/pages/main/writeoffPage/errorPage/errorPage?errTitle=${res.message}`, }) } }) } else if (value.END == 'C' && value.TYPE == 'memberCode' && value.ID.length >= 18) { Http.postRequest(config.api.memScan, app.globalData.token, '加载中', { memCode: value.ID }, (res) => { if (res.code == 200) { if (res.data.discountRate != 100) { var discountRate = res.data.discountRate / 10; } else { var discountRate = "暂无折扣"; } wx.navigateTo({ url: `/pages/member/member?levelName=${res.data.levelName}&discountRate=${discountRate}` }) } else { wx.showModal({ title: "抱歉", content: res.message, showCancel: false }) } }) } else { wx.showToast({ title: '请扫描正确的二维码', icon: 'none', duration: 1300 }) } } else { wx.showToast({ title: '请扫描正确的二维码', icon: 'none', duration: 1300 }) } }, fail: function () { wx.showToast({ title: '请扫描正确的二维码', icon: 'none', duration: 1300 }) } }) }, // 跳转到手动核销 aoto: function () { wx.setStorageSync("verifyRemark", 11) wx.setStorageSync wx.navigateTo({ url: '/pages/main/write0ff/write0ff', }) }, })