|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- // pages/index/sw/index.js
- let config = require("../../config/config.js");
- let Http = require("../../utils/HttpBasics");
- let app = getApp();
- const imgurl = require("../../utils/imgurl");
- const bgColor = require("../../utils/bgColor.js")
- Component({
- /**
- * 组件的属性列表
- */
- properties: {},
-
- /**
- * 组件的初始数据
- */
- data: {
- sql: bgColor.colorFirst.main.sql,
- txt: bgColor.colorFirst.main.txt,
- change: imgurl.change.url,
- None: imgurl.None.url,
- jianUrl: imgurl.jian.url,
- barginicon: imgurl.barginicon.url,
- wangmeimeibargin: imgurl.wangmeimeibargin.url,
- kData:[],
- kSize:'',
- pSize: '',
- pData:[],
- couponId:'',
- couponId1: '',
- },
- /**
- * 组件的方法列表
- */
- methods: {
- //获取砍价拼团数据
- getList(val) {
- let that = this;
- let param = ''
- if(val=='1'){
- param={
- targetAd : 6,
- couponId: this.data.couponId
- }
- }else{
- param = {
- targetAd : 7,
- couponId: this.data.couponId1
- }
- }
- Http.get({
- url: config.api.change,
- data:param,
- }).then(res => {
- if(res.data != undefined && res.data){
- if(val=='1'){
- that.setData({
- kData: res.data.data,
- kSize: res.data.size,
- couponId: res.data.data.couponId,
- });
- }else{
- that.setData({
- pData: res.data.data,
- pSize:res.data.size,
- couponId1: res.data.data.couponId
- });
-
- }
- } else {
- if(val=='1'){
- that.setData({
- kData: '',
- kSize: '',
- couponId: '',
- });
- }else{
- that.setData({
- pData: '',
- pSize:'',
- couponId1: ''
- });
-
- }
- }
-
- })
- .catch(err => {
- console.log(err)
- tt.showToast({
- title: err.errMsg,
- icon: 'none',
- duration: 2000,
- mask: false
- });
- })
- },
- // 换一换
- getChange(){
- let that = this
- if (that.kSize != 1 && that.kSize != 0){
- that.getList(1)
- }
- if (that.pSize!=1 && that.pSize !=0) {
- that.getList(2)
- }
- },
- //跳转砍价详情
- gotokjdetail: function (e) {
- tt.navigateTo({
- url: `/pages/coupon/detail/index?couponChannelId=${
- e.currentTarget.dataset.couponchannelid
- }&couponId=${
- e.currentTarget.dataset.couponid
- }&targetAd=${
- e.currentTarget.dataset.targetad
- }`
- });
- },
- //跳转拼团详情
- gotoptdetail: function (e) {
- tt.navigateTo({
- url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${
- e.currentTarget.dataset.couponchannelid
- }&couponId=${
- e.currentTarget.dataset.couponid
- }&targetAd=${
- e.currentTarget.dataset.targetad
- }`
- });
- },
- },
- ready() {
- app.couponChannelListCallback = (token,val) => {
- Http.setToken(token);
- this.getList(1);
- this.getList(2);
- };
- if (app.globalData.token && app.globalData.token != null) {
- app.couponChannelListCallback(app.globalData.token);
- }
- }
- });
|