抖音c端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

2 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // pages/index/sw/index.js
  2. let config = require("../../config/config.js");
  3. let Http = require("../../utils/HttpBasics");
  4. let app = getApp();
  5. const imgurl = require("../../utils/imgurl");
  6. const bgColor = require("../../utils/bgColor.js")
  7. Component({
  8. /**
  9. * 组件的属性列表
  10. */
  11. properties: {},
  12. /**
  13. * 组件的初始数据
  14. */
  15. data: {
  16. sql: bgColor.colorFirst.main.sql,
  17. txt: bgColor.colorFirst.main.txt,
  18. change: imgurl.change.url,
  19. None: imgurl.None.url,
  20. jianUrl: imgurl.jian.url,
  21. barginicon: imgurl.barginicon.url,
  22. wangmeimeibargin: imgurl.wangmeimeibargin.url,
  23. kData:[],
  24. kSize:'',
  25. pSize: '',
  26. pData:[],
  27. couponId:'',
  28. couponId1: '',
  29. },
  30. /**
  31. * 组件的方法列表
  32. */
  33. methods: {
  34. //获取砍价拼团数据
  35. getList(val) {
  36. let that = this;
  37. let param = ''
  38. if(val=='1'){
  39. param={
  40. targetAd : 6,
  41. couponId: this.data.couponId
  42. }
  43. }else{
  44. param = {
  45. targetAd : 7,
  46. couponId: this.data.couponId1
  47. }
  48. }
  49. Http.get({
  50. url: config.api.change,
  51. data:param,
  52. }).then(res => {
  53. if(res.data != undefined && res.data){
  54. if(val=='1'){
  55. that.setData({
  56. kData: res.data.data,
  57. kSize: res.data.size,
  58. couponId: res.data.data.couponId,
  59. });
  60. }else{
  61. that.setData({
  62. pData: res.data.data,
  63. pSize:res.data.size,
  64. couponId1: res.data.data.couponId
  65. });
  66. }
  67. } else {
  68. if(val=='1'){
  69. that.setData({
  70. kData: '',
  71. kSize: '',
  72. couponId: '',
  73. });
  74. }else{
  75. that.setData({
  76. pData: '',
  77. pSize:'',
  78. couponId1: ''
  79. });
  80. }
  81. }
  82. })
  83. .catch(err => {
  84. console.log(err)
  85. tt.showToast({
  86. title: err.errMsg,
  87. icon: 'none',
  88. duration: 2000,
  89. mask: false
  90. });
  91. })
  92. },
  93. // 换一换
  94. getChange(){
  95. let that = this
  96. if (that.kSize != 1 && that.kSize != 0){
  97. that.getList(1)
  98. }
  99. if (that.pSize!=1 && that.pSize !=0) {
  100. that.getList(2)
  101. }
  102. },
  103. //跳转砍价详情
  104. gotokjdetail: function (e) {
  105. tt.navigateTo({
  106. url: `/pages/coupon/detail/index?couponChannelId=${
  107. e.currentTarget.dataset.couponchannelid
  108. }&couponId=${
  109. e.currentTarget.dataset.couponid
  110. }&targetAd=${
  111. e.currentTarget.dataset.targetad
  112. }`
  113. });
  114. },
  115. //跳转拼团详情
  116. gotoptdetail: function (e) {
  117. tt.navigateTo({
  118. url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${
  119. e.currentTarget.dataset.couponchannelid
  120. }&couponId=${
  121. e.currentTarget.dataset.couponid
  122. }&targetAd=${
  123. e.currentTarget.dataset.targetad
  124. }`
  125. });
  126. },
  127. },
  128. ready() {
  129. app.couponChannelListCallback = (token,val) => {
  130. Http.setToken(token);
  131. this.getList(1);
  132. this.getList(2);
  133. };
  134. if (app.globalData.token && app.globalData.token != null) {
  135. app.couponChannelListCallback(app.globalData.token);
  136. }
  137. }
  138. });