|
- // pages/index/sw/index.js
- let config = require('../../../config/config.js')
- let Http = require('../../../utils/HttpBasics')
- let app = getApp()
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
-
- },
-
- /**
- * 组件的初始数据
- */
- data: {
- tabs: [],
- list: [],
- current: '1',
- current_scroll: '1',
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- handleChange({
- detail
- }) {
- this.setData({
- current: detail.key
- });
- },
-
- handleChangeScroll({
- detail
- }) {
- this.setData({
- current_scroll: detail.key
- });
- },
- },
- ready() {
- var that = this
- app.couponListCallback = token =>{
- Http.setToken(token)
- // business获取
- Http.get({
- url: config.api.businessList,
- data: {
- pageNum: 1,
- pageSize: 10,
- type: 1
- }
- })
- .then(res => {
- console.log(res)
- that.setData({
- tabs: res.data.list
- })
- })
- // 券list获取
- Http.get({
- url: config.api.couponList,
- data: {
- pageNum: 1,
- pageSize: 10
- }
- }).then(res => {
- console.log(res);
- that.setData({
- list: res.data.list
- })
- })
- }
- if (app.globalData.token && app.globalData.token != null) {
- app.couponListCallback(app.globalData.token)
- }
- }
- })
|