123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- import {
- get
- } from "../../utils/http";
- const app = getApp()
- Page({
-
- data: {
- couponInfo: '',
- couponLogin: ''
- },
-
- onLoad(options) {
- this.setData({
- recordId: options.recordId
- })
- console.log(options.recordId,'options.recordId');
-
- this.getCouponInfo()
-
- this.getCouponLogin()
- },
-
- onReady() {
- },
-
- onShow() {},
-
- onHide() {
- },
-
- onUnload() {
- },
-
- onPullDownRefresh() {
- },
-
- onReachBottom() {
- },
-
- onShareAppMessage() {
- },
-
- getCouponInfo() {
- get('/v2/api/send_coupon/active', {}, (res) => {
- if (res.code == 200) {
- this.setData({
- couponInfo: res.data
- })
- }
- })
- },
-
- getCoupon() {
- if (this.data.couponLogin > 0) {
- return
- }
- if(wx.getStorageSync('userInfo')==''){
- wx.navigateTo({
- url: `/pages/login/login`,
- })
- }
- get('/v2/api/send_coupon/receive', {
- id: this.data.recordId
- }, (res) => {
- this.getCouponLogin()
- })
- },
-
- getCouponLogin() {
- get('/v2/api/send_coupon/discount_coupon', {}, (res) => {
- if (res.code == 200) {
- this.setData({
- couponLogin: res.data.status
- })
- }
- })
- }
- })
|