123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- import {
- get
- } from "../../utils/http";
- const app = getApp()
- Page({
-
- data: {
- page: 0,
- limit: 10,
- couponInfo: '',
- coupon_id: '',
- couponRecord: '',
- sendCoupon:'',
- timesLevel:'',
- recordId:''
- },
-
- onLoad(options) {
- wx.hideShareMenu()
- this.getSendCoupon()
- this.scrollToLower()
- this.getSendCouponLevel()
- this.getTimes()
- },
-
- onReady() {
- },
-
- onShow() {
-
- },
-
- onHide() {
- },
-
- onUnload() {
- },
-
- onPullDownRefresh() {
- },
-
- onReachBottom() {
- },
-
- onShareAppMessage() {
- },
-
- getTimes(){
- get('/v2/api/send_coupon/hand_out',{},(res)=>{
- if(res.code==200){
- console.log(res);
- this.setData({
- timesLevel:res.data
- })
- }
- })
- },
-
- onShareFriends() {
- if(this.data.sendCoupon!=1){
- wx.showToast({
- title: '您不满足此次活动要求',
- })
- return
- }
- if(this.data.timesLevel==0){
- wx.showToast({
- title: '没有剩余次数了',
- })
- return
- }
- },
-
- getSendCoupon() {
- get('/v2/api/send_coupon/active', {}, (res) => {
- if (res.code == 200) {
- this.setData({
- couponInfo: res.data,
- coupon_id: res.data.coupon_id
- },()=>{
- get('/v2/api/send_coupon/send', {
- coupon_id:this.data.coupon_id
- }, (res) => {
- this.setData({
- recordId:res.data
- })
- })
- })
- }
- })
- },
-
- onShareAppMessage() {
- return {
- title: '朋友送你的0元修丽可B5补水还未领取,点击去领取~',
- path: `/pages/sendGetCoupon/sendGetCoupon?recordId=${this.data.recordId}`,
- imageUrl: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20220922/%E7%BC%96%E7%BB%84%402x.png',
- };
- },
-
- scrollToLower() {
- this.setData({
- page: this.data.page + 1
- })
- get('/v2/api/send_coupon/list', {
- page: this.data.page,
- limit: this.data.limit
- }, (res) => {
- let arr = [...res.data, ...this.data.couponRecord]
- this.setData({
- couponRecord: arr
- })
- })
- },
-
- getSendCouponLevel(){
- get('/v2/api/send_coupon/apply',{},(res)=>{
- this.setData({
- sendCoupon:res.data
- },)
- })
- },
- })
|