抖音c端
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. const navigationBarHeight = (getApp().statusBarHeight + 50) + 'px'
  2. var config = require("../../config/config.js");
  3. const Http = require("../../utils/HttpBasics");
  4. var app = getApp();
  5. Page({
  6. data: {
  7. navigationBarHeight,
  8. canIUse: tt.canIUse("button.open-type.getPhoneNumber"),
  9. couponChannelId: "",
  10. path: null,
  11. paramData: null,
  12. signActivity: "",
  13. mineFlag: null,
  14. skipUrl: 0,
  15. fillIndentId: "",
  16. couponId: "",
  17. // skip: app.globalData.skip
  18. },
  19. onLoad: function (options) {
  20. var that = this;
  21. if (options.skipUrl) {
  22. that.setData({
  23. skipUrl: options.skipUrl
  24. })
  25. }
  26. if (options.mallTenantId) {
  27. that.setData({
  28. mallTenantId: options.mallTenantId
  29. })
  30. }
  31. that.setData({
  32. path: options.path
  33. })
  34. that.setData({
  35. paramData: options
  36. })
  37. if (options && options.fillIndentId && options.couponId) {
  38. that.setData({
  39. fillIndentId: options.fillIndentId,
  40. couponId: options.couponId
  41. })
  42. }
  43. if (options && options.couponChannelId) {
  44. that.setData({
  45. couponChannelId: options.couponChannelId
  46. });
  47. }
  48. if (options && options.mineFlag) {
  49. that.setData({
  50. mineFlag: options.mineFlag
  51. })
  52. }
  53. if (options && options.signActivity) {
  54. that.setData({
  55. signActivity: options.signActivity
  56. });
  57. }
  58. Http.get({
  59. url: config.api.marketicon,
  60. data: {
  61. appId: app.globalData.appId
  62. }
  63. }).then(res => {
  64. that.setData({
  65. mallImgUrl: res.data.mallImgUrl
  66. });
  67. tt.setNavigationBarTitle({
  68. title: res.data.mallName
  69. })
  70. })
  71. .catch(err => {
  72. tt.showToast({
  73. title: err.errMsg,
  74. icon: 'none',
  75. duration: 2000,
  76. mask: false
  77. });
  78. })
  79. },
  80. onShow: function () {
  81. tt.checkSession({
  82. success() {
  83. //session_key 未过期,并且在本生命周期一直有效
  84. },
  85. fail() {
  86. // session_key 已经失效,需要重新执行登录流程
  87. console.log("session_key 过期")
  88. tt.login({
  89. success: (res) => {
  90. if (res.code) {
  91. let usrdata = {
  92. appId: app.globalData.appId,
  93. code: res.code,
  94. }
  95. Http.post({
  96. url: config.api.login,
  97. data: usrdata
  98. }).then(res => {
  99. Http.setToken(res.data.token);
  100. app.globalData.token = res.data.token;
  101. })
  102. }
  103. }
  104. })
  105. }
  106. })
  107. },
  108. backHome() {
  109. console.log("我调用的返回");
  110. tt.navigateBack({
  111. delta: 1,
  112. success: (res) => {
  113. },
  114. fail: (res) => {
  115. },
  116. });
  117. // tt.reLaunch({
  118. // url: "/pages/index/index",
  119. // success: (res) => {
  120. // },
  121. // fail: (res) => {
  122. // },
  123. // });
  124. },
  125. getPhoneNumber: function (e) {
  126. var that = this;
  127. var iv = e.detail.iv;
  128. var encryptedData = e.detail.encryptedData;
  129. Http.post({
  130. url: config.api.getUserPhone,
  131. data: {
  132. encryptedData: encryptedData,
  133. iv: iv
  134. }
  135. }).then(res => {
  136. app.globalData.phone = res.data.phone;
  137. if (that.data.skipUrl == '1') {
  138. console.log(app.globalData.skip, app.globalData.skipUrl, "跳转地址")
  139. if (app.globalData.skip == 'redirectTo') {
  140. tt.redirectTo({
  141. url: app.globalData.skipUrl,
  142. })
  143. return;
  144. } else if (app.globalData.skip == 'navigateTo') {
  145. tt.navigateTo({
  146. url: app.globalData.skipUrl,
  147. })
  148. return;
  149. } else if (app.globalData.skip == 'reLaunch') {
  150. tt.reLaunch({
  151. url: app.globalData.skipUrl,
  152. })
  153. return;
  154. } else if (app.globalData.skip == 'switchTab') {
  155. tt.redirectTo({
  156. url: app.globalData.skipUrl,
  157. })
  158. return;
  159. } else if (app.globalData.skip == 'navigateBack') {
  160. tt.navigateBack({
  161. delta: 1,
  162. })
  163. return;
  164. }
  165. }
  166. //确认订单
  167. if (that.data.path == "qr") {
  168. tt.redirectTo({
  169. url: `/pages/coupon/confirmation/confirmation?couponChannelId=${that.data.couponChannelId}`
  170. })
  171. }
  172. //线上配送
  173. if (that.data.path == "fi") {
  174. tt.redirectTo({
  175. url: `/pages/fillIndent/fillIndent?id=${that.data.fillIndentId}&couponId=${that.data.couponId}`
  176. })
  177. }
  178. // 来着问卷
  179. if (that.data.path == "wj") {
  180. tt.redirectTo({
  181. url: `/pages/questionnaire/questionnaire?id=${that.data.wjId}`
  182. })
  183. return;
  184. }
  185. /**a
  186. * 来自我的
  187. */
  188. if (that.data.path == 'main') {
  189. tt.redirectTo({
  190. url: `/index/user`
  191. })
  192. return;
  193. }
  194. /**
  195. * 来自积分兑换
  196. */
  197. if (that.data.path == 'jifen') {
  198. tt.redirectTo({
  199. url: `/pages/integralmall/payIntegcoupondetail/index?couponChannelId=${that.data.paramData.couponChannelId}&couponId=${that.data.paramData.couponId}`
  200. })
  201. return;
  202. }
  203. /**
  204. * 来自拼团详情
  205. */
  206. if (that.data.path == 'spell') {
  207. if (that.data.paramData.avatarUrl) {
  208. tt.redirectTo({
  209. url: `/pages/joinFrDpell/index?couponId=${that.data.paramData.couponId}&orderGroupId=${that.data.paramData.orderGroupId}&couponChannelId=${that.data.paramData.couponChannelId}&orderId=${that.data.paramData.orderId}&avatarUrl=${that.data.paramData.avatarUrl}&nickName=${that.data.paramData.nickName}`
  210. })
  211. } else {
  212. tt.redirectTo({
  213. url: `/pages/spellGroup/mySpellGroup/index?couponId=${that.data.paramData.couponId}&couponChannelId=${that.data.paramData.couponChannelId}`
  214. })
  215. }
  216. return;
  217. }
  218. /**
  219. * fromId若存在来自卡转赠
  220. */
  221. if (that.data.path == 'index' && !that.data.paramData.cuserId) {
  222. tt.redirectTo({
  223. url: "/pages/game/index?url=" + that.data.paramData.url + "&id=" + that.data.paramData.id + "&gameId=" + that.data.paramData.gameId,
  224. })
  225. } else if (that.data.path == 'index' && that.data.paramData.cuserId) {
  226. tt.redirectTo({
  227. url: "/pages/coupon/detail/index?cuserId=" + that.data.paramData.cuserId + '&couponChannelId=' + that.data.paramData.couponChannelId + '&coverImg=' + that.data.paramData.coverImg + '&avatarUrl=' + that.data.paramData.avatarUrl + '&userName=' + that.data.paramData.userName + '&couponOrderId=' + that.data.paramData.couponOrderId + "&updateDate=" + that.data.paramData.updateDate + "&mallTenantId=" + that.data.mallTenantId,
  228. })
  229. }
  230. /**
  231. * 活动报名
  232. */
  233. else if (that.data.signActivity) {
  234. tt.redirectTo({
  235. url: `/pages/radetail/joinActivity/edit?activityId=${that.data.signActivity}`
  236. })
  237. } else if (that.data.mineFlag == 'mine') {
  238. tt.redirectTo({
  239. url: '/index/user'
  240. });
  241. } else if (that.data.mineFlag == 'index') {
  242. tt.redirectTo({
  243. url: app.globalData.goHomeUrl
  244. });
  245. } else {
  246. tt.showToast({
  247. title: res.data.msg,
  248. icon: "success",
  249. success: function (res) {
  250. if (that.data.couponChannelId) {
  251. tt.redirectTo({
  252. url: "/pages/coupon/detail/index?couponChannelId=" + that.data.couponChannelId + "&flag=pay" + "&mallTenantId=" + that.data.mallTenantId,
  253. })
  254. } else {
  255. tt.redirectTo({
  256. url: '/index/passCar',
  257. })
  258. }
  259. }
  260. });
  261. }
  262. }).catch(err => {
  263. tt.showToast({
  264. title: err.message,
  265. icon: 'none',
  266. duration: 2000,
  267. mask: false
  268. });
  269. })
  270. },
  271. });